@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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
|
+
import { lt, minVersion, valid } from 'semver';
|
|
4
|
+
import { FixCategory, PackageError, PackageRule, Project } from '../types';
|
|
5
|
+
|
|
6
|
+
const STARTUP = '@servicetitan/startup';
|
|
7
|
+
const TYPESCRIPT = 'typescript';
|
|
8
|
+
|
|
9
|
+
interface ErrorData {
|
|
10
|
+
actualVersion: string;
|
|
11
|
+
requiredVersion: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type RuleError = PackageError<ErrorData>;
|
|
15
|
+
|
|
16
|
+
export class RequireCompatibleTypescript implements PackageRule {
|
|
17
|
+
get id() {
|
|
18
|
+
return 'require-compatible-typescript';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
run({ packageManager }: Project): RuleError | undefined {
|
|
22
|
+
if (packageManager.command === 'pnpm') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const requiredVersion = packageManager.getDeclaredVersion({
|
|
27
|
+
workspacePackage: '',
|
|
28
|
+
declaredBy: STARTUP,
|
|
29
|
+
dependency: TYPESCRIPT,
|
|
30
|
+
});
|
|
31
|
+
const actualVersion = packageManager.getResolvedVersion({
|
|
32
|
+
workspacePackage: '',
|
|
33
|
+
dependency: TYPESCRIPT,
|
|
34
|
+
});
|
|
35
|
+
if (!(requiredVersion && actualVersion)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const floor = minVersion(requiredVersion);
|
|
40
|
+
if (floor && valid(actualVersion) && lt(actualVersion, floor)) {
|
|
41
|
+
return {
|
|
42
|
+
id: this.id,
|
|
43
|
+
message: `project's top-level "${TYPESCRIPT}" is older than the version required by ${STARTUP}`,
|
|
44
|
+
details: `${chalk.yellow(actualVersion)} is older than ${requiredVersion}`,
|
|
45
|
+
fixable: FixCategory.lockFile,
|
|
46
|
+
location: packageManager.lockFileName,
|
|
47
|
+
data: { actualVersion, requiredVersion },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fix({ data }: RuleError) {
|
|
53
|
+
const { requiredVersion } = data ?? {};
|
|
54
|
+
if (!requiredVersion) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[
|
|
59
|
+
`npm pkg set dependencies["${TYPESCRIPT}"]="${requiredVersion}"`,
|
|
60
|
+
'npx @servicetitan/install --fix --quiet',
|
|
61
|
+
`npm pkg delete dependencies["${TYPESCRIPT}"]`,
|
|
62
|
+
].forEach(command => execSync(command, { stdio: 'inherit' }));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -2,6 +2,7 @@ import { getPackages, logErrors, PackageType } from '../../utils';
|
|
|
2
2
|
import {
|
|
3
3
|
checkArgs,
|
|
4
4
|
compile,
|
|
5
|
+
getBundleCommand,
|
|
5
6
|
lernaExec,
|
|
6
7
|
pipeStdout,
|
|
7
8
|
ProcessTree,
|
|
@@ -28,8 +29,6 @@ export class Start extends Command<typeof entry> {
|
|
|
28
29
|
checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });
|
|
29
30
|
|
|
30
31
|
const useTsc = this.args.useTsc;
|
|
31
|
-
const useVite = this.args.useVite;
|
|
32
|
-
const cmd = useVite ? 'startup bundle-vite' : 'startup bundle-package';
|
|
33
32
|
|
|
34
33
|
const packages = getPackages({
|
|
35
34
|
scope: this.args.scope,
|
|
@@ -44,6 +43,7 @@ export class Start extends Command<typeof entry> {
|
|
|
44
43
|
const bundleScope = packages
|
|
45
44
|
.filter(({ type }) => type === PackageType.Bundle)
|
|
46
45
|
.map(({ name }) => name);
|
|
46
|
+
const bundleCmd = getBundleCommand(this.args);
|
|
47
47
|
const precompileScope = packages
|
|
48
48
|
.filter(({ scripts }) => !!scripts?.precompile)
|
|
49
49
|
.map(({ name }) => name);
|
|
@@ -126,7 +126,7 @@ export class Start extends Command<typeof entry> {
|
|
|
126
126
|
return Promise.resolve();
|
|
127
127
|
}
|
|
128
128
|
return lernaExec({
|
|
129
|
-
cmd,
|
|
129
|
+
'cmd': bundleCmd,
|
|
130
130
|
'scope': bundleScope,
|
|
131
131
|
'parallel': true,
|
|
132
132
|
'stream': true,
|
|
@@ -142,7 +142,7 @@ export class Start extends Command<typeof entry> {
|
|
|
142
142
|
return Promise.resolve();
|
|
143
143
|
}
|
|
144
144
|
return lernaExec({
|
|
145
|
-
cmd,
|
|
145
|
+
'cmd': bundleCmd,
|
|
146
146
|
'scope': bundleScope,
|
|
147
147
|
'parallel': true,
|
|
148
148
|
'stream': true,
|
|
@@ -3,6 +3,7 @@ import { fs, vol } from 'memfs';
|
|
|
3
3
|
import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';
|
|
4
4
|
import { parseCLI, resolveConfig, startVitest } from 'vitest/node';
|
|
5
5
|
import { getDefaultTestExcludes } from '../../../../../utils';
|
|
6
|
+
import { ignoreModulesPlugin } from '../../../../../vite/plugins';
|
|
6
7
|
import { Vitest } from '../vitest';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -20,6 +21,7 @@ jest.mock('vitest/', () => ({
|
|
|
20
21
|
}));
|
|
21
22
|
|
|
22
23
|
jest.mock('fs', () => fs);
|
|
24
|
+
jest.mock('../../../../../vite/plugins', () => ({ ignoreModulesPlugin: jest.fn() }));
|
|
23
25
|
|
|
24
26
|
describe(`[startup] Test ${Vitest.name}`, () => {
|
|
25
27
|
const defaultExcludes = getDefaultTestExcludes();
|
|
@@ -42,6 +44,7 @@ describe(`[startup] Test ${Vitest.name}`, () => {
|
|
|
42
44
|
jest.mocked(parseCLI).mockReturnValue({ filter: [], options: {} });
|
|
43
45
|
jest.mocked(resolveConfig).mockResolvedValue({ viteConfig: {} } as any);
|
|
44
46
|
jest.mocked(startVitest).mockResolvedValue({ close: jest.fn() } as any);
|
|
47
|
+
jest.mocked(ignoreModulesPlugin).mockReturnValue({ name: 'ignore-modules' } as any);
|
|
45
48
|
|
|
46
49
|
vol.fromJSON({ 'package.json': JSON.stringify({}) });
|
|
47
50
|
});
|
|
@@ -60,7 +63,10 @@ describe(`[startup] Test ${Vitest.name}`, () => {
|
|
|
60
63
|
{},
|
|
61
64
|
{
|
|
62
65
|
test: config,
|
|
63
|
-
plugins: [
|
|
66
|
+
plugins: [
|
|
67
|
+
expect.objectContaining({ name: 'vitest-svg-transformer' }),
|
|
68
|
+
expect.objectContaining({ name: 'ignore-modules' }),
|
|
69
|
+
],
|
|
64
70
|
...overrides,
|
|
65
71
|
}
|
|
66
72
|
);
|
|
@@ -105,6 +111,7 @@ describe(`[startup] Test ${Vitest.name}`, () => {
|
|
|
105
111
|
'coverage.include',
|
|
106
112
|
'environment',
|
|
107
113
|
'plugins.vitest-svg-transformer',
|
|
114
|
+
'plugins.ignore-modules',
|
|
108
115
|
],
|
|
109
116
|
},
|
|
110
117
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';
|
|
2
2
|
import { parseCLI, resolveConfig, startVitest } from 'vitest/node';
|
|
3
3
|
import { getDefaultTestExcludes, getVitestConfiguration, log, omit } from '../../../../utils';
|
|
4
|
+
import { ignoreModulesPlugin } from '../../../../vite/plugins';
|
|
4
5
|
import svgTransformer from '../../../../vitest/svg-transformer';
|
|
5
6
|
|
|
6
7
|
type VitestConfig = NonNullable<ViteUserConfig['test']>;
|
|
@@ -64,9 +65,10 @@ async function getUserConfig(): Promise<ViteUserConfig> {
|
|
|
64
65
|
/* istanbul ignore next: debug only */
|
|
65
66
|
log.debug('vitest:userConfig', () => JSON.stringify(result, null, 2));
|
|
66
67
|
|
|
67
|
-
const plugins: NonNullable<ViteUserConfig['plugins']> = [
|
|
68
|
-
(
|
|
69
|
-
|
|
68
|
+
const plugins: NonNullable<ViteUserConfig['plugins']> = [
|
|
69
|
+
svgTransformer(),
|
|
70
|
+
ignoreModulesPlugin({ package: { dependencies: {} } }),
|
|
71
|
+
].filter(({ name }) => !omitDefault.includes(`plugins.${name}`));
|
|
70
72
|
|
|
71
73
|
return { test: result, ...(plugins.length ? { plugins } : {}) };
|
|
72
74
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { getStartupVersion } from '../core';
|
|
|
8
8
|
import { CommandName, log } from '../utils';
|
|
9
9
|
import { commandRegistry } from './commands/registry';
|
|
10
10
|
import type { CommandOptions } from './commands/types';
|
|
11
|
-
import { checkStartupLocation, setNodeOptions } from './utils';
|
|
11
|
+
import { checkStartupLocation, getExitCode, setNodeOptions } from './utils';
|
|
12
12
|
|
|
13
13
|
const yargsInstance = yargs(hideBin(process.argv));
|
|
14
14
|
|
|
@@ -61,7 +61,7 @@ async function handleCommand(name: CommandName, argv: any) {
|
|
|
61
61
|
if (setNodeOptions(name, entry)) {
|
|
62
62
|
log.debug('run', `Running ${name} in child process with amended NODE_OPTIONS`);
|
|
63
63
|
execa(process.argv[0], process.argv.slice(1), { stdio: 'inherit' }).catch(reason => {
|
|
64
|
-
process.exit(reason
|
|
64
|
+
process.exit(getExitCode(reason));
|
|
65
65
|
});
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getBundleCommand } from '../get-bundle-command';
|
|
2
|
+
|
|
3
|
+
describe(`[startup] ${getBundleCommand.name}`, () => {
|
|
4
|
+
let args: Parameters<typeof getBundleCommand>[0];
|
|
5
|
+
|
|
6
|
+
const subject = () => getBundleCommand(args);
|
|
7
|
+
|
|
8
|
+
describe('when bundler is vite', () => {
|
|
9
|
+
beforeEach(() => (args = { bundler: 'vite' }));
|
|
10
|
+
|
|
11
|
+
test('returns "startup bundle-vite"', () => {
|
|
12
|
+
expect(subject()).toBe('startup bundle-vite');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('when bundler is webpack', () => {
|
|
17
|
+
beforeEach(() => (args = { bundler: 'webpack' }));
|
|
18
|
+
|
|
19
|
+
test('returns "startup bundle-webpack"', () => {
|
|
20
|
+
expect(subject()).toBe('startup bundle-webpack');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import { getExitCode } from '../get-exit-code';
|
|
3
|
+
|
|
4
|
+
describe(`[startup] utils:${getExitCode.name}`, () => {
|
|
5
|
+
const SIGNAL_EXIT_BASE = 128;
|
|
6
|
+
let error: { exitCode?: number; signal?: NodeJS.Signals };
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
error = {};
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const subject = () => getExitCode(error);
|
|
13
|
+
|
|
14
|
+
test('returns 1', () => {
|
|
15
|
+
expect(subject()).toBe(1);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('when the child exited with a non-zero code', () => {
|
|
19
|
+
beforeEach(() => (error = { exitCode: 2 }));
|
|
20
|
+
|
|
21
|
+
test('returns that exit code', () => {
|
|
22
|
+
expect(subject()).toBe(2);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('when the child was killed by a signal', () => {
|
|
27
|
+
beforeEach(() => (error = { signal: 'SIGINT' }));
|
|
28
|
+
|
|
29
|
+
test(`returns ${SIGNAL_EXIT_BASE} plus the signal number`, () => {
|
|
30
|
+
expect(subject()).toBe(SIGNAL_EXIT_BASE + os.constants.signals.SIGINT);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('when the signal is not recognized', () => {
|
|
35
|
+
beforeEach(() => (error = { signal: 'NOTASIGNAL' as NodeJS.Signals }));
|
|
36
|
+
|
|
37
|
+
test(`returns ${SIGNAL_EXIT_BASE + 1}`, () => {
|
|
38
|
+
expect(subject()).toBe(SIGNAL_EXIT_BASE + 1);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getConfiguration, log } from '../../../utils';
|
|
2
|
+
import { resolveBundler } from '../resolve-bundler';
|
|
3
|
+
|
|
4
|
+
jest.mock('../../../utils', () => ({
|
|
5
|
+
...jest.requireActual('../../../utils'),
|
|
6
|
+
getConfiguration: jest.fn(),
|
|
7
|
+
log: { warning: jest.fn() },
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
describe(`[startup] ${resolveBundler.name}`, () => {
|
|
11
|
+
let args: Parameters<typeof resolveBundler>[0];
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.clearAllMocks();
|
|
15
|
+
args = {};
|
|
16
|
+
jest.mocked(getConfiguration).mockReturnValue({} as any);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const subject = () => resolveBundler(args);
|
|
20
|
+
|
|
21
|
+
test('defaults to webpack', () => {
|
|
22
|
+
expect(subject()).toBe('webpack');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('with the --bundler flag', () => {
|
|
26
|
+
beforeEach(() => (args = { bundler: 'vite' }));
|
|
27
|
+
|
|
28
|
+
test('uses the flag value', () => {
|
|
29
|
+
expect(subject()).toBe(args.bundler);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('with cli.bundler config', () => {
|
|
34
|
+
beforeEach(() => jest.mocked(getConfiguration).mockReturnValue({ bundler: 'vite' } as any));
|
|
35
|
+
|
|
36
|
+
test('uses the configured bundler', () => {
|
|
37
|
+
expect(subject()).toBe(getConfiguration().bundler);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('and the --bundler flag', () => {
|
|
41
|
+
beforeEach(() => (args = { bundler: 'webpack' }));
|
|
42
|
+
|
|
43
|
+
test('the flag wins over config', () => {
|
|
44
|
+
expect(subject()).toBe(args.bundler);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('with the deprecated --use-vite flag', () => {
|
|
50
|
+
beforeEach(() => (args = { useVite: true }));
|
|
51
|
+
|
|
52
|
+
test('resolves to vite', () => {
|
|
53
|
+
expect(subject()).toBe('vite');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('logs a deprecation warning', () => {
|
|
57
|
+
subject();
|
|
58
|
+
|
|
59
|
+
expect(log.warning).toHaveBeenCalledWith(
|
|
60
|
+
expect.stringContaining('--use-vite is deprecated')
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
|
|
3
|
+
const SIGNAL_EXIT_BASE = 128;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Derive this process's exit code from a failed child process result.
|
|
7
|
+
*
|
|
8
|
+
* A signal death (Ctrl-C, OOM kill) carries no exitCode, so map it to the
|
|
9
|
+
* shell's "128 + signal number" convention. Exiting with an undefined exitCode
|
|
10
|
+
* would resolve to 0, reporting a killed build as a success.
|
|
11
|
+
*/
|
|
12
|
+
export function getExitCode({ exitCode, signal }: { exitCode?: number; signal?: string }): number {
|
|
13
|
+
if (signal) {
|
|
14
|
+
return SIGNAL_EXIT_BASE + (os.constants.signals[signal as NodeJS.Signals] ?? 1);
|
|
15
|
+
}
|
|
16
|
+
return exitCode ?? 1;
|
|
17
|
+
}
|
package/src/cli/utils/index.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './compile';
|
|
|
16
16
|
*/
|
|
17
17
|
export * from './constants';
|
|
18
18
|
export * from './eslint';
|
|
19
|
+
export * from './get-bundle-command';
|
|
20
|
+
export * from './get-exit-code';
|
|
19
21
|
export * from './get-module-type';
|
|
20
22
|
export * from './is-module-installed';
|
|
21
23
|
export * from './is-tty';
|
|
@@ -24,6 +26,7 @@ export * from './maybe-create-git-folder';
|
|
|
24
26
|
export * from './pipe-stdout';
|
|
25
27
|
export * from './process-tree';
|
|
26
28
|
export * from './publish';
|
|
29
|
+
export * from './resolve-bundler';
|
|
27
30
|
export * from './set-node-options';
|
|
28
31
|
// Don't export ./stylelint, it breaks tests using the default "jsdom" environment
|
|
29
32
|
export * from './ts-config';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Bundler, getConfiguration, log } from '../../utils';
|
|
2
|
+
|
|
3
|
+
interface BundlerArgs {
|
|
4
|
+
bundler?: Bundler;
|
|
5
|
+
useVite?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Resolves the bundler from the --bundler flag, then the deprecated --use-vite
|
|
10
|
+
* flag, then the cli.bundler package.json config, then the webpack default.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveBundler(args: BundlerArgs): Bundler {
|
|
13
|
+
if (args.bundler) {
|
|
14
|
+
return args.bundler;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (args.useVite) {
|
|
18
|
+
log.warning('--use-vite is deprecated. Use --bundler=vite instead.');
|
|
19
|
+
return 'vite';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return getConfiguration().bundler ?? 'webpack';
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { bundleReportFileName, bundleReportTitle } from '../bundle-report';
|
|
2
|
+
import { getBundleType } from '../get-bundle-type';
|
|
3
|
+
|
|
4
|
+
jest.mock('../get-bundle-type');
|
|
5
|
+
|
|
6
|
+
const NOW = new Date(2026, 5, 9, 9, 5);
|
|
7
|
+
const FORMATTED_DATE = '2026-06-09 09:05';
|
|
8
|
+
|
|
9
|
+
describe('bundle-report', () => {
|
|
10
|
+
let context: Parameters<typeof bundleReportFileName>[0];
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
jest.clearAllMocks();
|
|
14
|
+
jest.useFakeTimers().setSystemTime(NOW);
|
|
15
|
+
context = { package: { name: '@servicetitan/foo' } } as typeof context;
|
|
16
|
+
jest.mocked(getBundleType).mockReturnValue(undefined);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterEach(() => jest.useRealTimers());
|
|
20
|
+
|
|
21
|
+
describe(bundleReportFileName.name, () => {
|
|
22
|
+
const subject = () => bundleReportFileName(context);
|
|
23
|
+
|
|
24
|
+
test('combines package name and timestamp', () => {
|
|
25
|
+
expect(subject()).toBe(`${context.package.name}-bundle-${NOW.getTime()}`);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('with a bundle type', () => {
|
|
29
|
+
const type = 'full';
|
|
30
|
+
|
|
31
|
+
beforeEach(() => jest.mocked(getBundleType).mockReturnValue(type));
|
|
32
|
+
|
|
33
|
+
test('adds type to the name', () => {
|
|
34
|
+
expect(subject()).toBe(`${context.package.name}-${type}-bundle-${NOW.getTime()}`);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe(bundleReportTitle.name, () => {
|
|
40
|
+
const subject = () => bundleReportTitle(context);
|
|
41
|
+
|
|
42
|
+
const unscoped = (name: string) => name.replace(/^@[^/]+\//, '');
|
|
43
|
+
|
|
44
|
+
test('combines unscoped name and formatted date', () => {
|
|
45
|
+
expect(subject()).toBe(`${unscoped(context.package.name)} ${FORMATTED_DATE}`);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('with a bundle type', () => {
|
|
49
|
+
const type = 'full';
|
|
50
|
+
|
|
51
|
+
beforeEach(() => jest.mocked(getBundleType).mockReturnValue(type));
|
|
52
|
+
|
|
53
|
+
test('appends the type in parentheses', () => {
|
|
54
|
+
expect(subject()).toBe(
|
|
55
|
+
`${unscoped(context.package.name)} (${type}) ${FORMATTED_DATE}`
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createExtensionRegExp } from '../create-extension-regexp';
|
|
2
|
+
|
|
3
|
+
describe(createExtensionRegExp.name, () => {
|
|
4
|
+
let extensions: string[];
|
|
5
|
+
|
|
6
|
+
beforeEach(() => (extensions = ['png', 'gif']));
|
|
7
|
+
|
|
8
|
+
const subject = () => createExtensionRegExp(extensions);
|
|
9
|
+
|
|
10
|
+
test('regex matches all extensions', () => {
|
|
11
|
+
const regex = subject();
|
|
12
|
+
expect(extensions.every(extension => regex.test(`foo.${extension}`))).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('regex does not match other extensions', () => {
|
|
16
|
+
expect(subject().test('foo.js')).toBe(false);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('regex is case-insensitive', () => {
|
|
20
|
+
const regex = subject();
|
|
21
|
+
expect(extensions.every(extension => regex.test(`foo.${extension}`.toUpperCase()))).toBe(
|
|
22
|
+
true
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('regex only matches extension at end of string', () => {
|
|
27
|
+
const regex = subject();
|
|
28
|
+
expect(extensions.some(extension => regex.test(`${extension}/foo.js`.toUpperCase()))).toBe(
|
|
29
|
+
false
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { getBundleType } from '../get-bundle-type';
|
|
3
|
+
import { resolveOutputPath } from '../resolve-output-path';
|
|
4
|
+
import { resolveOutputRoot } from '../resolve-output-root';
|
|
5
|
+
import { BuildContext } from '../types';
|
|
6
|
+
|
|
7
|
+
jest.mock('../get-bundle-type');
|
|
8
|
+
|
|
9
|
+
describe(`[startup] ${resolveOutputPath.name}`, () => {
|
|
10
|
+
let context: BuildContext;
|
|
11
|
+
let outputPath: string | undefined;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.clearAllMocks();
|
|
15
|
+
jest.mocked(getBundleType).mockReturnValue(undefined);
|
|
16
|
+
context = { build: {}, package: { destination: 'dist' } } as BuildContext;
|
|
17
|
+
outputPath = undefined;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const subject = () => resolveOutputPath(context, outputPath);
|
|
21
|
+
|
|
22
|
+
function itReturnsResolvedRoot() {
|
|
23
|
+
test('returns resolved root', () => {
|
|
24
|
+
expect(subject()).toBe(resolveOutputRoot(context, outputPath));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
itReturnsResolvedRoot();
|
|
29
|
+
|
|
30
|
+
describe('with an outputPath', () => {
|
|
31
|
+
beforeEach(() => (outputPath = '/output/dir'));
|
|
32
|
+
|
|
33
|
+
itReturnsResolvedRoot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('when getBundleType returns a subdir', () => {
|
|
37
|
+
const subdir = 'full';
|
|
38
|
+
|
|
39
|
+
beforeEach(() => jest.mocked(getBundleType).mockReturnValue(subdir));
|
|
40
|
+
|
|
41
|
+
test('appends the subdir to the output root', () => {
|
|
42
|
+
expect(subject()).toBe(path.join(resolveOutputRoot(context, outputPath), subdir));
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { resolveOutputRoot } from '../resolve-output-root';
|
|
3
|
+
import { BuildContext } from '../types';
|
|
4
|
+
|
|
5
|
+
describe(`[startup] ${resolveOutputRoot.name}`, () => {
|
|
6
|
+
let context: BuildContext;
|
|
7
|
+
let outputPath: string | undefined;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
context = { build: {}, package: { destination: 'dist' } } as BuildContext;
|
|
11
|
+
outputPath = undefined;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const subject = () => resolveOutputRoot(context, outputPath);
|
|
15
|
+
|
|
16
|
+
function itReturnsDefaultRoot() {
|
|
17
|
+
test('returns default output root', () => {
|
|
18
|
+
expect(subject()).toBe(path.join(process.cwd(), context.package.destination, 'bundle'));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
itReturnsDefaultRoot();
|
|
23
|
+
|
|
24
|
+
describe('with an outputPath', () => {
|
|
25
|
+
beforeEach(() => (outputPath = '/foo'));
|
|
26
|
+
|
|
27
|
+
test('returns the outputPath', () => {
|
|
28
|
+
expect(subject()).toBe(outputPath);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('when the package is an MFE', () => {
|
|
32
|
+
beforeEach(() => (context.package.isWebComponent = true));
|
|
33
|
+
|
|
34
|
+
itReturnsDefaultRoot();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { sortSharedCss } from '../sort-shared-css';
|
|
2
|
+
|
|
3
|
+
describe(`[startup] ${sortSharedCss.name}`, () => {
|
|
4
|
+
let cssFiles: string[];
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
cssFiles = ['foo.bundle.css', 'bar.bundle.css'];
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const subject = () => sortSharedCss(cssFiles);
|
|
11
|
+
|
|
12
|
+
function itReturnsInput() {
|
|
13
|
+
test('returns input', () => {
|
|
14
|
+
expect(subject()).toBe(cssFiles);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
itReturnsInput();
|
|
19
|
+
|
|
20
|
+
describe('when input contains design-system CSS', () => {
|
|
21
|
+
let otherCssFiles: string[];
|
|
22
|
+
const designSystemBundle = 'design-system.bundle.css';
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
otherCssFiles = [...cssFiles];
|
|
26
|
+
cssFiles = [...otherCssFiles, designSystemBundle];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('moves design system to front', () => {
|
|
30
|
+
expect(subject()).toEqual([designSystemBundle, ...otherCssFiles]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('when design-system CSS is already first', () => {
|
|
34
|
+
beforeEach(() => (cssFiles = [designSystemBundle, ...otherCssFiles]));
|
|
35
|
+
|
|
36
|
+
itReturnsInput();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getBundleType } from './get-bundle-type';
|
|
2
|
+
import { BuildContext } from './types';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Base name (no extension) and title for the bundle-size report, shared by the webpack and Vite
|
|
6
|
+
* builds so both bundlers label their reports identically. The timestamp keeps successive reports
|
|
7
|
+
* for the same package distinct.
|
|
8
|
+
*/
|
|
9
|
+
export function bundleReportFileName(context: BuildContext): string {
|
|
10
|
+
const type = getBundleType(context);
|
|
11
|
+
const qualifier = type ? `-${type}` : '';
|
|
12
|
+
return `${context.package.name}${qualifier}-bundle-${Date.now()}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function bundleReportTitle(context: BuildContext): string {
|
|
16
|
+
const unscopedName = context.package.name.replace(/^@[^/]+\//, '');
|
|
17
|
+
const type = getBundleType(context);
|
|
18
|
+
const qualifier = type ? ` (${type})` : '';
|
|
19
|
+
return `${unscopedName}${qualifier} ${formatDate(new Date())}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function formatDate(date: Date): string {
|
|
23
|
+
const yyyy = date.getFullYear();
|
|
24
|
+
const mm = zeroPad(date.getMonth() + 1);
|
|
25
|
+
const dd = zeroPad(date.getDate());
|
|
26
|
+
const HH = zeroPad(date.getHours());
|
|
27
|
+
const MM = zeroPad(date.getMinutes());
|
|
28
|
+
return `${yyyy}-${mm}-${dd} ${HH}:${MM}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function zeroPad(value: number) {
|
|
32
|
+
return value.toString().padStart(2, '0');
|
|
33
|
+
}
|