@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/tasks/task.ts"],"sourcesContent":["import { formatDuration, log, readJsonSafe } from '../../utils';\n\nclass TaskTimer {\n private counter = 0;\n\n private get currentMarkName() {\n return `${this.name}[${this.counter}]`;\n }\n\n private get currentMarkList() {\n return globalThis.performance.getEntriesByName(this.currentMarkName, 'mark');\n }\n\n constructor(private readonly name: string) {\n this.start();\n }\n\n start() {\n if (this.currentMarkList.length > 0) {\n this.cancel();\n }\n\n globalThis.performance.mark(this.currentMarkName);\n }\n\n end() {\n if (this.currentMarkList.length === 0) {\n throw new Error(`There are no tasks in progress for ${this.currentMarkName}`);\n }\n\n const measure = globalThis.performance.measure(this.currentMarkName, this.currentMarkName);\n return { measure, counter: this.counter++ };\n }\n\n cancel() {\n if (this.currentMarkList.length === 0) {\n throw new Error(`There are no tasks in progress for ${this.currentMarkName}`);\n }\n\n const measure = globalThis.performance.measure(this.currentMarkName, {\n start: this.currentMarkName,\n detail: {\n status: 'cancelled',\n },\n });\n\n return { measure, counter: this.counter++ };\n }\n\n add(duration: number) {\n const measure = globalThis.performance.measure(this.currentMarkName, {\n duration,\n end: globalThis.performance.now(),\n });\n return { measure, counter: this.counter++ };\n }\n}\n\nexport interface TaskParameters {\n name: string;\n watch?: boolean;\n global: boolean;\n}\n\nexport abstract class Task {\n protected readonly watch: boolean;\n protected readonly taskTimer: TaskTimer;\n
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/tasks/task.ts"],"sourcesContent":["import { exitWhenParentExits, formatDuration, log, readJsonSafe } from '../../utils';\n\nclass TaskTimer {\n private counter = 0;\n\n private get currentMarkName() {\n return `${this.name}[${this.counter}]`;\n }\n\n private get currentMarkList() {\n return globalThis.performance.getEntriesByName(this.currentMarkName, 'mark');\n }\n\n constructor(private readonly name: string) {\n this.start();\n }\n\n start() {\n if (this.currentMarkList.length > 0) {\n this.cancel();\n }\n\n globalThis.performance.mark(this.currentMarkName);\n }\n\n end() {\n if (this.currentMarkList.length === 0) {\n throw new Error(`There are no tasks in progress for ${this.currentMarkName}`);\n }\n\n const measure = globalThis.performance.measure(this.currentMarkName, this.currentMarkName);\n return { measure, counter: this.counter++ };\n }\n\n cancel() {\n if (this.currentMarkList.length === 0) {\n throw new Error(`There are no tasks in progress for ${this.currentMarkName}`);\n }\n\n const measure = globalThis.performance.measure(this.currentMarkName, {\n start: this.currentMarkName,\n detail: {\n status: 'cancelled',\n },\n });\n\n return { measure, counter: this.counter++ };\n }\n\n add(duration: number) {\n const measure = globalThis.performance.measure(this.currentMarkName, {\n duration,\n end: globalThis.performance.now(),\n });\n return { measure, counter: this.counter++ };\n }\n}\n\nexport interface TaskParameters {\n name: string;\n watch?: boolean;\n global: boolean;\n}\n\nexport abstract class Task {\n protected readonly watch: boolean;\n protected readonly taskTimer: TaskTimer;\n protected readonly name: string;\n private readonly global: boolean;\n\n constructor({ name, watch, global }: TaskParameters) {\n this.name = name;\n this.watch = !!watch;\n this.global = global;\n this.taskTimer = new TaskTimer(name);\n this.checkRunLocation();\n }\n\n watchForParentExit(): void {\n if (this.watch) {\n exitWhenParentExits(this.name);\n }\n }\n\n protected logCompletionResults({\n measure,\n counter,\n }: {\n measure: PerformanceMeasure;\n counter: number;\n }) {\n const enumerator = counter === 0 ? 'Initial ' : 'Subsequent ';\n log.info(\n `${this.watch ? enumerator : ''}${this.name} task completed in ${formatDuration(measure.duration)}`\n );\n }\n\n private checkRunLocation() {\n const packageJson = readJsonSafe('package.json');\n if (!packageJson?.workspaces && this.global) {\n throw new Error(`Task ${this.name} has to run inside the workspace root directory`);\n }\n if ((!packageJson || packageJson.workspaces) && !this.global) {\n throw new Error(`Task ${this.name} has to run inside the package directory`);\n }\n }\n\n abstract execute(): Promise<void>;\n}\n"],"names":["Task","TaskTimer","currentMarkName","name","counter","currentMarkList","globalThis","performance","getEntriesByName","start","length","cancel","mark","end","Error","measure","detail","status","add","duration","now","watchForParentExit","watch","exitWhenParentExits","logCompletionResults","enumerator","log","info","formatDuration","checkRunLocation","packageJson","readJsonSafe","workspaces","global","taskTimer"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/tasks/tsc-compile/tsc-compile.ts"],"sourcesContent":["import {\n getPackages,\n getPackagesGraph,\n getTsConfig,\n log,\n Package,\n PackageType,\n} from '../../../utils';\nimport { CliTask } from '../cli-task';\n\ninterface Args {\n ignore?: string | string[];\n scope?: string | string[];\n watch?: boolean;\n}\n\nexport class TscCompile extends CliTask {\n constructor(private readonly args: Args) {\n super({\n name: 'tsc-compile',\n watch: args.watch,\n global: true,\n indicators: {\n end: 'Watching for file changes.',\n watchStart: 'Starting incremental compilation.',\n },\n });\n }\n\n async execute() {\n const packages = getPackages({\n scope: this.args.scope,\n ignore: this.args.ignore,\n type: [PackageType.TSC, PackageType.Bundle],\n });\n\n const tsConfigs = collapsePackages(packages).map(({ location }) => getTsConfig(location));\n\n log.debug(\n 'tsc-compile',\n `${this.args.watch ? 'watching' : 'compiling'} ${tsConfigs.join(' ')}`\n );\n\n await this.runChildProcess(\n 'tsc',\n [\n '-b',\n this.watch ? '-w' : undefined,\n '--pretty',\n '--preserveWatchOutput',\n '--emitDeclarationOnly',\n ...tsConfigs,\n ].filter(i => i !== undefined)\n );\n }\n}\n\n/**\n * Exclude dependant packages as they will be built through project references\n */\nfunction collapsePackages(packages: Package[]) {\n const dependencies = new Set(\n Object.values(getPackagesGraph({ scope: packages.map(({ name }) => name) })).flat()\n );\n\n return packages.filter(({ name }) => !dependencies.has(name));\n}\n"],"names":["TscCompile","CliTask","execute","packages","getPackages","scope","args","ignore","type","PackageType","TSC","Bundle","tsConfigs","collapsePackages","map","location","getTsConfig","log","debug","watch","join","runChildProcess","undefined","filter","i","name","global","indicators","end","watchStart","dependencies","Set","Object","values","getPackagesGraph","flat","has"],"mappings":";;;;+BAgBaA;;;eAAAA;;;uBATN;yBACiB
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/tasks/tsc-compile/tsc-compile.ts"],"sourcesContent":["import {\n getPackages,\n getPackagesGraph,\n getTsConfig,\n log,\n Package,\n PackageType,\n} from '../../../utils';\nimport { CliTask } from '../cli-task';\n\ninterface Args {\n ignore?: string | string[];\n scope?: string | string[];\n watch?: boolean;\n}\n\nexport class TscCompile extends CliTask {\n constructor(private readonly args: Args) {\n super({\n name: 'tsc-compile',\n watch: args.watch,\n global: true,\n indicators: {\n end: 'Watching for file changes.',\n watchStart: 'Starting incremental compilation.',\n },\n });\n }\n\n async execute() {\n const packages = getPackages({\n scope: this.args.scope,\n ignore: this.args.ignore,\n type: [PackageType.TSC, PackageType.Bundle],\n });\n\n const tsConfigs = collapsePackages(packages).map(({ location }) => getTsConfig(location));\n\n log.debug(\n 'tsc-compile',\n `${this.args.watch ? 'watching' : 'compiling'} ${tsConfigs.join(' ')}`\n );\n\n await this.runChildProcess(\n 'tsc',\n [\n '-b',\n this.watch ? '-w' : undefined,\n '--pretty',\n '--preserveWatchOutput',\n '--emitDeclarationOnly',\n ...tsConfigs,\n ].filter(i => i !== undefined)\n );\n }\n}\n\n/**\n * Exclude dependant packages as they will be built through project references\n */\nfunction collapsePackages(packages: Package[]) {\n const dependencies = new Set(\n Object.values(getPackagesGraph({ scope: packages.map(({ name }) => name) })).flat()\n );\n\n return packages.filter(({ name }) => !dependencies.has(name));\n}\n"],"names":["TscCompile","CliTask","execute","packages","getPackages","scope","args","ignore","type","PackageType","TSC","Bundle","tsConfigs","collapsePackages","map","location","getTsConfig","log","debug","watch","join","runChildProcess","undefined","filter","i","name","global","indicators","end","watchStart","dependencies","Set","Object","values","getPackagesGraph","flat","has"],"mappings":";;;;+BAgBaA;;;eAAAA;;;uBATN;yBACiB;;;;;;;;;;;;AAQjB,MAAMA,mBAAmBC,gBAAO;IAanC,MAAMC,UAAU;QACZ,MAAMC,WAAWC,IAAAA,kBAAW,EAAC;YACzBC,OAAO,IAAI,CAACC,IAAI,CAACD,KAAK;YACtBE,QAAQ,IAAI,CAACD,IAAI,CAACC,MAAM;YACxBC,MAAM;gBAACC,kBAAW,CAACC,GAAG;gBAAED,kBAAW,CAACE,MAAM;aAAC;QAC/C;QAEA,MAAMC,YAAYC,iBAAiBV,UAAUW,GAAG,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAKC,IAAAA,kBAAW,EAACD;QAE/EE,UAAG,CAACC,KAAK,CACL,eACA,GAAG,IAAI,CAACZ,IAAI,CAACa,KAAK,GAAG,aAAa,YAAY,CAAC,EAAEP,UAAUQ,IAAI,CAAC,MAAM;QAG1E,MAAM,IAAI,CAACC,eAAe,CACtB,OACA;YACI;YACA,IAAI,CAACF,KAAK,GAAG,OAAOG;YACpB;YACA;YACA;eACGV;SACN,CAACW,MAAM,CAACC,CAAAA,IAAKA,MAAMF;IAE5B;IArCA,YAAY,AAAiBhB,IAAU,CAAE;QACrC,KAAK,CAAC;YACFmB,MAAM;YACNN,OAAOb,KAAKa,KAAK;YACjBO,QAAQ;YACRC,YAAY;gBACRC,KAAK;gBACLC,YAAY;YAChB;QACJ,iDATyBvB,OAAAA;IAU7B;AA4BJ;AAEA;;CAEC,GACD,SAASO,iBAAiBV,QAAmB;IACzC,MAAM2B,eAAe,IAAIC,IACrBC,OAAOC,MAAM,CAACC,IAAAA,uBAAgB,EAAC;QAAE7B,OAAOF,SAASW,GAAG,CAAC,CAAC,EAAEW,IAAI,EAAE,GAAKA;IAAM,IAAIU,IAAI;IAGrF,OAAOhC,SAASoB,MAAM,CAAC,CAAC,EAAEE,IAAI,EAAE,GAAK,CAACK,aAAaM,GAAG,CAACX;AAC3D"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export declare function gitGetBranch(): string;
|
|
2
2
|
export declare function gitGetCommitHash(): string;
|
|
3
|
+
export interface GitContext {
|
|
4
|
+
repo?: string;
|
|
5
|
+
branch?: string;
|
|
6
|
+
userEmail?: string;
|
|
7
|
+
userName?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function gitGetContext(): Promise<GitContext>;
|
|
3
10
|
//# sourceMappingURL=cli-git.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-git.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-git.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-git.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAczD"}
|
|
@@ -14,14 +14,44 @@ _export(exports, {
|
|
|
14
14
|
},
|
|
15
15
|
get gitGetCommitHash () {
|
|
16
16
|
return gitGetCommitHash;
|
|
17
|
+
},
|
|
18
|
+
get gitGetContext () {
|
|
19
|
+
return gitGetContext;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
22
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
19
23
|
const _clios = require("./cli-os");
|
|
24
|
+
function _interop_require_default(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const GIT_TIMEOUT_MS = 2000;
|
|
20
30
|
function gitGetBranch() {
|
|
21
31
|
return (0, _clios.runCommandOutput)('git rev-parse --abbrev-ref HEAD').trim();
|
|
22
32
|
}
|
|
23
33
|
function gitGetCommitHash() {
|
|
24
34
|
return (0, _clios.runCommandOutput)('git rev-parse --short HEAD').trim();
|
|
25
35
|
}
|
|
36
|
+
async function gitGetContext() {
|
|
37
|
+
var _ref;
|
|
38
|
+
const options = {
|
|
39
|
+
quiet: true,
|
|
40
|
+
ignoreErrors: true,
|
|
41
|
+
timeout: GIT_TIMEOUT_MS
|
|
42
|
+
};
|
|
43
|
+
const [rev, userEmail, userName] = await Promise.all([
|
|
44
|
+
(0, _clios.runCommandOutputAsync)('git rev-parse --abbrev-ref HEAD --show-toplevel', options),
|
|
45
|
+
(0, _clios.runCommandOutputAsync)('git config user.email', options),
|
|
46
|
+
(0, _clios.runCommandOutputAsync)('git config user.name', options)
|
|
47
|
+
]);
|
|
48
|
+
const [branch, root] = (_ref = rev === null || rev === void 0 ? void 0 : rev.split('\n')) !== null && _ref !== void 0 ? _ref : [];
|
|
49
|
+
return {
|
|
50
|
+
repo: root ? _nodepath.default.basename(root) : undefined,
|
|
51
|
+
branch,
|
|
52
|
+
userEmail,
|
|
53
|
+
userName
|
|
54
|
+
};
|
|
55
|
+
}
|
|
26
56
|
|
|
27
57
|
//# sourceMappingURL=cli-git.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import { runCommandOutput } from './cli-os';\n\nexport function gitGetBranch(): string {\n return runCommandOutput('git rev-parse --abbrev-ref HEAD').trim();\n}\n\nexport function gitGetCommitHash(): string {\n return runCommandOutput('git rev-parse --short HEAD').trim();\n}\n"],"names":["gitGetBranch","gitGetCommitHash","runCommandOutput","trim"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import path from 'node:path';\nimport { runCommandOutput, runCommandOutputAsync } from './cli-os';\n\nconst GIT_TIMEOUT_MS = 2000;\n\nexport function gitGetBranch(): string {\n return runCommandOutput('git rev-parse --abbrev-ref HEAD').trim();\n}\n\nexport function gitGetCommitHash(): string {\n return runCommandOutput('git rev-parse --short HEAD').trim();\n}\n\nexport interface GitContext {\n repo?: string;\n branch?: string;\n userEmail?: string;\n userName?: string;\n}\n\nexport async function gitGetContext(): Promise<GitContext> {\n const options = { quiet: true, ignoreErrors: true, timeout: GIT_TIMEOUT_MS };\n const [rev, userEmail, userName] = await Promise.all([\n runCommandOutputAsync('git rev-parse --abbrev-ref HEAD --show-toplevel', options),\n runCommandOutputAsync('git config user.email', options),\n runCommandOutputAsync('git config user.name', options),\n ]);\n const [branch, root] = rev?.split('\\n') ?? [];\n return {\n repo: root ? path.basename(root) : undefined,\n branch,\n userEmail,\n userName,\n };\n}\n"],"names":["gitGetBranch","gitGetCommitHash","gitGetContext","GIT_TIMEOUT_MS","runCommandOutput","trim","options","quiet","ignoreErrors","timeout","rev","userEmail","userName","Promise","all","runCommandOutputAsync","branch","root","split","repo","path","basename","undefined"],"mappings":";;;;;;;;;;;QAKgBA;eAAAA;;QAIAC;eAAAA;;QAWMC;eAAAA;;;iEApBL;uBACuC;;;;;;AAExD,MAAMC,iBAAiB;AAEhB,SAASH;IACZ,OAAOI,IAAAA,uBAAgB,EAAC,mCAAmCC,IAAI;AACnE;AAEO,SAASJ;IACZ,OAAOG,IAAAA,uBAAgB,EAAC,8BAA8BC,IAAI;AAC9D;AASO,eAAeH;;IAClB,MAAMI,UAAU;QAAEC,OAAO;QAAMC,cAAc;QAAMC,SAASN;IAAe;IAC3E,MAAM,CAACO,KAAKC,WAAWC,SAAS,GAAG,MAAMC,QAAQC,GAAG,CAAC;QACjDC,IAAAA,4BAAqB,EAAC,mDAAmDT;QACzES,IAAAA,4BAAqB,EAAC,yBAAyBT;QAC/CS,IAAAA,4BAAqB,EAAC,wBAAwBT;KACjD;IACD,MAAM,CAACU,QAAQC,KAAK,WAAGP,gBAAAA,0BAAAA,IAAKQ,KAAK,CAAC,4CAAS,EAAE;IAC7C,OAAO;QACHC,MAAMF,OAAOG,iBAAI,CAACC,QAAQ,CAACJ,QAAQK;QACnCN;QACAL;QACAC;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-npm.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-npm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-npm.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-npm.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAWrF;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE,CAmB7F;AAED,wBAAgB,iBAAiB,WAOhC;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAI/F;AAED,wBAAsB,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,iBAE7E;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAE7D;AAED,wBAAsB,aAAa,CAAC,EAChC,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,GACN,EAAE;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf,iBAmBA;AAED,wBAAsB,YAAY,CAAC,EAC/B,WAAW,EACX,QAAQ,EACR,GAAG,GACN,EAAE;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACf,iBAGA;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAgB,OAAO,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,8BAY5F"}
|
|
@@ -37,7 +37,9 @@ _export(exports, {
|
|
|
37
37
|
return npmView;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
+
const _utils = require("../../utils");
|
|
40
41
|
const _clios = require("./cli-os");
|
|
42
|
+
const _withexponentialbackoff = require("./with-exponential-backoff");
|
|
41
43
|
const NPM_TIMEOUT = 10000;
|
|
42
44
|
function npmGetPackageVersions(registry, packageName) {
|
|
43
45
|
try {
|
|
@@ -101,7 +103,12 @@ async function npmPackageSet(key, value) {
|
|
|
101
103
|
await (0, _clios.runCommand)(`npm pkg set ${key}=${value}`);
|
|
102
104
|
}
|
|
103
105
|
async function npmTagVersion({ packageName, packageVersion, registry, tag }) {
|
|
104
|
-
|
|
106
|
+
/*
|
|
107
|
+
* Retrying with backoff because verdaccio's dist-tag write can briefly 404
|
|
108
|
+
* right after the version it targets was published (metadata propagation lag).
|
|
109
|
+
*/ await (0, _withexponentialbackoff.withExponentialBackoff)(()=>(0, _clios.runCommand)(`npm dist-tag ${registry ? `--registry=${registry} ` : ''}add ${packageName}@${packageVersion} ${tag}`), {
|
|
110
|
+
onRetry: (delay)=>_utils.log.warning(`Failed to tag ${packageName}@${packageVersion} with "${tag}", retrying in ${delay}ms...`)
|
|
111
|
+
});
|
|
105
112
|
}
|
|
106
113
|
async function npmRemoveTag({ packageName, registry, tag }) {
|
|
107
114
|
const registryFlag = registry ? `--registry=${registry} ` : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-npm.ts"],"sourcesContent":["import { runCommand, runCommandOutput } from './cli-os';\n\nexport interface Version {\n name: string;\n date: Date;\n tag?: string;\n}\n\nconst NPM_TIMEOUT = 10000;\n\nexport function npmGetPackageVersions(registry: string, packageName: string): string[] {\n try {\n const v = runCommandOutput(\n `npm show ${packageName} versions --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n return JSON.parse(v);\n } catch {\n return [];\n }\n}\n\nexport function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[] {\n try {\n const result = runCommandOutput(\n `npm view ${packageName} time dist-tags --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n const { time, 'dist-tags': distTags } = JSON.parse(result);\n\n const tags = Object.fromEntries(\n Object.entries(distTags).map(([tag, version]) => [version, tag])\n );\n\n return Object.keys(time).reduce((out, version) => {\n return [...out, { name: version, date: new Date(time[version]), tag: tags[version] }];\n }, []);\n } catch {\n return [];\n }\n}\n\nexport function npmGetProjectRoot() {\n return runCommandOutput('npm prefix', {\n quiet: true,\n // ignore stderr because any error here is fundamental and will be repeated elsewhere\n stdio: ['inherit', 'pipe', 'ignore'],\n timeout: NPM_TIMEOUT,\n }).trim();\n}\n\nexport async function npmUnpublish(registry: string, packageName: string, packageVersion: string) {\n await runCommand(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {\n timeout: NPM_TIMEOUT,\n });\n}\n\nexport async function npmPublish({ dry, tag }: { dry?: boolean; tag?: string }) {\n await runCommand(['npm publish', !!tag && `--tag ${tag}`, !!dry && `--dry-run`]);\n}\n\nexport async function npmPackageSet(key: string, value: string) {\n await runCommand(`npm pkg set ${key}=${value}`);\n}\n\nexport async function npmTagVersion({\n packageName,\n packageVersion,\n registry,\n tag,\n}: {\n packageName: string;\n packageVersion: string;\n registry?: string;\n tag: string;\n}) {\n await runCommand(\n
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-npm.ts"],"sourcesContent":["import { log } from '../../utils';\nimport { runCommand, runCommandOutput } from './cli-os';\nimport { withExponentialBackoff } from './with-exponential-backoff';\n\nexport interface Version {\n name: string;\n date: Date;\n tag?: string;\n}\n\nconst NPM_TIMEOUT = 10000;\n\nexport function npmGetPackageVersions(registry: string, packageName: string): string[] {\n try {\n const v = runCommandOutput(\n `npm show ${packageName} versions --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n return JSON.parse(v);\n } catch {\n return [];\n }\n}\n\nexport function npmGetPackageVersionsDetails(registry: string, packageName: string): Version[] {\n try {\n const result = runCommandOutput(\n `npm view ${packageName} time dist-tags --registry ${registry} --json`,\n { timeout: NPM_TIMEOUT }\n );\n\n const { time, 'dist-tags': distTags } = JSON.parse(result);\n\n const tags = Object.fromEntries(\n Object.entries(distTags).map(([tag, version]) => [version, tag])\n );\n\n return Object.keys(time).reduce((out, version) => {\n return [...out, { name: version, date: new Date(time[version]), tag: tags[version] }];\n }, []);\n } catch {\n return [];\n }\n}\n\nexport function npmGetProjectRoot() {\n return runCommandOutput('npm prefix', {\n quiet: true,\n // ignore stderr because any error here is fundamental and will be repeated elsewhere\n stdio: ['inherit', 'pipe', 'ignore'],\n timeout: NPM_TIMEOUT,\n }).trim();\n}\n\nexport async function npmUnpublish(registry: string, packageName: string, packageVersion: string) {\n await runCommand(`npm unpublish ${packageName}@${packageVersion} --registry ${registry}`, {\n timeout: NPM_TIMEOUT,\n });\n}\n\nexport async function npmPublish({ dry, tag }: { dry?: boolean; tag?: string }) {\n await runCommand(['npm publish', !!tag && `--tag ${tag}`, !!dry && `--dry-run`]);\n}\n\nexport async function npmPackageSet(key: string, value: string) {\n await runCommand(`npm pkg set ${key}=${value}`);\n}\n\nexport async function npmTagVersion({\n packageName,\n packageVersion,\n registry,\n tag,\n}: {\n packageName: string;\n packageVersion: string;\n registry?: string;\n tag: string;\n}) {\n /*\n * Retrying with backoff because verdaccio's dist-tag write can briefly 404\n * right after the version it targets was published (metadata propagation lag).\n */\n await withExponentialBackoff(\n () =>\n runCommand(\n `npm dist-tag ${\n registry ? `--registry=${registry} ` : ''\n }add ${packageName}@${packageVersion} ${tag}`\n ),\n {\n onRetry: delay =>\n log.warning(\n `Failed to tag ${packageName}@${packageVersion} with \"${tag}\", retrying in ${delay}ms...`\n ),\n }\n );\n}\n\nexport async function npmRemoveTag({\n packageName,\n registry,\n tag,\n}: {\n packageName: string;\n registry?: string;\n tag: string;\n}) {\n const registryFlag = registry ? `--registry=${registry} ` : '';\n await runCommand(`npm dist-tag ${registryFlag}rm ${packageName} ${tag}`);\n}\n\nexport interface NPMPackageInfo {\n 'name': string;\n 'version': string;\n 'dist-tags'?: Record<string, string>;\n 'time'?: Record<string, string>;\n 'versions'?: string[];\n}\n\nexport function npmView({ packageName, registry }: { packageName: string; registry?: string }) {\n try {\n const result = runCommandOutput(\n ['npm', 'view', '--json', registry ? `--registry=${registry}` : '', packageName],\n { quiet: true, timeout: NPM_TIMEOUT }\n );\n if (result) {\n return JSON.parse(result) as NPMPackageInfo;\n }\n } catch {\n // ignore\n }\n}\n"],"names":["npmGetPackageVersions","npmGetPackageVersionsDetails","npmGetProjectRoot","npmPackageSet","npmPublish","npmRemoveTag","npmTagVersion","npmUnpublish","npmView","NPM_TIMEOUT","registry","packageName","v","runCommandOutput","timeout","JSON","parse","result","time","distTags","tags","Object","fromEntries","entries","map","tag","version","keys","reduce","out","name","date","Date","quiet","stdio","trim","packageVersion","runCommand","dry","key","value","withExponentialBackoff","onRetry","delay","log","warning","registryFlag"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExecSyncOptionsWithBufferEncoding, SpawnOptionsWithoutStdio } from 'child_process';
|
|
1
|
+
import { ExecOptions, ExecSyncOptionsWithBufferEncoding, SpawnOptionsWithoutStdio } from 'child_process';
|
|
2
2
|
type RunCommandOptions = SpawnOptionsWithoutStdio & {
|
|
3
3
|
quiet?: boolean;
|
|
4
4
|
};
|
|
@@ -7,5 +7,11 @@ type RunCommandOutputOptions = ExecSyncOptionsWithBufferEncoding & {
|
|
|
7
7
|
quiet?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare function runCommandOutput(command: string | (string | false)[], { quiet, ...execSyncOptions }?: RunCommandOutputOptions): string;
|
|
10
|
+
type RunCommandOutputAsyncOptions = ExecOptions & {
|
|
11
|
+
quiet?: boolean;
|
|
12
|
+
ignoreErrors?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function runCommandOutputAsync(command: string, { quiet, ignoreErrors, ...execOptions }?: RunCommandOutputAsyncOptions): Promise<string | undefined>;
|
|
15
|
+
export declare function killProcessTree(pid: number, signal?: NodeJS.Signals): void;
|
|
10
16
|
export {};
|
|
11
17
|
//# sourceMappingURL=cli-os.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-os.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-os.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cli-os.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-os.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,WAAW,EAEX,iCAAiC,EAEjC,wBAAwB,EAC3B,MAAM,eAAe,CAAC;AAIvB,KAAK,iBAAiB,GAAG,wBAAwB,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAExE,wBAAsB,UAAU,CAC5B,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,EACpC,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAE,iBAAsB,iBAyCrD;AAED,KAAK,uBAAuB,GAAG,iCAAiC,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,EACpC,EAAE,KAAK,EAAE,GAAG,eAAe,EAAE,GAAE,uBAA4B,UAqB9D;AAED,KAAK,4BAA4B,GAAG,WAAW,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9F,wBAAsB,qBAAqB,CACvC,OAAO,EAAE,MAAM,EACf,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,GAAE,4BAAiC,GAC3E,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoB7B;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,OAAmB,QAW9E"}
|
package/dist/cli/utils/cli-os.js
CHANGED
|
@@ -9,14 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
get killProcessTree () {
|
|
13
|
+
return killProcessTree;
|
|
14
|
+
},
|
|
12
15
|
get runCommand () {
|
|
13
16
|
return runCommand;
|
|
14
17
|
},
|
|
15
18
|
get runCommandOutput () {
|
|
16
19
|
return runCommandOutput;
|
|
20
|
+
},
|
|
21
|
+
get runCommandOutputAsync () {
|
|
22
|
+
return runCommandOutputAsync;
|
|
17
23
|
}
|
|
18
24
|
});
|
|
19
25
|
const _child_process = require("child_process");
|
|
26
|
+
const _util = require("util");
|
|
20
27
|
const _utils = require("../../utils");
|
|
21
28
|
async function runCommand(command, { quiet, ...spawnOptions } = {}) {
|
|
22
29
|
return new Promise((resolve, reject)=>{
|
|
@@ -71,5 +78,40 @@ function runCommandOutput(command, { quiet, ...execSyncOptions } = {}) {
|
|
|
71
78
|
}
|
|
72
79
|
return result;
|
|
73
80
|
}
|
|
81
|
+
async function runCommandOutputAsync(command, { quiet, ignoreErrors, ...execOptions } = {}) {
|
|
82
|
+
if (!quiet) {
|
|
83
|
+
_utils.log.info(`Running: ${command}`);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const { stdout } = await (0, _util.promisify)(_child_process.exec)(command, execOptions);
|
|
87
|
+
const result = stdout.toString().trim();
|
|
88
|
+
if (!quiet) {
|
|
89
|
+
_utils.log.info('command finished', result);
|
|
90
|
+
}
|
|
91
|
+
return result || undefined;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (ignoreErrors) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function killProcessTree(pid, signal = 'SIGKILL') {
|
|
100
|
+
try {
|
|
101
|
+
if (process.platform === 'win32') {
|
|
102
|
+
(0, _child_process.execFileSync)('taskkill', [
|
|
103
|
+
'/pid',
|
|
104
|
+
String(pid),
|
|
105
|
+
'/t',
|
|
106
|
+
'/f'
|
|
107
|
+
]);
|
|
108
|
+
} else {
|
|
109
|
+
// negative pid targets the whole process group
|
|
110
|
+
process.kill(-pid, signal);
|
|
111
|
+
}
|
|
112
|
+
} catch (unused) {
|
|
113
|
+
// tree already gone
|
|
114
|
+
}
|
|
115
|
+
}
|
|
74
116
|
|
|
75
117
|
//# sourceMappingURL=cli-os.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-os.ts"],"sourcesContent":["import {\n execSync,\n ExecSyncOptionsWithBufferEncoding,\n spawn,\n SpawnOptionsWithoutStdio,\n} from 'child_process';\nimport { log } from '../../utils';\n\ntype RunCommandOptions = SpawnOptionsWithoutStdio & { quiet?: boolean };\n\nexport async function runCommand(\n command: string | (string | false)[],\n { quiet, ...spawnOptions }: RunCommandOptions = {}\n) {\n return new Promise<void>((resolve, reject) => {\n const commandArray: string[] = Array.isArray(command)\n ? command.reduce((acc, el) => (el ? [...acc, ...el.toString().split(' ')] : acc), [])\n : command.split(' ');\n const fullCommand = commandArray.join(' ');\n const commandName = commandArray.shift();\n\n if (!commandName) {\n reject(new Error('invalid command'));\n return;\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const proc = spawn(commandName, commandArray, {\n shell: process.platform === 'win32',\n ...spawnOptions,\n });\n\n proc.stdout.pipe(process.stdout);\n proc.stderr.pipe(process.stderr);\n\n proc.on('exit', function (code) {\n if (!quiet) {\n log.info(`command finished with code ${code}`, fullCommand);\n }\n\n if (code) {\n reject(new Error(`command exited with code: ${code}`));\n } else {\n resolve();\n }\n });\n proc.on('error', function (e) {\n reject(e);\n });\n });\n}\n\ntype RunCommandOutputOptions = ExecSyncOptionsWithBufferEncoding & { quiet?: boolean };\n\nexport function runCommandOutput(\n command: string | (string | false)[],\n { quiet, ...execSyncOptions }: RunCommandOutputOptions = {}\n) {\n const fullCommand = Array.isArray(command)\n ? command.reduce((acc, el) => (el ? [...acc, el.toString()] : acc), []).join(' ')\n : command;\n\n if (!fullCommand) {\n throw new Error();\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const result = execSync(fullCommand, execSyncOptions).toString();\n\n if (!quiet) {\n log.info('command finished', result.trim());\n }\n\n return result;\n}\n"],"names":["runCommand","runCommandOutput","command","quiet","spawnOptions","Promise","resolve","reject","commandArray","Array","isArray","reduce","acc","el","toString","split","fullCommand","join","commandName","shift","Error","log","info","proc","spawn","shell","process","platform","stdout","pipe","stderr","on","code","e","execSyncOptions","result","execSync","trim"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-os.ts"],"sourcesContent":["import {\n exec,\n execFileSync,\n ExecOptions,\n execSync,\n ExecSyncOptionsWithBufferEncoding,\n spawn,\n SpawnOptionsWithoutStdio,\n} from 'child_process';\nimport { promisify } from 'util';\nimport { log } from '../../utils';\n\ntype RunCommandOptions = SpawnOptionsWithoutStdio & { quiet?: boolean };\n\nexport async function runCommand(\n command: string | (string | false)[],\n { quiet, ...spawnOptions }: RunCommandOptions = {}\n) {\n return new Promise<void>((resolve, reject) => {\n const commandArray: string[] = Array.isArray(command)\n ? command.reduce((acc, el) => (el ? [...acc, ...el.toString().split(' ')] : acc), [])\n : command.split(' ');\n const fullCommand = commandArray.join(' ');\n const commandName = commandArray.shift();\n\n if (!commandName) {\n reject(new Error('invalid command'));\n return;\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const proc = spawn(commandName, commandArray, {\n shell: process.platform === 'win32',\n ...spawnOptions,\n });\n\n proc.stdout.pipe(process.stdout);\n proc.stderr.pipe(process.stderr);\n\n proc.on('exit', function (code) {\n if (!quiet) {\n log.info(`command finished with code ${code}`, fullCommand);\n }\n\n if (code) {\n reject(new Error(`command exited with code: ${code}`));\n } else {\n resolve();\n }\n });\n proc.on('error', function (e) {\n reject(e);\n });\n });\n}\n\ntype RunCommandOutputOptions = ExecSyncOptionsWithBufferEncoding & { quiet?: boolean };\n\nexport function runCommandOutput(\n command: string | (string | false)[],\n { quiet, ...execSyncOptions }: RunCommandOutputOptions = {}\n) {\n const fullCommand = Array.isArray(command)\n ? command.reduce((acc, el) => (el ? [...acc, el.toString()] : acc), []).join(' ')\n : command;\n\n if (!fullCommand) {\n throw new Error();\n }\n\n if (!quiet) {\n log.info(`Running: ${fullCommand}`);\n }\n\n const result = execSync(fullCommand, execSyncOptions).toString();\n\n if (!quiet) {\n log.info('command finished', result.trim());\n }\n\n return result;\n}\n\ntype RunCommandOutputAsyncOptions = ExecOptions & { quiet?: boolean; ignoreErrors?: boolean };\n\nexport async function runCommandOutputAsync(\n command: string,\n { quiet, ignoreErrors, ...execOptions }: RunCommandOutputAsyncOptions = {}\n): Promise<string | undefined> {\n if (!quiet) {\n log.info(`Running: ${command}`);\n }\n\n try {\n const { stdout } = await promisify(exec)(command, execOptions);\n const result = stdout.toString().trim();\n\n if (!quiet) {\n log.info('command finished', result);\n }\n\n return result || undefined;\n } catch (error) {\n if (ignoreErrors) {\n return undefined;\n }\n throw error;\n }\n}\n\nexport function killProcessTree(pid: number, signal: NodeJS.Signals = 'SIGKILL') {\n try {\n if (process.platform === 'win32') {\n execFileSync('taskkill', ['/pid', String(pid), '/t', '/f']);\n } else {\n // negative pid targets the whole process group\n process.kill(-pid, signal);\n }\n } catch {\n // tree already gone\n }\n}\n"],"names":["killProcessTree","runCommand","runCommandOutput","runCommandOutputAsync","command","quiet","spawnOptions","Promise","resolve","reject","commandArray","Array","isArray","reduce","acc","el","toString","split","fullCommand","join","commandName","shift","Error","log","info","proc","spawn","shell","process","platform","stdout","pipe","stderr","on","code","e","execSyncOptions","result","execSync","trim","ignoreErrors","execOptions","promisify","exec","undefined","error","pid","signal","execFileSync","String","kill"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/compile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/compile.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,EACpB,QAAQ,EACR,KAAa,EACb,MAAc,GACjB,EAAE;IACC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,6CAgBA"}
|
|
@@ -10,8 +10,13 @@ Object.defineProperty(exports, "compile", {
|
|
|
10
10
|
});
|
|
11
11
|
const _utils = require("../../utils");
|
|
12
12
|
const _lernaexec = require("./lerna-exec");
|
|
13
|
+
const _resolvebundler = require("./resolve-bundler");
|
|
13
14
|
function compile({ packages, watch = false, useTsc = false }) {
|
|
14
15
|
_utils.log.info('Compiling TypeScript files...');
|
|
16
|
+
const options = [
|
|
17
|
+
watch && '--watch',
|
|
18
|
+
watch && !useTsc && (0, _resolvebundler.resolveBundler)({}) === 'vite' && '--react-refresh'
|
|
19
|
+
].filter((option)=>typeof option === 'string');
|
|
15
20
|
return (0, _lernaexec.lernaExec)({
|
|
16
21
|
cmd: useTsc ? 'startup task tsc-compile-package' : 'startup task swc-compile-package',
|
|
17
22
|
parallel: true,
|
|
@@ -22,10 +27,8 @@ function compile({ packages, watch = false, useTsc = false }) {
|
|
|
22
27
|
'pipe',
|
|
23
28
|
'inherit'
|
|
24
29
|
] : 'inherit',
|
|
25
|
-
...
|
|
26
|
-
'--':
|
|
27
|
-
'--watch'
|
|
28
|
-
]
|
|
30
|
+
...options.length ? {
|
|
31
|
+
'--': options
|
|
29
32
|
} : {}
|
|
30
33
|
});
|
|
31
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/compile.ts"],"sourcesContent":["import { log } from '../../utils';\nimport { lernaExec } from './lerna-exec';\n\nexport function compile({\n packages,\n watch = false,\n useTsc = false,\n}: {\n packages: string[];\n watch?: boolean;\n useTsc?: boolean;\n}) {\n log.info('Compiling TypeScript files...');\n return lernaExec({\n cmd: useTsc ? 'startup task tsc-compile-package' : 'startup task swc-compile-package',\n parallel: true,\n scope: packages,\n stream: true,\n stdio: watch ? ['inherit', 'pipe', 'inherit'] : 'inherit',\n ...(
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/compile.ts"],"sourcesContent":["import { log } from '../../utils';\nimport { lernaExec } from './lerna-exec';\nimport { resolveBundler } from './resolve-bundler';\n\nexport function compile({\n packages,\n watch = false,\n useTsc = false,\n}: {\n packages: string[];\n watch?: boolean;\n useTsc?: boolean;\n}) {\n log.info('Compiling TypeScript files...');\n\n const options = [\n watch && '--watch',\n watch && !useTsc && resolveBundler({}) === 'vite' && '--react-refresh',\n ].filter(option => typeof option === 'string');\n\n return lernaExec({\n cmd: useTsc ? 'startup task tsc-compile-package' : 'startup task swc-compile-package',\n parallel: true,\n scope: packages,\n stream: true,\n stdio: watch ? ['inherit', 'pipe', 'inherit'] : 'inherit',\n ...(options.length ? { '--': options } : {}),\n });\n}\n"],"names":["compile","packages","watch","useTsc","log","info","options","resolveBundler","filter","option","lernaExec","cmd","parallel","scope","stream","stdio","length"],"mappings":";;;;+BAIgBA;;;eAAAA;;;uBAJI;2BACM;gCACK;AAExB,SAASA,QAAQ,EACpBC,QAAQ,EACRC,QAAQ,KAAK,EACbC,SAAS,KAAK,EAKjB;IACGC,UAAG,CAACC,IAAI,CAAC;IAET,MAAMC,UAAU;QACZJ,SAAS;QACTA,SAAS,CAACC,UAAUI,IAAAA,8BAAc,EAAC,CAAC,OAAO,UAAU;KACxD,CAACC,MAAM,CAACC,CAAAA,SAAU,OAAOA,WAAW;IAErC,OAAOC,IAAAA,oBAAS,EAAC;QACbC,KAAKR,SAAS,qCAAqC;QACnDS,UAAU;QACVC,OAAOZ;QACPa,QAAQ;QACRC,OAAOb,QAAQ;YAAC;YAAW;YAAQ;SAAU,GAAG;QAChD,GAAII,QAAQU,MAAM,GAAG;YAAE,MAAMV;QAAQ,IAAI,CAAC,CAAC;IAC/C;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/copy-files.ts"],"sourcesContent":["import cpx from 'cpx2';\nimport fs from 'fs';\nimport { glob } from 'glob';\nimport DtsCreator from 'typed-css-modules';\nimport { getFolders, log } from '../../utils';\nimport { compileLess } from './compile-less';\nimport { compileSass } from './compile-sass';\n\nconst assetExtensions = ['eot', 'gif', 'jpg', 'otf', 'png', 'svg', 'ttf', 'woff', 'woff2'];\nconst resourceExtensions = ['html', 'json'];\nexport const styleExtensions = ['css', 'less', 'scss'];\nconst styleTypeDefinitionExtensions = styleExtensions.map(ext => `${ext}.d.ts`);\n\nexport const supportedExtensions = [\n assetExtensions,\n resourceExtensions,\n styleExtensions,\n styleTypeDefinitionExtensions,\n].flat();\n\nconst styleModuleRegex = new RegExp(`\\\\.module\\\\.(${styleExtensions.join('|')})$`);\n\ninterface CopyFilesOptions {\n watch?: boolean;\n}\n\nexport async function copyFiles({ watch }: CopyFilesOptions) {\n const { source, destination } = getFolders();\n if (!fs.existsSync(source)) {\n return;\n }\n\n const filesPattern = `${source}/**/*.{${supportedExtensions.join()}}`;\n const creator = new DtsCreator({ camelCase: true, namedExports: true });\n const generateDefinitions = async (file: string) => {\n try {\n const css = await compile(file);\n const content = await creator.create(file, css, !!watch);\n await content.writeFile();\n } catch (error) {\n log.error(String(error));\n }\n };\n\n if (!watch) {\n const modulesPattern = `${source}/**/*.module.{${styleExtensions.join()}}`;\n log.info(`Generating types for ${modulesPattern}`);\n const modules = await glob(modulesPattern);\n await Promise.all(modules.map(generateDefinitions));\n\n log.info(`Copying ${filesPattern} -> ${destination}`);\n cpx.copySync(filesPattern, destination);\n\n return;\n }\n\n log.info(`Watching ${filesPattern} -> ${destination}`);\n cpx.watch(filesPattern, destination, {\n initialCopy: false,\n // Optimization so cpx2 doesn't waste resources watching irrelevant files\n ignore: ['__tests__', '__mocks__', '*.*', ...supportedExtensions.map(ext => `!*.${ext}`)],\n })\n .on('copy', async ({ srcPath, dstPath }: { srcPath: string; dstPath: string }) => {\n log.info(`Copied ${srcPath} -> ${dstPath}`);\n if (styleModuleRegex.test(srcPath)) {\n log.info(`Generating types for ${srcPath}`);\n await generateDefinitions(srcPath);\n }\n })\n .on('watch-error', (error: unknown) => log.error(String(error)));\n\n /* istanbul ignore next: not executed in test environment */\n if (process.env.NODE_ENV !== 'test') {\n await new Promise<void>(() => {});\n }\n}\n\nasync function compile(filePath: string) {\n if (filePath.endsWith('.less')) {\n return compileLess(filePath);\n }\n if (filePath.endsWith('.scss')) {\n return compileSass(filePath);\n }\n}\n"],"names":["copyFiles","styleExtensions","supportedExtensions","assetExtensions","resourceExtensions","styleTypeDefinitionExtensions","map","ext","flat","styleModuleRegex","RegExp","join","watch","source","destination","getFolders","fs","existsSync","filesPattern","creator","DtsCreator","camelCase","namedExports","generateDefinitions","file","css","compile","content","create","writeFile","error","log","String","modulesPattern","info","modules","glob","Promise","all","cpx","copySync","initialCopy","ignore","on","srcPath","dstPath","test","process","env","NODE_ENV","filePath","endsWith","compileLess","compileSass"],"mappings":";;;;;;;;;;;QA0BsBA;eAAAA;;QAhBTC;eAAAA;;QAGAC;eAAAA;;;6DAbG;2DACD;sBACM;wEACE;uBACS;6BACJ;6BACA;;;;;;AAE5B,MAAMC,kBAAkB;IAAC;IAAO;IAAO;IAAO;IAAO;IAAO;IAAO;IAAO;IAAQ;CAAQ;AAC1F,MAAMC,qBAAqB;IAAC;IAAQ;CAAO;
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/copy-files.ts"],"sourcesContent":["import cpx from 'cpx2';\nimport fs from 'fs';\nimport { glob } from 'glob';\nimport DtsCreator from 'typed-css-modules';\nimport { getFolders, log } from '../../utils';\nimport { compileLess } from './compile-less';\nimport { compileSass } from './compile-sass';\n\nconst assetExtensions = ['eot', 'gif', 'jpg', 'otf', 'png', 'svg', 'ttf', 'woff', 'woff2'];\nconst resourceExtensions = ['html', 'js', 'json'];\nexport const styleExtensions = ['css', 'less', 'scss'];\nconst styleTypeDefinitionExtensions = styleExtensions.map(ext => `${ext}.d.ts`);\n\nexport const supportedExtensions = [\n assetExtensions,\n resourceExtensions,\n styleExtensions,\n styleTypeDefinitionExtensions,\n].flat();\n\nconst styleModuleRegex = new RegExp(`\\\\.module\\\\.(${styleExtensions.join('|')})$`);\n\ninterface CopyFilesOptions {\n watch?: boolean;\n}\n\nexport async function copyFiles({ watch }: CopyFilesOptions) {\n const { source, destination } = getFolders();\n if (!fs.existsSync(source)) {\n return;\n }\n\n const filesPattern = `${source}/**/*.{${supportedExtensions.join()}}`;\n const creator = new DtsCreator({ camelCase: true, namedExports: true });\n const generateDefinitions = async (file: string) => {\n try {\n const css = await compile(file);\n const content = await creator.create(file, css, !!watch);\n await content.writeFile();\n } catch (error) {\n log.error(String(error));\n }\n };\n\n if (!watch) {\n const modulesPattern = `${source}/**/*.module.{${styleExtensions.join()}}`;\n log.info(`Generating types for ${modulesPattern}`);\n const modules = await glob(modulesPattern);\n await Promise.all(modules.map(generateDefinitions));\n\n log.info(`Copying ${filesPattern} -> ${destination}`);\n cpx.copySync(filesPattern, destination);\n\n return;\n }\n\n log.info(`Watching ${filesPattern} -> ${destination}`);\n cpx.watch(filesPattern, destination, {\n initialCopy: false,\n // Optimization so cpx2 doesn't waste resources watching irrelevant files\n ignore: ['__tests__', '__mocks__', '*.*', ...supportedExtensions.map(ext => `!*.${ext}`)],\n })\n .on('copy', async ({ srcPath, dstPath }: { srcPath: string; dstPath: string }) => {\n log.info(`Copied ${srcPath} -> ${dstPath}`);\n if (styleModuleRegex.test(srcPath)) {\n log.info(`Generating types for ${srcPath}`);\n await generateDefinitions(srcPath);\n }\n })\n .on('watch-error', (error: unknown) => log.error(String(error)));\n\n /* istanbul ignore next: not executed in test environment */\n if (process.env.NODE_ENV !== 'test') {\n await new Promise<void>(() => {});\n }\n}\n\nasync function compile(filePath: string) {\n if (filePath.endsWith('.less')) {\n return compileLess(filePath);\n }\n if (filePath.endsWith('.scss')) {\n return compileSass(filePath);\n }\n}\n"],"names":["copyFiles","styleExtensions","supportedExtensions","assetExtensions","resourceExtensions","styleTypeDefinitionExtensions","map","ext","flat","styleModuleRegex","RegExp","join","watch","source","destination","getFolders","fs","existsSync","filesPattern","creator","DtsCreator","camelCase","namedExports","generateDefinitions","file","css","compile","content","create","writeFile","error","log","String","modulesPattern","info","modules","glob","Promise","all","cpx","copySync","initialCopy","ignore","on","srcPath","dstPath","test","process","env","NODE_ENV","filePath","endsWith","compileLess","compileSass"],"mappings":";;;;;;;;;;;QA0BsBA;eAAAA;;QAhBTC;eAAAA;;QAGAC;eAAAA;;;6DAbG;2DACD;sBACM;wEACE;uBACS;6BACJ;6BACA;;;;;;AAE5B,MAAMC,kBAAkB;IAAC;IAAO;IAAO;IAAO;IAAO;IAAO;IAAO;IAAO;IAAQ;CAAQ;AAC1F,MAAMC,qBAAqB;IAAC;IAAQ;IAAM;CAAO;AAC1C,MAAMH,kBAAkB;IAAC;IAAO;IAAQ;CAAO;AACtD,MAAMI,gCAAgCJ,gBAAgBK,GAAG,CAACC,CAAAA,MAAO,GAAGA,IAAI,KAAK,CAAC;AAEvE,MAAML,sBAAsB;IAC/BC;IACAC;IACAH;IACAI;CACH,CAACG,IAAI;AAEN,MAAMC,mBAAmB,IAAIC,OAAO,CAAC,aAAa,EAAET,gBAAgBU,IAAI,CAAC,KAAK,EAAE,CAAC;AAM1E,eAAeX,UAAU,EAAEY,KAAK,EAAoB;IACvD,MAAM,EAAEC,MAAM,EAAEC,WAAW,EAAE,GAAGC,IAAAA,iBAAU;IAC1C,IAAI,CAACC,WAAE,CAACC,UAAU,CAACJ,SAAS;QACxB;IACJ;IAEA,MAAMK,eAAe,GAAGL,OAAO,OAAO,EAAEX,oBAAoBS,IAAI,GAAG,CAAC,CAAC;IACrE,MAAMQ,UAAU,IAAIC,wBAAU,CAAC;QAAEC,WAAW;QAAMC,cAAc;IAAK;IACrE,MAAMC,sBAAsB,OAAOC;QAC/B,IAAI;YACA,MAAMC,MAAM,MAAMC,QAAQF;YAC1B,MAAMG,UAAU,MAAMR,QAAQS,MAAM,CAACJ,MAAMC,KAAK,CAAC,CAACb;YAClD,MAAMe,QAAQE,SAAS;QAC3B,EAAE,OAAOC,OAAO;YACZC,UAAG,CAACD,KAAK,CAACE,OAAOF;QACrB;IACJ;IAEA,IAAI,CAAClB,OAAO;QACR,MAAMqB,iBAAiB,GAAGpB,OAAO,cAAc,EAAEZ,gBAAgBU,IAAI,GAAG,CAAC,CAAC;QAC1EoB,UAAG,CAACG,IAAI,CAAC,CAAC,qBAAqB,EAAED,gBAAgB;QACjD,MAAME,UAAU,MAAMC,IAAAA,UAAI,EAACH;QAC3B,MAAMI,QAAQC,GAAG,CAACH,QAAQ7B,GAAG,CAACiB;QAE9BQ,UAAG,CAACG,IAAI,CAAC,CAAC,QAAQ,EAAEhB,aAAa,IAAI,EAAEJ,aAAa;QACpDyB,aAAG,CAACC,QAAQ,CAACtB,cAAcJ;QAE3B;IACJ;IAEAiB,UAAG,CAACG,IAAI,CAAC,CAAC,SAAS,EAAEhB,aAAa,IAAI,EAAEJ,aAAa;IACrDyB,aAAG,CAAC3B,KAAK,CAACM,cAAcJ,aAAa;QACjC2B,aAAa;QACb,yEAAyE;QACzEC,QAAQ;YAAC;YAAa;YAAa;eAAUxC,oBAAoBI,GAAG,CAACC,CAAAA,MAAO,CAAC,GAAG,EAAEA,KAAK;SAAE;IAC7F,GACKoC,EAAE,CAAC,QAAQ,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAwC;QACzEd,UAAG,CAACG,IAAI,CAAC,CAAC,OAAO,EAAEU,QAAQ,IAAI,EAAEC,SAAS;QAC1C,IAAIpC,iBAAiBqC,IAAI,CAACF,UAAU;YAChCb,UAAG,CAACG,IAAI,CAAC,CAAC,qBAAqB,EAAEU,SAAS;YAC1C,MAAMrB,oBAAoBqB;QAC9B;IACJ,GACCD,EAAE,CAAC,eAAe,CAACb,QAAmBC,UAAG,CAACD,KAAK,CAACE,OAAOF;IAE5D,0DAA0D,GAC1D,IAAIiB,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;QACjC,MAAM,IAAIZ,QAAc,KAAO;IACnC;AACJ;AAEA,eAAeX,QAAQwB,QAAgB;IACnC,IAAIA,SAASC,QAAQ,CAAC,UAAU;QAC5B,OAAOC,IAAAA,wBAAW,EAACF;IACvB;IACA,IAAIA,SAASC,QAAQ,CAAC,UAAU;QAC5B,OAAOE,IAAAA,wBAAW,EAACH;IACvB;AACJ"}
|
|
@@ -6,7 +6,6 @@ export * from './cli-os';
|
|
|
6
6
|
export * from './compile';
|
|
7
7
|
export * from './constants';
|
|
8
8
|
export * from './eslint';
|
|
9
|
-
export * from './get-bundle-command';
|
|
10
9
|
export * from './get-exit-code';
|
|
11
10
|
export * from './get-module-type';
|
|
12
11
|
export * from './is-module-installed';
|
|
@@ -21,4 +20,5 @@ export * from './set-node-options';
|
|
|
21
20
|
export * from './ts-config';
|
|
22
21
|
export * from './type-check';
|
|
23
22
|
export * from './watch-stdout';
|
|
23
|
+
export * from './with-exponential-backoff';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAW1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAW1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC"}
|
package/dist/cli/utils/index.js
CHANGED
|
@@ -10,7 +10,6 @@ _export_star(require("./cli-os"), exports);
|
|
|
10
10
|
_export_star(require("./compile"), exports);
|
|
11
11
|
_export_star(require("./constants"), exports);
|
|
12
12
|
_export_star(require("./eslint"), exports);
|
|
13
|
-
_export_star(require("./get-bundle-command"), exports);
|
|
14
13
|
_export_star(require("./get-exit-code"), exports);
|
|
15
14
|
_export_star(require("./get-module-type"), exports);
|
|
16
15
|
_export_star(require("./is-module-installed"), exports);
|
|
@@ -25,6 +24,7 @@ _export_star(require("./set-node-options"), exports);
|
|
|
25
24
|
_export_star(require("./ts-config"), exports);
|
|
26
25
|
_export_star(require("./type-check"), exports);
|
|
27
26
|
_export_star(require("./watch-stdout"), exports);
|
|
27
|
+
_export_star(require("./with-exponential-backoff"), exports);
|
|
28
28
|
function _export_star(from, to) {
|
|
29
29
|
Object.keys(from).forEach(function(k) {
|
|
30
30
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './check-args';\nexport * from './check-startup-location';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\n/*\n * These modules eagerly load heavy dependencies (less, sass). Importing them\n * from the barrel causes every test that touches cli/utils to pay that cost\n * and spams \"Less has finished and no sheets were loaded\" in test output.\n * Import directly from the module instead (e.g., import { copyFiles } from './copy-files').\n *\n * export * from './compile-less';\n * export * from './compile-sass';\n * export * from './copy-files';\n */\nexport * from './constants';\nexport * from './eslint';\nexport * from './get-
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/index.ts"],"sourcesContent":["export * from './check-args';\nexport * from './check-startup-location';\nexport * from './cli-git';\nexport * from './cli-npm';\nexport * from './cli-os';\nexport * from './compile';\n/*\n * These modules eagerly load heavy dependencies (less, sass). Importing them\n * from the barrel causes every test that touches cli/utils to pay that cost\n * and spams \"Less has finished and no sheets were loaded\" in test output.\n * Import directly from the module instead (e.g., import { copyFiles } from './copy-files').\n *\n * export * from './compile-less';\n * export * from './compile-sass';\n * export * from './copy-files';\n */\nexport * from './constants';\nexport * from './eslint';\nexport * from './get-exit-code';\nexport * from './get-module-type';\nexport * from './is-module-installed';\nexport * from './is-tty';\nexport * from './lerna-exec';\nexport * from './maybe-create-git-folder';\nexport * from './pipe-stdout';\nexport * from './process-tree';\nexport * from './publish';\nexport * from './resolve-bundler';\nexport * from './set-node-options';\n// Don't export ./stylelint, it breaks tests using the default \"jsdom\" environment\nexport * from './ts-config';\nexport * from './type-check';\nexport * from './watch-stdout';\nexport * from './with-exponential-backoff';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBAWA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBAEA;qBACA;qBACA;qBACA"}
|
|
@@ -14,15 +14,11 @@ function _check_private_redeclaration(obj, privateCollection) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function _class_apply_descriptor_get(receiver, descriptor) {
|
|
17
|
-
if (descriptor.get)
|
|
18
|
-
return descriptor.get.call(receiver);
|
|
19
|
-
}
|
|
17
|
+
if (descriptor.get) return descriptor.get.call(receiver);
|
|
20
18
|
return descriptor.value;
|
|
21
19
|
}
|
|
22
20
|
function _class_extract_field_descriptor(receiver, privateMap, action) {
|
|
23
|
-
if (!privateMap.has(receiver))
|
|
24
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
25
|
-
}
|
|
21
|
+
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
26
22
|
return privateMap.get(receiver);
|
|
27
23
|
}
|
|
28
24
|
function _class_private_field_get(receiver, privateMap) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/process-tree.ts"],"sourcesContent":["interface HandlerResultObject {\n process: Promise<unknown>;\n onComplete?: Promise<unknown>;\n}\n\nexport type HandlerResult = HandlerResultObject | Promise<unknown>;\n\nfunction isHandlerResultObject(result: HandlerResult): result is HandlerResultObject {\n return 'process' in result;\n}\n\nexport class ProcessTree<T extends Record<any, any> = never> {\n readonly #entries: Map<\n T,\n {\n handler: () => HandlerResult;\n dependsOn: T[keyof T][];\n process?: Promise<unknown>;\n onComplete?: Promise<unknown>;\n }\n > = new Map();\n\n add(\n name: T[keyof T],\n handler: () => HandlerResult,\n {\n dependsOn = [],\n }: {\n dependsOn?: T[keyof T][];\n } = {}\n ) {\n dependsOn.forEach(item => {\n if (!this.#entries.has(item)) {\n throw new Error(`Unknown process dependency: ${item}`);\n }\n });\n this.#entries.set(name, { handler, dependsOn });\n }\n\n run() {\n [...this.#entries.keys()].forEach(item => {\n const entry = this.#entries.get(item)!;\n\n const handlerResult = Promise.all(\n entry.dependsOn.map(item => this.#entries.get(item)!.onComplete).filter(el => !!el)\n ).then(() => ({ result: entry.handler() }));\n\n entry.process = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? result.process : result\n );\n entry.onComplete = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? (result.onComplete ?? result.process) : result\n );\n });\n return Promise.all(\n [...this.#entries.values()].map(item => item.process).filter(el => !!el)\n );\n }\n}\n"],"names":["ProcessTree","isHandlerResultObject","result","add","name","handler","dependsOn","forEach","item","has","Error","set","run","keys","entry","get","handlerResult","Promise","all","map","onComplete","filter","el","then","process","values","Map"],"mappings":";;;;+BAWaA;;;eAAAA
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/process-tree.ts"],"sourcesContent":["interface HandlerResultObject {\n process: Promise<unknown>;\n onComplete?: Promise<unknown>;\n}\n\nexport type HandlerResult = HandlerResultObject | Promise<unknown>;\n\nfunction isHandlerResultObject(result: HandlerResult): result is HandlerResultObject {\n return 'process' in result;\n}\n\nexport class ProcessTree<T extends Record<any, any> = never> {\n readonly #entries: Map<\n T,\n {\n handler: () => HandlerResult;\n dependsOn: T[keyof T][];\n process?: Promise<unknown>;\n onComplete?: Promise<unknown>;\n }\n > = new Map();\n\n add(\n name: T[keyof T],\n handler: () => HandlerResult,\n {\n dependsOn = [],\n }: {\n dependsOn?: T[keyof T][];\n } = {}\n ) {\n dependsOn.forEach(item => {\n if (!this.#entries.has(item)) {\n throw new Error(`Unknown process dependency: ${item}`);\n }\n });\n this.#entries.set(name, { handler, dependsOn });\n }\n\n run() {\n [...this.#entries.keys()].forEach(item => {\n const entry = this.#entries.get(item)!;\n\n const handlerResult = Promise.all(\n entry.dependsOn.map(item => this.#entries.get(item)!.onComplete).filter(el => !!el)\n ).then(() => ({ result: entry.handler() }));\n\n entry.process = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? result.process : result\n );\n entry.onComplete = handlerResult.then(({ result }) =>\n isHandlerResultObject(result) ? (result.onComplete ?? result.process) : result\n );\n });\n return Promise.all(\n [...this.#entries.values()].map(item => item.process).filter(el => !!el)\n );\n }\n}\n"],"names":["ProcessTree","isHandlerResultObject","result","add","name","handler","dependsOn","forEach","item","has","Error","set","run","keys","entry","get","handlerResult","Promise","all","map","onComplete","filter","el","then","process","values","Map"],"mappings":";;;;+BAWaA;;;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;AAJb,SAASC,sBAAsBC,MAAqB;IAChD,OAAO,aAAaA;AACxB;IAGa;AADN,MAAMF;IAWTG,IACIC,IAAgB,EAChBC,OAA4B,EAC5B,EACIC,YAAY,EAAE,EAGjB,GAAG,CAAC,CAAC,EACR;QACEA,UAAUC,OAAO,CAACC,CAAAA;YACd,IAAI,CAAC,yBAAA,IAAI,EAAC,UAASC,GAAG,CAACD,OAAO;gBAC1B,MAAM,IAAIE,MAAM,CAAC,4BAA4B,EAAEF,MAAM;YACzD;QACJ;QACA,yBAAA,IAAI,EAAC,UAASG,GAAG,CAACP,MAAM;YAAEC;YAASC;QAAU;IACjD;IAEAM,MAAM;QACF;eAAI,yBAAA,IAAI,EAAC,UAASC,IAAI;SAAG,CAACN,OAAO,CAACC,CAAAA;YAC9B,MAAMM,QAAQ,yBAAA,IAAI,EAAC,UAASC,GAAG,CAACP;YAEhC,MAAMQ,gBAAgBC,QAAQC,GAAG,CAC7BJ,MAAMR,SAAS,CAACa,GAAG,CAACX,CAAAA,OAAQ,yBAAA,IAAI,EAAC,UAASO,GAAG,CAACP,MAAOY,UAAU,EAAEC,MAAM,CAACC,CAAAA,KAAM,CAAC,CAACA,KAClFC,IAAI,CAAC,IAAO,CAAA;oBAAErB,QAAQY,MAAMT,OAAO;gBAAG,CAAA;YAExCS,MAAMU,OAAO,GAAGR,cAAcO,IAAI,CAAC,CAAC,EAAErB,MAAM,EAAE,GAC1CD,sBAAsBC,UAAUA,OAAOsB,OAAO,GAAGtB;YAErDY,MAAMM,UAAU,GAAGJ,cAAcO,IAAI,CAAC,CAAC,EAAErB,MAAM,EAAE;oBACZA;uBAAjCD,sBAAsBC,WAAWA,qBAAAA,OAAOkB,UAAU,cAAjBlB,gCAAAA,qBAAqBA,OAAOsB,OAAO,GAAItB;;QAEhF;QACA,OAAOe,QAAQC,GAAG,CACd;eAAI,yBAAA,IAAI,EAAC,UAASO,MAAM;SAAG,CAACN,GAAG,CAACX,CAAAA,OAAQA,KAAKgB,OAAO,EAAEH,MAAM,CAACC,CAAAA,KAAM,CAAC,CAACA;IAE7E;;QA7CA,gCAAS;;mBAQL,IAAII;;;AAsCZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-bundler.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/resolve-bundler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-bundler.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/resolve-bundler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,aAAa,CAAC;AAElE,UAAU,WAAW;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAWzD"}
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "resolveBundler", {
|
|
|
8
8
|
return resolveBundler;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _core = require("../../core");
|
|
11
12
|
const _utils = require("../../utils");
|
|
12
13
|
function resolveBundler(args) {
|
|
13
14
|
var _getConfiguration_bundler;
|
|
@@ -18,7 +19,7 @@ function resolveBundler(args) {
|
|
|
18
19
|
_utils.log.warning('--use-vite is deprecated. Use --bundler=vite instead.');
|
|
19
20
|
return 'vite';
|
|
20
21
|
}
|
|
21
|
-
return (_getConfiguration_bundler = (0, _utils.getConfiguration)().bundler) !== null && _getConfiguration_bundler !== void 0 ? _getConfiguration_bundler :
|
|
22
|
+
return (_getConfiguration_bundler = (0, _utils.getConfiguration)().bundler) !== null && _getConfiguration_bundler !== void 0 ? _getConfiguration_bundler : _core.bundleConstants.defaultBundler;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
//# sourceMappingURL=resolve-bundler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/resolve-bundler.ts"],"sourcesContent":["import { type Bundler, getConfiguration, log } from '../../utils';\n\ninterface BundlerArgs {\n bundler?: Bundler;\n useVite?: boolean;\n}\n\n/*\n * Resolves the bundler from the --bundler flag, then the deprecated --use-vite\n * flag, then the cli.bundler package.json config, then the webpack default.\n */\nexport function resolveBundler(args: BundlerArgs): Bundler {\n if (args.bundler) {\n return args.bundler;\n }\n\n if (args.useVite) {\n log.warning('--use-vite is deprecated. Use --bundler=vite instead.');\n return 'vite';\n }\n\n return getConfiguration().bundler ??
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/resolve-bundler.ts"],"sourcesContent":["import { bundleConstants } from '../../core';\nimport { type Bundler, getConfiguration, log } from '../../utils';\n\ninterface BundlerArgs {\n bundler?: Bundler;\n useVite?: boolean;\n}\n\n/*\n * Resolves the bundler from the --bundler flag, then the deprecated --use-vite\n * flag, then the cli.bundler package.json config, then the webpack default.\n */\nexport function resolveBundler(args: BundlerArgs): Bundler {\n if (args.bundler) {\n return args.bundler;\n }\n\n if (args.useVite) {\n log.warning('--use-vite is deprecated. Use --bundler=vite instead.');\n return 'vite';\n }\n\n return getConfiguration().bundler ?? bundleConstants.defaultBundler;\n}\n"],"names":["resolveBundler","args","getConfiguration","bundler","useVite","log","warning","bundleConstants","defaultBundler"],"mappings":";;;;+BAYgBA;;;eAAAA;;;sBAZgB;uBACoB;AAW7C,SAASA,eAAeC,IAAiB;QAUrCC;IATP,IAAID,KAAKE,OAAO,EAAE;QACd,OAAOF,KAAKE,OAAO;IACvB;IAEA,IAAIF,KAAKG,OAAO,EAAE;QACdC,UAAG,CAACC,OAAO,CAAC;QACZ,OAAO;IACX;IAEA,QAAOJ,4BAAAA,IAAAA,uBAAgB,IAAGC,OAAO,cAA1BD,uCAAAA,4BAA8BK,qBAAe,CAACC,cAAc;AACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-config.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/ts-config.ts"],"names":[],"mappings":"AAIA,qBAAa,QAAQ;IAGL,
|
|
1
|
+
{"version":3,"file":"ts-config.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/ts-config.ts"],"names":[],"mappings":"AAIA,qBAAa,QAAQ;IAGL,QAAQ,CAAC,UAAU,EAAE,MAAM;IAFvC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;gBAEnB,UAAU,EAAE,MAAM;IAKvC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAOzD,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,OAAO;CAUlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/ts-config.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { readJson } from '../../utils';\n\nexport class TSConfig {\n private readonly json: Map<string, any>;\n\n constructor(
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/ts-config.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { readJson } from '../../utils';\n\nexport class TSConfig {\n private readonly json: Map<string, any>;\n\n constructor(readonly configPath: string) {\n this.json = new Map();\n }\n\n // Overload signatures\n getValue<T>(key: string, defaultValue: T): NoInfer<T>;\n getValue<T>(key: string, defaultValue?: T): T | undefined;\n\n // Implementation signature\n getValue<T>(key: string, defaultValue?: T) {\n return this.getValueInternal<T>(this.configPath, key.split('.'), defaultValue);\n }\n\n private getValueInternal<T>(configPath: string, key: string[], defaultValue?: T): T {\n const config = this.getJson<{ extends?: string }>(configPath);\n const value = key.reduce<any>((result, el) => {\n return result && typeof result === 'object' ? result[el] : undefined;\n }, config);\n\n if (value !== undefined) {\n return value;\n }\n\n const extendsPath = this.getExtendsPath(configPath, config);\n if (extendsPath) {\n return this.getValueInternal(extendsPath, key, defaultValue);\n }\n\n return defaultValue as T;\n }\n\n private getExtendsPath(configPath: string, config: { extends?: string }) {\n if (!config.extends) {\n return;\n }\n\n if (!/^\\.?\\.\\//.test(config.extends)) {\n return require.resolve(config.extends);\n }\n\n const dir = path.dirname(configPath);\n return [config.extends, `${config.extends}.json`]\n .map(name => path.join(dir, name))\n .find(fs.existsSync);\n }\n\n private getJson<T>(configPath: string): T {\n let result: T = this.json.get(configPath);\n\n if (!result) {\n result = readJson<T>(configPath);\n this.json.set(configPath, result);\n }\n\n return result;\n }\n}\n"],"names":["TSConfig","getValue","key","defaultValue","getValueInternal","configPath","split","config","getJson","value","reduce","result","el","undefined","extendsPath","getExtendsPath","extends","test","require","resolve","dir","path","dirname","map","name","join","find","fs","existsSync","json","get","readJson","set","Map"],"mappings":";;;;+BAIaA;;;eAAAA;;;2DAJE;6DACE;uBACQ;;;;;;;;;;;;;;;;;AAElB,MAAMA;IAWT,2BAA2B;IAC3BC,SAAYC,GAAW,EAAEC,YAAgB,EAAE;QACvC,OAAO,IAAI,CAACC,gBAAgB,CAAI,IAAI,CAACC,UAAU,EAAEH,IAAII,KAAK,CAAC,MAAMH;IACrE;IAEQC,iBAAoBC,UAAkB,EAAEH,GAAa,EAAEC,YAAgB,EAAK;QAChF,MAAMI,SAAS,IAAI,CAACC,OAAO,CAAuBH;QAClD,MAAMI,QAAQP,IAAIQ,MAAM,CAAM,CAACC,QAAQC;YACnC,OAAOD,UAAU,OAAOA,WAAW,WAAWA,MAAM,CAACC,GAAG,GAAGC;QAC/D,GAAGN;QAEH,IAAIE,UAAUI,WAAW;YACrB,OAAOJ;QACX;QAEA,MAAMK,cAAc,IAAI,CAACC,cAAc,CAACV,YAAYE;QACpD,IAAIO,aAAa;YACb,OAAO,IAAI,CAACV,gBAAgB,CAACU,aAAaZ,KAAKC;QACnD;QAEA,OAAOA;IACX;IAEQY,eAAeV,UAAkB,EAAEE,MAA4B,EAAE;QACrE,IAAI,CAACA,OAAOS,OAAO,EAAE;YACjB;QACJ;QAEA,IAAI,CAAC,WAAWC,IAAI,CAACV,OAAOS,OAAO,GAAG;YAClC,OAAOE,QAAQC,OAAO,CAACZ,OAAOS,OAAO;QACzC;QAEA,MAAMI,MAAMC,aAAI,CAACC,OAAO,CAACjB;QACzB,OAAO;YAACE,OAAOS,OAAO;YAAE,GAAGT,OAAOS,OAAO,CAAC,KAAK,CAAC;SAAC,CAC5CO,GAAG,CAACC,CAAAA,OAAQH,aAAI,CAACI,IAAI,CAACL,KAAKI,OAC3BE,IAAI,CAACC,WAAE,CAACC,UAAU;IAC3B;IAEQpB,QAAWH,UAAkB,EAAK;QACtC,IAAIM,SAAY,IAAI,CAACkB,IAAI,CAACC,GAAG,CAACzB;QAE9B,IAAI,CAACM,QAAQ;YACTA,SAASoB,IAAAA,eAAQ,EAAI1B;YACrB,IAAI,CAACwB,IAAI,CAACG,GAAG,CAAC3B,YAAYM;QAC9B;QAEA,OAAOA;IACX;IAvDA,YAAY,AAASN,UAAkB,CAAE;;QAFzC,uBAAiBwB,QAAjB,KAAA;aAEqBxB,aAAAA;QACjB,IAAI,CAACwB,IAAI,GAAG,IAAII;IACpB;AAsDJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface WithExponentialBackoffConfig {
|
|
2
|
+
initialDelay?: number;
|
|
3
|
+
maxRetries?: number;
|
|
4
|
+
onRetry?: (delay: number, error: unknown) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function withExponentialBackoff<T>(callback: () => Promise<T>, config?: WithExponentialBackoffConfig): Promise<T>;
|
|
7
|
+
//# sourceMappingURL=with-exponential-backoff.d.ts.map
|