@servicetitan/startup 36.4.0 → 37.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/analyze.js +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +4 -5
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -1
- package/dist/cli/commands/bundle-vite.js +18 -1
- package/dist/cli/commands/bundle-vite.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +6 -0
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +10 -1
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/command-registry.d.ts +12 -28
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +0 -3
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +6 -0
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +10 -1
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +2 -0
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts +13 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.js +72 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.js.map +1 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +3 -4
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.d.ts.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +7 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/get-bundle-command.d.ts +3 -0
- package/dist/cli/utils/get-bundle-command.d.ts.map +1 -0
- package/dist/cli/utils/get-bundle-command.js +16 -0
- package/dist/cli/utils/get-bundle-command.js.map +1 -0
- package/dist/cli/utils/get-exit-code.d.ts +12 -0
- package/dist/cli/utils/get-exit-code.d.ts.map +1 -0
- package/dist/cli/utils/get-exit-code.js +26 -0
- package/dist/cli/utils/get-exit-code.js.map +1 -0
- package/dist/cli/utils/index.d.ts +3 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +3 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/resolve-bundler.d.ts +8 -0
- package/dist/cli/utils/resolve-bundler.d.ts.map +1 -0
- package/dist/cli/utils/resolve-bundler.js +24 -0
- package/dist/cli/utils/resolve-bundler.js.map +1 -0
- package/dist/core/bundle-report.d.ts +4 -0
- package/dist/core/bundle-report.d.ts.map +1 -0
- package/dist/core/bundle-report.js +43 -0
- package/dist/core/bundle-report.js.map +1 -0
- package/dist/core/check-resource/check-resource.d.ts +5 -3
- package/dist/core/check-resource/check-resource.d.ts.map +1 -1
- package/dist/core/check-resource/check-resource.js +20 -13
- package/dist/core/check-resource/check-resource.js.map +1 -1
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts +11 -1
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts.map +1 -1
- package/dist/core/check-resource/get-peer-dependency-meta.js +58 -2
- package/dist/core/check-resource/get-peer-dependency-meta.js.map +1 -1
- package/dist/core/check-resource/index.d.ts +1 -1
- package/dist/core/check-resource/index.d.ts.map +1 -1
- package/dist/core/check-resource/index.js.map +1 -1
- package/dist/core/check-resource/is-resolvable.d.ts +7 -0
- package/dist/core/check-resource/is-resolvable.d.ts.map +1 -0
- package/dist/core/check-resource/is-resolvable.js +31 -0
- package/dist/core/check-resource/is-resolvable.js.map +1 -0
- package/dist/core/check-resource/types.d.ts +1 -0
- package/dist/core/check-resource/types.d.ts.map +1 -1
- package/dist/core/chunk-patterns.d.ts +7 -0
- package/dist/core/chunk-patterns.d.ts.map +1 -0
- package/dist/core/chunk-patterns.js +37 -0
- package/dist/core/chunk-patterns.js.map +1 -0
- package/dist/core/create-build-context.d.ts +0 -1
- package/dist/core/create-build-context.d.ts.map +1 -1
- package/dist/core/create-build-context.js +2 -2
- package/dist/core/create-build-context.js.map +1 -1
- package/dist/core/create-extension-regexp.d.ts +5 -0
- package/dist/core/create-extension-regexp.d.ts.map +1 -0
- package/dist/core/create-extension-regexp.js +45 -0
- package/dist/core/create-extension-regexp.js.map +1 -0
- package/dist/core/get-process-env.d.ts +3 -0
- package/dist/core/get-process-env.d.ts.map +1 -0
- package/dist/core/get-process-env.js +25 -0
- package/dist/core/get-process-env.js.map +1 -0
- package/dist/core/index.d.ts +8 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/moment-locales.d.ts +2 -0
- package/dist/core/moment-locales.d.ts.map +1 -0
- package/dist/core/moment-locales.js +21 -0
- package/dist/core/moment-locales.js.map +1 -0
- package/dist/core/resolve-output-path.d.ts +3 -0
- package/dist/core/resolve-output-path.d.ts.map +1 -0
- package/dist/core/resolve-output-path.js +25 -0
- package/dist/core/resolve-output-path.js.map +1 -0
- package/dist/core/resolve-output-root.d.ts +3 -0
- package/dist/core/resolve-output-root.d.ts.map +1 -0
- package/dist/core/resolve-output-root.js +23 -0
- package/dist/core/resolve-output-root.js.map +1 -0
- package/dist/core/sort-shared-css.d.ts +2 -0
- package/dist/core/sort-shared-css.d.ts.map +1 -0
- package/dist/core/sort-shared-css.js +20 -0
- package/dist/core/sort-shared-css.js.map +1 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/cypress/config/index.d.ts +1 -0
- package/dist/cypress/config/index.d.ts.map +1 -1
- package/dist/cypress/config/index.js +1 -0
- package/dist/cypress/config/index.js.map +1 -1
- package/dist/cypress/config/vite-config.d.ts +3 -0
- package/dist/cypress/config/vite-config.d.ts.map +1 -0
- package/dist/cypress/config/vite-config.js +58 -0
- package/dist/cypress/config/vite-config.js.map +1 -0
- package/dist/jest/resolver.d.ts.map +1 -1
- package/dist/jest/resolver.js +20 -1
- package/dist/jest/resolver.js.map +1 -1
- package/dist/storybook-config/index.d.ts +1 -0
- package/dist/storybook-config/index.d.ts.map +1 -1
- package/dist/storybook-config/index.js +1 -0
- package/dist/storybook-config/index.js.map +1 -1
- package/dist/storybook-config/vite-final.d.ts +7 -0
- package/dist/storybook-config/vite-final.d.ts.map +1 -0
- package/dist/storybook-config/vite-final.js +86 -0
- package/dist/storybook-config/vite-final.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +15 -10
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +32 -2
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-name.d.ts +2 -1
- package/dist/utils/get-package-name.d.ts.map +1 -1
- package/dist/utils/get-package-name.js +4 -2
- package/dist/utils/get-package-name.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +6 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/validate-shared-dependencies.d.ts.map +1 -1
- package/dist/utils/validate-shared-dependencies.js +4 -0
- package/dist/utils/validate-shared-dependencies.js.map +1 -1
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
- package/dist/vite/build-shared-dependencies.js +1 -2
- package/dist/vite/build-shared-dependencies.js.map +1 -1
- package/dist/vite/config/asset-file-names.d.ts +4 -0
- package/dist/vite/config/asset-file-names.d.ts.map +1 -0
- package/dist/vite/config/asset-file-names.js +29 -0
- package/dist/vite/config/asset-file-names.js.map +1 -0
- package/dist/vite/config/base-config.d.ts.map +1 -1
- package/dist/vite/config/base-config.js +67 -40
- package/dist/vite/config/base-config.js.map +1 -1
- package/dist/vite/config/code-splitting.d.ts +4 -0
- package/dist/vite/config/code-splitting.d.ts.map +1 -0
- package/dist/vite/config/code-splitting.js +48 -0
- package/dist/vite/config/code-splitting.js.map +1 -0
- package/dist/vite/config/create-css-config.d.ts +3 -0
- package/dist/vite/config/create-css-config.d.ts.map +1 -0
- package/dist/vite/config/create-css-config.js +26 -0
- package/dist/vite/config/create-css-config.js.map +1 -0
- package/dist/vite/config/create-filtering-logger.d.ts +3 -0
- package/dist/vite/config/create-filtering-logger.d.ts.map +1 -0
- package/dist/vite/config/create-filtering-logger.js +37 -0
- package/dist/vite/config/create-filtering-logger.js.map +1 -0
- package/dist/vite/config/create-vite-build-context.d.ts +2 -1
- package/dist/vite/config/create-vite-build-context.d.ts.map +1 -1
- package/dist/vite/config/create-vite-build-context.js.map +1 -1
- package/dist/vite/config/create-vite-config.d.ts.map +1 -1
- package/dist/vite/config/create-vite-config.js +30 -13
- package/dist/vite/config/create-vite-config.js.map +1 -1
- package/dist/vite/config/get-warmup-client-files.d.ts +3 -0
- package/dist/vite/config/get-warmup-client-files.d.ts.map +1 -0
- package/dist/vite/config/get-warmup-client-files.js +26 -0
- package/dist/vite/config/get-warmup-client-files.js.map +1 -0
- package/dist/vite/index.html +1 -0
- package/dist/vite/plugins/bundle-stat-plugin.d.ts +4 -0
- package/dist/vite/plugins/bundle-stat-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/bundle-stat-plugin.js +32 -0
- package/dist/vite/plugins/bundle-stat-plugin.js.map +1 -0
- package/dist/vite/plugins/chain-source-maps-plugin.d.ts +3 -0
- package/dist/vite/plugins/chain-source-maps-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/chain-source-maps-plugin.js +37 -0
- package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -0
- package/dist/vite/plugins/clean-plugin.d.ts +4 -0
- package/dist/vite/plugins/clean-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/clean-plugin.js +63 -0
- package/dist/vite/plugins/clean-plugin.js.map +1 -0
- package/dist/vite/plugins/design-system-guard-plugin.d.ts +4 -0
- package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/design-system-guard-plugin.js +35 -0
- package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +21 -3
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/ignore-modules-plugin.js +22 -8
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
- package/dist/vite/plugins/index.d.ts +7 -0
- package/dist/vite/plugins/index.d.ts.map +1 -1
- package/dist/vite/plugins/index.js +7 -0
- package/dist/vite/plugins/index.js.map +1 -1
- package/dist/vite/plugins/istanbul-plugin.d.ts +4 -0
- package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/istanbul-plugin.js +27 -0
- package/dist/vite/plugins/istanbul-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/magic-comments-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/index.js +20 -0
- package/dist/vite/plugins/magic-comments-plugin/index.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts +4 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +63 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts +6 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js +40 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js.map +1 -0
- package/dist/vite/plugins/metadata-plugin.js +2 -2
- package/dist/vite/plugins/metadata-plugin.js.map +1 -1
- package/dist/vite/plugins/moment-locales-plugin.d.ts +5 -0
- package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/moment-locales-plugin.js +50 -0
- package/dist/vite/plugins/moment-locales-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts +14 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js +100 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts +3 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js +56 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts +2 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.js +19 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.js +20 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/{shared-dependencies-plugin.js → shared-dependencies-plugin/shared-dependencies-plugin.js} +29 -107
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -0
- package/dist/vite/plugins/utils/import-esm.d.ts +2 -0
- package/dist/vite/plugins/utils/import-esm.d.ts.map +1 -0
- package/dist/vite/plugins/utils/import-esm.js +22 -0
- package/dist/vite/plugins/utils/import-esm.js.map +1 -0
- package/dist/vite/plugins/utils/index.d.ts +3 -0
- package/dist/vite/plugins/utils/index.d.ts.map +1 -0
- package/dist/vite/plugins/utils/index.js +21 -0
- package/dist/vite/plugins/utils/index.js.map +1 -0
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +53 -24
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +0 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +11 -3
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +2 -21
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts +5 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.js +20 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.js.map +1 -0
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +1 -4
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts +2 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js +11 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +26 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +41 -10
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/index.d.ts +1 -0
- package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/index.js +1 -0
- package/dist/webpack/configs/plugins/index.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +2 -5
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js +1 -0
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js +2 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js +2 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +8 -3
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/create-webpack-configs.d.ts.map +1 -1
- package/dist/webpack/create-webpack-configs.js +4 -12
- package/dist/webpack/create-webpack-configs.js.map +1 -1
- package/dist/webpack/types.d.ts +1 -1
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.js +1 -2
- package/dist/webpack/utils/create-webpack-build-context.js.map +1 -1
- package/package.json +22 -18
- package/src/cli/commands/__tests__/build.test.ts +33 -5
- package/src/cli/commands/__tests__/bundle-vite.test.ts +50 -1
- package/src/cli/commands/__tests__/start.test.ts +17 -4
- package/src/cli/commands/build.ts +5 -6
- package/src/cli/commands/bundle-vite.ts +13 -0
- package/src/cli/commands/registry/build.ts +6 -1
- package/src/cli/commands/registry/command-registry.ts +0 -1
- package/src/cli/commands/registry/start.ts +6 -1
- package/src/cli/commands/review/rules/__tests__/require-compatible-typescript.test.ts +127 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/require-compatible-typescript.ts +64 -0
- package/src/cli/commands/start.ts +4 -4
- package/src/cli/commands/test/runners/__tests__/vitest.test.ts +8 -1
- package/src/cli/commands/test/runners/vitest.ts +5 -3
- package/src/cli/index.ts +2 -2
- package/src/cli/utils/__tests__/get-bundle-command.test.ts +23 -0
- package/src/cli/utils/__tests__/get-exit-code.test.ts +41 -0
- package/src/cli/utils/__tests__/resolve-bundler.test.ts +64 -0
- package/src/cli/utils/get-bundle-command.ts +5 -0
- package/src/cli/utils/get-exit-code.ts +17 -0
- package/src/cli/utils/index.ts +3 -0
- package/src/cli/utils/resolve-bundler.ts +23 -0
- package/src/core/__tests__/bundle-report.test.ts +60 -0
- package/src/core/__tests__/create-extension-regexp.test.ts +32 -0
- package/src/core/__tests__/resolve-output-path.test.ts +45 -0
- package/src/core/__tests__/resolve-output-root.test.ts +37 -0
- package/src/core/__tests__/sort-shared-css.test.ts +39 -0
- package/src/core/bundle-report.ts +33 -0
- package/src/core/check-resource/__tests__/check-resource.test.ts +21 -7
- package/src/core/check-resource/__tests__/get-peer-dependency-meta.test.ts +70 -13
- package/src/core/check-resource/__tests__/is-resolvable.test.ts +20 -0
- package/src/core/check-resource/check-resource.ts +17 -16
- package/src/core/check-resource/get-peer-dependency-meta.ts +67 -4
- package/src/core/check-resource/index.ts +1 -1
- package/src/core/check-resource/is-resolvable.ts +19 -0
- package/src/core/check-resource/types.ts +2 -0
- package/src/core/chunk-patterns.ts +30 -0
- package/src/core/create-build-context.ts +2 -2
- package/src/core/create-extension-regexp.ts +7 -0
- package/src/core/get-process-env.ts +17 -0
- package/src/core/index.ts +8 -1
- package/src/core/moment-locales.ts +6 -0
- package/src/core/resolve-output-path.ts +10 -0
- package/src/core/resolve-output-root.ts +8 -0
- package/src/core/sort-shared-css.ts +7 -0
- package/src/core/types.ts +1 -1
- package/src/cypress/config/__tests__/vite-config.test.ts +72 -0
- package/src/cypress/config/index.ts +1 -0
- package/src/cypress/config/vite-config.ts +37 -0
- package/src/jest/__tests__/resolver.test.ts +42 -1
- package/src/jest/resolver.ts +17 -1
- package/src/storybook-config/__tests__/vite-final.test.ts +122 -0
- package/src/storybook-config/index.ts +1 -0
- package/src/storybook-config/vite-final.ts +65 -0
- package/src/utils/__tests__/get-configuration.test.ts +82 -5
- package/src/utils/__tests__/get-package-name.test.ts +57 -0
- package/src/utils/__tests__/validate-shared-dependencies.test.ts +50 -35
- package/src/utils/get-configuration.ts +50 -15
- package/src/utils/get-package-name.ts +8 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/types.ts +1 -0
- package/src/utils/validate-shared-dependencies.ts +15 -1
- package/src/vite/__tests__/build-shared-dependencies.test.ts +13 -26
- package/src/vite/__tests__/validate-shared-dependencies.test.ts +30 -19
- package/src/vite/build-shared-dependencies.ts +3 -7
- package/src/vite/config/__tests__/asset-file-names.test.ts +40 -0
- package/src/vite/config/__tests__/base-config.test.ts +99 -31
- package/src/vite/config/__tests__/code-splitting.test.ts +34 -0
- package/src/vite/config/__tests__/create-css-config.test.ts +58 -0
- package/src/vite/config/__tests__/create-filtering-logger.test.ts +51 -0
- package/src/vite/config/__tests__/create-vite-build-context.test.ts +5 -2
- package/src/vite/config/__tests__/create-vite-config.test.ts +91 -13
- package/src/vite/config/__tests__/get-warmup-client-files.test.ts +20 -0
- package/src/vite/config/asset-file-names.ts +20 -0
- package/src/vite/config/base-config.ts +45 -37
- package/src/vite/config/code-splitting.ts +23 -0
- package/src/vite/config/create-css-config.ts +16 -0
- package/src/vite/config/create-filtering-logger.ts +34 -0
- package/src/vite/config/create-vite-build-context.ts +3 -5
- package/src/vite/config/create-vite-config.ts +45 -12
- package/src/vite/config/get-warmup-client-files.ts +13 -0
- package/src/vite/index.html +1 -0
- package/src/vite/plugins/__tests__/bundle-stat-plugin.test.ts +70 -0
- package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +58 -0
- package/src/vite/plugins/__tests__/clean-plugin.test.ts +121 -0
- package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +83 -0
- package/src/vite/plugins/__tests__/html-template.test.ts +6 -0
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +29 -7
- package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +62 -0
- package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +104 -0
- package/src/vite/plugins/bundle-stat-plugin.ts +24 -0
- package/src/vite/plugins/chain-source-maps-plugin.ts +26 -0
- package/src/vite/plugins/clean-plugin.ts +46 -0
- package/src/vite/plugins/design-system-guard-plugin.ts +34 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +36 -7
- package/src/vite/plugins/index.ts +7 -0
- package/src/vite/plugins/istanbul-plugin.ts +19 -0
- package/src/vite/plugins/magic-comments-plugin/__tests__/magic-comments-plugin.test.ts +105 -0
- package/src/vite/plugins/magic-comments-plugin/__tests__/parse-magic-comments.test.ts +40 -0
- package/src/vite/plugins/magic-comments-plugin/index.ts +1 -0
- package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +63 -0
- package/src/vite/plugins/magic-comments-plugin/parse-magic-comments.ts +39 -0
- package/src/vite/plugins/metadata-plugin.ts +1 -1
- package/src/vite/plugins/moment-locales-plugin.ts +41 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/assemble-iife.test.ts +29 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/assert-no-dynamic-css.test.ts +113 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/flatten.test.ts +23 -0
- package/src/vite/plugins/{__tests__ → shared-dependencies-plugin/__tests__}/shared-dependencies-plugin.test.ts +38 -4
- package/src/vite/plugins/shared-dependencies-plugin/assemble-iife.ts +114 -0
- package/src/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.ts +58 -0
- package/src/vite/plugins/shared-dependencies-plugin/flatten.ts +8 -0
- package/src/vite/plugins/shared-dependencies-plugin/index.ts +1 -0
- package/src/vite/plugins/{shared-dependencies-plugin.ts → shared-dependencies-plugin/shared-dependencies-plugin.ts} +24 -115
- package/src/vite/plugins/utils/import-esm.ts +15 -0
- package/src/vite/plugins/utils/index.ts +2 -0
- package/src/vite/rolldown-oxc.d.ts +20 -0
- package/src/webpack/__tests__/bundle-webpack.test.ts +8 -8
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +54 -5
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +81 -12
- package/src/webpack/__tests__/create-webpack-config.test.ts +92 -9
- package/src/webpack/configs/optimization-config.ts +47 -25
- package/src/webpack/configs/output-config.ts +1 -2
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +16 -4
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +3 -25
- package/src/webpack/configs/plugins/define-process-env-plugin.ts +10 -0
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +1 -5
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +76 -24
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.ts +7 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +59 -9
- package/src/webpack/configs/plugins/index.ts +1 -0
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -2
- package/src/webpack/configs/plugins-config.ts +2 -0
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/create-webpack-config.ts +11 -4
- package/src/webpack/create-webpack-configs.ts +2 -8
- package/src/webpack/types.ts +1 -4
- package/src/webpack/utils/create-webpack-build-context.ts +1 -6
- package/tsconfig/base.json +1 -1
- package/tsconfig/types.d.ts +10 -0
- package/dist/core/get-output-path.d.ts +0 -3
- package/dist/core/get-output-path.d.ts.map +0 -1
- package/dist/core/get-output-path.js +0 -29
- package/dist/core/get-output-path.js.map +0 -1
- package/dist/vite/plugins/shared-dependencies-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/shared-dependencies-plugin.js.map +0 -1
- package/src/core/__tests__/get-output-path.test.ts +0 -64
- package/src/core/get-output-path.ts +0 -15
- /package/dist/vite/plugins/{shared-dependencies-plugin.d.ts → shared-dependencies-plugin/shared-dependencies-plugin.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/start.ts"],"sourcesContent":["import { getPackages, logErrors, PackageType } from '../../utils';\nimport {\n checkArgs,\n compile,\n lernaExec,\n pipeStdout,\n ProcessTree,\n typeCheck,\n watchStdout,\n} from '../utils';\nimport type { entry } from './registry/start';\nimport { Command } from './types';\n\nenum StartProcesses {\n Precompile,\n Compile,\n KendoUILicense,\n PreparePackage,\n PreparePackageWatch,\n TypeCheck,\n BundleExposedDependencies,\n Bundle,\n}\n\nexport class Start extends Command<typeof entry> {\n @logErrors\n async execute() {\n checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });\n\n const useTsc = this.args.useTsc;\n
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/start.ts"],"sourcesContent":["import { getPackages, logErrors, PackageType } from '../../utils';\nimport {\n checkArgs,\n compile,\n getBundleCommand,\n lernaExec,\n pipeStdout,\n ProcessTree,\n typeCheck,\n watchStdout,\n} from '../utils';\nimport type { entry } from './registry/start';\nimport { Command } from './types';\n\nenum StartProcesses {\n Precompile,\n Compile,\n KendoUILicense,\n PreparePackage,\n PreparePackageWatch,\n TypeCheck,\n BundleExposedDependencies,\n Bundle,\n}\n\nexport class Start extends Command<typeof entry> {\n @logErrors\n async execute() {\n checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });\n\n const useTsc = this.args.useTsc;\n\n const packages = getPackages({\n scope: this.args.scope,\n ignore: this.args.ignore,\n type: [PackageType.TSC, PackageType.Bundle],\n });\n if (packages.length === 0) {\n return;\n }\n\n const scope = packages.map(({ name }) => name);\n const bundleScope = packages\n .filter(({ type }) => type === PackageType.Bundle)\n .map(({ name }) => name);\n const bundleCmd = getBundleCommand(this.args);\n const precompileScope = packages\n .filter(({ scripts }) => !!scripts?.precompile)\n .map(({ name }) => name);\n\n const processTree = new ProcessTree<typeof StartProcesses>();\n\n processTree.add(StartProcesses.Precompile, () => {\n if (precompileScope.length === 0) {\n return Promise.resolve();\n }\n return lernaExec({\n cmd: 'npm run precompile',\n scope: precompileScope,\n parallel: true,\n stream: true,\n });\n });\n\n processTree.add(\n StartProcesses.Compile,\n () => {\n const process = compile({\n packages: scope,\n watch: true,\n useTsc,\n });\n\n pipeStdout(process);\n\n const onComplete = new Promise<void>(resolve => {\n let counter = 0;\n\n watchStdout(\n process,\n useTsc\n ? 'Initial tsc-compile-package task completed'\n : 'Initial swc-compile-package task completed',\n count => {\n counter += count;\n\n if (counter === scope.length) {\n resolve();\n }\n }\n );\n });\n\n return { process, onComplete };\n },\n { dependsOn: [StartProcesses.Precompile] }\n );\n processTree.add(StartProcesses.PreparePackage, () =>\n lernaExec({\n cmd: 'startup prepare-package',\n scope,\n stream: true,\n })\n );\n processTree.add(\n StartProcesses.PreparePackageWatch,\n () =>\n lernaExec({\n 'cmd': 'startup prepare-package',\n scope,\n 'parallel': true,\n 'stream': true,\n '--': ['--watch'],\n }),\n { dependsOn: [StartProcesses.PreparePackage] }\n );\n processTree.add(\n StartProcesses.TypeCheck,\n () => typeCheck({ packages: scope, watch: true }),\n { dependsOn: [StartProcesses.PreparePackage] }\n );\n processTree.add(\n StartProcesses.BundleExposedDependencies,\n () => {\n if (bundleScope.length === 0) {\n return Promise.resolve();\n }\n return lernaExec({\n 'cmd': bundleCmd,\n 'scope': bundleScope,\n 'parallel': true,\n 'stream': true,\n '--': ['--exposed-dependencies', '--use-watch-config'],\n });\n },\n { dependsOn: [StartProcesses.Compile, StartProcesses.PreparePackage] }\n );\n processTree.add(\n StartProcesses.Bundle,\n () => {\n if (bundleScope.length === 0) {\n return Promise.resolve();\n }\n return lernaExec({\n 'cmd': bundleCmd,\n 'scope': bundleScope,\n 'parallel': true,\n 'stream': true,\n '--': [\n '--watch',\n this.args.config ? `--config \"${this.args.config}\"` : undefined,\n this.args.codeCoverage ? '--code-coverage' : undefined,\n ].filter(item => !!item) as string[],\n });\n },\n { dependsOn: [StartProcesses.BundleExposedDependencies] }\n );\n\n await processTree.run();\n }\n}\n"],"names":["Start","StartProcesses","Command","execute","checkArgs","args","obsolete","useTsc","packages","getPackages","scope","ignore","type","PackageType","TSC","Bundle","length","map","name","bundleScope","filter","bundleCmd","getBundleCommand","precompileScope","scripts","precompile","processTree","ProcessTree","add","Promise","resolve","lernaExec","cmd","parallel","stream","process","compile","watch","pipeStdout","onComplete","counter","watchStdout","count","dependsOn","typeCheck","config","undefined","codeCoverage","item","run"],"mappings":";;;;+BAyBaA;;;eAAAA;;;uBAzBuC;wBAU7C;uBAEiB;;;;;;;;;;AAExB,IAAA,AAAKC,wCAAAA;;;;;;;;;WAAAA;EAAAA;AAWE,MAAMD,cAAcE,cAAO;IAC9B,MACMC,UAAU;QACZC,IAAAA,iBAAS,EAAC,IAAI,CAACC,IAAI,EAAE;YAAEC,UAAU;gBAAC;gBAAa;aAA0B;QAAC;QAE1E,MAAMC,SAAS,IAAI,CAACF,IAAI,CAACE,MAAM;QAE/B,MAAMC,WAAWC,IAAAA,kBAAW,EAAC;YACzBC,OAAO,IAAI,CAACL,IAAI,CAACK,KAAK;YACtBC,QAAQ,IAAI,CAACN,IAAI,CAACM,MAAM;YACxBC,MAAM;gBAACC,kBAAW,CAACC,GAAG;gBAAED,kBAAW,CAACE,MAAM;aAAC;QAC/C;QACA,IAAIP,SAASQ,MAAM,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;YACZ;QAEJR,YAAYE,GAAG,IAEX,IACIG,IAAAA,iBAAS,EAAC;gBACN,OAAO;gBACPrB;gBACA,YAAY;gBACZ,UAAU;gBACV,MAAM;oBAAC;iBAAU;YACrB,IACJ;YAAEiC,WAAW;;aAA+B;QAAC;QAEjDjB,YAAYE,GAAG,IAEX,IAAMgB,IAAAA,iBAAS,EAAC;gBAAEpC,UAAUE;gBAAO2B,OAAO;YAAK,IAC/C;YAAEM,WAAW;;aAA+B;QAAC;QAEjDjB,YAAYE,GAAG,IAEX;YACI,IAAIT,YAAYH,MAAM,KAAK,GAAG;gBAC1B,OAAOa,QAAQC,OAAO;YAC1B;YACA,OAAOC,IAAAA,iBAAS,EAAC;gBACb,OAAOV;gBACP,SAASF;gBACT,YAAY;gBACZ,UAAU;gBACV,MAAM;oBAAC;oBAA0B;iBAAqB;YAC1D;QACJ,GACA;YAAEwB,WAAW;;;aAAuD;QAAC;QAEzEjB,YAAYE,GAAG,IAEX;YACI,IAAIT,YAAYH,MAAM,KAAK,GAAG;gBAC1B,OAAOa,QAAQC,OAAO;YAC1B;YACA,OAAOC,IAAAA,iBAAS,EAAC;gBACb,OAAOV;gBACP,SAASF;gBACT,YAAY;gBACZ,UAAU;gBACV,MAAM;oBACF;oBACA,IAAI,CAACd,IAAI,CAACwC,MAAM,GAAG,CAAC,UAAU,EAAE,IAAI,CAACxC,IAAI,CAACwC,MAAM,CAAC,CAAC,CAAC,GAAGC;oBACtD,IAAI,CAACzC,IAAI,CAAC0C,YAAY,GAAG,oBAAoBD;iBAChD,CAAC1B,MAAM,CAAC4B,CAAAA,OAAQ,CAAC,CAACA;YACvB;QACJ,GACA;YAAEL,WAAW;;aAA0C;QAAC;QAG5D,MAAMjB,YAAYuB,GAAG;IACzB;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"names":[],"mappings":"AAQA,qBAAa,MAAM;IACT,GAAG;CAQZ"}
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "Vitest", {
|
|
|
11
11
|
const _config = require("vitest/config");
|
|
12
12
|
const _node = require("vitest/node");
|
|
13
13
|
const _utils = require("../../../../utils");
|
|
14
|
+
const _plugins = require("../../../../vite/plugins");
|
|
14
15
|
const _svgtransformer = /*#__PURE__*/ _interop_require_default(require("../../../../vitest/svg-transformer"));
|
|
15
16
|
function _interop_require_default(obj) {
|
|
16
17
|
return obj && obj.__esModule ? obj : {
|
|
@@ -84,7 +85,12 @@ async function getUserConfig() {
|
|
|
84
85
|
const result = (0, _config.mergeConfig)((0, _config.mergeConfig)((0, _utils.omit)(getDefaultConfig(), omitDefault), config), (_viteConfig_test = viteConfig.test) !== null && _viteConfig_test !== void 0 ? _viteConfig_test : {});
|
|
85
86
|
/* istanbul ignore next: debug only */ _utils.log.debug('vitest:userConfig', ()=>JSON.stringify(result, null, 2));
|
|
86
87
|
const plugins = [
|
|
87
|
-
(0, _svgtransformer.default)()
|
|
88
|
+
(0, _svgtransformer.default)(),
|
|
89
|
+
(0, _plugins.ignoreModulesPlugin)({
|
|
90
|
+
package: {
|
|
91
|
+
dependencies: {}
|
|
92
|
+
}
|
|
93
|
+
})
|
|
88
94
|
].filter(({ name })=>!omitDefault.includes(`plugins.${name}`));
|
|
89
95
|
return {
|
|
90
96
|
test: result,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"sourcesContent":["import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';\nimport { parseCLI, resolveConfig, startVitest } from 'vitest/node';\nimport { getDefaultTestExcludes, getVitestConfiguration, log, omit } from '../../../../utils';\nimport svgTransformer from '../../../../vitest/svg-transformer';\n\ntype VitestConfig = NonNullable<ViteUserConfig['test']>;\n\nexport class Vitest {\n async run() {\n const cliOptions = getCliOptions();\n const userConfig = await getUserConfig();\n\n // startVitest sets process.exitCode to 1 when tests fail\n const vitest = await startVitest('test', cliOptions.filter, cliOptions.options, userConfig);\n await vitest.close();\n }\n}\n\nconst RUNNER_OPTION = '--runner';\n\nfunction excludeRunnerOption(args: string[]) {\n return args.reduce<string[]>((result, item, index) => {\n if (!item.startsWith(RUNNER_OPTION) && (index === 0 || args[index - 1] !== RUNNER_OPTION)) {\n result.push(item);\n }\n return result;\n }, []);\n}\n\nfunction getCliOptions() {\n // parseCLI requires the first element to be \"vitest\"\n const result = parseCLI(['vitest', ...excludeRunnerOption(process.argv.slice(3))]);\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:cliOptions', () => JSON.stringify(result, null, 2));\n\n return result;\n}\n\nfunction getDefaultConfig(): VitestConfig {\n return {\n coverage: {\n exclude: [...coverageConfigDefaults.exclude, ...getDefaultTestExcludes()],\n include: ['**/*.{ts,tsx}'],\n reporter: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n },\n environment: 'jsdom',\n exclude: [...configDefaults.exclude, ...getDefaultTestExcludes()],\n restoreMocks: true,\n server: { deps: { inline: ['@servicetitan/anvil2'] } }, // fixes css parser errors\n };\n}\n\nasync function getUserConfig(): Promise<ViteUserConfig> {\n const { viteConfig } = await resolveConfig();\n\n const { omitDefault = [], ...config } = getVitestConfiguration();\n\n const result = mergeConfig(\n mergeConfig(omit(getDefaultConfig(), omitDefault), config),\n viteConfig.test ?? {}\n );\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:userConfig', () => JSON.stringify(result, null, 2));\n\n const plugins: NonNullable<ViteUserConfig['plugins']> = [svgTransformer()].filter(
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"sourcesContent":["import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';\nimport { parseCLI, resolveConfig, startVitest } from 'vitest/node';\nimport { getDefaultTestExcludes, getVitestConfiguration, log, omit } from '../../../../utils';\nimport { ignoreModulesPlugin } from '../../../../vite/plugins';\nimport svgTransformer from '../../../../vitest/svg-transformer';\n\ntype VitestConfig = NonNullable<ViteUserConfig['test']>;\n\nexport class Vitest {\n async run() {\n const cliOptions = getCliOptions();\n const userConfig = await getUserConfig();\n\n // startVitest sets process.exitCode to 1 when tests fail\n const vitest = await startVitest('test', cliOptions.filter, cliOptions.options, userConfig);\n await vitest.close();\n }\n}\n\nconst RUNNER_OPTION = '--runner';\n\nfunction excludeRunnerOption(args: string[]) {\n return args.reduce<string[]>((result, item, index) => {\n if (!item.startsWith(RUNNER_OPTION) && (index === 0 || args[index - 1] !== RUNNER_OPTION)) {\n result.push(item);\n }\n return result;\n }, []);\n}\n\nfunction getCliOptions() {\n // parseCLI requires the first element to be \"vitest\"\n const result = parseCLI(['vitest', ...excludeRunnerOption(process.argv.slice(3))]);\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:cliOptions', () => JSON.stringify(result, null, 2));\n\n return result;\n}\n\nfunction getDefaultConfig(): VitestConfig {\n return {\n coverage: {\n exclude: [...coverageConfigDefaults.exclude, ...getDefaultTestExcludes()],\n include: ['**/*.{ts,tsx}'],\n reporter: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n },\n environment: 'jsdom',\n exclude: [...configDefaults.exclude, ...getDefaultTestExcludes()],\n restoreMocks: true,\n server: { deps: { inline: ['@servicetitan/anvil2'] } }, // fixes css parser errors\n };\n}\n\nasync function getUserConfig(): Promise<ViteUserConfig> {\n const { viteConfig } = await resolveConfig();\n\n const { omitDefault = [], ...config } = getVitestConfiguration();\n\n const result = mergeConfig(\n mergeConfig(omit(getDefaultConfig(), omitDefault), config),\n viteConfig.test ?? {}\n );\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:userConfig', () => JSON.stringify(result, null, 2));\n\n const plugins: NonNullable<ViteUserConfig['plugins']> = [\n svgTransformer(),\n ignoreModulesPlugin({ package: { dependencies: {} } }),\n ].filter(({ name }) => !omitDefault.includes(`plugins.${name}`));\n\n return { test: result, ...(plugins.length ? { plugins } : {}) };\n}\n"],"names":["Vitest","run","cliOptions","getCliOptions","userConfig","getUserConfig","vitest","startVitest","filter","options","close","RUNNER_OPTION","excludeRunnerOption","args","reduce","result","item","index","startsWith","push","parseCLI","process","argv","slice","log","debug","JSON","stringify","getDefaultConfig","coverage","exclude","coverageConfigDefaults","getDefaultTestExcludes","include","reporter","environment","configDefaults","restoreMocks","server","deps","inline","viteConfig","resolveConfig","omitDefault","config","getVitestConfiguration","mergeConfig","omit","test","plugins","svgTransformer","ignoreModulesPlugin","package","dependencies","name","includes","length"],"mappings":";;;;+BAQaA;;;eAAAA;;;wBARuE;sBAC/B;uBACqB;yBACtC;uEACT;;;;;;AAIpB,MAAMA;IACT,MAAMC,MAAM;QACR,MAAMC,aAAaC;QACnB,MAAMC,aAAa,MAAMC;QAEzB,yDAAyD;QACzD,MAAMC,SAAS,MAAMC,IAAAA,iBAAW,EAAC,QAAQL,WAAWM,MAAM,EAAEN,WAAWO,OAAO,EAAEL;QAChF,MAAME,OAAOI,KAAK;IACtB;AACJ;AAEA,MAAMC,gBAAgB;AAEtB,SAASC,oBAAoBC,IAAc;IACvC,OAAOA,KAAKC,MAAM,CAAW,CAACC,QAAQC,MAAMC;QACxC,IAAI,CAACD,KAAKE,UAAU,CAACP,kBAAmBM,CAAAA,UAAU,KAAKJ,IAAI,CAACI,QAAQ,EAAE,KAAKN,aAAY,GAAI;YACvFI,OAAOI,IAAI,CAACH;QAChB;QACA,OAAOD;IACX,GAAG,EAAE;AACT;AAEA,SAASZ;IACL,qDAAqD;IACrD,MAAMY,SAASK,IAAAA,cAAQ,EAAC;QAAC;WAAaR,oBAAoBS,QAAQC,IAAI,CAACC,KAAK,CAAC;KAAI;IAEjF,oCAAoC,GACpCC,UAAG,CAACC,KAAK,CAAC,qBAAqB,IAAMC,KAAKC,SAAS,CAACZ,QAAQ,MAAM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3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import chalk from 'chalk';\nimport execa from 'execa';\nimport kebabCase from 'lodash.kebabcase';\nimport path from 'path';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { getStartupVersion } from '../core';\nimport { CommandName, log } from '../utils';\nimport { commandRegistry } from './commands/registry';\nimport type { CommandOptions } from './commands/types';\nimport { checkStartupLocation, setNodeOptions } from './utils';\n\nconst yargsInstance = yargs(hideBin(process.argv));\n\nObject.values(CommandName)\n .reduce((y, name) => addCommand(name, y), yargsInstance)\n .usage('Usage: startup <command> [options]')\n .epilogue(\n chalk.bold.cyan(`startup cli v${getStartupVersion()}\\n`) +\n `Run ${chalk.bold.cyan('startup <command> --help')} to see command options.\\n` +\n `For detailed documentation, see ${chalk.bold.cyan('https://docs.st.dev/docs/frontend/uikit/startup')}.\\n`\n )\n .demandCommand(1, '')\n .strictCommands()\n .updateStrings({\n 'Unknown command: %s': {\n one: chalk.bold.red('Unknown command: %s'),\n other: chalk.bold.red('Unknown command: %s'),\n } as any,\n })\n .version()\n .wrap(Math.min(100, yargsInstance.terminalWidth()))\n .help()\n .parse();\n\nfunction addCommand(name: CommandName, y: typeof yargs) {\n const entry = commandRegistry[name];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { description, options: { _, ...options } = {} } = entry;\n const nameWithArgs = name + (_?.description ? ` ${_.description}` : '');\n const groupedOptions = Object.entries(options).reduce((result, [key, value]) => {\n result[kebabCase(key)] = { group: 'Command Options:', ...value };\n return result;\n }, {} as CommandOptions);\n const handler = (argv: any) => handleCommand(name, argv);\n if (description) {\n y.command(nameWithArgs, description, groupedOptions, handler);\n } else {\n y.command(nameWithArgs, false, groupedOptions, handler);\n }\n return y;\n}\n\nasync function handleCommand(name: CommandName, argv: any) {\n const entry = commandRegistry[name];\n\n checkNodeVersion();\n checkStartupLocation(name, entry);\n\n if (setNodeOptions(name, entry)) {\n log.debug('run', `Running ${name} in child process with amended NODE_OPTIONS`);\n execa(process.argv[0], process.argv.slice(1), { stdio: 'inherit' }).catch(reason => {\n process.exit(reason
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import chalk from 'chalk';\nimport execa from 'execa';\nimport kebabCase from 'lodash.kebabcase';\nimport path from 'path';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { getStartupVersion } from '../core';\nimport { CommandName, log } from '../utils';\nimport { commandRegistry } from './commands/registry';\nimport type { CommandOptions } from './commands/types';\nimport { checkStartupLocation, getExitCode, setNodeOptions } from './utils';\n\nconst yargsInstance = yargs(hideBin(process.argv));\n\nObject.values(CommandName)\n .reduce((y, name) => addCommand(name, y), yargsInstance)\n .usage('Usage: startup <command> [options]')\n .epilogue(\n chalk.bold.cyan(`startup cli v${getStartupVersion()}\\n`) +\n `Run ${chalk.bold.cyan('startup <command> --help')} to see command options.\\n` +\n `For detailed documentation, see ${chalk.bold.cyan('https://docs.st.dev/docs/frontend/uikit/startup')}.\\n`\n )\n .demandCommand(1, '')\n .strictCommands()\n .updateStrings({\n 'Unknown command: %s': {\n one: chalk.bold.red('Unknown command: %s'),\n other: chalk.bold.red('Unknown command: %s'),\n } as any,\n })\n .version()\n .wrap(Math.min(100, yargsInstance.terminalWidth()))\n .help()\n .parse();\n\nfunction addCommand(name: CommandName, y: typeof yargs) {\n const entry = commandRegistry[name];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { description, options: { _, ...options } = {} } = entry;\n const nameWithArgs = name + (_?.description ? ` ${_.description}` : '');\n const groupedOptions = Object.entries(options).reduce((result, [key, value]) => {\n result[kebabCase(key)] = { group: 'Command Options:', ...value };\n return result;\n }, {} as CommandOptions);\n const handler = (argv: any) => handleCommand(name, argv);\n if (description) {\n y.command(nameWithArgs, description, groupedOptions, handler);\n } else {\n y.command(nameWithArgs, false, groupedOptions, handler);\n }\n return y;\n}\n\nasync function handleCommand(name: CommandName, argv: any) {\n const entry = commandRegistry[name];\n\n checkNodeVersion();\n checkStartupLocation(name, entry);\n\n if (setNodeOptions(name, entry)) {\n log.debug('run', `Running ${name} in child process with amended NODE_OPTIONS`);\n execa(process.argv[0], process.argv.slice(1), { stdio: 'inherit' }).catch(reason => {\n process.exit(getExitCode(reason));\n });\n return;\n }\n\n const CommandClass = await entry.load();\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const command = new CommandClass({ ...argv, _: argv._.slice(1) });\n command.execute().catch(() => {\n process.exit(1);\n });\n}\n\nfunction checkNodeVersion() {\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n if (nodeVersion % 2 === 0 || process.env.SKIP_NODE_VERSION_CHECK) {\n return;\n }\n\n const { engines } = require(path.join(__dirname, '../../package.json'));\n log.error(\n `error: node v${nodeVersion} detected, only even-numbered LTS versions ${engines.node} are supported`\n );\n log.text('See https://nodejs.org/en/download for LTS versions');\n process.exit(1);\n}\n"],"names":["yargsInstance","yargs","hideBin","process","argv","Object","values","CommandName","reduce","y","name","addCommand","usage","epilogue","chalk","bold","cyan","getStartupVersion","demandCommand","strictCommands","updateStrings","one","red","other","version","wrap","Math","min","terminalWidth","help","parse","entry","commandRegistry","description","options","_","nameWithArgs","groupedOptions","entries","result","key","value","kebabCase","group","handler","handleCommand","command","checkNodeVersion","checkStartupLocation","setNodeOptions","log","debug","execa","slice","stdio","catch","reason","exit","getExitCode","CommandClass","load","execute","nodeVersion","Number","versions","node","split","env","SKIP_NODE_VERSION_CHECK","engines","require","path","join","__dirname","error","text"],"mappings":";;;;8DAAkB;8DACA;wEACI;6DACL;8DACC;yBACM;sBACU;uBACD;0BACD;wBAEkC;;;;;;AAElE,MAAMA,gBAAgBC,IAAAA,cAAK,EAACC,IAAAA,gBAAO,EAACC,QAAQC,IAAI;AAEhDC,OAAOC,MAAM,CAACC,kBAAW,EACpBC,MAAM,CAAC,CAACC,GAAGC,OAASC,WAAWD,MAAMD,IAAIT,eACzCY,KAAK,CAAC,sCACNC,QAAQ,CACLC,cAAK,CAACC,IAAI,CA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0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-bundle-command.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/get-bundle-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAEnF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getBundleCommand", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getBundleCommand;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _resolvebundler = require("./resolve-bundler");
|
|
12
|
+
function getBundleCommand(args) {
|
|
13
|
+
return (0, _resolvebundler.resolveBundler)(args) === 'vite' ? 'startup bundle-vite' : 'startup bundle-webpack';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=get-bundle-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/get-bundle-command.ts"],"sourcesContent":["import { resolveBundler } from './resolve-bundler';\n\nexport function getBundleCommand(args: Parameters<typeof resolveBundler>[0]): string {\n return resolveBundler(args) === 'vite' ? 'startup bundle-vite' : 'startup bundle-webpack';\n}\n"],"names":["getBundleCommand","args","resolveBundler"],"mappings":";;;;+BAEgBA;;;eAAAA;;;gCAFe;AAExB,SAASA,iBAAiBC,IAA0C;IACvE,OAAOC,IAAAA,8BAAc,EAACD,UAAU,SAAS,wBAAwB;AACrE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive this process's exit code from a failed child process result.
|
|
3
|
+
*
|
|
4
|
+
* A signal death (Ctrl-C, OOM kill) carries no exitCode, so map it to the
|
|
5
|
+
* shell's "128 + signal number" convention. Exiting with an undefined exitCode
|
|
6
|
+
* would resolve to 0, reporting a killed build as a success.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getExitCode({ exitCode, signal }: {
|
|
9
|
+
exitCode?: number;
|
|
10
|
+
signal?: string;
|
|
11
|
+
}): number;
|
|
12
|
+
//# sourceMappingURL=get-exit-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-exit-code.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/get-exit-code.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAKhG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getExitCode", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getExitCode;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _nodeos = /*#__PURE__*/ _interop_require_default(require("node:os"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const SIGNAL_EXIT_BASE = 128;
|
|
18
|
+
function getExitCode({ exitCode, signal }) {
|
|
19
|
+
if (signal) {
|
|
20
|
+
var _os_constants_signals_signal;
|
|
21
|
+
return SIGNAL_EXIT_BASE + ((_os_constants_signals_signal = _nodeos.default.constants.signals[signal]) !== null && _os_constants_signals_signal !== void 0 ? _os_constants_signals_signal : 1);
|
|
22
|
+
}
|
|
23
|
+
return exitCode !== null && exitCode !== void 0 ? exitCode : 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=get-exit-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/get-exit-code.ts"],"sourcesContent":["import os from 'node:os';\n\nconst SIGNAL_EXIT_BASE = 128;\n\n/**\n * Derive this process's exit code from a failed child process result.\n *\n * A signal death (Ctrl-C, OOM kill) carries no exitCode, so map it to the\n * shell's \"128 + signal number\" convention. Exiting with an undefined exitCode\n * would resolve to 0, reporting a killed build as a success.\n */\nexport function getExitCode({ exitCode, signal }: { exitCode?: number; signal?: string }): number {\n if (signal) {\n return SIGNAL_EXIT_BASE + (os.constants.signals[signal as NodeJS.Signals] ?? 1);\n }\n return exitCode ?? 1;\n}\n"],"names":["getExitCode","SIGNAL_EXIT_BASE","exitCode","signal","os","constants","signals"],"mappings":";;;;+BAWgBA;;;eAAAA;;;+DAXD;;;;;;AAEf,MAAMC,mBAAmB;AASlB,SAASD,YAAY,EAAEE,QAAQ,EAAEC,MAAM,EAA0C;IACpF,IAAIA,QAAQ;YACmBC;QAA3B,OAAOH,qBAAoBG,+BAAAA,eAAE,CAACC,SAAS,CAACC,OAAO,CAACH,OAAyB,cAA9CC,0CAAAA,+BAAkD;IACjF;IACA,OAAOF,qBAAAA,sBAAAA,WAAY;AACvB"}
|
|
@@ -6,6 +6,8 @@ export * from './cli-os';
|
|
|
6
6
|
export * from './compile';
|
|
7
7
|
export * from './constants';
|
|
8
8
|
export * from './eslint';
|
|
9
|
+
export * from './get-bundle-command';
|
|
10
|
+
export * from './get-exit-code';
|
|
9
11
|
export * from './get-module-type';
|
|
10
12
|
export * from './is-module-installed';
|
|
11
13
|
export * from './is-tty';
|
|
@@ -14,6 +16,7 @@ export * from './maybe-create-git-folder';
|
|
|
14
16
|
export * from './pipe-stdout';
|
|
15
17
|
export * from './process-tree';
|
|
16
18
|
export * from './publish';
|
|
19
|
+
export * from './resolve-bundler';
|
|
17
20
|
export * from './set-node-options';
|
|
18
21
|
export * from './ts-config';
|
|
19
22
|
export * from './type-check';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAW1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAW1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/cli/utils/index.js
CHANGED
|
@@ -10,6 +10,8 @@ _export_star(require("./cli-os"), exports);
|
|
|
10
10
|
_export_star(require("./compile"), exports);
|
|
11
11
|
_export_star(require("./constants"), exports);
|
|
12
12
|
_export_star(require("./eslint"), exports);
|
|
13
|
+
_export_star(require("./get-bundle-command"), exports);
|
|
14
|
+
_export_star(require("./get-exit-code"), exports);
|
|
13
15
|
_export_star(require("./get-module-type"), exports);
|
|
14
16
|
_export_star(require("./is-module-installed"), exports);
|
|
15
17
|
_export_star(require("./is-tty"), exports);
|
|
@@ -18,6 +20,7 @@ _export_star(require("./maybe-create-git-folder"), exports);
|
|
|
18
20
|
_export_star(require("./pipe-stdout"), exports);
|
|
19
21
|
_export_star(require("./process-tree"), exports);
|
|
20
22
|
_export_star(require("./publish"), exports);
|
|
23
|
+
_export_star(require("./resolve-bundler"), exports);
|
|
21
24
|
_export_star(require("./set-node-options"), exports);
|
|
22
25
|
_export_star(require("./ts-config"), exports);
|
|
23
26
|
_export_star(require("./type-check"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './check-args';\nexport * from './check-startup-location';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\n/*\n * These modules eagerly load heavy dependencies (less, sass). Importing them\n * from the barrel causes every test that touches cli/utils to pay that cost\n * and spams \"Less has finished and no sheets were loaded\" in test output.\n * Import directly from the module instead (e.g., import { copyFiles } from './copy-files').\n *\n * export * from './compile-less';\n * export * from './compile-sass';\n * export * from './copy-files';\n */\nexport * from './constants';\nexport * from './eslint';\nexport * from './get-module-type';\nexport * from './is-module-installed';\nexport * from './is-tty';\nexport * from './lerna-exec';\nexport * from './maybe-create-git-folder';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './publish';\nexport * from './set-node-options';\n// Don't export ./stylelint, it breaks tests using the default \"jsdom\" environment\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBAWA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBAEA;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './check-args';\nexport * from './check-startup-location';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\n/*\n * These modules eagerly load heavy dependencies (less, sass). Importing them\n * from the barrel causes every test that touches cli/utils to pay that cost\n * and spams \"Less has finished and no sheets were loaded\" in test output.\n * Import directly from the module instead (e.g., import { copyFiles } from './copy-files').\n *\n * export * from './compile-less';\n * export * from './compile-sass';\n * export * from './copy-files';\n */\nexport * from './constants';\nexport * from './eslint';\nexport * from './get-bundle-command';\nexport * from './get-exit-code';\nexport * from './get-module-type';\nexport * from './is-module-installed';\nexport * from './is-tty';\nexport * from './lerna-exec';\nexport * from './maybe-create-git-folder';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './publish';\nexport * from './resolve-bundler';\nexport * from './set-node-options';\n// Don't export ./stylelint, it breaks tests using the default \"jsdom\" environment\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBAWA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBAEA;qBACA;qBACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-bundler.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/resolve-bundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,aAAa,CAAC;AAElE,UAAU,WAAW;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAWzD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "resolveBundler", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return resolveBundler;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _utils = require("../../utils");
|
|
12
|
+
function resolveBundler(args) {
|
|
13
|
+
var _getConfiguration_bundler;
|
|
14
|
+
if (args.bundler) {
|
|
15
|
+
return args.bundler;
|
|
16
|
+
}
|
|
17
|
+
if (args.useVite) {
|
|
18
|
+
_utils.log.warning('--use-vite is deprecated. Use --bundler=vite instead.');
|
|
19
|
+
return 'vite';
|
|
20
|
+
}
|
|
21
|
+
return (_getConfiguration_bundler = (0, _utils.getConfiguration)().bundler) !== null && _getConfiguration_bundler !== void 0 ? _getConfiguration_bundler : 'webpack';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=resolve-bundler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/resolve-bundler.ts"],"sourcesContent":["import { type Bundler, getConfiguration, log } from '../../utils';\n\ninterface BundlerArgs {\n bundler?: Bundler;\n useVite?: boolean;\n}\n\n/*\n * Resolves the bundler from the --bundler flag, then the deprecated --use-vite\n * flag, then the cli.bundler package.json config, then the webpack default.\n */\nexport function resolveBundler(args: BundlerArgs): Bundler {\n if (args.bundler) {\n return args.bundler;\n }\n\n if (args.useVite) {\n log.warning('--use-vite is deprecated. Use --bundler=vite instead.');\n return 'vite';\n }\n\n return getConfiguration().bundler ?? 'webpack';\n}\n"],"names":["resolveBundler","args","getConfiguration","bundler","useVite","log","warning"],"mappings":";;;;+BAWgBA;;;eAAAA;;;uBAXoC;AAW7C,SAASA,eAAeC,IAAiB;QAUrCC;IATP,IAAID,KAAKE,OAAO,EAAE;QACd,OAAOF,KAAKE,OAAO;IACvB;IAEA,IAAIF,KAAKG,OAAO,EAAE;QACdC,UAAG,CAACC,OAAO,CAAC;QACZ,OAAO;IACX;IAEA,QAAOJ,4BAAAA,IAAAA,uBAAgB,IAAGC,OAAO,cAA1BD,uCAAAA,4BAA8B;AACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-report.d.ts","sourceRoot":"","sources":["../../src/core/bundle-report.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAIlE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAK/D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get bundleReportFileName () {
|
|
13
|
+
return bundleReportFileName;
|
|
14
|
+
},
|
|
15
|
+
get bundleReportTitle () {
|
|
16
|
+
return bundleReportTitle;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _getbundletype = require("./get-bundle-type");
|
|
20
|
+
function bundleReportFileName(context) {
|
|
21
|
+
const type = (0, _getbundletype.getBundleType)(context);
|
|
22
|
+
const qualifier = type ? `-${type}` : '';
|
|
23
|
+
return `${context.package.name}${qualifier}-bundle-${Date.now()}`;
|
|
24
|
+
}
|
|
25
|
+
function bundleReportTitle(context) {
|
|
26
|
+
const unscopedName = context.package.name.replace(/^@[^/]+\//, '');
|
|
27
|
+
const type = (0, _getbundletype.getBundleType)(context);
|
|
28
|
+
const qualifier = type ? ` (${type})` : '';
|
|
29
|
+
return `${unscopedName}${qualifier} ${formatDate(new Date())}`;
|
|
30
|
+
}
|
|
31
|
+
function formatDate(date) {
|
|
32
|
+
const yyyy = date.getFullYear();
|
|
33
|
+
const mm = zeroPad(date.getMonth() + 1);
|
|
34
|
+
const dd = zeroPad(date.getDate());
|
|
35
|
+
const HH = zeroPad(date.getHours());
|
|
36
|
+
const MM = zeroPad(date.getMinutes());
|
|
37
|
+
return `${yyyy}-${mm}-${dd} ${HH}:${MM}`;
|
|
38
|
+
}
|
|
39
|
+
function zeroPad(value) {
|
|
40
|
+
return value.toString().padStart(2, '0');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=bundle-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/bundle-report.ts"],"sourcesContent":["import { getBundleType } from './get-bundle-type';\nimport { BuildContext } from './types';\n\n/*\n * Base name (no extension) and title for the bundle-size report, shared by the webpack and Vite\n * builds so both bundlers label their reports identically. The timestamp keeps successive reports\n * for the same package distinct.\n */\nexport function bundleReportFileName(context: BuildContext): string {\n const type = getBundleType(context);\n const qualifier = type ? `-${type}` : '';\n return `${context.package.name}${qualifier}-bundle-${Date.now()}`;\n}\n\nexport function bundleReportTitle(context: BuildContext): string {\n const unscopedName = context.package.name.replace(/^@[^/]+\\//, '');\n const type = getBundleType(context);\n const qualifier = type ? ` (${type})` : '';\n return `${unscopedName}${qualifier} ${formatDate(new Date())}`;\n}\n\nfunction formatDate(date: Date): string {\n const yyyy = date.getFullYear();\n const mm = zeroPad(date.getMonth() + 1);\n const dd = zeroPad(date.getDate());\n const HH = zeroPad(date.getHours());\n const MM = zeroPad(date.getMinutes());\n return `${yyyy}-${mm}-${dd} ${HH}:${MM}`;\n}\n\nfunction zeroPad(value: number) {\n return value.toString().padStart(2, '0');\n}\n"],"names":["bundleReportFileName","bundleReportTitle","context","type","getBundleType","qualifier","package","name","Date","now","unscopedName","replace","formatDate","date","yyyy","getFullYear","mm","zeroPad","getMonth","dd","getDate","HH","getHours","MM","getMinutes","value","toString","padStart"],"mappings":";;;;;;;;;;;QAQgBA;eAAAA;;QAMAC;eAAAA;;;+BAdc;AAQvB,SAASD,qBAAqBE,OAAqB;IACtD,MAAMC,OAAOC,IAAAA,4BAAa,EAACF;IAC3B,MAAMG,YAAYF,OAAO,CAAC,CAAC,EAAEA,MAAM,GAAG;IACtC,OAAO,GAAGD,QAAQI,OAAO,CAACC,IAAI,GAAGF,UAAU,QAAQ,EAAEG,KAAKC,GAAG,IAAI;AACrE;AAEO,SAASR,kBAAkBC,OAAqB;IACnD,MAAMQ,eAAeR,QAAQI,OAAO,CAACC,IAAI,CAACI,OAAO,CAAC,aAAa;IAC/D,MAAMR,OAAOC,IAAAA,4BAAa,EAACF;IAC3B,MAAMG,YAAYF,OAAO,CAAC,EAAE,EAAEA,KAAK,CAAC,CAAC,GAAG;IACxC,OAAO,GAAGO,eAAeL,UAAU,CAAC,EAAEO,WAAW,IAAIJ,SAAS;AAClE;AAEA,SAASI,WAAWC,IAAU;IAC1B,MAAMC,OAAOD,KAAKE,WAAW;IAC7B,MAAMC,KAAKC,QAAQJ,KAAKK,QAAQ,KAAK;IACrC,MAAMC,KAAKF,QAAQJ,KAAKO,OAAO;IAC/B,MAAMC,KAAKJ,QAAQJ,KAAKS,QAAQ;IAChC,MAAMC,KAAKN,QAAQJ,KAAKW,UAAU;IAClC,OAAO,GAAGV,KAAK,CAAC,EAAEE,GAAG,CAAC,EAAEG,GAAG,CAAC,EAAEE,GAAG,CAAC,EAAEE,IAAI;AAC5C;AAEA,SAASN,QAAQQ,KAAa;IAC1B,OAAOA,MAAMC,QAAQ,GAAGC,QAAQ,CAAC,GAAG;AACxC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { CheckerArgs } from './types';
|
|
3
|
-
export declare function checkResource(context:
|
|
1
|
+
import type { PackageContext } from '../types';
|
|
2
|
+
import type { CheckerArgs, IgnoreMode } from './types';
|
|
3
|
+
export declare function checkResource(context: {
|
|
4
|
+
package: Pick<PackageContext, 'dependencies'>;
|
|
5
|
+
}): ({ resource, importer }: CheckerArgs) => IgnoreMode | false;
|
|
4
6
|
//# sourceMappingURL=check-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-resource.d.ts","sourceRoot":"","sources":["../../../src/core/check-resource/check-resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"check-resource.d.ts","sourceRoot":"","sources":["../../../src/core/check-resource/check-resource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;CAAE,IACnE,wBAAwB,WAAW,KAAG,UAAU,GAAG,KAAK,CAsB5E"}
|
|
@@ -11,18 +11,26 @@ Object.defineProperty(exports, "checkResource", {
|
|
|
11
11
|
const _utils = require("../../utils");
|
|
12
12
|
const _getpeerdependencymeta = require("./get-peer-dependency-meta");
|
|
13
13
|
const _ismanagedreactdomclientdependency = require("./is-managed-react-dom-client-dependency");
|
|
14
|
+
const _isresolvable = require("./is-resolvable");
|
|
14
15
|
function checkResource(context) {
|
|
15
16
|
return function({ resource, importer }) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
if (!context.package.dependencies[resource]) {
|
|
18
|
+
const meta = (0, _getpeerdependencymeta.getPeerDependencyMeta)({
|
|
19
|
+
resource,
|
|
20
|
+
importer
|
|
21
|
+
});
|
|
22
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.optional) && !(0, _isresolvable.isResolvable)({
|
|
22
23
|
resource,
|
|
23
24
|
importer
|
|
24
|
-
})
|
|
25
|
-
|
|
25
|
+
})) {
|
|
26
|
+
var _meta_fallback;
|
|
27
|
+
const mode = (_meta_fallback = meta.fallback) !== null && _meta_fallback !== void 0 ? _meta_fallback : 'throw';
|
|
28
|
+
_utils.log.debug('check-resource', `${JSON.stringify({
|
|
29
|
+
resource,
|
|
30
|
+
importer
|
|
31
|
+
})} => ${mode}`);
|
|
32
|
+
return mode;
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
/**
|
|
28
36
|
* react-dom/client isn't an explicit dependency, so the peerDependenciesMeta
|
|
@@ -30,12 +38,11 @@ function checkResource(context) {
|
|
|
30
38
|
*/ if ((0, _ismanagedreactdomclientdependency.isManagedReactDomClientDependency)({
|
|
31
39
|
resource,
|
|
32
40
|
importer
|
|
41
|
+
}) && !(0, _isresolvable.isResolvable)({
|
|
42
|
+
resource,
|
|
43
|
+
importer
|
|
33
44
|
})) {
|
|
34
|
-
|
|
35
|
-
require.resolve(resource);
|
|
36
|
-
} catch (unused) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
45
|
+
return 'empty';
|
|
39
46
|
}
|
|
40
47
|
return false;
|
|
41
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/check-resource/check-resource.ts"],"sourcesContent":["import { log } from '../../utils';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/core/check-resource/check-resource.ts"],"sourcesContent":["import { log } from '../../utils';\nimport type { PackageContext } from '../types';\nimport { getPeerDependencyMeta } from './get-peer-dependency-meta';\nimport { isManagedReactDomClientDependency } from './is-managed-react-dom-client-dependency';\nimport { isResolvable } from './is-resolvable';\nimport type { CheckerArgs, IgnoreMode } from './types';\n\nexport function checkResource(context: { package: Pick<PackageContext, 'dependencies'> }) {\n return function ({ resource, importer }: CheckerArgs): IgnoreMode | false {\n if (!context.package.dependencies[resource]) {\n const meta = getPeerDependencyMeta({ resource, importer });\n if (meta?.optional && !isResolvable({ resource, importer })) {\n const mode = meta.fallback ?? 'throw';\n log.debug('check-resource', `${JSON.stringify({ resource, importer })} => ${mode}`);\n return mode;\n }\n }\n\n /**\n * react-dom/client isn't an explicit dependency, so the peerDependenciesMeta\n * path above can't catch it.\n */\n if (\n isManagedReactDomClientDependency({ resource, importer }) &&\n !isResolvable({ resource, importer })\n ) {\n return 'empty';\n }\n return false;\n };\n}\n"],"names":["checkResource","context","resource","importer","package","dependencies","meta","getPeerDependencyMeta","optional","isResolvable","mode","fallback","log","debug","JSON","stringify","isManagedReactDomClientDependency"],"mappings":";;;;+BAOgBA;;;eAAAA;;;uBAPI;uCAEkB;mDACY;8BACrB;AAGtB,SAASA,cAAcC,OAA0D;IACpF,OAAO,SAAU,EAAEC,QAAQ,EAAEC,QAAQ,EAAe;QAChD,IAAI,CAACF,QAAQG,OAAO,CAACC,YAAY,CAACH,SAAS,EAAE;YACzC,MAAMI,OAAOC,IAAAA,4CAAqB,EAAC;gBAAEL;gBAAUC;YAAS;YACxD,IAAIG,CAAAA,iBAAAA,2BAAAA,KAAME,QAAQ,KAAI,CAACC,IAAAA,0BAAY,EAAC;gBAAEP;gBAAUC;YAAS,IAAI;oBAC5CG;gBAAb,MAAMI,QAAOJ,iBAAAA,KAAKK,QAAQ,cAAbL,4BAAAA,iBAAiB;gBAC9BM,UAAG,CAACC,KAAK,CAAC,kBAAkB,GAAGC,KAAKC,SAAS,CAAC;oBAAEb;oBAAUC;gBAAS,GAAG,IAAI,EAAEO,MAAM;gBAClF,OAAOA;YACX;QACJ;QAEA;;;SAGC,GACD,IACIM,IAAAA,oEAAiC,EAAC;YAAEd;YAAUC;QAAS,MACvD,CAACM,IAAAA,0BAAY,EAAC;YAAEP;YAAUC;QAAS,IACrC;YACE,OAAO;QACX;QACA,OAAO;IACX;AACJ"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import type { CheckerArgs } from './types';
|
|
1
|
+
import type { CheckerArgs, IgnoreMode } from './types';
|
|
2
2
|
interface PeerDependencyMeta {
|
|
3
3
|
optional?: boolean;
|
|
4
|
+
fallback?: IgnoreMode;
|
|
4
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Merged view of npm's `peerDependenciesMeta[resource]` (which carries
|
|
8
|
+
* `optional`) and our extension `cli.peerDependenciesMeta[resource]`. Returns
|
|
9
|
+
* undefined when no entry is declared for the resource.
|
|
10
|
+
*
|
|
11
|
+
* Validates the `cli.peerDependenciesMeta` map so a malformed entry (for
|
|
12
|
+
* example, `optional: true` written there by mistake, thinking it's npm's
|
|
13
|
+
* field) fails loudly.
|
|
14
|
+
*/
|
|
5
15
|
export declare function getPeerDependencyMeta({ resource, importer, }: CheckerArgs): PeerDependencyMeta | undefined;
|
|
6
16
|
export {};
|
|
7
17
|
//# sourceMappingURL=get-peer-dependency-meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-peer-dependency-meta.d.ts","sourceRoot":"","sources":["../../../src/core/check-resource/get-peer-dependency-meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-peer-dependency-meta.d.ts","sourceRoot":"","sources":["../../../src/core/check-resource/get-peer-dependency-meta.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,UAAU,kBAAkB;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACzB;AAKD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,QAAQ,EACR,QAAQ,GACX,EAAE,WAAW,GAAG,kBAAkB,GAAG,SAAS,CA0B9C"}
|
|
@@ -8,10 +8,66 @@ Object.defineProperty(exports, "getPeerDependencyMeta", {
|
|
|
8
8
|
return getPeerDependencyMeta;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _lodashmemoize = /*#__PURE__*/ _interop_require_default(require("lodash.memoize"));
|
|
11
12
|
const _getpackagejson = require("./get-package-json");
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const ALLOWED_KEYS = [
|
|
19
|
+
'fallback'
|
|
20
|
+
];
|
|
21
|
+
const ALLOWED_FALLBACKS = [
|
|
22
|
+
'throw',
|
|
23
|
+
'empty'
|
|
24
|
+
];
|
|
12
25
|
function getPeerDependencyMeta({ resource, importer }) {
|
|
13
|
-
var
|
|
14
|
-
|
|
26
|
+
var _pkg_cli, _pkg_peerDependenciesMeta;
|
|
27
|
+
if (!/^[@a-z]/.test(resource)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const pkg = (0, _getpackagejson.getPackageJson)(importer);
|
|
31
|
+
if (!pkg) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const cliMap = (_pkg_cli = pkg.cli) === null || _pkg_cli === void 0 ? void 0 : _pkg_cli.peerDependenciesMeta;
|
|
35
|
+
if (cliMap && typeof cliMap === 'object') {
|
|
36
|
+
validate(cliMap);
|
|
37
|
+
}
|
|
38
|
+
const npmEntry = (_pkg_peerDependenciesMeta = pkg.peerDependenciesMeta) === null || _pkg_peerDependenciesMeta === void 0 ? void 0 : _pkg_peerDependenciesMeta[resource];
|
|
39
|
+
const cliEntry = cliMap === null || cliMap === void 0 ? void 0 : cliMap[resource];
|
|
40
|
+
if (!npmEntry && !cliEntry) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if ((cliEntry === null || cliEntry === void 0 ? void 0 : cliEntry.fallback) && !(npmEntry === null || npmEntry === void 0 ? void 0 : npmEntry.optional)) {
|
|
44
|
+
throw new Error(`cli.peerDependenciesMeta["${resource}"].fallback requires peerDependenciesMeta["${resource}"].optional = true`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...npmEntry,
|
|
48
|
+
...cliEntry
|
|
49
|
+
};
|
|
15
50
|
}
|
|
51
|
+
/*
|
|
52
|
+
* cli.peerDependenciesMeta mirrors npm's peerDependenciesMeta shape. If a
|
|
53
|
+
* developer mistakenly puts npm fields (for example, `optional: true`) there
|
|
54
|
+
* thinking it's npm's config, this check causes it to fail loudly.
|
|
55
|
+
*
|
|
56
|
+
* Memoized by reference so each importer's map is validated once per build.
|
|
57
|
+
*/ const validate = (0, _lodashmemoize.default)(function validate(meta) {
|
|
58
|
+
for (const [resource, entry] of Object.entries(meta)){
|
|
59
|
+
if (entry === null || typeof entry !== 'object') {
|
|
60
|
+
throw new Error(`cli.peerDependenciesMeta["${resource}"] must be an object`);
|
|
61
|
+
}
|
|
62
|
+
const unknown = Object.keys(entry).filter((k)=>!ALLOWED_KEYS.includes(k));
|
|
63
|
+
if (unknown.length) {
|
|
64
|
+
throw new Error(`cli.peerDependenciesMeta["${resource}"] has unexpected key(s) [${unknown.join(', ')}]; allowed: [${ALLOWED_KEYS.join(', ')}]`);
|
|
65
|
+
}
|
|
66
|
+
const { fallback } = entry;
|
|
67
|
+
if (fallback !== undefined && !ALLOWED_FALLBACKS.includes(fallback)) {
|
|
68
|
+
throw new Error(`cli.peerDependenciesMeta["${resource}"].fallback must be one of [${ALLOWED_FALLBACKS.join(', ')}], got ${JSON.stringify(fallback)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
16
72
|
|
|
17
73
|
//# sourceMappingURL=get-peer-dependency-meta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/check-resource/get-peer-dependency-meta.ts"],"sourcesContent":["import { getPackageJson } from './get-package-json';\nimport type { CheckerArgs } from './types';\n\ninterface PeerDependencyMeta {\n optional?: boolean;\n}\n\nexport function getPeerDependencyMeta({\n resource,\n importer,\n}: CheckerArgs): PeerDependencyMeta | undefined {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/core/check-resource/get-peer-dependency-meta.ts"],"sourcesContent":["import memoize from 'lodash.memoize';\nimport { getPackageJson } from './get-package-json';\nimport type { CheckerArgs, IgnoreMode } from './types';\n\ninterface PeerDependencyMeta {\n optional?: boolean;\n fallback?: IgnoreMode;\n}\n\nconst ALLOWED_KEYS: readonly string[] = ['fallback'];\nconst ALLOWED_FALLBACKS: readonly IgnoreMode[] = ['throw', 'empty'];\n\n/**\n * Merged view of npm's `peerDependenciesMeta[resource]` (which carries\n * `optional`) and our extension `cli.peerDependenciesMeta[resource]`. Returns\n * undefined when no entry is declared for the resource.\n *\n * Validates the `cli.peerDependenciesMeta` map so a malformed entry (for\n * example, `optional: true` written there by mistake, thinking it's npm's\n * field) fails loudly.\n */\nexport function getPeerDependencyMeta({\n resource,\n importer,\n}: CheckerArgs): PeerDependencyMeta | undefined {\n if (!/^[@a-z]/.test(resource)) {\n return;\n }\n\n const pkg = getPackageJson(importer);\n if (!pkg) {\n return;\n }\n\n const cliMap = pkg.cli?.peerDependenciesMeta;\n if (cliMap && typeof cliMap === 'object') {\n validate(cliMap);\n }\n\n const npmEntry = pkg.peerDependenciesMeta?.[resource];\n const cliEntry = cliMap?.[resource];\n if (!npmEntry && !cliEntry) {\n return;\n }\n if (cliEntry?.fallback && !npmEntry?.optional) {\n throw new Error(\n `cli.peerDependenciesMeta[\"${resource}\"].fallback requires peerDependenciesMeta[\"${resource}\"].optional = true`\n );\n }\n return { ...npmEntry, ...cliEntry };\n}\n\n/*\n * cli.peerDependenciesMeta mirrors npm's peerDependenciesMeta shape. If a\n * developer mistakenly puts npm fields (for example, `optional: true`) there\n * thinking it's npm's config, this check causes it to fail loudly.\n *\n * Memoized by reference so each importer's map is validated once per build.\n */\nconst validate = memoize(function validate(meta: Record<string, unknown>) {\n for (const [resource, entry] of Object.entries(meta)) {\n if (entry === null || typeof entry !== 'object') {\n throw new Error(`cli.peerDependenciesMeta[\"${resource}\"] must be an object`);\n }\n const unknown = Object.keys(entry).filter(k => !ALLOWED_KEYS.includes(k));\n if (unknown.length) {\n throw new Error(\n `cli.peerDependenciesMeta[\"${resource}\"] has unexpected key(s) [${unknown.join(', ')}]; allowed: [${ALLOWED_KEYS.join(', ')}]`\n );\n }\n const { fallback } = entry as { fallback?: unknown };\n if (fallback !== undefined && !ALLOWED_FALLBACKS.includes(fallback as IgnoreMode)) {\n throw new Error(\n `cli.peerDependenciesMeta[\"${resource}\"].fallback must be one of [${ALLOWED_FALLBACKS.join(', ')}], got ${JSON.stringify(fallback)}`\n );\n }\n }\n});\n"],"names":["getPeerDependencyMeta","ALLOWED_KEYS","ALLOWED_FALLBACKS","resource","importer","pkg","test","getPackageJson","cliMap","cli","peerDependenciesMeta","validate","npmEntry","cliEntry","fallback","optional","Error","memoize","meta","entry","Object","entries","unknown","keys","filter","k","includes","length","join","undefined","JSON","stringify"],"mappings":";;;;+BAqBgBA;;;eAAAA;;;sEArBI;gCACW;;;;;;AAQ/B,MAAMC,eAAkC;IAAC;CAAW;AACpD,MAAMC,oBAA2C;IAAC;IAAS;CAAQ;AAW5D,SAASF,sBAAsB,EAClCG,QAAQ,EACRC,QAAQ,EACE;QAUKC,UAKEA;IAdjB,IAAI,CAAC,UAAUC,IAAI,CAACH,WAAW;QAC3B;IACJ;IAEA,MAAME,MAAME,IAAAA,8BAAc,EAACH;IAC3B,IAAI,CAACC,KAAK;QACN;IACJ;IAEA,MAAMG,UAASH,WAAAA,IAAII,GAAG,cAAPJ,+BAAAA,SAASK,oBAAoB;IAC5C,IAAIF,UAAU,OAAOA,WAAW,UAAU;QACtCG,SAASH;IACb;IAEA,MAAMI,YAAWP,4BA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