@servicetitan/startup 36.3.1 → 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 +2 -2
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +2 -2
- 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.map +1 -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.map +1 -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/core/metadata/build-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/build-metadata.js +5 -6
- 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 +5 -4
- 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/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.map +1 -1
- package/dist/utils/get-package-data.js +3 -2
- 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 -17
- 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 +29 -21
- 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-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 +1 -2
- package/src/cli/commands/mfe-generate-metadata.ts +1 -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/get-startup-version.ts +6 -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 +6 -3
- package/src/core/metadata/generate-exposed-dependencies-metadata.ts +20 -0
- package/src/{webpack/configs/utils → core/metadata}/generate-metadata.ts +8 -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 +35 -1
- package/src/utils/__tests__/get-packages.test.ts +4 -4
- package/src/utils/__tests__/validate-shared-dependencies.test.ts +55 -0
- package/src/utils/get-configuration.ts +51 -7
- package/src/utils/get-package-data.ts +3 -1
- 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 +40 -14
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -16
- package/src/webpack/__tests__/create-webpack-config.test.ts +9 -8
- 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 -18
- 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.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +0 -1
- 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/get-bundle-type.ts +0 -22
- 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/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.js +0 -0
- /package/dist/{utils → core/get-version}/get-startup-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-web-components-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-web-components-version.js +0 -0
- /package/dist/{webpack/configs/utils → core/metadata}/build-metadata.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/{webpack/configs/utils → core/get-version}/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{utils → core/get-version}/__tests__/get-startup-version.test.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/get-web-components-version.ts +0 -0
- /package/src/{webpack/utils → core}/stringify-config.ts +0 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Eta } from 'eta';
|
|
2
|
+
import { fs, vol } from 'memfs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { getSharedEntryPoints } from '../../../core';
|
|
5
|
+
import type { ViteBuildContext } from '../../types';
|
|
6
|
+
import { htmlPlugin } from '../html-plugin';
|
|
7
|
+
|
|
8
|
+
const mockRender = jest.fn();
|
|
9
|
+
|
|
10
|
+
jest.mock('fs', () => fs);
|
|
11
|
+
jest.mock('eta', () => ({
|
|
12
|
+
Eta: jest.fn(() => ({ render: mockRender })),
|
|
13
|
+
}));
|
|
14
|
+
jest.mock('../../../core', () => ({
|
|
15
|
+
getSharedEntryPoints: jest.fn(),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
describe(htmlPlugin.name, () => {
|
|
19
|
+
const VIRTUAL_HTML_PATH = path.resolve('index.html');
|
|
20
|
+
const RENDERED_HTML = '<html><body>rendered</body></html>';
|
|
21
|
+
|
|
22
|
+
let context: ViteBuildContext;
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
jest.clearAllMocks();
|
|
26
|
+
vol.fromJSON({});
|
|
27
|
+
mockRender.mockReturnValue(RENDERED_HTML);
|
|
28
|
+
jest.mocked(getSharedEntryPoints).mockReturnValue({ css: [], js: [] });
|
|
29
|
+
context = {
|
|
30
|
+
build: { name: 'my-app', isProduction: false },
|
|
31
|
+
package: { isWebComponent: false, source: 'src' },
|
|
32
|
+
bundlerConfig: { pluginOverrides: {} },
|
|
33
|
+
} as ViteBuildContext;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(() => vol.reset());
|
|
37
|
+
|
|
38
|
+
const subject = () => htmlPlugin(context);
|
|
39
|
+
|
|
40
|
+
test('returns plugin with correct name', () => {
|
|
41
|
+
expect(subject().name).toBe('html');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('constructs Eta with default template directory', () => {
|
|
45
|
+
subject();
|
|
46
|
+
|
|
47
|
+
const defaultTemplateDir = path.resolve(__dirname, '../..');
|
|
48
|
+
expect(Eta).toHaveBeenCalledWith({ views: defaultTemplateDir });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe.each(['index.ejs', 'index.html'])('when source contains %s', name => {
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
vol.fromJSON({ [path.resolve(context.package.source, name)]: '' });
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('constructs Eta with the source directory', () => {
|
|
57
|
+
subject();
|
|
58
|
+
|
|
59
|
+
expect(Eta).toHaveBeenCalledWith({ views: path.resolve(context.package.source) });
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('when template is overridden', () => {
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
context.bundlerConfig.pluginOverrides.html = { template: '/templates/custom.ejs' };
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('constructs Eta with template directory', () => {
|
|
69
|
+
subject();
|
|
70
|
+
|
|
71
|
+
const templateDir = path.dirname(
|
|
72
|
+
path.resolve(context.bundlerConfig.pluginOverrides.html!.template!)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(Eta).toHaveBeenCalledWith({ views: templateDir });
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('resolveId', () => {
|
|
80
|
+
let source: string;
|
|
81
|
+
let importer: string | undefined;
|
|
82
|
+
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
source = './app';
|
|
85
|
+
importer = undefined;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const subject = () => {
|
|
89
|
+
const plugin = htmlPlugin(context);
|
|
90
|
+
return (plugin.resolveId as Function).call(plugin, source, importer);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const itReturnsUndefined = () => {
|
|
94
|
+
test('returns undefined', () => {
|
|
95
|
+
expect(subject()).toBeUndefined();
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
itReturnsUndefined();
|
|
100
|
+
|
|
101
|
+
describe('when source is virtual HTML path', () => {
|
|
102
|
+
beforeEach(() => (source = VIRTUAL_HTML_PATH));
|
|
103
|
+
|
|
104
|
+
test('returns source', () => {
|
|
105
|
+
expect(subject()).toBe(VIRTUAL_HTML_PATH);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('when importer includes index.html', () => {
|
|
110
|
+
beforeEach(() => (importer = VIRTUAL_HTML_PATH));
|
|
111
|
+
|
|
112
|
+
itReturnsUndefined();
|
|
113
|
+
|
|
114
|
+
describe('when source JS file exists', () => {
|
|
115
|
+
let sourcePath: string;
|
|
116
|
+
|
|
117
|
+
beforeEach(() => {
|
|
118
|
+
sourcePath = path.resolve(source + '.js');
|
|
119
|
+
vol.fromJSON({ [sourcePath]: '' });
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('resolves to .js path', () => {
|
|
123
|
+
expect(subject()).toBe(sourcePath);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe('when source is not relative path', () => {
|
|
127
|
+
beforeEach(() => {
|
|
128
|
+
source = 'react';
|
|
129
|
+
sourcePath = path.resolve(source + '.js');
|
|
130
|
+
vol.fromJSON({ [sourcePath]: '' });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
itReturnsUndefined();
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe('load', () => {
|
|
140
|
+
let id: string;
|
|
141
|
+
|
|
142
|
+
beforeEach(() => (id = ''));
|
|
143
|
+
|
|
144
|
+
const subject = () => {
|
|
145
|
+
const plugin = htmlPlugin(context);
|
|
146
|
+
return (plugin.load as Function).call(plugin, id);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
test('does nothing', () => {
|
|
150
|
+
subject();
|
|
151
|
+
|
|
152
|
+
expect(mockRender).not.toHaveBeenCalled();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe('when id is virtual HTML path', () => {
|
|
156
|
+
beforeEach(() => (id = VIRTUAL_HTML_PATH));
|
|
157
|
+
|
|
158
|
+
test('returns rendered HTML', () => {
|
|
159
|
+
expect(subject()).toBe(RENDERED_HTML);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('passes context values to template', () => {
|
|
163
|
+
subject();
|
|
164
|
+
|
|
165
|
+
expect(mockRender).toHaveBeenCalledWith('index.html', {
|
|
166
|
+
title: 'ServiceTitan',
|
|
167
|
+
favicon: undefined,
|
|
168
|
+
css: [],
|
|
169
|
+
js: [],
|
|
170
|
+
isProduction: context.build.isProduction,
|
|
171
|
+
isWebComponent: context.package.isWebComponent,
|
|
172
|
+
name: context.build.name,
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
describe.each(['index.ejs', 'index.html'])('when source contains %s', name => {
|
|
177
|
+
beforeEach(() => {
|
|
178
|
+
vol.fromJSON({ [path.resolve(context.package.source, name)]: '' });
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test(`renders the ${name} template`, () => {
|
|
182
|
+
subject();
|
|
183
|
+
|
|
184
|
+
expect(mockRender).toHaveBeenCalledWith(name, expect.anything());
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
describe('when source contains both index.ejs and index.html', () => {
|
|
189
|
+
beforeEach(() => {
|
|
190
|
+
vol.fromJSON({
|
|
191
|
+
[path.resolve(context.package.source, 'index.ejs')]: '',
|
|
192
|
+
[path.resolve(context.package.source, 'index.html')]: '',
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test('renders index.ejs', () => {
|
|
197
|
+
subject();
|
|
198
|
+
|
|
199
|
+
expect(mockRender).toHaveBeenCalledWith('index.ejs', expect.anything());
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe('when template is overridden', () => {
|
|
204
|
+
beforeEach(() => {
|
|
205
|
+
context.bundlerConfig.pluginOverrides.html = {
|
|
206
|
+
template: '/templates/custom.ejs',
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test('renders the template', () => {
|
|
211
|
+
subject();
|
|
212
|
+
|
|
213
|
+
const name = path.basename(
|
|
214
|
+
context.bundlerConfig.pluginOverrides.html!.template!
|
|
215
|
+
);
|
|
216
|
+
expect(mockRender).toHaveBeenCalledWith(name, expect.anything());
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
describe('when title is overridden', () => {
|
|
221
|
+
beforeEach(() => {
|
|
222
|
+
context.bundlerConfig.pluginOverrides.html = { title: 'Custom Title' };
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test('passes overridden title to template', () => {
|
|
226
|
+
subject();
|
|
227
|
+
|
|
228
|
+
expect(mockRender).toHaveBeenCalledWith(
|
|
229
|
+
expect.anything(),
|
|
230
|
+
expect.objectContaining({ title: 'Custom Title' })
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe('when favicon is overridden', () => {
|
|
236
|
+
beforeEach(() => {
|
|
237
|
+
context.bundlerConfig.pluginOverrides.html = { favicon: '/favicon.ico' };
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test('passes overridden favicon to template', () => {
|
|
241
|
+
subject();
|
|
242
|
+
|
|
243
|
+
expect(mockRender).toHaveBeenCalledWith(
|
|
244
|
+
expect.anything(),
|
|
245
|
+
expect.objectContaining({ favicon: '/favicon.ico' })
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
describe('configResolved', () => {
|
|
253
|
+
const publicDir = path.resolve('public');
|
|
254
|
+
|
|
255
|
+
const subject = () => {
|
|
256
|
+
const plugin = htmlPlugin(context);
|
|
257
|
+
(plugin.configResolved as Function).call(plugin, { publicDir });
|
|
258
|
+
(plugin.load as Function).call(plugin, VIRTUAL_HTML_PATH);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
test('ignores favicon', () => {
|
|
262
|
+
subject();
|
|
263
|
+
|
|
264
|
+
expect(mockRender).toHaveBeenCalledWith(
|
|
265
|
+
expect.anything(),
|
|
266
|
+
expect.objectContaining({ favicon: undefined })
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
describe('when public directory contains favicon.ico', () => {
|
|
271
|
+
beforeEach(() => {
|
|
272
|
+
vol.fromJSON({ [path.join(publicDir, 'favicon.ico')]: '' });
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test('configures favicon', () => {
|
|
276
|
+
subject();
|
|
277
|
+
|
|
278
|
+
expect(mockRender).toHaveBeenCalledWith(
|
|
279
|
+
expect.anything(),
|
|
280
|
+
expect.objectContaining({ favicon: '/favicon.ico' })
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
describe('when favicon is explicitly configured', () => {
|
|
285
|
+
const favicon = '/custom.ico';
|
|
286
|
+
|
|
287
|
+
beforeEach(() => {
|
|
288
|
+
context.bundlerConfig.pluginOverrides.html = { favicon };
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test('uses configured value', () => {
|
|
292
|
+
subject();
|
|
293
|
+
|
|
294
|
+
expect(mockRender).toHaveBeenCalledWith(
|
|
295
|
+
expect.anything(),
|
|
296
|
+
expect.objectContaining({ favicon })
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
describe('configureServer', () => {
|
|
304
|
+
const TRANSFORMED_HTML = '<html>transformed</html>';
|
|
305
|
+
|
|
306
|
+
let req: any;
|
|
307
|
+
let res: any;
|
|
308
|
+
let next: jest.Mock;
|
|
309
|
+
let server: any;
|
|
310
|
+
|
|
311
|
+
beforeEach(() => {
|
|
312
|
+
req = { url: '/other' };
|
|
313
|
+
res = { end: jest.fn() };
|
|
314
|
+
next = jest.fn();
|
|
315
|
+
|
|
316
|
+
const plugin = htmlPlugin(context);
|
|
317
|
+
server = {
|
|
318
|
+
middlewares: { use: jest.fn() },
|
|
319
|
+
transformIndexHtml: jest.fn(() => Promise.resolve(TRANSFORMED_HTML)),
|
|
320
|
+
};
|
|
321
|
+
const postHook = (plugin.configureServer as Function).call(plugin, server);
|
|
322
|
+
postHook();
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
const subject = async () => {
|
|
326
|
+
const middleware = server.middlewares.use.mock.calls[0][0];
|
|
327
|
+
await middleware(req, res, next);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
test('calls next middleware', async () => {
|
|
331
|
+
await subject();
|
|
332
|
+
|
|
333
|
+
expect(next).toHaveBeenCalled();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test('does not serve transformed HTML', async () => {
|
|
337
|
+
await subject();
|
|
338
|
+
|
|
339
|
+
expect(server.transformIndexHtml).not.toHaveBeenCalled();
|
|
340
|
+
expect(res.end).not.toHaveBeenCalled();
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
describe('when request URL ends with index.html', () => {
|
|
344
|
+
beforeEach(() => (req.url = '/index.html'));
|
|
345
|
+
|
|
346
|
+
test('serves transformed HTML', async () => {
|
|
347
|
+
await subject();
|
|
348
|
+
|
|
349
|
+
expect(server.transformIndexHtml).toHaveBeenCalledWith(req.url, RENDERED_HTML);
|
|
350
|
+
expect(res.end).toHaveBeenCalledWith(TRANSFORMED_HTML);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test('does not call next middleware', async () => {
|
|
354
|
+
await subject();
|
|
355
|
+
|
|
356
|
+
expect(next).not.toHaveBeenCalled();
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { getSharedEntryPoints } from '../../../core';
|
|
3
|
+
import type { ViteBuildContext } from '../../types';
|
|
4
|
+
import { htmlPlugin } from '../html-plugin';
|
|
5
|
+
|
|
6
|
+
jest.mock('../../../core', () => ({
|
|
7
|
+
getSharedEntryPoints: jest.fn(),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
describe('Vite host HTML template', () => {
|
|
11
|
+
const VIRTUAL_HTML_PATH = path.resolve('index.html');
|
|
12
|
+
const css = ['shared/anvil2.bundle.css', 'shared/design-system.bundle.css'];
|
|
13
|
+
const js = ['shared/shared.bundle.js'];
|
|
14
|
+
|
|
15
|
+
let context: ViteBuildContext;
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
jest.clearAllMocks();
|
|
19
|
+
jest.mocked(getSharedEntryPoints).mockReturnValue({ css, js });
|
|
20
|
+
context = {
|
|
21
|
+
build: { name: 'my-mfe', isProduction: true },
|
|
22
|
+
package: { isWebComponent: false, source: __dirname },
|
|
23
|
+
bundlerConfig: { pluginOverrides: {} },
|
|
24
|
+
} as ViteBuildContext;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const subject = () => {
|
|
28
|
+
const plugin = htmlPlugin(context);
|
|
29
|
+
return (plugin.load as Function).call(plugin, VIRTUAL_HTML_PATH) as string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
test('renders the default title', () => {
|
|
33
|
+
expect(subject()).toContain('<title>ServiceTitan</title>');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('with a configured title', () => {
|
|
37
|
+
beforeEach(() => (context.bundlerConfig.pluginOverrides.html = { title: 'My App' }));
|
|
38
|
+
|
|
39
|
+
test('renders the configured title', () => {
|
|
40
|
+
expect(subject()).toContain('<title>My App</title>');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('with a configured favicon', () => {
|
|
45
|
+
beforeEach(
|
|
46
|
+
() => (context.bundlerConfig.pluginOverrides.html = { favicon: '/favicon.ico' })
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
test('renders the favicon link', () => {
|
|
50
|
+
expect(subject()).toContain('<link rel="icon" href="/favicon.ico" />');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('renders each shared CSS link with crossorigin', () => {
|
|
55
|
+
const html = subject();
|
|
56
|
+
|
|
57
|
+
css.forEach(item =>
|
|
58
|
+
expect(html).toContain(
|
|
59
|
+
`<link href="./${item}" rel="stylesheet" crossorigin="anonymous" />`
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('renders each shared JS script', () => {
|
|
65
|
+
const html = subject();
|
|
66
|
+
|
|
67
|
+
js.forEach(item => expect(html).toContain(`<script src="./${item}"></script>`));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('imports the host entry module', () => {
|
|
71
|
+
expect(subject()).toContain("import './dist/index'");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('when web component', () => {
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
context.package.isWebComponent = true;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('imports the MFE entry module', () => {
|
|
80
|
+
expect(subject()).toContain("import './index'");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('renders the custom element', () => {
|
|
84
|
+
expect(subject()).toContain(`<${context.build.name} />`);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('initializes the element on load', () => {
|
|
88
|
+
expect(subject()).toContain(
|
|
89
|
+
`document.querySelector('${context.build.name}')?.provide(`
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('self-hosts', () => {
|
|
94
|
+
expect(subject()).toContain('window.__mfeSelfHosted__ = true');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BuildContext, checkResource } from '../../../core';
|
|
2
|
+
import { ignoreModulesPlugin, VIRTUAL_PREFIX } from '../ignore-modules-plugin';
|
|
3
|
+
|
|
4
|
+
jest.mock('../../../core', () => ({
|
|
5
|
+
checkResource: jest.fn(),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
describe(ignoreModulesPlugin.name, () => {
|
|
9
|
+
const moduleName = 'some-module';
|
|
10
|
+
const context = {} as BuildContext;
|
|
11
|
+
const checker = jest.fn();
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
jest.mocked(checkResource).mockReturnValue(checker);
|
|
15
|
+
checker.mockReturnValue(false);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const subject = () => ignoreModulesPlugin(context);
|
|
19
|
+
|
|
20
|
+
test('creates plugin with correct name', () => {
|
|
21
|
+
expect(subject().name).toBe('ignore-modules');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('enforces pre order so it runs before built-in resolvers', () => {
|
|
25
|
+
expect(subject().enforce).toBe('pre');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('resolveId', () => {
|
|
29
|
+
let importer: string | undefined;
|
|
30
|
+
|
|
31
|
+
beforeEach(() => (importer = '/importer.ts'));
|
|
32
|
+
|
|
33
|
+
const subject = () => {
|
|
34
|
+
const plugin = ignoreModulesPlugin(context);
|
|
35
|
+
return (plugin.resolveId as Function).call(plugin, moduleName, importer);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const itReturnsUndefined = () => {
|
|
39
|
+
test('returns undefined', () => {
|
|
40
|
+
expect(subject()).toBeUndefined();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
itReturnsUndefined();
|
|
45
|
+
|
|
46
|
+
describe('when checker matches the resource', () => {
|
|
47
|
+
beforeEach(() => checker.mockReturnValue(true));
|
|
48
|
+
|
|
49
|
+
test('returns virtual id', () => {
|
|
50
|
+
expect(subject()).toBe(`${VIRTUAL_PREFIX}${moduleName}`);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('when importer is not provided', () => {
|
|
54
|
+
beforeEach(() => (importer = undefined));
|
|
55
|
+
|
|
56
|
+
itReturnsUndefined();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('load', () => {
|
|
62
|
+
let id: string;
|
|
63
|
+
|
|
64
|
+
beforeEach(() => (id = moduleName));
|
|
65
|
+
|
|
66
|
+
const subject = () => {
|
|
67
|
+
const plugin = ignoreModulesPlugin(context);
|
|
68
|
+
return (plugin.load as Function).call(plugin, id);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
test('returns undefined', () => {
|
|
72
|
+
expect(subject()).toBeUndefined();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('when id has virtual prefix', () => {
|
|
76
|
+
beforeEach(() => (id = `${VIRTUAL_PREFIX}${moduleName}`));
|
|
77
|
+
|
|
78
|
+
test('returns module that throws MODULE_NOT_FOUND on evaluation', () => {
|
|
79
|
+
expect(subject()).toBe(
|
|
80
|
+
`throw Object.assign(new Error("Cannot find module '${moduleName}'"), { code: 'MODULE_NOT_FOUND' });`
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import type { OutputBundle } from 'rolldown';
|
|
3
|
+
import { type BuildContext, generateMetadata } from '../../../core';
|
|
4
|
+
import { metadataPlugin } from '../metadata-plugin';
|
|
5
|
+
|
|
6
|
+
jest.mock('fs', () => fs);
|
|
7
|
+
jest.mock('../../../core', () => ({
|
|
8
|
+
generateMetadata: jest.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
describe(metadataPlugin.name, () => {
|
|
12
|
+
let context: BuildContext;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
vol.fromJSON({});
|
|
17
|
+
context = {
|
|
18
|
+
package: { isWebComponent: true },
|
|
19
|
+
} as BuildContext;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => vol.reset());
|
|
23
|
+
|
|
24
|
+
const subject = () => metadataPlugin(context);
|
|
25
|
+
|
|
26
|
+
describe('when package is not a web component', () => {
|
|
27
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
28
|
+
|
|
29
|
+
test('returns undefined', () => {
|
|
30
|
+
expect(subject()).toBeUndefined();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('returns plugin with correct name', () => {
|
|
35
|
+
expect(subject()!.name).toBe('metadata');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const defaultAddress = { port: 3000 };
|
|
39
|
+
|
|
40
|
+
const setupServer = ({
|
|
41
|
+
outDir,
|
|
42
|
+
address = () => defaultAddress,
|
|
43
|
+
}: {
|
|
44
|
+
outDir: string;
|
|
45
|
+
address?: () => unknown;
|
|
46
|
+
}) => {
|
|
47
|
+
const plugin = subject()!;
|
|
48
|
+
(plugin.configResolved as Function).call(plugin, {
|
|
49
|
+
build: { outDir },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
let listener!: Function;
|
|
53
|
+
const server: any = {
|
|
54
|
+
httpServer: {
|
|
55
|
+
once: (_event: string, cb: Function) => (listener = cb),
|
|
56
|
+
address,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
(plugin.configureServer as Function).call(plugin, server);
|
|
60
|
+
listener();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
describe('configResolved', () => {
|
|
64
|
+
const outDir = '/custom-output';
|
|
65
|
+
|
|
66
|
+
beforeEach(() => setupServer({ outDir }));
|
|
67
|
+
|
|
68
|
+
test('captures outDir for use by configureServer', () => {
|
|
69
|
+
expect(fs.existsSync(`${outDir}/entrypoints.json`)).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('configureServer', () => {
|
|
74
|
+
const outDir = '/output';
|
|
75
|
+
|
|
76
|
+
test('writes entrypoints.json', () => {
|
|
77
|
+
setupServer({ outDir });
|
|
78
|
+
|
|
79
|
+
const written = JSON.parse(
|
|
80
|
+
fs.readFileSync(`${outDir}/entrypoints.json`, 'utf8') as string
|
|
81
|
+
);
|
|
82
|
+
expect(written).toEqual({
|
|
83
|
+
module: true,
|
|
84
|
+
port: defaultAddress.port,
|
|
85
|
+
css: [],
|
|
86
|
+
js: ['@vite/client', '@id/__x00__VIRTUAL./index'],
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('calls generateMetadata', () => {
|
|
91
|
+
setupServer({ outDir });
|
|
92
|
+
|
|
93
|
+
expect(generateMetadata).toHaveBeenCalledWith(context);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('when address is a string', () => {
|
|
97
|
+
beforeEach(() => setupServer({ outDir, address: () => 'pipe-path' }));
|
|
98
|
+
|
|
99
|
+
test('does not write entrypoints', () => {
|
|
100
|
+
expect(fs.existsSync(`${outDir}/entrypoints.json`)).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('does not generate metadata', () => {
|
|
104
|
+
expect(generateMetadata).not.toHaveBeenCalled();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('writeBundle', () => {
|
|
110
|
+
const bundle = {
|
|
111
|
+
'main.js': { type: 'chunk', isEntry: true, fileName: 'assets/main.js' },
|
|
112
|
+
'vendor.js': { type: 'chunk', isEntry: false, fileName: 'assets/vendor.js' },
|
|
113
|
+
'style.css': { type: 'asset', fileName: 'assets/style.css' },
|
|
114
|
+
} as unknown as OutputBundle;
|
|
115
|
+
|
|
116
|
+
let options: { dir?: string };
|
|
117
|
+
|
|
118
|
+
beforeEach(() => {
|
|
119
|
+
options = { dir: '/build' };
|
|
120
|
+
fs.mkdirSync(options.dir!, { recursive: true });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const subject = () => {
|
|
124
|
+
const plugin = metadataPlugin(context)!;
|
|
125
|
+
return (plugin.writeBundle as Function).call(plugin, options, bundle);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
test('writes entrypoints.json with entry JS and CSS files', () => {
|
|
129
|
+
subject();
|
|
130
|
+
|
|
131
|
+
const entries = Object.values(bundle);
|
|
132
|
+
const expectedJs = entries
|
|
133
|
+
.filter(e => e.type === 'chunk' && e.isEntry)
|
|
134
|
+
.map(e => e.fileName);
|
|
135
|
+
const expectedCss = entries
|
|
136
|
+
.filter(e => e.type === 'asset' && e.fileName.endsWith('.css'))
|
|
137
|
+
.map(e => e.fileName);
|
|
138
|
+
|
|
139
|
+
const written = JSON.parse(
|
|
140
|
+
fs.readFileSync(`${options.dir}/entrypoints.json`, 'utf8') as string
|
|
141
|
+
);
|
|
142
|
+
expect(written).toEqual({
|
|
143
|
+
module: true,
|
|
144
|
+
css: expectedCss,
|
|
145
|
+
js: expectedJs,
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('calls generateMetadata', () => {
|
|
150
|
+
subject();
|
|
151
|
+
|
|
152
|
+
expect(generateMetadata).toHaveBeenCalledWith(context);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe('when options.dir is not set', () => {
|
|
156
|
+
beforeEach(() => (options.dir = undefined));
|
|
157
|
+
|
|
158
|
+
test('throws error', () => {
|
|
159
|
+
expect(() => subject()).toThrow('web-component build requires output.dir');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|