diff --git a/.eslintrc.js b/.eslintrc.js index 04cdd2b714c2..192c94f5d70e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -72,5 +72,12 @@ module.exports = { 'react/no-unknown-property': 'off', // Need to deactivate otherwise eslint replaces some unknown properties with React ones }, }, + { + // this package uses pre-bundling, dependencies will be bundled, and will be in devDepenencies + files: ['**/lib/theming/**/*'], + rules: { + 'import/no-extraneous-dependencies': ['error', { bundledDependencies: false }], + }, + }, ], }; diff --git a/lib/cli/src/versions.ts b/lib/cli/src/versions.ts index 03075c22a2b8..2860b7a3e804 100644 --- a/lib/cli/src/versions.ts +++ b/lib/cli/src/versions.ts @@ -1,58 +1,58 @@ // auto generated file, do not edit export default { - "@storybook/addon-a11y": "6.5.0-alpha.30", - "@storybook/addon-actions": "6.5.0-alpha.30", - "@storybook/addon-backgrounds": "6.5.0-alpha.30", - "@storybook/addon-controls": "6.5.0-alpha.30", - "@storybook/addon-docs": "6.5.0-alpha.30", - "@storybook/addon-essentials": "6.5.0-alpha.30", - "@storybook/addon-interactions": "6.5.0-alpha.30", - "@storybook/addon-jest": "6.5.0-alpha.30", - "@storybook/addon-links": "6.5.0-alpha.30", - "@storybook/addon-measure": "6.5.0-alpha.30", - "@storybook/addon-outline": "6.5.0-alpha.30", - "@storybook/addon-storyshots": "6.5.0-alpha.30", - "@storybook/addon-storyshots-puppeteer": "6.5.0-alpha.30", - "@storybook/addon-storysource": "6.5.0-alpha.30", - "@storybook/addon-toolbars": "6.5.0-alpha.30", - "@storybook/addon-viewport": "6.5.0-alpha.30", - "@storybook/addons": "6.5.0-alpha.30", - "@storybook/angular": "6.5.0-alpha.30", - "@storybook/api": "6.5.0-alpha.30", - "@storybook/builder-webpack4": "6.5.0-alpha.30", - "@storybook/builder-webpack5": "6.5.0-alpha.30", - "@storybook/channel-postmessage": "6.5.0-alpha.30", - "@storybook/channel-websocket": "6.5.0-alpha.30", - "@storybook/channels": "6.5.0-alpha.30", - "@storybook/cli": "6.5.0-alpha.30", - "@storybook/client-api": "6.5.0-alpha.30", - "@storybook/client-logger": "6.5.0-alpha.30", - "@storybook/codemod": "6.5.0-alpha.30", - "@storybook/components": "6.5.0-alpha.30", - "@storybook/core": "6.5.0-alpha.30", - "@storybook/core-client": "6.5.0-alpha.30", - "@storybook/core-common": "6.5.0-alpha.30", - "@storybook/core-events": "6.5.0-alpha.30", - "@storybook/core-server": "6.5.0-alpha.30", - "@storybook/csf-tools": "6.5.0-alpha.30", - "@storybook/ember": "6.5.0-alpha.30", - "@storybook/html": "6.5.0-alpha.30", - "@storybook/instrumenter": "6.5.0-alpha.30", - "@storybook/manager-webpack4": "6.5.0-alpha.30", - "@storybook/manager-webpack5": "6.5.0-alpha.30", - "@storybook/node-logger": "6.5.0-alpha.30", - "@storybook/postinstall": "6.5.0-alpha.30", - "@storybook/preact": "6.5.0-alpha.30", - "@storybook/preview-web": "6.5.0-alpha.30", - "@storybook/react": "6.5.0-alpha.30", - "@storybook/router": "6.5.0-alpha.30", - "@storybook/server": "6.5.0-alpha.30", - "@storybook/source-loader": "6.5.0-alpha.30", - "@storybook/store": "6.5.0-alpha.30", - "@storybook/svelte": "6.5.0-alpha.30", - "@storybook/theming": "6.5.0-alpha.30", - "@storybook/ui": "6.5.0-alpha.30", - "@storybook/vue": "6.5.0-alpha.30", - "@storybook/vue3": "6.5.0-alpha.30", - "@storybook/web-components": "6.5.0-alpha.30" -} \ No newline at end of file + '@storybook/addon-a11y': '6.5.0-alpha.30', + '@storybook/addon-actions': '6.5.0-alpha.30', + '@storybook/addon-backgrounds': '6.5.0-alpha.30', + '@storybook/addon-controls': '6.5.0-alpha.30', + '@storybook/addon-docs': '6.5.0-alpha.30', + '@storybook/addon-essentials': '6.5.0-alpha.30', + '@storybook/addon-interactions': '6.5.0-alpha.30', + '@storybook/addon-jest': '6.5.0-alpha.30', + '@storybook/addon-links': '6.5.0-alpha.30', + '@storybook/addon-measure': '6.5.0-alpha.30', + '@storybook/addon-outline': '6.5.0-alpha.30', + '@storybook/addon-storyshots': '6.5.0-alpha.30', + '@storybook/addon-storyshots-puppeteer': '6.5.0-alpha.30', + '@storybook/addon-storysource': '6.5.0-alpha.30', + '@storybook/addon-toolbars': '6.5.0-alpha.30', + '@storybook/addon-viewport': '6.5.0-alpha.30', + '@storybook/addons': '6.5.0-alpha.30', + '@storybook/angular': '6.5.0-alpha.30', + '@storybook/api': '6.5.0-alpha.30', + '@storybook/builder-webpack4': '6.5.0-alpha.30', + '@storybook/builder-webpack5': '6.5.0-alpha.30', + '@storybook/channel-postmessage': '6.5.0-alpha.30', + '@storybook/channel-websocket': '6.5.0-alpha.30', + '@storybook/channels': '6.5.0-alpha.30', + '@storybook/cli': '6.5.0-alpha.30', + '@storybook/client-api': '6.5.0-alpha.30', + '@storybook/client-logger': '6.5.0-alpha.30', + '@storybook/codemod': '6.5.0-alpha.30', + '@storybook/components': '6.5.0-alpha.30', + '@storybook/core': '6.5.0-alpha.30', + '@storybook/core-client': '6.5.0-alpha.30', + '@storybook/core-common': '6.5.0-alpha.30', + '@storybook/core-events': '6.5.0-alpha.30', + '@storybook/core-server': '6.5.0-alpha.30', + '@storybook/csf-tools': '6.5.0-alpha.30', + '@storybook/ember': '6.5.0-alpha.30', + '@storybook/html': '6.5.0-alpha.30', + '@storybook/instrumenter': '6.5.0-alpha.30', + '@storybook/manager-webpack4': '6.5.0-alpha.30', + '@storybook/manager-webpack5': '6.5.0-alpha.30', + '@storybook/node-logger': '6.5.0-alpha.30', + '@storybook/postinstall': '6.5.0-alpha.30', + '@storybook/preact': '6.5.0-alpha.30', + '@storybook/preview-web': '6.5.0-alpha.30', + '@storybook/react': '6.5.0-alpha.30', + '@storybook/router': '6.5.0-alpha.30', + '@storybook/server': '6.5.0-alpha.30', + '@storybook/source-loader': '6.5.0-alpha.30', + '@storybook/store': '6.5.0-alpha.30', + '@storybook/svelte': '6.5.0-alpha.30', + '@storybook/theming': '6.5.0-alpha.30', + '@storybook/ui': '6.5.0-alpha.30', + '@storybook/vue': '6.5.0-alpha.30', + '@storybook/vue3': '6.5.0-alpha.30', + '@storybook/web-components': '6.5.0-alpha.30', +}; diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix b/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix index 37b5192c6b7e..89cc929f1c06 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix @@ -490,8 +490,6 @@ Object { "options": Object { "docgenOptions": Object { "alias": Object { - "@emotion/core": "NODE_MODULES/@emotion/core", - "@emotion/styled": "NODE_MODULES/@emotion/styled", "@storybook/addons": "ROOT/lib/addons", "@storybook/api": "ROOT/lib/api", "@storybook/channel-postmessage": "ROOT/lib/channel-postmessage", @@ -505,7 +503,6 @@ Object { "@storybook/semver": "NODE_MODULES/@storybook/semver", "@storybook/store": "ROOT/lib/store", "@storybook/theming": "ROOT/lib/theming", - "emotion-theming": "NODE_MODULES/emotion-theming", "react": "NODE_MODULES/react", "react-dom": "NODE_MODULES/react-dom", "vue$": "NODE_MODULES/vue/dist/vue.esm-bundler.js", diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix b/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix index 7b49332e2b0e..75f472fb1bc8 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix @@ -489,8 +489,6 @@ Object { "options": Object { "docgenOptions": Object { "alias": Object { - "@emotion/core": "NODE_MODULES/@emotion/core", - "@emotion/styled": "NODE_MODULES/@emotion/styled", "@storybook/addons": "ROOT/lib/addons", "@storybook/api": "ROOT/lib/api", "@storybook/channel-postmessage": "ROOT/lib/channel-postmessage", @@ -504,7 +502,6 @@ Object { "@storybook/semver": "NODE_MODULES/@storybook/semver", "@storybook/store": "ROOT/lib/store", "@storybook/theming": "ROOT/lib/theming", - "emotion-theming": "NODE_MODULES/emotion-theming", "react": "NODE_MODULES/react", "react-dom": "NODE_MODULES/react-dom", "vue$": "NODE_MODULES/vue/dist/vue.esm-bundler.js", diff --git a/lib/theming/package.json b/lib/theming/package.json index 71bf8b666653..f6541b634795 100644 --- a/lib/theming/package.json +++ b/lib/theming/package.json @@ -37,21 +37,24 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "ts-node ../../scripts/prebundle.ts" }, "dependencies": { + "@storybook/client-logger": "6.5.0-alpha.30", + "core-js": "^3.8.2" + }, + "devDependencies": { "@emotion/core": "^10.3.1", "@emotion/is-prop-valid": "^0.8.6", "@emotion/styled": "^10.0.27", - "@storybook/client-logger": "6.5.0-alpha.30", - "core-js": "^3.8.2", + "@types/node": "^14.14.20 || ^16.0.0", "deep-object-diff": "^1.1.0", "emotion-theming": "^10.0.27", "global": "^4.4.0", "memoizerific": "^1.11.3", "polished": "^4.0.5", - "resolve-from": "^5.0.0", - "ts-dedent": "^2.0.0" + "ts-dedent": "^2.0.0", + "ts-node": "^10.4.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0", @@ -60,6 +63,7 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": "./src/index.ts", "gitHead": "4dc5ec5956f3a8cfb07e3c4b3442fb3f6ac95662", "sbmodern": "dist/modern/index.js" } diff --git a/lib/theming/paths.js b/lib/theming/paths.js index b356b4ae3235..2e132e739e78 100644 --- a/lib/theming/paths.js +++ b/lib/theming/paths.js @@ -1,12 +1,2 @@ -const { dirname } = require('path'); -const resolveFrom = require('resolve-from'); - -const resolve = resolveFrom.bind(null, __dirname); - -// These paths need to be aliased in the manager webpack config to ensure that all -// code running inside the manager uses the *same* versions of each package. -module.exports = { - '@emotion/core': dirname(resolve('@emotion/core/package.json')), - '@emotion/styled': dirname(resolve('@emotion/styled/package.json')), - 'emotion-theming': dirname(resolve('emotion-theming/package.json')), -}; +// We used to alias paths, but now that we are bundling dependencies, we do not need to +module.exports = {}; diff --git a/lib/theming/src/index.ts b/lib/theming/src/index.ts index 86d514f19ad7..6b58d0f9b640 100644 --- a/lib/theming/src/index.ts +++ b/lib/theming/src/index.ts @@ -1,3 +1,6 @@ +// eslint-disable-next-line @typescript-eslint/triple-slash-reference +/// + import emotionStyled, { CreateStyled } from '@emotion/styled'; import { Theme } from './types'; diff --git a/lib/theming/src/typings.d.ts b/lib/theming/src/typings.d.ts index ab568e12c7ac..e917d057faac 100644 --- a/lib/theming/src/typings.d.ts +++ b/lib/theming/src/typings.d.ts @@ -1,3 +1,3 @@ // todo the following packages need definition files or a TS migration declare module 'react-inspector'; -declare module 'global'; +declare module 'global'; \ No newline at end of file diff --git a/package.json b/package.json index aa76fc436007..54242bd9f0be 100644 --- a/package.json +++ b/package.json @@ -128,6 +128,11 @@ "@nrwl/nx-cloud": "12.1.1", "@nrwl/tao": "12.3.4", "@nrwl/workspace": "12.3.4", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.0.6", + "@rollup/plugin-typescript": "^8.3.0", "@storybook/addon-a11y": "workspace:*", "@storybook/addon-actions": "workspace:*", "@storybook/addon-backgrounds": "workspace:*", @@ -223,6 +228,7 @@ "danger": "^10.6.2", "detect-port": "^1.3.0", "downlevel-dts": "^0.6.0", + "dts-bundle-generator": "^6.2.0", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.5", "eslint": "^7.17.0", @@ -271,6 +277,9 @@ "remark-cli": "^9.0.0", "remark-lint": "^8.0.0", "remark-preset-lint-recommended": "^5.0.0", + "rollup": "^2.60.2", + "rollup-plugin-jsx": "^1.0.3", + "rollup-plugin-terser": "^7.0.2", "serve-static": "^1.14.1", "shelljs": "^0.8.4", "shx": "^0.3.2", diff --git a/scripts/bundle-package.ts b/scripts/bundle-package.ts new file mode 100644 index 000000000000..bcf6852e3c06 --- /dev/null +++ b/scripts/bundle-package.ts @@ -0,0 +1,204 @@ +import path, { resolve } from 'path'; +import { bold, gray, greenBright } from 'chalk'; +import execa from 'execa'; +import { rollup, OutputOptions, watch, RollupOptions } from 'rollup'; +import readPkgUp from 'read-pkg-up'; +import fs from 'fs-extra'; +import rollupTypescript from '@rollup/plugin-typescript'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import { babel, getBabelOutputPlugin } from '@rollup/plugin-babel'; +import { terser } from 'rollup-plugin-terser'; +import { generateDtsBundle } from 'dts-bundle-generator'; +import * as dtsLozalize from './dts-localize'; + +interface Options { + input: string; + externals: string[]; + cwd: string; + optimized?: boolean; + watch?: boolean; +} + +async function build(options: Options) { + const { input, externals, cwd, optimized } = options; + const setting: RollupOptions = { + input, + external: externals, + plugins: [ + nodeResolve({ + browser: true, + preferBuiltins: true, + }), + commonjs(), + babel({ + babelHelpers: 'external', + skipPreflightCheck: true, + }), + json(), + rollupTypescript({ lib: ['es2015', 'dom', 'esnext'], target: 'es6' }), + ], + }; + + const outputs: OutputOptions[] = [ + { + dir: resolve(cwd, './dist/modern'), + format: 'es', + sourcemap: optimized, + preferConst: true, + plugins: [ + getBabelOutputPlugin({ + presets: [ + [ + '@babel/preset-env', + { + shippedProposals: true, + useBuiltIns: 'usage', + corejs: '3', + modules: false, + targets: { chrome: '94' }, + }, + ], + ], + }), + optimized ? terser({ output: { comments: false }, module: true }) : null, + ].filter(Boolean), + }, + { + dir: resolve(cwd, './dist/esm'), + format: 'es', + sourcemap: optimized, + plugins: [ + getBabelOutputPlugin({ + presets: [ + [ + '@babel/preset-env', + { + shippedProposals: true, + useBuiltIns: 'usage', + modules: false, + corejs: '3', + }, + ], + ], + }), + optimized ? terser({ output: { comments: false }, module: true }) : null, + ].filter(Boolean), + }, + { + dir: resolve(cwd, './dist/cjs'), + format: 'commonjs', + plugins: [ + getBabelOutputPlugin({ + presets: [ + [ + '@babel/preset-env', + { + shippedProposals: true, + useBuiltIns: 'usage', + corejs: '3', + modules: false, + targets: { node: '14' }, + }, + ], + ], + }), + optimized ? terser({ output: { comments: false }, module: true }) : null, + ].filter(Boolean), + }, + ]; + + if (options.watch) { + const watcher = watch({ ...setting, output: outputs }); + + watcher.on('change', (event) => { + console.log(`${greenBright('changed')}: ${event.replace(path.resolve(cwd, '../..'), '.')}`); + + dts(options); + }); + } else { + const bundler = await rollup(setting); + + await Promise.all(outputs.map((config) => bundler.write(config))); + + await bundler.close(); + } +} + +async function dts({ input, externals, cwd, ...options }: Options) { + if (options.watch) { + try { + const [out] = await generateDtsBundle( + [ + { + filePath: input, + output: { inlineDeclareGlobals: false, sortNodes: true, noBanner: true }, + }, + ], + { followSymlinks: false } + ); + + await fs.outputFile('dist/ts3.9/index.d.ts', out); + } catch (e) { + console.log(e.message); + } + } else { + const [out] = await generateDtsBundle( + [ + { + filePath: input, + output: { inlineDeclareGlobals: false, sortNodes: true, noBanner: true }, + }, + ], + { followSymlinks: false } + ); + + const bundledDTSfile = path.join(cwd, 'dist/ts-tmp/index.d.ts'); + const localizedDTSout = path.join(cwd, 'dist/ts3.9'); + await fs.outputFile(bundledDTSfile, out); + + await dtsLozalize.run([bundledDTSfile], localizedDTSout, { externals, cwd }); + + await fs.remove(path.join(cwd, 'dist/ts-tmp')); + + await execa('node', [ + path.join(__dirname, '../node_modules/.bin/downlevel-dts'), + 'dist/ts3.9', + 'dist/ts3.4', + ]); + } +} + +async function removeDist() { + await fs.remove('dist'); +} + +export async function run({ cwd, flags }: { cwd: string; flags: string[] }) { + const { packageJson: pkg } = await readPkgUp({ cwd }); + const message = gray(`Built: ${bold(`${pkg.name}@${pkg.version}`)}`); + console.time(message); + + if (flags.includes('--reset')) { + await removeDist(); + } + + const input = path.join(cwd, pkg.bundlerEntrypoint); + const externals = Object.keys({ ...pkg.dependencies, ...pkg.peerDependencies }); + + const options: Options = { + cwd, + externals, + input, + optimized: flags.includes('--optimized'), + watch: flags.includes('--watch'), + }; + + await Promise.all([ + // + build(options), + dts(options), + ]); + + console.timeEnd(message); +} diff --git a/scripts/dts-localize.ts b/scripts/dts-localize.ts new file mode 100644 index 000000000000..25548196476a --- /dev/null +++ b/scripts/dts-localize.ts @@ -0,0 +1,289 @@ +/* eslint-disable no-param-reassign */ +import path from 'path'; +import fs from 'fs-extra'; +import { sync } from 'read-pkg-up'; + +import * as ts from 'typescript'; + +const parseConfigHost = { + useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames, + readDirectory: ts.sys.readDirectory, + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, +}; + +function getAbsolutePath(fileName: string, cwd?: string) { + if (!path.isAbsolute(fileName)) { + fileName = path.join(cwd !== undefined ? cwd : process.cwd(), fileName); + } + + return fileName; +} + +function getCompilerOptions(inputFileNames: string[], preferredConfigPath?: string) { + const configFileName = + preferredConfigPath !== undefined ? preferredConfigPath : findConfig(inputFileNames); + const configParseResult = ts.readConfigFile(configFileName, ts.sys.readFile); + const compilerOptionsParseResult = ts.parseJsonConfigFileContent( + configParseResult.config, + parseConfigHost, + path.resolve(path.dirname(configFileName)), + undefined, + getAbsolutePath(configFileName) + ); + + return compilerOptionsParseResult.options; +} + +function findConfig(inputFiles: string[]) { + if (inputFiles.length !== 1) { + throw new Error( + 'Cannot find tsconfig for multiple files. Please specify preferred tsconfig file' + ); + } + + // input file could be a relative path to the current path + // and desired config could be outside of current cwd folder + // so we have to provide absolute path to find config until the root + const searchPath = getAbsolutePath(inputFiles[0]); + const configFileName = ts.findConfigFile(searchPath, ts.sys.fileExists); + if (!configFileName) { + throw new Error(`Cannot find config file for file ${searchPath}`); + } + + return configFileName; +} + +interface Options { + externals: string[]; + cwd?: string; +} + +export const run = async (entrySourceFiles: string[], outputPath: string, options: Options) => { + const compilerOptions = getCompilerOptions(entrySourceFiles); + const host = ts.createCompilerHost(compilerOptions); + const cwd = options.cwd || process.cwd(); + const pkg = sync({ cwd }).packageJson; + const externals = Object.keys({ ...pkg.dependencies, ...pkg.peerDependencies }); + + // this to make paths for local packages as they are in node_modules because of yarn + // but it depends on the way you handle "flatting of files" + // so basically you can remove this host completely if you handle it in different way + host.realpath = (p: string) => p; + + const program = ts.createProgram(entrySourceFiles, compilerOptions, host); + const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed, removeComments: false }); + + const typeChecker = program.getTypeChecker(); + const sourceFiles = program.getSourceFiles(); + + const filesRemapping = new Map(); + const replaceRemapping = new Map(); + + entrySourceFiles.forEach((file) => { + const sourceFile = sourceFiles.find((f) => f.fileName === file); + + actOnSourceFile(sourceFile); + }); + + /** + * @param {string} basePath the path is the directory where the package.json is located + * @param {string} filePath the path of the current file + */ + function getReplacementPathRelativeToBase(basePath: string, filePath: string) { + const relative = path.relative(basePath, filePath); + let newPath = ''; + + /* + first we work out the relative path from the basePath + we might get a path like: ../../node_modules/packagename/dist/dir/file.ts + Here's a few examples of what the idea is: + + ../../node_modules/packagename/dist/dir/file.ts => _modules/packagename-dist-dir-file.ts + ../../node_modules/packagename/node_modules/b/dist/dir/file.ts => _modules/packagename-node_modules-b-dist-dir-file.ts + ./node_modules/packagename/dist/dir/file.ts => _modules/packagename-dist-dir-file.ts + ./dist/ts-tmp/file.ts => file.ts + + */ + + if (relative.includes('node_modules/')) { + const [, ...parts] = relative.split('node_modules/'); + const filename = parts.join('node_modules/').split('/').join('-'); + newPath = path.join(outputPath, '_modules', filename); + } else if (relative.includes('dist/ts-tmp/')) { + const [, ...parts] = relative.split('dist/ts-tmp/'); + const filename = parts.join('').split('/').join('-'); + newPath = path.join(outputPath, filename); + } else { + const filename = relative.split('/').join('-'); + newPath = path.join(outputPath, filename); + } + return newPath; + } + + function wasReplacedAlready(fileName: string, target: string) { + // skipping this import because is has been previously replaced already + if (replaceRemapping.has(fileName) && replaceRemapping.get(fileName).includes(target)) { + return true; + } + return false; + } + + function getReplacementPathRelativeToFile( + currentSourceFile: string, + referencedSourceFile: string + ) { + filesRemapping.set(currentSourceFile, getReplacementPathRelativeToBase(cwd, currentSourceFile)); + filesRemapping.set( + referencedSourceFile, + getReplacementPathRelativeToBase(cwd, referencedSourceFile) + ); + + const result = path + .relative(filesRemapping.get(currentSourceFile), filesRemapping.get(referencedSourceFile)) + .slice(1) + .replace('.d.ts', '') + .replace('.ts', ''); + + replaceRemapping.set(currentSourceFile, [ + ...(replaceRemapping.get(currentSourceFile) || []), + result, + ]); + + return result; + } + + function wasIgnored(target: string) { + if (externals.includes(target)) { + return true; + } + return false; + } + + function replaceImport(node: ts.Node) { + if ( + (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && + node.moduleSpecifier !== undefined + ) { + // @ts-ignore + const target: string = node.moduleSpecifier.text; + let currentSourceFile = ''; + let referencedSourceFile = ''; + + if (wasIgnored(target)) { + return true; + } + + currentSourceFile = node.getSourceFile().fileName; + + if (wasReplacedAlready(currentSourceFile, target)) { + return true; + } + + // find the sourceFile the import is pointing to + referencedSourceFile = getSourceFile( + typeChecker.getSymbolAtLocation(node.moduleSpecifier).valueDeclaration + ).fileName; + + const replacementPath = getReplacementPathRelativeToFile( + currentSourceFile, + referencedSourceFile + ); + + // @ts-ignore + node.moduleSpecifier = ts.createStringLiteral(replacementPath); + + return true; + } + + if (ts.isImportTypeNode(node)) { + const target = node.argument.getText().slice(1, -1); + let currentSourceFile = ''; + let referencedSourceFile = ''; + + // check if the import's path is in the ignore-list + if (wasIgnored(target)) { + return true; + } + + currentSourceFile = node.getSourceFile().fileName; + + // check if it's already been replaced previously + if (wasReplacedAlready(currentSourceFile, target)) { + return true; + } + + // find the sourceFile the import is pointing to + referencedSourceFile = getSourceFile( + typeChecker.getSymbolAtLocation(node).valueDeclaration + ).fileName; + + const replacementPath = getReplacementPathRelativeToFile( + currentSourceFile, + referencedSourceFile + ); + + // @ts-ignore + node.argument = ts.createStringLiteral(replacementPath); + // node.argument = ts.factory.createStringLiteral(replacementPath); // TS4 + + return true; + } + + return undefined; + } + + function getSourceFile(moduleNode: ts.Node) { + while (!ts.isSourceFile(moduleNode)) { + moduleNode = moduleNode.parent; + } + return moduleNode; + } + + function walkNodeToReplaceImports(node: ts.Node) { + // it seems that it is unnecessary, but we're sure that it is impossible to have import statement later than we can just skip this node + if (replaceImport(node)) { + return; + } + + ts.forEachChild(node, (n) => walkNodeToReplaceImports(n)); + } + + function outputSourceToFile(sourceFile: ts.SourceFile) { + const newPath = filesRemapping.get(sourceFile.fileName); + fs.outputFileSync(newPath, printer.printFile(sourceFile).trim()); + } + + function actOnSourceFile(sourceFile: ts.SourceFile & { resolvedModules?: Map }) { + // console.log(sourceFile); + filesRemapping.set( + sourceFile.fileName, + getReplacementPathRelativeToBase(cwd, sourceFile.fileName) + ); + + walkNodeToReplaceImports(sourceFile); + + outputSourceToFile(sourceFile); + + // using a internal 'resolvedModules' API to get all the modules that were imported by this source file + // this seems to be a cache TypeScript uses internally + // I've been looking for a a public API to use, but so far haven't found it. + // I could create the dependency graph myself, perhaps that'd be better, but I'm OK with this for now. + if (sourceFile.resolvedModules && sourceFile.resolvedModules.size > 0) { + Array.from(sourceFile.resolvedModules.entries()).forEach(([k, v]) => { + if (externals.includes(k)) { + return; + } + const x = sourceFiles.find((f) => f.fileName === v.resolvedFileName); + if (!x) { + return; + } + if (replaceRemapping.has(v.resolvedFileName)) { + return; + } + + actOnSourceFile(sourceFiles.find((f) => f.fileName === v.resolvedFileName)); + }); + } + } +}; diff --git a/scripts/prebundle.ts b/scripts/prebundle.ts new file mode 100644 index 000000000000..db88139ad9cc --- /dev/null +++ b/scripts/prebundle.ts @@ -0,0 +1,9 @@ +import { run } from './bundle-package'; + +const flags = process.argv.slice(2); +const cwd = process.cwd(); + +run({ cwd, flags }).catch((err) => { + console.error(err.stack); + process.exit(1); +}); diff --git a/yarn.lock b/yarn.lock index a72c03f0ecf8..111d0598aadc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -764,7 +764,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-imports@npm:^7.0.0, @babel/helper-module-imports@npm:^7.12.1, @babel/helper-module-imports@npm:^7.12.13, @babel/helper-module-imports@npm:^7.12.5, @babel/helper-module-imports@npm:^7.16.0, @babel/helper-module-imports@npm:^7.16.7, @babel/helper-module-imports@npm:^7.8.3": +"@babel/helper-module-imports@npm:^7.0.0, @babel/helper-module-imports@npm:^7.10.4, @babel/helper-module-imports@npm:^7.12.1, @babel/helper-module-imports@npm:^7.12.13, @babel/helper-module-imports@npm:^7.12.5, @babel/helper-module-imports@npm:^7.16.0, @babel/helper-module-imports@npm:^7.16.7, @babel/helper-module-imports@npm:^7.8.3": version: 7.16.7 resolution: "@babel/helper-module-imports@npm:7.16.7" dependencies: @@ -6029,6 +6029,67 @@ __metadata: languageName: node linkType: hard +"@rollup/plugin-babel@npm:^5.3.0": + version: 5.3.0 + resolution: "@rollup/plugin-babel@npm:5.3.0" + dependencies: + "@babel/helper-module-imports": ^7.10.4 + "@rollup/pluginutils": ^3.1.0 + peerDependencies: + "@babel/core": ^7.0.0 + "@types/babel__core": ^7.1.9 + rollup: ^1.20.0||^2.0.0 + peerDependenciesMeta: + "@types/babel__core": + optional: true + checksum: e014731ee431b4ad94aed150377037f5a6d653002e72807bddf6185d046834b826141b8016fa242b371950d799d4b33394b746a6b3aaa987437c586bc2d14e00 + languageName: node + linkType: hard + +"@rollup/plugin-commonjs@npm:^21.0.1": + version: 21.0.1 + resolution: "@rollup/plugin-commonjs@npm:21.0.1" + dependencies: + "@rollup/pluginutils": ^3.1.0 + commondir: ^1.0.1 + estree-walker: ^2.0.1 + glob: ^7.1.6 + is-reference: ^1.2.1 + magic-string: ^0.25.7 + resolve: ^1.17.0 + peerDependencies: + rollup: ^2.38.3 + checksum: 640a05ca010c1cec3481c7934f7c24f65a1c8a5f539f6caa1652ec44fa2ddd42bd01b1fb40ce8e81d7bc1259561f91014e9c1bac8332f4dc8a2ef292b8d2d76e + languageName: node + linkType: hard + +"@rollup/plugin-json@npm:^4.1.0": + version: 4.1.0 + resolution: "@rollup/plugin-json@npm:4.1.0" + dependencies: + "@rollup/pluginutils": ^3.0.8 + peerDependencies: + rollup: ^1.20.0 || ^2.0.0 + checksum: 9fc4a3ee60929afcb5269ebda602914d1cf5dc020808f85be90c0a5a2ba9ca26136b0284a1935984861f0549a1e1db30fc372906c14425f5da4909f0fd21e5ea + languageName: node + linkType: hard + +"@rollup/plugin-node-resolve@npm:^13.0.6": + version: 13.1.3 + resolution: "@rollup/plugin-node-resolve@npm:13.1.3" + dependencies: + "@rollup/pluginutils": ^3.1.0 + "@types/resolve": 1.17.1 + builtin-modules: ^3.1.0 + deepmerge: ^4.2.2 + is-module: ^1.0.0 + resolve: ^1.19.0 + peerDependencies: + rollup: ^2.42.0 + checksum: f679239e1b74a10db54adf5837fb6269cc36badd277223bb9b0aa068c27b5156bcc21f3bda818cc4baf1373c0806ac8e561a426cbe5a10c5c97ce90d55a975d2 + languageName: node + linkType: hard + "@rollup/plugin-node-resolve@npm:^7.1.1": version: 7.1.3 resolution: "@rollup/plugin-node-resolve@npm:7.1.3" @@ -6056,6 +6117,20 @@ __metadata: languageName: node linkType: hard +"@rollup/plugin-typescript@npm:^8.3.0": + version: 8.3.0 + resolution: "@rollup/plugin-typescript@npm:8.3.0" + dependencies: + "@rollup/pluginutils": ^3.1.0 + resolve: ^1.17.0 + peerDependencies: + rollup: ^2.14.0 + tslib: "*" + typescript: ">=3.7.0" + checksum: d10ffd4a59d4e5bf36cff8990f9f69194b8d274b81d4b4dcb4eafa6a6e3f5a64589eb3029319ae811bb21643a0e58333631787e36829f3a6e3891289ca7d2dcc + languageName: node + linkType: hard + "@rollup/pluginutils@npm:^3.0.8, @rollup/pluginutils@npm:^3.1.0": version: 3.1.0 resolution: "@rollup/pluginutils@npm:3.1.0" @@ -8191,6 +8266,11 @@ __metadata: "@nrwl/nx-cloud": 12.1.1 "@nrwl/tao": 12.3.4 "@nrwl/workspace": 12.3.4 + "@rollup/plugin-babel": ^5.3.0 + "@rollup/plugin-commonjs": ^21.0.1 + "@rollup/plugin-json": ^4.1.0 + "@rollup/plugin-node-resolve": ^13.0.6 + "@rollup/plugin-typescript": ^8.3.0 "@storybook/addon-a11y": "workspace:*" "@storybook/addon-actions": "workspace:*" "@storybook/addon-backgrounds": "workspace:*" @@ -8287,6 +8367,7 @@ __metadata: danger: ^10.6.2 detect-port: ^1.3.0 downlevel-dts: ^0.6.0 + dts-bundle-generator: ^6.2.0 enzyme: ^3.11.0 enzyme-adapter-react-16: ^1.15.5 eslint: ^7.17.0 @@ -8336,6 +8417,9 @@ __metadata: remark-cli: ^9.0.0 remark-lint: ^8.0.0 remark-preset-lint-recommended: ^5.0.0 + rollup: ^2.60.2 + rollup-plugin-jsx: ^1.0.3 + rollup-plugin-terser: ^7.0.2 serve-static: ^1.14.1 shelljs: ^0.8.4 shx: ^0.3.2 @@ -8582,14 +8666,15 @@ __metadata: "@emotion/is-prop-valid": ^0.8.6 "@emotion/styled": ^10.0.27 "@storybook/client-logger": 6.5.0-alpha.30 + "@types/node": ^14.14.20 || ^16.0.0 core-js: ^3.8.2 deep-object-diff: ^1.1.0 emotion-theming: ^10.0.27 global: ^4.4.0 memoizerific: ^1.11.3 polished: ^4.0.5 - resolve-from: ^5.0.0 ts-dedent: ^2.0.0 + ts-node: ^10.4.0 peerDependencies: react: ^16.8.0 || ^17.0.0 react-dom: ^16.8.0 || ^17.0.0 @@ -10089,6 +10174,15 @@ __metadata: languageName: node linkType: hard +"@types/resolve@npm:1.17.1": + version: 1.17.1 + resolution: "@types/resolve@npm:1.17.1" + dependencies: + "@types/node": "*" + checksum: 6eeb9c27d99bf4b393bf168d43208f63e78cefca5644662a0bdb2bdbf8352386f4f3aca66add138fc41bce5f66fd48a0de430a1473f11b612fbed0375ae78031 + languageName: node + linkType: hard + "@types/responselike@npm:^1.0.0": version: 1.0.0 resolution: "@types/responselike@npm:1.0.0" @@ -12266,7 +12360,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^5.5.3": +"acorn@npm:^5.2.1, acorn@npm:^5.5.3": version: 5.7.4 resolution: "acorn@npm:5.7.4" bin: @@ -13222,6 +13316,13 @@ __metadata: languageName: node linkType: hard +"ast-types@npm:0.9.6": + version: 0.9.6 + resolution: "ast-types@npm:0.9.6" + checksum: d6aa2f8322d7ff7794bae2c25f97211595fc62f591cb097624c1d22fe683ce9a948b2978917d1b8c54ff93d0e09847e3b64f31797d9439e49590e4de0faa6aee + languageName: node + linkType: hard + "ast-types@npm:^0.7.0": version: 0.7.8 resolution: "ast-types@npm:0.7.8" @@ -14264,6 +14365,13 @@ __metadata: languageName: node linkType: hard +"base62@npm:^1.1.0": + version: 1.2.8 + resolution: "base62@npm:1.2.8" + checksum: 41e2a07c90a626f343d0224bd0e6df3962b6baf7e414cfffa76ab8def5ab068e9118e8f19814f6d3a3fe7e0d5d33cd2d72a12dc31fd0c8ff8cfbaace1e5e2488 + languageName: node + linkType: hard + "base64-js@npm:1.3.1": version: 1.3.1 resolution: "base64-js@npm:1.3.1" @@ -16844,7 +16952,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^2.11.0, commander@npm:^2.12.1, commander@npm:^2.18.0, commander@npm:^2.19.0, commander@npm:^2.20.0, commander@npm:^2.6.0": +"commander@npm:^2.11.0, commander@npm:^2.12.1, commander@npm:^2.18.0, commander@npm:^2.19.0, commander@npm:^2.20.0, commander@npm:^2.5.0, commander@npm:^2.6.0": version: 2.20.3 resolution: "commander@npm:2.20.3" checksum: 74c781a5248c2402a0a3e966a0a2bba3c054aad144f5c023364be83265e796b20565aa9feff624132ff629aa64e16999fa40a743c10c12f7c61e96a794b99288 @@ -16914,6 +17022,25 @@ __metadata: languageName: node linkType: hard +"commoner@npm:^0.10.1": + version: 0.10.8 + resolution: "commoner@npm:0.10.8" + dependencies: + commander: ^2.5.0 + detective: ^4.3.1 + glob: ^5.0.15 + graceful-fs: ^4.1.2 + iconv-lite: ^0.4.5 + mkdirp: ^0.5.0 + private: ^0.1.6 + q: ^1.1.2 + recast: ^0.11.17 + bin: + commonize: ./bin/commonize + checksum: 6026519a4cb31a26543cf58e0d310c5ed0185af7983b9371826d113e9e6c8fb5294d56a7fe99dd28b560fde239141150d9419237fceabfeb609434f2088fe536 + languageName: node + linkType: hard + "compare-func@npm:^2.0.0": version: 2.0.0 resolution: "compare-func@npm:2.0.0" @@ -18936,6 +19063,13 @@ __metadata: languageName: node linkType: hard +"defined@npm:^1.0.0": + version: 1.0.0 + resolution: "defined@npm:1.0.0" + checksum: 2b9929414857729a97cfcc77987e65005e03b3fd92747e1d6a743b054c1387b62e669dc453b53e3a8105f1398df6aad54c07eed984871c93be8c7f4560a1828b + languageName: node + linkType: hard + "del@npm:^2.2.0": version: 2.2.2 resolution: "del@npm:2.2.2" @@ -19134,6 +19268,16 @@ __metadata: languageName: node linkType: hard +"detective@npm:^4.3.1": + version: 4.7.1 + resolution: "detective@npm:4.7.1" + dependencies: + acorn: ^5.2.1 + defined: ^1.0.0 + checksum: 91c3ea531658d8dac6953d0436a199b1411e590eec502c46a39003868134d323eff0b905a17cddf1825f6362b46ba3f3c3d57e5fed0039e3449a0241b56dac58 + languageName: node + linkType: hard + "dezalgo@npm:^1.0.0": version: 1.0.3 resolution: "dezalgo@npm:1.0.3" @@ -19549,6 +19693,18 @@ __metadata: languageName: node linkType: hard +"dts-bundle-generator@npm:^6.2.0": + version: 6.4.0 + resolution: "dts-bundle-generator@npm:6.4.0" + dependencies: + typescript: ">=3.0.1" + yargs: ^17.2.1 + bin: + dts-bundle-generator: dist/bin/dts-bundle-generator.js + checksum: c3c9464ed132bba49f82ceff275971e3cdc150aa5d120f581487e5a524930a7e1d66847dbb10155c2b177df9e8dc1fccbe48721b0b19349bfe7aa3aca4fcfec8 + languageName: node + linkType: hard + "duplexer2@npm:~0.1.4": version: 0.1.4 resolution: "duplexer2@npm:0.1.4" @@ -21532,6 +21688,26 @@ __metadata: languageName: node linkType: hard +"esprima-fb@npm:^15001.1.0-dev-harmony-fb": + version: 15001.1.0-dev-harmony-fb + resolution: "esprima-fb@npm:15001.1.0-dev-harmony-fb" + bin: + esparse: ./bin/esparse.js + esvalidate: ./bin/esvalidate.js + checksum: dfc86c1f86b7d50b3424e2ba978f89996b5817b6ab4a177f81b71f7000b62a09dc1779b9cd1d7feb7920b21489e9dc6e6cd77e87ee99cba24e3c2a5609dc5531 + languageName: node + linkType: hard + +"esprima-fb@npm:^15001.1001.0-dev-harmony-fb": + version: 15001.1001.0-dev-harmony-fb + resolution: "esprima-fb@npm:15001.1001.0-dev-harmony-fb" + bin: + esparse: ./bin/esparse.js + esvalidate: ./bin/esvalidate.js + checksum: ed29ff9aa737fe192d5d8f4a05a66fdbbfe35340c4a89e650e05ae9c68c3490b50915514fa47ffa980657cd028ab95c74c7299a0a3e49a4dc0811077cc542da4 + languageName: node + linkType: hard + "esprima@npm:^4.0.0, esprima@npm:^4.0.1, esprima@npm:~4.0.0": version: 4.0.1 resolution: "esprima@npm:4.0.1" @@ -21562,6 +21738,16 @@ __metadata: languageName: node linkType: hard +"esprima@npm:~3.1.0": + version: 3.1.3 + resolution: "esprima@npm:3.1.3" + bin: + esparse: ./bin/esparse.js + esvalidate: ./bin/esvalidate.js + checksum: 1fb9e3e419301aa070803c940ba30e9918cce3690e2f44939097e6094ce91e9833e42206fbf0a33e389d6664d13695e47e92974534da2a3f21dd1ff1bf3c88e3 + languageName: node + linkType: hard + "esquery@npm:^1.4.0": version: 1.4.0 resolution: "esquery@npm:1.4.0" @@ -21619,6 +21805,13 @@ __metadata: languageName: node linkType: hard +"estree-walker@npm:^0.2.1": + version: 0.2.1 + resolution: "estree-walker@npm:0.2.1" + checksum: 5a7285ba6f4fd29d5ac112fdf3950929b2a52805b6683329355cbddf40edf08b52e6c9a4be28b5426e694d54f8b4594478eb66005b9fea641f18fa427e7888c8 + languageName: node + linkType: hard + "estree-walker@npm:^0.6.1": version: 0.6.1 resolution: "estree-walker@npm:0.6.1" @@ -23817,7 +24010,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^5.0.10": +"glob@npm:^5.0.10, glob@npm:^5.0.15": version: 5.0.15 resolution: "glob@npm:5.0.15" dependencies: @@ -25418,7 +25611,7 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24, iconv-lite@npm:^0.4.4": +"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24, iconv-lite@npm:^0.4.4, iconv-lite@npm:^0.4.5": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" dependencies: @@ -26583,6 +26776,15 @@ __metadata: languageName: node linkType: hard +"is-reference@npm:^1.2.1": + version: 1.2.1 + resolution: "is-reference@npm:1.2.1" + dependencies: + "@types/estree": "*" + checksum: 7dc819fc8de7790264a0a5d531164f9f5b9ef5aa1cd05f35322d14db39c8a2ec78fd5d4bf57f9789f3ddd2b3abeea7728432b759636157a42db12a9e8c3b549b + languageName: node + linkType: hard + "is-regex@npm:^1.0.3, is-regex@npm:^1.0.4, is-regex@npm:^1.0.5, is-regex@npm:^1.1.0, is-regex@npm:^1.1.2, is-regex@npm:^1.1.4": version: 1.1.4 resolution: "is-regex@npm:1.1.4" @@ -28287,7 +28489,7 @@ __metadata: languageName: node linkType: hard -"jest-worker@npm:26.6.2, jest-worker@npm:^26.5.0, jest-worker@npm:^26.6.2": +"jest-worker@npm:26.6.2, jest-worker@npm:^26.2.1, jest-worker@npm:^26.5.0, jest-worker@npm:^26.6.2": version: 26.6.2 resolution: "jest-worker@npm:26.6.2" dependencies: @@ -28982,6 +29184,21 @@ __metadata: languageName: node linkType: hard +"jstransform@npm:^11.0.3": + version: 11.0.3 + resolution: "jstransform@npm:11.0.3" + dependencies: + base62: ^1.1.0 + commoner: ^0.10.1 + esprima-fb: ^15001.1.0-dev-harmony-fb + object-assign: ^2.0.0 + source-map: ^0.4.2 + bin: + jstransform: bin/jstransform + checksum: addd3f98ee2ec629c97a6b603c9e8770eee835dad4a3fe132b4b9802eb5d3d6fc410314d155063a3a8fefc55b4790ab69d7f05837ec8a401b3b605eb289f8038 + languageName: node + linkType: hard + "jstransformer@npm:1.0.0": version: 1.0.0 resolution: "jstransformer@npm:1.0.0" @@ -29012,6 +29229,17 @@ __metadata: languageName: node linkType: hard +"jsx-transform@npm:^2.3.0": + version: 2.4.1 + resolution: "jsx-transform@npm:2.4.1" + dependencies: + esprima-fb: ^15001.1001.0-dev-harmony-fb + jstransform: ^11.0.3 + through2: ^2.0.0 + checksum: c861e279841360de1d840157d61d999a5b00aabd678017782f21b5fa63ff2bfb92a2982503ca22d56b5c9a10cef86d86c668ca55089ce3dbe5a5f488e5a8571d + languageName: node + linkType: hard + "jszip@npm:^3.1.3": version: 3.7.1 resolution: "jszip@npm:3.7.1" @@ -30522,6 +30750,15 @@ __metadata: languageName: node linkType: hard +"magic-string@npm:^0.14.0": + version: 0.14.0 + resolution: "magic-string@npm:0.14.0" + dependencies: + vlq: ^0.2.1 + checksum: 2d49700cb0fb32a6db990fb8313e432b0c39c8757522a2b739d578cfd8d71d72db7fd920d9576a4a2b0932ac92bfc4aa1a7abd9f39109234835a005acf87a08c + languageName: node + linkType: hard + "make-dir@npm:^1.0.0": version: 1.3.0 resolution: "make-dir@npm:1.3.0" @@ -32783,6 +33020,13 @@ __metadata: languageName: node linkType: hard +"object-assign@npm:^2.0.0": + version: 2.1.1 + resolution: "object-assign@npm:2.1.1" + checksum: c481245a25ab944cc728fe80bfffbc5957f79ba05b4fe579eb06c0cf9af6737f0228b3e96e73c3c29450b2b359231f5ce7714b4e817976518ca134a19cc1bebb + languageName: node + linkType: hard + "object-copy@npm:^0.1.0": version: 0.1.0 resolution: "object-copy@npm:0.1.0" @@ -36005,7 +36249,7 @@ __metadata: languageName: node linkType: hard -"private@npm:^0.1.8": +"private@npm:^0.1.6, private@npm:^0.1.8, private@npm:~0.1.5": version: 0.1.8 resolution: "private@npm:0.1.8" checksum: 829a23723e5fd3105c72b2dadeeb65743a430f7e6967a8a6f3e49392a1b3ea52975a255376d8c513b0c988bdf162f1a5edf9d9bac27d1ab11f8dba8cdb58880e @@ -37845,6 +38089,18 @@ __metadata: languageName: node linkType: hard +"recast@npm:^0.11.17": + version: 0.11.23 + resolution: "recast@npm:0.11.23" + dependencies: + ast-types: 0.9.6 + esprima: ~3.1.0 + private: ~0.1.5 + source-map: ~0.5.0 + checksum: 8e9bb67f07398354df76c949bc42c044390554803f7c1a22d30e1344b15aa73b3987078b9a0cdee562eb2de2d1c36767cae2d96e41a4b6f3d3fe1eb1d740d988 + languageName: node + linkType: hard + "recast@npm:^0.18.1": version: 0.18.10 resolution: "recast@npm:0.18.10" @@ -39271,6 +39527,17 @@ __metadata: languageName: node linkType: hard +"rollup-plugin-jsx@npm:^1.0.3": + version: 1.0.3 + resolution: "rollup-plugin-jsx@npm:1.0.3" + dependencies: + jsx-transform: ^2.3.0 + magic-string: ^0.14.0 + rollup-pluginutils: ^1.3.1 + checksum: fe404acd2b2860eadc284f07ed25122de5b9b7f925400522eb0c95714923cc2aa4331fa8e629b8b0f2f52942179a89db1a1f9983252fa390f79412864e904102 + languageName: node + linkType: hard + "rollup-plugin-terser@npm:^5.3.1": version: 5.3.1 resolution: "rollup-plugin-terser@npm:5.3.1" @@ -39286,6 +39553,30 @@ __metadata: languageName: node linkType: hard +"rollup-plugin-terser@npm:^7.0.2": + version: 7.0.2 + resolution: "rollup-plugin-terser@npm:7.0.2" + dependencies: + "@babel/code-frame": ^7.10.4 + jest-worker: ^26.2.1 + serialize-javascript: ^4.0.0 + terser: ^5.0.0 + peerDependencies: + rollup: ^2.0.0 + checksum: f79b851c6f7b06555d3a8ce7a4e32abd2b7cb8318e89fb8db73e662fa6e3af1a59920e881d111efc65a7437fd9582b61b1f4859b6fd839ba948616829d92432d + languageName: node + linkType: hard + +"rollup-pluginutils@npm:^1.3.1": + version: 1.5.2 + resolution: "rollup-pluginutils@npm:1.5.2" + dependencies: + estree-walker: ^0.2.1 + minimatch: ^3.0.2 + checksum: dd116e92b66432b987fb0cb1bb71ec7317ec4fa5fe9673a98498fd966e94daef9dc6f34deee204b17bb9438f05b8dfa370bb03e83e06af9e377e4ab9c83b048a + languageName: node + linkType: hard + "rollup-pluginutils@npm:^2.8.1, rollup-pluginutils@npm:^2.8.2": version: 2.8.2 resolution: "rollup-pluginutils@npm:2.8.2" @@ -39322,6 +39613,20 @@ __metadata: languageName: node linkType: hard +"rollup@npm:^2.60.2": + version: 2.64.0 + resolution: "rollup@npm:2.64.0" + dependencies: + fsevents: ~2.3.2 + dependenciesMeta: + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 22d8893e359ae9ed0eb599050276805e1b27ed22adfdcf06f6ad0f7a5d0f40e93e888a1dd6053709f1e8338f29ddbc1e6eab2fe0237c81dd1acad1f6bbb463e4 + languageName: node + linkType: hard + "rst-selector-parser@npm:^2.2.3": version: 2.2.3 resolution: "rst-selector-parser@npm:2.2.3" @@ -40640,7 +40945,7 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.5.0, source-map@npm:^0.5.6, source-map@npm:^0.5.7": +"source-map@npm:^0.5.0, source-map@npm:^0.5.6, source-map@npm:^0.5.7, source-map@npm:~0.5.0": version: 0.5.7 resolution: "source-map@npm:0.5.7" checksum: 904e767bb9c494929be013017380cbba013637da1b28e5943b566031e29df04fba57edf3f093e0914be094648b577372bd8ad247fa98cfba9c600794cd16b599 @@ -42333,7 +42638,7 @@ __metadata: languageName: node linkType: hard -"terser@npm:^5.10.0, terser@npm:^5.2.0, terser@npm:^5.3.4, terser@npm:^5.3.8, terser@npm:^5.7.2": +"terser@npm:^5.0.0, terser@npm:^5.10.0, terser@npm:^5.2.0, terser@npm:^5.3.4, terser@npm:^5.3.8, terser@npm:^5.7.2": version: 5.10.0 resolution: "terser@npm:5.10.0" dependencies: @@ -43433,6 +43738,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:>=3.0.1": + version: 4.5.4 + resolution: "typescript@npm:4.5.4" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 4dccd6947e632cc0070653788a3a81051825e9a7acd4c3586124e5a145148bb57b0a401b81d220ac1eb7742a29d5d22fd35af033f839daa60738c3e4fecb5850 + languageName: node + linkType: hard + "typescript@npm:^3.8.3, typescript@npm:^3.9.7, typescript@npm:~3.9.3": version: 3.9.10 resolution: "typescript@npm:3.9.10" @@ -43463,6 +43778,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@>=3.0.1#~builtin": + version: 4.5.4 + resolution: "typescript@patch:typescript@npm%3A4.5.4#~builtin::version=4.5.4&hash=493e53" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 7e9541c322d8e72164763c5ccb13e6f8534124a5917b697500033c9437e23c81bfdb0e14c9d4dd8cbe9ad78ea605e91eef02f9ee6f94d9f8130ac4846664e31c + languageName: node + linkType: hard + "typescript@patch:typescript@^3.8.3#~builtin, typescript@patch:typescript@^3.9.7#~builtin, typescript@patch:typescript@~3.9.3#~builtin": version: 3.9.10 resolution: "typescript@patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=493e53" @@ -44538,6 +44863,13 @@ __metadata: languageName: node linkType: hard +"vlq@npm:^0.2.1": + version: 0.2.3 + resolution: "vlq@npm:0.2.3" + checksum: d1557b404353ca75c7affaaf403d245a3273a7d1c6b3380ed7f04ae3f080e4658f41ac700d6f48acb3cd4875fe7bc7da4924b3572cd5584a5de83b35b1de5e12 + languageName: node + linkType: hard + "vm-browserify@npm:^1.0.1, vm-browserify@npm:^1.1.2": version: 1.1.2 resolution: "vm-browserify@npm:1.1.2" @@ -46724,6 +47056,13 @@ __metadata: languageName: node linkType: hard +"yargs-parser@npm:^21.0.0": + version: 21.0.0 + resolution: "yargs-parser@npm:21.0.0" + checksum: e7605acabf7a57bd382e781a83702bd2e13069b2c55bbe04d3c40aa6e8104f53ad4e3c78eabb8932306795187ef655e64ac7576f188914ce46c7c9f480155c99 + languageName: node + linkType: hard + "yargs@npm:15.4.1, yargs@npm:^15.3.1, yargs@npm:^15.4.1": version: 15.4.1 resolution: "yargs@npm:15.4.1" @@ -46795,6 +47134,21 @@ __metadata: languageName: node linkType: hard +"yargs@npm:^17.2.1": + version: 17.3.1 + resolution: "yargs@npm:17.3.1" + dependencies: + cliui: ^7.0.2 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.3 + y18n: ^5.0.5 + yargs-parser: ^21.0.0 + checksum: 2c5ff77132468093a1872b8a9798cdcc5da0bcf7a2b0660264ffa91766324b0926c3346e091d249dc3a86caf7e8e623aa0f8de660c9baf440188d4da7d4378c4 + languageName: node + linkType: hard + "yauzl@npm:^2.10.0": version: 2.10.0 resolution: "yauzl@npm:2.10.0"