@servicetitan/startup 37.0.2 → 38.1.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/js-yaml.js +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +22 -9
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +6 -0
- package/dist/cli/commands/bundle-package.d.ts.map +1 -0
- package/dist/cli/commands/bundle-package.js +59 -0
- package/dist/cli/commands/bundle-package.js.map +1 -0
- package/dist/cli/commands/bundle-vite.js +13 -4
- package/dist/cli/commands/bundle-vite.js.map +1 -1
- package/dist/cli/commands/bundle-webpack.js +13 -4
- package/dist/cli/commands/bundle-webpack.js.map +1 -1
- package/dist/cli/commands/clean.js +13 -4
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/command.d.ts +9 -0
- package/dist/cli/commands/command.d.ts.map +1 -0
- package/dist/cli/commands/command.js +35 -0
- package/dist/cli/commands/command.js.map +1 -0
- package/dist/cli/commands/convert-eslint-config.js +14 -7
- package/dist/cli/commands/convert-eslint-config.js.map +1 -1
- package/dist/cli/commands/eslint.js +13 -4
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/init.js +13 -4
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.js +13 -4
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +13 -4
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.js +13 -4
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +15 -7
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +13 -4
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-list.js +13 -4
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +13 -4
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +13 -4
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.js +13 -4
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
- package/dist/cli/commands/mfe-publish.js +13 -4
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/mfe-purge-cache.js +13 -4
- package/dist/cli/commands/mfe-purge-cache.js.map +1 -1
- package/dist/cli/commands/prepare-package.js +13 -4
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +1 -1
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +3 -5
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/bundle-package.d.ts +41 -0
- package/dist/cli/commands/registry/bundle-package.d.ts.map +1 -0
- package/dist/cli/commands/registry/bundle-package.js +54 -0
- package/dist/cli/commands/registry/bundle-package.js.map +1 -0
- package/dist/cli/commands/registry/command-registry.d.ts +42 -2
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +10 -19
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +1 -1
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +3 -5
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/review/review.js +14 -7
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js +1 -3
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js +1 -3
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js.map +1 -1
- package/dist/cli/commands/review/rules/no-typescript-entry-point.js +1 -3
- package/dist/cli/commands/review/rules/no-typescript-entry-point.js.map +1 -1
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js +5 -12
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +5 -12
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
- package/dist/cli/commands/review/rules/require-explicit-side-effects.js +1 -3
- package/dist/cli/commands/review/rules/require-explicit-side-effects.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -3
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-servicetitan-scope.js +1 -3
- package/dist/cli/commands/review/rules/require-servicetitan-scope.js.map +1 -1
- package/dist/cli/commands/review/rules/require-tsconfig-references.js +1 -3
- package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -1
- package/dist/cli/commands/review/types.d.ts.map +1 -1
- package/dist/cli/commands/review/types.js.map +1 -1
- package/dist/cli/commands/review/utils/compare-version.js +8 -19
- package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +1 -0
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +20 -6
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +28 -13
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stylelint.js +13 -4
- package/dist/cli/commands/stylelint.js.map +1 -1
- package/dist/cli/commands/styles-check.js +13 -4
- package/dist/cli/commands/styles-check.js.map +1 -1
- package/dist/cli/commands/test/runners/jest.js +1 -3
- package/dist/cli/commands/test/runners/jest.js.map +1 -1
- package/dist/cli/commands/test/tests.js +13 -4
- package/dist/cli/commands/test/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +1 -6
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/types.js +2 -20
- package/dist/cli/commands/types.js.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.js +17 -13
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
- package/dist/cli/index.js +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/cli-task.d.ts +3 -0
- package/dist/cli/tasks/cli-task.d.ts.map +1 -1
- package/dist/cli/tasks/cli-task.js +41 -9
- package/dist/cli/tasks/cli-task.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts +9 -1
- package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package/get-swc-options.js +18 -2
- package/dist/cli/tasks/swc-compile-package/get-swc-options.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts +3 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js +17 -3
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/task.d.ts +2 -1
- package/dist/cli/tasks/task.d.ts.map +1 -1
- package/dist/cli/tasks/task.js +6 -3
- package/dist/cli/tasks/task.js.map +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -3
- package/dist/cli/tasks/tsc-compile/tsc-compile.js.map +1 -1
- package/dist/cli/utils/cli-npm.d.ts.map +1 -1
- package/dist/cli/utils/cli-npm.js +8 -1
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts +1 -0
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js +20 -0
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/compile.d.ts.map +1 -1
- package/dist/cli/utils/compile.js +7 -4
- package/dist/cli/utils/compile.js.map +1 -1
- package/dist/cli/utils/copy-files.js +1 -0
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/index.d.ts +1 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +1 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/process-tree.js +2 -6
- package/dist/cli/utils/process-tree.js.map +1 -1
- package/dist/cli/utils/resolve-bundler.d.ts.map +1 -1
- package/dist/cli/utils/resolve-bundler.js +2 -1
- package/dist/cli/utils/resolve-bundler.js.map +1 -1
- package/dist/cli/utils/ts-config.d.ts +1 -1
- package/dist/cli/utils/ts-config.d.ts.map +1 -1
- package/dist/cli/utils/ts-config.js +1 -3
- package/dist/cli/utils/ts-config.js.map +1 -1
- package/dist/cli/utils/with-exponential-backoff.d.ts +7 -0
- package/dist/cli/utils/with-exponential-backoff.d.ts.map +1 -0
- package/dist/cli/utils/with-exponential-backoff.js +28 -0
- package/dist/cli/utils/with-exponential-backoff.js.map +1 -0
- package/dist/core/constants.d.ts +2 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +6 -1
- package/dist/core/constants.js.map +1 -1
- package/dist/cypress/config/vite-config.d.ts.map +1 -1
- package/dist/cypress/config/vite-config.js +23 -3
- package/dist/cypress/config/vite-config.js.map +1 -1
- package/dist/cypress/config/webpack-config.d.ts.map +1 -1
- package/dist/cypress/config/webpack-config.js +5 -0
- package/dist/cypress/config/webpack-config.js.map +1 -1
- package/dist/postinstall.js +118 -0
- package/dist/scripts/generate-bin-wrappers.js +203 -0
- package/dist/storybook-config/swc.d.ts +6 -0
- package/dist/storybook-config/swc.d.ts.map +1 -1
- package/dist/storybook-config/vite-final.d.ts.map +1 -1
- package/dist/storybook-config/vite-final.js +32 -6
- package/dist/storybook-config/vite-final.js.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +3 -1
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/exit-when-parent-exits.d.ts +6 -0
- package/dist/utils/exit-when-parent-exits.d.ts.map +1 -0
- package/dist/utils/exit-when-parent-exits.js +37 -0
- package/dist/utils/exit-when-parent-exits.js.map +1 -0
- package/dist/utils/find-up.d.ts +1 -1
- package/dist/utils/find-up.d.ts.map +1 -1
- package/dist/utils/find-up.js +2 -2
- package/dist/utils/find-up.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +6 -3
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +10 -2
- package/dist/utils/get-configuration.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 +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/log.js +1 -3
- package/dist/utils/log.js.map +1 -1
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
- package/dist/vite/build-shared-dependencies.js +2 -0
- package/dist/vite/build-shared-dependencies.js.map +1 -1
- package/dist/vite/config/base-config.d.ts.map +1 -1
- package/dist/vite/config/base-config.js +14 -1
- package/dist/vite/config/base-config.js.map +1 -1
- package/dist/vite/config/create-filtering-logger.d.ts.map +1 -1
- package/dist/vite/config/create-filtering-logger.js +12 -1
- package/dist/vite/config/create-filtering-logger.js.map +1 -1
- package/dist/vite/config/create-vite-build-context.d.ts.map +1 -1
- package/dist/vite/config/create-vite-build-context.js +4 -1
- package/dist/vite/config/create-vite-build-context.js.map +1 -1
- package/dist/vite/config/create-vite-config.js +7 -2
- package/dist/vite/config/create-vite-config.js.map +1 -1
- package/dist/vite/config/load-config-file.js +8 -19
- package/dist/vite/config/load-config-file.js.map +1 -1
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.html +2 -2
- package/dist/vite/index.js +16 -0
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugins/chain-source-maps-plugin.js +1 -1
- package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -1
- package/dist/vite/plugins/clean-plugin.js +1 -1
- package/dist/vite/plugins/clean-plugin.js.map +1 -1
- package/dist/vite/plugins/css-injector-plugin.js +1 -1
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -1
- package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/design-system-guard-plugin.js +10 -5
- package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -1
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +1 -1
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/dev-server-routing-plugin.js +4 -3
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -1
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/externals-plugin.js +11 -5
- package/dist/vite/plugins/externals-plugin.js.map +1 -1
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/html-plugin.js +5 -3
- package/dist/vite/plugins/html-plugin.js.map +1 -1
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +2 -2
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/ignore-modules-plugin.js +36 -24
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
- package/dist/vite/plugins/index.d.ts +3 -0
- package/dist/vite/plugins/index.d.ts.map +1 -1
- package/dist/vite/plugins/index.js +3 -0
- package/dist/vite/plugins/index.js.map +1 -1
- package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/istanbul-plugin.js +33 -1
- package/dist/vite/plugins/istanbul-plugin.js.map +1 -1
- package/dist/vite/plugins/less-tilde-plugin.d.ts +8 -0
- package/dist/vite/plugins/less-tilde-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/less-tilde-plugin.js +53 -0
- package/dist/vite/plugins/less-tilde-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +1 -1
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -1
- package/dist/vite/plugins/metadata-plugin.js +1 -1
- package/dist/vite/plugins/metadata-plugin.js.map +1 -1
- package/dist/vite/plugins/moment-locales-plugin.d.ts +1 -1
- package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/moment-locales-plugin.js +30 -14
- package/dist/vite/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/vite/plugins/react-refresh-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/react-refresh-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/index.js +20 -0
- package/dist/vite/plugins/react-refresh-plugin/index.js.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts +4 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js +143 -0
- package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js.map +1 -0
- package/dist/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js +14 -11
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -1
- package/dist/vite/plugins/style-urls-plugin.js +1 -1
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -1
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/virtual-modules-plugin.js +9 -6
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/vite/plugins/window-externals-plugin.d.ts +22 -0
- package/dist/vite/plugins/window-externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/window-externals-plugin.js +74 -0
- package/dist/vite/plugins/window-externals-plugin.js.map +1 -0
- package/dist/vite/types.d.ts +4 -1
- package/dist/vite/types.d.ts.map +1 -1
- package/dist/webpack/bundle-webpack.d.ts.map +1 -1
- package/dist/webpack/bundle-webpack.js +6 -1
- package/dist/webpack/bundle-webpack.js.map +1 -1
- package/dist/webpack/configs/optimization-config.js +4 -4
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.js +1 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +1 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/configuration.expose-loader.js +13 -0
- package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/index.js +1 -0
- package/dist/webpack/utils/index.d.ts +1 -0
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -0
- package/dist/webpack/utils/index.js.map +1 -1
- package/dist/webpack/utils/normalize-proxy-config.d.ts +6 -0
- package/dist/webpack/utils/normalize-proxy-config.d.ts.map +1 -0
- package/dist/webpack/utils/normalize-proxy-config.js +52 -0
- package/dist/webpack/utils/normalize-proxy-config.js.map +1 -0
- package/package.json +25 -22
- package/src/cli/commands/__tests__/build.test.ts +33 -19
- package/src/cli/commands/__tests__/bundle-package.test.ts +65 -0
- package/src/cli/commands/__tests__/bundle-vite.test.ts +1 -0
- package/src/cli/commands/__tests__/command.test.ts +42 -0
- package/src/cli/commands/__tests__/mfe-check.test.ts +26 -5
- package/src/cli/commands/__tests__/run-task.test.ts +20 -1
- package/src/cli/commands/__tests__/start.test.ts +35 -15
- package/src/cli/commands/build.ts +6 -5
- package/src/cli/commands/bundle-package.ts +20 -0
- package/src/cli/commands/command.ts +14 -0
- package/src/cli/commands/mfe-check.ts +6 -10
- package/src/cli/commands/registry/build.ts +3 -2
- package/src/cli/commands/registry/bundle-package.ts +22 -0
- package/src/cli/commands/registry/command-registry.ts +2 -0
- package/src/cli/commands/registry/start.ts +3 -2
- package/src/cli/commands/review/types.ts +1 -3
- package/src/cli/commands/run-task.ts +8 -2
- package/src/cli/commands/start.ts +9 -5
- package/src/cli/commands/types.ts +2 -6
- package/src/cli/index.ts +3 -0
- package/src/cli/tasks/__tests__/cli-task.test.ts +181 -69
- package/src/cli/tasks/__tests__/task.test.ts +40 -45
- package/src/cli/tasks/cli-task.ts +43 -2
- package/src/cli/tasks/swc-compile-package/__tests__/get-swc-options.test.ts +46 -4
- package/src/cli/tasks/swc-compile-package/__tests__/swc-compile-package.test.ts +25 -4
- package/src/cli/tasks/swc-compile-package/get-swc-options.ts +14 -1
- package/src/cli/tasks/swc-compile-package/swc-compile-package.ts +6 -2
- package/src/cli/tasks/task.ts +8 -2
- package/src/cli/tasks/tsc-compile/__tests__/tsc-compile.test.ts +8 -32
- package/src/cli/tasks/tsc-compile-package/__tests__/tsc-compile-package.test.ts +10 -19
- package/src/cli/utils/__tests__/cli-npm.test.ts +33 -0
- package/src/cli/utils/__tests__/cli-os.test.ts +86 -3
- package/src/cli/utils/__tests__/compile.test.ts +37 -2
- package/src/cli/utils/__tests__/copy-files.test.ts +1 -1
- package/src/cli/utils/__tests__/with-exponential-backoff.test.ts +119 -0
- package/src/cli/utils/cli-npm.ts +19 -4
- package/src/cli/utils/cli-os.ts +14 -0
- package/src/cli/utils/compile.ts +8 -1
- package/src/cli/utils/copy-files.ts +1 -1
- package/src/cli/utils/index.ts +1 -1
- package/src/cli/utils/resolve-bundler.ts +2 -1
- package/src/cli/utils/ts-config.ts +1 -1
- package/src/cli/utils/with-exponential-backoff.ts +28 -0
- package/src/core/constants.ts +2 -0
- package/src/cypress/config/__tests__/vite-config.test.ts +21 -11
- package/src/cypress/config/__tests__/webpack-config.test.ts +17 -0
- package/src/cypress/config/vite-config.ts +18 -3
- package/src/cypress/config/webpack-config.ts +2 -0
- package/src/storybook-config/__tests__/vite-final.test.ts +71 -11
- package/src/storybook-config/__tests__/webpack-final.test.ts +30 -6
- package/src/storybook-config/vite-final.ts +23 -2
- package/src/storybook-config/webpack-final.ts +10 -2
- package/src/utils/__tests__/exit-when-parent-exits.test.ts +87 -0
- package/src/utils/__tests__/find-up.test.ts +49 -0
- package/src/utils/__tests__/get-configuration.test.ts +62 -0
- package/src/utils/exit-when-parent-exits.ts +33 -0
- package/src/utils/find-up.ts +2 -2
- package/src/utils/get-configuration.ts +14 -5
- package/src/utils/index.ts +1 -0
- package/src/vite/__tests__/build-shared-dependencies.test.ts +39 -5
- package/src/vite/build-shared-dependencies.ts +2 -1
- package/src/vite/config/__tests__/base-config.test.ts +16 -4
- package/src/vite/config/__tests__/create-css-config.test.ts +2 -6
- package/src/vite/config/__tests__/create-filtering-logger.test.ts +9 -0
- package/src/vite/config/__tests__/create-vite-build-context.test.ts +25 -0
- package/src/vite/config/__tests__/create-vite-config.test.ts +6 -3
- package/src/vite/config/base-config.ts +18 -2
- package/src/vite/config/create-filtering-logger.ts +13 -2
- package/src/vite/config/create-vite-build-context.ts +1 -0
- package/src/vite/config/create-vite-config.ts +6 -3
- package/src/vite/index.html +2 -2
- package/src/vite/index.ts +2 -0
- package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/clean-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +15 -3
- package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +121 -99
- package/src/vite/plugins/__tests__/externals-plugin.test.ts +24 -3
- package/src/vite/plugins/__tests__/html-plugin.test.ts +10 -3
- package/src/vite/plugins/__tests__/html-template.test.ts +10 -2
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +30 -6
- package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +42 -1
- package/src/vite/plugins/__tests__/less-tilde-plugin.test.ts +91 -0
- package/src/vite/plugins/__tests__/metadata-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +35 -25
- package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +1 -1
- package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +20 -9
- package/src/vite/plugins/__tests__/window-externals-plugin.test.ts +128 -0
- package/src/vite/plugins/chain-source-maps-plugin.ts +1 -1
- package/src/vite/plugins/clean-plugin.ts +1 -1
- package/src/vite/plugins/css-injector-plugin.ts +1 -1
- package/src/vite/plugins/design-system-guard-plugin.ts +11 -8
- package/src/vite/plugins/dev-server-routing-plugin.ts +4 -4
- package/src/vite/plugins/externals-plugin.ts +15 -6
- package/src/vite/plugins/html-plugin.ts +4 -2
- package/src/vite/plugins/ignore-modules-plugin.ts +32 -23
- package/src/vite/plugins/index.ts +3 -0
- package/src/vite/plugins/istanbul-plugin.ts +28 -1
- package/src/vite/plugins/less-tilde-plugin.ts +64 -0
- package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +1 -1
- package/src/vite/plugins/metadata-plugin.ts +1 -1
- package/src/vite/plugins/moment-locales-plugin.ts +24 -14
- package/src/vite/plugins/react-refresh-plugin/README.md +165 -0
- package/src/vite/plugins/react-refresh-plugin/__tests__/react-refresh-plugin.test.ts +366 -0
- package/src/vite/plugins/react-refresh-plugin/__tests__/refresh-runtime.test.ts +193 -0
- package/src/vite/plugins/react-refresh-plugin/index.ts +1 -0
- package/src/vite/plugins/react-refresh-plugin/react-refresh-plugin.ts +144 -0
- package/src/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/shared-dependencies-plugin.test.ts +21 -16
- package/src/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.ts +13 -12
- package/src/vite/plugins/style-urls-plugin.ts +1 -1
- package/src/vite/plugins/virtual-modules-plugin.ts +8 -7
- package/src/vite/plugins/window-externals-plugin.ts +94 -0
- package/src/vite/types.ts +4 -1
- package/src/webpack/__tests__/bundle-webpack.test.ts +32 -0
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -5
- package/src/webpack/__tests__/create-webpack-config.test.ts +10 -6
- package/src/webpack/bundle-webpack.ts +7 -1
- package/src/webpack/configs/optimization-config.ts +3 -3
- package/src/webpack/configs/output-config.ts +1 -1
- package/src/webpack/utils/__tests__/normalize-proxy-config.test.ts +121 -0
- package/src/webpack/utils/index.ts +1 -0
- package/src/webpack/utils/normalize-proxy-config.ts +59 -0
- package/tsconfig/types.d.ts +10 -0
- package/dist/cli/utils/get-bundle-command.d.ts +0 -3
- package/dist/cli/utils/get-bundle-command.d.ts.map +0 -1
- package/dist/cli/utils/get-bundle-command.js +0 -16
- package/dist/cli/utils/get-bundle-command.js.map +0 -1
- package/src/cli/utils/__tests__/get-bundle-command.test.ts +0 -23
- package/src/cli/utils/get-bundle-command.ts +0 -5
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { normalizePath } from 'vite';
|
|
3
4
|
import { type BuildContext, getBundleType } from '../../../core';
|
|
4
5
|
import { log } from '../../../utils';
|
|
5
6
|
import { devServerRoutingPlugin } from '../dev-server-routing-plugin';
|
|
6
7
|
|
|
7
8
|
jest.mock('fs', () => fs);
|
|
9
|
+
jest.mock('vite', () => ({ normalizePath: jest.fn() }));
|
|
8
10
|
jest.mock('../../../core', () => ({
|
|
9
11
|
getBundleType: jest.fn(),
|
|
10
12
|
}));
|
|
@@ -16,8 +18,6 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
16
18
|
const SHARED_DEPS_DIR = 'shared';
|
|
17
19
|
const destination = 'dist/bundle/full';
|
|
18
20
|
const destDir = path.resolve(destination);
|
|
19
|
-
const outDir = path.resolve('dist/bundle/full');
|
|
20
|
-
const outDirRelative = path.relative(process.cwd(), outDir);
|
|
21
21
|
|
|
22
22
|
let context: BuildContext;
|
|
23
23
|
|
|
@@ -25,6 +25,7 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
25
25
|
jest.clearAllMocks();
|
|
26
26
|
vol.fromJSON({});
|
|
27
27
|
jest.mocked(getBundleType).mockReturnValue(SHARED_DEPS_DIR);
|
|
28
|
+
jest.mocked(normalizePath).mockImplementation(id => id.split('\\').join('/'));
|
|
28
29
|
context = {
|
|
29
30
|
build: { name: 'test-app' },
|
|
30
31
|
package: { destination },
|
|
@@ -39,92 +40,94 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
39
40
|
const subject = () => devServerRoutingPlugin(context);
|
|
40
41
|
|
|
41
42
|
test('returns plugin with correct name', () => {
|
|
42
|
-
expect(subject().name).toBe('dev-server-routing');
|
|
43
|
+
expect(subject().name).toBe('st:dev-server-routing');
|
|
43
44
|
});
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
let middleware!: Function;
|
|
52
|
-
const server: any = {
|
|
53
|
-
middlewares: {
|
|
54
|
-
use: (handler: Function) => (middleware = handler),
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
(plugin.configureServer as Function).call(plugin, server);
|
|
58
|
-
return middleware;
|
|
59
|
-
};
|
|
46
|
+
describe('configureServer', () => {
|
|
47
|
+
let req: any;
|
|
48
|
+
let next: jest.Mock;
|
|
49
|
+
let middleware: Function;
|
|
60
50
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const req: any = { url: `/${SHARED_DEPS_DIR}/dep.js` };
|
|
65
|
-
const originalUrl = req.url;
|
|
51
|
+
const setupMiddleware = () => {
|
|
52
|
+
const plugin = devServerRoutingPlugin(context);
|
|
53
|
+
(plugin.configResolved as Function).call(plugin, { build: { outDir: destDir } });
|
|
66
54
|
|
|
67
|
-
|
|
55
|
+
const server: any = {
|
|
56
|
+
middlewares: { use: (handler: Function) => (middleware = handler) },
|
|
57
|
+
};
|
|
58
|
+
(plugin.configureServer as Function).call(plugin, server);
|
|
59
|
+
};
|
|
68
60
|
|
|
69
|
-
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
req = { method: 'GET', url: '/anything' };
|
|
63
|
+
next = jest.fn();
|
|
64
|
+
setupMiddleware();
|
|
70
65
|
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('configureServer', () => {
|
|
74
|
-
const itPreservesUnmatchedUrls = () => {
|
|
75
|
-
test('preserves unmatched URL', () => {
|
|
76
|
-
const middleware = setupMiddleware(outDir);
|
|
77
|
-
const req: any = { url: '/other/path' };
|
|
78
|
-
const originalUrl = req.url;
|
|
79
|
-
|
|
80
|
-
middleware(req, {}, jest.fn());
|
|
81
66
|
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
};
|
|
67
|
+
const subject = () => middleware(req, {}, next);
|
|
85
68
|
|
|
86
69
|
test('logs request', () => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
middleware({ method: 'GET', url: '/anything' }, {}, jest.fn());
|
|
70
|
+
subject();
|
|
90
71
|
|
|
91
72
|
expect(log.info).toHaveBeenCalled();
|
|
92
73
|
});
|
|
93
74
|
|
|
94
75
|
test('calls next middleware', () => {
|
|
95
|
-
|
|
96
|
-
const next = jest.fn();
|
|
97
|
-
|
|
98
|
-
middleware({ url: '/anything' }, {}, next);
|
|
76
|
+
subject();
|
|
99
77
|
|
|
100
78
|
expect(next).toHaveBeenCalled();
|
|
101
79
|
});
|
|
102
80
|
|
|
81
|
+
const itPreservesUnmatchedUrls = () => {
|
|
82
|
+
describe('with an unmatched URL', () => {
|
|
83
|
+
let originalUrl: string;
|
|
84
|
+
|
|
85
|
+
beforeEach(() => {
|
|
86
|
+
req.url = '/other/path';
|
|
87
|
+
originalUrl = req.url;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('preserves the URL', () => {
|
|
91
|
+
subject();
|
|
92
|
+
|
|
93
|
+
expect(req.url).toBe(originalUrl);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
103
98
|
describe('when package is a web component', () => {
|
|
104
|
-
beforeEach(() =>
|
|
99
|
+
beforeEach(() => {
|
|
100
|
+
context.package.isWebComponent = true;
|
|
101
|
+
setupMiddleware();
|
|
102
|
+
});
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const req: any = { url: `/${outDirRelative}/index.js` };
|
|
104
|
+
describe('with a URL under outDir', () => {
|
|
105
|
+
beforeEach(() => (req.url = `/${destination}/index.js`));
|
|
109
106
|
|
|
110
|
-
|
|
107
|
+
test('strips outDir prefix from URL', () => {
|
|
108
|
+
subject();
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
expect(req.url).toBe('/index.js');
|
|
111
|
+
});
|
|
113
112
|
});
|
|
114
113
|
|
|
115
114
|
itPreservesUnmatchedUrls();
|
|
116
115
|
});
|
|
117
116
|
|
|
118
117
|
describe('when package is not a web component', () => {
|
|
119
|
-
beforeEach(() =>
|
|
118
|
+
beforeEach(() => {
|
|
119
|
+
context.package.isWebComponent = false;
|
|
120
|
+
setupMiddleware();
|
|
121
|
+
});
|
|
120
122
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const req: any = { url: `/${SHARED_DEPS_DIR}/dep.js` };
|
|
123
|
+
describe('with a shared dependency URL', () => {
|
|
124
|
+
beforeEach(() => (req.url = `/${SHARED_DEPS_DIR}/dep.js`));
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
test('rewrites URL to outDir', () => {
|
|
127
|
+
subject();
|
|
126
128
|
|
|
127
|
-
|
|
129
|
+
expect(req.url).toBe(`/${destination}/${SHARED_DEPS_DIR}/dep.js`);
|
|
130
|
+
});
|
|
128
131
|
});
|
|
129
132
|
|
|
130
133
|
itPreservesUnmatchedUrls();
|
|
@@ -132,8 +135,8 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
132
135
|
});
|
|
133
136
|
|
|
134
137
|
describe('configurePreviewServer', () => {
|
|
135
|
-
const
|
|
136
|
-
const plugin =
|
|
138
|
+
const registerPreviewServer = () => {
|
|
139
|
+
const plugin = devServerRoutingPlugin(context);
|
|
137
140
|
const uses: { path?: string; handler: Function }[] = [];
|
|
138
141
|
const server: any = {
|
|
139
142
|
middlewares: {
|
|
@@ -153,39 +156,66 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
153
156
|
};
|
|
154
157
|
};
|
|
155
158
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
describe('logging middleware', () => {
|
|
160
|
+
let req: any;
|
|
161
|
+
let next: jest.Mock;
|
|
162
|
+
let logger: Function;
|
|
160
163
|
|
|
161
|
-
|
|
164
|
+
beforeEach(() => {
|
|
165
|
+
({ logger } = registerPreviewServer());
|
|
166
|
+
req = { method: 'GET', url: '/index.html' };
|
|
167
|
+
next = jest.fn();
|
|
168
|
+
});
|
|
162
169
|
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
const subject = () => logger(req, {}, next);
|
|
171
|
+
|
|
172
|
+
test('logs request', () => {
|
|
173
|
+
subject();
|
|
174
|
+
|
|
175
|
+
expect(log.info).toHaveBeenCalled();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('calls next middleware', () => {
|
|
179
|
+
subject();
|
|
180
|
+
|
|
181
|
+
expect(next).toHaveBeenCalled();
|
|
182
|
+
});
|
|
165
183
|
});
|
|
166
184
|
|
|
167
185
|
describe('when package is not a web component', () => {
|
|
168
|
-
|
|
186
|
+
let staticFiles: Function | undefined;
|
|
169
187
|
|
|
170
|
-
|
|
171
|
-
|
|
188
|
+
beforeEach(() => {
|
|
189
|
+
context.package.isWebComponent = false;
|
|
190
|
+
({ staticFiles } = registerPreviewServer());
|
|
191
|
+
});
|
|
172
192
|
|
|
173
|
-
|
|
193
|
+
test('does not register a static file middleware', () => {
|
|
174
194
|
expect(staticFiles).toBeUndefined();
|
|
175
195
|
});
|
|
176
196
|
});
|
|
177
197
|
|
|
178
198
|
describe('when package is a web component', () => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
let req: any;
|
|
200
|
+
let res: any;
|
|
201
|
+
let next: jest.Mock;
|
|
202
|
+
let mockStream: { pipe: jest.Mock };
|
|
203
|
+
let createReadStreamSpy: jest.SpyInstance;
|
|
204
|
+
let staticFiles: Function | undefined;
|
|
205
|
+
|
|
206
|
+
beforeEach(() => {
|
|
207
|
+
context.package.isWebComponent = true;
|
|
208
|
+
mockStream = { pipe: jest.fn() };
|
|
209
|
+
createReadStreamSpy = jest
|
|
210
|
+
.spyOn(fs, 'createReadStream')
|
|
211
|
+
.mockReturnValue(mockStream as any);
|
|
212
|
+
({ staticFiles } = registerPreviewServer());
|
|
213
|
+
req = { url: '/file.js' };
|
|
214
|
+
res = { setHeader: jest.fn() };
|
|
215
|
+
next = jest.fn();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const subject = () => staticFiles!(req, res, next);
|
|
189
219
|
|
|
190
220
|
describe.each([
|
|
191
221
|
['file.js', 'application/javascript'],
|
|
@@ -193,11 +223,12 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
193
223
|
['file.json', 'application/json'],
|
|
194
224
|
])('when requested file is %s', (fileName, contentType) => {
|
|
195
225
|
beforeEach(() => {
|
|
226
|
+
req.url = `/${fileName}`;
|
|
196
227
|
vol.fromJSON({ [path.join(destDir, fileName)]: 'content' });
|
|
197
228
|
});
|
|
198
229
|
|
|
199
230
|
test(`serves file as ${contentType}`, () => {
|
|
200
|
-
|
|
231
|
+
subject();
|
|
201
232
|
|
|
202
233
|
expect(res.setHeader).toHaveBeenCalledWith('Content-Type', contentType);
|
|
203
234
|
expect(mockStream.pipe).toHaveBeenCalledWith(res);
|
|
@@ -205,14 +236,13 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
205
236
|
});
|
|
206
237
|
|
|
207
238
|
describe('when requested file has unrecognized extension', () => {
|
|
208
|
-
const fileName = 'file.txt';
|
|
209
|
-
|
|
210
239
|
beforeEach(() => {
|
|
211
|
-
|
|
240
|
+
req.url = '/file.txt';
|
|
241
|
+
vol.fromJSON({ [path.join(destDir, 'file.txt')]: 'content' });
|
|
212
242
|
});
|
|
213
243
|
|
|
214
244
|
test('serves file without content type', () => {
|
|
215
|
-
|
|
245
|
+
subject();
|
|
216
246
|
|
|
217
247
|
expect(res.setHeader).not.toHaveBeenCalled();
|
|
218
248
|
expect(mockStream.pipe).toHaveBeenCalledWith(res);
|
|
@@ -220,13 +250,10 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
220
250
|
});
|
|
221
251
|
|
|
222
252
|
describe('when requested file does not exist', () => {
|
|
223
|
-
beforeEach(() =>
|
|
253
|
+
beforeEach(() => (req.url = '/missing.js'));
|
|
224
254
|
|
|
225
255
|
test('calls next middleware', () => {
|
|
226
|
-
|
|
227
|
-
const next = jest.fn();
|
|
228
|
-
|
|
229
|
-
staticFiles!({ url: '/missing.js' }, {}, next);
|
|
256
|
+
subject();
|
|
230
257
|
|
|
231
258
|
expect(next).toHaveBeenCalled();
|
|
232
259
|
});
|
|
@@ -234,20 +261,15 @@ describe(devServerRoutingPlugin.name, () => {
|
|
|
234
261
|
|
|
235
262
|
describe('when requested URL traverses outside the mounted directory', () => {
|
|
236
263
|
beforeEach(() => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
});
|
|
264
|
+
req.url = '/../outside.js';
|
|
265
|
+
vol.fromJSON({ [path.resolve(destDir, '../outside.js')]: 'content' });
|
|
240
266
|
});
|
|
241
267
|
|
|
242
268
|
test('does not serve the file', () => {
|
|
243
|
-
|
|
244
|
-
const { staticFiles } = setupPreviewServer();
|
|
245
|
-
const next = jest.fn();
|
|
246
|
-
|
|
247
|
-
staticFiles!({ url: '/../outside.js' }, {}, next);
|
|
269
|
+
subject();
|
|
248
270
|
|
|
249
271
|
expect(next).toHaveBeenCalled();
|
|
250
|
-
expect(
|
|
272
|
+
expect(createReadStreamSpy).not.toHaveBeenCalled();
|
|
251
273
|
});
|
|
252
274
|
});
|
|
253
275
|
});
|
|
@@ -31,7 +31,7 @@ describe(externalsPlugin.name, () => {
|
|
|
31
31
|
const subject = () => externalsPlugin(context);
|
|
32
32
|
|
|
33
33
|
test('returns plugin with correct name', () => {
|
|
34
|
-
expect(subject()!.name).toBe('externals');
|
|
34
|
+
expect(subject()!.name).toBe('st:externals');
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
test('enforces pre', () => {
|
|
@@ -70,12 +70,33 @@ describe(externalsPlugin.name, () => {
|
|
|
70
70
|
describe('when build is production', () => {
|
|
71
71
|
beforeEach(() => (context.build.isProduction = true));
|
|
72
72
|
|
|
73
|
+
describe('resolveId filter', () => {
|
|
74
|
+
const subject = () =>
|
|
75
|
+
(externalsPlugin(context) as { resolveId: { filter: unknown } }).resolveId.filter;
|
|
76
|
+
|
|
77
|
+
test('matches each dependency exactly', () => {
|
|
78
|
+
expect(subject()).toEqual({ id: [/^react$/, /^@scope\/lib$/] });
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('when a dependency name contains regex characters', () => {
|
|
82
|
+
beforeEach(() =>
|
|
83
|
+
jest.mocked(getExternals).mockReturnValue({ 'lodash.throttle': 'x' })
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
test('escapes them', () => {
|
|
87
|
+
expect(subject()).toEqual({ id: [/^lodash\.throttle$/] });
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
73
92
|
describe('resolveId', () => {
|
|
74
93
|
let source: string;
|
|
75
94
|
|
|
76
95
|
const subject = () => {
|
|
77
|
-
const
|
|
78
|
-
|
|
96
|
+
const { resolveId } = externalsPlugin(context) as {
|
|
97
|
+
resolveId: { handler: Function };
|
|
98
|
+
};
|
|
99
|
+
return resolveId.handler.call({}, source);
|
|
79
100
|
};
|
|
80
101
|
|
|
81
102
|
describe('with known dependency', () => {
|
|
@@ -28,7 +28,7 @@ describe(htmlPlugin.name, () => {
|
|
|
28
28
|
jest.mocked(getSharedEntryPoints).mockReturnValue({ css: [], js: [] });
|
|
29
29
|
context = {
|
|
30
30
|
build: { name: 'my-app', isProduction: false },
|
|
31
|
-
package: { isWebComponent: false, source: 'src' },
|
|
31
|
+
package: { isWebComponent: false, source: 'src', destination: 'dist' },
|
|
32
32
|
bundlerConfig: { pluginOverrides: {} },
|
|
33
33
|
} as ViteBuildContext;
|
|
34
34
|
});
|
|
@@ -38,7 +38,7 @@ describe(htmlPlugin.name, () => {
|
|
|
38
38
|
const subject = () => htmlPlugin(context);
|
|
39
39
|
|
|
40
40
|
test('returns plugin with correct name', () => {
|
|
41
|
-
expect(subject().name).toBe('html');
|
|
41
|
+
expect(subject().name).toBe('st:html');
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
test('constructs Eta with default template directory', () => {
|
|
@@ -170,6 +170,7 @@ describe(htmlPlugin.name, () => {
|
|
|
170
170
|
isProduction: context.build.isProduction,
|
|
171
171
|
isWebComponent: context.package.isWebComponent,
|
|
172
172
|
name: context.build.name,
|
|
173
|
+
tsOutDir: context.package.destination,
|
|
173
174
|
});
|
|
174
175
|
});
|
|
175
176
|
|
|
@@ -310,7 +311,7 @@ describe(htmlPlugin.name, () => {
|
|
|
310
311
|
|
|
311
312
|
beforeEach(() => {
|
|
312
313
|
req = { url: '/other' };
|
|
313
|
-
res = { end: jest.fn() };
|
|
314
|
+
res = { end: jest.fn(), setHeader: jest.fn() };
|
|
314
315
|
next = jest.fn();
|
|
315
316
|
|
|
316
317
|
const plugin = htmlPlugin(context);
|
|
@@ -350,6 +351,12 @@ describe(htmlPlugin.name, () => {
|
|
|
350
351
|
expect(res.end).toHaveBeenCalledWith(TRANSFORMED_HTML);
|
|
351
352
|
});
|
|
352
353
|
|
|
354
|
+
test('sets HTML content type', async () => {
|
|
355
|
+
await subject();
|
|
356
|
+
|
|
357
|
+
expect(res.setHeader).toHaveBeenCalledWith('Content-Type', 'text/html');
|
|
358
|
+
});
|
|
359
|
+
|
|
353
360
|
test('does not call next middleware', async () => {
|
|
354
361
|
await subject();
|
|
355
362
|
|
|
@@ -19,7 +19,7 @@ describe('Vite host HTML template', () => {
|
|
|
19
19
|
jest.mocked(getSharedEntryPoints).mockReturnValue({ css, js });
|
|
20
20
|
context = {
|
|
21
21
|
build: { name: 'my-mfe', isProduction: true },
|
|
22
|
-
package: { isWebComponent: false, source: __dirname },
|
|
22
|
+
package: { isWebComponent: false, source: __dirname, destination: 'dist' },
|
|
23
23
|
bundlerConfig: { pluginOverrides: {} },
|
|
24
24
|
} as ViteBuildContext;
|
|
25
25
|
});
|
|
@@ -70,13 +70,21 @@ describe('Vite host HTML template', () => {
|
|
|
70
70
|
test('renders each shared JS script', () => {
|
|
71
71
|
const html = subject();
|
|
72
72
|
|
|
73
|
-
js.forEach(item => expect(html).toContain(`<script src="./${item}"></script>`));
|
|
73
|
+
js.forEach(item => expect(html).toContain(`<script defer src="./${item}"></script>`));
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test('imports the host entry module', () => {
|
|
77
77
|
expect(subject()).toContain("import './dist/index'");
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
+
describe('with a non-default tsconfig outDir', () => {
|
|
81
|
+
beforeEach(() => (context.package.destination = 'lib'));
|
|
82
|
+
|
|
83
|
+
test('imports the entry from that directory', () => {
|
|
84
|
+
expect(subject()).toContain(`import './${context.package.destination}/index'`);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
80
88
|
describe('when web component', () => {
|
|
81
89
|
beforeEach(() => {
|
|
82
90
|
context.package.isWebComponent = true;
|
|
@@ -5,7 +5,7 @@ jest.mock('../../../core', () => ({
|
|
|
5
5
|
checkResource: jest.fn(),
|
|
6
6
|
}));
|
|
7
7
|
|
|
8
|
-
describe(ignoreModulesPlugin.name
|
|
8
|
+
describe(`[startup] ${ignoreModulesPlugin.name}`, () => {
|
|
9
9
|
const moduleName = 'some-module';
|
|
10
10
|
const context = {} as BuildContext;
|
|
11
11
|
const checker = jest.fn();
|
|
@@ -18,21 +18,32 @@ describe(ignoreModulesPlugin.name, () => {
|
|
|
18
18
|
const subject = () => ignoreModulesPlugin(context);
|
|
19
19
|
|
|
20
20
|
test('creates plugin with correct name', () => {
|
|
21
|
-
expect(subject().name).toBe('ignore-modules');
|
|
21
|
+
expect(subject().name).toBe('st:ignore-modules');
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
test('enforces pre order so it runs before built-in resolvers', () => {
|
|
25
25
|
expect(subject().enforce).toBe('pre');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
describe('resolveId filter', () => {
|
|
29
|
+
const subject = () =>
|
|
30
|
+
(ignoreModulesPlugin(context) as { resolveId: { filter: unknown } }).resolveId.filter;
|
|
31
|
+
|
|
32
|
+
test('runs the hook only for bare specifiers', () => {
|
|
33
|
+
expect(subject()).toEqual({ id: /^[@a-z]/ });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
28
37
|
describe('resolveId', () => {
|
|
29
38
|
let importer: string | undefined;
|
|
30
39
|
|
|
31
40
|
beforeEach(() => (importer = '/importer.ts'));
|
|
32
41
|
|
|
33
42
|
const subject = () => {
|
|
34
|
-
const
|
|
35
|
-
|
|
43
|
+
const { resolveId } = ignoreModulesPlugin(context) as {
|
|
44
|
+
resolveId: { handler: Function };
|
|
45
|
+
};
|
|
46
|
+
return resolveId.handler.call({}, moduleName, importer);
|
|
36
47
|
};
|
|
37
48
|
|
|
38
49
|
const itReturnsUndefined = () => {
|
|
@@ -72,14 +83,27 @@ describe(ignoreModulesPlugin.name, () => {
|
|
|
72
83
|
});
|
|
73
84
|
});
|
|
74
85
|
|
|
86
|
+
describe('load filter', () => {
|
|
87
|
+
const subject = () =>
|
|
88
|
+
(ignoreModulesPlugin(context) as { load: { filter: { id: RegExp } } }).load.filter.id;
|
|
89
|
+
|
|
90
|
+
test('matches the plugin virtual module ids', () => {
|
|
91
|
+
expect(subject().test(`${THROW_PREFIX}${moduleName}`)).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('ignores ordinary module ids', () => {
|
|
95
|
+
expect(subject().test('/src/app.tsx')).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
75
99
|
describe('load', () => {
|
|
76
100
|
let id: string;
|
|
77
101
|
|
|
78
102
|
beforeEach(() => (id = moduleName));
|
|
79
103
|
|
|
80
104
|
const subject = () => {
|
|
81
|
-
const
|
|
82
|
-
return
|
|
105
|
+
const { load } = ignoreModulesPlugin(context) as { load: { handler: Function } };
|
|
106
|
+
return load.handler.call({}, id);
|
|
83
107
|
};
|
|
84
108
|
|
|
85
109
|
test('returns undefined', () => {
|
|
@@ -11,7 +11,12 @@ describe(istanbulPlugin.name, () => {
|
|
|
11
11
|
beforeEach(() => {
|
|
12
12
|
jest.clearAllMocks();
|
|
13
13
|
jest.mocked(importEsm).mockResolvedValue({ default: mockIstanbul });
|
|
14
|
-
context = {
|
|
14
|
+
context = {
|
|
15
|
+
options: {},
|
|
16
|
+
build: {},
|
|
17
|
+
package: { destination: 'dist' },
|
|
18
|
+
bundlerConfig: {},
|
|
19
|
+
} as ViteBuildContext;
|
|
15
20
|
});
|
|
16
21
|
|
|
17
22
|
const subject = () => istanbulPlugin(context);
|
|
@@ -58,5 +63,41 @@ describe(istanbulPlugin.name, () => {
|
|
|
58
63
|
expect.objectContaining({ exclude: ['**/node_modules/**', '**/.yalc/**'] })
|
|
59
64
|
);
|
|
60
65
|
});
|
|
66
|
+
|
|
67
|
+
describe('when the package exposes shared dependencies', () => {
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
context.package.isExposeSharedDependencies = true;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('also excludes the shared dependencies', async () => {
|
|
73
|
+
await subject();
|
|
74
|
+
|
|
75
|
+
expect(mockIstanbul).toHaveBeenCalledWith(
|
|
76
|
+
expect.objectContaining({
|
|
77
|
+
exclude: [
|
|
78
|
+
'**/node_modules/**',
|
|
79
|
+
'**/.yalc/**',
|
|
80
|
+
`${context.package.destination}/bundle/shared/**`,
|
|
81
|
+
],
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('when package has custom outDir', () => {
|
|
87
|
+
const outDir = 'foo';
|
|
88
|
+
|
|
89
|
+
beforeEach(() => (context.bundlerConfig.outDir = outDir));
|
|
90
|
+
|
|
91
|
+
test('excludes custom shared dependencies location', async () => {
|
|
92
|
+
await subject();
|
|
93
|
+
|
|
94
|
+
expect(mockIstanbul).toHaveBeenCalledWith(
|
|
95
|
+
expect.objectContaining({
|
|
96
|
+
exclude: ['**/node_modules/**', '**/.yalc/**', `${outDir}/shared/**`],
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
61
102
|
});
|
|
62
103
|
});
|