@nx/react 0.0.0-pr-22179-271588f
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/LICENSE +22 -0
- package/README.md +68 -0
- package/ast-utils.d.ts +1 -0
- package/ast-utils.js +11 -0
- package/babel.d.ts +20 -0
- package/babel.js +50 -0
- package/executors.json +14 -0
- package/generators.json +112 -0
- package/index.d.ts +22 -0
- package/index.js +47 -0
- package/mf/dynamic-federation.d.ts +4 -0
- package/mf/dynamic-federation.js +75 -0
- package/mf/index.d.ts +1 -0
- package/mf/index.js +7 -0
- package/migrations.json +310 -0
- package/module-federation.d.ts +4 -0
- package/module-federation.js +12 -0
- package/package.json +49 -0
- package/plugins/bundle-rollup.d.ts +1 -0
- package/plugins/bundle-rollup.js +47 -0
- package/plugins/component-testing/index.d.ts +37 -0
- package/plugins/component-testing/index.js +222 -0
- package/plugins/component-testing/webpack-fallback.d.ts +5 -0
- package/plugins/component-testing/webpack-fallback.js +125 -0
- package/plugins/jest.d.ts +1 -0
- package/plugins/jest.js +59 -0
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.d.ts +4 -0
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +60 -0
- package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.d.ts +8 -0
- package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.js +13 -0
- package/plugins/storybook/index.d.ts +3 -0
- package/plugins/storybook/index.js +174 -0
- package/plugins/storybook/merge-plugins.d.ts +3 -0
- package/plugins/storybook/merge-plugins.js +17 -0
- package/plugins/webpack.d.ts +1 -0
- package/plugins/webpack.js +6 -0
- package/plugins/with-react.d.ts +10 -0
- package/plugins/with-react.js +22 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +25 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +211 -0
- package/src/executors/module-federation-dev-server/schema.json +114 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +9 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +106 -0
- package/src/executors/module-federation-ssr-dev-server/schema.json +48 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +232 -0
- package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rspack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-rspack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-rspack/src/index.html +14 -0
- package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-vite/index.html__tmpl__ +16 -0
- package/src/generators/application/files/base-vite/public/favicon.ico +0 -0
- package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-vite/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-vite/src/environments/environment.prod.ts__tmpl__ +3 -0
- package/src/generators/application/files/base-vite/src/environments/environment.ts__tmpl__ +6 -0
- package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-webpack/src/index.html +12 -0
- package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +50 -0
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +886 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.module.__style__ +1 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +36 -0
- package/src/generators/application/files/style-css-module/src/styles.__style__ +1 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.__style__ +1 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +35 -0
- package/src/generators/application/files/style-global-css/src/styles.__style__ +1 -0
- package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +34 -0
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +37 -0
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +40 -0
- package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +33 -0
- package/src/generators/application/files/style-tailwind/src/styles.css +1 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +79 -0
- package/src/generators/application/lib/add-jest.d.ts +3 -0
- package/src/generators/application/lib/add-jest.js +21 -0
- package/src/generators/application/lib/add-project.d.ts +3 -0
- package/src/generators/application/lib/add-project.js +96 -0
- package/src/generators/application/lib/add-routing.d.ts +3 -0
- package/src/generators/application/lib/add-routing.js +27 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +143 -0
- package/src/generators/application/lib/find-free-port.d.ts +2 -0
- package/src/generators/application/lib/find-free-port.js +16 -0
- package/src/generators/application/lib/get-app-tests.d.ts +2 -0
- package/src/generators/application/lib/get-app-tests.js +21 -0
- package/src/generators/application/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/application/lib/install-common-dependencies.js +47 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +72 -0
- package/src/generators/application/lib/set-defaults.d.ts +3 -0
- package/src/generators/application/lib/set-defaults.js +43 -0
- package/src/generators/application/lib/show-possible-warnings.d.ts +3 -0
- package/src/generators/application/lib/show-possible-warnings.js +11 -0
- package/src/generators/application/lib/update-jest-config.d.ts +3 -0
- package/src/generators/application/lib/update-jest-config.js +30 -0
- package/src/generators/application/schema.d.ts +45 -0
- package/src/generators/application/schema.json +201 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +93 -0
- package/src/generators/component/files/__fileName__.__style__ +0 -0
- package/src/generators/component/files/__fileName__.module.__style__ +7 -0
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +7 -0
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +88 -0
- package/src/generators/component/lib/get-component-tests.d.ts +2 -0
- package/src/generators/component/lib/get-component-tests.js +12 -0
- package/src/generators/component/lib/normalize-options.d.ts +3 -0
- package/src/generators/component/lib/normalize-options.js +50 -0
- package/src/generators/component/schema.d.ts +48 -0
- package/src/generators/component/schema.json +150 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +13 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js +100 -0
- package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +13 -0
- package/src/generators/component-cypress-spec/schema.json +44 -0
- package/src/generators/component-story/component-story.d.ts +12 -0
- package/src/generators/component-story/component-story.js +72 -0
- package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +29 -0
- package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +36 -0
- package/src/generators/component-story/schema.json +42 -0
- package/src/generators/component-test/component-test.d.ts +4 -0
- package/src/generators/component-test/component-test.js +76 -0
- package/src/generators/component-test/files/__fileName__.cy__ext__ +21 -0
- package/src/generators/component-test/schema.d.ts +4 -0
- package/src/generators/component-test/schema.js +2 -0
- package/src/generators/component-test/schema.json +31 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +10 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +51 -0
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +4 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js +45 -0
- package/src/generators/cypress-component-configuration/schema.d.ts +8 -0
- package/src/generators/cypress-component-configuration/schema.json +54 -0
- package/src/generators/federate-module/federate-module.d.ts +4 -0
- package/src/generators/federate-module/federate-module.js +70 -0
- package/src/generators/federate-module/lib/utils.d.ts +23 -0
- package/src/generators/federate-module/lib/utils.js +100 -0
- package/src/generators/federate-module/schema.d.ts +13 -0
- package/src/generators/federate-module/schema.json +83 -0
- package/src/generators/hook/files/__fileName__.spec.tsx__tmpl__ +18 -0
- package/src/generators/hook/files/__fileName__.ts__tmpl__ +15 -0
- package/src/generators/hook/hook.d.ts +5 -0
- package/src/generators/hook/hook.js +131 -0
- package/src/generators/hook/schema.d.ts +24 -0
- package/src/generators/hook/schema.json +84 -0
- package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +33 -0
- package/src/generators/host/files/common/src/main.js__tmpl__ +10 -0
- package/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +41 -0
- package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +10 -0
- package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +21 -0
- package/src/generators/host/files/module-federation/webpack.config.js__tmpl__ +12 -0
- package/src/generators/host/files/module-federation/webpack.config.prod.js__tmpl__ +32 -0
- package/src/generators/host/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +16 -0
- package/src/generators/host/files/module-federation-ssr/server.ts__tmpl__ +28 -0
- package/src/generators/host/files/module-federation-ssr/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/host/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +13 -0
- package/src/generators/host/files/module-federation-ssr-ts/server.ts__tmpl__ +28 -0
- package/src/generators/host/files/module-federation-ssr-ts/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/host/files/module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +12 -0
- package/src/generators/host/files/module-federation-ts/module-federation.config.ts__tmpl__ +25 -0
- package/src/generators/host/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +33 -0
- package/src/generators/host/files/module-federation-ts/webpack.config.ts__tmpl__ +12 -0
- package/src/generators/host/host.d.ts +5 -0
- package/src/generators/host/host.js +95 -0
- package/src/generators/host/lib/add-module-federation-files.d.ts +6 -0
- package/src/generators/host/lib/add-module-federation-files.js +52 -0
- package/src/generators/host/lib/normalize-remote.d.ts +4 -0
- package/src/generators/host/lib/normalize-remote.js +28 -0
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +6 -0
- package/src/generators/host/lib/setup-ssr-for-host.js +33 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.d.ts +3 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.js +20 -0
- package/src/generators/host/schema.d.ts +37 -0
- package/src/generators/host/schema.json +184 -0
- package/src/generators/init/init.d.ts +4 -0
- package/src/generators/init/init.js +23 -0
- package/src/generators/init/schema.d.ts +5 -0
- package/src/generators/init/schema.json +27 -0
- package/src/generators/library/files/common/README.md +7 -0
- package/src/generators/library/files/common/package.json__tmpl__ +4 -0
- package/src/generators/library/files/common/src/index.ts__tmpl__ +0 -0
- package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/files/vite/README.md +7 -0
- package/src/generators/library/files/vite/package.json__tmpl__ +12 -0
- package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/lib/add-linting.d.ts +3 -0
- package/src/generators/library/lib/add-linting.js +36 -0
- package/src/generators/library/lib/add-rollup-build-target.d.ts +4 -0
- package/src/generators/library/lib/add-rollup-build-target.js +59 -0
- package/src/generators/library/lib/create-files.d.ts +3 -0
- package/src/generators/library/lib/create-files.js +53 -0
- package/src/generators/library/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/library/lib/install-common-dependencies.js +47 -0
- package/src/generators/library/lib/normalize-options.d.ts +3 -0
- package/src/generators/library/lib/normalize-options.js +92 -0
- package/src/generators/library/lib/set-defaults.d.ts +3 -0
- package/src/generators/library/lib/set-defaults.js +23 -0
- package/src/generators/library/lib/update-app-routes.d.ts +3 -0
- package/src/generators/library/lib/update-app-routes.js +62 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +193 -0
- package/src/generators/library/schema.d.ts +45 -0
- package/src/generators/library/schema.json +198 -0
- package/src/generators/redux/files/__fileName__.slice.spec.ts__tmpl__ +56 -0
- package/src/generators/redux/files/__fileName__.slice.ts__tmpl__ +129 -0
- package/src/generators/redux/redux.d.ts +5 -0
- package/src/generators/redux/redux.js +143 -0
- package/src/generators/redux/schema.d.ts +23 -0
- package/src/generators/redux/schema.json +51 -0
- package/src/generators/remote/files/common/src/main.js__tmpl__ +1 -0
- package/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +1 -0
- package/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +1 -0
- package/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +9 -0
- package/src/generators/remote/files/module-federation/webpack.config.js__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation/webpack.config.prod.js__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
- package/src/generators/remote/files/module-federation-ssr/server.ts__tmpl__ +45 -0
- package/src/generators/remote/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +10 -0
- package/src/generators/remote/files/module-federation-ssr-ts/server.ts__tmpl__ +45 -0
- package/src/generators/remote/files/module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/remote/files/module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation-ts/module-federation.config.ts__tmpl__ +13 -0
- package/src/generators/remote/files/module-federation-ts/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/remote/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation-ts/webpack.config.ts__tmpl__ +12 -0
- package/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +2 -0
- package/src/generators/remote/lib/add-remote-to-dynamic-host.js +11 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +4 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js +40 -0
- package/src/generators/remote/lib/setup-tspath-for-remote.d.ts +3 -0
- package/src/generators/remote/lib/setup-tspath-for-remote.js +15 -0
- package/src/generators/remote/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/remote/lib/update-host-with-remote.js +64 -0
- package/src/generators/remote/remote.d.ts +7 -0
- package/src/generators/remote/remote.js +104 -0
- package/src/generators/remote/schema.d.ts +34 -0
- package/src/generators/remote/schema.json +183 -0
- package/src/generators/setup-ssr/files/server.ts__tmpl__ +28 -0
- package/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +47 -0
- package/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/setup-ssr/schema.d.ts +7 -0
- package/src/generators/setup-ssr/schema.json +48 -0
- package/src/generators/setup-ssr/setup-ssr.d.ts +4 -0
- package/src/generators/setup-ssr/setup-ssr.js +183 -0
- package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +15 -0
- package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +17 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +36 -0
- package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/update-project.js +13 -0
- package/src/generators/setup-tailwind/schema.d.ts +6 -0
- package/src/generators/setup-tailwind/schema.js +2 -0
- package/src/generators/setup-tailwind/schema.json +47 -0
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +4 -0
- package/src/generators/setup-tailwind/setup-tailwind.js +35 -0
- package/src/generators/stories/schema.json +67 -0
- package/src/generators/stories/stories.d.ts +15 -0
- package/src/generators/stories/stories.js +130 -0
- package/src/generators/storybook-configuration/configuration.d.ts +6 -0
- package/src/generators/storybook-configuration/configuration.js +74 -0
- package/src/generators/storybook-configuration/schema.d.ts +16 -0
- package/src/generators/storybook-configuration/schema.json +95 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.d.ts +3 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +37 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.d.ts +3 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.js +15 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +2 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js +103 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.d.ts +2 -0
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +8 -0
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.d.ts +2 -0
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +8 -0
- package/src/migrations/update-16-7-0/add-babel-core.d.ts +2 -0
- package/src/migrations/update-16-7-0/add-babel-core.js +14 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.d.ts +2 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +57 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +2 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +26 -0
- package/src/module-federation/ast-utils.d.ts +8 -0
- package/src/module-federation/ast-utils.js +102 -0
- package/src/module-federation/load-config.d.ts +3 -0
- package/src/module-federation/load-config.js +16 -0
- package/src/module-federation/models.d.ts +24 -0
- package/src/module-federation/models.js +2 -0
- package/src/module-federation/package-json.d.ts +8 -0
- package/src/module-federation/package-json.js +13 -0
- package/src/module-federation/utils.d.ts +12 -0
- package/src/module-federation/utils.js +76 -0
- package/src/module-federation/with-module-federation-ssr.d.ts +2 -0
- package/src/module-federation/with-module-federation-ssr.js +34 -0
- package/src/module-federation/with-module-federation.d.ts +7 -0
- package/src/module-federation/with-module-federation.js +50 -0
- package/src/rules/add-styled-dependencies.d.ts +5 -0
- package/src/rules/add-styled-dependencies.js +17 -0
- package/src/rules/update-module-federation-project.d.ts +9 -0
- package/src/rules/update-module-federation-project.js +50 -0
- package/src/utils/add-mf-env-to-inputs.d.ts +2 -0
- package/src/utils/add-mf-env-to-inputs.js +24 -0
- package/src/utils/assertion.d.ts +1 -0
- package/src/utils/assertion.js +19 -0
- package/src/utils/ast-utils.d.ts +29 -0
- package/src/utils/ast-utils.js +522 -0
- package/src/utils/component-props.d.ts +15 -0
- package/src/utils/component-props.js +60 -0
- package/src/utils/create-ts-config.d.ts +9 -0
- package/src/utils/create-ts-config.js +65 -0
- package/src/utils/ct-utils.d.ts +14 -0
- package/src/utils/ct-utils.js +94 -0
- package/src/utils/dependencies.d.ts +7 -0
- package/src/utils/dependencies.js +2 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +12 -0
- package/src/utils/get-in-source-vitest-tests-template.d.ts +1 -0
- package/src/utils/get-in-source-vitest-tests-template.js +21 -0
- package/src/utils/has-vite-plugin.d.ts +2 -0
- package/src/utils/has-vite-plugin.js +11 -0
- package/src/utils/has-webpack-plugin.d.ts +2 -0
- package/src/utils/has-webpack-plugin.js +11 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +9 -0
- package/src/utils/lint.d.ts +36 -0
- package/src/utils/lint.js +24 -0
- package/src/utils/maybe-js.d.ts +3 -0
- package/src/utils/maybe-js.js +9 -0
- package/src/utils/styled.d.ts +3 -0
- package/src/utils/styled.js +62 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +30 -0
- package/src/utils/versions.d.ts +46 -0
- package/src/utils/versions.js +54 -0
- package/tailwind.d.ts +6 -0
- package/tailwind.js +29 -0
- package/typings/cssmodule.d.ts +19 -0
- package/typings/image.d.ts +48 -0
- package/typings/style.d.ts +9 -0
- package/typings/styled-jsx.d.ts +8 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBaseWebpackConfig = void 0;
|
|
4
|
+
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
5
|
+
const webpack_1 = require("@nx/webpack");
|
|
6
|
+
function buildBaseWebpackConfig({ tsConfigPath = 'tsconfig.cy.json', compiler = 'babel', }) {
|
|
7
|
+
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
8
|
+
const config = {
|
|
9
|
+
target: 'web',
|
|
10
|
+
resolve: {
|
|
11
|
+
extensions,
|
|
12
|
+
plugins: [
|
|
13
|
+
new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
|
|
14
|
+
configFile: tsConfigPath,
|
|
15
|
+
extensions,
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
mode: 'development',
|
|
20
|
+
devtool: false,
|
|
21
|
+
output: {
|
|
22
|
+
publicPath: '/',
|
|
23
|
+
chunkFilename: '[name].bundle.js',
|
|
24
|
+
},
|
|
25
|
+
module: {
|
|
26
|
+
rules: [
|
|
27
|
+
{
|
|
28
|
+
test: /\.(bmp|png|jpe?g|gif|webp|avif)$/,
|
|
29
|
+
type: 'asset',
|
|
30
|
+
parser: {
|
|
31
|
+
dataUrlCondition: {
|
|
32
|
+
maxSize: 10000, // 10 kB
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
CSS_MODULES_LOADER,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
if (compiler === 'swc') {
|
|
41
|
+
config.module.rules.push({
|
|
42
|
+
test: /\.([jt])sx?$/,
|
|
43
|
+
loader: require.resolve('swc-loader'),
|
|
44
|
+
exclude: /node_modules/,
|
|
45
|
+
options: {
|
|
46
|
+
jsc: {
|
|
47
|
+
parser: {
|
|
48
|
+
syntax: 'typescript',
|
|
49
|
+
decorators: true,
|
|
50
|
+
tsx: true,
|
|
51
|
+
},
|
|
52
|
+
transform: {
|
|
53
|
+
react: {
|
|
54
|
+
runtime: 'automatic',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
loose: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (compiler === 'babel') {
|
|
63
|
+
config.module.rules.push({
|
|
64
|
+
test: /\.(js|jsx|mjs|ts|tsx)$/,
|
|
65
|
+
loader: require.resolve('babel-loader'),
|
|
66
|
+
options: {
|
|
67
|
+
presets: [`@nx/react/babel`],
|
|
68
|
+
rootMode: 'upward',
|
|
69
|
+
babelrc: true,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return config;
|
|
74
|
+
}
|
|
75
|
+
exports.buildBaseWebpackConfig = buildBaseWebpackConfig;
|
|
76
|
+
const loaderModulesOptions = {
|
|
77
|
+
modules: {
|
|
78
|
+
mode: 'local',
|
|
79
|
+
getLocalIdent: webpack_1.getCSSModuleLocalIdent,
|
|
80
|
+
},
|
|
81
|
+
importLoaders: 1,
|
|
82
|
+
};
|
|
83
|
+
const commonLoaders = [
|
|
84
|
+
{
|
|
85
|
+
loader: require.resolve('style-loader'),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
loader: require.resolve('css-loader'),
|
|
89
|
+
options: loaderModulesOptions,
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
const CSS_MODULES_LOADER = {
|
|
93
|
+
test: /\.css$|\.scss$|\.sass$|\.less$/,
|
|
94
|
+
oneOf: [
|
|
95
|
+
{
|
|
96
|
+
test: /\.module\.css$/,
|
|
97
|
+
use: commonLoaders,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
test: /\.module\.(scss|sass)$/,
|
|
101
|
+
use: [
|
|
102
|
+
...commonLoaders,
|
|
103
|
+
{
|
|
104
|
+
loader: require.resolve('sass-loader'),
|
|
105
|
+
options: {
|
|
106
|
+
implementation: require('sass'),
|
|
107
|
+
sassOptions: {
|
|
108
|
+
fiber: false,
|
|
109
|
+
precision: 8,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
test: /\.module\.less$/,
|
|
117
|
+
use: [
|
|
118
|
+
...commonLoaders,
|
|
119
|
+
{
|
|
120
|
+
loader: require.resolve('less-loader'),
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/plugins/jest.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const JS_SOURCE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'];
|
|
6
|
+
module.exports = {
|
|
7
|
+
process(src, filename, options) {
|
|
8
|
+
const assetFilename = JSON.stringify(path.basename(filename));
|
|
9
|
+
if (filename.match(/\.svg$/)) {
|
|
10
|
+
// Based on how SVGR generates a component name:
|
|
11
|
+
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
|
|
12
|
+
const pascalCaseFilename = (0, devkit_1.names)(path.parse(filename).name).className;
|
|
13
|
+
const componentName = `Svg${pascalCaseFilename}`;
|
|
14
|
+
return {
|
|
15
|
+
code: `const React = require('react');
|
|
16
|
+
module.exports = {
|
|
17
|
+
__esModule: true,
|
|
18
|
+
default: ${assetFilename},
|
|
19
|
+
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
|
|
20
|
+
return {
|
|
21
|
+
$$typeof: Symbol.for('react.element'),
|
|
22
|
+
type: 'svg',
|
|
23
|
+
ref: ref,
|
|
24
|
+
key: null,
|
|
25
|
+
props: Object.assign({}, props, {
|
|
26
|
+
children: ${assetFilename}
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
};`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (JS_SOURCE_EXTENSIONS.includes(path.extname(filename))) {
|
|
34
|
+
const transformer = getJsTransform(options.config?.transform ?? []);
|
|
35
|
+
if (transformer)
|
|
36
|
+
return transformer.process(src, filename, options);
|
|
37
|
+
}
|
|
38
|
+
// Fallback for unknown extensions
|
|
39
|
+
return {
|
|
40
|
+
code: `module.exports = ${assetFilename};`,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
function getJsTransform(transformers) {
|
|
45
|
+
try {
|
|
46
|
+
if (transformers?.[1]?.includes('@swc/jest')) {
|
|
47
|
+
return require('@swc/jest').createTransformer();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// ignored
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return require('babel-jest').default.createTransformer();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// ignored
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyReactConfig = void 0;
|
|
4
|
+
function applyReactConfig(options, config = {}) {
|
|
5
|
+
if (!process.env['NX_TASK_TARGET_PROJECT'])
|
|
6
|
+
return;
|
|
7
|
+
addHotReload(config);
|
|
8
|
+
if (options.svgr !== false) {
|
|
9
|
+
removeSvgLoaderIfPresent(config);
|
|
10
|
+
config.module.rules.push({
|
|
11
|
+
test: /\.svg$/,
|
|
12
|
+
issuer: /\.(js|ts|md)x?$/,
|
|
13
|
+
use: [
|
|
14
|
+
{
|
|
15
|
+
loader: require.resolve('@svgr/webpack'),
|
|
16
|
+
options: {
|
|
17
|
+
svgo: false,
|
|
18
|
+
titleProp: true,
|
|
19
|
+
ref: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// enable webpack node api
|
|
26
|
+
config.node = {
|
|
27
|
+
__dirname: true,
|
|
28
|
+
__filename: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.applyReactConfig = applyReactConfig;
|
|
32
|
+
function addHotReload(config) {
|
|
33
|
+
if (config.mode === 'development' && config['devServer']?.hot) {
|
|
34
|
+
// add `react-refresh/babel` to babel loader plugin
|
|
35
|
+
const babelLoader = config.module.rules.find((rule) => rule &&
|
|
36
|
+
typeof rule !== 'string' &&
|
|
37
|
+
rule.loader?.toString().includes('babel-loader'));
|
|
38
|
+
if (babelLoader && typeof babelLoader !== 'string') {
|
|
39
|
+
babelLoader.options['plugins'] = [
|
|
40
|
+
...(babelLoader.options['plugins'] || []),
|
|
41
|
+
[
|
|
42
|
+
require.resolve('react-refresh/babel'),
|
|
43
|
+
{
|
|
44
|
+
skipEnvCheck: true,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
50
|
+
config.plugins.push(new ReactRefreshPlugin());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// We remove potentially conflicting rules that target SVGs because we use @svgr/webpack loader
|
|
54
|
+
// See https://github.com/nrwl/nx/issues/14383
|
|
55
|
+
function removeSvgLoaderIfPresent(config) {
|
|
56
|
+
const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' && rule.test.toString().includes('svg'));
|
|
57
|
+
if (svgLoaderIdx === -1)
|
|
58
|
+
return;
|
|
59
|
+
config.module.rules.splice(svgLoaderIdx, 1);
|
|
60
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NxReactWebpackPlugin = void 0;
|
|
4
|
+
const apply_react_config_1 = require("./lib/apply-react-config");
|
|
5
|
+
class NxReactWebpackPlugin {
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
}
|
|
9
|
+
apply(compiler) {
|
|
10
|
+
(0, apply_react_config_1.applyReactConfig)(this.options, compiler.options);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.NxReactWebpackPlugin = NxReactWebpackPlugin;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webpack = exports.core = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const config_1 = require("@nx/webpack/src/utils/config");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const webpack_1 = require("webpack");
|
|
8
|
+
const merge_plugins_1 = require("./merge-plugins");
|
|
9
|
+
const with_react_1 = require("../with-react");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
// This is shamelessly taken from CRA and modified for NX use
|
|
12
|
+
// https://github.com/facebook/create-react-app/blob/4784997f0682e75eb32a897b4ffe34d735912e6c/packages/react-scripts/config/env.js#L71
|
|
13
|
+
function getClientEnvironment(mode) {
|
|
14
|
+
// Grab NODE_ENV and NX_* and STORYBOOK_* environment variables and prepare them to be
|
|
15
|
+
// injected into the application via DefinePlugin in webpack configuration.
|
|
16
|
+
const NX_PREFIX = /^NX_/i;
|
|
17
|
+
const STORYBOOK_PREFIX = /^STORYBOOK_/i;
|
|
18
|
+
const raw = Object.keys(process.env)
|
|
19
|
+
.filter((key) => NX_PREFIX.test(key) || STORYBOOK_PREFIX.test(key))
|
|
20
|
+
.reduce((env, key) => {
|
|
21
|
+
env[key] = process.env[key];
|
|
22
|
+
return env;
|
|
23
|
+
}, {
|
|
24
|
+
// Useful for determining whether we’re running in production mode.
|
|
25
|
+
NODE_ENV: process.env.NODE_ENV || mode,
|
|
26
|
+
// Environment variables for Storybook
|
|
27
|
+
// https://github.com/storybookjs/storybook/blob/bdf9e5ed854b8d34e737eee1a4a05add88265e92/lib/core-common/src/utils/envs.ts#L12-L21
|
|
28
|
+
NODE_PATH: process.env.NODE_PATH || '',
|
|
29
|
+
STORYBOOK: process.env.STORYBOOK || 'true',
|
|
30
|
+
// This is to support CRA's public folder feature.
|
|
31
|
+
// In production we set this to dot(.) to allow the browser to access these assets
|
|
32
|
+
// even when deployed inside a subpath. (like in GitHub pages)
|
|
33
|
+
// In development this is just empty as we always serves from the root.
|
|
34
|
+
PUBLIC_URL: mode === 'production' ? '.' : '',
|
|
35
|
+
});
|
|
36
|
+
// Stringify all values so we can feed into webpack DefinePlugin
|
|
37
|
+
const stringified = {
|
|
38
|
+
'process.env': Object.keys(raw).reduce((env, key) => {
|
|
39
|
+
env[key] = JSON.stringify(raw[key]);
|
|
40
|
+
return env;
|
|
41
|
+
}, {}),
|
|
42
|
+
};
|
|
43
|
+
return { stringified };
|
|
44
|
+
}
|
|
45
|
+
const core = (prev, options) => ({
|
|
46
|
+
...prev,
|
|
47
|
+
disableWebpackDefaults: true,
|
|
48
|
+
});
|
|
49
|
+
exports.core = core;
|
|
50
|
+
const getProjectData = async (storybookOptions) => {
|
|
51
|
+
const fallbackData = {
|
|
52
|
+
workspaceRoot: storybookOptions.configDir,
|
|
53
|
+
projectRoot: '',
|
|
54
|
+
sourceRoot: '',
|
|
55
|
+
};
|
|
56
|
+
// Edge-case: not running from Nx
|
|
57
|
+
if (!process.env.NX_WORKSPACE_ROOT)
|
|
58
|
+
return fallbackData;
|
|
59
|
+
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
60
|
+
const projectNode = projectGraph.nodes[process.env.NX_TASK_TARGET_PROJECT];
|
|
61
|
+
return projectNode
|
|
62
|
+
? {
|
|
63
|
+
workspaceRoot: process.env.NX_WORKSPACE_ROOT,
|
|
64
|
+
projectRoot: projectNode.data.root,
|
|
65
|
+
sourceRoot: projectNode.data.sourceRoot,
|
|
66
|
+
projectNode,
|
|
67
|
+
}
|
|
68
|
+
: // Edge-case: missing project node
|
|
69
|
+
fallbackData;
|
|
70
|
+
};
|
|
71
|
+
const fixBabelConfigurationIfNeeded = (webpackConfig, projectData) => {
|
|
72
|
+
if (!projectData.projectNode)
|
|
73
|
+
return;
|
|
74
|
+
const isUsingBabelUpwardRootMode = Object.keys(projectData.projectNode.data.targets).find((k) => {
|
|
75
|
+
const targetConfig = projectData.projectNode.data.targets[k];
|
|
76
|
+
return ((targetConfig.executor === '@nx/webpack:webpack' ||
|
|
77
|
+
targetConfig.executor === '@nrwl/webpack:webpack') &&
|
|
78
|
+
targetConfig.options?.babelUpwardRootMode);
|
|
79
|
+
});
|
|
80
|
+
if (isUsingBabelUpwardRootMode)
|
|
81
|
+
return;
|
|
82
|
+
let babelrcPath;
|
|
83
|
+
for (const ext of ['', '.json', '.js', '.cjs', '.mjs', '.cts']) {
|
|
84
|
+
const candidate = (0, path_1.join)(projectData.workspaceRoot, projectData.projectRoot, `.babelrc${ext}`);
|
|
85
|
+
if ((0, fs_1.existsSync)(candidate)) {
|
|
86
|
+
babelrcPath = candidate;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Unexpected setup, skip.
|
|
91
|
+
if (!babelrcPath)
|
|
92
|
+
return;
|
|
93
|
+
let babelRuleItem;
|
|
94
|
+
for (const rule of webpackConfig.module.rules) {
|
|
95
|
+
if (typeof rule === 'string')
|
|
96
|
+
continue;
|
|
97
|
+
if (!rule || !Array.isArray(rule.use))
|
|
98
|
+
continue;
|
|
99
|
+
for (const item of rule.use) {
|
|
100
|
+
if (typeof item !== 'string' && item['loader'].includes('babel-loader')) {
|
|
101
|
+
babelRuleItem = item;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (babelRuleItem) {
|
|
107
|
+
babelRuleItem.options.configFile = babelrcPath;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const webpack = async (storybookWebpackConfig = {}, options) => {
|
|
111
|
+
devkit_1.logger.info('=> Loading Nx React Storybook Addon from "@nx/react/plugins/storybook"');
|
|
112
|
+
// In case anyone is missing dep and did not run migrations.
|
|
113
|
+
// See: https://github.com/nrwl/nx/issues/14455
|
|
114
|
+
try {
|
|
115
|
+
require.resolve('@nx/webpack');
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
throw new Error(`'@nx/webpack' package is not installed. Install it and try again.`);
|
|
119
|
+
}
|
|
120
|
+
const { withNx, withWeb } = require('@nx/webpack');
|
|
121
|
+
const projectData = await getProjectData(options);
|
|
122
|
+
const tsconfigPath = (0, fs_1.existsSync)((0, path_1.join)(projectData.projectRoot, 'tsconfig.storybook.json'))
|
|
123
|
+
? (0, path_1.join)(projectData.projectRoot, 'tsconfig.storybook.json')
|
|
124
|
+
: (0, path_1.join)(projectData.projectRoot, 'tsconfig.json');
|
|
125
|
+
// The 'tsconfig.json' is mainly for the cypress test to be able to run
|
|
126
|
+
// because it will look into the cypress project dir and it will not find tsconfig.storybook.json
|
|
127
|
+
fixBabelConfigurationIfNeeded(storybookWebpackConfig, projectData);
|
|
128
|
+
const builderOptions = {
|
|
129
|
+
...options,
|
|
130
|
+
root: projectData.workspaceRoot,
|
|
131
|
+
projectRoot: projectData.projectRoot,
|
|
132
|
+
sourceRoot: projectData.sourceRoot,
|
|
133
|
+
fileReplacements: [],
|
|
134
|
+
sourceMap: true,
|
|
135
|
+
styles: options.styles ?? [],
|
|
136
|
+
optimization: {},
|
|
137
|
+
tsConfig: tsconfigPath,
|
|
138
|
+
extractCss: storybookWebpackConfig.mode === 'production',
|
|
139
|
+
target: 'web',
|
|
140
|
+
};
|
|
141
|
+
// ESM build for modern browsers.
|
|
142
|
+
let baseWebpackConfig = {};
|
|
143
|
+
const configure = (0, config_1.composePluginsSync)(withNx({ target: 'web', skipTypeChecking: true }), (0, with_react_1.withReact)());
|
|
144
|
+
const finalConfig = configure(baseWebpackConfig, {
|
|
145
|
+
options: builderOptions,
|
|
146
|
+
context: { root: devkit_1.workspaceRoot }, // The context is not used here.
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
...storybookWebpackConfig,
|
|
150
|
+
module: {
|
|
151
|
+
...storybookWebpackConfig.module,
|
|
152
|
+
rules: [
|
|
153
|
+
...storybookWebpackConfig.module.rules,
|
|
154
|
+
...finalConfig.module.rules,
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
resolve: {
|
|
158
|
+
...storybookWebpackConfig.resolve,
|
|
159
|
+
fallback: {
|
|
160
|
+
...storybookWebpackConfig.resolve?.fallback,
|
|
161
|
+
// Next.js and other React frameworks may have server-code that uses these modules.
|
|
162
|
+
// They are not meant for client-side components so skip the fallbacks.
|
|
163
|
+
assert: false,
|
|
164
|
+
path: false,
|
|
165
|
+
util: false,
|
|
166
|
+
},
|
|
167
|
+
plugins: (0, merge_plugins_1.mergePlugins)(...(storybookWebpackConfig.resolve.plugins ??
|
|
168
|
+
[]), ...(finalConfig.resolve
|
|
169
|
+
.plugins ?? [])),
|
|
170
|
+
},
|
|
171
|
+
plugins: (0, merge_plugins_1.mergePlugins)(new webpack_1.DefinePlugin(getClientEnvironment(storybookWebpackConfig.mode).stringified), ...(storybookWebpackConfig.plugins ?? []), ...(finalConfig.plugins ?? [])),
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
exports.webpack = webpack;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ResolvePluginInstance, RuleSetRule, WebpackPluginInstance } from 'webpack';
|
|
2
|
+
export declare const mergeRules: (...args: RuleSetRule[]) => (WebpackPluginInstance | RuleSetRule)[];
|
|
3
|
+
export declare const mergePlugins: (...args: (WebpackPluginInstance | ResolvePluginInstance)[]) => (WebpackPluginInstance | ResolvePluginInstance)[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergePlugins = exports.mergeRules = void 0;
|
|
4
|
+
const mergeRules = (...args) => args.reduce((rules, rule) => {
|
|
5
|
+
if (rules.some((includedPlugin) => includedPlugin.constructor.name === rule.constructor.name)) {
|
|
6
|
+
return rules;
|
|
7
|
+
}
|
|
8
|
+
return [...rules, rule];
|
|
9
|
+
}, []);
|
|
10
|
+
exports.mergeRules = mergeRules;
|
|
11
|
+
const mergePlugins = (...args) => args.reduce((plugins, plugin) => {
|
|
12
|
+
if (plugins.some((includedPlugin) => includedPlugin.constructor.name === plugin.constructor.name)) {
|
|
13
|
+
return plugins;
|
|
14
|
+
}
|
|
15
|
+
return [...plugins, plugin];
|
|
16
|
+
}, []);
|
|
17
|
+
exports.mergePlugins = mergePlugins;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const webpack_1 = require("@nx/webpack");
|
|
4
|
+
const with_react_1 = require("./with-react");
|
|
5
|
+
const plugin = (0, webpack_1.composePlugins)((0, webpack_1.withNx)(), (0, with_react_1.withReact)());
|
|
6
|
+
module.exports = plugin;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Configuration } from 'webpack';
|
|
2
|
+
import type { NxWebpackExecutionContext, WithWebOptions } from '@nx/webpack';
|
|
3
|
+
export interface WithReactOptions extends WithWebOptions {
|
|
4
|
+
svgr?: false;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @param {WithReactOptions} pluginOptions
|
|
8
|
+
* @returns {NxWebpackPlugin}
|
|
9
|
+
*/
|
|
10
|
+
export declare function withReact(pluginOptions?: WithReactOptions): (config: Configuration, context: NxWebpackExecutionContext) => Configuration;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withReact = void 0;
|
|
4
|
+
const apply_react_config_1 = require("./nx-react-webpack-plugin/lib/apply-react-config");
|
|
5
|
+
const processed = new Set();
|
|
6
|
+
/**
|
|
7
|
+
* @param {WithReactOptions} pluginOptions
|
|
8
|
+
* @returns {NxWebpackPlugin}
|
|
9
|
+
*/
|
|
10
|
+
function withReact(pluginOptions = {}) {
|
|
11
|
+
return function configure(config, context) {
|
|
12
|
+
const { withWeb } = require('@nx/webpack');
|
|
13
|
+
if (processed.has(config))
|
|
14
|
+
return config;
|
|
15
|
+
// Apply web config for CSS, JSX, index.html handling, etc.
|
|
16
|
+
config = withWeb(pluginOptions)(config, context);
|
|
17
|
+
(0, apply_react_config_1.applyReactConfig)(pluginOptions, config);
|
|
18
|
+
processed.add(config);
|
|
19
|
+
return config;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.withReact = withReact;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { WebDevServerOptions } from '@nx/webpack/src/executors/dev-server/schema';
|
|
3
|
+
type ModuleFederationDevServerOptions = WebDevServerOptions & {
|
|
4
|
+
devRemotes?: string[];
|
|
5
|
+
skipRemotes?: string[];
|
|
6
|
+
static?: boolean;
|
|
7
|
+
isInitialHost?: boolean;
|
|
8
|
+
parallel?: number;
|
|
9
|
+
staticRemotesPort?: number;
|
|
10
|
+
};
|
|
11
|
+
type StaticRemoteConfig = {
|
|
12
|
+
basePath: string;
|
|
13
|
+
outputPath: string;
|
|
14
|
+
urlSegment: string;
|
|
15
|
+
};
|
|
16
|
+
type StaticRemotesConfig = {
|
|
17
|
+
remotes: string[];
|
|
18
|
+
config: Record<string, StaticRemoteConfig> | undefined;
|
|
19
|
+
};
|
|
20
|
+
export declare function parseStaticRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
|
|
21
|
+
export default function moduleFederationDevServer(options: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncIterableIterator<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}>;
|
|
25
|
+
export {};
|