Fix getLazy
- Fix getLazy not passing options to getModule - Fix rm, rmSync missing in fs - Remove useless code in searchExports iterator
This commit is contained in:
parent
af1a26c333
commit
a984bf08b0
|
@ -44,6 +44,14 @@ export function renameSync(oldPath, newPath) {
|
||||||
return fs.renameSync(oldPath, newPath);
|
return fs.renameSync(oldPath, newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function rm(pathToFile) {
|
||||||
|
return fs.rmSync(pathToFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function rmSync(pathToFile) {
|
||||||
|
return fs.rmSync(pathToFile);
|
||||||
|
}
|
||||||
|
|
||||||
export function unlinkSync(fileToDelete) {
|
export function unlinkSync(fileToDelete) {
|
||||||
return fs.unlinkSync(fileToDelete);
|
return fs.unlinkSync(fileToDelete);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,9 +168,6 @@ export default class WebpackModules {
|
||||||
let foundModule = null;
|
let foundModule = null;
|
||||||
const wrappedExport = exports[key];
|
const wrappedExport = exports[key];
|
||||||
if (!wrappedExport) continue;
|
if (!wrappedExport) continue;
|
||||||
if (wrappedExport.Z && wrappedFilter(wrappedExport.Z, module, index)) foundModule = defaultExport ? wrappedExport.Z : wrappedExport;
|
|
||||||
if (wrappedExport.ZP && wrappedFilter(wrappedExport.ZP, module, index)) foundModule = defaultExport ? wrappedExport.ZP : wrappedExport;
|
|
||||||
if (wrappedExport.__esModule && wrappedExport.default && wrappedFilter(wrappedExport.default, module, index)) foundModule = defaultExport ? wrappedExport.default : wrappedExport;
|
|
||||||
if (wrappedFilter(wrappedExport, module, index)) foundModule = wrappedExport;
|
if (wrappedFilter(wrappedExport, module, index)) foundModule = wrappedExport;
|
||||||
if (!foundModule) continue;
|
if (!foundModule) continue;
|
||||||
if (first) return foundModule;
|
if (first) return foundModule;
|
||||||
|
@ -228,9 +225,6 @@ export default class WebpackModules {
|
||||||
let foundModule = null;
|
let foundModule = null;
|
||||||
const wrappedExport = exports[key];
|
const wrappedExport = exports[key];
|
||||||
if (!wrappedExport) continue;
|
if (!wrappedExport) continue;
|
||||||
if (wrappedExport.Z && wrappedFilter(wrappedExport.Z, module, index)) foundModule = defaultExport ? wrappedExport.Z : wrappedExport;
|
|
||||||
if (wrappedExport.ZP && wrappedFilter(wrappedExport.ZP, module, index)) foundModule = defaultExport ? wrappedExport.ZP : wrappedExport;
|
|
||||||
if (wrappedExport.__esModule && wrappedExport.default && wrappedFilter(wrappedExport.default, module, index)) foundModule = defaultExport ? wrappedExport.default : wrappedExport;
|
|
||||||
if (wrappedFilter(wrappedExport, module, index)) foundModule = wrappedExport;
|
if (wrappedFilter(wrappedExport, module, index)) foundModule = wrappedExport;
|
||||||
if (!foundModule) continue;
|
if (!foundModule) continue;
|
||||||
if (first) returnedModules[q] = foundModule;
|
if (first) returnedModules[q] = foundModule;
|
||||||
|
@ -343,7 +337,7 @@ export default class WebpackModules {
|
||||||
*/
|
*/
|
||||||
static getLazy(filter, options = {}) {
|
static getLazy(filter, options = {}) {
|
||||||
const {signal: abortSignal, defaultExport = true, searchExports = false} = options;
|
const {signal: abortSignal, defaultExport = true, searchExports = false} = options;
|
||||||
const fromCache = this.getModule(filter);
|
const fromCache = this.getModule(filter, {defaultExport, searchExports});
|
||||||
if (fromCache) return Promise.resolve(fromCache);
|
if (fromCache) return Promise.resolve(fromCache);
|
||||||
|
|
||||||
const wrappedFilter = wrapFilter(filter);
|
const wrappedFilter = wrapFilter(filter);
|
||||||
|
@ -359,9 +353,6 @@ export default class WebpackModules {
|
||||||
foundModule = null;
|
foundModule = null;
|
||||||
const wrappedExport = exports[key];
|
const wrappedExport = exports[key];
|
||||||
if (!wrappedExport) continue;
|
if (!wrappedExport) continue;
|
||||||
if (wrappedExport.Z && wrappedFilter(wrappedExport.Z)) foundModule = defaultExport ? wrappedExport.Z : wrappedExport;
|
|
||||||
if (wrappedExport.ZP && wrappedFilter(wrappedExport.ZP)) foundModule = defaultExport ? wrappedExport.ZP : wrappedExport;
|
|
||||||
if (wrappedExport.__esModule && wrappedExport.default && wrappedFilter(wrappedExport.default)) foundModule = defaultExport ? wrappedExport.default : wrappedExport;
|
|
||||||
if (wrappedFilter(wrappedExport)) foundModule = wrappedExport;
|
if (wrappedFilter(wrappedExport)) foundModule = wrappedExport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,20 @@ export const rmdirSync = function (path, options) {
|
||||||
Remote.filesystem.deleteDirectory(path, options);
|
Remote.filesystem.deleteDirectory(path, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const rm = function (path, options, callback) {
|
||||||
|
try {
|
||||||
|
const result = Remote.filesystem.rm(path, options);
|
||||||
|
callback(null, result);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
callback(error, null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const rmSync = function (path, options) {
|
||||||
|
Remote.filesystem.rmSync(path, options);
|
||||||
|
};
|
||||||
|
|
||||||
export const exists = function (path, options, callback) {
|
export const exists = function (path, options, callback) {
|
||||||
try {
|
try {
|
||||||
const result = Remote.filesystem.exists(path, options);
|
const result = Remote.filesystem.exists(path, options);
|
||||||
|
@ -161,6 +175,8 @@ export default {
|
||||||
realpathSync,
|
realpathSync,
|
||||||
rename,
|
rename,
|
||||||
renameSync,
|
renameSync,
|
||||||
|
rm,
|
||||||
|
rmSync,
|
||||||
rmdir,
|
rmdir,
|
||||||
rmdirSync,
|
rmdirSync,
|
||||||
unlink,
|
unlink,
|
||||||
|
|
Loading…
Reference in New Issue