@servicetitan/startup 36.4.0 → 37.0.0
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/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 +2 -2
- 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/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 +17 -1
- 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/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/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 +15 -14
- 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/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 +31 -5
- 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 +70 -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/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,34 @@
|
|
|
1
|
+
import { CHUNK_PATTERNS } from '../../../core';
|
|
2
|
+
import type { ViteBuildContext } from '../../types';
|
|
3
|
+
import { getCodeSplitting } from '../code-splitting';
|
|
4
|
+
|
|
5
|
+
describe(getCodeSplitting.name, () => {
|
|
6
|
+
let context: ViteBuildContext;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
context = { build: { isProduction: false } } as unknown as ViteBuildContext;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const subject = () => getCodeSplitting(context);
|
|
13
|
+
|
|
14
|
+
test('returns undefined', () => {
|
|
15
|
+
expect(subject()).toBeUndefined();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('when a production build', () => {
|
|
19
|
+
beforeEach(() => (context.build.isProduction = true));
|
|
20
|
+
|
|
21
|
+
test('splits node_modules into prioritized groups', () => {
|
|
22
|
+
expect(subject()?.groups).toEqual([
|
|
23
|
+
{ name: 'servicetitan', test: CHUNK_PATTERNS.servicetitan, priority: 30 },
|
|
24
|
+
{ name: 'kendo', test: CHUNK_PATTERNS.kendo, priority: 20 },
|
|
25
|
+
{ name: 'vendor-core', test: CHUNK_PATTERNS['vendor-core'], priority: 15 },
|
|
26
|
+
{ name: 'vendor', test: CHUNK_PATTERNS.vendor, priority: 10 },
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('sets a 20 KB minimum chunk size', () => {
|
|
31
|
+
expect(subject()?.minSize).toBe(20 * 1024);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { bundleConstants } from '../../../core';
|
|
2
|
+
import { createCssConfig } from '../create-css-config';
|
|
3
|
+
|
|
4
|
+
describe(createCssConfig.name, () => {
|
|
5
|
+
let isProduction: boolean;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
isProduction = false;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const subject = () => createCssConfig(isProduction);
|
|
12
|
+
|
|
13
|
+
test('uses camelCase locals convention', () => {
|
|
14
|
+
expect(subject()).toEqual(
|
|
15
|
+
expect.objectContaining({
|
|
16
|
+
modules: expect.objectContaining({
|
|
17
|
+
localsConvention: bundleConstants.cssModules.localsConvention,
|
|
18
|
+
}),
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('uses development name template', () => {
|
|
24
|
+
expect(subject()).toEqual(
|
|
25
|
+
expect.objectContaining({
|
|
26
|
+
modules: expect.objectContaining({
|
|
27
|
+
generateScopedName: bundleConstants.cssModules.classnameTemplate.development,
|
|
28
|
+
}),
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('sets less math option', () => {
|
|
34
|
+
expect(subject()).toEqual(
|
|
35
|
+
expect.objectContaining({
|
|
36
|
+
preprocessorOptions: {
|
|
37
|
+
less: { math: bundleConstants.less.math },
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('when production', () => {
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
isProduction = true;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('uses production name template', () => {
|
|
49
|
+
expect(subject()).toEqual(
|
|
50
|
+
expect.objectContaining({
|
|
51
|
+
modules: expect.objectContaining({
|
|
52
|
+
generateScopedName: bundleConstants.cssModules.classnameTemplate.production,
|
|
53
|
+
}),
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createLogger, Logger } from 'vite';
|
|
2
|
+
import { createFilteringLogger } from '../create-filtering-logger';
|
|
3
|
+
|
|
4
|
+
jest.mock('vite', () => ({ createLogger: jest.fn() }));
|
|
5
|
+
|
|
6
|
+
describe(createFilteringLogger.name, () => {
|
|
7
|
+
let spies: Record<'warn' | 'warnOnce', jest.Mock>;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
spies = { warn: jest.fn(), warnOnce: jest.fn() };
|
|
11
|
+
jest.mocked(createLogger).mockReturnValue({ ...spies } as unknown as Logger);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe.each(['warn', 'warnOnce'] as ('warn' | 'warnOnce')[])('%s', method => {
|
|
15
|
+
let message: string;
|
|
16
|
+
|
|
17
|
+
beforeEach(() => (message = 'some message'));
|
|
18
|
+
|
|
19
|
+
const subject = () => (createFilteringLogger()[method] as Function)(message);
|
|
20
|
+
|
|
21
|
+
test('passes message through', () => {
|
|
22
|
+
subject();
|
|
23
|
+
|
|
24
|
+
expect(spies[method]).toHaveBeenCalled();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function itSuppressesMessage() {
|
|
28
|
+
test('suppresses message', () => {
|
|
29
|
+
subject();
|
|
30
|
+
|
|
31
|
+
expect(spies[method]).not.toHaveBeenCalled();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
describe('when message is shared .js asset warning', () => {
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
message =
|
|
37
|
+
'<script src="./shared/shared.abc.bundle.js"> in "/index.html" can\'t be bundled without type="module" attribute';
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
itSuppressesMessage();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('when message is shared .css asset warning', () => {
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
message = "./shared/anvil2.abc.bundle.css doesn't exist at build time";
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
itSuppressesMessage();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BuildContext } from '../../../core';
|
|
2
2
|
import type { VitePackageJsonOverride } from '../../../utils/get-configuration';
|
|
3
3
|
import { createViteBuildContext } from '../create-vite-build-context';
|
|
4
4
|
import type { ViteConfigFileOverride } from '../define-config';
|
|
5
5
|
|
|
6
6
|
describe(createViteBuildContext.name, () => {
|
|
7
|
-
const context = {
|
|
7
|
+
const context = {
|
|
8
|
+
build: { name: 'test' },
|
|
9
|
+
package: { destination: 'dist' },
|
|
10
|
+
} as BuildContext;
|
|
8
11
|
|
|
9
12
|
let pkgJsonConfig: VitePackageJsonOverride;
|
|
10
13
|
let fileConfig: ViteConfigFileOverride;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { createBuildContext } from '../../../core';
|
|
1
|
+
import { createBuildContext, resolveOutputPath, resolveOutputRoot } from '../../../core';
|
|
2
2
|
import { getViteConfiguration } from '../../../utils';
|
|
3
3
|
import { createBaseConfig } from '../base-config';
|
|
4
4
|
import { createViteBuildContext } from '../create-vite-build-context';
|
|
5
5
|
import { createViteConfig } from '../create-vite-config';
|
|
6
|
+
import { getWarmupClientFiles } from '../get-warmup-client-files';
|
|
6
7
|
import { loadConfigFile } from '../load-config-file';
|
|
7
8
|
import { mergeViteConfigs } from '../merge-vite-configs';
|
|
8
9
|
|
|
9
10
|
jest.mock('../../../core', () => ({
|
|
11
|
+
...jest.requireActual('../../../core'),
|
|
10
12
|
createBuildContext: jest.fn(),
|
|
11
|
-
stringifyConfig: jest.fn(),
|
|
12
13
|
}));
|
|
13
14
|
jest.mock('../../../utils', () => ({
|
|
14
15
|
getViteConfiguration: jest.fn(),
|
|
@@ -26,25 +27,36 @@ jest.mock('../load-config-file', () => ({
|
|
|
26
27
|
jest.mock('../merge-vite-configs', () => ({
|
|
27
28
|
mergeViteConfigs: jest.fn(),
|
|
28
29
|
}));
|
|
30
|
+
jest.mock('../get-warmup-client-files', () => ({
|
|
31
|
+
getWarmupClientFiles: jest.fn(),
|
|
32
|
+
}));
|
|
29
33
|
|
|
30
34
|
describe(createViteConfig.name, () => {
|
|
31
35
|
const options = { name: 'test', isProduction: false };
|
|
32
|
-
const
|
|
33
|
-
const mockFileConfig: any = { omitDefault: ['from-file'] };
|
|
34
|
-
const mockViteContext: any = { bundlerConfig: {} };
|
|
36
|
+
const warmupFiles = ['dist/**/*.js', '!dist/bundle/**'];
|
|
35
37
|
const mockBaseConfig: any = { root: '/' };
|
|
36
38
|
const mockFinalConfig: any = { server: { port: 3000 } };
|
|
37
39
|
|
|
38
40
|
let mockContext: any;
|
|
41
|
+
let mockPackageJsonConfig: any;
|
|
42
|
+
let mockFileConfig: any;
|
|
43
|
+
let mockViteBuildContext: any;
|
|
39
44
|
|
|
40
45
|
beforeEach(() => {
|
|
41
|
-
|
|
46
|
+
jest.clearAllMocks();
|
|
47
|
+
|
|
48
|
+
mockContext = { build: {}, package: { destination: 'dist' } };
|
|
49
|
+
mockPackageJsonConfig = { omitDefault: ['from-pkg'] };
|
|
50
|
+
mockFileConfig = { omitDefault: ['from-file'] };
|
|
51
|
+
mockViteBuildContext = { ...mockContext, bundlerConfig: {} };
|
|
52
|
+
|
|
42
53
|
jest.mocked(createBuildContext).mockReturnValue(mockContext);
|
|
43
|
-
jest.mocked(getViteConfiguration).mockReturnValue(
|
|
54
|
+
jest.mocked(getViteConfiguration).mockReturnValue(mockPackageJsonConfig);
|
|
44
55
|
jest.mocked(loadConfigFile).mockResolvedValue(mockFileConfig);
|
|
45
|
-
jest.mocked(createViteBuildContext).mockReturnValue(
|
|
56
|
+
jest.mocked(createViteBuildContext).mockReturnValue(mockViteBuildContext);
|
|
46
57
|
jest.mocked(createBaseConfig).mockReturnValue(mockBaseConfig);
|
|
47
58
|
jest.mocked(mergeViteConfigs).mockReturnValue({ ...mockFinalConfig });
|
|
59
|
+
jest.mocked(getWarmupClientFiles).mockReturnValue(warmupFiles);
|
|
48
60
|
});
|
|
49
61
|
|
|
50
62
|
const subject = () => createViteConfig(options);
|
|
@@ -71,8 +83,8 @@ describe(createViteConfig.name, () => {
|
|
|
71
83
|
await subject();
|
|
72
84
|
|
|
73
85
|
expect(createViteBuildContext).toHaveBeenCalledWith(
|
|
74
|
-
mockContext,
|
|
75
|
-
|
|
86
|
+
expect.objectContaining(mockContext),
|
|
87
|
+
mockPackageJsonConfig,
|
|
76
88
|
mockFileConfig
|
|
77
89
|
);
|
|
78
90
|
});
|
|
@@ -80,7 +92,7 @@ describe(createViteConfig.name, () => {
|
|
|
80
92
|
test('creates base config from vite context', async () => {
|
|
81
93
|
await subject();
|
|
82
94
|
|
|
83
|
-
expect(createBaseConfig).toHaveBeenCalledWith(
|
|
95
|
+
expect(createBaseConfig).toHaveBeenCalledWith(mockViteBuildContext);
|
|
84
96
|
});
|
|
85
97
|
|
|
86
98
|
test('merges base, package.json, and file configs', async () => {
|
|
@@ -88,13 +100,79 @@ describe(createViteConfig.name, () => {
|
|
|
88
100
|
|
|
89
101
|
expect(mergeViteConfigs).toHaveBeenCalledWith(
|
|
90
102
|
mockBaseConfig,
|
|
91
|
-
|
|
103
|
+
mockPackageJsonConfig,
|
|
92
104
|
mockFileConfig
|
|
93
105
|
);
|
|
94
106
|
});
|
|
95
107
|
|
|
96
108
|
test('returns merged config', async () => {
|
|
97
|
-
expect(await subject()).toEqual(
|
|
109
|
+
expect(await subject()).toEqual(
|
|
110
|
+
expect.objectContaining({
|
|
111
|
+
server: expect.objectContaining(mockFinalConfig.server),
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('resolves build.outDir from the configured outDir', async () => {
|
|
117
|
+
expect((await subject()).build?.outDir).toBe(resolveOutputPath(mockContext, undefined));
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('sets warmup.clientFiles for the dev server', async () => {
|
|
121
|
+
expect((await subject()).server?.warmup?.clientFiles).toBe(warmupFiles);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('warms the resolved output root', async () => {
|
|
125
|
+
await subject();
|
|
126
|
+
|
|
127
|
+
expect(getWarmupClientFiles).toHaveBeenCalledWith(
|
|
128
|
+
mockViteBuildContext,
|
|
129
|
+
resolveOutputRoot(mockContext, undefined)
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('when consumer config sets warmup', () => {
|
|
134
|
+
beforeEach(() =>
|
|
135
|
+
jest.mocked(mergeViteConfigs).mockReturnValue({
|
|
136
|
+
server: { warmup: { clientFiles: ['custom/**'], ssrFiles: ['ssr/**'] } },
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
test('consumer clientFiles take precedence', async () => {
|
|
141
|
+
expect((await subject()).server?.warmup?.clientFiles).toEqual(['custom/**']);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('preserves other consumer warmup options', async () => {
|
|
145
|
+
expect((await subject()).server?.warmup?.ssrFiles).toEqual(['ssr/**']);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe('when the merged config sets a custom outDir', () => {
|
|
150
|
+
const outDir = '/custom';
|
|
151
|
+
|
|
152
|
+
beforeEach(() =>
|
|
153
|
+
jest.mocked(mergeViteConfigs).mockReturnValue({ ...mockFinalConfig, build: { outDir } })
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
test('resolves build.outDir from the custom outDir', async () => {
|
|
157
|
+
expect((await subject()).build?.outDir).toBe(resolveOutputPath(mockContext, outDir));
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test('warms the custom output root', async () => {
|
|
161
|
+
await subject();
|
|
162
|
+
|
|
163
|
+
expect(getWarmupClientFiles).toHaveBeenCalledWith(
|
|
164
|
+
mockViteBuildContext,
|
|
165
|
+
resolveOutputRoot(mockContext, outDir)
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
describe('when production', () => {
|
|
171
|
+
beforeEach(() => (mockContext.build.isProduction = true));
|
|
172
|
+
|
|
173
|
+
test('skips warmup', async () => {
|
|
174
|
+
expect((await subject()).server?.warmup).toBeUndefined();
|
|
175
|
+
});
|
|
98
176
|
});
|
|
99
177
|
|
|
100
178
|
describe('when build is light', () => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import type { ViteBuildContext } from '../../types';
|
|
3
|
+
import { getWarmupClientFiles } from '../get-warmup-client-files';
|
|
4
|
+
|
|
5
|
+
describe(getWarmupClientFiles.name, () => {
|
|
6
|
+
const destination = 'dist';
|
|
7
|
+
let context: ViteBuildContext;
|
|
8
|
+
let outputRoot: string;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
context = { build: {}, package: { destination } } as unknown as ViteBuildContext;
|
|
12
|
+
outputRoot = path.join(process.cwd(), destination, 'bundle');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const subject = () => getWarmupClientFiles(context, outputRoot);
|
|
16
|
+
|
|
17
|
+
test('returns compiled output, excluding the bundle output', () => {
|
|
18
|
+
expect(subject()).toEqual([`${destination}/**/*.js`, `!${destination}/bundle/**`]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FONT_EXTENSIONS,
|
|
3
|
+
IMAGE_EXTENSIONS,
|
|
4
|
+
SVG_EXTENSIONS,
|
|
5
|
+
createExtensionRegExp,
|
|
6
|
+
} from '../../core';
|
|
7
|
+
|
|
8
|
+
const FONT = createExtensionRegExp(FONT_EXTENSIONS);
|
|
9
|
+
const IMAGE = createExtensionRegExp([...IMAGE_EXTENSIONS, ...SVG_EXTENSIONS]);
|
|
10
|
+
|
|
11
|
+
export function assetFileNames(asset: { names: string[] }): string {
|
|
12
|
+
const name = asset.names[0] ?? '';
|
|
13
|
+
if (FONT.test(name)) {
|
|
14
|
+
return 'fonts/[name]-[hash][extname]';
|
|
15
|
+
}
|
|
16
|
+
if (IMAGE.test(name)) {
|
|
17
|
+
return 'images/[name]-[hash][extname]';
|
|
18
|
+
}
|
|
19
|
+
return 'assets/[name]-[hash][extname]';
|
|
20
|
+
}
|
|
@@ -6,21 +6,32 @@ import {
|
|
|
6
6
|
defineWebComponentName,
|
|
7
7
|
getBundleType,
|
|
8
8
|
getCdnPath,
|
|
9
|
-
|
|
9
|
+
getProcessEnv,
|
|
10
10
|
} from '../../core';
|
|
11
11
|
import { omit } from '../../utils';
|
|
12
12
|
import {
|
|
13
|
+
bundleStatPlugin,
|
|
14
|
+
chainSourceMapsPlugin,
|
|
15
|
+
cleanPlugin,
|
|
13
16
|
cssInjectorPlugin,
|
|
17
|
+
designSystemGuardPlugin,
|
|
14
18
|
devServerRoutingPlugin,
|
|
15
19
|
externalsPlugin,
|
|
16
20
|
htmlPlugin,
|
|
17
21
|
ignoreModulesPlugin,
|
|
22
|
+
istanbulPlugin,
|
|
23
|
+
magicCommentsPlugin,
|
|
18
24
|
metadataPlugin,
|
|
25
|
+
momentLocalesPlugin,
|
|
19
26
|
styleUrlsPlugin,
|
|
20
27
|
svgrPlugin,
|
|
21
28
|
virtualModulesPlugin,
|
|
22
29
|
} from '../plugins';
|
|
23
30
|
import { ViteBuildContext } from '../types';
|
|
31
|
+
import { assetFileNames } from './asset-file-names';
|
|
32
|
+
import { getCodeSplitting } from './code-splitting';
|
|
33
|
+
import { createCssConfig } from './create-css-config';
|
|
34
|
+
import { createFilteringLogger } from './create-filtering-logger';
|
|
24
35
|
|
|
25
36
|
function importMetaRemap(
|
|
26
37
|
...definitions: (Record<string, string> | undefined)[]
|
|
@@ -39,16 +50,22 @@ function importMetaRemap(
|
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
function createPlugins(context: ViteBuildContext) {
|
|
42
|
-
const entries: [string, Plugin[] | Plugin | undefined][] = [
|
|
43
|
-
['
|
|
44
|
-
['
|
|
45
|
-
['externals', externalsPlugin(context)],
|
|
46
|
-
['virtualModules', virtualModulesPlugin(context)],
|
|
53
|
+
const entries: [string, Plugin[] | Plugin | Promise<Plugin> | undefined][] = [
|
|
54
|
+
['bundleStat', bundleStatPlugin(context)],
|
|
55
|
+
['clean', cleanPlugin(context)],
|
|
47
56
|
['cssInjector', cssInjectorPlugin(context)],
|
|
48
|
-
['
|
|
49
|
-
['metadata', metadataPlugin(context)],
|
|
57
|
+
['designSystemGuard', designSystemGuardPlugin(context)],
|
|
50
58
|
['devServerRouting', devServerRoutingPlugin(context)],
|
|
59
|
+
['externals', externalsPlugin(context)],
|
|
60
|
+
['html', htmlPlugin(context)],
|
|
51
61
|
['ignoreModules', ignoreModulesPlugin(context)],
|
|
62
|
+
['istanbul', istanbulPlugin(context)],
|
|
63
|
+
['magicComments', magicCommentsPlugin(context)],
|
|
64
|
+
['metadata', metadataPlugin(context)],
|
|
65
|
+
['momentLocales', momentLocalesPlugin(context)],
|
|
66
|
+
['styleUrls', styleUrlsPlugin(context)],
|
|
67
|
+
['svgr', svgrPlugin(context)],
|
|
68
|
+
['virtualModules', virtualModulesPlugin(context)],
|
|
52
69
|
];
|
|
53
70
|
|
|
54
71
|
return entries
|
|
@@ -65,47 +82,33 @@ export function createBaseConfig(context: ViteBuildContext): InlineConfig {
|
|
|
65
82
|
|
|
66
83
|
let config: InlineConfig = {
|
|
67
84
|
cacheDir: `node_modules/.vite/${getBundleType(context) ?? 'host'}`,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
warmup: {
|
|
71
|
-
// Pre-warms compiled files to avoid multiple page reloads at dev session start
|
|
72
|
-
clientFiles: [`${context.package.destination}/**/*.js`],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
85
|
+
customLogger: createFilteringLogger(),
|
|
86
|
+
server: { port: context.bundlerConfig.port ?? (isWebComponent ? 8888 : 8080) },
|
|
75
87
|
mode: isProduction ? bundleConstants.mode.production : bundleConstants.mode.development,
|
|
76
88
|
configFile: false,
|
|
77
89
|
oxc: { legalComments: 'none' },
|
|
78
90
|
base: getCdnPath(context) || './', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
|
|
79
|
-
css:
|
|
80
|
-
modules: {
|
|
81
|
-
localsConvention: bundleConstants.cssModules.localsConvention,
|
|
82
|
-
generateScopedName: isProduction
|
|
83
|
-
? bundleConstants.cssModules.classnameTemplate.production
|
|
84
|
-
: bundleConstants.cssModules.classnameTemplate.development,
|
|
85
|
-
},
|
|
86
|
-
preprocessorOptions: {
|
|
87
|
-
less: { math: bundleConstants.less.math },
|
|
88
|
-
},
|
|
89
|
-
},
|
|
91
|
+
css: createCssConfig(isProduction),
|
|
90
92
|
build: {
|
|
91
93
|
/*
|
|
92
94
|
* MFEs render inside shadow DOM — lazy CSS chunks would inject into document.head,
|
|
93
95
|
* leaking styles into the host. Bundling all CSS into one file avoids this.
|
|
94
96
|
*/
|
|
95
97
|
cssCodeSplit: !isWebComponent,
|
|
96
|
-
/*
|
|
97
|
-
* MFE bundle dirs (full/light/headless) are safe to clean — no shared deps inside.
|
|
98
|
-
* Host outDir (dist/bundle/) contains shared/, so cleaning would delete shared deps.
|
|
99
|
-
*/
|
|
100
|
-
emptyOutDir: isWebComponent,
|
|
101
|
-
outDir: getOutputPath(context),
|
|
102
98
|
sourcemap: true,
|
|
99
|
+
rolldownOptions: {
|
|
100
|
+
output: { assetFileNames, codeSplitting: getCodeSplitting(context) },
|
|
101
|
+
plugins: [chainSourceMapsPlugin()],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
define: {
|
|
105
|
+
...importMetaRemap(
|
|
106
|
+
defineExposedDependencies(context),
|
|
107
|
+
defineExposedInstanceDependencies(context),
|
|
108
|
+
defineWebComponentName(context)
|
|
109
|
+
),
|
|
110
|
+
...(getProcessEnv(context) ?? {}),
|
|
103
111
|
},
|
|
104
|
-
define: importMetaRemap(
|
|
105
|
-
defineExposedDependencies(context),
|
|
106
|
-
defineExposedInstanceDependencies(context),
|
|
107
|
-
defineWebComponentName(context)
|
|
108
|
-
),
|
|
109
112
|
optimizeDeps: {
|
|
110
113
|
include: ['@servicetitan/startup-utils'],
|
|
111
114
|
/*
|
|
@@ -133,5 +136,10 @@ export function createBaseConfig(context: ViteBuildContext): InlineConfig {
|
|
|
133
136
|
config.build = { ...config.build, cssMinify: !!context.bundlerConfig.minify.css };
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
// Minified output can't be mapped back to source, so skip it when instrumenting.
|
|
140
|
+
if (context.options.codeCoverage) {
|
|
141
|
+
config.build = { ...config.build, minify: false };
|
|
142
|
+
}
|
|
143
|
+
|
|
136
144
|
return config;
|
|
137
145
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CodeSplittingGroup, CodeSplittingOptions } from 'rolldown';
|
|
2
|
+
import { CHUNK_PATTERNS } from '../../core';
|
|
3
|
+
import { ViteBuildContext } from '../types';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Rolldown matches higher-priority groups first, so the specific @servicetitan and
|
|
7
|
+
* Kendo groups claim their modules before the general vendor groups can. Code outside
|
|
8
|
+
* node_modules matches no group, so it stays in the entry chunk.
|
|
9
|
+
*/
|
|
10
|
+
const VENDOR_GROUPS: CodeSplittingGroup[] = [
|
|
11
|
+
{ name: 'servicetitan', test: CHUNK_PATTERNS.servicetitan, priority: 30 },
|
|
12
|
+
{ name: 'kendo', test: CHUNK_PATTERNS.kendo, priority: 20 },
|
|
13
|
+
{ name: 'vendor-core', test: CHUNK_PATTERNS['vendor-core'], priority: 15 },
|
|
14
|
+
{ name: 'vendor', test: CHUNK_PATTERNS.vendor, priority: 10 },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export function getCodeSplitting(context: ViteBuildContext): CodeSplittingOptions | undefined {
|
|
18
|
+
if (!context.build.isProduction) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return { groups: VENDOR_GROUPS, minSize: 20 * 1024 };
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSOptions } from 'vite';
|
|
2
|
+
import { bundleConstants } from '../../core';
|
|
3
|
+
|
|
4
|
+
export function createCssConfig(isProduction: boolean): CSSOptions {
|
|
5
|
+
return {
|
|
6
|
+
modules: {
|
|
7
|
+
localsConvention: bundleConstants.cssModules.localsConvention,
|
|
8
|
+
generateScopedName: isProduction
|
|
9
|
+
? bundleConstants.cssModules.classnameTemplate.production
|
|
10
|
+
: bundleConstants.cssModules.classnameTemplate.development,
|
|
11
|
+
},
|
|
12
|
+
preprocessorOptions: {
|
|
13
|
+
less: { math: bundleConstants.less.math },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createLogger, type Logger } from 'vite';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Expected warnings when a host's HTML references the shared-bundle assets created by
|
|
5
|
+
* separate "exposed dependencies" build. Matched on ./shared/ so a genuinely missing
|
|
6
|
+
* app asset still warns.
|
|
7
|
+
*/
|
|
8
|
+
const SHARED_ASSET_WARNINGS = [
|
|
9
|
+
/<script src="\.\/shared\/[^"]+"> in "[^"]*" can't be bundled without type="module"/,
|
|
10
|
+
/\.\/shared\/\S+ doesn't exist at build time/,
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Wraps Vite's logger to drop the shared-asset HTML warnings. Everything else passes through.
|
|
15
|
+
*/
|
|
16
|
+
export function createFilteringLogger(): Logger {
|
|
17
|
+
const logger = createLogger();
|
|
18
|
+
const { warn, warnOnce } = logger;
|
|
19
|
+
const isSuppressed = (message: string) =>
|
|
20
|
+
SHARED_ASSET_WARNINGS.some(pattern => pattern.test(message));
|
|
21
|
+
|
|
22
|
+
logger.warn = (message, options) => {
|
|
23
|
+
if (!isSuppressed(message)) {
|
|
24
|
+
warn.call(logger, message, options);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
logger.warnOnce = (message, options) => {
|
|
28
|
+
if (!isSuppressed(message)) {
|
|
29
|
+
warnOnce.call(logger, message, options);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return logger;
|
|
34
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { BuildContext } from '../../core';
|
|
1
2
|
import { VitePackageJsonOverride } from '../../utils';
|
|
2
3
|
import { ViteBuildContext } from '../types';
|
|
3
|
-
import {
|
|
4
|
+
import { ViteConfigFileOverride } from './define-config';
|
|
4
5
|
|
|
5
6
|
function createBundlerConfig(
|
|
6
7
|
packageJsonConfig: VitePackageJsonOverride,
|
|
@@ -38,8 +39,5 @@ export function createViteBuildContext(
|
|
|
38
39
|
pkgJsonConfig: VitePackageJsonOverride,
|
|
39
40
|
fileConfig: ViteConfigFileOverride
|
|
40
41
|
): ViteBuildContext {
|
|
41
|
-
return {
|
|
42
|
-
...context,
|
|
43
|
-
bundlerConfig: createBundlerConfig(pkgJsonConfig, fileConfig),
|
|
44
|
-
};
|
|
42
|
+
return { ...context, bundlerConfig: createBundlerConfig(pkgJsonConfig, fileConfig) };
|
|
45
43
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BuildContextOptions,
|
|
3
|
+
createBuildContext,
|
|
4
|
+
resolveOutputPath,
|
|
5
|
+
resolveOutputRoot,
|
|
6
|
+
stringifyConfig,
|
|
7
|
+
} from '../../core';
|
|
2
8
|
import { getViteConfiguration, log } from '../../utils';
|
|
3
9
|
import { createBaseConfig } from './base-config';
|
|
4
10
|
import { createViteBuildContext } from './create-vite-build-context';
|
|
11
|
+
import { getWarmupClientFiles } from './get-warmup-client-files';
|
|
5
12
|
import { loadConfigFile } from './load-config-file';
|
|
6
13
|
import { mergeViteConfigs } from './merge-vite-configs';
|
|
7
14
|
|
|
@@ -12,18 +19,16 @@ export async function createViteConfig(options: BuildContextOptions) {
|
|
|
12
19
|
const viteContext = createViteBuildContext(context, packageJsonConfig, fileConfig);
|
|
13
20
|
const baseConfig = createBaseConfig(viteContext);
|
|
14
21
|
const finalConfig = mergeViteConfigs(baseConfig, packageJsonConfig, fileConfig);
|
|
22
|
+
const outputRoot = resolveOutputRoot(context, finalConfig.build?.outDir);
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
finalConfig.server =
|
|
24
|
-
...finalConfig.server,
|
|
25
|
-
port: Number(process.env.PORT) || finalConfig.server?.port,
|
|
26
|
-
};
|
|
24
|
+
// Resolve the output path: web components force the default, hosts honor a configured path.
|
|
25
|
+
finalConfig.build = {
|
|
26
|
+
...finalConfig.build,
|
|
27
|
+
outDir: resolveOutputPath(context, finalConfig.build?.outDir),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if (!context.build.isProduction) {
|
|
31
|
+
finalConfig.server = createDevServerConfig(viteContext, finalConfig, outputRoot);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
/* istanbul ignore next: debug only */
|
|
@@ -31,3 +36,31 @@ export async function createViteConfig(options: BuildContextOptions) {
|
|
|
31
36
|
|
|
32
37
|
return finalConfig;
|
|
33
38
|
}
|
|
39
|
+
|
|
40
|
+
function createDevServerConfig(
|
|
41
|
+
viteContext: ReturnType<typeof createViteBuildContext>,
|
|
42
|
+
finalConfig: ReturnType<typeof mergeViteConfigs>,
|
|
43
|
+
outputRoot: string
|
|
44
|
+
) {
|
|
45
|
+
const { light, headless, emitExposedDependencies } = viteContext.build;
|
|
46
|
+
|
|
47
|
+
const server = {
|
|
48
|
+
...finalConfig.server,
|
|
49
|
+
warmup: {
|
|
50
|
+
clientFiles: getWarmupClientFiles(viteContext, outputRoot),
|
|
51
|
+
...finalConfig.server?.warmup,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
* Background dev servers (light/headless) must use a random port to avoid
|
|
57
|
+
* conflicting with the full bundle's user-configured port.
|
|
58
|
+
*/
|
|
59
|
+
if (light || headless) {
|
|
60
|
+
server.port = 0;
|
|
61
|
+
} else if (!emitExposedDependencies) {
|
|
62
|
+
server.port = Number(process.env.PORT) || finalConfig.server?.port;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return server;
|
|
66
|
+
}
|