From fb24a545ce9f5c10ea3f8d62c31fec3ff8f3beb1 Mon Sep 17 00:00:00 2001 From: Kevin Titor <0x142857@gmail.com> Date: Sun, 19 Jul 2020 00:56:05 +0800 Subject: [PATCH 1/2] chore: about type checking --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index dcfba36e..4c15bd11 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,12 @@ tsup [...files] --bundle `dependencies` in your `packages.json` are always excluded, you can also use `--external ` flag to mark specific package as external. +### What about type checking? + +esbuild is fast because it doesn't perform any type checking, you already get type checking from your IDE like VS Code or WebStorm. + +Additionally, if you want type checking at build time, you can enable `--dts`, which will run a real TypeScript compiler to generate declaration file so you get type checking as well. + ### Run a program ```bash From a4714a7eb024be9eed59926778933dd5ce2dd90a Mon Sep 17 00:00:00 2001 From: Kevin Titor <0x142857@gmail.com> Date: Mon, 20 Jul 2020 16:45:18 +0800 Subject: [PATCH 2/2] feat: use esbuild for bundling (#72) BREAKING CHANGE: - Removed `run` command - Using `esbuild` instead of `rollup` for bundling, `dts` file is still generated by rollup. --- .github/workflows/codeql.yml | 52 ----- README.md | 46 +++- package.json | 15 +- src/cli.ts | 92 ++------ src/errors.ts | 2 +- src/index.ts | 282 ++++++++++++++----------- src/resolve-plugin.ts | 68 ------ src/rollup.ts | 97 +++++++++ src/size-plugin.ts | 33 --- src/utils.ts | 18 +- test/__snapshots__/index.test.ts.snap | 9 +- test/index.test.ts | 6 +- test/package.json | 3 +- test/yarn.lock | 5 + yarn.lock | 289 +++++++++++++------------- 15 files changed, 485 insertions(+), 532 deletions(-) delete mode 100644 .github/workflows/codeql.yml delete mode 100644 src/resolve-plugin.ts create mode 100644 src/rollup.ts delete mode 100644 src/size-plugin.ts diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 9771ca0f..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: "Code scanning - action" - -on: - push: - pull_request: - schedule: - - cron: '0 19 * * 0' - -jobs: - CodeQL-Build: - - # CodeQL runs on ubuntu-latest and windows-latest - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - # Override language selection by uncommenting this and choosing your languages - # with: - # languages: go, javascript, csharp, python, cpp, java - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/README.md b/README.md index 4c15bd11..33ff5702 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # tsup -Rollup your TypeScript library with no config, powered by [esbuild](https://github.com/evanw/esbuild). +Bundle your TypeScript library with no config, powered by [esbuild](https://github.com/evanw/esbuild). ## What can it bundle? @@ -30,6 +30,19 @@ tsup [...files] Files are written into `./dist`. +You can bundle multiple files in one go: + +```bash +tsup src/index.ts src/cli.ts +``` + +Code splitting is enabled by default and supported in `cjs` and `esm` format. + +### Excluding packages + + +By default tsup bundles all `import`-ed modules but `dependencies` in your `packages.json` are always excluded, you can also use `--external ` flag to mark other packages as external. + ### Generate declaration file ```bash @@ -40,13 +53,32 @@ This will emit `./dist/index.js` and `./dist/index.d.ts`. If you want to bundle types from `node_modules` as well, use the `--dts-bundle` flag instead, which implicitly set `--dts` flag as well. (Note that this is experimental.) -### Bundle files and node modules +### Bundle formats + +Supported format: `esm`, `cjs`, (default) and `iife`. + +You can bundle in multiple format in one go: ```bash -tsup [...files] --bundle +tsup src/index.ts --format esm,cjs,iife ``` -`dependencies` in your `packages.json` are always excluded, you can also use `--external ` flag to mark specific package as external. +That will output files in following folder structure: + +```bash +dist +├── esm +│ └── index.js +├── iife +│ └── index.js +└── index.js +``` + +### Watch mode + +```bash +tsup src/index.ts --watch +``` ### What about type checking? @@ -54,12 +86,6 @@ esbuild is fast because it doesn't perform any type checking, you already get ty Additionally, if you want type checking at build time, you can enable `--dts`, which will run a real TypeScript compiler to generate declaration file so you get type checking as well. -### Run a program - -```bash -tsup run main.ts -``` - --- For more details: diff --git a/package.json b/package.json index c401bdbe..dbe28305 100644 --- a/package.json +++ b/package.json @@ -13,22 +13,22 @@ "url": "https://github.com/egoist/tsup.git" }, "scripts": { - "build": "rm -rf dist && tsup src/cli.ts src/index.ts --external typescript --bundle --dts", + "build": "rm -rf dist && tsup src/cli.ts src/index.ts src/rollup.ts --external typescript --bundle --dts", "prepublishOnly": "npm run build", "test": "npm run build && jest" }, "dependencies": { "cac": "^6.5.13", - "esbuild": "^0.6.3", + "chalk": "^4.1.0", + "chokidar": "^3.4.1", + "esbuild": "^0.6.4", "joycon": "^2.2.5", "rollup": "^2.21.0", "rollup-plugin-dts": "^1.4.8", - "rollup-plugin-esbuild": "^2.4.1" + "sucrase": "^3.15.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^13.0.1", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^8.4.0", "@types/fs-extra": "^9.0.1", "@types/jest": "^26.0.4", "@types/node": "^14.0.23", @@ -36,13 +36,10 @@ "execa": "^4.0.3", "fs-extra": "^9.0.1", "jest": "^26.1.0", - "kleur": "^4.0.2", "prettier": "^2.0.5", - "pretty-bytes": "^5.3.0", - "resolve": "^1.17.0", "rollup-plugin-hashbang": "^2.2.2", "ts-jest": "^26.1.2", - "tsup": "^2.0.1", + "tsup": "^2.1.0", "typescript": "^3.9.6" } } diff --git a/src/cli.ts b/src/cli.ts index 1903a4a1..72d521f4 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -3,6 +3,14 @@ import { readFileSync } from 'fs' import { join } from 'path' import { cac } from 'cac' import { handlError, PrettyError } from './errors' +import { Format } from './' + +function stringyOrArray(input: string, defaultValue: string[]): string[] { + if (!input) { + return defaultValue + } + return Array.isArray(input) ? input : input.split(',') +} async function main() { const cli = cac('tsup') @@ -12,23 +20,18 @@ async function main() { ignoreOptionDefaultValue: true, }) .option('-d, --out-dir ', 'Output directory', { default: 'dist' }) - .option('--format ', 'Bundle format, "cjs", "iife", "umd", "esm"', { + .option('--format ', 'Bundle format, "cjs", "iife", "esm"', { default: 'cjs', }) .option('--minify', 'Minify bundle') .option('--target ', 'Bundle target, "es20XX" or "esnext"', { default: 'es2017', }) - .option('--bundle', 'Bundle node_modules') .option('--dts', 'Generate declaration file') - .option('--dts-bundle', 'Bundle types from node_modules') .option('--watch', 'Watch mode') .option('--define.* ', 'Define compile-time constants') - .option( - '--external ', - 'Mark specific packages as external (use with --bundle)' - ) - .option('--module-name ', 'Module name (with with --format umd)') + .option('--external ', 'Mark specific packages as external') + .option('--global-name ', 'Global variable name for iife format') .option('--jsxFactory ', 'Name of JSX factory function', { default: 'React.createElement', }) @@ -44,73 +47,12 @@ async function main() { throw new PrettyError(`Missing input files, e.g. tsup src/index.ts`) } - const { rollup, watch } = await import('rollup') - const { createRollupConfigs, printSizes } = await import('./') - const rollupConfigs = await createRollupConfigs(files, options) - if (options.watch) { - const watcher = watch( - rollupConfigs.map((config) => ({ - ...config.inputConfig, - output: config.outputConfig, - })) - ) - let builtOnce = false - watcher.on('event', (event) => { - if (event.code === 'START') { - if (builtOnce) { - console.log(`Rebuilding..`) - } else { - console.log(`Building..`) - } - } - if (event.code === 'END') { - builtOnce = true - printSizes() - } - }) - } else { - const startTime = Date.now() - - await Promise.all( - rollupConfigs.map(async (config) => { - try { - const result = await rollup(config.inputConfig) - await result.write(config.outputConfig) - } catch (err) { - console.error( - `Failed with following plugins used: ${config.inputConfig.plugins - ?.map((p) => p.name) - .join(', ')}` - ) - throw err - } - }) - ) - printSizes() - const endTime = Date.now() - console.log(`Done in ${endTime - startTime}ms`) - } - }) - - cli - .command('run ', 'Bundle and execute a file', { - allowUnknownOptions: true, - }) - .option('--define.* ', 'Define compile-time constants') - .action(async (file: string, options) => { - const extraArgs = process.argv.slice(process.argv.indexOf(file) + 1) - const { rollup } = await import('rollup') - const { createRollupConfigs } = await import('./') - const { runCode } = await import('./run') - const [rollupConfig] = await createRollupConfigs([file], { - define: options.define, - outDir: 'dist', - format: 'cjs', - }) - const bundle = await rollup(rollupConfig.inputConfig) - const { output } = await bundle.write(rollupConfig.outputConfig) - runCode(join('dist', output[0].fileName), { - args: extraArgs, + const { build } = await import('./') + await build({ + ...options, + entryPoints: files, + format: stringyOrArray(options.format, ['cjs']) as Format[], + external: stringyOrArray(options.external, []), }) }) diff --git a/src/errors.ts b/src/errors.ts index 4ccd915e..687e1622 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,4 +1,4 @@ -import colors from 'kleur' +import colors from 'chalk' export class PrettyError extends Error { constructor(message: string) { diff --git a/src/index.ts b/src/index.ts index bc14c77e..f4539300 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,150 +1,186 @@ -import { ModuleFormat, InputOptions, OutputOptions } from 'rollup' -import prettyBytes from 'pretty-bytes' -import colors from 'kleur' -import hashbangPlugin from 'rollup-plugin-hashbang' -import tsPlugin from 'rollup-plugin-esbuild' -import commonjsPlugin from '@rollup/plugin-commonjs' -import jsonPlugin from '@rollup/plugin-json' -import { sizePlugin, caches } from './size-plugin' -import { resolvePlugin } from './resolve-plugin' -import { isExternal, resolveTsConfig } from './utils' +import fs from 'fs' +import { dirname, join } from 'path' +import { Worker } from 'worker_threads' +import colors from 'chalk' +import { Service, startService, BuildResult } from 'esbuild' +import { getDeps, resolveTsConfig } from './utils' +import { FSWatcher } from 'chokidar' -type Options = { - // Bundle packages in node_modules - bundle?: boolean - // Generate .d.ts file - dts?: boolean - // Bundle .d.ts files in node_modules - dtsBundle?: boolean +const textDecoder = new TextDecoder('utf-8') + +export type Format = 'cjs' | 'esm' | 'iife' + +export type Options = { + entryPoints: string[] + /** + * Compile target, like `es2018` + */ target?: string minify?: boolean watch?: boolean jsxFactory?: string jsxFragment?: string outDir?: string - format: ModuleFormat - moduleName?: string + format: Format[] + globalName?: string define?: { [k: string]: string } + dts?: boolean /** Don't bundle these packages */ external?: string[] - inlineDynamicImports?: boolean } -export async function createRollupConfigs(files: string[], options: Options) { - if (options.dtsBundle) { - options.dts = true - } +const services: Map = new Map() - const tsconfig = resolveTsConfig(process.cwd()) || undefined +export const makeLabel = (input: string, type: 'info' | 'success' | 'error') => + colors[type === 'info' ? 'bgBlue' : type === 'error' ? 'bgRed' : 'bgGreen']( + colors.black(` ${input.toUpperCase()} `) + ) - if (tsconfig) { - console.log(`Using tsconfig: ${tsconfig}`) +export async function runEsbuild( + options: Options, + { format }: { format: Format } +): Promise<() => Promise> { + let service = services.get(format) + if (!service) { + service = await startService() + services.set(format, service) + } + const deps = await getDeps(process.cwd()) + const external = [...deps, ...(options.external || [])] + const outDir = options.outDir || 'dist' + const runService = async () => { + console.log(`${makeLabel(format, 'info')} Build start`) + const startTime = Date.now() + const result = + service && + (await service.build({ + entryPoints: options.entryPoints, + format: format === 'cjs' ? 'esm' : format, + bundle: true, + platform: 'node', + globalName: options.globalName, + jsxFactory: options.jsxFactory, + jsxFragment: options.jsxFragment, + define: options.define, + external, + outdir: format === 'cjs' ? outDir : join(outDir, format), + write: false, + splitting: format === 'cjs' || format === 'esm', + })) + const timeInMs = Date.now() - startTime + console.log( + `${makeLabel(format, 'success')} Build success in ${Math.floor( + timeInMs + )}ms` + ) + return result + } + let result + try { + result = await runService() + } catch (error) { + console.error(`${makeLabel(format, 'error')} Build failed`) + return runService + } + // Manually write files + if (result && result.outputFiles) { + const { transform } = await import('sucrase') + await Promise.all( + result.outputFiles.map(async (file) => { + const dir = dirname(file.path) + const outPath = file.path + await fs.promises.mkdir(dir, { recursive: true }) + let mode: number | undefined + if (file.contents[0] === 35 && file.contents[1] === 33) { + mode = 0o755 + } + // Cause we need to transform to code from esm to cjs first + if (format === 'cjs' && outPath.endsWith('.js')) { + const content = transform(textDecoder.decode(file.contents), { + transforms: ['imports'], + }) + await fs.promises.writeFile(outPath, content.code, { + encoding: 'utf8', + mode, + }) + } else { + await fs.promises.writeFile(outPath, file.contents, { + mode, + }) + } + }) + ) } + return runService +} - const getRollupConfig = async ({ - dts, - dtsBundle, - }: { - dts?: boolean - dtsBundle?: boolean - }): Promise<{ - name: string - inputConfig: InputOptions - outputConfig: OutputOptions - }> => { - const compilerOptions: any = { - module: 'esnext', - } +function stopServices() { + for (const [name, service] of services.entries()) { + service.stop() + services.delete(name) + } +} - if (dts) { - compilerOptions.declaration = false - } +export async function build(options: Options) { + let watcher: FSWatcher | undefined + let runServices: Array<() => Promise> | undefined - return { - name: `dts: ${dts}, bundle: ${options.bundle}`, - inputConfig: { - input: files, - preserveEntrySignatures: 'strict', - inlineDynamicImports: options.inlineDynamicImports, - onwarn(warning, handler) { - if ( - warning.code === 'UNRESOLVED_IMPORT' || - warning.code === 'CIRCULAR_DEPENDENCY' - ) { - return - } - return handler(warning) - }, - plugins: [ - hashbangPlugin(), - jsonPlugin(), - !dts && - tsPlugin({ - target: options.target, - watch: options.watch, - minify: options.minify, - jsxFactory: options.jsxFactory, - jsxFragment: options.jsxFragment, - define: options.define, - tsconfig - }), - (!dts || dtsBundle) && - resolvePlugin({ - bundle: options.bundle, - external: options.external, - dtsBundle: dtsBundle, - }), - !dts && - commonjsPlugin({ - // @ts-ignore wrong typing in @rollup/plugin-commonjs - ignore: (name: string) => { - if (!options.external) { - return false - } - return isExternal(options.external, name) - }, - }), - dts && - (await import('rollup-plugin-dts').then((res) => res.default())), - sizePlugin(), + const startWatcher = async () => { + const { watch } = await import('chokidar') + watcher = + watcher || + watch( + [ + ...options.entryPoints.map((entry) => + join(dirname(entry), '**/*.{ts,tsx,js,jsx,mjs,json}') + ), + '!**/{dist,node_modules}/**', + options.outDir ? `!${join(options.outDir, '**')}` : '', ].filter(Boolean), - }, - outputConfig: { - dir: options.outDir || 'dist', - format: options.format || 'cjs', - exports: 'named', - name: options.moduleName, - }, - } + { + ignoreInitial: true, + } + ).on('all', async () => { + if (runServices) { + await Promise.all(runServices.map((runService) => runService())) + } + }) } - const rollupConfigs = [await getRollupConfig({})] - if (options.dts) { - rollupConfigs.push( - await getRollupConfig({ dts: true, dtsBundle: options.dtsBundle }) - ) - } - - return rollupConfigs -} + try { + const tsconfig = resolveTsConfig(process.cwd()) + if (tsconfig) { + console.log(makeLabel('CLI', 'info'), `Using tsconfig: ${tsconfig}`) + } -export function printSizes() { - const result: Map = new Map() - for (const cache of caches.values()) { - for (const [filename, getSize] of cache.entries()) { - result.set(filename, getSize()) + runServices = await Promise.all([ + ...options.format.map((format) => runEsbuild(options, { format })), + ]) + if (options.dts) { + // Run rollup in a worker so it doesn't block the event loop + const worker = new Worker(join(__dirname, 'rollup.js')) + worker.postMessage({ + options, + }) + worker.on('message', data => { + if (data === 'exit') { + worker.unref() + } + }) } - } - const maxNameLength = [...result.keys()].sort((a, b) => - a.length > b.length ? -1 : 1 - )[0].length - for (const [filename, size] of result.entries()) { - console.log( - `${colors.bold(filename.padEnd(maxNameLength))} - ${colors.green( - prettyBytes(size) - )}` - ) + if (options.watch) { + await startWatcher() + } else { + stopServices() + } + } catch (error) { + if (!options.watch) { + stopServices() + } else { + startWatcher() + } + throw error } } diff --git a/src/resolve-plugin.ts b/src/resolve-plugin.ts deleted file mode 100644 index 33b75d1a..00000000 --- a/src/resolve-plugin.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { builtinModules } from 'module' -import { dirname } from 'path' -import { Plugin } from 'rollup' -import JoyCon from 'joycon' -import nodeResolvePlugin from '@rollup/plugin-node-resolve' -import { isExternal } from './utils' - -const PACKAGE_NAME_RE = /^[@a-z]/ - -const joycon = new JoyCon() - -export const resolvePlugin = ({ - bundle, - external, - dtsBundle, -}: { - bundle?: boolean - external?: string[] - dtsBundle?: boolean -}): Plugin => { - const nodeResolve = nodeResolvePlugin({ - mainFields: dtsBundle ? ['types', 'typings'] : ['module', 'main'], - extensions: dtsBundle ? ['.d.ts'] : ['.mjs', '.js', '.json', '.node'], - customResolveOptions: { - moduleDirectory: dtsBundle - ? ['node_modules/@types', 'node_modules'] - : 'node_modules', - }, - }) - - return { - ...nodeResolve, - - async resolveId(source, importer) { - // Always exclude builtin modules - if (builtinModules.includes(source)) { - return false - } - - if (bundle) { - const cwd = importer && dirname(importer) - if (cwd && PACKAGE_NAME_RE.test(source)) { - // Exclude specified packages - if (external && isExternal(external, source, importer)) { - return false - } - - // Exclude "dependencies" in package.json - const pkg = joycon.loadSync(['package.json'], process.cwd()) - - const deps = Object.keys((pkg.data && pkg.data.dependencies) || {}) - - if (deps.includes(source)) { - return false - } - } - - const result = await nodeResolve.resolveId!.call(this, source, importer) - - if (result !== null) { - return result - } - } - - return null - }, - } -} diff --git a/src/rollup.ts b/src/rollup.ts new file mode 100644 index 00000000..446082ed --- /dev/null +++ b/src/rollup.ts @@ -0,0 +1,97 @@ +import { parentPort } from 'worker_threads' +import { InputOptions, OutputOptions } from 'rollup' +import { Options, makeLabel } from './' +import hashbangPlugin from 'rollup-plugin-hashbang' +import jsonPlugin from '@rollup/plugin-json' +import { handlError } from './errors' + +type RollupConfig = { + inputConfig: InputOptions + outputConfig: OutputOptions +} + +const getRollupConfig = async (options: Options): Promise => { + return { + inputConfig: { + input: options.entryPoints, + preserveEntrySignatures: 'strict', + onwarn(warning, handler) { + if ( + warning.code === 'UNRESOLVED_IMPORT' || + warning.code === 'CIRCULAR_DEPENDENCY' || + warning.code === 'EMPTY_BUNDLE' + ) { + return + } + return handler(warning) + }, + plugins: [ + hashbangPlugin(), + jsonPlugin(), + await import('rollup-plugin-dts').then((res) => res.default()), + ].filter(Boolean), + }, + outputConfig: { + dir: options.outDir || 'dist', + format: 'esm', + exports: 'named', + name: options.globalName, + }, + } +} + +async function runRollup(options: RollupConfig) { + const { rollup } = await import('rollup') + try { + const start = Date.now() + const getDuration = () => { + return `${Math.floor(Date.now() - start)}ms` + } + console.log(`${makeLabel('dts', 'info')} Build start`) + const bundle = await rollup(options.inputConfig) + await bundle.write(options.outputConfig) + console.log( + `${makeLabel('dts', 'success')} Build success in ${getDuration()}` + ) + } catch (error) { + console.log(`${makeLabel('dts', 'error')} Build error`) + handlError(error) + } +} + +async function watchRollup(options: { + inputConfig: InputOptions + outputConfig: OutputOptions +}) { + const { watch } = await import('rollup') + let start: number = Date.now() + const getDuration = () => { + return `${Math.floor(Date.now() - start)}ms` + } + watch({ + ...options.inputConfig, + output: options.outputConfig, + }).on('event', (event) => { + if (event.code === 'START') { + start = Date.now() + console.log(`${makeLabel('dts', 'info')} Build start`) + } else if (event.code === 'END') { + console.log( + `${makeLabel('dts', 'success')} Build success in ${getDuration()}` + ) + } else if (event.code === 'ERROR') { + console.log(`${makeLabel('dts', 'error')} Build error`) + handlError(event.error) + } + }) +} + +parentPort?.on('message', async (data: { options: Options }) => { + const config = await getRollupConfig(data.options) + if (data.options.watch) { + watchRollup(config) + } else { + await runRollup(config) + parentPort?.postMessage('exit') + } +}) diff --git a/src/size-plugin.ts b/src/size-plugin.ts deleted file mode 100644 index dac37880..00000000 --- a/src/size-plugin.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { join, relative } from 'path' -import { Plugin } from 'rollup' - -type Cache = Map number> - -export const caches: Map = new Map() - -export const sizePlugin = (): Plugin => { - const key = Math.random() - let cache: Cache - return { - name: 'size', - - buildStart() { - cache = new Map() - caches.set(key, cache) - }, - - generateBundle(options, bundle, isWrite) { - if (isWrite) { - for (const key of Object.keys(bundle)) { - const file = bundle[key] - if (file.type === 'chunk') { - cache.set( - relative(process.cwd(), join(options.dir || '', file.fileName)), - () => file.code.length - ) - } - } - } - }, - } -} diff --git a/src/utils.ts b/src/utils.ts index f18dadc4..81a4cadc 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,11 +1,16 @@ import JoyCon from 'joycon' +const joycon = new JoyCon() + // No backslash in path function slash(input: string) { return input.replace(/\\/g, '/') } -export type External = string | RegExp | ((id: string, parentId?: string) => boolean) +export type External = + | string + | RegExp + | ((id: string, parentId?: string) => boolean) export function isExternal( externals: External | External[], @@ -41,6 +46,13 @@ export function isExternal( } export function resolveTsConfig(cwd: string) { - const joycon = new JoyCon() return joycon.resolveSync(['tsconfig.build.json', 'tsconfig.json'], cwd) -} \ No newline at end of file +} + +export async function getDeps(cwd: string) { + const { data } = await joycon.load(['package.json'], cwd) + + const deps = Object.keys(data?.dependencies || {}) + + return deps +} diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index 26b9be13..6910f29e 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -1,12 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`simple 1`] = ` -"'use strict'; +"\\"use strict\\";Object.defineProperty(exports, \\"__esModule\\", {value: true});// foo.ts +var foo_default = \\"foo\\"; -Object.defineProperty(exports, '__esModule', { value: true }); +// input.ts +var input_default = foo_default; -var foo2 = \\"foo\\"; -exports.default = foo2; +exports.default = input_default; " `; diff --git a/test/index.test.ts b/test/index.test.ts index a293492b..ce7594ea 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -45,12 +45,12 @@ runTest('simple', { }) runTest( - 'bundle graphql-tools with dts bundle', + 'bundle graphql-tools with --dts flag', { - 'input.ts': `export { makeExecutableSchema, SchemaDirectiveVisitor } from 'graphql-tools'`, + 'input.ts': `export { makeExecutableSchema } from 'graphql-tools'`, }, { - flags: ['--bundle', '--dts-bundle'], snapshot: false, + flags: ['--dts'] } ) diff --git a/test/package.json b/test/package.json index 48a656c1..75d75126 100644 --- a/test/package.json +++ b/test/package.json @@ -1,6 +1,7 @@ { "private": true, "devDependencies": { - "graphql-tools": "^5.0.0" + "graphql-tools": "^5.0.0", + "graphql": "^15.3.0" } } diff --git a/test/yarn.lock b/test/yarn.lock index e02f4d37..da7388eb 100644 --- a/test/yarn.lock +++ b/test/yarn.lock @@ -110,6 +110,11 @@ graphql-tools@^5.0.0: tslib "^1.11.1" uuid "^7.0.3" +graphql@^15.3.0: + version "15.3.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.3.0.tgz#3ad2b0caab0d110e3be4a5a9b2aa281e362b5278" + integrity sha512-GTCJtzJmkFLWRfFJuoo9RWWa/FfamUHgiFosxi/X1Ani4AVWbeyBenZTNX6dM+7WSbbFfTo/25eh0LLkwHMw2w== + iterall@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" diff --git a/yarn.lock b/yarn.lock index ca5b72e9..2f957e90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -477,19 +477,6 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@rollup/plugin-commonjs@^13.0.1": - version "13.0.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-13.0.1.tgz#4fe12144271af724db35bac07b9bf718f22332e0" - integrity sha512-4G08+lhTIPxp6g5eDGiwD4BKr3Pf467h+Sfhvd7kztSpZyplQv0dAtcWbGqJ9kV0ovgGo/Z6Hhl1d/q6egkl6Q== - dependencies: - "@rollup/pluginutils" "^3.0.8" - commondir "^1.0.1" - estree-walker "^1.0.1" - glob "^7.1.2" - is-reference "^1.1.2" - magic-string "^0.25.2" - resolve "^1.11.0" - "@rollup/plugin-json@^4.1.0": version "4.1.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" @@ -497,19 +484,6 @@ dependencies: "@rollup/pluginutils" "^3.0.8" -"@rollup/plugin-node-resolve@^8.4.0": - version "8.4.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.4.0.tgz#261d79a680e9dc3d86761c14462f24126ba83575" - integrity sha512-LFqKdRLn0ShtQyf6SBYO69bGE1upV6wUhBX0vFOUnLAyzx5cwp8svA0eHUnu8+YU57XOkrMtfG63QOpQx25pHQ== - dependencies: - "@rollup/pluginutils" "^3.1.0" - "@types/resolve" "1.17.1" - builtin-modules "^3.1.0" - deep-freeze "^0.0.1" - deepmerge "^4.2.2" - is-module "^1.0.0" - resolve "^1.17.0" - "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -644,7 +618,7 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.0.tgz#dc85454b953178cc6043df5208b9e949b54a3bc4" integrity sha512-/rM+sWiuOZ5dvuVzV37sUuklsbg+JPOP8d+nNFlo2ZtfpzPiPvh1/gc8liWOLBqe+sR+ZM7guPaIcTt6UZTo7Q== -"@types/resolve@1.17.1", "@types/resolve@^1.17.1": +"@types/resolve@^1.17.1": version "1.17.1" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== @@ -728,6 +702,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: "@types/color-name" "^1.1.1" color-convert "^2.0.1" +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= + anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -736,7 +715,7 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -anymatch@^3.0.3: +anymatch@^3.0.3, anymatch@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== @@ -897,6 +876,11 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" +binary-extensions@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9" + integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -921,7 +905,7 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.1: +braces@^3.0.1, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -952,11 +936,6 @@ buffer-from@1.x, buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -builtin-modules@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" - integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== - cac@^6.5.13: version "6.5.13" resolved "https://registry.yarnpkg.com/cac/-/cac-6.5.13.tgz#8d9be6dce0afb707c76c5962bf9cc6571f4c933a" @@ -1029,11 +1008,34 @@ chalk@^4.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== +chokidar@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.1.tgz#e905bdecf10eaa0a0b1db0c664481cc4cbc22ba1" + integrity sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.4.0" + optionalDependencies: + fsevents "~2.1.2" + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -1107,10 +1109,10 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== component-emitter@^1.2.1: version "1.3.0" @@ -1221,11 +1223,6 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= -deep-freeze@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/deep-freeze/-/deep-freeze-0.0.1.tgz#3a0b0005de18672819dfd38cd31f91179c893e84" - integrity sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ= - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -1317,6 +1314,11 @@ esbuild@^0.6.3: resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.6.3.tgz#a957e22f2503c745793514388110f9b55b3a6f83" integrity sha512-4lHgz/EvGLRQnDYzzrvW+eilaPHim5pCLz4mP0k0QIalD/n8Ji2NwQwoIa1uX+yKkbn9R/FAZvaEbodjx55rDg== +esbuild@^0.6.4: + version "0.6.5" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.6.5.tgz#efbe11cf51abd0d4d489ca1bc80fd4761a35bd16" + integrity sha512-glMZd0b6W2soHuUuchM6c55e6gbdDhVpvYcmLsH3OJo87hQZcb3lFPZAJ5MbzLCJa2bChQOaoC4bqVtbqfsM/A== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1505,15 +1507,6 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-cache-dir@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" - integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== - dependencies: - commondir "^1.0.1" - make-dir "^3.0.2" - pkg-dir "^4.1.0" - find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -1548,15 +1541,6 @@ fragment-cache@^0.2.1: dependencies: map-cache "^0.2.2" -fs-extra@8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" - integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc" @@ -1618,7 +1602,14 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob-parent@~5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + dependencies: + is-glob "^4.0.1" + +glob@7.1.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -1787,6 +1778,13 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -1848,6 +1846,11 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -1858,10 +1861,12 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== -is-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" - integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" is-number@^3.0.0: version "3.0.0" @@ -1887,13 +1892,6 @@ is-potential-custom-element-name@^1.0.0: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz#0c52e54bcca391bb2c494b21e8626d7336c6e397" integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c= -is-reference@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427" - integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw== - dependencies: - "@types/estree" "0.0.39" - is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -2464,13 +2462,6 @@ json5@2.x, json5@^2.1.2: dependencies: minimist "^1.2.5" -jsonfile@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179" @@ -2519,11 +2510,6 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== -kleur@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.0.2.tgz#57b36cc5235601f824c33e6e45db10cd5493dbf5" - integrity sha512-FGCCxczbrZuF5CtMeO0xfnjhzkVZSXfcWK90IPLucDWZwskrpYN7pmRIgvd8muU0mrPrzy4A2RBGuwCjLHI+nw== - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -2571,14 +2557,7 @@ magic-string@^0.22.4: dependencies: vlq "^0.2.2" -magic-string@^0.25.2: - version "0.25.7" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" - integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== - dependencies: - sourcemap-codec "^1.4.4" - -make-dir@^3.0.0, make-dir@^3.0.2: +make-dir@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== @@ -2693,6 +2672,15 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +mz@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -2759,7 +2747,7 @@ normalize-path@^2.1.1: dependencies: remove-trailing-separator "^1.0.1" -normalize-path@^3.0.0: +normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== @@ -2788,6 +2776,11 @@ oauth-sign@~0.9.0: resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" @@ -2916,7 +2909,7 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.2: +picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1, picomatch@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== @@ -2928,7 +2921,7 @@ pirates@^4.0.1: dependencies: node-modules-regexp "^1.0.0" -pkg-dir@^4.1.0, pkg-dir@^4.2.0: +pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== @@ -2950,11 +2943,6 @@ prettier@^2.0.5: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== -pretty-bytes@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2" - integrity sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg== - pretty-format@^25.2.1, pretty-format@^25.5.0: version "25.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a" @@ -3030,6 +3018,13 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" +readdirp@~3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.4.0.tgz#9fdccdf9e9155805449221ac645e8303ab5b9ada" + integrity sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ== + dependencies: + picomatch "^2.2.1" + regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" @@ -3122,14 +3117,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@1.15.1: - version "1.15.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" - integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== - dependencies: - path-parse "^1.0.6" - -resolve@^1.10.0, resolve@^1.11.0, resolve@^1.17.0, resolve@^1.3.2: +resolve@^1.10.0, resolve@^1.17.0, resolve@^1.3.2: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== @@ -3148,7 +3136,7 @@ rimraf@^3.0.0: dependencies: glob "^7.1.3" -rollup-plugin-dts@^1.4.7, rollup-plugin-dts@^1.4.8: +rollup-plugin-dts@^1.4.8: version "1.4.8" resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-1.4.8.tgz#3b0eadc285aede11c3f5ced72b56b5f7735df95c" integrity sha512-2qHB4B3oaTyi1mDmqDzsRGKlev32v3EhMUAmc45Cn9eB22R7FsYDiigvT9XdM/oQzfd0qv5MkeZju8DP0nauiA== @@ -3171,18 +3159,7 @@ rollup-plugin-hashbang@^2.2.2: dependencies: magic-string "^0.22.4" -rollup-plugin-typescript2@^0.27.1: - version "0.27.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.27.1.tgz#4f27193408a8f040139eed3e3db7b0c7f3668200" - integrity sha512-RJl77Bbj1EunAQDC3dK/O2HWuSUX3oJbRGzyLoS5o9W4Hs1Nix3Gavqj1Lzs5Y6Ff4H2xXfmZ1WWUQCYocSbzQ== - dependencies: - "@rollup/pluginutils" "^3.0.8" - find-cache-dir "^3.3.1" - fs-extra "8.1.0" - resolve "1.15.1" - tslib "1.11.2" - -rollup@^2.20.0, rollup@^2.21.0: +rollup@^2.21.0: version "2.21.0" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.21.0.tgz#d2e114533812043d5c9b7b0a83f1b2a242e4e1d6" integrity sha512-BEGgy+wSzux7Ycq58pRiWEOBZaXRXTuvzl1gsm7gqmsAHxkWf9nyA5V2LN9fGSHhhDQd0/C13iRzSh4bbIpWZQ== @@ -3381,11 +3358,6 @@ source-map@^0.7.3: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -sourcemap-codec@^1.4.4: - version "1.4.8" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" - integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== - spdx-correct@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" @@ -3503,6 +3475,18 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +sucrase@^3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.15.0.tgz#78596a78be7264a65b52ed8d873883413ef0220c" + integrity sha512-05TJOUfMgckH7wKqfk/1p4G6q16nIeW/GHQwD44vkT0mQMqqzgfHCwkX3whNmwyOo7nVF0jDLwVu/qOBTtsscw== + dependencies: + commander "^4.0.0" + glob "7.1.6" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -3547,6 +3531,20 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + throat@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" @@ -3618,6 +3616,11 @@ tr46@^2.0.2: dependencies: punycode "^2.1.1" +ts-interface-checker@^0.1.9: + version "0.1.11" + resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.11.tgz#07e7eddb08212f83fef12c253d0cefa8c70fe1bc" + integrity sha512-Jx6cFBiuCQrRl3CgoIOamIE/toZ8jQJbIlsLGpkBiUpCEUyFcyZ2pvjP8kSXIcz8V5v/murgm/5EfIQapUmh6A== + ts-jest@^26.1.2: version "26.1.2" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.1.2.tgz#dd2e832ffae9cb803361483b6a3010a6413dc475" @@ -3634,26 +3637,17 @@ ts-jest@^26.1.2: semver "7.x" yargs-parser "18.x" -tslib@1.11.2: - version "1.11.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9" - integrity sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg== - -tslib@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3" - integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g== - -tsup@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/tsup/-/tsup-2.0.1.tgz#1356c4645a8557be3878ff98f99bbad6bb00ad3c" - integrity sha512-yInVRdjlJfjUDByNAUCdVQPgLtw8nPlw7Zw4wwUHP0BCIRFWb4D2Di6bakCsWbwfp4PjF9lvUfiNbElmB9GFAQ== +tsup@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tsup/-/tsup-2.1.0.tgz#2d6410d38a62e28a20eb6cb863fe5590b5488b3c" + integrity sha512-olm/SXqV58FUczleRXRuZiUB3odEbH+BH+AQGZgW8PgTkCKjN+MIvw7T6KewH6Y0guUFkJJw7M4q8EMYjaIioA== dependencies: + cac "^6.5.13" + esbuild "^0.6.3" joycon "^2.2.5" - rollup "^2.20.0" - rollup-plugin-dts "^1.4.7" - rollup-plugin-typescript2 "^0.27.1" - tslib "^2.0.0" + rollup "^2.21.0" + rollup-plugin-dts "^1.4.8" + rollup-plugin-esbuild "^2.4.1" tunnel-agent@^0.6.0: version "0.6.0" @@ -3716,11 +3710,6 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^2.0.1" -universalify@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" - integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== - universalify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"