@servicetitan/startup 38.0.0 → 38.2.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 +32 -10
- 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 +13 -0
- package/dist/cli/commands/command.d.ts.map +1 -0
- package/dist/cli/commands/command.js +74 -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.d.ts.map +1 -1
- package/dist/cli/commands/init.js +13 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +14 -21
- 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 -18
- 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/install.d.ts +0 -16
- package/dist/cli/commands/registry/install.d.ts.map +1 -1
- package/dist/cli/commands/registry/install.js +1 -17
- package/dist/cli/commands/registry/install.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/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 +37 -14
- 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-git.d.ts +7 -0
- package/dist/cli/utils/cli-git.d.ts.map +1 -1
- package/dist/cli/utils/cli-git.js +30 -0
- package/dist/cli/utils/cli-git.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 +7 -1
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js +42 -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/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/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +2 -1
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/telemetry/index.d.ts +3 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +21 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/telemetry.d.ts +15 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -0
- package/dist/telemetry/telemetry.js +176 -0
- package/dist/telemetry/telemetry.js.map +1 -0
- 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 +12 -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 +6 -2
- package/dist/vite/config/create-filtering-logger.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.js +1 -1
- 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/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/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 +17 -12
- 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 +32 -26
- package/src/cli/commands/__tests__/build.test.ts +81 -20
- package/src/cli/commands/__tests__/bundle-package.test.ts +65 -0
- package/src/cli/commands/__tests__/command.test.ts +154 -0
- package/src/cli/commands/__tests__/init.test.ts +1 -1
- package/src/cli/commands/__tests__/install.test.ts +5 -72
- 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 +77 -16
- package/src/cli/commands/build.ts +15 -6
- package/src/cli/commands/bundle-package.ts +20 -0
- package/src/cli/commands/command.ts +64 -0
- package/src/cli/commands/init.ts +0 -1
- package/src/cli/commands/install.ts +5 -21
- 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/install.ts +1 -6
- package/src/cli/commands/registry/start.ts +3 -2
- package/src/cli/commands/run-task.ts +8 -2
- package/src/cli/commands/start.ts +17 -6
- 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-git.test.ts +54 -3
- package/src/cli/utils/__tests__/cli-npm.test.ts +33 -0
- package/src/cli/utils/__tests__/cli-os.test.ts +183 -4
- 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-git.ts +27 -1
- package/src/cli/utils/cli-npm.ts +19 -4
- package/src/cli/utils/cli-os.ts +44 -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/storybook-config/__tests__/vite-final.test.ts +6 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +26 -12
- package/src/storybook-config/webpack-final.ts +10 -4
- package/src/telemetry/__tests__/telemetry.test.ts +326 -0
- package/src/telemetry/index.ts +2 -0
- package/src/telemetry/telemetry.ts +134 -0
- 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 +12 -4
- package/src/vite/config/__tests__/create-css-config.test.ts +2 -6
- package/src/vite/config/__tests__/create-filtering-logger.test.ts +3 -2
- package/src/vite/config/__tests__/create-vite-config.test.ts +6 -3
- package/src/vite/config/base-config.ts +13 -1
- package/src/vite/config/create-filtering-logger.ts +8 -2
- 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 +1 -1
- 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__/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 +1 -1
- 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/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/webpack/__tests__/bundle-webpack.test.ts +32 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +27 -1
- 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 +22 -11
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-exponential-backoff.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/with-exponential-backoff.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACrD;AAED,wBAAsB,sBAAsB,CAAC,CAAC,EAC1C,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC1B,MAAM,GAAE,4BAAiC,GAC1C,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "withExponentialBackoff", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return withExponentialBackoff;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
async function withExponentialBackoff(callback, config = {}) {
|
|
12
|
+
const { initialDelay = 500, maxRetries = 5, onRetry } = config;
|
|
13
|
+
const attempt = async (attemptNumber, delay)=>{
|
|
14
|
+
try {
|
|
15
|
+
return await callback();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (attemptNumber >= maxRetries) {
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
onRetry === null || onRetry === void 0 ? void 0 : onRetry(delay, error);
|
|
21
|
+
await new Promise((resolve)=>setTimeout(resolve, delay));
|
|
22
|
+
return attempt(attemptNumber + 1, delay * 2);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return attempt(1, initialDelay);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=with-exponential-backoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/with-exponential-backoff.ts"],"sourcesContent":["export interface WithExponentialBackoffConfig {\n initialDelay?: number;\n maxRetries?: number;\n onRetry?: (delay: number, error: unknown) => void;\n}\n\nexport async function withExponentialBackoff<T>(\n callback: () => Promise<T>,\n config: WithExponentialBackoffConfig = {}\n): Promise<T> {\n const { initialDelay = 500, maxRetries = 5, onRetry } = config;\n\n const attempt = async (attemptNumber: number, delay: number): Promise<T> => {\n try {\n return await callback();\n } catch (error) {\n if (attemptNumber >= maxRetries) {\n throw error;\n }\n\n onRetry?.(delay, error);\n await new Promise(resolve => setTimeout(resolve, delay));\n return attempt(attemptNumber + 1, delay * 2);\n }\n };\n\n return attempt(1, initialDelay);\n}\n"],"names":["withExponentialBackoff","callback","config","initialDelay","maxRetries","onRetry","attempt","attemptNumber","delay","error","Promise","resolve","setTimeout"],"mappings":";;;;+BAMsBA;;;eAAAA;;;AAAf,eAAeA,uBAClBC,QAA0B,EAC1BC,SAAuC,CAAC,CAAC;IAEzC,MAAM,EAAEC,eAAe,GAAG,EAAEC,aAAa,CAAC,EAAEC,OAAO,EAAE,GAAGH;IAExD,MAAMI,UAAU,OAAOC,eAAuBC;QAC1C,IAAI;YACA,OAAO,MAAMP;QACjB,EAAE,OAAOQ,OAAO;YACZ,IAAIF,iBAAiBH,YAAY;gBAC7B,MAAMK;YACV;YAEAJ,oBAAAA,8BAAAA,QAAUG,OAAOC;YACjB,MAAM,IAAIC,QAAQC,CAAAA,UAAWC,WAAWD,SAASH;YACjD,OAAOF,QAAQC,gBAAgB,GAAGC,QAAQ;QAC9C;IACJ;IAEA,OAAOF,QAAQ,GAAGH;AACtB"}
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -13,5 +13,7 @@ export declare const bundleConstants: {
|
|
|
13
13
|
readonly production: "production";
|
|
14
14
|
readonly development: "development";
|
|
15
15
|
};
|
|
16
|
+
readonly bundlers: readonly ["vite", "webpack"];
|
|
17
|
+
readonly defaultBundler: "webpack";
|
|
16
18
|
};
|
|
17
19
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiBlB,CAAC"}
|
package/dist/core/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/constants.ts"],"sourcesContent":["export const bundleConstants = {\n cssModules: {\n classnameTemplate: {\n production: '[local]__[hash:base64:5]',\n development: '[path][name]__[local]',\n },\n localsConvention: 'camelCaseOnly',\n },\n less: {\n math: 'always',\n },\n mode: {\n production: 'production',\n development: 'development',\n },\n} as const;\n"],"names":["bundleConstants","cssModules","classnameTemplate","production","development","localsConvention","less","math","mode"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,kBAAkB;IAC3BC,YAAY;QACRC,mBAAmB;YACfC,YAAY;YACZC,aAAa;QACjB;QACAC,kBAAkB;IACtB;IACAC,MAAM;QACFC,MAAM;IACV;IACAC,MAAM;QACFL,YAAY;QACZC,aAAa;IACjB;
|
|
1
|
+
{"version":3,"sources":["../../src/core/constants.ts"],"sourcesContent":["export const bundleConstants = {\n cssModules: {\n classnameTemplate: {\n production: '[local]__[hash:base64:5]',\n development: '[path][name]__[local]',\n },\n localsConvention: 'camelCaseOnly',\n },\n less: {\n math: 'always',\n },\n mode: {\n production: 'production',\n development: 'development',\n },\n bundlers: ['vite', 'webpack'],\n defaultBundler: 'webpack',\n} as const;\n"],"names":["bundleConstants","cssModules","classnameTemplate","production","development","localsConvention","less","math","mode","bundlers","defaultBundler"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,kBAAkB;IAC3BC,YAAY;QACRC,mBAAmB;YACfC,YAAY;YACZC,aAAa;QACjB;QACAC,kBAAkB;IACtB;IACAC,MAAM;QACFC,MAAM;IACV;IACAC,MAAM;QACFL,YAAY;QACZC,aAAa;IACjB;IACAK,UAAU;QAAC;QAAQ;KAAU;IAC7BC,gBAAgB;AACpB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies patch-package patches after startup is installed in a consumer project.
|
|
3
|
+
*
|
|
4
|
+
* Under npm, patch-package finds packages directly in node_modules/. Under pnpm,
|
|
5
|
+
* packages live in the .pnpm store and aren't at their expected node_modules/<pkg>
|
|
6
|
+
* paths. This script bridges the gap by creating temporary symlinks so
|
|
7
|
+
* patch-package can locate and patch them, then cleans up the symlinks afterward.
|
|
8
|
+
*
|
|
9
|
+
* Only runs when startup is installed inside a project directory (not globally
|
|
10
|
+
* or in an npx cache). Failures are logged as warnings to avoid blocking installs.
|
|
11
|
+
*/
|
|
12
|
+
const { execFileSync } = require('child_process');
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Parse patch filenames and resolve each package's install location in the
|
|
18
|
+
* .pnpm store. Returns an array of { pkg, link, target } for packages that
|
|
19
|
+
* need a temporary symlink (i.e., not already at node_modules/<pkg>).
|
|
20
|
+
*
|
|
21
|
+
* Expected filename format (patch-package convention):
|
|
22
|
+
* <name>+<version>.patch — e.g., jsdom+26.1.0.patch
|
|
23
|
+
* <name>+<version>.dev.patch — e.g., jsdom+26.1.0.dev.patch
|
|
24
|
+
* @<scope>+<name>+<version>.patch — e.g., @babel+core+7.28.5.patch
|
|
25
|
+
*/
|
|
26
|
+
function getPnpmPatchTargets(cwd, patchDir) {
|
|
27
|
+
const pnpmDir = path.join(cwd, 'node_modules', '.pnpm');
|
|
28
|
+
if (!fs.existsSync(pnpmDir)) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const targets = [];
|
|
33
|
+
for (const file of fs.readdirSync(patchDir).filter(f => f.endsWith('.patch'))) {
|
|
34
|
+
const match = file.match(/^(?<name>.+)\+\d/);
|
|
35
|
+
if (!match?.groups) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { name } = match.groups;
|
|
40
|
+
const pkg = name.replace(/\+/, '/'); // @scope+name -> @scope/name
|
|
41
|
+
const link = path.join(cwd, 'node_modules', pkg);
|
|
42
|
+
if (fs.existsSync(link)) {
|
|
43
|
+
// already exists
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const entry = fs.readdirSync(pnpmDir).find(e => e.startsWith(`${name}@`));
|
|
48
|
+
if (!entry) {
|
|
49
|
+
// package not installed (e.g., .dev patch in production install)
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
targets.push({
|
|
54
|
+
pkg,
|
|
55
|
+
link,
|
|
56
|
+
target: path.join(pnpmDir, entry, 'node_modules', pkg),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return targets;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* For pnpm, patch-package can't find packages because they live in the .pnpm
|
|
64
|
+
* store instead of node_modules/<pkg>. We create temporary symlinks so
|
|
65
|
+
* patch-package can find them, then clean up after.
|
|
66
|
+
*/
|
|
67
|
+
function addPnpmSymlinks(targets) {
|
|
68
|
+
for (const { link, target } of targets) {
|
|
69
|
+
fs.mkdirSync(path.dirname(link), { recursive: true });
|
|
70
|
+
fs.symlinkSync(target, link);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function removePnpmSymlinks(targets) {
|
|
75
|
+
for (const { link } of targets) {
|
|
76
|
+
fs.unlinkSync(link);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function main() {
|
|
81
|
+
const cwd = process.env.INIT_CWD;
|
|
82
|
+
const patchDir = path.resolve('patches');
|
|
83
|
+
const relativePatchDir = path.relative(cwd, patchDir);
|
|
84
|
+
const isInstalledInCurrentDirectory = patchDir.startsWith(path.resolve(cwd));
|
|
85
|
+
|
|
86
|
+
// Only apply patches when installed in project (as opposed to globally or in npx cache)
|
|
87
|
+
if (!fs.existsSync('package.json') || !isInstalledInCurrentDirectory) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const patchTargets = getPnpmPatchTargets(cwd, patchDir);
|
|
92
|
+
addPnpmSymlinks(patchTargets);
|
|
93
|
+
try {
|
|
94
|
+
execFileSync('patch-package', ['--error-on-fail', '--patch-dir', relativePatchDir], {
|
|
95
|
+
cwd,
|
|
96
|
+
shell: process.platform === 'win32',
|
|
97
|
+
stdio: 'inherit',
|
|
98
|
+
});
|
|
99
|
+
} finally {
|
|
100
|
+
removePnpmSymlinks(patchTargets);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Only run when executed directly (e.g., `node postinstall.js`), not when imported (e.g., in tests).
|
|
105
|
+
/* istanbul ignore next */
|
|
106
|
+
if (require.main === module) {
|
|
107
|
+
try {
|
|
108
|
+
main();
|
|
109
|
+
} catch (e) {
|
|
110
|
+
/*
|
|
111
|
+
* To avoid disrupting workflows only log warning when postinstall fails.
|
|
112
|
+
* To see detailed error, run npm with --foreground-scripts option.
|
|
113
|
+
*/
|
|
114
|
+
console.warn(`postinstall failed`, e); // eslint-disable-line no-console
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = { main };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generates bin wrapper scripts for all CLI tools exposed by startup's dependencies.
|
|
6
|
+
*
|
|
7
|
+
* pnpm uses strict node_modules isolation - only direct dependencies' bins are linked
|
|
8
|
+
* into a consumer's node_modules/.bin/. Since startup acts as a toolbox package, it
|
|
9
|
+
* needs to re-export its dependencies' bins so consumers get them automatically.
|
|
10
|
+
*
|
|
11
|
+
* Under npm these wrappers are harmless but redundant - npm links the original
|
|
12
|
+
* package's bins directly. Under pnpm, startup's wrappers are the only ones
|
|
13
|
+
* visible to consumers.
|
|
14
|
+
*
|
|
15
|
+
* This script:
|
|
16
|
+
* 1. Reads startup's dependencies from package.json
|
|
17
|
+
* 2. Resolves each dependency's `bin` entries
|
|
18
|
+
* 3. Generates thin wrapper scripts in bin/ (using shared bin/_run.js helper)
|
|
19
|
+
* 4. Removes obsolete wrappers from previous runs
|
|
20
|
+
* 5. Updates the `bin` field in startup's package.json
|
|
21
|
+
*
|
|
22
|
+
* Run: npm run prepare -w packages/startup
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
|
|
28
|
+
const GENERATED_MARKER = 'Auto-generated by scripts/generate-bin-wrappers.js';
|
|
29
|
+
|
|
30
|
+
// Packages whose bins should not be exposed to consumers
|
|
31
|
+
const SKIP_PACKAGES = new Set([
|
|
32
|
+
'@servicetitan/install', // consumers use @servicetitan/install directly
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
// Bins from transitive dependencies that startup needs to expose to consumers
|
|
36
|
+
const EXTRA_BINS = [
|
|
37
|
+
{
|
|
38
|
+
name: 'kendo-ui-license',
|
|
39
|
+
from: '@progress/kendo-licensing',
|
|
40
|
+
binPath: 'bin/kendo-ui-license.js',
|
|
41
|
+
},
|
|
42
|
+
{ name: 'nx', from: 'nx', binPath: 'bin/nx.js' },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Collect bin entries from each dependency's package.json. Skips packages in
|
|
47
|
+
* SKIP_PACKAGES, normalizes string-form bin fields to { name: path } objects,
|
|
48
|
+
* and appends EXTRA_BINS for transitive dependencies that need explicit exposure.
|
|
49
|
+
*/
|
|
50
|
+
function discoverBins(startupDirectory, dependencies) {
|
|
51
|
+
const bins = [];
|
|
52
|
+
|
|
53
|
+
for (const packageName of dependencies) {
|
|
54
|
+
if (SKIP_PACKAGES.has(packageName)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
let packageJson;
|
|
58
|
+
try {
|
|
59
|
+
const packageJsonPath = require.resolve(packageName + '/package.json', {
|
|
60
|
+
paths: [startupDirectory],
|
|
61
|
+
});
|
|
62
|
+
packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
63
|
+
} catch {
|
|
64
|
+
// Some packages block ./package.json in exports - read directly from node_modules
|
|
65
|
+
try {
|
|
66
|
+
const packageJsonPath = resolveNodeModulesPackageJson(
|
|
67
|
+
packageName,
|
|
68
|
+
startupDirectory
|
|
69
|
+
);
|
|
70
|
+
packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
71
|
+
} catch {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!packageJson.bin) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* When bin is a string the command name defaults to the package name.
|
|
82
|
+
* Strip the @scope/ prefix for scoped packages, matching npm's behavior.
|
|
83
|
+
*/
|
|
84
|
+
const entries =
|
|
85
|
+
typeof packageJson.bin === 'string'
|
|
86
|
+
? { [packageJson.name.replace(/^@.*\//, '')]: packageJson.bin }
|
|
87
|
+
: packageJson.bin;
|
|
88
|
+
|
|
89
|
+
for (const [name, binPath] of Object.entries(entries)) {
|
|
90
|
+
bins.push({ name, from: packageName, binPath });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
bins.push(...EXTRA_BINS);
|
|
95
|
+
bins.sort((a, b) => a.name.localeCompare(b.name));
|
|
96
|
+
return bins;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/*
|
|
100
|
+
* Delete previously generated wrappers that no longer correspond to a
|
|
101
|
+
* dependency. Identifies generated files by the presence of GENERATED_MARKER
|
|
102
|
+
* and removes any that aren't in the current bin list.
|
|
103
|
+
*/
|
|
104
|
+
function removeObsoleteWrappers(binDirectory, bins) {
|
|
105
|
+
const generatedNames = new Set(bins.map(bin => `${bin.name}.js`));
|
|
106
|
+
const removed = [];
|
|
107
|
+
for (const file of fs.readdirSync(binDirectory)) {
|
|
108
|
+
const filePath = path.join(binDirectory, file);
|
|
109
|
+
try {
|
|
110
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
111
|
+
if (content.includes(GENERATED_MARKER) && !generatedNames.has(file)) {
|
|
112
|
+
fs.rmSync(filePath);
|
|
113
|
+
removed.push(file);
|
|
114
|
+
}
|
|
115
|
+
} catch {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return removed;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
* Write a thin wrapper script for each bin entry. Each wrapper delegates to
|
|
124
|
+
* bin/_run.js which locates and executes the real binary. Skips files whose
|
|
125
|
+
* content is already up to date. Returns the bin entries for package.json
|
|
126
|
+
* and the list of wrappers that were added or updated.
|
|
127
|
+
*/
|
|
128
|
+
function generateWrappers(binDirectory, bins) {
|
|
129
|
+
const binEntries = {
|
|
130
|
+
startup: './bin/index.js',
|
|
131
|
+
};
|
|
132
|
+
const added = [];
|
|
133
|
+
|
|
134
|
+
for (const { name, from, binPath } of bins) {
|
|
135
|
+
const wrapperPath = path.join(binDirectory, `${name}.js`);
|
|
136
|
+
const wrapper = `#!/usr/bin/env node\n// ${GENERATED_MARKER} - wraps: ${from} -> ${binPath}\nrequire('./_run')('${from}', '${binPath}');\n`;
|
|
137
|
+
const existing = fs.existsSync(wrapperPath) && fs.readFileSync(wrapperPath, 'utf8');
|
|
138
|
+
const normalized = existing && existing.replace(/\r\n/g, '\n');
|
|
139
|
+
if (normalized !== wrapper) {
|
|
140
|
+
fs.writeFileSync(wrapperPath, wrapper);
|
|
141
|
+
fs.chmodSync(wrapperPath, 0o755);
|
|
142
|
+
added.push(name);
|
|
143
|
+
}
|
|
144
|
+
binEntries[name] = `./bin/${name}.js`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return { binEntries, added };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Walk up node_modules directories to find a dependency's package.json,
|
|
152
|
+
* handling both hoisted and nested layouts.
|
|
153
|
+
*/
|
|
154
|
+
function resolveNodeModulesPackageJson(packageName, fromDirectory) {
|
|
155
|
+
let directory = fromDirectory;
|
|
156
|
+
while (directory !== path.dirname(directory)) {
|
|
157
|
+
const candidate = path.join(directory, 'node_modules', packageName, 'package.json');
|
|
158
|
+
if (fs.existsSync(candidate)) {
|
|
159
|
+
return candidate;
|
|
160
|
+
}
|
|
161
|
+
directory = path.dirname(directory);
|
|
162
|
+
}
|
|
163
|
+
throw new Error(`Cannot find package.json for ${packageName}`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function main() {
|
|
167
|
+
const startupDirectory = path.resolve(__dirname, '..', '..');
|
|
168
|
+
const packageJsonPath = path.join(startupDirectory, 'package.json');
|
|
169
|
+
const binDirectory = path.join(startupDirectory, 'bin');
|
|
170
|
+
|
|
171
|
+
console.log('Generating bin wrappers...');
|
|
172
|
+
|
|
173
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
174
|
+
const dependencies = Object.keys(packageJson.dependencies ?? {});
|
|
175
|
+
|
|
176
|
+
const bins = discoverBins(startupDirectory, dependencies);
|
|
177
|
+
const removed = removeObsoleteWrappers(binDirectory, bins);
|
|
178
|
+
const { binEntries, added } = generateWrappers(binDirectory, bins);
|
|
179
|
+
|
|
180
|
+
if (JSON.stringify(packageJson.bin) !== JSON.stringify(binEntries)) {
|
|
181
|
+
packageJson.bin = binEntries;
|
|
182
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4) + '\n');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
for (const name of added) {
|
|
186
|
+
console.log(` added: ${name}`);
|
|
187
|
+
}
|
|
188
|
+
for (const file of removed) {
|
|
189
|
+
console.log(` removed: ${file}`);
|
|
190
|
+
}
|
|
191
|
+
const upToDate = bins.length - added.length;
|
|
192
|
+
console.log(
|
|
193
|
+
` ${added.length} added/updated, ${removed.length} removed, ${upToDate} up to date`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Only run when executed directly (e.g., `node generate-bin-wrappers.js`), not when imported (e.g., in tests).
|
|
198
|
+
/* istanbul ignore next */
|
|
199
|
+
if (require.main === module) {
|
|
200
|
+
main();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
module.exports = { main };
|
|
@@ -7,11 +7,17 @@ export declare function swc(config: SwcOptions): {
|
|
|
7
7
|
decorators: true;
|
|
8
8
|
};
|
|
9
9
|
target: import("@swc/types").JscTarget | undefined;
|
|
10
|
+
baseUrl: string | undefined;
|
|
11
|
+
paths: {
|
|
12
|
+
[from: string]: string[];
|
|
13
|
+
} | undefined;
|
|
10
14
|
transform: {
|
|
11
15
|
legacyDecorator: boolean | undefined;
|
|
12
16
|
decoratorMetadata: boolean | undefined;
|
|
13
17
|
react: {
|
|
14
18
|
runtime: "automatic";
|
|
19
|
+
refresh: boolean;
|
|
20
|
+
development: boolean;
|
|
15
21
|
};
|
|
16
22
|
};
|
|
17
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swc.d.ts","sourceRoot":"","sources":["../../src/storybook-config/swc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C,wBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU
|
|
1
|
+
{"version":3,"file":"swc.d.ts","sourceRoot":"","sources":["../../src/storybook-config/swc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C,wBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-final.d.ts","sourceRoot":"","sources":["../../src/storybook-config/webpack-final.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"webpack-final.d.ts","sourceRoot":"","sources":["../../src/storybook-config/webpack-final.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAQ7C,OAAO,EAAE,SAAS,EAAuB,MAAM,kBAAkB,CAAC;AAElE,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,GAAE,SAAc,GAAG,aAAa,CAgB5F"}
|
|
@@ -65,7 +65,8 @@ function getContext(config) {
|
|
|
65
65
|
function getPlugins(context, overrides) {
|
|
66
66
|
return [
|
|
67
67
|
(0, _plugins.miniCssExtractPlugin)(context, overrides),
|
|
68
|
-
(0, _plugins.ignorePlugin)(context, {})
|
|
68
|
+
(0, _plugins.ignorePlugin)(context, {}),
|
|
69
|
+
(0, _plugins.filterWarningsPlugin)(context, {})
|
|
69
70
|
].filter((plugin)=>!!plugin);
|
|
70
71
|
}
|
|
71
72
|
function getRules(context, overrides) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/storybook-config/webpack-final.ts"],"sourcesContent":["import { getPackageManager } from '@servicetitan/install';\nimport { inspect } from 'node:util';\nimport type { Configuration } from 'webpack';\nimport { log } from '../utils';\nimport { rulesConfig } from '../webpack/configs';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/storybook-config/webpack-final.ts"],"sourcesContent":["import { getPackageManager } from '@servicetitan/install';\nimport { inspect } from 'node:util';\nimport type { Configuration } from 'webpack';\nimport { log } from '../utils';\nimport { rulesConfig } from '../webpack/configs';\nimport {\n filterWarningsPlugin,\n ignorePlugin,\n miniCssExtractPlugin,\n} from '../webpack/configs/plugins';\nimport { Overrides, WebpackBuildContext } from '../webpack/types';\n\nexport function webpackFinal(config: Configuration, overrides: Overrides = {}): Configuration {\n const context = getContext(config);\n const rules = getRules(context, overrides);\n const plugins = getPlugins(context, overrides);\n\n /* istanbul ignore next: debug only */\n log.debug('storybook-config:webpack-final', () => inspect({ rules, plugins }, { depth: null }));\n\n return {\n ...config,\n module: {\n ...config.module,\n rules: [...transformDefaultRules(config.module?.rules), ...rules],\n },\n plugins: [...(config.plugins ?? []), ...plugins],\n };\n}\n\nfunction getContext(config: Configuration): WebpackBuildContext {\n return {\n package: {\n name: '',\n version: '',\n destination: '',\n source: '',\n dependencies: {},\n sharedDependencies: {},\n isWebComponent: false,\n isLegacyRoot: false,\n isExposeSharedDependencies: false,\n packageManager: getPackageManager(),\n },\n build: {\n name: '',\n isProduction: config.mode === 'production',\n },\n options: {},\n bundlerConfig: {},\n };\n}\n\nfunction getPlugins(context: WebpackBuildContext, overrides: Overrides) {\n return [\n miniCssExtractPlugin(context, overrides),\n ignorePlugin(context, {}),\n filterWarningsPlugin(context, {}),\n ].filter(plugin => !!plugin);\n}\n\nfunction getRules(context: WebpackBuildContext, overrides: Overrides) {\n const include = ['.module.css', '.module.less', '.less', '.module.scss', '.scss', '.svg'];\n const exclude = ['.css'];\n\n const { rules } = rulesConfig(context, overrides);\n\n return rules.filter(\n ({ test }) =>\n !(test instanceof RegExp) ||\n include.some(ext => test.exec(ext) && !exclude.some(ext => test.exec(ext)))\n );\n}\n\nfunction transformDefaultRules(rules: NonNullable<Configuration['module']>['rules'] = []) {\n const result = rules.map(rule => {\n if (rule && typeof rule === 'object' && rule.test instanceof RegExp) {\n if (rule.test.test('.css')) {\n return { ...rule, exclude: /\\.module.css$/ };\n }\n if (rule.test.test('.svg')) {\n return { ...rule, exclude: /\\.svg$/i };\n }\n }\n return rule;\n });\n\n /* istanbul ignore next: debug only */\n log.debug('storybook-config:transform-default-rules', () =>\n inspect({ result }, { depth: null })\n );\n\n return result;\n}\n"],"names":["webpackFinal","config","overrides","context","getContext","rules","getRules","plugins","getPlugins","log","debug","inspect","depth","module","transformDefaultRules","package","name","version","destination","source","dependencies","sharedDependencies","isWebComponent","isLegacyRoot","isExposeSharedDependencies","packageManager","getPackageManager","build","isProduction","mode","options","bundlerConfig","miniCssExtractPlugin","ignorePlugin","filterWarningsPlugin","filter","plugin","include","exclude","rulesConfig","test","RegExp","some","ext","exec","result","map","rule"],"mappings":";;;;+BAYgBA;;;eAAAA;;;yBAZkB;0BACV;uBAEJ;yBACQ;yBAKrB;AAGA,SAASA,aAAaC,MAAqB,EAAEC,YAAuB,CAAC,CAAC;QAcvDD;QAFuBA;IAXzC,MAAME,UAAUC,WAAWH;IAC3B,MAAMI,QAAQC,SAASH,SAASD;IAChC,MAAMK,UAAUC,WAAWL,SAASD;IAEpC,oCAAoC,GACpCO,UAAG,CAACC,KAAK,CAAC,kCAAkC,IAAMC,IAAAA,iBAAO,EAAC;YAAEN;YAAOE;QAAQ,GAAG;YAAEK,OAAO;QAAK;IAE5F,OAAO;QACH,GAAGX,MAAM;QACTY,QAAQ;YACJ,GAAGZ,OAAOY,MAAM;YAChBR,OAAO;mBAAIS,uBAAsBb,iBAAAA,OAAOY,MAAM,cAAbZ,qCAAAA,eAAeI,KAAK;mBAAMA;aAAM;QACrE;QACAE,SAAS;gBAAKN,kBAAAA,OAAOM,OAAO,cAAdN,6BAAAA,kBAAkB,EAAE;eAAMM;SAAQ;IACpD;AACJ;AAEA,SAASH,WAAWH,MAAqB;IACrC,OAAO;QACHc,SAAS;YACLC,MAAM;YACNC,SAAS;YACTC,aAAa;YACbC,QAAQ;YACRC,cAAc,CAAC;YACfC,oBAAoB,CAAC;YACrBC,gBAAgB;YAChBC,cAAc;YACdC,4BAA4B;YAC5BC,gBAAgBC,IAAAA,0BAAiB;QACrC;QACAC,OAAO;YACHX,MAAM;YACNY,cAAc3B,OAAO4B,IAAI,KAAK;QAClC;QACAC,SAAS,CAAC;QACVC,eAAe,CAAC;IACpB;AACJ;AAEA,SAASvB,WAAWL,OAA4B,EAAED,SAAoB;IAClE,OAAO;QACH8B,IAAAA,6BAAoB,EAAC7B,SAASD;QAC9B+B,IAAAA,qBAAY,EAAC9B,SAAS,CAAC;QACvB+B,IAAAA,6BAAoB,EAAC/B,SAAS,CAAC;KAClC,CAACgC,MAAM,CAACC,CAAAA,SAAU,CAAC,CAACA;AACzB;AAEA,SAAS9B,SAASH,OAA4B,EAAED,SAAoB;IAChE,MAAMmC,UAAU;QAAC;QAAe;QAAgB;QAAS;QAAgB;QAAS;KAAO;IACzF,MAAMC,UAAU;QAAC;KAAO;IAExB,MAAM,EAAEjC,KAAK,EAAE,GAAGkC,IAAAA,oBAAW,EAACpC,SAASD;IAEvC,OAAOG,MAAM8B,MAAM,CACf,CAAC,EAAEK,IAAI,EAAE,GACL,CAAEA,CAAAA,gBAAgBC,MAAK,KACvBJ,QAAQK,IAAI,CAACC,CAAAA,MAAOH,KAAKI,IAAI,CAACD,QAAQ,CAACL,QAAQI,IAAI,CAACC,CAAAA,MAAOH,KAAKI,IAAI,CAACD;AAEjF;AAEA,SAAS7B,sBAAsBT,QAAuD,EAAE;IACpF,MAAMwC,SAASxC,MAAMyC,GAAG,CAACC,CAAAA;QACrB,IAAIA,QAAQ,OAAOA,SAAS,YAAYA,KAAKP,IAAI,YAAYC,QAAQ;YACjE,IAAIM,KAAKP,IAAI,CAACA,IAAI,CAAC,SAAS;gBACxB,OAAO;oBAAE,GAAGO,IAAI;oBAAET,SAAS;gBAAgB;YAC/C;YACA,IAAIS,KAAKP,IAAI,CAACA,IAAI,CAAC,SAAS;gBACxB,OAAO;oBAAE,GAAGO,IAAI;oBAAET,SAAS;gBAAU;YACzC;QACJ;QACA,OAAOS;IACX;IAEA,oCAAoC,GACpCtC,UAAG,CAACC,KAAK,CAAC,4CAA4C,IAClDC,IAAAA,iBAAO,EAAC;YAAEkC;QAAO,GAAG;YAAEjC,OAAO;QAAK;IAGtC,OAAOiC;AACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get Telemetry () {
|
|
13
|
+
return _telemetry.Telemetry;
|
|
14
|
+
},
|
|
15
|
+
get telemetry () {
|
|
16
|
+
return _telemetry.telemetry;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _telemetry = require("./telemetry");
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/index.ts"],"sourcesContent":["export { Telemetry, telemetry } from './telemetry';\nexport type { AttributeValue, Attributes } from './telemetry';\n"],"names":["Telemetry","telemetry"],"mappings":";;;;;;;;;;;QAASA;eAAAA,oBAAS;;QAAEC;eAAAA,oBAAS;;;2BAAQ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type AttributeValue = string | number | boolean | undefined;
|
|
2
|
+
export type Attributes = Record<string, AttributeValue | Record<string, AttributeValue>>;
|
|
3
|
+
export declare class Telemetry {
|
|
4
|
+
private initPromise?;
|
|
5
|
+
private readonly pendingRequests;
|
|
6
|
+
info(name: string, attributes?: Attributes): void;
|
|
7
|
+
warn(name: string, attributes?: Attributes): void;
|
|
8
|
+
error(name: string, error: unknown, attributes?: Attributes): void;
|
|
9
|
+
flush(): Promise<void>;
|
|
10
|
+
private init;
|
|
11
|
+
private event;
|
|
12
|
+
private send;
|
|
13
|
+
}
|
|
14
|
+
export declare const telemetry: Telemetry;
|
|
15
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/telemetry/telemetry.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AACnE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;AA4DzF,qBAAa,SAAS;IAClB,OAAO,CAAC,WAAW,CAAC,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+B;IAE/D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,GAAE,UAAe,GAAG,IAAI;IAIrD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,GAAE,UAAe,GAAG,IAAI;IAIrD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,GAAE,UAAe,GAAG,IAAI;IAIhE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,IAAI;CAwBf;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}
|