@servicetitan/startup 36.4.0 → 37.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/analyze.js +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +4 -5
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -1
- package/dist/cli/commands/bundle-vite.js +18 -1
- package/dist/cli/commands/bundle-vite.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +6 -0
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +10 -1
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/command-registry.d.ts +12 -28
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +0 -3
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +6 -0
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +10 -1
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +2 -0
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts +13 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.js +72 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.js.map +1 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +3 -4
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.d.ts.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +7 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/get-bundle-command.d.ts +3 -0
- package/dist/cli/utils/get-bundle-command.d.ts.map +1 -0
- package/dist/cli/utils/get-bundle-command.js +16 -0
- package/dist/cli/utils/get-bundle-command.js.map +1 -0
- package/dist/cli/utils/get-exit-code.d.ts +12 -0
- package/dist/cli/utils/get-exit-code.d.ts.map +1 -0
- package/dist/cli/utils/get-exit-code.js +26 -0
- package/dist/cli/utils/get-exit-code.js.map +1 -0
- package/dist/cli/utils/index.d.ts +3 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +3 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/resolve-bundler.d.ts +8 -0
- package/dist/cli/utils/resolve-bundler.d.ts.map +1 -0
- package/dist/cli/utils/resolve-bundler.js +24 -0
- package/dist/cli/utils/resolve-bundler.js.map +1 -0
- package/dist/core/bundle-report.d.ts +4 -0
- package/dist/core/bundle-report.d.ts.map +1 -0
- package/dist/core/bundle-report.js +43 -0
- package/dist/core/bundle-report.js.map +1 -0
- package/dist/core/check-resource/check-resource.d.ts +5 -3
- package/dist/core/check-resource/check-resource.d.ts.map +1 -1
- package/dist/core/check-resource/check-resource.js +20 -13
- package/dist/core/check-resource/check-resource.js.map +1 -1
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts +11 -1
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts.map +1 -1
- package/dist/core/check-resource/get-peer-dependency-meta.js +58 -2
- package/dist/core/check-resource/get-peer-dependency-meta.js.map +1 -1
- package/dist/core/check-resource/index.d.ts +1 -1
- package/dist/core/check-resource/index.d.ts.map +1 -1
- package/dist/core/check-resource/index.js.map +1 -1
- package/dist/core/check-resource/is-resolvable.d.ts +7 -0
- package/dist/core/check-resource/is-resolvable.d.ts.map +1 -0
- package/dist/core/check-resource/is-resolvable.js +31 -0
- package/dist/core/check-resource/is-resolvable.js.map +1 -0
- package/dist/core/check-resource/types.d.ts +1 -0
- package/dist/core/check-resource/types.d.ts.map +1 -1
- package/dist/core/chunk-patterns.d.ts +7 -0
- package/dist/core/chunk-patterns.d.ts.map +1 -0
- package/dist/core/chunk-patterns.js +37 -0
- package/dist/core/chunk-patterns.js.map +1 -0
- package/dist/core/create-build-context.d.ts +0 -1
- package/dist/core/create-build-context.d.ts.map +1 -1
- package/dist/core/create-build-context.js +2 -2
- package/dist/core/create-build-context.js.map +1 -1
- package/dist/core/create-extension-regexp.d.ts +5 -0
- package/dist/core/create-extension-regexp.d.ts.map +1 -0
- package/dist/core/create-extension-regexp.js +45 -0
- package/dist/core/create-extension-regexp.js.map +1 -0
- package/dist/core/get-process-env.d.ts +3 -0
- package/dist/core/get-process-env.d.ts.map +1 -0
- package/dist/core/get-process-env.js +25 -0
- package/dist/core/get-process-env.js.map +1 -0
- package/dist/core/index.d.ts +8 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/moment-locales.d.ts +2 -0
- package/dist/core/moment-locales.d.ts.map +1 -0
- package/dist/core/moment-locales.js +21 -0
- package/dist/core/moment-locales.js.map +1 -0
- package/dist/core/resolve-output-path.d.ts +3 -0
- package/dist/core/resolve-output-path.d.ts.map +1 -0
- package/dist/core/resolve-output-path.js +25 -0
- package/dist/core/resolve-output-path.js.map +1 -0
- package/dist/core/resolve-output-root.d.ts +3 -0
- package/dist/core/resolve-output-root.d.ts.map +1 -0
- package/dist/core/resolve-output-root.js +23 -0
- package/dist/core/resolve-output-root.js.map +1 -0
- package/dist/core/sort-shared-css.d.ts +2 -0
- package/dist/core/sort-shared-css.d.ts.map +1 -0
- package/dist/core/sort-shared-css.js +20 -0
- package/dist/core/sort-shared-css.js.map +1 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/cypress/config/index.d.ts +1 -0
- package/dist/cypress/config/index.d.ts.map +1 -1
- package/dist/cypress/config/index.js +1 -0
- package/dist/cypress/config/index.js.map +1 -1
- package/dist/cypress/config/vite-config.d.ts +3 -0
- package/dist/cypress/config/vite-config.d.ts.map +1 -0
- package/dist/cypress/config/vite-config.js +58 -0
- package/dist/cypress/config/vite-config.js.map +1 -0
- package/dist/jest/resolver.d.ts.map +1 -1
- package/dist/jest/resolver.js +20 -1
- package/dist/jest/resolver.js.map +1 -1
- package/dist/storybook-config/index.d.ts +1 -0
- package/dist/storybook-config/index.d.ts.map +1 -1
- package/dist/storybook-config/index.js +1 -0
- package/dist/storybook-config/index.js.map +1 -1
- package/dist/storybook-config/vite-final.d.ts +7 -0
- package/dist/storybook-config/vite-final.d.ts.map +1 -0
- package/dist/storybook-config/vite-final.js +86 -0
- package/dist/storybook-config/vite-final.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +15 -10
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +32 -2
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-name.d.ts +2 -1
- package/dist/utils/get-package-name.d.ts.map +1 -1
- package/dist/utils/get-package-name.js +4 -2
- package/dist/utils/get-package-name.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +6 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/validate-shared-dependencies.d.ts.map +1 -1
- package/dist/utils/validate-shared-dependencies.js +4 -0
- package/dist/utils/validate-shared-dependencies.js.map +1 -1
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
- package/dist/vite/build-shared-dependencies.js +1 -2
- package/dist/vite/build-shared-dependencies.js.map +1 -1
- package/dist/vite/config/asset-file-names.d.ts +4 -0
- package/dist/vite/config/asset-file-names.d.ts.map +1 -0
- package/dist/vite/config/asset-file-names.js +29 -0
- package/dist/vite/config/asset-file-names.js.map +1 -0
- package/dist/vite/config/base-config.d.ts.map +1 -1
- package/dist/vite/config/base-config.js +67 -40
- package/dist/vite/config/base-config.js.map +1 -1
- package/dist/vite/config/code-splitting.d.ts +4 -0
- package/dist/vite/config/code-splitting.d.ts.map +1 -0
- package/dist/vite/config/code-splitting.js +48 -0
- package/dist/vite/config/code-splitting.js.map +1 -0
- package/dist/vite/config/create-css-config.d.ts +3 -0
- package/dist/vite/config/create-css-config.d.ts.map +1 -0
- package/dist/vite/config/create-css-config.js +26 -0
- package/dist/vite/config/create-css-config.js.map +1 -0
- package/dist/vite/config/create-filtering-logger.d.ts +3 -0
- package/dist/vite/config/create-filtering-logger.d.ts.map +1 -0
- package/dist/vite/config/create-filtering-logger.js +37 -0
- package/dist/vite/config/create-filtering-logger.js.map +1 -0
- package/dist/vite/config/create-vite-build-context.d.ts +2 -1
- package/dist/vite/config/create-vite-build-context.d.ts.map +1 -1
- package/dist/vite/config/create-vite-build-context.js.map +1 -1
- package/dist/vite/config/create-vite-config.d.ts.map +1 -1
- package/dist/vite/config/create-vite-config.js +30 -13
- package/dist/vite/config/create-vite-config.js.map +1 -1
- package/dist/vite/config/get-warmup-client-files.d.ts +3 -0
- package/dist/vite/config/get-warmup-client-files.d.ts.map +1 -0
- package/dist/vite/config/get-warmup-client-files.js +26 -0
- package/dist/vite/config/get-warmup-client-files.js.map +1 -0
- package/dist/vite/index.html +1 -0
- package/dist/vite/plugins/bundle-stat-plugin.d.ts +4 -0
- package/dist/vite/plugins/bundle-stat-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/bundle-stat-plugin.js +32 -0
- package/dist/vite/plugins/bundle-stat-plugin.js.map +1 -0
- package/dist/vite/plugins/chain-source-maps-plugin.d.ts +3 -0
- package/dist/vite/plugins/chain-source-maps-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/chain-source-maps-plugin.js +37 -0
- package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -0
- package/dist/vite/plugins/clean-plugin.d.ts +4 -0
- package/dist/vite/plugins/clean-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/clean-plugin.js +63 -0
- package/dist/vite/plugins/clean-plugin.js.map +1 -0
- package/dist/vite/plugins/design-system-guard-plugin.d.ts +4 -0
- package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/design-system-guard-plugin.js +35 -0
- package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +21 -3
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/ignore-modules-plugin.js +22 -8
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
- package/dist/vite/plugins/index.d.ts +7 -0
- package/dist/vite/plugins/index.d.ts.map +1 -1
- package/dist/vite/plugins/index.js +7 -0
- package/dist/vite/plugins/index.js.map +1 -1
- package/dist/vite/plugins/istanbul-plugin.d.ts +4 -0
- package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/istanbul-plugin.js +27 -0
- package/dist/vite/plugins/istanbul-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/magic-comments-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/index.js +20 -0
- package/dist/vite/plugins/magic-comments-plugin/index.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts +4 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +63 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts +6 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js +40 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js.map +1 -0
- package/dist/vite/plugins/metadata-plugin.js +2 -2
- package/dist/vite/plugins/metadata-plugin.js.map +1 -1
- package/dist/vite/plugins/moment-locales-plugin.d.ts +5 -0
- package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/moment-locales-plugin.js +50 -0
- package/dist/vite/plugins/moment-locales-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts +14 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js +100 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts +3 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js +56 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts +2 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.js +19 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.js +20 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/{shared-dependencies-plugin.js → shared-dependencies-plugin/shared-dependencies-plugin.js} +29 -107
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -0
- package/dist/vite/plugins/utils/import-esm.d.ts +2 -0
- package/dist/vite/plugins/utils/import-esm.d.ts.map +1 -0
- package/dist/vite/plugins/utils/import-esm.js +22 -0
- package/dist/vite/plugins/utils/import-esm.js.map +1 -0
- package/dist/vite/plugins/utils/index.d.ts +3 -0
- package/dist/vite/plugins/utils/index.d.ts.map +1 -0
- package/dist/vite/plugins/utils/index.js +21 -0
- package/dist/vite/plugins/utils/index.js.map +1 -0
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +53 -24
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +0 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +11 -3
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +2 -21
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts +5 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.js +20 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.js.map +1 -0
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +1 -4
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts +2 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js +11 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +26 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +41 -10
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/index.d.ts +1 -0
- package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/index.js +1 -0
- package/dist/webpack/configs/plugins/index.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +2 -5
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js +1 -0
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js +2 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js +2 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +8 -3
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/create-webpack-configs.d.ts.map +1 -1
- package/dist/webpack/create-webpack-configs.js +4 -12
- package/dist/webpack/create-webpack-configs.js.map +1 -1
- package/dist/webpack/types.d.ts +1 -1
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.js +1 -2
- package/dist/webpack/utils/create-webpack-build-context.js.map +1 -1
- package/package.json +22 -18
- package/src/cli/commands/__tests__/build.test.ts +33 -5
- package/src/cli/commands/__tests__/bundle-vite.test.ts +50 -1
- package/src/cli/commands/__tests__/start.test.ts +17 -4
- package/src/cli/commands/build.ts +5 -6
- package/src/cli/commands/bundle-vite.ts +13 -0
- package/src/cli/commands/registry/build.ts +6 -1
- package/src/cli/commands/registry/command-registry.ts +0 -1
- package/src/cli/commands/registry/start.ts +6 -1
- package/src/cli/commands/review/rules/__tests__/require-compatible-typescript.test.ts +127 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/require-compatible-typescript.ts +64 -0
- package/src/cli/commands/start.ts +4 -4
- package/src/cli/commands/test/runners/__tests__/vitest.test.ts +8 -1
- package/src/cli/commands/test/runners/vitest.ts +5 -3
- package/src/cli/index.ts +2 -2
- package/src/cli/utils/__tests__/get-bundle-command.test.ts +23 -0
- package/src/cli/utils/__tests__/get-exit-code.test.ts +41 -0
- package/src/cli/utils/__tests__/resolve-bundler.test.ts +64 -0
- package/src/cli/utils/get-bundle-command.ts +5 -0
- package/src/cli/utils/get-exit-code.ts +17 -0
- package/src/cli/utils/index.ts +3 -0
- package/src/cli/utils/resolve-bundler.ts +23 -0
- package/src/core/__tests__/bundle-report.test.ts +60 -0
- package/src/core/__tests__/create-extension-regexp.test.ts +32 -0
- package/src/core/__tests__/resolve-output-path.test.ts +45 -0
- package/src/core/__tests__/resolve-output-root.test.ts +37 -0
- package/src/core/__tests__/sort-shared-css.test.ts +39 -0
- package/src/core/bundle-report.ts +33 -0
- package/src/core/check-resource/__tests__/check-resource.test.ts +21 -7
- package/src/core/check-resource/__tests__/get-peer-dependency-meta.test.ts +70 -13
- package/src/core/check-resource/__tests__/is-resolvable.test.ts +20 -0
- package/src/core/check-resource/check-resource.ts +17 -16
- package/src/core/check-resource/get-peer-dependency-meta.ts +67 -4
- package/src/core/check-resource/index.ts +1 -1
- package/src/core/check-resource/is-resolvable.ts +19 -0
- package/src/core/check-resource/types.ts +2 -0
- package/src/core/chunk-patterns.ts +30 -0
- package/src/core/create-build-context.ts +2 -2
- package/src/core/create-extension-regexp.ts +7 -0
- package/src/core/get-process-env.ts +17 -0
- package/src/core/index.ts +8 -1
- package/src/core/moment-locales.ts +6 -0
- package/src/core/resolve-output-path.ts +10 -0
- package/src/core/resolve-output-root.ts +8 -0
- package/src/core/sort-shared-css.ts +7 -0
- package/src/core/types.ts +1 -1
- package/src/cypress/config/__tests__/vite-config.test.ts +72 -0
- package/src/cypress/config/index.ts +1 -0
- package/src/cypress/config/vite-config.ts +37 -0
- package/src/jest/__tests__/resolver.test.ts +42 -1
- package/src/jest/resolver.ts +17 -1
- package/src/storybook-config/__tests__/vite-final.test.ts +122 -0
- package/src/storybook-config/index.ts +1 -0
- package/src/storybook-config/vite-final.ts +65 -0
- package/src/utils/__tests__/get-configuration.test.ts +82 -5
- package/src/utils/__tests__/get-package-name.test.ts +57 -0
- package/src/utils/__tests__/validate-shared-dependencies.test.ts +50 -35
- package/src/utils/get-configuration.ts +50 -15
- package/src/utils/get-package-name.ts +8 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/types.ts +1 -0
- package/src/utils/validate-shared-dependencies.ts +15 -1
- package/src/vite/__tests__/build-shared-dependencies.test.ts +13 -26
- package/src/vite/__tests__/validate-shared-dependencies.test.ts +30 -19
- package/src/vite/build-shared-dependencies.ts +3 -7
- package/src/vite/config/__tests__/asset-file-names.test.ts +40 -0
- package/src/vite/config/__tests__/base-config.test.ts +99 -31
- package/src/vite/config/__tests__/code-splitting.test.ts +34 -0
- package/src/vite/config/__tests__/create-css-config.test.ts +58 -0
- package/src/vite/config/__tests__/create-filtering-logger.test.ts +51 -0
- package/src/vite/config/__tests__/create-vite-build-context.test.ts +5 -2
- package/src/vite/config/__tests__/create-vite-config.test.ts +91 -13
- package/src/vite/config/__tests__/get-warmup-client-files.test.ts +20 -0
- package/src/vite/config/asset-file-names.ts +20 -0
- package/src/vite/config/base-config.ts +45 -37
- package/src/vite/config/code-splitting.ts +23 -0
- package/src/vite/config/create-css-config.ts +16 -0
- package/src/vite/config/create-filtering-logger.ts +34 -0
- package/src/vite/config/create-vite-build-context.ts +3 -5
- package/src/vite/config/create-vite-config.ts +45 -12
- package/src/vite/config/get-warmup-client-files.ts +13 -0
- package/src/vite/index.html +1 -0
- package/src/vite/plugins/__tests__/bundle-stat-plugin.test.ts +70 -0
- package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +58 -0
- package/src/vite/plugins/__tests__/clean-plugin.test.ts +121 -0
- package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +83 -0
- package/src/vite/plugins/__tests__/html-template.test.ts +6 -0
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +29 -7
- package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +62 -0
- package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +104 -0
- package/src/vite/plugins/bundle-stat-plugin.ts +24 -0
- package/src/vite/plugins/chain-source-maps-plugin.ts +26 -0
- package/src/vite/plugins/clean-plugin.ts +46 -0
- package/src/vite/plugins/design-system-guard-plugin.ts +34 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +36 -7
- package/src/vite/plugins/index.ts +7 -0
- package/src/vite/plugins/istanbul-plugin.ts +19 -0
- package/src/vite/plugins/magic-comments-plugin/__tests__/magic-comments-plugin.test.ts +105 -0
- package/src/vite/plugins/magic-comments-plugin/__tests__/parse-magic-comments.test.ts +40 -0
- package/src/vite/plugins/magic-comments-plugin/index.ts +1 -0
- package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +63 -0
- package/src/vite/plugins/magic-comments-plugin/parse-magic-comments.ts +39 -0
- package/src/vite/plugins/metadata-plugin.ts +1 -1
- package/src/vite/plugins/moment-locales-plugin.ts +41 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/assemble-iife.test.ts +29 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/assert-no-dynamic-css.test.ts +113 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/flatten.test.ts +23 -0
- package/src/vite/plugins/{__tests__ → shared-dependencies-plugin/__tests__}/shared-dependencies-plugin.test.ts +38 -4
- package/src/vite/plugins/shared-dependencies-plugin/assemble-iife.ts +114 -0
- package/src/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.ts +58 -0
- package/src/vite/plugins/shared-dependencies-plugin/flatten.ts +8 -0
- package/src/vite/plugins/shared-dependencies-plugin/index.ts +1 -0
- package/src/vite/plugins/{shared-dependencies-plugin.ts → shared-dependencies-plugin/shared-dependencies-plugin.ts} +24 -115
- package/src/vite/plugins/utils/import-esm.ts +15 -0
- package/src/vite/plugins/utils/index.ts +2 -0
- package/src/vite/rolldown-oxc.d.ts +20 -0
- package/src/webpack/__tests__/bundle-webpack.test.ts +8 -8
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +54 -5
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +81 -12
- package/src/webpack/__tests__/create-webpack-config.test.ts +92 -9
- package/src/webpack/configs/optimization-config.ts +47 -25
- package/src/webpack/configs/output-config.ts +1 -2
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +16 -4
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +3 -25
- package/src/webpack/configs/plugins/define-process-env-plugin.ts +10 -0
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +1 -5
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +76 -24
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.ts +7 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +59 -9
- package/src/webpack/configs/plugins/index.ts +1 -0
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -2
- package/src/webpack/configs/plugins-config.ts +2 -0
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/create-webpack-config.ts +11 -4
- package/src/webpack/create-webpack-configs.ts +2 -8
- package/src/webpack/types.ts +1 -4
- package/src/webpack/utils/create-webpack-build-context.ts +1 -6
- package/tsconfig/base.json +1 -1
- package/tsconfig/types.d.ts +10 -0
- package/dist/core/get-output-path.d.ts +0 -3
- package/dist/core/get-output-path.d.ts.map +0 -1
- package/dist/core/get-output-path.js +0 -29
- package/dist/core/get-output-path.js.map +0 -1
- package/dist/vite/plugins/shared-dependencies-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/shared-dependencies-plugin.js.map +0 -1
- package/src/core/__tests__/get-output-path.test.ts +0 -64
- package/src/core/get-output-path.ts +0 -15
- /package/dist/vite/plugins/{shared-dependencies-plugin.d.ts → shared-dependencies-plugin/shared-dependencies-plugin.d.ts} +0 -0
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { checkResource } from '../../core/check-resource';
|
|
1
2
|
import resolver from '../resolver';
|
|
2
3
|
|
|
4
|
+
jest.mock('../../core/check-resource');
|
|
5
|
+
|
|
3
6
|
describe('[startup] Jest resolver', () => {
|
|
4
|
-
const
|
|
7
|
+
const checker = jest.fn();
|
|
8
|
+
const options: Partial<Parameters<typeof resolver>[1]> = {
|
|
9
|
+
defaultResolver: jest.fn(),
|
|
10
|
+
basedir: '/node_modules/some-package/dist',
|
|
11
|
+
};
|
|
5
12
|
let path: string;
|
|
6
13
|
let queryParam: string | undefined;
|
|
7
14
|
|
|
@@ -9,6 +16,8 @@ describe('[startup] Jest resolver', () => {
|
|
|
9
16
|
path = 'foo.svg';
|
|
10
17
|
queryParam = undefined;
|
|
11
18
|
jest.clearAllMocks();
|
|
19
|
+
jest.mocked(checkResource).mockReturnValue(checker as any);
|
|
20
|
+
checker.mockReturnValue(false);
|
|
12
21
|
});
|
|
13
22
|
|
|
14
23
|
const subject = () => resolver(`${path}${queryParam ?? ''}`, options as any);
|
|
@@ -38,4 +47,36 @@ describe('[startup] Jest resolver', () => {
|
|
|
38
47
|
|
|
39
48
|
itCallsDefaultResolver();
|
|
40
49
|
});
|
|
50
|
+
|
|
51
|
+
describe('when defaultResolver throws', () => {
|
|
52
|
+
const error = new Error("Cannot find module 'foo'");
|
|
53
|
+
|
|
54
|
+
beforeEach(() =>
|
|
55
|
+
jest.mocked(options.defaultResolver!).mockImplementation(() => {
|
|
56
|
+
throw error;
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
test('rethrows the error', () => {
|
|
61
|
+
expect(subject).toThrow(error);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('when checkResource returns "empty"', () => {
|
|
65
|
+
beforeEach(() => checker.mockReturnValue('empty'));
|
|
66
|
+
|
|
67
|
+
test('returns the empty module path', () => {
|
|
68
|
+
expect(subject()).toBe(
|
|
69
|
+
require.resolve('../../webpack/configs/plugins/ignore-plugin/empty-module')
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('when checkResource returns "throw"', () => {
|
|
75
|
+
beforeEach(() => checker.mockReturnValue('throw'));
|
|
76
|
+
|
|
77
|
+
test('rethrows the error', () => {
|
|
78
|
+
expect(subject).toThrow(error);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
41
82
|
});
|
package/src/jest/resolver.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import type { SyncResolver } from 'jest-resolve';
|
|
2
|
+
import { checkResource } from '../core/check-resource';
|
|
2
3
|
import { SVG_PATH_REGEX } from '../utils/transform-svg';
|
|
3
4
|
|
|
5
|
+
const EMPTY_MODULE_PATH = require.resolve('../webpack/configs/plugins/ignore-plugin/empty-module');
|
|
6
|
+
|
|
4
7
|
const resolver: SyncResolver = (path, options) => {
|
|
5
8
|
const { type, path: pathSansType } = SVG_PATH_REGEX.exec(path)?.groups ?? {};
|
|
6
|
-
|
|
9
|
+
const resolvedPath = type ? pathSansType : path;
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
return options.defaultResolver(resolvedPath, options);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
const mode = checkResource({ package: { dependencies: {} } })({
|
|
15
|
+
resource: resolvedPath,
|
|
16
|
+
importer: options.basedir ?? '',
|
|
17
|
+
});
|
|
18
|
+
if (mode === 'empty') {
|
|
19
|
+
return EMPTY_MODULE_PATH;
|
|
20
|
+
}
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
7
23
|
};
|
|
8
24
|
|
|
9
25
|
export = resolver;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { InlineConfig } from 'vite';
|
|
2
|
+
import { createCssConfig } from '../../vite/config/create-css-config';
|
|
3
|
+
import { svgrPlugin } from '../../vite/plugins/svgr-plugin';
|
|
4
|
+
import { viteFinal } from '../vite-final';
|
|
5
|
+
|
|
6
|
+
jest.mock('../../vite/plugins/svgr-plugin', () => ({ svgrPlugin: jest.fn() }));
|
|
7
|
+
|
|
8
|
+
describe(`[startup/storybook-config] ${viteFinal.name}`, () => {
|
|
9
|
+
const mockSvgrPlugin = { name: 'vite-plugin-svgr' } as any;
|
|
10
|
+
let config: InlineConfig;
|
|
11
|
+
let configType: 'DEVELOPMENT' | 'PRODUCTION' | undefined;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.clearAllMocks();
|
|
15
|
+
jest.mocked(svgrPlugin).mockReturnValue(mockSvgrPlugin);
|
|
16
|
+
config = {};
|
|
17
|
+
configType = undefined;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const subject = () => viteFinal(config, { configType });
|
|
21
|
+
|
|
22
|
+
test('adds svgr plugin', () => {
|
|
23
|
+
expect(subject()).toEqual(expect.objectContaining({ plugins: [mockSvgrPlugin] }));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('dedupes react', () => {
|
|
27
|
+
expect(subject()).toEqual(
|
|
28
|
+
expect.objectContaining({ resolve: { dedupe: ['react', 'react-dom'] } })
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('pre-bundles react', () => {
|
|
33
|
+
expect(subject()).toEqual(
|
|
34
|
+
expect.objectContaining({
|
|
35
|
+
optimizeDeps: { include: ['react', 'react-dom', 'react/jsx-runtime'] },
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe.each([
|
|
41
|
+
['DEVELOPMENT', false],
|
|
42
|
+
['PRODUCTION', true],
|
|
43
|
+
] as const)('when configType is %s', (type, isProduction) => {
|
|
44
|
+
const cssConfig = createCssConfig(isProduction);
|
|
45
|
+
|
|
46
|
+
beforeEach(() => (configType = type));
|
|
47
|
+
|
|
48
|
+
test('adds the css modules', () => {
|
|
49
|
+
const { modules } = cssConfig;
|
|
50
|
+
|
|
51
|
+
expect(subject()).toEqual(
|
|
52
|
+
expect.objectContaining({ css: expect.objectContaining({ modules }) })
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('adds the preprocessor options', () => {
|
|
57
|
+
const { preprocessorOptions } = cssConfig;
|
|
58
|
+
|
|
59
|
+
expect(subject()).toEqual(
|
|
60
|
+
expect.objectContaining({ css: expect.objectContaining({ preprocessorOptions }) })
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('when config already contains css preprocessor options', () => {
|
|
66
|
+
const scssOptions = { quietDeps: true };
|
|
67
|
+
|
|
68
|
+
beforeEach(() => (config = { css: { preprocessorOptions: { scss: scssOptions } } }));
|
|
69
|
+
|
|
70
|
+
test('preserves existing preprocessor options', () => {
|
|
71
|
+
const { preprocessorOptions } = createCssConfig(false);
|
|
72
|
+
|
|
73
|
+
expect(subject()).toEqual(
|
|
74
|
+
expect.objectContaining({
|
|
75
|
+
css: expect.objectContaining({
|
|
76
|
+
preprocessorOptions: {
|
|
77
|
+
...config.css?.preprocessorOptions,
|
|
78
|
+
...preprocessorOptions,
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('when config already contains plugins', () => {
|
|
87
|
+
const existingPlugin = { name: 'existing' };
|
|
88
|
+
|
|
89
|
+
beforeEach(() => (config = { plugins: [existingPlugin] }));
|
|
90
|
+
|
|
91
|
+
test('preserves existing plugins', () => {
|
|
92
|
+
expect(subject()).toEqual(
|
|
93
|
+
expect.objectContaining({ plugins: [existingPlugin, mockSvgrPlugin] })
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('when config already contains resolve.dedupe', () => {
|
|
99
|
+
beforeEach(() => (config = { resolve: { dedupe: ['lodash', 'react'] } }));
|
|
100
|
+
|
|
101
|
+
test('merges react without duplicating existing entries', () => {
|
|
102
|
+
expect((subject().resolve as { dedupe: string[] }).dedupe).toEqual([
|
|
103
|
+
'lodash',
|
|
104
|
+
'react',
|
|
105
|
+
'react-dom',
|
|
106
|
+
]);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('when config already contains optimizeDeps.include', () => {
|
|
111
|
+
beforeEach(() => (config = { optimizeDeps: { include: ['lodash', 'react'] } }));
|
|
112
|
+
|
|
113
|
+
test('merges react without duplicating existing entries', () => {
|
|
114
|
+
expect((subject().optimizeDeps as { include: string[] }).include).toEqual([
|
|
115
|
+
'lodash',
|
|
116
|
+
'react',
|
|
117
|
+
'react-dom',
|
|
118
|
+
'react/jsx-runtime',
|
|
119
|
+
]);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
import type { InlineConfig } from 'vite';
|
|
3
|
+
import { log } from '../utils';
|
|
4
|
+
import { createCssConfig } from '../vite/config/create-css-config';
|
|
5
|
+
import { svgrPlugin } from '../vite/plugins/svgr-plugin';
|
|
6
|
+
import type { ViteBuildContext } from '../vite/types';
|
|
7
|
+
|
|
8
|
+
interface ViteFinalOptions {
|
|
9
|
+
/*
|
|
10
|
+
* Storybook signals the build type through `configType`, not Vite's
|
|
11
|
+
* `config.mode` (which Storybook's Vite builder leaves unset).
|
|
12
|
+
*/
|
|
13
|
+
configType?: 'DEVELOPMENT' | 'PRODUCTION';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Pre-bundle and dedupe React so the Storybook preview loads a single React
|
|
18
|
+
* instance. Storybook leaves this to Vite's automatic discovery, which can miss
|
|
19
|
+
* React in monorepos.
|
|
20
|
+
*/
|
|
21
|
+
const REACT_DEDUPE = ['react', 'react-dom'];
|
|
22
|
+
const REACT_OPTIMIZE = [...REACT_DEDUPE, 'react/jsx-runtime'];
|
|
23
|
+
|
|
24
|
+
export function viteFinal(
|
|
25
|
+
config: InlineConfig,
|
|
26
|
+
{ configType }: ViteFinalOptions = {}
|
|
27
|
+
): InlineConfig {
|
|
28
|
+
const isProduction = configType === 'PRODUCTION';
|
|
29
|
+
const css = createCssConfig(isProduction);
|
|
30
|
+
const plugins = [svgrPlugin(getContext())];
|
|
31
|
+
|
|
32
|
+
const merged: InlineConfig = {
|
|
33
|
+
...config,
|
|
34
|
+
css: {
|
|
35
|
+
...config.css,
|
|
36
|
+
modules: css.modules,
|
|
37
|
+
preprocessorOptions: {
|
|
38
|
+
...config.css?.preprocessorOptions,
|
|
39
|
+
...css.preprocessorOptions,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
resolve: {
|
|
43
|
+
...config.resolve,
|
|
44
|
+
dedupe: [...new Set([...(config.resolve?.dedupe ?? []), ...REACT_DEDUPE])],
|
|
45
|
+
},
|
|
46
|
+
optimizeDeps: {
|
|
47
|
+
...config.optimizeDeps,
|
|
48
|
+
include: [...new Set([...(config.optimizeDeps?.include ?? []), ...REACT_OPTIMIZE])],
|
|
49
|
+
},
|
|
50
|
+
plugins: [...(config.plugins ?? []), ...plugins],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/* istanbul ignore next: debug only */
|
|
54
|
+
log.debug('storybook-config:vite-final', () => inspect({ merged }, { depth: null }));
|
|
55
|
+
|
|
56
|
+
return merged;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getContext(): ViteBuildContext {
|
|
60
|
+
/*
|
|
61
|
+
* svgrPlugin only reads bundlerConfig.pluginOverrides, so a minimal context
|
|
62
|
+
* is enough to reuse it with startup's default SVG include patterns.
|
|
63
|
+
*/
|
|
64
|
+
return { bundlerConfig: { pluginOverrides: {} } } as ViteBuildContext;
|
|
65
|
+
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getConfiguration,
|
|
5
5
|
getConfigurationSafe,
|
|
6
6
|
getESLintConfiguration,
|
|
7
|
+
getExposeProcessEnv,
|
|
7
8
|
getJestConfiguration,
|
|
8
9
|
getReviewConfiguration,
|
|
9
10
|
getStylelintConfiguration,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
isLegacy,
|
|
19
20
|
isLegacyRoot,
|
|
20
21
|
isStyleCheckDisabled,
|
|
22
|
+
isViteDevServerDisabled,
|
|
21
23
|
isWebComponent,
|
|
22
24
|
} from '../get-configuration';
|
|
23
25
|
import { log } from '../log';
|
|
@@ -225,6 +227,22 @@ describe('[startup] Utils', () => {
|
|
|
225
227
|
});
|
|
226
228
|
});
|
|
227
229
|
|
|
230
|
+
describe(getExposeProcessEnv.name, () => {
|
|
231
|
+
const subject = () => getExposeProcessEnv();
|
|
232
|
+
|
|
233
|
+
itReturns(subject, []);
|
|
234
|
+
|
|
235
|
+
describe('with "cli.expose-process-env"', () => {
|
|
236
|
+
const content = { cli: { 'expose-process-env': ['API_URL', 'FEATURE_FLAG'] } };
|
|
237
|
+
|
|
238
|
+
beforeEach(() => mockPackageJson(content));
|
|
239
|
+
|
|
240
|
+
test('returns "cli.expose-process-env"', () => {
|
|
241
|
+
expect(subject()).toEqual(content.cli['expose-process-env']);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
228
246
|
describe(getViteConfiguration.name, () => {
|
|
229
247
|
const subject = () => getViteConfiguration();
|
|
230
248
|
|
|
@@ -412,16 +430,16 @@ describe('[startup] Utils', () => {
|
|
|
412
430
|
});
|
|
413
431
|
|
|
414
432
|
describe.each([
|
|
415
|
-
{
|
|
416
|
-
fn: isBundle,
|
|
417
|
-
defaultValue: true,
|
|
418
|
-
trigger: { cli: { webpack: false } },
|
|
419
|
-
},
|
|
420
433
|
{
|
|
421
434
|
fn: isDevServerDisabled,
|
|
422
435
|
defaultValue: false,
|
|
423
436
|
trigger: { cli: { webpack: { devServer: false } } },
|
|
424
437
|
},
|
|
438
|
+
{
|
|
439
|
+
fn: isViteDevServerDisabled,
|
|
440
|
+
defaultValue: false,
|
|
441
|
+
trigger: { cli: { vite: { devServer: false } } },
|
|
442
|
+
},
|
|
425
443
|
{
|
|
426
444
|
fn: isExposeSharedDependencies,
|
|
427
445
|
defaultValue: false,
|
|
@@ -486,4 +504,63 @@ describe('[startup] Utils', () => {
|
|
|
486
504
|
});
|
|
487
505
|
});
|
|
488
506
|
});
|
|
507
|
+
|
|
508
|
+
describe(isBundle.name, () => {
|
|
509
|
+
let json: Record<string, any>;
|
|
510
|
+
|
|
511
|
+
beforeEach(() => {
|
|
512
|
+
json = { name: '{packageName}', cli: {} };
|
|
513
|
+
mockPackageJson(json);
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
const subject = () => isBundle();
|
|
517
|
+
|
|
518
|
+
itReturns(subject, true);
|
|
519
|
+
|
|
520
|
+
describe('when cli.webpack is false', () => {
|
|
521
|
+
beforeEach(() => {
|
|
522
|
+
json.cli.webpack = false;
|
|
523
|
+
mockPackageJson(json);
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
itReturns(subject, false);
|
|
527
|
+
|
|
528
|
+
describe('when cli.vite is truthy', () => {
|
|
529
|
+
beforeEach(() => {
|
|
530
|
+
json.cli.vite = {};
|
|
531
|
+
mockPackageJson(json);
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
test('throws error', () => {
|
|
535
|
+
expect(subject).toThrow(
|
|
536
|
+
`package ${json.name} has conflicting webpack and vite configurations: ` +
|
|
537
|
+
`cli.webpack is false but cli.vite is not`
|
|
538
|
+
);
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
describe('when cli.vite is false', () => {
|
|
544
|
+
beforeEach(() => {
|
|
545
|
+
json.cli.vite = false;
|
|
546
|
+
mockPackageJson(json);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
itReturns(subject, false);
|
|
550
|
+
|
|
551
|
+
describe('when cli.webpack is truthy', () => {
|
|
552
|
+
beforeEach(() => {
|
|
553
|
+
json.cli.webpack = {};
|
|
554
|
+
mockPackageJson(json);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
test('throws error', () => {
|
|
558
|
+
expect(subject).toThrow(
|
|
559
|
+
`package ${json.name} has conflicting webpack and vite configurations: ` +
|
|
560
|
+
`cli.vite is false but cli.webpack is not`
|
|
561
|
+
);
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
});
|
|
489
566
|
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import { getPackageName } from '../get-package-name';
|
|
3
|
+
import { LocationOrJson } from '../types';
|
|
4
|
+
|
|
5
|
+
jest.mock('fs', () => fs);
|
|
6
|
+
|
|
7
|
+
describe(getPackageName.name, () => {
|
|
8
|
+
let locationOrJson: LocationOrJson | undefined;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
vol.reset();
|
|
12
|
+
locationOrJson = undefined;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const subject = () => getPackageName(locationOrJson);
|
|
16
|
+
|
|
17
|
+
describe('with a JSON object', () => {
|
|
18
|
+
beforeEach(() => (locationOrJson = { name: 'foo' }));
|
|
19
|
+
|
|
20
|
+
test('returns "name" property', () => {
|
|
21
|
+
expect(subject()).toBe((locationOrJson as Record<string, any>).name);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('when name is not present', () => {
|
|
26
|
+
beforeEach(() => (locationOrJson = {}));
|
|
27
|
+
|
|
28
|
+
test('returns empty string', () => {
|
|
29
|
+
expect(subject()).toBe('');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('with a location', () => {
|
|
34
|
+
const packageJson = { name: 'bar' };
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
locationOrJson = 'packages/foo';
|
|
38
|
+
vol.fromJSON({
|
|
39
|
+
[`${locationOrJson as string}/package.json`]: JSON.stringify(packageJson),
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('returns "name" from location\'s package.json', () => {
|
|
44
|
+
expect(subject()).toBe(packageJson.name);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('with no argument', () => {
|
|
49
|
+
const packageJson = { name: 'baz' };
|
|
50
|
+
|
|
51
|
+
beforeEach(() => vol.fromJSON({ 'package.json': JSON.stringify(packageJson) }));
|
|
52
|
+
|
|
53
|
+
test('returns "name" from current package.json', () => {
|
|
54
|
+
expect(subject()).toBe(packageJson.name);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -3,53 +3,68 @@ import { validateSharedDependencies } from '../validate-shared-dependencies';
|
|
|
3
3
|
|
|
4
4
|
jest.mock('fs', () => fs);
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
|
|
8
|
-
vol.fromJSON({ 'package.json': JSON.stringify(content) });
|
|
9
|
-
}
|
|
6
|
+
describe(`[startup] ${validateSharedDependencies.name}`, () => {
|
|
7
|
+
let cli: Record<string, any>;
|
|
10
8
|
|
|
9
|
+
beforeEach(() => (cli = {}));
|
|
11
10
|
afterEach(() => vol.reset());
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
12
|
+
const subject = () => {
|
|
13
|
+
vol.fromJSON({ 'package.json': JSON.stringify({ cli }) });
|
|
14
|
+
return validateSharedDependencies();
|
|
15
|
+
};
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
function itDoesNotThrow() {
|
|
18
|
+
test('does not throw', () => {
|
|
19
|
+
expect(subject).not.toThrow();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
function itThrows(message: RegExp) {
|
|
24
|
+
test('throws', () => {
|
|
25
|
+
expect(subject).toThrow(message);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
itDoesNotThrow();
|
|
30
|
+
|
|
31
|
+
describe('with conflicting {cli, cli.webpack}.shared-dependencies', () => {
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
cli['shared-dependencies'] = { defaults: '' };
|
|
34
|
+
cli.webpack = { 'shared-dependencies': { defaults: '', extra: 'foo' } };
|
|
32
35
|
});
|
|
33
|
-
|
|
36
|
+
|
|
37
|
+
itThrows(/both set but differ/);
|
|
34
38
|
});
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cli
|
|
39
|
-
|
|
40
|
-
'webpack': { 'shared-dependencies': { defaults: '', extra: 'foo' } },
|
|
41
|
-
},
|
|
40
|
+
describe('with conflicting {cli, cli.webpack}.expose-shared-dependencies', () => {
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
cli['expose-shared-dependencies'] = true;
|
|
43
|
+
cli.webpack = { 'expose-shared-dependencies': false };
|
|
42
44
|
});
|
|
43
|
-
|
|
45
|
+
|
|
46
|
+
itThrows(/both set but differ/);
|
|
44
47
|
});
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
49
|
+
describe('when configured as a web-component', () => {
|
|
50
|
+
beforeEach(() => (cli['web-component'] = true));
|
|
51
|
+
|
|
52
|
+
describe.each([
|
|
53
|
+
{ cli: { 'expose-shared-dependencies': true } },
|
|
54
|
+
{ cli: { webpack: { 'expose-shared-dependencies': true } } },
|
|
55
|
+
])('with %o', config => {
|
|
56
|
+
beforeEach(() => Object.assign(cli, config.cli));
|
|
57
|
+
|
|
58
|
+
itThrows(/only applies to host applications/);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe.each([
|
|
62
|
+
{ cli: { 'expose-shared-dependencies': false } },
|
|
63
|
+
{ cli: { webpack: { 'expose-shared-dependencies': false } } },
|
|
64
|
+
])('with %o', config => {
|
|
65
|
+
beforeEach(() => Object.assign(cli, config.cli));
|
|
66
|
+
|
|
67
|
+
itDoesNotThrow();
|
|
52
68
|
});
|
|
53
|
-
expect(() => validateSharedDependencies()).toThrow(/both set but differ/);
|
|
54
69
|
});
|
|
55
70
|
});
|