@lwc/module-resolver
Advanced tools
Comparing version 0.35.11 to 0.35.12
{ | ||
"name": "@lwc/module-resolver", | ||
"description": "Resolves paths for LWC components", | ||
"version": "0.35.11", | ||
"main": "./src/index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"glob": "^7.1.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "59298cd9789d1beca3c32529eaa56e7cf1de3466" | ||
"name": "@lwc/module-resolver", | ||
"description": "Resolves paths for LWC components", | ||
"version": "0.35.12", | ||
"main": "./src/index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"glob": "^7.1.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "3b3c278249e7751aea87e8e0b877eaa231dde808" | ||
} |
@@ -12,3 +12,5 @@ /* | ||
describe('simple folder structure', () => { | ||
const simpleStructurePath = path.resolve(path.join(__dirname, 'fixtures/simple-folder-structure')); | ||
const simpleStructurePath = path.resolve( | ||
path.join(__dirname, 'fixtures/simple-folder-structure') | ||
); | ||
@@ -15,0 +17,0 @@ it('default resolution', () => { |
@@ -14,3 +14,3 @@ /* | ||
moduleDirectories: ['fake_node_modules'], | ||
rootDir: path.join(__dirname, 'fixtures') | ||
rootDir: path.join(__dirname, 'fixtures'), | ||
}; | ||
@@ -21,4 +21,9 @@ | ||
expect(lwcModuleNames).toHaveLength(4); | ||
expect(lwcModuleNames).toContain('alias-fake-package', 'fake-module1', 'fake-module2', 'other-resource'); | ||
}) | ||
expect(lwcModuleNames).toContain( | ||
'alias-fake-package', | ||
'fake-module1', | ||
'fake-module2', | ||
'other-resource' | ||
); | ||
}); | ||
}); |
@@ -26,3 +26,3 @@ /* | ||
config = fs.readFileSync(lwcConfigPath, 'utf8'); | ||
} catch(e) { | ||
} catch (e) { | ||
config = jsonPkg.lwc; | ||
@@ -44,3 +44,3 @@ } | ||
moduleName: null, | ||
moduleNamespace: DEFAULT_NS | ||
moduleNamespace: DEFAULT_NS, | ||
}; | ||
@@ -79,3 +79,3 @@ | ||
if (Array.isArray(modules)) { | ||
modules.forEach((modulePath) => resolveModules(modulePath, opts)); | ||
modules.forEach(modulePath => resolveModules(modulePath, opts)); | ||
} else { | ||
@@ -85,3 +85,3 @@ const { mappings, visited, moduleRoot, lwcConfig } = opts; | ||
const packageEntries = resolveModulesInDir(path.join(moduleRoot, modules), lwcConfig); | ||
Object.keys(packageEntries).forEach((moduleName) => { | ||
Object.keys(packageEntries).forEach(moduleName => { | ||
if (!hasModuleBeenVisited(moduleName, visited)) { | ||
@@ -93,3 +93,3 @@ mappings[moduleName] = packageEntries[moduleName]; | ||
} else { | ||
Object.keys(modules).forEach((moduleName) => { | ||
Object.keys(modules).forEach(moduleName => { | ||
if (!hasModuleBeenVisited(moduleName, visited)) { | ||
@@ -110,16 +110,18 @@ const modulePath = path.join(moduleRoot, modules[moduleName]); | ||
return modulePaths.reduce((m, nodeModulesDir) => { | ||
return glob.sync(PACKAGE_PATTERN, { cwd: nodeModulesDir, ignore: ['**/node_modules/**'] }).reduce((mappings, file) => { | ||
const moduleRoot = path.dirname(path.join(nodeModulesDir, file)); | ||
const lwcConfig = loadLwcConfig(moduleRoot); | ||
return glob | ||
.sync(PACKAGE_PATTERN, { cwd: nodeModulesDir, ignore: ['**/node_modules/**'] }) | ||
.reduce((mappings, file) => { | ||
const moduleRoot = path.dirname(path.join(nodeModulesDir, file)); | ||
const lwcConfig = loadLwcConfig(moduleRoot); | ||
if (lwcConfig) { | ||
resolveModules(lwcConfig.modules, {mappings, visited, moduleRoot, lwcConfig }); | ||
} | ||
if (lwcConfig) { | ||
resolveModules(lwcConfig.modules, { mappings, visited, moduleRoot, lwcConfig }); | ||
} | ||
return mappings; | ||
}, m); | ||
return mappings; | ||
}, m); | ||
}, {}); | ||
} | ||
exports.resolveLwcNpmModules = resolveLwcNpmModules | ||
exports.resolveLwcNpmModules = resolveLwcNpmModules; | ||
exports.resolveModulesInDir = resolveModulesInDir; |
@@ -39,3 +39,3 @@ /* | ||
return path.join(prefix, aPath, moduleDir); | ||
}), | ||
}) | ||
); | ||
@@ -45,2 +45,2 @@ }, []); | ||
return dirs; | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9565
205