diff --git a/packages/@lwc/compiler/src/rollup-plugins/module-resolver.ts b/packages/@lwc/compiler/src/rollup-plugins/module-resolver.ts index a7ac9ce8ab..7b7118aea1 100755 --- a/packages/@lwc/compiler/src/rollup-plugins/module-resolver.ts +++ b/packages/@lwc/compiler/src/rollup-plugins/module-resolver.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import * as path from 'path'; +import path from 'path'; import { Plugin } from 'rollup'; import { ModuleResolutionErrors, generateCompilerError } from '@lwc/errors'; diff --git a/packages/@lwc/engine/package.json b/packages/@lwc/engine/package.json index 1c7344c777..434169dca4 100644 --- a/packages/@lwc/engine/package.json +++ b/packages/@lwc/engine/package.json @@ -23,9 +23,12 @@ "@lwc/template-compiler": "1.0.2" }, "lwc": { - "modules": { - "lwc": "dist/engine.js" - } + "modules": [ + { + "name": "lwc", + "path": "dist/engine.js" + } + ] }, "publishConfig": { "access": "public" diff --git a/packages/@lwc/module-resolver/CONTRIBUTING.md b/packages/@lwc/module-resolver/CONTRIBUTING.md deleted file mode 100644 index 63b4515e9b..0000000000 --- a/packages/@lwc/module-resolver/CONTRIBUTING.md +++ /dev/null @@ -1,3 +0,0 @@ -# Contributing - -Please refer to Lightning Web Components contributing guide [here](https://github.com/salesforce/lwc/blob/master/CONTRIBUTING.md). diff --git a/packages/@lwc/module-resolver/package.json b/packages/@lwc/module-resolver/package.json index 5f72fb4ddc..55dba25599 100644 --- a/packages/@lwc/module-resolver/package.json +++ b/packages/@lwc/module-resolver/package.json @@ -8,9 +8,6 @@ "build": "tsc" }, "license": "MIT", - "dependencies": { - "fast-glob": "~2.2.6" - }, "files": [ "dist/" ], diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/custom-override.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/custom-override.js new file mode 100644 index 0000000000..8e1c8ce99d --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/custom-override.js @@ -0,0 +1 @@ +export const x = 2; \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/custom/module.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/custom/module.js new file mode 100644 index 0000000000..856e96622d --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/custom/module.js @@ -0,0 +1 @@ +export const x = 1; \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/lwc.config.json b/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/lwc.config.json new file mode 100644 index 0000000000..016bf27ae1 --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/custom-resolution/lwc.config.json @@ -0,0 +1,8 @@ +{ + "modules": [ + { + "name": "custom-module", + "path": "custom/module.js" + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-module-package/package.json b/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-module-package/package.json deleted file mode 100644 index c074fa583d..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-module-package/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "fake-module-package", - "lwc": { - "modules": { - "alias-fake-package": "/fake/package" - } - } -} diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/other/resource.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/other/resource.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/package.json b/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/package.json deleted file mode 100644 index b9a076f7d5..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "fake-multi-component", - "lwc": { - "modules": [ - "src", - { "other-resource": "other/resource.js" } - ] - } -} diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/src/fake/module1/module1.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/src/fake/module1/module1.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/src/fake/module2/module2.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/fake_node_modules/fake-multi-component/src/fake/module2/module2.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/from-npm/lwc.config.json b/packages/@lwc/module-resolver/src/__tests__/fixtures/from-npm/lwc.config.json new file mode 100644 index 0000000000..65ebe6b0bd --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/from-npm/lwc.config.json @@ -0,0 +1,7 @@ +{ + "modules": [ + "@lwc/engine", + "@lwc/wire-service", + "@lwc/synthetic-shadow" + ] +} \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/lwc.config.json b/packages/@lwc/module-resolver/src/__tests__/fixtures/lwc.config.json new file mode 100644 index 0000000000..88858e80de --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/lwc.config.json @@ -0,0 +1,5 @@ +{ + "modules": [ + "module-entries/" + ] +} \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/cssEntry/cssEntry.css b/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/cssEntry/cssEntry.css new file mode 100644 index 0000000000..33f8a24bfd --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/cssEntry/cssEntry.css @@ -0,0 +1 @@ +export const test = 1; \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/htmlEntry/htmlEntry.html b/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/htmlEntry/htmlEntry.html new file mode 100644 index 0000000000..af9fa97fa9 --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/htmlEntry/htmlEntry.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/jsEntry/jsEntry.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/jsEntry/jsEntry.js new file mode 100644 index 0000000000..33f8a24bfd --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/fixtures/module-entries/ns/jsEntry/jsEntry.js @@ -0,0 +1 @@ +export const test = 1; \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/cssModule/cssModule.css b/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/cssModule/cssModule.css deleted file mode 100644 index 77a4631d57..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/cssModule/cssModule.css +++ /dev/null @@ -1,3 +0,0 @@ -:host { - color : blue; -} \ No newline at end of file diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/missmatched-name/missmatchedname.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/missmatched-name/missmatchedname.js deleted file mode 100644 index cbc8cc96cb..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/missmatched-name/missmatchedname.js +++ /dev/null @@ -1 +0,0 @@ -// purposely empty diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/prefixed-module-name/module-name.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/prefixed-module-name/module-name.js deleted file mode 100644 index cbc8cc96cb..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/prefixed-module-name/module-name.js +++ /dev/null @@ -1 +0,0 @@ -// purposely empty diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simple-module/simple-module.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simple-module/simple-module.js deleted file mode 100644 index cbc8cc96cb..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simple-module/simple-module.js +++ /dev/null @@ -1 +0,0 @@ -// purposely empty diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simpleCmp/simpleCmp.html b/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simpleCmp/simpleCmp.html deleted file mode 100644 index cc340bc4c9..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simpleCmp/simpleCmp.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simpleCmp/simpleCmp.js b/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simpleCmp/simpleCmp.js deleted file mode 100644 index cbc8cc96cb..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/fixtures/simple-folder-structure/modules/ns/simpleCmp/simpleCmp.js +++ /dev/null @@ -1 +0,0 @@ -// purposely empty diff --git a/packages/@lwc/module-resolver/src/__tests__/resolve-dir-modules.spec.js b/packages/@lwc/module-resolver/src/__tests__/resolve-dir-modules.spec.js deleted file mode 100644 index 032e55c8f0..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/resolve-dir-modules.spec.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * SPDX-License-Identifier: MIT - * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT - */ -const path = require('path'); -const lwcResolver = require('../index'); - -describe('resolve-src-modules', () => { - describe('simple folder structure', () => { - const simpleStructurePath = path.resolve( - path.join(__dirname, 'fixtures/simple-folder-structure') - ); - - it('default resolution', () => { - const modules = lwcResolver.resolveModulesInDir(simpleStructurePath); - const moduleNames = Object.keys(modules); - expect(moduleNames).toHaveLength(3); - expect(moduleNames).toEqual( - expect.arrayContaining(['ns/cssModule', 'ns/simpleCmp', 'ns/simple-module']) - ); - }); - }); -}); diff --git a/packages/@lwc/module-resolver/src/__tests__/resolve-lwc-modules.spec.js b/packages/@lwc/module-resolver/src/__tests__/resolve-lwc-modules.spec.js deleted file mode 100644 index 3916d4e298..0000000000 --- a/packages/@lwc/module-resolver/src/__tests__/resolve-lwc-modules.spec.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * SPDX-License-Identifier: MIT - * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT - */ -const path = require('path'); -const lwcResolver = require('../index'); - -describe('resolve-lwc-npm-modules', () => { - it('resolve from npm', () => { - const resolverOptions = { - moduleDirectories: ['fake_node_modules'], - rootDir: path.join(__dirname, 'fixtures'), - }; - - const lwcModules = lwcResolver.resolveLwcNpmModules(resolverOptions); - const lwcModuleNames = Object.keys(lwcModules); - expect(lwcModuleNames).toHaveLength(4); - expect(lwcModuleNames).toEqual( - expect.arrayContaining([ - 'alias-fake-package', - 'fake/module1', - 'fake/module2', - 'other-resource', - ]) - ); - }); - it('resolve from npm: modulePaths options', () => { - const resolverOptions = { - modulePaths: [path.join(__dirname, 'fixtures', 'fake_node_modules')], - }; - - const lwcModules = lwcResolver.resolveLwcNpmModules(resolverOptions); - const lwcModuleNames = Object.keys(lwcModules); - expect(lwcModuleNames).toHaveLength(4); - expect(lwcModuleNames).toEqual( - expect.arrayContaining([ - 'alias-fake-package', - 'fake/module1', - 'fake/module2', - 'other-resource', - ]) - ); - }); - it('resolve from npm: ignorePattern', () => { - const resolverOptions = { - modulePaths: [path.join(__dirname, 'fixtures', 'fake_node_modules')], - ignorePatterns: ['**/fake-module-package/**'], - }; - - const lwcModules = lwcResolver.resolveLwcNpmModules(resolverOptions); - const lwcModuleNames = Object.keys(lwcModules); - expect(lwcModuleNames).toHaveLength(3); - expect(lwcModuleNames).toEqual( - expect.arrayContaining(['fake/module1', 'fake/module2', 'other-resource']) - ); - }); - it('resolve from npm: modulePaths has direct package.json folder reference', () => { - const resolverOptions = { - modulePaths: [ - path.join(__dirname, 'fixtures', 'fake_node_modules', 'fake-multi-component'), - ], - }; - - const lwcModules = lwcResolver.resolveLwcNpmModules(resolverOptions); - const lwcModuleNames = Object.keys(lwcModules); - expect(lwcModuleNames).toHaveLength(3); - expect(lwcModuleNames).toEqual( - expect.arrayContaining(['fake/module1', 'fake/module2', 'other-resource']) - ); - }); -}); diff --git a/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts b/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts new file mode 100644 index 0000000000..e511c71590 --- /dev/null +++ b/packages/@lwc/module-resolver/src/__tests__/resolve.modules.spec.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018, salesforce.com, inc. + * All rights reserved. + * SPDX-License-Identifier: MIT + * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT + */ + +import path from 'path'; +import { resolveModules } from '../index'; + +const FIXTURE_MODULE_ENTRIES = ['ns/cssEntry', 'ns/htmlEntry', 'ns/jsEntry']; + +describe('resolve modules', () => { + it('from directory', () => { + const modules = resolveModules({ + rootDir: __dirname, + modules: ['fixtures/module-entries'], + }); + const specifiers = modules.map(m => m.specifier); + expect(specifiers).toStrictEqual(FIXTURE_MODULE_ENTRIES); + }); + + it('from config', () => { + const moduleDir = path.join(__dirname, 'fixtures'); + const modules = resolveModules({ rootDir: moduleDir }); + const specifiers = modules.map(m => m.specifier); + expect(specifiers).toStrictEqual(FIXTURE_MODULE_ENTRIES); + }); + + it('from config resolving to npm', () => { + const moduleDir = path.join(__dirname, 'fixtures/from-npm'); + const modules = resolveModules({ rootDir: moduleDir }); + const specifiers = modules.map(m => m.specifier); + expect(specifiers).toStrictEqual(['lwc', 'wire-service', '@lwc/synthetic-shadow']); + }); + + it('from config resolving to custom modules', () => { + const moduleDir = path.join(__dirname, 'fixtures/custom-resolution'); + const modules = resolveModules({ rootDir: moduleDir }); + const specifiers = modules.map(m => m.specifier); + expect(specifiers).toStrictEqual(['custom-module']); + }); + + it('with configuration overrides resolving to custom modules', () => { + const moduleDir = path.join(__dirname, 'fixtures/custom-resolution'); + const modules = resolveModules({ + rootDir: moduleDir, + modules: [{ name: 'custom-module', path: 'custom-override.js' }], + }); + const specifiers = modules.map(m => m.specifier); + const entries = modules.map(m => m.entry); + expect(specifiers).toStrictEqual(['custom-module']); + expect(entries).toStrictEqual([path.join(moduleDir, 'custom-override.js')]); + }); + + it('from api configuration', () => { + const modules = resolveModules({ modules: ['@lwc/engine'] }); + const specifiers = modules.map(m => m.specifier); + expect(specifiers).toStrictEqual(['lwc']); + }); +}); diff --git a/packages/@lwc/module-resolver/src/index.ts b/packages/@lwc/module-resolver/src/index.ts index b82e6d53d0..291681941b 100644 --- a/packages/@lwc/module-resolver/src/index.ts +++ b/packages/@lwc/module-resolver/src/index.ts @@ -6,154 +6,115 @@ */ /* eslint-env node */ -import glob from 'fast-glob'; import path from 'path'; import fs from 'fs'; -import nodeModulePaths from './node-modules-paths'; - -const DEFAULT_IGNORE = ['**/node_modules/**', '**/__tests__/**']; -const PACKAGE_PATTERN = ['*/*/package.json', '*/package.json', 'package.json']; -const MODULE_ENTRY_PATTERN = `**/*.([jt]s|html|css)`; -const LWC_CONFIG_FILE = '.lwcrc'; +import { + getModuleEntry, + normalizeConfig, + loadConfig, + isString, + mergeModules, + LWC_CONFIG_FILE, +} from './utils'; export interface RegistryEntry { entry: string; - moduleSpecifier: string; - moduleName: string; - moduleNamespace: string; + specifier: string; } -export interface ModuleResolverConfig { - moduleDirectories: string[]; - rootDir: string; - modulePaths: string[]; - ignorePatterns?: string[]; +export interface ModuleRegistryMap { + [key: string]: RegistryEntry; } - -interface FlatEntry { +export interface ModuleRecordObject { + name: string; path: string; } -function createRegistryEntry(entry, moduleSpecifier, moduleName, moduleNamespace): RegistryEntry { - return { entry, moduleSpecifier, moduleName, moduleNamespace }; +export interface ModuleResolverConfig { + rootDir: string; + modules: ModuleRecord[]; } -function loadLwcConfig(modulePath) { - const packageJsonPath = path.join(modulePath, 'package.json'); - const lwcConfigPath = path.join(modulePath, LWC_CONFIG_FILE); - let config; - try { - config = JSON.parse(fs.readFileSync(lwcConfigPath, 'utf8')); - } catch (ignore) { - // ignore - } - if (!config) { - try { - config = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).lwc; - } catch (ignore) { - // ignore - } - } - return config; +export type ModuleRecord = string | ModuleRecordObject; +export interface LwcConfig { + modules: ModuleRecord[]; } -export function resolveModulesInDir(absPath: string): { [name: string]: RegistryEntry } { - return glob - .sync(MODULE_ENTRY_PATTERN, { - cwd: absPath, - transform: entry => - typeof entry === 'string' ? { path: entry } : { path: entry.path }, - }) - .reduce((mappings, { path: file }) => { - const ext = path.extname(file); - const fileName = path.basename(file, ext); - const rootDir = path.dirname(file); - const rootParts = rootDir.split('/'); // the glob library normalizes paths to forward slashes only - https://github.com/isaacs/node-glob#windows - const entry = path.join(absPath, file); - - const dirModuleName = rootParts.pop(); - const dirModuleNamespace = rootParts.pop(); - if (dirModuleNamespace && dirModuleName === fileName) { - const registryNode = createRegistryEntry( - entry, - `${dirModuleNamespace}/${fileName}`, - fileName, - dirModuleNamespace.toLowerCase() - ); - mappings[registryNode.moduleSpecifier] = registryNode; - } +function resolveModulesFromDir(modulesDir: string): RegistryEntry[] { + const namespaces = fs.readdirSync(modulesDir); + const resolvedModules: RegistryEntry[] = []; + namespaces.forEach(ns => { + if (ns[0] !== '.' && fs.lstatSync(path.join(modulesDir, ns)).isDirectory()) { + const namespacedModuleDir = path.join(modulesDir, ns); + const modules = fs.readdirSync(namespacedModuleDir); + modules.forEach(moduleName => { + const moduleDir = path.join(namespacedModuleDir, moduleName); + const entry = getModuleEntry(moduleDir, moduleName); + if (entry) { + const specifier = `${ns}/${moduleName}`; + resolvedModules.push({ entry, specifier }); + } + }); + } + }); - return mappings; - }, {}); + return resolvedModules; } -function hasModuleBeenVisited(module, visited) { - return visited.has(module); -} +function resolveModulesFromNpm(packageName: string): RegistryEntry[] { + let resolvedModules: RegistryEntry[] = []; + try { + const pkgJsonPath = require.resolve(`${packageName}/package.json`); + const packageDir = path.dirname(pkgJsonPath); + const lwcConfigFile = path.join(packageDir, LWC_CONFIG_FILE); -function expandModuleDirectories({ - moduleDirectories, - rootDir, - modulePaths, -}: Partial = {}) { - if (modulePaths) { - return modulePaths; - } - if (!moduleDirectories && !rootDir) { - // paths() is spec'd to return null only for built-in node - // modules like 'http'. To be safe, return empty array in - // instead of null in this case. - return require.resolve.paths('.') || []; + if (fs.existsSync(lwcConfigFile)) { + resolvedModules = resolveModules({ rootDir: lwcConfigFile }); + } else { + const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')); + if (pkgJson.lwc) { + resolvedModules = resolveModulesFromList(pkgJson.lwc.modules, { root: packageDir }); + } + } + } catch (e) { + /*noop*/ } - return nodeModulePaths(rootDir || __dirname, moduleDirectories); + return resolvedModules; } -function resolveModules(modules, opts) { - if (Array.isArray(modules)) { - modules.forEach(modulePath => resolveModules(modulePath, opts)); - } else { - const { mappings, visited, moduleRoot } = opts; - if (typeof modules === 'string') { - const packageEntries = resolveModulesInDir(path.join(moduleRoot, modules)); - Object.keys(packageEntries).forEach(moduleName => { - if (!hasModuleBeenVisited(moduleName, visited)) { - mappings[moduleName] = packageEntries[moduleName]; - visited.add(moduleName); - } - }); +function resolveModulesFromList( + modules: ModuleRecord[], + { root }: { root: string } +): RegistryEntry[] { + const resolvedModules: RegistryEntry[] = []; + modules.forEach(moduleId => { + if (!isString(moduleId)) { + const { name: specifier, path: modulePath } = moduleId as ModuleRecordObject; + const entry = path.resolve(root, modulePath); + if (fs.existsSync(entry)) { + resolvedModules.push({ entry, specifier }); + } } else { - Object.keys(modules).forEach(moduleName => { - if (!hasModuleBeenVisited(moduleName, visited)) { - const modulePath = path.join(moduleRoot, modules[moduleName]); - mappings[moduleName] = { moduleSpecifier: moduleName, entry: modulePath }; - visited.add(moduleName); - } - }); + const absPath = path.resolve(root, moduleId as string); + // If the moduleRecord is a string check first in the file directory + if (fs.existsSync(absPath)) { + resolvedModules.push(...resolveModulesFromDir(absPath)); + } else { + // Otherwise, try to see if is an npm package + resolvedModules.push(...resolveModulesFromNpm(moduleId as string)); + } } - } -} - -export function resolveLwcNpmModules(options: Partial = {}) { - const visited = new Set(); - const modulePaths = expandModuleDirectories(options); - return modulePaths.reduce((m, nodeModulesDir) => { - return glob - .sync(PACKAGE_PATTERN, { - cwd: nodeModulesDir, - ignore: options.ignorePatterns || DEFAULT_IGNORE, - transform: entry => - typeof entry === 'string' ? { path: entry } : { path: entry.path }, - }) - .reduce((mappings, { path: file }) => { - const moduleRoot = path.dirname(path.join(nodeModulesDir, file)); - const lwcConfig = loadLwcConfig(moduleRoot); + }); - if (lwcConfig) { - resolveModules(lwcConfig.modules, { mappings, visited, moduleRoot, lwcConfig }); - } + return resolvedModules; +} - return mappings; - }, m); - }, {}); +export function resolveModules( + resolverConfig: Partial = {} +): RegistryEntry[] { + const normalizedConfig = normalizeConfig(resolverConfig); + const rootConfig = loadConfig(normalizedConfig.rootDir); + const modules = mergeModules(normalizedConfig.modules, rootConfig.modules); + return resolveModulesFromList(modules, { root: normalizedConfig.rootDir }); } diff --git a/packages/@lwc/module-resolver/src/node-modules-paths.ts b/packages/@lwc/module-resolver/src/node-modules-paths.ts deleted file mode 100644 index b3efe9e44d..0000000000 --- a/packages/@lwc/module-resolver/src/node-modules-paths.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * SPDX-License-Identifier: MIT - * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT - */ -/** - * Adapted from Jest, which is adapted from: - * https://github.com/browserify/resolve - */ - -import path from 'path'; - -export default function nodeModulesPaths(basedir: string, moduleDirectory: string[] | undefined) { - const modules: string[] = moduleDirectory ? [...moduleDirectory] : ['node_modules']; - - // ensure that `basedir` is an absolute path at this point, - // resolving against the process' current working directory - const basedirAbs = path.resolve(basedir); - - let prefix = '/'; - if (/^([A-Za-z]:)/.test(basedirAbs)) { - prefix = ''; - } else if (/^\\\\/.test(basedirAbs)) { - prefix = '\\\\'; - } - - const paths = [basedirAbs]; - let parsed = path.parse(basedirAbs); - while (parsed.dir !== paths[paths.length - 1]) { - paths.push(parsed.dir); - parsed = path.parse(parsed.dir); - } - - const dirs = paths.reduce((dirs: string[], aPath) => { - return dirs.concat( - modules.map(moduleDir => { - return path.join(prefix, aPath, moduleDir); - }) - ); - }, []); - - return dirs; -} diff --git a/packages/@lwc/module-resolver/src/utils.ts b/packages/@lwc/module-resolver/src/utils.ts new file mode 100644 index 0000000000..3b6aae9c16 --- /dev/null +++ b/packages/@lwc/module-resolver/src/utils.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2018, salesforce.com, inc. + * All rights reserved. + * SPDX-License-Identifier: MIT + * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT + */ +import fs from 'fs'; +import path from 'path'; +import { LwcConfig, ModuleResolverConfig, ModuleRecord, ModuleRecordObject } from '.'; + +export const LWC_CONFIG_FILE = 'lwc.config.json'; + +const DEFAULT_CONFIG: LwcConfig = { modules: [] }; + +export function isString(str) { + return Object.prototype.toString.call(str) === '[object String]'; +} + +export function loadConfig(configPath: string): LwcConfig { + const configFile = path.join(configPath, LWC_CONFIG_FILE); + if (!fs.existsSync(configFile)) { + return DEFAULT_CONFIG; + } + + try { + return JSON.parse(fs.readFileSync(path.join(configPath, LWC_CONFIG_FILE), 'utf8')); + } catch (e) { + return DEFAULT_CONFIG; + } +} + +export function getEntry(moduleDir, moduleName, ext) { + return path.join(moduleDir, `${moduleName}.${ext}`); +} + +export function getModuleEntry(moduleDir, moduleName) { + const entryJS = getEntry(moduleDir, moduleName, 'js'); + const entryHTML = getEntry(moduleDir, moduleName, 'html'); + const entryCSS = getEntry(moduleDir, moduleName, 'css'); + + if (fs.existsSync(entryJS)) { + return entryJS; + } else if (fs.existsSync(entryHTML)) { + return entryHTML; + } else if (fs.existsSync(entryCSS)) { + return entryCSS; + } +} + +export function normalizeConfig(config: Partial): ModuleResolverConfig { + const rootDir = config.rootDir ? path.resolve(config.rootDir) : process.cwd(); + const modules = config.modules || []; + return { + ...DEFAULT_CONFIG, + modules, + rootDir, + }; +} + +// The modules can be either string or ModuleRecordObject { name, path } +// +// user define modules will have precedence over the ones defined elsewhere (ex. npm) +export function mergeModules(userModules: ModuleRecord[], configModules: ModuleRecord[]) { + const visited = new Set(); + const modules = userModules; + + // Visit the user modules to created an index with the name as keys + userModules.forEach(m => { + visited.add(isString(m) ? m : (m as ModuleRecordObject).name); + }); + + configModules.forEach(m => { + // Collect all of the modules unless they been already defined in userland + if (isString(m) || !visited.has((m as ModuleRecordObject).name)) { + modules.push(m); + } + }); + + return modules; +} diff --git a/packages/@lwc/rollup-plugin/README.md b/packages/@lwc/rollup-plugin/README.md index 6e25ab8b7a..548460ba90 100644 --- a/packages/@lwc/rollup-plugin/README.md +++ b/packages/@lwc/rollup-plugin/README.md @@ -8,8 +8,6 @@ Rollup plugin to compile LWC yarn add --dev @lwc/rollup-plugin ``` -Note that both `@lwc/engine` and `@lwc/compiler` are peer dependencies of this plugin that need to be installed separately. - ## Usage ```js @@ -24,7 +22,7 @@ export default { ## Options -- `rootDir` (string, optional, default: `input`) - set the LWC module directory +- `rootDir` (string, optional, default: `input directory`) - set the LWC module directory - `sourcemap` (boolean, optional, default: `false`) - make the LWC compiler produce source maps -- `resolveFromPackages` (boolean, optional, default: `true`) - let the rollup plugin resolve modules from the `node_modules` directory +- `modules` Mapping of module specifiers. - `stylesheetConfig` (object, optional, default: `{}`) - the configuration to pass to the `@lwc/style-compiler` diff --git a/packages/@lwc/rollup-plugin/src/constants.js b/packages/@lwc/rollup-plugin/src/constants.js index 47680f7f2c..8d2d754ab8 100644 --- a/packages/@lwc/rollup-plugin/src/constants.js +++ b/packages/@lwc/rollup-plugin/src/constants.js @@ -7,12 +7,13 @@ const DEFAULT_MODE = 'dev'; const DEFAULT_OPTIONS = { mode: DEFAULT_MODE, - resolveFromSource: true, - resolveFromPackages: true, sourcemap: false, }; +const DEFAULT_MODULES = ['@lwc/engine', '@lwc/synthetic-shadow', '@lwc/wire-service']; + module.exports = { DEFAULT_OPTIONS, DEFAULT_MODE, + DEFAULT_MODULES, }; diff --git a/packages/@lwc/rollup-plugin/src/index.js b/packages/@lwc/rollup-plugin/src/index.js index 8f7b9b78a3..31de049725 100644 --- a/packages/@lwc/rollup-plugin/src/index.js +++ b/packages/@lwc/rollup-plugin/src/index.js @@ -10,7 +10,7 @@ const compiler = require('@lwc/compiler'); const pluginUtils = require('rollup-pluginutils'); const lwcResolver = require('@lwc/module-resolver'); const { getModuleQualifiedName } = require('./utils'); -const { DEFAULT_OPTIONS, DEFAULT_MODE } = require('./constants'); +const { DEFAULT_OPTIONS, DEFAULT_MODE, DEFAULT_MODULES } = require('./constants'); const IMPLICIT_DEFAULT_HTML_PATH = '@lwc/resources/empty_html.js'; const EMPTY_IMPLICIT_HTML_CONTENT = 'export default void 0'; @@ -28,7 +28,6 @@ module.exports = function rollupLwcCompiler(pluginOptions = {}) { const { include, exclude } = pluginOptions; const filter = pluginUtils.createFilter(include, exclude); const mergedPluginOptions = Object.assign({}, DEFAULT_OPTIONS, pluginOptions); - const { resolveFromPackages, resolveFromSource } = mergedPluginOptions; // Closure to store the resolved modules let modulePaths = {}; @@ -36,17 +35,12 @@ module.exports = function rollupLwcCompiler(pluginOptions = {}) { return { name: 'rollup-plugin-lwc-compiler', - options(rollupOptions) { - modulePaths = {}; - const entry = rollupOptions.input || rollupOptions.entry; - const entryDir = mergedPluginOptions.rootDir || path.dirname(entry); - const externalPaths = resolveFromPackages - ? lwcResolver.resolveLwcNpmModules(mergedPluginOptions) - : {}; - const sourcePaths = resolveFromSource - ? lwcResolver.resolveModulesInDir(entryDir, mergedPluginOptions) - : {}; - Object.assign(modulePaths, externalPaths, sourcePaths); + options({ input }) { + const { modules: userModules = [], rootDir } = mergedPluginOptions; + const defaultSrc = path.dirname(input); + const modules = [...userModules, ...DEFAULT_MODULES, rootDir || defaultSrc]; + const resolvedModules = lwcResolver.resolveModules({ rootDir, modules }); + modulePaths = resolvedModules.reduce((map, m) => ((map[m.specifier] = m), map), {}); }, resolveId(importee, importer) { diff --git a/packages/@lwc/synthetic-shadow/package.json b/packages/@lwc/synthetic-shadow/package.json index fa645b632c..ab5764a1b1 100644 --- a/packages/@lwc/synthetic-shadow/package.json +++ b/packages/@lwc/synthetic-shadow/package.json @@ -16,9 +16,12 @@ "dist/" ], "lwc": { - "modules": { - "@lwc/synthetic-shadow": "dist/synthetic-shadow.js" - } + "modules": [ + { + "name": "@lwc/synthetic-shadow", + "path": "dist/synthetic-shadow.js" + } + ] }, "publishConfig": { "access": "public" diff --git a/packages/@lwc/wire-service/package.json b/packages/@lwc/wire-service/package.json index 27e1322952..66d5420701 100644 --- a/packages/@lwc/wire-service/package.json +++ b/packages/@lwc/wire-service/package.json @@ -24,9 +24,12 @@ "@lwc/rollup-plugin": "1.0.2" }, "lwc": { - "modules": { - "wire-service": "dist/wire-service.js" - } + "modules": [ + { + "name": "wire-service", + "path": "dist/wire-service.js" + } + ] }, "publishConfig": { "access": "public" diff --git a/packages/perf-benchmarks/package.json b/packages/perf-benchmarks/package.json index 1955a41dcf..116294e8e9 100644 --- a/packages/perf-benchmarks/package.json +++ b/packages/perf-benchmarks/package.json @@ -7,11 +7,11 @@ "remote": "best --projects best.headless.config.js --runner remote" }, "devDependencies": { - "@best/runner-headless": "4.0.0-alpha7", - "@best/runner-hub": "4.0.0-alpha7", - "@best/store-aws": "4.0.0-alpha7", - "@lwc/rollup-plugin": "1.0.2", - "@best/cli": "^4.0.0-alpha7" + "@best/runner-headless": "4.0.0-alpha8", + "@best/runner-hub": "4.0.0-alpha8", + "@best/store-aws": "4.0.0-alpha8", + "@best/cli": "^4.0.0-alpha8", + "@lwc/rollup-plugin": "1.0.2" }, "dependencies": { "@lwc/engine": "1.0.2", diff --git a/yarn.lock b/yarn.lock index 53c4c81497..bad96013e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -757,48 +757,48 @@ lodash "^4.17.10" to-fast-properties "^2.0.0" -"@best/analyzer@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/analyzer/-/analyzer-4.0.0-alpha7.tgz#953ec117869e3e033b80cb13790806abc51e3745" - integrity sha512-eK7DoH1Ej5Oh0bM9gvGZdiYtwg7q5JW/BmRpf2ChxEAZg2QNLy8cHAxyM0PCBscXFdzYNHP1deBjXeWPdeLmNA== +"@best/analyzer@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/analyzer/-/analyzer-4.0.0-alpha8.tgz#ed245a637e6392df8d35b9b57416830bb48e52b9" + integrity sha512-PrpWc3aVEHOMA1QZHm6snCmWHOcSc29B1aLLySnk+ycoNNRPWuJJHeR/mx1AUQSRJQrAwiSDfG2t9dNPg5y1xA== -"@best/api-db@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/api-db/-/api-db-4.0.0-alpha7.tgz#42ce212ff7ee60d7bf715c0d25f2e5c8c6d25616" - integrity sha512-0ixPDxgvucaVNfDtJcwk35J/RFUwE8leZFOvkMd2ECv8149A3wC1A5ocQfh5/weMWrahFpiLSmaIZFix9kGAPA== +"@best/api-db@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/api-db/-/api-db-4.0.0-alpha8.tgz#5fec84f6867303d967888451ac9f9eaea2fb388d" + integrity sha512-3dgYNP9JyF5fGHWg5UurEA5g83EvE15yGg604hSV+iFKXsZMqm+nYQ/qMHx+fNJOw6p1DRxZxdYw3EDx58Amtg== dependencies: pg "^7.11.0" sqlite "^3.0.3" -"@best/builder@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/builder/-/builder-4.0.0-alpha7.tgz#1ac97f0ee52370b2be17458573f5dd4e8bc50a05" - integrity sha512-HwsX8nzn6Goir2m9EHm5jUuH1PfbMC6b+IWXcfn52S4KFIBq0dfhrkXXA3rpRWosSCQ5tAwWhFqmFDV+UDuUtQ== +"@best/builder@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/builder/-/builder-4.0.0-alpha8.tgz#bed3a296dcd05654e941fb51430095c32c6f10e3" + integrity sha512-7d2/ODneTrU16Ub7xJQNeKaLVPgSzPwQv0Avr7MXj8lzIlC31TWtiJd9KtNsFpX36YeqdC8cZb/m4lAMzecM/Q== dependencies: - "@best/runtime" "4.0.0-alpha7" - "@best/utils" "4.0.0-alpha7" + "@best/runtime" "4.0.0-alpha8" + "@best/utils" "4.0.0-alpha8" mkdirp "~0.5.1" ncp "^2.0.0" rimraf "^2.6.2" rollup "~1.15.5" worker-farm "~1.7.0" -"@best/cli@^4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/cli/-/cli-4.0.0-alpha7.tgz#47db9ba012cf0e7338d893910ba9e71dd18db0f3" - integrity sha512-Tnjs5yKY+s1LiOlvOWzT4YvK+A6yHrMYPmFv6QpZNEah07gCYMygdFIJ3I2qwPpccvlZugovRNCuCTsbkEMr1w== - dependencies: - "@best/analyzer" "4.0.0-alpha7" - "@best/api-db" "4.0.0-alpha7" - "@best/builder" "4.0.0-alpha7" - "@best/compare" "4.0.0-alpha7" - "@best/config" "4.0.0-alpha7" - "@best/console-stream" "4.0.0-alpha7" - "@best/github-integration" "4.0.0-alpha7" - "@best/runner" "4.0.0-alpha7" - "@best/store" "4.0.0-alpha7" - "@best/store-fs" "4.0.0-alpha7" - "@best/utils" "4.0.0-alpha7" +"@best/cli@^4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/cli/-/cli-4.0.0-alpha8.tgz#8e94542c1444851d1983169fb133f37938a3aba2" + integrity sha512-qhXHblRS38RM9F0O64d7XXS5UvdO8IdyUDJxpfG2xF2UzI9ExLTJGTNnaVp1Z8xVQpUV+8eHEcvOEOOVd2GGMw== + dependencies: + "@best/analyzer" "4.0.0-alpha8" + "@best/api-db" "4.0.0-alpha8" + "@best/builder" "4.0.0-alpha8" + "@best/compare" "4.0.0-alpha8" + "@best/config" "4.0.0-alpha8" + "@best/console-stream" "4.0.0-alpha8" + "@best/github-integration" "4.0.0-alpha8" + "@best/runner" "4.0.0-alpha8" + "@best/store" "4.0.0-alpha8" + "@best/store-fs" "4.0.0-alpha8" + "@best/utils" "4.0.0-alpha8" asciichart "1.5.7" chalk "~2.4.2" cli-table "~0.3.1" @@ -809,134 +809,134 @@ simple-statistics "^6.0.1" yargs "~11.0.0" -"@best/compare@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/compare/-/compare-4.0.0-alpha7.tgz#8baad9a8e5ff1eeee16a0711d2573cc95d75a197" - integrity sha512-mNnxmhLmu3S2lTzEz020OfTPokzwRhrn/hObAgxWjAasp4ayQ5rHEBFaNqMbohgiN0hBLVTbZ9t0hgYEvPpwqg== +"@best/compare@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/compare/-/compare-4.0.0-alpha8.tgz#232b2c2f143edc9bcb7115ab013403b6d782b758" + integrity sha512-YZ7D+6+5mS2eUWjvkOGFCjcbvAPD+gWEN0xtEz+rL7ZOQBy0eX377rV8fOMrzWSTihKmphoRincTRyjs075DFA== dependencies: - "@best/analyzer" "4.0.0-alpha7" + "@best/analyzer" "4.0.0-alpha8" chalk "~2.4.2" -"@best/config@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/config/-/config-4.0.0-alpha7.tgz#c6e47a7897861a45d3d7bbe283144373048e8521" - integrity sha512-aJ2w8wDqgoYYLJE9AjclDGfx+yZtFmSoAiNufiLLcbzcm+F9V7OyHD1BqKP8IFOg8v/V2uEd6ApmVE8RoZd4xQ== +"@best/config@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/config/-/config-4.0.0-alpha8.tgz#aed7dec1dadd6b119575f8f0fcccfa5c406b6df2" + integrity sha512-XBNvOkMXdyw+GLf7LPCDIw/lX8koNdTjdsZ7jNvCf5rV0jhEUZOrcZD/mHtF1PDQVC0tLI/R8jP0Rb2yiWK3TQ== dependencies: - "@best/regex-util" "4.0.0-alpha7" - "@best/utils" "4.0.0-alpha7" + "@best/regex-util" "4.0.0-alpha8" + "@best/utils" "4.0.0-alpha8" chalk "~2.4.2" simple-git "~1.113.0" -"@best/console-stream@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/console-stream/-/console-stream-4.0.0-alpha7.tgz#27b6218a71e99eaabed59853d276c1f1b9d75f62" - integrity sha512-dX0sa3SKhVc1OM+4Q1ySNvDJmIqylEAzhJB1pJblEuXtZznSvGcSl42gyC6daoUvbBjKwfzVBjL39Aiua8LNEQ== +"@best/console-stream@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/console-stream/-/console-stream-4.0.0-alpha8.tgz#e62c1088dd4de1aca06105eabb2922b7a87f88d6" + integrity sha512-xbq30WSOKzbct+aJ790tGHK7oL3CDRsW2Q31X3VLb3G6mMpxQgQedoLYY6lKbcWdltOemFI5leCR/MfzN2AXAA== dependencies: - "@best/utils" "4.0.0-alpha7" + "@best/utils" "4.0.0-alpha8" chalk "~2.4.2" -"@best/github-integration@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/github-integration/-/github-integration-4.0.0-alpha7.tgz#f1ed5c5bbe0f8d64318d222ec5b97f5209abb8b7" - integrity sha512-bOR7I8RhqriPm4VoAK6Y5VXu+o55XeKsUaLgWfMhmNVBqFWIfXJLUVmFKQln2rsacMKew1IeOMn2b83qN4Bynw== +"@best/github-integration@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/github-integration/-/github-integration-4.0.0-alpha8.tgz#9fc47aa9b22be6e5463d73c48b6b1ff863672623" + integrity sha512-7PzsA2KZ7/L7GCNjpGb2Uk5i2xTzDmGyyOwZC1y2Pqa004uMJbJ/iitg6AdrJRb/3tMO6vL0nJwW077yoPhxrA== dependencies: - "@best/api-db" "4.0.0-alpha7" - "@best/types" "4.0.0-alpha7" - "@best/utils" "4.0.0-alpha7" + "@best/api-db" "4.0.0-alpha8" + "@best/types" "4.0.0-alpha8" + "@best/utils" "4.0.0-alpha8" "@octokit/rest" "^16.28.2" base-64 "^0.1.0" expand-tilde "~2.0.2" json2md "~1.5.11" jsonwebtoken "8.1.0" -"@best/regex-util@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/regex-util/-/regex-util-4.0.0-alpha7.tgz#d32be67dec08d8a2b00b1f5edb2b19389eeda31c" - integrity sha512-WmnX1TsQ9hPUuI2XiB0ubjzHN7QXtvp/Pfz8e9u9B7pkM0UhAqtN8BNq1ACe8rREGzBzIA1Vxrwp/uS0l8Ubgw== +"@best/regex-util@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/regex-util/-/regex-util-4.0.0-alpha8.tgz#ba0783b616f72fba92722fdbfe48575b9bd9eead" + integrity sha512-ChIIqmM9B/atoc7lZoj6z+9GPC8xFvdulZH/tpda0v0ZH38Rrjdf5kZWFS2Oyx4hJqEa88cuGcbA6k5po1NAjw== -"@best/runner-abstract@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/runner-abstract/-/runner-abstract-4.0.0-alpha7.tgz#222d6f2a768c445b1508a6722b84d3225ab22bb9" - integrity sha512-mNM4UjB18V3T8UxJmdrxXGbBQCQjZLdk/vcvjyRG7UyC5atNCRxBitt4P1WnfwMmtryouM90O6mkw8y7d39mHA== +"@best/runner-abstract@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/runner-abstract/-/runner-abstract-4.0.0-alpha8.tgz#92883c326deee0b26ca9781fe95963bb6b1d7dbf" + integrity sha512-pJ5rQmzcI18YzCRZ6W/LHEDBemfKafEs/F1IiIGjrOzYkLojlkN7f4qtMsLzO/fIWNaG1vUMCoQfKLzLxw4AIA== dependencies: - "@best/utils" "4.0.0-alpha7" + "@best/utils" "4.0.0-alpha8" express "~4.16.2" -"@best/runner-headless@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/runner-headless/-/runner-headless-4.0.0-alpha7.tgz#99f76a1278999618d4dbbabc0f4cc2da6acab151" - integrity sha512-ZTy/29ygr5Kbl52lFXr0KFX1YdAgF2gFWcXynSUYDHcQAjpucW3lLfhHTqdBTSxdtLky65xEkiTyFu5w4fgmtA== +"@best/runner-headless@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/runner-headless/-/runner-headless-4.0.0-alpha8.tgz#e677940d66b977ba0313d8bb8712113e8b9bdd6b" + integrity sha512-vxPS/YumjGzHg+13BEOYpGBNss0WFMrWO4si6qfVkATtpllpNP/xpWkwmwVUfc/O+jkNhvrwTFG65b4NDHa0hw== dependencies: - "@best/runner-abstract" "4.0.0-alpha7" - "@best/types" "4.0.0-alpha7" + "@best/runner-abstract" "4.0.0-alpha8" + "@best/types" "4.0.0-alpha8" puppeteer "~1.17.0" -"@best/runner-hub@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/runner-hub/-/runner-hub-4.0.0-alpha7.tgz#9e72fbf73a721006182434cf836f5ce8730c76ed" - integrity sha512-rSW467esBVPUYOYgv5CCPNUDnyXrCFhcPNZhjpz+DaX2/cXlxgKbp8g+okjlRZqVRQJeMBQLX+82o6a3/xYR9w== +"@best/runner-hub@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/runner-hub/-/runner-hub-4.0.0-alpha8.tgz#983ac3dd67fa85d70a35e3b8ed5c964563ac8cbc" + integrity sha512-mj5e2vHP5YUUbnSldu/Ahzq5p5zbmjlX5s27xVp87Kk0In6gvsAhC57hSDcuUWUX2iUSCWdMNce+LKLGqyjsvA== dependencies: - "@best/console-stream" "4.0.0-alpha7" - "@best/types" "4.0.0-alpha7" - "@best/utils" "4.0.0-alpha7" + "@best/console-stream" "4.0.0-alpha8" + "@best/types" "4.0.0-alpha8" + "@best/utils" "4.0.0-alpha8" socket.io-client "~2.2.0" tar "~4.4.10" -"@best/runner@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/runner/-/runner-4.0.0-alpha7.tgz#2cb9ba6c58999935b0388cf51e5a8a9e9f297f5b" - integrity sha512-quJGvRcGIuE3O0zFShMrCHaMdm+K8hGSfH15J0ectpbyjYK7SIiRaLtIDDZVAXgCtjt61u4kQKLntBhl+TDkfA== +"@best/runner@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/runner/-/runner-4.0.0-alpha8.tgz#f6a85107bfb5f2eb8c3368d8ddbdaa0064caaf9c" + integrity sha512-mM5qjW2FQGgNY1a4YULYRY8H3rTHhZWlKu28CO5aVpRpl0QrXiEH/1aReXJnTTKdvoZ+mBN8+jOCn8h13ZwZ7w== dependencies: - "@best/console-stream" "4.0.0-alpha7" - "@best/runner-abstract" "4.0.0-alpha7" + "@best/console-stream" "4.0.0-alpha8" + "@best/runner-abstract" "4.0.0-alpha8" chalk "~2.4.2" -"@best/runtime@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/runtime/-/runtime-4.0.0-alpha7.tgz#750adb7784dcbf6d44f7c056145c03e6304c0d87" - integrity sha512-safvPk4f3eMqqlXDayT9QlEOzTGXV2wQ3xFQSp1NdY7jbozdxd05sfr6ykgMALa9zUz8wSNKoxyEmm8giNVgWw== +"@best/runtime@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/runtime/-/runtime-4.0.0-alpha8.tgz#7bf5f541149b2d22ab132405eecddf502800f05d" + integrity sha512-hGnot+y4GlgMEjAR/AcGccx0ei1eBNL/Wx7y8UzwhoVo+Qj9ssNgCOyRwJkQ7f0xXCzx/7aq4LgJL6RVIeR+BA== dependencies: chalk "~2.4.2" -"@best/store-aws@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/store-aws/-/store-aws-4.0.0-alpha7.tgz#3e22298023a774d924424f2dd6391ea081a5ebea" - integrity sha512-eNwQxbcpk1yPx1JiMFDBvYnjAWNSvp1pUy3awiK0r3lY8PMP+LLHZcCUPKypIWpI/hRArkvTGI+wp7ySseo70A== +"@best/store-aws@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/store-aws/-/store-aws-4.0.0-alpha8.tgz#3d788d7aa821270621b28bd23a8331db11656a2a" + integrity sha512-Nx2OXiPlyTBhrh+ZdkhoX1CLGtmOH/Vr0rgKFgTKCUDb98lOSALUfi+Rdbm1yHrgi1VnO9mg7pK4O5wCkO9sVg== dependencies: - "@best/types" "4.0.0-alpha7" + "@best/types" "4.0.0-alpha8" aws-sdk "~2.444.0" chalk "~2.4.2" mime-types "~2.1.24" node-fetch "~1.7.3" -"@best/store-fs@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/store-fs/-/store-fs-4.0.0-alpha7.tgz#659eb1860d908af68c9476e3ff536c5b62eb7ae1" - integrity sha512-IEoxWJhp2CbzaUxdv4pkLYRfgai6d3Z/soj26wXgFOht7XauX+s1yZzg35T29F6QPr5XhDb62Z77P9npijQWmQ== +"@best/store-fs@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/store-fs/-/store-fs-4.0.0-alpha8.tgz#c992aa9ad96a9b53e42e0e74962c655f45ce9231" + integrity sha512-hPbM3LsqXM2Ri/FdQLYzcr5sd7F2IC0vPSM6s1uZjf6/4wMrzW97UFL0slqFeMU1ZXCEFarZk+f58B8F5gS0Bg== dependencies: - "@best/types" "4.0.0-alpha7" + "@best/types" "4.0.0-alpha8" chalk "~2.4.2" globby "~9.2.0" -"@best/store@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/store/-/store-4.0.0-alpha7.tgz#5cb6ef3e581eb82521e89669956987f2c1e67be8" - integrity sha512-h2xnYSJ3EHVv26n9GUgb+lL51L55ydh/RDlghEcJ6587St8QHkdU5elWfobBJtClYEd8PEikQ4ZhPdm2OKCjXw== +"@best/store@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/store/-/store-4.0.0-alpha8.tgz#f98109ecbb577bad5704572f5845c9aae3bdb564" + integrity sha512-MRjm3YBgxyOiODl9vhVm7AQkz1FZzj32Tm3+N0nPQjlJSX0rGD+/WQNQH3Tjf6l9FNYsa4fhjL8vC2b/akVLjA== dependencies: json2md "~1.5.11" mkdirp "^0.5.1" ncp "^2.0.0" rimraf "~2.6.2" -"@best/types@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/types/-/types-4.0.0-alpha7.tgz#de4dea8c84534486521ba45e32d408a4119395d4" - integrity sha512-7M2WEpUH6fE+AsSdk3kF4KnKozbGjEt01z201UDLlMdg+M+XxkFvo1HgjWhrB5wL4DS71hfE4K0WRCF6hvRZxQ== +"@best/types@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/types/-/types-4.0.0-alpha8.tgz#862ca8de2e60eaa563070449dcf810cec0d0e2b2" + integrity sha512-mJtjmlK/RaIMbB05rpF9yEHczydLACx35zvY8x7BqRiikRv+6vPbbHPFCrfpr7lozkK3hYgsxGjTPHnFU8zVkA== -"@best/utils@4.0.0-alpha7": - version "4.0.0-alpha7" - resolved "https://registry.yarnpkg.com/@best/utils/-/utils-4.0.0-alpha7.tgz#8dce909d586b875f076bac3de5a6251d7b6c012a" - integrity sha512-Z40zD5P0brlsp+yl2hsnum1ze72vQ+X3njrk7v1RXXix1zPbRggilCGIqw6pikE6UyT3bRjppg2b4hXxPgoWow== +"@best/utils@4.0.0-alpha8": + version "4.0.0-alpha8" + resolved "https://registry.yarnpkg.com/@best/utils/-/utils-4.0.0-alpha8.tgz#b769cc37a62f99c1aee17e5c29b9fd5b6881f32a" + integrity sha512-hZMsqGO4IQN/5b9kVn03ZwvQfH7bfYfzwcSi3R9zs/75NECeyvDGLnLci8FlNuPksKJ8SE5R1ihVrNEbLC/VLw== dependencies: chalk "~2.4.2" https-proxy-agent "2.2.2" @@ -5241,18 +5241,6 @@ fast-glob@^2.0.2, fast-glob@^2.2.6: merge2 "^1.2.3" micromatch "^3.1.10" -fast-glob@~2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.6.tgz#a5d5b697ec8deda468d85a74035290a025a95295" - integrity sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w== - dependencies: - "@mrmlnc/readdir-enhanced" "^2.2.1" - "@nodelib/fs.stat" "^1.1.2" - glob-parent "^3.1.0" - is-glob "^4.0.0" - merge2 "^1.2.3" - micromatch "^3.1.10" - fast-glob@~3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.0.4.tgz#d484a41005cb6faeb399b951fd1bd70ddaebb602"