| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8235c26 commit 5a8af3d
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,7 @@ const { | |||
| 43 | 43 | aggregateTwoErrors, | |
| 44 | 44 | } = require('internal/errors'); | |
| 45 | 45 | const { isArrayBufferView } = require('internal/util/types'); | |
| 46 | - const { rimrafPromises } = require('internal/fs/rimraf'); | ||
| 46 | + | ||
| 47 | 47 | const { | |
| 48 | 48 | constants: { | |
| 49 | 49 | kIoMaxLength, | |
@@ -93,6 +93,7 @@ const { | |||
| 93 | 93 | kEmptyObject, | |
| 94 | 94 | lazyDOMException, | |
| 95 | 95 | promisify, | |
| 96 | + getLazy, | ||
| 96 | 97 | } = require('internal/util'); | |
| 97 | 98 | const EventEmitter = require('events'); | |
| 98 | 99 | const { StringDecoder } = require('string_decoder'); | |
@@ -136,6 +137,8 @@ function lazyFsStreams() { | |||
| 136 | 137 | return fsStreams ??= require('internal/fs/streams'); | |
| 137 | 138 | } | |
| 138 | 139 | ||
| 140 | + const lazyRimRaf = getLazy(() => require('internal/fs/rimraf').rimrafPromises); | ||
| 141 | + | ||
| 139 | 142 | // By the time the C++ land creates an error for a promise rejection (likely from a | |
| 140 | 143 | // libuv callback), there is already no JS frames on the stack. So we need to | |
| 141 | 144 | // wait until V8 resumes execution back to JS land before we have enough information | |
@@ -804,7 +807,7 @@ async function ftruncate(handle, len = 0) { | |||
| 804 | 807 | async function rm(path, options) { | |
| 805 | 808 | path = pathModule.toNamespacedPath(getValidatedPath(path)); | |
| 806 | 809 | options = await validateRmOptionsPromise(path, options, false); | |
| 807 | - return rimrafPromises(path, options); | ||
| 810 | + return lazyRimRaf()(path, options); | ||
| 808 | 811 | } | |
| 809 | 812 | ||
| 810 | 813 | async function rmdir(path, options) { | |
@@ -815,7 +818,7 @@ async function rmdir(path, options) { | |||
| 815 | 818 | emitRecursiveRmdirWarning(); | |
| 816 | 819 | const stats = await stat(path); | |
| 817 | 820 | if (stats.isDirectory()) { | |
| 818 | - return rimrafPromises(path, options); | ||
| 821 | + return lazyRimRaf()(path, options); | ||
| 819 | 822 | } | |
| 820 | 823 | } | |
| 821 | 824 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments