@servicetitan/startup 36.3.0 → 36.4.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/vite.js +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +14 -9
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts +6 -0
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/bundle-vite.js +110 -0
- package/dist/cli/commands/bundle-vite.js.map +1 -0
- package/dist/cli/commands/bundle-webpack.d.ts +6 -0
- package/dist/cli/commands/bundle-webpack.d.ts.map +1 -0
- package/dist/cli/commands/{bundle-package.js → bundle-webpack.js} +8 -6
- package/dist/cli/commands/bundle-webpack.js.map +1 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +2 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +13 -3
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.d.ts.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +5 -3
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-list.js +1 -1
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-publish.js +1 -1
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +8 -0
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +8 -0
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/bundle-vite.d.ts +33 -0
- package/dist/cli/commands/registry/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/registry/bundle-vite.js +45 -0
- package/dist/cli/commands/registry/bundle-vite.js.map +1 -0
- package/dist/cli/commands/registry/{bundle-package.d.ts → bundle-webpack.d.ts} +1 -1
- package/dist/cli/commands/registry/bundle-webpack.d.ts.map +1 -0
- package/dist/cli/commands/registry/{bundle-package.js → bundle-webpack.js} +1 -1
- package/dist/cli/commands/registry/{bundle-package.js.map → bundle-webpack.js.map} +1 -1
- package/dist/cli/commands/registry/command-registry.d.ts +72 -0
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +7 -2
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +4 -0
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +4 -0
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +12 -22
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -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 +8 -3
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-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 +0 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +0 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/core/check-resource/check-resource.d.ts +4 -0
- package/dist/core/check-resource/check-resource.d.ts.map +1 -0
- package/dist/core/check-resource/check-resource.js +44 -0
- package/dist/core/check-resource/check-resource.js.map +1 -0
- package/dist/core/check-resource/get-package-json.d.ts +10 -0
- package/dist/core/check-resource/get-package-json.d.ts.map +1 -0
- package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.js +12 -10
- package/dist/core/check-resource/get-package-json.js.map +1 -0
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts +7 -0
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts.map +1 -0
- package/dist/core/check-resource/get-peer-dependency-meta.js +17 -0
- package/dist/core/check-resource/get-peer-dependency-meta.js.map +1 -0
- package/dist/core/check-resource/index.d.ts +3 -0
- package/dist/core/check-resource/index.d.ts.map +1 -0
- package/dist/core/check-resource/index.js +13 -0
- package/dist/core/check-resource/index.js.map +1 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.d.ts +8 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.js +15 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.js.map +1 -0
- package/dist/core/check-resource/types.d.ts +5 -0
- package/dist/core/check-resource/types.d.ts.map +1 -0
- package/dist/core/check-resource/types.js.map +1 -0
- package/dist/core/constants.d.ts +17 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +28 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/create-build-context.d.ts +14 -0
- package/dist/core/create-build-context.d.ts.map +1 -0
- package/dist/core/create-build-context.js +54 -0
- package/dist/core/create-build-context.js.map +1 -0
- package/dist/core/defines/define-exposed-dependencies.d.ts +5 -0
- package/dist/core/defines/define-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/defines/define-exposed-dependencies.js +32 -0
- package/dist/core/defines/define-exposed-dependencies.js.map +1 -0
- package/dist/core/defines/define-exposed-instance-dependencies.d.ts +5 -0
- package/dist/core/defines/define-exposed-instance-dependencies.d.ts.map +1 -0
- package/dist/core/defines/define-exposed-instance-dependencies.js +29 -0
- package/dist/core/defines/define-exposed-instance-dependencies.js.map +1 -0
- package/dist/core/defines/define-web-component-name.d.ts +5 -0
- package/dist/core/defines/define-web-component-name.d.ts.map +1 -0
- package/dist/core/defines/define-web-component-name.js +23 -0
- package/dist/core/defines/define-web-component-name.js.map +1 -0
- package/dist/core/defines/index.d.ts +4 -0
- package/dist/core/defines/index.d.ts.map +1 -0
- package/dist/core/defines/index.js +26 -0
- package/dist/core/defines/index.js.map +1 -0
- package/dist/core/externals.d.ts +3 -0
- package/dist/core/externals.d.ts.map +1 -0
- package/dist/core/externals.js +28 -0
- package/dist/core/externals.js.map +1 -0
- package/dist/core/get-build-name.d.ts +2 -0
- package/dist/core/get-build-name.d.ts.map +1 -0
- package/dist/core/get-build-name.js +24 -0
- package/dist/core/get-build-name.js.map +1 -0
- package/dist/core/get-bundle-type.d.ts +3 -0
- package/dist/core/get-bundle-type.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core}/get-bundle-type.js +4 -2
- package/dist/core/get-bundle-type.js.map +1 -0
- package/dist/core/get-cdn-path.d.ts +3 -0
- package/dist/core/get-cdn-path.d.ts.map +1 -0
- package/dist/core/get-cdn-path.js +15 -0
- package/dist/core/get-cdn-path.js.map +1 -0
- package/dist/core/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/get-exposed-dependencies.js.map +1 -0
- package/dist/core/get-output-path.d.ts +3 -0
- package/dist/core/get-output-path.d.ts.map +1 -0
- package/dist/core/get-output-path.js +29 -0
- package/dist/core/get-output-path.js.map +1 -0
- package/dist/core/get-shared-entry-points.d.ts +11 -0
- package/dist/core/get-shared-entry-points.d.ts.map +1 -0
- package/dist/core/get-shared-entry-points.js +43 -0
- package/dist/core/get-shared-entry-points.js.map +1 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.d.ts +3 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.js +18 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/core/get-version/get-startup-version.d.ts.map +1 -0
- package/dist/{utils → core/get-version}/get-startup-version.js +2 -2
- package/dist/core/get-version/get-startup-version.js.map +1 -0
- package/dist/core/get-version/get-web-components-version.d.ts +3 -0
- package/dist/core/get-version/get-web-components-version.d.ts.map +1 -0
- package/dist/core/get-version/get-web-components-version.js +23 -0
- package/dist/core/get-version/get-web-components-version.js.map +1 -0
- package/dist/core/get-version/index.d.ts +4 -0
- package/dist/core/get-version/index.d.ts.map +1 -0
- package/dist/core/get-version/index.js +22 -0
- package/dist/core/get-version/index.js.map +1 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +34 -0
- package/dist/core/index.js.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/build-metadata.d.ts +2 -0
- package/dist/core/metadata/build-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/build-metadata.js +6 -7
- package/dist/core/metadata/build-metadata.js.map +1 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.d.ts +3 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.d.ts.map +1 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.js +42 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.js.map +1 -0
- package/dist/core/metadata/generate-metadata.d.ts +3 -0
- package/dist/core/metadata/generate-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/generate-metadata.js +7 -5
- package/dist/core/metadata/generate-metadata.js.map +1 -0
- package/dist/core/metadata/index.d.ts +4 -0
- package/dist/core/metadata/index.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/index.js +2 -2
- package/dist/core/metadata/index.js.map +1 -0
- package/dist/core/stringify-config.d.ts.map +1 -0
- package/dist/core/stringify-config.js.map +1 -0
- package/dist/core/types.d.ts +50 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/virtual-modules.d.ts +8 -0
- package/dist/core/virtual-modules.d.ts.map +1 -0
- package/dist/core/virtual-modules.js +83 -0
- package/dist/core/virtual-modules.js.map +1 -0
- package/dist/cypress/config/webpack-config.d.ts +1 -1
- package/dist/cypress/config/webpack-config.d.ts.map +1 -1
- package/dist/cypress/config/webpack-config.js +20 -8
- package/dist/cypress/config/webpack-config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +18 -13
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/find-up.js +4 -4
- package/dist/utils/find-up.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +33 -2
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +12 -8
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-data.d.ts +0 -1
- package/dist/utils/get-package-data.d.ts.map +1 -1
- package/dist/utils/get-package-data.js +6 -24
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-packages.d.ts +1 -1
- package/dist/utils/get-packages.d.ts.map +1 -1
- package/dist/utils/get-packages.js +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/validate-shared-dependencies.d.ts +2 -0
- package/dist/utils/validate-shared-dependencies.d.ts.map +1 -0
- package/dist/utils/validate-shared-dependencies.js +26 -0
- package/dist/utils/validate-shared-dependencies.js.map +1 -0
- package/dist/vite/build-shared-dependencies.d.ts +3 -0
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -0
- package/dist/vite/build-shared-dependencies.js +61 -0
- package/dist/vite/build-shared-dependencies.js.map +1 -0
- package/dist/vite/config/base-config.d.ts +4 -0
- package/dist/vite/config/base-config.d.ts.map +1 -0
- package/dist/vite/config/base-config.js +149 -0
- package/dist/vite/config/base-config.js.map +1 -0
- package/dist/vite/config/create-vite-build-context.d.ts +5 -0
- package/dist/vite/config/create-vite-build-context.d.ts.map +1 -0
- package/dist/vite/config/create-vite-build-context.js +43 -0
- package/dist/vite/config/create-vite-build-context.js.map +1 -0
- package/dist/vite/config/create-vite-config.d.ts +3 -0
- package/dist/vite/config/create-vite-config.d.ts.map +1 -0
- package/dist/vite/config/create-vite-config.js +43 -0
- package/dist/vite/config/create-vite-config.js.map +1 -0
- package/dist/vite/config/define-config.d.ts +13 -0
- package/dist/vite/config/define-config.d.ts.map +1 -0
- package/dist/vite/config/define-config.js +15 -0
- package/dist/vite/config/define-config.js.map +1 -0
- package/dist/vite/config/index.d.ts +6 -0
- package/dist/vite/config/index.d.ts.map +1 -0
- package/dist/vite/config/index.js +24 -0
- package/dist/vite/config/index.js.map +1 -0
- package/dist/vite/config/load-config-file.d.ts +4 -0
- package/dist/vite/config/load-config-file.d.ts.map +1 -0
- package/dist/vite/config/load-config-file.js +103 -0
- package/dist/vite/config/load-config-file.js.map +1 -0
- package/dist/vite/config/merge-vite-configs.d.ts +5 -0
- package/dist/vite/config/merge-vite-configs.d.ts.map +1 -0
- package/dist/vite/config/merge-vite-configs.js +17 -0
- package/dist/vite/config/merge-vite-configs.js.map +1 -0
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.html +32 -0
- package/dist/vite/index.js +20 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts +4 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.js +42 -0
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +24 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js +85 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/externals-plugin.d.ts +4 -0
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/externals-plugin.js +60 -0
- package/dist/vite/plugins/externals-plugin.js.map +1 -0
- package/dist/vite/plugins/html-plugin.d.ts +4 -0
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/html-plugin.js +118 -0
- package/dist/vite/plugins/html-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +5 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.js +44 -0
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -0
- package/dist/vite/plugins/index.d.ts +10 -0
- package/dist/vite/plugins/index.d.ts.map +1 -0
- package/dist/vite/plugins/index.js +28 -0
- package/dist/vite/plugins/index.js.map +1 -0
- package/dist/vite/plugins/metadata-plugin.d.ts +4 -0
- package/dist/vite/plugins/metadata-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/metadata-plugin.js +76 -0
- package/dist/vite/plugins/metadata-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin.d.ts +8 -0
- package/dist/vite/plugins/shared-dependencies-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin.js +252 -0
- package/dist/vite/plugins/shared-dependencies-plugin.js.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts +4 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.js +31 -0
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -0
- package/dist/vite/plugins/svgr-plugin.d.ts +4 -0
- package/dist/vite/plugins/svgr-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/svgr-plugin.js +33 -0
- package/dist/vite/plugins/svgr-plugin.js.map +1 -0
- package/dist/vite/plugins/utils/get-css-file-names.d.ts +5 -0
- package/dist/vite/plugins/utils/get-css-file-names.d.ts.map +1 -0
- package/dist/vite/plugins/utils/get-css-file-names.js +21 -0
- package/dist/vite/plugins/utils/get-css-file-names.js.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.js +54 -0
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -0
- package/dist/vite/types.d.ts +4 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/types.js +6 -0
- package/dist/vite/types.js.map +1 -0
- package/dist/vite/validate-shared-dependencies.d.ts +2 -0
- package/dist/vite/validate-shared-dependencies.d.ts.map +1 -0
- package/dist/vite/validate-shared-dependencies.js +27 -0
- package/dist/vite/validate-shared-dependencies.js.map +1 -0
- package/dist/webpack/bundle-webpack.d.ts +11 -0
- package/dist/webpack/bundle-webpack.d.ts.map +1 -0
- package/dist/webpack/bundle-webpack.js +107 -0
- package/dist/webpack/bundle-webpack.js.map +1 -0
- package/dist/webpack/configs/amd-config.d.ts +3 -2
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +3 -2
- package/dist/webpack/configs/cache-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.js +5 -18
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +2 -2
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +8 -8
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +3 -2
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +3 -2
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +6 -5
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +3 -2
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +4 -14
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +0 -1
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.d.ts +3 -3
- package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +5 -4
- package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +3 -1
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +2 -2
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +2 -2
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +9 -7
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +3 -2
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +11 -25
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +3 -8
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +10 -47
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +6 -6
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +4 -13
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +4 -12
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +4 -6
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +2 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +4 -2
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +16 -21
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +9 -8
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +2 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +4 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +3 -3
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +13 -56
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts +3 -2
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/resolve-config.d.ts +3 -2
- package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
- package/dist/webpack/configs/resolve-config.js +2 -1
- package/dist/webpack/configs/resolve-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +2 -1
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/configs/rules/js-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/js-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/js-rules.js +2 -1
- package/dist/webpack/configs/rules/js-rules.js.map +1 -1
- package/dist/webpack/configs/rules/less-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/less-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/less-rules.js.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/scss-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/svg-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.d.ts +2 -2
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +2 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +3 -2
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/watch-options-config.d.ts +2 -2
- package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
- package/dist/webpack/configs/watch-options-config.js +2 -2
- package/dist/webpack/configs/watch-options-config.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts +2 -0
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +37 -48
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/create-webpack-configs.d.ts +16 -0
- package/dist/webpack/create-webpack-configs.d.ts.map +1 -0
- package/dist/webpack/create-webpack-configs.js +88 -0
- package/dist/webpack/create-webpack-configs.js.map +1 -0
- package/dist/webpack/index.d.ts +2 -0
- package/dist/webpack/index.d.ts.map +1 -1
- package/dist/webpack/index.js +2 -0
- package/dist/webpack/index.js.map +1 -1
- package/dist/webpack/types.d.ts +4 -11
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.d.ts +4 -0
- package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -0
- package/dist/webpack/utils/create-webpack-build-context.js +21 -0
- package/dist/webpack/utils/create-webpack-build-context.js.map +1 -0
- package/dist/webpack/utils/index.d.ts +1 -1
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -1
- package/dist/webpack/utils/index.js.map +1 -1
- package/jest/babel-plugin-import-meta-env.js +18 -0
- package/jest/jest-preset.js +5 -2
- package/package.json +30 -22
- package/src/cli/commands/__tests__/build.test.ts +2 -2
- package/src/cli/commands/__tests__/bundle-vite.test.ts +228 -0
- package/src/cli/commands/__tests__/{bundle-package.test.ts → bundle-webpack.test.ts} +26 -17
- package/src/cli/commands/__tests__/install.test.ts +6 -2
- package/src/cli/commands/__tests__/mfe-check.test.ts +16 -10
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +13 -10
- package/src/cli/commands/__tests__/mfe-publish.test.ts +4 -4
- package/src/cli/commands/__tests__/start.test.ts +1 -1
- package/src/cli/commands/build.ts +14 -11
- package/src/cli/commands/bundle-vite.ts +82 -0
- package/src/cli/commands/{bundle-package.ts → bundle-webpack.ts} +9 -6
- package/src/cli/commands/install.ts +2 -1
- package/src/cli/commands/mfe-check.ts +14 -8
- package/src/cli/commands/mfe-generate-metadata.ts +3 -1
- package/src/cli/commands/mfe-list.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +1 -1
- package/src/cli/commands/mfe-publish.ts +1 -1
- package/src/cli/commands/registry/__tests__/command-registry.test.ts +1 -0
- package/src/cli/commands/registry/build.ts +2 -0
- package/src/cli/commands/registry/bundle-vite.ts +14 -0
- package/src/cli/commands/registry/command-registry.ts +5 -2
- package/src/cli/commands/registry/start.ts +1 -0
- package/src/cli/commands/start.ts +15 -29
- package/src/cli/index.ts +2 -1
- package/src/cli/tasks/swc-compile-package/__tests__/swc-compile-package.test.ts +21 -1
- package/src/cli/tasks/swc-compile-package/swc-cli.d.ts +1 -1
- package/src/cli/tasks/swc-compile-package/swc-compile-package.ts +9 -3
- package/src/cli/tasks/tsc-compile/tsc-compile.ts +1 -1
- package/src/cli/utils/copy-files.ts +1 -1
- package/src/cli/utils/index.ts +0 -1
- package/src/core/__tests__/get-cdn-path.test.ts +27 -0
- package/src/core/__tests__/get-output-path.test.ts +64 -0
- package/src/core/check-resource/__tests__/check-resource.test.ts +58 -0
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/get-package-json.test.ts +2 -1
- package/src/core/check-resource/__tests__/get-peer-dependency-meta.test.ts +51 -0
- package/src/core/check-resource/__tests__/is-managed-react-dom-client-dependency.test.ts +35 -0
- package/src/core/check-resource/check-resource.ts +30 -0
- package/src/core/check-resource/get-package-json.ts +33 -0
- package/src/core/check-resource/get-peer-dependency-meta.ts +15 -0
- package/src/core/check-resource/index.ts +2 -0
- package/src/core/check-resource/is-managed-react-dom-client-dependency.ts +13 -0
- package/src/core/check-resource/types.ts +4 -0
- package/src/core/constants.ts +16 -0
- package/src/core/create-build-context.ts +61 -0
- package/src/core/defines/define-exposed-dependencies.ts +25 -0
- package/src/core/defines/define-exposed-instance-dependencies.ts +19 -0
- package/src/core/defines/define-web-component-name.ts +15 -0
- package/src/core/defines/index.ts +3 -0
- package/src/core/externals.ts +22 -0
- package/src/core/get-build-name.ts +11 -0
- package/src/core/get-bundle-type.ts +19 -0
- package/src/core/get-cdn-path.ts +5 -0
- package/src/core/get-output-path.ts +15 -0
- package/src/core/get-shared-entry-points.ts +37 -0
- package/src/core/get-version/__tests__/get-launchdarkly-sdk-version.test.ts +48 -0
- package/src/core/get-version/__tests__/get-web-components-version.test.ts +48 -0
- package/src/core/get-version/get-launchdarkly-sdk-version.ts +8 -0
- package/src/core/get-version/get-startup-version.ts +6 -0
- package/src/core/get-version/get-web-components-version.ts +16 -0
- package/src/core/get-version/index.ts +3 -0
- package/src/core/index.ts +16 -0
- package/src/{webpack/configs/utils → core/metadata}/__tests__/build-metadata.test.ts +10 -6
- package/src/{webpack/configs/utils → core/metadata}/__tests__/generate-metadata.test.ts +25 -13
- package/src/{webpack/configs/utils → core/metadata}/build-metadata.ts +11 -6
- package/src/core/metadata/generate-exposed-dependencies-metadata.ts +20 -0
- package/src/{webpack/configs/utils → core/metadata}/generate-metadata.ts +9 -6
- package/src/core/metadata/index.ts +3 -0
- package/src/core/types.ts +54 -0
- package/src/core/virtual-modules.ts +74 -0
- package/src/cypress/config/__tests__/webpack-config.test.ts +4 -3
- package/src/cypress/config/webpack-config.ts +24 -11
- package/src/index.ts +1 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +5 -27
- package/src/storybook-config/webpack-final.ts +23 -15
- package/src/utils/__tests__/get-configuration.test.ts +28 -7
- package/src/utils/__tests__/get-package-data.test.ts +24 -34
- package/src/utils/__tests__/get-packages.test.ts +4 -4
- package/src/utils/__tests__/validate-shared-dependencies.test.ts +55 -0
- package/src/utils/find-up.ts +1 -1
- package/src/utils/get-configuration.ts +51 -7
- package/src/utils/get-package-data.ts +3 -15
- package/src/utils/get-packages.ts +2 -2
- package/src/utils/index.ts +1 -1
- package/src/utils/validate-shared-dependencies.ts +32 -0
- package/src/vite/__tests__/build-shared-dependencies.test.ts +247 -0
- package/src/vite/__tests__/validate-shared-dependencies.test.ts +34 -0
- package/src/vite/build-shared-dependencies.ts +56 -0
- package/src/vite/config/__tests__/base-config.test.ts +309 -0
- package/src/vite/config/__tests__/create-vite-build-context.test.ts +86 -0
- package/src/vite/config/__tests__/create-vite-config.test.ts +141 -0
- package/src/vite/config/__tests__/define-config.test.ts +23 -0
- package/src/vite/config/__tests__/load-config-file.test.ts +191 -0
- package/src/vite/config/__tests__/merge-vite-configs.test.ts +84 -0
- package/src/vite/config/base-config.ts +137 -0
- package/src/vite/config/create-vite-build-context.ts +45 -0
- package/src/vite/config/create-vite-config.ts +33 -0
- package/src/vite/config/define-config.ts +18 -0
- package/src/vite/config/index.ts +5 -0
- package/src/vite/config/load-config-file.ts +52 -0
- package/src/vite/config/merge-vite-configs.ts +15 -0
- package/src/vite/index.html +32 -0
- package/src/vite/index.ts +1 -0
- package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +119 -0
- package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +255 -0
- package/src/vite/plugins/__tests__/externals-plugin.test.ts +138 -0
- package/src/vite/plugins/__tests__/html-plugin.test.ts +360 -0
- package/src/vite/plugins/__tests__/html-template.test.ts +97 -0
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +85 -0
- package/src/vite/plugins/__tests__/metadata-plugin.test.ts +163 -0
- package/src/vite/plugins/__tests__/shared-dependencies-plugin.test.ts +427 -0
- package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +77 -0
- package/src/vite/plugins/__tests__/svgr-plugin.test.ts +67 -0
- package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +101 -0
- package/src/vite/plugins/css-injector-plugin.ts +65 -0
- package/src/vite/plugins/dev-server-routing-plugin.ts +96 -0
- package/src/vite/plugins/externals-plugin.ts +81 -0
- package/src/vite/plugins/html-plugin.ts +111 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +25 -0
- package/src/vite/plugins/index.ts +9 -0
- package/src/vite/plugins/metadata-plugin.ts +65 -0
- package/src/vite/plugins/shared-dependencies-plugin.ts +273 -0
- package/src/vite/plugins/style-urls-plugin.ts +21 -0
- package/src/vite/plugins/svgr-plugin.ts +17 -0
- package/src/vite/plugins/utils/get-css-file-names.ts +11 -0
- package/src/vite/plugins/virtual-modules-plugin.ts +46 -0
- package/src/vite/types.ts +6 -0
- package/src/vite/validate-shared-dependencies.ts +27 -0
- package/src/webpack/__mocks__/style-rules.ts +15 -3
- package/src/{cli/utils/__tests__/bundle.test.ts → webpack/__tests__/bundle-webpack.test.ts} +30 -23
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +50 -20
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -16
- package/src/webpack/__tests__/create-webpack-config.test.ts +9 -13
- package/src/webpack/bundle-webpack.ts +107 -0
- package/src/webpack/configs/amd-config.ts +3 -2
- package/src/webpack/configs/cache-config.ts +7 -15
- package/src/webpack/configs/dev-server-config.ts +16 -17
- package/src/webpack/configs/devtool-config.ts +4 -3
- package/src/webpack/configs/entry.config.ts +8 -7
- package/src/webpack/configs/externals-config.ts +5 -21
- package/src/webpack/configs/index.ts +0 -1
- package/src/webpack/configs/loaders/css-loader.ts +7 -3
- package/src/webpack/configs/loaders/style-loader.ts +4 -5
- package/src/webpack/configs/module-config.ts +2 -2
- package/src/webpack/configs/optimization-config.ts +17 -11
- package/src/webpack/configs/output-config.ts +12 -23
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +9 -36
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +7 -15
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +7 -13
- package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +7 -8
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +4 -3
- package/src/webpack/configs/plugins/html-plugin.ts +6 -6
- package/src/webpack/configs/plugins/html-tags-plugin.ts +10 -17
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +67 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +10 -10
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +9 -5
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +3 -2
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +4 -3
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +11 -65
- package/src/webpack/configs/plugins/watch-run-plugin.ts +3 -2
- package/src/webpack/configs/plugins-config.ts +3 -2
- package/src/webpack/configs/resolve-config.ts +4 -2
- package/src/webpack/configs/rules/css-rules.ts +4 -3
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/configs/rules/js-rules.ts +3 -2
- package/src/webpack/configs/rules/less-rules.ts +2 -2
- package/src/webpack/configs/rules/scss-rules.ts +2 -2
- package/src/webpack/configs/rules/svg-rules.ts +2 -2
- package/src/webpack/configs/rules-config.ts +6 -5
- package/src/webpack/configs/stats-config.ts +3 -2
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +19 -51
- package/src/webpack/create-webpack-configs.ts +83 -0
- package/src/webpack/index.ts +2 -0
- package/src/webpack/types.ts +11 -11
- package/src/webpack/utils/__tests__/split-by-entry.test.ts +33 -0
- package/src/webpack/utils/create-webpack-build-context.ts +12 -0
- package/src/webpack/utils/index.ts +1 -1
- package/dist/cli/commands/bundle-package.d.ts +0 -6
- package/dist/cli/commands/bundle-package.d.ts.map +0 -1
- package/dist/cli/commands/bundle-package.js.map +0 -1
- package/dist/cli/commands/registry/bundle-package.d.ts.map +0 -1
- package/dist/cli/utils/bundle.d.ts +0 -14
- package/dist/cli/utils/bundle.d.ts.map +0 -1
- package/dist/cli/utils/bundle.js +0 -187
- package/dist/cli/utils/bundle.js.map +0 -1
- package/dist/utils/get-startup-version.d.ts.map +0 -1
- package/dist/utils/get-startup-version.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +0 -3
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +0 -40
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts +0 -2
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts +0 -2
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js +0 -27
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts +0 -7
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js +0 -15
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js.map +0 -1
- package/dist/webpack/configs/types.d.ts +0 -37
- package/dist/webpack/configs/types.d.ts.map +0 -1
- package/dist/webpack/configs/types.js.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.js.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts +0 -3
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.js.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +0 -3
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.js.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts +0 -2
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js +0 -26
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts +0 -2
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.js +0 -22
- package/dist/webpack/configs/utils/get-web-components-version.js.map +0 -1
- package/dist/webpack/configs/utils/index.d.ts +0 -4
- package/dist/webpack/configs/utils/index.d.ts.map +0 -1
- package/dist/webpack/configs/utils/index.js.map +0 -1
- package/dist/webpack/utils/stringify-config.d.ts.map +0 -1
- package/dist/webpack/utils/stringify-config.js.map +0 -1
- package/src/cli/utils/bundle.ts +0 -191
- package/src/utils/get-startup-version.ts +0 -6
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/check-resource.test.ts +0 -62
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +0 -47
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -35
- package/src/webpack/configs/plugins/ignore-plugin/check-resource.ts +0 -29
- package/src/webpack/configs/plugins/ignore-plugin/get-package-json.ts +0 -23
- package/src/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.ts +0 -12
- package/src/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.ts +0 -11
- package/src/webpack/configs/types.ts +0 -40
- package/src/webpack/configs/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -30
- package/src/webpack/configs/utils/__tests__/get-web-components-version.test.ts +0 -24
- package/src/webpack/configs/utils/get-bundle-type.ts +0 -22
- package/src/webpack/configs/utils/get-launchdarkly-sdk-version.ts +0 -15
- package/src/webpack/configs/utils/get-web-components-version.ts +0 -8
- package/src/webpack/configs/utils/index.ts +0 -3
- /package/dist/{webpack/configs → core/check-resource}/types.js +0 -0
- /package/dist/{webpack/configs/utils → core}/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core}/get-exposed-dependencies.js +0 -0
- /package/dist/{utils → core/get-version}/get-startup-version.d.ts +0 -0
- /package/dist/{webpack/utils → core}/stringify-config.d.ts +0 -0
- /package/dist/{webpack/utils → core}/stringify-config.js +0 -0
- /package/src/cli/commands/registry/{bundle-package.ts → bundle-webpack.ts} +0 -0
- /package/src/{webpack/configs/utils → core}/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{webpack/configs/utils → core}/get-exposed-dependencies.ts +0 -0
- /package/src/{utils → core/get-version}/__tests__/get-startup-version.test.ts +0 -0
- /package/src/{webpack/utils → core}/stringify-config.ts +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { BuildContext } from '../../../core';
|
|
2
|
+
import { cssInjectorPlugin } from '../css-injector-plugin';
|
|
3
|
+
|
|
4
|
+
describe(cssInjectorPlugin.name, () => {
|
|
5
|
+
let context: BuildContext;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
context = {
|
|
9
|
+
build: { name: 'my-component', isProduction: false },
|
|
10
|
+
package: { isWebComponent: true },
|
|
11
|
+
} as BuildContext;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const subject = () => cssInjectorPlugin(context);
|
|
15
|
+
|
|
16
|
+
test('returns a plugin with correct name', () => {
|
|
17
|
+
expect(subject()!.name).toBe('mfe-css-injector');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('enforces post order', () => {
|
|
21
|
+
expect(subject()!.enforce).toBe('post');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('when package is not a web component', () => {
|
|
25
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
26
|
+
|
|
27
|
+
test('returns undefined', () => {
|
|
28
|
+
expect(subject()).toBeUndefined();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('when build is production', () => {
|
|
33
|
+
beforeEach(() => (context.build.isProduction = true));
|
|
34
|
+
|
|
35
|
+
test('returns undefined', () => {
|
|
36
|
+
expect(subject()).toBeUndefined();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('transform', () => {
|
|
41
|
+
const viteId = '/path/to/component.css';
|
|
42
|
+
|
|
43
|
+
const viteCssOutput = [
|
|
44
|
+
`import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from "/@vite/client"`,
|
|
45
|
+
`const __vite__id = ${JSON.stringify(viteId)}`,
|
|
46
|
+
`const __vite__css = ".foo { color: red; }"`,
|
|
47
|
+
`__vite__updateStyle(__vite__id, __vite__css)`,
|
|
48
|
+
`import.meta.hot.accept()`,
|
|
49
|
+
`import.meta.hot.prune(() => __vite__removeStyle(__vite__id))`,
|
|
50
|
+
].join('\n');
|
|
51
|
+
|
|
52
|
+
const pluginContext = {
|
|
53
|
+
error: jest.fn((msg: string) => {
|
|
54
|
+
throw new Error(msg);
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const transform = (code: string, id: string) => {
|
|
59
|
+
const plugin = subject()!;
|
|
60
|
+
return (plugin.transform as Function).call(pluginContext, code, id);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
test('replaces updateStyle with MfeStyleRegistry import', () => {
|
|
64
|
+
const result = transform(viteCssOutput, viteId);
|
|
65
|
+
|
|
66
|
+
expect(result.code).toContain(
|
|
67
|
+
`import { MfeStyleRegistry as __mfe__Registry } from '@servicetitan/web-components'`
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('replaces updateStyle call with injectSheet using component name', () => {
|
|
72
|
+
const result = transform(viteCssOutput, viteId);
|
|
73
|
+
|
|
74
|
+
expect(result.code).toContain(
|
|
75
|
+
`__mfe__Registry.for("my-component").injectSheet(__vite__id, __vite__css)`
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('removes removeStyle prune handler', () => {
|
|
80
|
+
const result = transform(viteCssOutput, viteId);
|
|
81
|
+
|
|
82
|
+
expect(result.code).not.toContain('__vite__removeStyle');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('preserves hot.accept()', () => {
|
|
86
|
+
const result = transform(viteCssOutput, viteId);
|
|
87
|
+
|
|
88
|
+
expect(result.code).toContain('import.meta.hot.accept()');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('skips non-CSS files', () => {
|
|
92
|
+
expect(transform(viteCssOutput, '/path/to/file.ts')).toBeUndefined();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('skips CSS files without vite style markers', () => {
|
|
96
|
+
expect(transform('export default ".foo {}"', viteId)).toBeUndefined();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test.each(['.css', '.less', '.scss'])('transforms %s files', ext => {
|
|
100
|
+
const result = transform(viteCssOutput, `/path/to/file${ext}`);
|
|
101
|
+
|
|
102
|
+
expect(result).toBeDefined();
|
|
103
|
+
expect(result.code).toContain('__mfe__Registry');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('errors when transform produces no change', () => {
|
|
107
|
+
const unrecognizedOutput = [
|
|
108
|
+
`import { someNewApi } from "/@vite/client"`,
|
|
109
|
+
`const __vite__id = "/path/to/style.css"`,
|
|
110
|
+
`const __vite__css = ".foo { color: red; }"`,
|
|
111
|
+
`__vite__updateStyle(__vite__id, __vite__css)`,
|
|
112
|
+
].join('\n');
|
|
113
|
+
|
|
114
|
+
expect(() => transform(unrecognizedOutput, '/path/to/style.css')).toThrow(
|
|
115
|
+
/Vite's internal output format may have changed/
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { type BuildContext, getBundleType } from '../../../core';
|
|
4
|
+
import { log } from '../../../utils';
|
|
5
|
+
import { devServerRoutingPlugin } from '../dev-server-routing-plugin';
|
|
6
|
+
|
|
7
|
+
jest.mock('fs', () => fs);
|
|
8
|
+
jest.mock('../../../core', () => ({
|
|
9
|
+
getBundleType: jest.fn(),
|
|
10
|
+
}));
|
|
11
|
+
jest.mock('../../../utils', () => ({
|
|
12
|
+
log: { info: jest.fn(), timestamp: '00:00:00' },
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
describe(devServerRoutingPlugin.name, () => {
|
|
16
|
+
const SHARED_DEPS_DIR = 'shared';
|
|
17
|
+
const destination = 'dist/bundle/full';
|
|
18
|
+
const destDir = path.resolve(destination);
|
|
19
|
+
const outDir = path.resolve('dist/bundle/full');
|
|
20
|
+
const outDirRelative = path.relative(process.cwd(), outDir);
|
|
21
|
+
|
|
22
|
+
let context: BuildContext;
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
jest.clearAllMocks();
|
|
26
|
+
vol.fromJSON({});
|
|
27
|
+
jest.mocked(getBundleType).mockReturnValue(SHARED_DEPS_DIR);
|
|
28
|
+
context = {
|
|
29
|
+
build: { name: 'test-app' },
|
|
30
|
+
package: { destination },
|
|
31
|
+
} as BuildContext;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
jest.restoreAllMocks();
|
|
36
|
+
vol.reset();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const subject = () => devServerRoutingPlugin(context);
|
|
40
|
+
|
|
41
|
+
test('returns plugin with correct name', () => {
|
|
42
|
+
expect(subject().name).toBe('dev-server-routing');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const setupMiddleware = (resolvedOutDir: string) => {
|
|
46
|
+
const plugin = subject();
|
|
47
|
+
(plugin.configResolved as Function).call(plugin, {
|
|
48
|
+
build: { outDir: resolvedOutDir },
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
let middleware!: Function;
|
|
52
|
+
const server: any = {
|
|
53
|
+
middlewares: {
|
|
54
|
+
use: (handler: Function) => (middleware = handler),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
(plugin.configureServer as Function).call(plugin, server);
|
|
58
|
+
return middleware;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
describe('configResolved', () => {
|
|
62
|
+
test('captures outDir for use by configureServer', () => {
|
|
63
|
+
const middleware = setupMiddleware(outDir);
|
|
64
|
+
const req: any = { url: `/${SHARED_DEPS_DIR}/dep.js` };
|
|
65
|
+
const originalUrl = req.url;
|
|
66
|
+
|
|
67
|
+
middleware(req, {}, jest.fn());
|
|
68
|
+
|
|
69
|
+
expect(req.url).toBe(`/${outDirRelative}/${originalUrl.slice(1)}`);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('configureServer', () => {
|
|
74
|
+
const itPreservesUnmatchedUrls = () => {
|
|
75
|
+
test('preserves unmatched URL', () => {
|
|
76
|
+
const middleware = setupMiddleware(outDir);
|
|
77
|
+
const req: any = { url: '/other/path' };
|
|
78
|
+
const originalUrl = req.url;
|
|
79
|
+
|
|
80
|
+
middleware(req, {}, jest.fn());
|
|
81
|
+
|
|
82
|
+
expect(req.url).toBe(originalUrl);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
test('logs request', () => {
|
|
87
|
+
const middleware = setupMiddleware(outDir);
|
|
88
|
+
|
|
89
|
+
middleware({ method: 'GET', url: '/anything' }, {}, jest.fn());
|
|
90
|
+
|
|
91
|
+
expect(log.info).toHaveBeenCalled();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('calls next middleware', () => {
|
|
95
|
+
const middleware = setupMiddleware(outDir);
|
|
96
|
+
const next = jest.fn();
|
|
97
|
+
|
|
98
|
+
middleware({ url: '/anything' }, {}, next);
|
|
99
|
+
|
|
100
|
+
expect(next).toHaveBeenCalled();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('when package is a web component', () => {
|
|
104
|
+
beforeEach(() => (context.package.isWebComponent = true));
|
|
105
|
+
|
|
106
|
+
test('strips outDir prefix from URL', () => {
|
|
107
|
+
const middleware = setupMiddleware(outDir);
|
|
108
|
+
const req: any = { url: `/${outDirRelative}/index.js` };
|
|
109
|
+
|
|
110
|
+
middleware(req, {}, jest.fn());
|
|
111
|
+
|
|
112
|
+
expect(req.url).toBe('/index.js');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
itPreservesUnmatchedUrls();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('when package is not a web component', () => {
|
|
119
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
120
|
+
|
|
121
|
+
test('rewrites shared dependencies URL to outDir', () => {
|
|
122
|
+
const middleware = setupMiddleware(outDir);
|
|
123
|
+
const req: any = { url: `/${SHARED_DEPS_DIR}/dep.js` };
|
|
124
|
+
|
|
125
|
+
middleware(req, {}, jest.fn());
|
|
126
|
+
|
|
127
|
+
expect(req.url).toBe(`/${outDirRelative}/${SHARED_DEPS_DIR}/dep.js`);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
itPreservesUnmatchedUrls();
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe('configurePreviewServer', () => {
|
|
135
|
+
const setupPreviewServer = () => {
|
|
136
|
+
const plugin = subject();
|
|
137
|
+
const uses: { path?: string; handler: Function }[] = [];
|
|
138
|
+
const server: any = {
|
|
139
|
+
middlewares: {
|
|
140
|
+
use: (...args: any[]) => {
|
|
141
|
+
if (typeof args[0] === 'string') {
|
|
142
|
+
uses.push({ path: args[0], handler: args[1] });
|
|
143
|
+
} else {
|
|
144
|
+
uses.push({ handler: args[0] });
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
(plugin.configurePreviewServer as Function).call(plugin, server);
|
|
150
|
+
return {
|
|
151
|
+
logger: uses.find(u => !u.path)!.handler,
|
|
152
|
+
staticFiles: uses.find(u => u.path)?.handler,
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
test('logs request and calls next middleware', () => {
|
|
157
|
+
const { logger } = setupPreviewServer();
|
|
158
|
+
const req = { method: 'GET', url: '/index.html' };
|
|
159
|
+
const next = jest.fn();
|
|
160
|
+
|
|
161
|
+
logger(req, {}, next);
|
|
162
|
+
|
|
163
|
+
expect(log.info).toHaveBeenCalled();
|
|
164
|
+
expect(next).toHaveBeenCalled();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
describe('when package is not a web component', () => {
|
|
168
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
169
|
+
|
|
170
|
+
test('only registers logging middleware', () => {
|
|
171
|
+
const { logger, staticFiles } = setupPreviewServer();
|
|
172
|
+
|
|
173
|
+
expect(logger).toBeDefined();
|
|
174
|
+
expect(staticFiles).toBeUndefined();
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe('when package is a web component', () => {
|
|
179
|
+
beforeEach(() => (context.package.isWebComponent = true));
|
|
180
|
+
|
|
181
|
+
const serveStaticFile = (fileName: string) => {
|
|
182
|
+
const mockStream = { pipe: jest.fn() };
|
|
183
|
+
jest.spyOn(fs, 'createReadStream').mockReturnValue(mockStream as any);
|
|
184
|
+
const { staticFiles } = setupPreviewServer();
|
|
185
|
+
const res = { setHeader: jest.fn() };
|
|
186
|
+
staticFiles!({ url: `/${fileName}` }, res, jest.fn());
|
|
187
|
+
return { res, mockStream };
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
describe.each([
|
|
191
|
+
['file.js', 'application/javascript'],
|
|
192
|
+
['file.css', 'text/css'],
|
|
193
|
+
['file.json', 'application/json'],
|
|
194
|
+
])('when requested file is %s', (fileName, contentType) => {
|
|
195
|
+
beforeEach(() => {
|
|
196
|
+
vol.fromJSON({ [path.join(destDir, fileName)]: 'content' });
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test(`serves file as ${contentType}`, () => {
|
|
200
|
+
const { res, mockStream } = serveStaticFile(fileName);
|
|
201
|
+
|
|
202
|
+
expect(res.setHeader).toHaveBeenCalledWith('Content-Type', contentType);
|
|
203
|
+
expect(mockStream.pipe).toHaveBeenCalledWith(res);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
describe('when requested file has unrecognized extension', () => {
|
|
208
|
+
const fileName = 'file.txt';
|
|
209
|
+
|
|
210
|
+
beforeEach(() => {
|
|
211
|
+
vol.fromJSON({ [path.join(destDir, fileName)]: 'content' });
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test('serves file without content type', () => {
|
|
215
|
+
const { res, mockStream } = serveStaticFile(fileName);
|
|
216
|
+
|
|
217
|
+
expect(res.setHeader).not.toHaveBeenCalled();
|
|
218
|
+
expect(mockStream.pipe).toHaveBeenCalledWith(res);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
describe('when requested file does not exist', () => {
|
|
223
|
+
beforeEach(() => vol.reset());
|
|
224
|
+
|
|
225
|
+
test('calls next middleware', () => {
|
|
226
|
+
const { staticFiles } = setupPreviewServer();
|
|
227
|
+
const next = jest.fn();
|
|
228
|
+
|
|
229
|
+
staticFiles!({ url: '/missing.js' }, {}, next);
|
|
230
|
+
|
|
231
|
+
expect(next).toHaveBeenCalled();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe('when requested URL traverses outside the mounted directory', () => {
|
|
236
|
+
beforeEach(() => {
|
|
237
|
+
vol.fromJSON({
|
|
238
|
+
[path.resolve(destDir, '../outside.js')]: 'content',
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test('does not serve the file', () => {
|
|
243
|
+
const createReadStream = jest.spyOn(fs, 'createReadStream');
|
|
244
|
+
const { staticFiles } = setupPreviewServer();
|
|
245
|
+
const next = jest.fn();
|
|
246
|
+
|
|
247
|
+
staticFiles!({ url: '/../outside.js' }, {}, next);
|
|
248
|
+
|
|
249
|
+
expect(next).toHaveBeenCalled();
|
|
250
|
+
expect(createReadStream).not.toHaveBeenCalled();
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { type BuildContext, getExternals } from '../../../core';
|
|
4
|
+
import { externalsPlugin } from '../externals-plugin';
|
|
5
|
+
|
|
6
|
+
jest.mock('fs', () => fs);
|
|
7
|
+
jest.mock('../../../core', () => ({
|
|
8
|
+
getExternals: jest.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
describe(externalsPlugin.name, () => {
|
|
12
|
+
const mockExternals: Record<string, string> = {
|
|
13
|
+
'react': 'globalReact',
|
|
14
|
+
'@scope/lib': 'globalScopeLib',
|
|
15
|
+
};
|
|
16
|
+
const proxyNodeModules = path.resolve('node_modules', '.startup', 'externals', 'node_modules');
|
|
17
|
+
|
|
18
|
+
let context: BuildContext;
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
vol.fromJSON({});
|
|
23
|
+
jest.mocked(getExternals).mockReturnValue(mockExternals);
|
|
24
|
+
context = {
|
|
25
|
+
build: {},
|
|
26
|
+
} as BuildContext;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(() => vol.reset());
|
|
30
|
+
|
|
31
|
+
const subject = () => externalsPlugin(context);
|
|
32
|
+
|
|
33
|
+
test('returns plugin with correct name', () => {
|
|
34
|
+
expect(subject()!.name).toBe('externals');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('enforces pre', () => {
|
|
38
|
+
expect(subject()!.enforce).toBe('pre');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('writes proxy CJS module for each dependency', () => {
|
|
42
|
+
subject();
|
|
43
|
+
|
|
44
|
+
for (const [dependency, proxy] of Object.entries(mockExternals)) {
|
|
45
|
+
const cjsPath = path.join(proxyNodeModules, dependency, 'index.cjs');
|
|
46
|
+
expect(fs.readFileSync(cjsPath, 'utf8')).toBe(`module.exports = ${proxy};`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('writes proxy package.json for each dependency', () => {
|
|
51
|
+
subject();
|
|
52
|
+
|
|
53
|
+
for (const [dependency] of Object.entries(mockExternals)) {
|
|
54
|
+
const pkgPath = path.join(proxyNodeModules, dependency, 'package.json');
|
|
55
|
+
expect(JSON.parse(fs.readFileSync(pkgPath, 'utf8') as string)).toEqual({
|
|
56
|
+
name: dependency,
|
|
57
|
+
main: './index.cjs',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('when no externals exist', () => {
|
|
63
|
+
beforeEach(() => jest.mocked(getExternals).mockReturnValue(undefined));
|
|
64
|
+
|
|
65
|
+
test('returns undefined', () => {
|
|
66
|
+
expect(subject()).toBeUndefined();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('when build is production', () => {
|
|
71
|
+
beforeEach(() => (context.build.isProduction = true));
|
|
72
|
+
|
|
73
|
+
describe('resolveId', () => {
|
|
74
|
+
let source: string;
|
|
75
|
+
|
|
76
|
+
const subject = () => {
|
|
77
|
+
const plugin = externalsPlugin(context)!;
|
|
78
|
+
return (plugin.resolveId as Function).call(plugin, source);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
describe('with known dependency', () => {
|
|
82
|
+
const knownDependency = Object.keys(mockExternals)[0];
|
|
83
|
+
|
|
84
|
+
beforeEach(() => (source = knownDependency));
|
|
85
|
+
|
|
86
|
+
test('resolves to proxy module', () => {
|
|
87
|
+
expect(subject()).toBe(
|
|
88
|
+
path.join(proxyNodeModules, knownDependency, 'index.cjs')
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('with unknown dependency', () => {
|
|
94
|
+
beforeEach(() => (source = 'unknown'));
|
|
95
|
+
|
|
96
|
+
test('returns undefined', () => {
|
|
97
|
+
expect(subject()).toBeUndefined();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('does not define config', () => {
|
|
103
|
+
expect(subject()!.config).toBeUndefined();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('when build is not production', () => {
|
|
108
|
+
beforeEach(() => (context.build.isProduction = false));
|
|
109
|
+
|
|
110
|
+
describe('config', () => {
|
|
111
|
+
const subject = () => {
|
|
112
|
+
const plugin = externalsPlugin(context)!;
|
|
113
|
+
return (plugin.config as Function).call(plugin);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
test('returns resolve aliases for each dependency', () => {
|
|
117
|
+
expect(subject().resolve.alias).toEqual([
|
|
118
|
+
{
|
|
119
|
+
find: /^react$/,
|
|
120
|
+
replacement: path.join(proxyNodeModules, 'react'),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
find: /^@scope\/lib$/,
|
|
124
|
+
replacement: path.join(proxyNodeModules, '@scope/lib'),
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('includes dependencies in optimizeDeps', () => {
|
|
130
|
+
expect(subject().optimizeDeps.include).toEqual(Object.keys(mockExternals));
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('does not define resolveId', () => {
|
|
135
|
+
expect(subject()!.resolveId).toBeUndefined();
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|