@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,8 +1,12 @@
|
|
|
1
|
-
import { execSync, spawn } from 'child_process';
|
|
1
|
+
import { execFileSync, execSync, spawn } from 'child_process';
|
|
2
2
|
import { log } from '../../../utils';
|
|
3
|
-
import { runCommand, runCommandOutput } from '../cli-os';
|
|
3
|
+
import { killProcessTree, runCommand, runCommandOutput } from '../cli-os';
|
|
4
4
|
|
|
5
|
-
jest.mock('child_process', () => ({
|
|
5
|
+
jest.mock('child_process', () => ({
|
|
6
|
+
execFileSync: jest.fn(),
|
|
7
|
+
execSync: jest.fn(),
|
|
8
|
+
spawn: jest.fn(),
|
|
9
|
+
}));
|
|
6
10
|
jest.mock('../../../utils', () => ({ log: { info: jest.fn() } })); // suppress log output
|
|
7
11
|
|
|
8
12
|
describe('[startup] Cli Utils (OS)', () => {
|
|
@@ -138,4 +142,83 @@ describe('[startup] Cli Utils (OS)', () => {
|
|
|
138
142
|
expect(logInfoSpy).not.toHaveBeenCalled();
|
|
139
143
|
});
|
|
140
144
|
});
|
|
145
|
+
|
|
146
|
+
describe(`${killProcessTree.name}`, () => {
|
|
147
|
+
const pid = 1234;
|
|
148
|
+
const originalPlatform = process.platform;
|
|
149
|
+
let signal: Parameters<typeof killProcessTree>[1];
|
|
150
|
+
let killSpy: jest.SpyInstance;
|
|
151
|
+
|
|
152
|
+
function mockPlatform(platform: NodeJS.Platform) {
|
|
153
|
+
Object.defineProperty(process, 'platform', { value: platform, configurable: true });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
beforeEach(() => {
|
|
157
|
+
jest.clearAllMocks();
|
|
158
|
+
killSpy = jest.spyOn(process, 'kill').mockImplementation(jest.fn());
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
afterEach(() => mockPlatform(originalPlatform));
|
|
162
|
+
|
|
163
|
+
const subject = () => killProcessTree(pid, signal);
|
|
164
|
+
|
|
165
|
+
describe('on POSIX', () => {
|
|
166
|
+
beforeEach(() => mockPlatform('darwin'));
|
|
167
|
+
|
|
168
|
+
test('sends SIGKILL to the process tree', () => {
|
|
169
|
+
subject();
|
|
170
|
+
|
|
171
|
+
expect(killSpy).toHaveBeenCalledWith(-pid, 'SIGKILL');
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe('with a signal', () => {
|
|
175
|
+
beforeEach(() => (signal = 'SIGTERM'));
|
|
176
|
+
|
|
177
|
+
test('send the signal to the process tree', () => {
|
|
178
|
+
subject();
|
|
179
|
+
expect(killSpy).toHaveBeenCalledWith(-pid, signal);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe('when the process is already gone', () => {
|
|
184
|
+
beforeEach(() => {
|
|
185
|
+
killSpy.mockImplementation(() => {
|
|
186
|
+
throw new Error('ESRCH');
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test('does not throw', () => {
|
|
191
|
+
expect(() => killProcessTree(pid)).not.toThrow();
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
describe('on Windows', () => {
|
|
197
|
+
beforeEach(() => mockPlatform('win32'));
|
|
198
|
+
|
|
199
|
+
test('runs taskkill /F /T on the process tree', () => {
|
|
200
|
+
subject();
|
|
201
|
+
|
|
202
|
+
expect(execFileSync).toHaveBeenCalledWith('taskkill', [
|
|
203
|
+
'/pid',
|
|
204
|
+
String(pid),
|
|
205
|
+
'/t',
|
|
206
|
+
'/f',
|
|
207
|
+
]);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe('when the process is already gone', () => {
|
|
211
|
+
beforeEach(() => {
|
|
212
|
+
jest.mocked(execFileSync).mockImplementation(() => {
|
|
213
|
+
throw new Error('not found');
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('does not throw', () => {
|
|
218
|
+
subject();
|
|
219
|
+
expect(() => killProcessTree(pid)).not.toThrow();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
});
|
|
141
224
|
});
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { log } from '../../../utils';
|
|
2
2
|
import { compile } from '../compile';
|
|
3
3
|
import { lernaExec } from '../lerna-exec';
|
|
4
|
+
import { resolveBundler } from '../resolve-bundler';
|
|
4
5
|
|
|
5
6
|
jest.mock('../lerna-exec', () => ({
|
|
6
7
|
lernaExec: jest.fn(),
|
|
7
8
|
}));
|
|
8
9
|
|
|
10
|
+
jest.mock('../resolve-bundler', () => ({
|
|
11
|
+
resolveBundler: jest.fn(() => 'webpack'),
|
|
12
|
+
}));
|
|
13
|
+
|
|
9
14
|
describe('[startup] Cli Utils', () => {
|
|
10
15
|
const packages = ['foo', 'bar'];
|
|
11
16
|
let args: Parameters<typeof compile>[0];
|
|
@@ -13,17 +18,25 @@ describe('[startup] Cli Utils', () => {
|
|
|
13
18
|
beforeEach(() => {
|
|
14
19
|
jest.clearAllMocks();
|
|
15
20
|
jest.spyOn(log, 'info').mockImplementation(jest.fn()); // suppress output
|
|
21
|
+
jest.mocked(resolveBundler).mockReturnValue('webpack');
|
|
16
22
|
args = { packages };
|
|
17
23
|
});
|
|
18
24
|
|
|
19
|
-
function itRunsSwcCompilePackage({
|
|
25
|
+
function itRunsSwcCompilePackage({
|
|
26
|
+
reactRefresh,
|
|
27
|
+
watch,
|
|
28
|
+
}: { reactRefresh?: boolean; watch?: boolean } = {}) {
|
|
29
|
+
const options = [watch && '--watch', watch && reactRefresh && '--react-refresh'].filter(
|
|
30
|
+
option => typeof option === 'string'
|
|
31
|
+
);
|
|
32
|
+
|
|
20
33
|
expect(lernaExec).toHaveBeenCalledWith({
|
|
21
34
|
cmd: 'startup task swc-compile-package',
|
|
22
35
|
parallel: true,
|
|
23
36
|
scope: packages,
|
|
24
37
|
stream: true,
|
|
25
38
|
stdio: watch ? ['inherit', 'pipe', 'inherit'] : 'inherit',
|
|
26
|
-
...(
|
|
39
|
+
...(options.length ? { '--': options } : {}),
|
|
27
40
|
});
|
|
28
41
|
}
|
|
29
42
|
|
|
@@ -44,6 +57,28 @@ describe('[startup] Cli Utils', () => {
|
|
|
44
57
|
|
|
45
58
|
itRunsSwcCompilePackage({ watch: true });
|
|
46
59
|
});
|
|
60
|
+
|
|
61
|
+
describe('when bundler is vite', () => {
|
|
62
|
+
beforeEach(() => jest.mocked(resolveBundler).mockReturnValue('vite'));
|
|
63
|
+
|
|
64
|
+
test('enables react refresh and watch', async () => {
|
|
65
|
+
await subject();
|
|
66
|
+
|
|
67
|
+
itRunsSwcCompilePackage({ reactRefresh: true, watch: true });
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('with "useTsc"', () => {
|
|
71
|
+
beforeEach(() => (args.useTsc = true));
|
|
72
|
+
|
|
73
|
+
test('does not enable react refresh', async () => {
|
|
74
|
+
await subject();
|
|
75
|
+
|
|
76
|
+
expect(lernaExec).toHaveBeenCalledWith(
|
|
77
|
+
expect.objectContaining({ '--': ['--watch'] })
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
47
82
|
});
|
|
48
83
|
|
|
49
84
|
describe('with "useTsc"', () => {
|
|
@@ -68,7 +68,7 @@ describe(`[startup] cli utils (${copyFiles.name})`, () => {
|
|
|
68
68
|
|
|
69
69
|
const subject = async () => copyFiles(options);
|
|
70
70
|
|
|
71
|
-
test('copies
|
|
71
|
+
test('copies supported files from source to destination', async () => {
|
|
72
72
|
await subject();
|
|
73
73
|
|
|
74
74
|
expect(cpx.copySync).toHaveBeenCalledWith(files, destination);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { withExponentialBackoff, WithExponentialBackoffConfig } from '../with-exponential-backoff';
|
|
2
|
+
|
|
3
|
+
describe('[startup] withExponentialBackoff', () => {
|
|
4
|
+
const result = '{result}';
|
|
5
|
+
const error = new Error('{error}');
|
|
6
|
+
|
|
7
|
+
let callback: jest.Mock;
|
|
8
|
+
let config: WithExponentialBackoffConfig;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
jest.useFakeTimers();
|
|
12
|
+
callback = jest.fn();
|
|
13
|
+
config = {};
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(() => jest.useRealTimers());
|
|
17
|
+
|
|
18
|
+
const subject = () => withExponentialBackoff(callback, config);
|
|
19
|
+
|
|
20
|
+
describe('when the callback succeeds on the first attempt', () => {
|
|
21
|
+
beforeEach(() => callback.mockResolvedValue(result));
|
|
22
|
+
|
|
23
|
+
test('resolves with the result', async () => {
|
|
24
|
+
await expect(subject()).resolves.toBe(result);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('calls the callback once', async () => {
|
|
28
|
+
await subject();
|
|
29
|
+
|
|
30
|
+
expect(callback).toHaveBeenCalledTimes(1);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('when the callback fails once then succeeds', () => {
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
callback.mockRejectedValueOnce(error).mockResolvedValue(result);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const subjectAfterRetry = async () => {
|
|
40
|
+
const promise = subject();
|
|
41
|
+
await jest.advanceTimersByTimeAsync(100000);
|
|
42
|
+
return promise;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
test('resolves with the result', async () => {
|
|
46
|
+
await expect(subjectAfterRetry()).resolves.toBe(result);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('calls the callback twice', async () => {
|
|
50
|
+
await subjectAfterRetry();
|
|
51
|
+
|
|
52
|
+
expect(callback).toHaveBeenCalledTimes(2);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('with onRetry configured', () => {
|
|
56
|
+
beforeEach(() => (config.onRetry = jest.fn()));
|
|
57
|
+
|
|
58
|
+
test('calls onRetry with the initial delay and the error', async () => {
|
|
59
|
+
await subjectAfterRetry();
|
|
60
|
+
|
|
61
|
+
expect(config.onRetry).toHaveBeenCalledWith(500, error);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('when the callback keeps failing', () => {
|
|
67
|
+
beforeEach(() => callback.mockRejectedValue(error));
|
|
68
|
+
|
|
69
|
+
const subjectAfterRetries = async () => {
|
|
70
|
+
const promise = subject().catch((e: unknown) => e);
|
|
71
|
+
await jest.advanceTimersByTimeAsync(100000);
|
|
72
|
+
return promise;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
test('rejects with the underlying error', async () => {
|
|
76
|
+
await expect(subjectAfterRetries()).resolves.toBe(error);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('calls the callback maxRetries times', async () => {
|
|
80
|
+
await subjectAfterRetries();
|
|
81
|
+
|
|
82
|
+
expect(callback).toHaveBeenCalledTimes(5);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('doubles the delay passed to onRetry on each attempt', async () => {
|
|
86
|
+
config.onRetry = jest.fn();
|
|
87
|
+
|
|
88
|
+
await subjectAfterRetries();
|
|
89
|
+
|
|
90
|
+
expect(config.onRetry).toHaveBeenNthCalledWith(1, 500, error);
|
|
91
|
+
expect(config.onRetry).toHaveBeenNthCalledWith(2, 1000, error);
|
|
92
|
+
expect(config.onRetry).toHaveBeenNthCalledWith(3, 2000, error);
|
|
93
|
+
expect(config.onRetry).toHaveBeenNthCalledWith(4, 4000, error);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('with a custom maxRetries', () => {
|
|
97
|
+
beforeEach(() => (config.maxRetries = 2));
|
|
98
|
+
|
|
99
|
+
test('calls the callback maxRetries times', async () => {
|
|
100
|
+
await subjectAfterRetries();
|
|
101
|
+
|
|
102
|
+
expect(callback).toHaveBeenCalledTimes(2);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('with a custom initialDelay', () => {
|
|
107
|
+
beforeEach(() => {
|
|
108
|
+
config.initialDelay = 10;
|
|
109
|
+
config.onRetry = jest.fn();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('uses it for the first retry delay', async () => {
|
|
113
|
+
await subjectAfterRetries();
|
|
114
|
+
|
|
115
|
+
expect(config.onRetry).toHaveBeenNthCalledWith(1, 10, error);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
package/src/cli/utils/cli-npm.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { log } from '../../utils';
|
|
1
2
|
import { runCommand, runCommandOutput } from './cli-os';
|
|
3
|
+
import { withExponentialBackoff } from './with-exponential-backoff';
|
|
2
4
|
|
|
3
5
|
export interface Version {
|
|
4
6
|
name: string;
|
|
@@ -76,10 +78,23 @@ export async function npmTagVersion({
|
|
|
76
78
|
registry?: string;
|
|
77
79
|
tag: string;
|
|
78
80
|
}) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
/*
|
|
82
|
+
* Retrying with backoff because verdaccio's dist-tag write can briefly 404
|
|
83
|
+
* right after the version it targets was published (metadata propagation lag).
|
|
84
|
+
*/
|
|
85
|
+
await withExponentialBackoff(
|
|
86
|
+
() =>
|
|
87
|
+
runCommand(
|
|
88
|
+
`npm dist-tag ${
|
|
89
|
+
registry ? `--registry=${registry} ` : ''
|
|
90
|
+
}add ${packageName}@${packageVersion} ${tag}`
|
|
91
|
+
),
|
|
92
|
+
{
|
|
93
|
+
onRetry: delay =>
|
|
94
|
+
log.warning(
|
|
95
|
+
`Failed to tag ${packageName}@${packageVersion} with "${tag}", retrying in ${delay}ms...`
|
|
96
|
+
),
|
|
97
|
+
}
|
|
83
98
|
);
|
|
84
99
|
}
|
|
85
100
|
|
package/src/cli/utils/cli-os.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
execFileSync,
|
|
2
3
|
execSync,
|
|
3
4
|
ExecSyncOptionsWithBufferEncoding,
|
|
4
5
|
spawn,
|
|
@@ -79,3 +80,16 @@ export function runCommandOutput(
|
|
|
79
80
|
|
|
80
81
|
return result;
|
|
81
82
|
}
|
|
83
|
+
|
|
84
|
+
export function killProcessTree(pid: number, signal: NodeJS.Signals = 'SIGKILL') {
|
|
85
|
+
try {
|
|
86
|
+
if (process.platform === 'win32') {
|
|
87
|
+
execFileSync('taskkill', ['/pid', String(pid), '/t', '/f']);
|
|
88
|
+
} else {
|
|
89
|
+
// negative pid targets the whole process group
|
|
90
|
+
process.kill(-pid, signal);
|
|
91
|
+
}
|
|
92
|
+
} catch {
|
|
93
|
+
// tree already gone
|
|
94
|
+
}
|
|
95
|
+
}
|
package/src/cli/utils/compile.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { log } from '../../utils';
|
|
2
2
|
import { lernaExec } from './lerna-exec';
|
|
3
|
+
import { resolveBundler } from './resolve-bundler';
|
|
3
4
|
|
|
4
5
|
export function compile({
|
|
5
6
|
packages,
|
|
@@ -11,12 +12,18 @@ export function compile({
|
|
|
11
12
|
useTsc?: boolean;
|
|
12
13
|
}) {
|
|
13
14
|
log.info('Compiling TypeScript files...');
|
|
15
|
+
|
|
16
|
+
const options = [
|
|
17
|
+
watch && '--watch',
|
|
18
|
+
watch && !useTsc && resolveBundler({}) === 'vite' && '--react-refresh',
|
|
19
|
+
].filter(option => typeof option === 'string');
|
|
20
|
+
|
|
14
21
|
return lernaExec({
|
|
15
22
|
cmd: useTsc ? 'startup task tsc-compile-package' : 'startup task swc-compile-package',
|
|
16
23
|
parallel: true,
|
|
17
24
|
scope: packages,
|
|
18
25
|
stream: true,
|
|
19
26
|
stdio: watch ? ['inherit', 'pipe', 'inherit'] : 'inherit',
|
|
20
|
-
...(
|
|
27
|
+
...(options.length ? { '--': options } : {}),
|
|
21
28
|
});
|
|
22
29
|
}
|
|
@@ -7,7 +7,7 @@ import { compileLess } from './compile-less';
|
|
|
7
7
|
import { compileSass } from './compile-sass';
|
|
8
8
|
|
|
9
9
|
const assetExtensions = ['eot', 'gif', 'jpg', 'otf', 'png', 'svg', 'ttf', 'woff', 'woff2'];
|
|
10
|
-
const resourceExtensions = ['html', 'json'];
|
|
10
|
+
const resourceExtensions = ['html', 'js', 'json'];
|
|
11
11
|
export const styleExtensions = ['css', 'less', 'scss'];
|
|
12
12
|
const styleTypeDefinitionExtensions = styleExtensions.map(ext => `${ext}.d.ts`);
|
|
13
13
|
|
package/src/cli/utils/index.ts
CHANGED
|
@@ -16,7 +16,6 @@ export * from './compile';
|
|
|
16
16
|
*/
|
|
17
17
|
export * from './constants';
|
|
18
18
|
export * from './eslint';
|
|
19
|
-
export * from './get-bundle-command';
|
|
20
19
|
export * from './get-exit-code';
|
|
21
20
|
export * from './get-module-type';
|
|
22
21
|
export * from './is-module-installed';
|
|
@@ -32,3 +31,4 @@ export * from './set-node-options';
|
|
|
32
31
|
export * from './ts-config';
|
|
33
32
|
export * from './type-check';
|
|
34
33
|
export * from './watch-stdout';
|
|
34
|
+
export * from './with-exponential-backoff';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bundleConstants } from '../../core';
|
|
1
2
|
import { type Bundler, getConfiguration, log } from '../../utils';
|
|
2
3
|
|
|
3
4
|
interface BundlerArgs {
|
|
@@ -19,5 +20,5 @@ export function resolveBundler(args: BundlerArgs): Bundler {
|
|
|
19
20
|
return 'vite';
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
return getConfiguration().bundler ??
|
|
23
|
+
return getConfiguration().bundler ?? bundleConstants.defaultBundler;
|
|
23
24
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface WithExponentialBackoffConfig {
|
|
2
|
+
initialDelay?: number;
|
|
3
|
+
maxRetries?: number;
|
|
4
|
+
onRetry?: (delay: number, error: unknown) => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export async function withExponentialBackoff<T>(
|
|
8
|
+
callback: () => Promise<T>,
|
|
9
|
+
config: WithExponentialBackoffConfig = {}
|
|
10
|
+
): Promise<T> {
|
|
11
|
+
const { initialDelay = 500, maxRetries = 5, onRetry } = config;
|
|
12
|
+
|
|
13
|
+
const attempt = async (attemptNumber: number, delay: number): Promise<T> => {
|
|
14
|
+
try {
|
|
15
|
+
return await callback();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (attemptNumber >= maxRetries) {
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onRetry?.(delay, error);
|
|
22
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
23
|
+
return attempt(attemptNumber + 1, delay * 2);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return attempt(1, initialDelay);
|
|
28
|
+
}
|
package/src/core/constants.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InlineConfig } from 'vite';
|
|
2
2
|
import { createCssConfig } from '../../../vite/config/create-css-config';
|
|
3
|
-
import { istanbulPlugin, svgrPlugin } from '../../../vite/plugins';
|
|
3
|
+
import { ignoreModulesPlugin, istanbulPlugin, svgrPlugin } from '../../../vite/plugins';
|
|
4
4
|
import { viteConfig } from '../vite-config';
|
|
5
5
|
|
|
6
6
|
jest.mock('vite', () => ({
|
|
@@ -11,8 +11,9 @@ jest.mock('../../../vite/plugins');
|
|
|
11
11
|
|
|
12
12
|
describe(`[startup/cypress-config] ${viteConfig.name}`, () => {
|
|
13
13
|
const cssConfig: any = { modules: { localsConvention: 'camelCaseOnly' } };
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const mockSvgrPlugin: any = { name: 'vite-plugin-svgr' };
|
|
15
|
+
const mockIstanbulPlugin: any = { name: 'istanbul' };
|
|
16
|
+
const mockIgnoreModulesPlugin: any = { name: 'ignore-modules' };
|
|
16
17
|
|
|
17
18
|
let overrides: InlineConfig | undefined;
|
|
18
19
|
|
|
@@ -21,8 +22,9 @@ describe(`[startup/cypress-config] ${viteConfig.name}`, () => {
|
|
|
21
22
|
beforeEach(() => {
|
|
22
23
|
jest.clearAllMocks();
|
|
23
24
|
jest.mocked(createCssConfig).mockReturnValue(cssConfig);
|
|
24
|
-
jest.mocked(svgrPlugin).mockReturnValue(
|
|
25
|
-
jest.mocked(istanbulPlugin).mockReturnValue(
|
|
25
|
+
jest.mocked(svgrPlugin).mockReturnValue(mockSvgrPlugin);
|
|
26
|
+
jest.mocked(istanbulPlugin).mockReturnValue(mockIstanbulPlugin);
|
|
27
|
+
jest.mocked(ignoreModulesPlugin).mockReturnValue(mockIgnoreModulesPlugin);
|
|
26
28
|
overrides = undefined;
|
|
27
29
|
});
|
|
28
30
|
|
|
@@ -36,8 +38,20 @@ describe(`[startup/cypress-config] ${viteConfig.name}`, () => {
|
|
|
36
38
|
expect(subject().css).toBe(cssConfig);
|
|
37
39
|
});
|
|
38
40
|
|
|
39
|
-
test('
|
|
40
|
-
expect(subject().plugins).toContain(
|
|
41
|
+
test('adds the svgr plugin', () => {
|
|
42
|
+
expect(subject().plugins).toContain(mockSvgrPlugin);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('adds the istanbul plugin', () => {
|
|
46
|
+
expect(subject().plugins).toContain(mockIstanbulPlugin);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('adds the ignore-modules plugin', () => {
|
|
50
|
+
expect(subject().plugins).toContain(mockIgnoreModulesPlugin);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('registers the ignore modules plugin for the dependency pre-bundler', () => {
|
|
54
|
+
expect(subject().optimizeDeps?.rolldownOptions?.plugins).toEqual([mockIgnoreModulesPlugin]);
|
|
41
55
|
});
|
|
42
56
|
|
|
43
57
|
test('enables code coverage', () => {
|
|
@@ -48,10 +62,6 @@ describe(`[startup/cypress-config] ${viteConfig.name}`, () => {
|
|
|
48
62
|
);
|
|
49
63
|
});
|
|
50
64
|
|
|
51
|
-
test('includes the coverage plugin', () => {
|
|
52
|
-
expect(subject().plugins).toContain(istanbul);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
65
|
test('dedupes React', () => {
|
|
56
66
|
expect(subject().resolve?.dedupe).toEqual(['react', 'react-dom']);
|
|
57
67
|
});
|
|
@@ -3,12 +3,17 @@ import { getSwcOptions } from '../../../cli/tasks';
|
|
|
3
3
|
import { TSConfig } from '../../../cli/utils';
|
|
4
4
|
import { getBaseTsConfig } from '../../../utils';
|
|
5
5
|
import { JS_RULE_EXCLUDE, rulesConfig } from '../../../webpack/configs';
|
|
6
|
+
import { filterWarningsPlugin, ignorePlugin } from '../../../webpack/configs/plugins';
|
|
6
7
|
import { Overrides } from '../../../webpack/types';
|
|
7
8
|
import { webpackConfig } from '../webpack-config';
|
|
8
9
|
|
|
9
10
|
jest.mock('@servicetitan/install');
|
|
10
11
|
jest.mock('fs', () => fs);
|
|
11
12
|
jest.mock('../../../webpack/configs');
|
|
13
|
+
jest.mock('../../../webpack/configs/plugins', () => ({
|
|
14
|
+
filterWarningsPlugin: jest.fn(),
|
|
15
|
+
ignorePlugin: jest.fn(),
|
|
16
|
+
}));
|
|
12
17
|
jest.mock('../../../cli/tasks');
|
|
13
18
|
|
|
14
19
|
describe(`[startup/cypress-config] ${webpackConfig.name}`, () => {
|
|
@@ -19,12 +24,16 @@ describe(`[startup/cypress-config] ${webpackConfig.name}`, () => {
|
|
|
19
24
|
const mockSwcOptions: any = { jsc: 'foobar' };
|
|
20
25
|
const mockTsConfig = { compilerOptions: { target: 'es2020' } };
|
|
21
26
|
const mockFallbackTsConfig = { compilerOptions: { target: 'es2018' } };
|
|
27
|
+
const mockIgnorePlugin: any = { name: 'IgnorePlugin' };
|
|
28
|
+
const mockFilterWarningsPlugin = { name: 'FilterWarningsPlugin' };
|
|
22
29
|
const fallbackConfig = getBaseTsConfig();
|
|
23
30
|
|
|
24
31
|
let overrides: Overrides | undefined;
|
|
25
32
|
|
|
26
33
|
beforeEach(() => {
|
|
27
34
|
jest.clearAllMocks();
|
|
35
|
+
jest.mocked(ignorePlugin).mockReturnValue(mockIgnorePlugin);
|
|
36
|
+
jest.mocked(filterWarningsPlugin).mockReturnValue(mockFilterWarningsPlugin);
|
|
28
37
|
jest.mocked(rulesConfig).mockReturnValue({ rules: mockRules });
|
|
29
38
|
jest.mocked(getSwcOptions).mockReturnValue(mockSwcOptions);
|
|
30
39
|
vol.fromJSON({
|
|
@@ -56,6 +65,14 @@ describe(`[startup/cypress-config] ${webpackConfig.name}`, () => {
|
|
|
56
65
|
);
|
|
57
66
|
});
|
|
58
67
|
|
|
68
|
+
test('adds the ignore plugin', () => {
|
|
69
|
+
expect(subject().plugins).toContain(mockIgnorePlugin);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('adds the filter warnings plugin', () => {
|
|
73
|
+
expect(subject().plugins).toContain(mockFilterWarningsPlugin);
|
|
74
|
+
});
|
|
75
|
+
|
|
59
76
|
test('includes all rules from rulesConfig', () => {
|
|
60
77
|
const result = subject();
|
|
61
78
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InlineConfig, mergeConfig } from 'vite';
|
|
2
2
|
import { createCssConfig } from '../../vite/config/create-css-config';
|
|
3
|
-
import { istanbulPlugin, svgrPlugin } from '../../vite/plugins';
|
|
3
|
+
import { ignoreModulesPlugin, istanbulPlugin, svgrPlugin } from '../../vite/plugins';
|
|
4
4
|
import type { ViteBuildContext } from '../../vite/types';
|
|
5
5
|
|
|
6
6
|
/*
|
|
@@ -17,8 +17,22 @@ export function viteConfig(overrides?: InlineConfig): InlineConfig {
|
|
|
17
17
|
const config: InlineConfig = {
|
|
18
18
|
css: createCssConfig(false),
|
|
19
19
|
resolve: { dedupe: REACT_DEDUPE },
|
|
20
|
-
optimizeDeps: {
|
|
21
|
-
|
|
20
|
+
optimizeDeps: {
|
|
21
|
+
include: REACT_OPTIMIZE /*
|
|
22
|
+
* Top-level plugins don't run during dependency pre-bundling, so
|
|
23
|
+
* register ignoreModulesPlugin again here. Without this, missing
|
|
24
|
+
* optional peer dependencies inside pre-bundled packages throw at
|
|
25
|
+
* runtime instead of resolving to an empty module.
|
|
26
|
+
*/,
|
|
27
|
+
rolldownOptions: {
|
|
28
|
+
plugins: [ignoreModulesPlugin({ package: { dependencies: {} } })],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
plugins: [
|
|
32
|
+
svgrPlugin(context),
|
|
33
|
+
istanbulPlugin(context),
|
|
34
|
+
ignoreModulesPlugin({ package: { dependencies: {} } }),
|
|
35
|
+
],
|
|
22
36
|
};
|
|
23
37
|
|
|
24
38
|
return mergeConfig(config, overrides ?? {});
|
|
@@ -33,5 +47,6 @@ function getContext(): ViteBuildContext {
|
|
|
33
47
|
return {
|
|
34
48
|
options: { codeCoverage: true },
|
|
35
49
|
bundlerConfig: { pluginOverrides: {} },
|
|
50
|
+
package: {},
|
|
36
51
|
} as ViteBuildContext;
|
|
37
52
|
}
|
|
@@ -6,6 +6,7 @@ import { getSwcOptions } from '../../cli/tasks';
|
|
|
6
6
|
import { TSConfig } from '../../cli/utils';
|
|
7
7
|
import { getTsConfigWithFallback, log } from '../../utils';
|
|
8
8
|
import { JS_RULE_EXCLUDE, rulesConfig } from '../../webpack/configs';
|
|
9
|
+
import { filterWarningsPlugin, ignorePlugin } from '../../webpack/configs/plugins';
|
|
9
10
|
import { Overrides, WebpackBuildContext } from '../../webpack/types';
|
|
10
11
|
|
|
11
12
|
export function webpackConfig(overrides?: Overrides): Configuration {
|
|
@@ -19,6 +20,7 @@ export function webpackConfig(overrides?: Overrides): Configuration {
|
|
|
19
20
|
module: {
|
|
20
21
|
rules,
|
|
21
22
|
},
|
|
23
|
+
plugins: [ignorePlugin(context, {}), filterWarningsPlugin(context, {})],
|
|
22
24
|
resolve: {
|
|
23
25
|
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
24
26
|
},
|