@nx/react 16.0.0-beta.1
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/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/ast-utils.d.ts +1 -0
- package/ast-utils.js +12 -0
- package/ast-utils.js.map +1 -0
- package/babel.d.ts +16 -0
- package/babel.js +52 -0
- package/babel.js.map +1 -0
- package/executors.json +26 -0
- package/generators.json +223 -0
- package/index.d.ts +21 -0
- package/index.js +47 -0
- package/index.js.map +1 -0
- package/migrations.json +870 -0
- package/module-federation.d.ts +4 -0
- package/module-federation.js +13 -0
- package/module-federation.js.map +1 -0
- package/package.json +49 -0
- package/plugins/bundle-rollup.d.ts +1 -0
- package/plugins/bundle-rollup.js +42 -0
- package/plugins/bundle-rollup.js.map +1 -0
- package/plugins/component-testing/index.d.ts +38 -0
- package/plugins/component-testing/index.js +122 -0
- package/plugins/component-testing/index.js.map +1 -0
- package/plugins/component-testing/webpack-fallback.d.ts +5 -0
- package/plugins/component-testing/webpack-fallback.js +135 -0
- package/plugins/component-testing/webpack-fallback.js.map +1 -0
- package/plugins/jest.d.ts +1 -0
- package/plugins/jest.js +62 -0
- package/plugins/jest.js.map +1 -0
- package/plugins/storybook/index.d.ts +3 -0
- package/plugins/storybook/index.js +77 -0
- package/plugins/storybook/index.js.map +1 -0
- package/plugins/storybook/merge-plugins.d.ts +3 -0
- package/plugins/storybook/merge-plugins.js +18 -0
- package/plugins/storybook/merge-plugins.js.map +1 -0
- package/plugins/webpack.d.ts +3 -0
- package/plugins/webpack.js +15 -0
- package/plugins/webpack.js.map +1 -0
- package/plugins/with-react.d.ts +12 -0
- package/plugins/with-react.js +82 -0
- package/plugins/with-react.js.map +1 -0
- package/src/executors/module-federation-dev-server/compat.d.ts +2 -0
- package/src/executors/module-federation-dev-server/compat.js +6 -0
- package/src/executors/module-federation-dev-server/compat.js.map +1 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +11 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +55 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
- package/src/executors/module-federation-dev-server/schema.json +96 -0
- package/src/executors/module-federation-ssr-dev-server/compat.d.ts +2 -0
- package/src/executors/module-federation-ssr-dev-server/compat.js +6 -0
- package/src/executors/module-federation-ssr-dev-server/compat.js.map +1 -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 +71 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +1 -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 +129 -0
- package/src/generators/application/application.js.map +1 -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/.babelrc__tmpl__ +13 -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/environments/environment.prod.ts__tmpl__ +3 -0
- package/src/generators/application/files/base-webpack/src/environments/environment.ts__tmpl__ +6 -0
- package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-webpack/src/index.html +14 -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__ +9 -0
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +845 -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__ +37 -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__ +36 -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__ +35 -0
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +29 -0
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +40 -0
- package/src/generators/application/lib/add-cypress.d.ts +3 -0
- package/src/generators/application/lib/add-cypress.js +22 -0
- package/src/generators/application/lib/add-cypress.js.map +1 -0
- package/src/generators/application/lib/add-jest.d.ts +3 -0
- package/src/generators/application/lib/add-jest.js +17 -0
- package/src/generators/application/lib/add-jest.js.map +1 -0
- package/src/generators/application/lib/add-project.d.ts +2 -0
- package/src/generators/application/lib/add-project.js +98 -0
- package/src/generators/application/lib/add-project.js.map +1 -0
- package/src/generators/application/lib/add-routing.d.ts +3 -0
- package/src/generators/application/lib/add-routing.js +32 -0
- package/src/generators/application/lib/add-routing.js.map +1 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +47 -0
- package/src/generators/application/lib/create-application-files.js.map +1 -0
- package/src/generators/application/lib/find-free-port.d.ts +2 -0
- package/src/generators/application/lib/find-free-port.js +18 -0
- package/src/generators/application/lib/find-free-port.js.map +1 -0
- package/src/generators/application/lib/get-app-tests.d.ts +2 -0
- package/src/generators/application/lib/get-app-tests.js +22 -0
- package/src/generators/application/lib/get-app-tests.js.map +1 -0
- package/src/generators/application/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/application/lib/install-common-dependencies.js +29 -0
- package/src/generators/application/lib/install-common-dependencies.js.map +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +60 -0
- package/src/generators/application/lib/normalize-options.js.map +1 -0
- package/src/generators/application/lib/set-defaults.d.ts +3 -0
- package/src/generators/application/lib/set-defaults.js +23 -0
- package/src/generators/application/lib/set-defaults.js.map +1 -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/lib/update-jest-config.js.map +1 -0
- package/src/generators/application/schema.d.ts +44 -0
- package/src/generators/application/schema.json +196 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +141 -0
- package/src/generators/component/component.js.map +1 -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__ +71 -0
- package/src/generators/component/get-component-tests.d.ts +2 -0
- package/src/generators/component/get-component-tests.js +13 -0
- package/src/generators/component/get-component-tests.js.map +1 -0
- package/src/generators/component/noramlized-schema.d.ts +8 -0
- package/src/generators/component/noramlized-schema.js +3 -0
- package/src/generators/component/noramlized-schema.js.map +1 -0
- package/src/generators/component/schema.d.ts +20 -0
- package/src/generators/component/schema.json +153 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +14 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js +105 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js.map +1 -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 +81 -0
- package/src/generators/component-story/component-story.js.map +1 -0
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
- package/src/generators/component-story/schema.json +36 -0
- package/src/generators/component-test/component-test.d.ts +4 -0
- package/src/generators/component-test/component-test.js +78 -0
- package/src/generators/component-test/component-test.js.map +1 -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 +3 -0
- package/src/generators/component-test/schema.js.map +1 -0
- package/src/generators/component-test/schema.json +31 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +9 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +34 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +1 -0
- package/src/generators/cypress-component-configuration/files/cypress/support/commands.ts__tpl__ +42 -0
- package/src/generators/cypress-component-configuration/files/cypress.config.ts__tpl__ +8 -0
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +4 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js +75 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js.map +1 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.d.ts +7 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.js +30 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.js.map +1 -0
- package/src/generators/cypress-component-configuration/schema.d.ts +7 -0
- package/src/generators/cypress-component-configuration/schema.json +54 -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 +117 -0
- package/src/generators/hook/hook.js.map +1 -0
- package/src/generators/hook/schema.d.ts +11 -0
- package/src/generators/hook/schema.json +77 -0
- package/src/generators/host/files/common/src/app/__fileName__.tsx__tmpl__ +33 -0
- package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +6 -0
- package/src/generators/host/files/module-federation/src/main.ts__tmpl__ +1 -0
- package/src/generators/host/files/module-federation/src/remotes.d.ts__tmpl__ +4 -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__ +13 -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__ +15 -0
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/host/host.d.ts +4 -0
- package/src/generators/host/host.js +67 -0
- package/src/generators/host/host.js.map +1 -0
- package/src/generators/host/lib/add-module-federation-files.d.ts +5 -0
- package/src/generators/host/lib/add-module-federation-files.js +21 -0
- package/src/generators/host/lib/add-module-federation-files.js.map +1 -0
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +6 -0
- package/src/generators/host/lib/setup-ssr-for-host.js +27 -0
- package/src/generators/host/lib/setup-ssr-for-host.js.map +1 -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 +16 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.js.map +1 -0
- package/src/generators/host/schema.d.ts +31 -0
- package/src/generators/host/schema.json +168 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +80 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +11 -0
- package/src/generators/init/schema.json +49 -0
- package/src/generators/library/files/common/.babelrc__tmpl__ +16 -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 +38 -0
- package/src/generators/library/lib/add-linting.js.map +1 -0
- package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -0
- package/src/generators/library/lib/add-rollup-build-target.js +59 -0
- package/src/generators/library/lib/add-rollup-build-target.js.map +1 -0
- package/src/generators/library/lib/create-files.d.ts +3 -0
- package/src/generators/library/lib/create-files.js +26 -0
- package/src/generators/library/lib/create-files.js.map +1 -0
- package/src/generators/library/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/library/lib/install-common-dependencies.js +30 -0
- package/src/generators/library/lib/install-common-dependencies.js.map +1 -0
- package/src/generators/library/lib/maybe-js.d.ts +2 -0
- package/src/generators/library/lib/maybe-js.js +10 -0
- package/src/generators/library/lib/maybe-js.js.map +1 -0
- package/src/generators/library/lib/normalize-options.d.ts +3 -0
- package/src/generators/library/lib/normalize-options.js +57 -0
- package/src/generators/library/lib/normalize-options.js.map +1 -0
- package/src/generators/library/lib/set-defaults.d.ts +3 -0
- package/src/generators/library/lib/set-defaults.js +16 -0
- package/src/generators/library/lib/set-defaults.js.map +1 -0
- package/src/generators/library/lib/update-app-routes.d.ts +3 -0
- package/src/generators/library/lib/update-app-routes.js +63 -0
- package/src/generators/library/lib/update-app-routes.js.map +1 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +128 -0
- package/src/generators/library/library.js.map +1 -0
- package/src/generators/library/schema.d.ts +43 -0
- package/src/generators/library/schema.json +192 -0
- package/src/generators/redux/files/__directory__/__fileName__.slice.spec.ts__tmpl__ +53 -0
- package/src/generators/redux/files/__directory__/__fileName__.slice.ts__tmpl__ +129 -0
- package/src/generators/redux/redux.d.ts +5 -0
- package/src/generators/redux/redux.js +117 -0
- package/src/generators/redux/redux.js.map +1 -0
- package/src/generators/redux/schema.d.ts +20 -0
- package/src/generators/redux/schema.json +47 -0
- package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +6 -0
- package/src/generators/remote/files/module-federation/src/main.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation/src/remote-entry.ts__tmpl__ +1 -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/lib/setup-ssr-for-remote.d.ts +4 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js +32 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js.map +1 -0
- package/src/generators/remote/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/remote/lib/update-host-with-remote.js +53 -0
- package/src/generators/remote/lib/update-host-with-remote.js.map +1 -0
- package/src/generators/remote/remote.d.ts +6 -0
- package/src/generators/remote/remote.js +56 -0
- package/src/generators/remote/remote.js.map +1 -0
- package/src/generators/remote/schema.d.ts +26 -0
- package/src/generators/remote/schema.json +167 -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__ +15 -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 +5 -0
- package/src/generators/setup-ssr/setup-ssr.js +162 -0
- package/src/generators/setup-ssr/setup-ssr.js.map +1 -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/add-tailwind-style-imports.js.map +1 -0
- package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/update-project.js +15 -0
- package/src/generators/setup-tailwind/lib/update-project.js.map +1 -0
- package/src/generators/setup-tailwind/schema.d.ts +6 -0
- package/src/generators/setup-tailwind/schema.js +3 -0
- package/src/generators/setup-tailwind/schema.js.map +1 -0
- package/src/generators/setup-tailwind/schema.json +47 -0
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +5 -0
- package/src/generators/setup-tailwind/setup-tailwind.js +39 -0
- package/src/generators/setup-tailwind/setup-tailwind.js.map +1 -0
- package/src/generators/stories/schema.json +59 -0
- package/src/generators/stories/stories.d.ts +15 -0
- package/src/generators/stories/stories.js +118 -0
- package/src/generators/stories/stories.js.map +1 -0
- package/src/generators/storybook-configuration/configuration.d.ts +5 -0
- package/src/generators/storybook-configuration/configuration.js +64 -0
- package/src/generators/storybook-configuration/configuration.js.map +1 -0
- package/src/generators/storybook-configuration/schema.d.ts +17 -0
- package/src/generators/storybook-configuration/schema.json +103 -0
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.d.ts +3 -0
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js +13 -0
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js.map +1 -0
- package/src/migrations/update-12-0-0/update-emotion-setup.d.ts +3 -0
- package/src/migrations/update-12-0-0/update-emotion-setup.js +67 -0
- package/src/migrations/update-12-0-0/update-emotion-setup.js.map +1 -0
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.d.ts +3 -0
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js +27 -0
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js.map +1 -0
- package/src/migrations/update-12-8-0/update-12-8-0.d.ts +3 -0
- package/src/migrations/update-12-8-0/update-12-8-0.js +15 -0
- package/src/migrations/update-12-8-0/update-12-8-0.js.map +1 -0
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.d.ts +3 -0
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js +38 -0
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js.map +1 -0
- package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +3 -0
- package/src/migrations/update-13-0-0/update-emotion-setup.js +39 -0
- package/src/migrations/update-13-0-0/update-emotion-setup.js.map +1 -0
- package/src/migrations/update-13-0-0/webpack5-changes-utils.d.ts +11 -0
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js +269 -0
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js.map +1 -0
- package/src/migrations/update-13-10-0/update-13-10-0.d.ts +3 -0
- package/src/migrations/update-13-10-0/update-13-10-0.js +29 -0
- package/src/migrations/update-13-10-0/update-13-10-0.js.map +1 -0
- package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +3 -0
- package/src/migrations/update-14-0-0/add-default-development-configurations.js +40 -0
- package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +1 -0
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.d.ts +3 -0
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js +27 -0
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js.map +1 -0
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.d.ts +5 -0
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js +69 -0
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js.map +1 -0
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.d.ts +3 -0
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js +38 -0
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js.map +1 -0
- package/src/migrations/update-14-6-0/add-preset-jest-config.d.ts +3 -0
- package/src/migrations/update-14-6-0/add-preset-jest-config.js +40 -0
- package/src/migrations/update-14-6-0/add-preset-jest-config.js.map +1 -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 +39 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js.map +1 -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 +17 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.js.map +1 -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 +108 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js.map +1 -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 +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/module-federation/ast-utils.d.ts +8 -0
- package/src/module-federation/ast-utils.js +103 -0
- package/src/module-federation/ast-utils.js.map +1 -0
- package/src/module-federation/load-config.d.ts +3 -0
- package/src/module-federation/load-config.js +17 -0
- package/src/module-federation/load-config.js.map +1 -0
- package/src/module-federation/models.d.ts +24 -0
- package/src/module-federation/models.js +3 -0
- package/src/module-federation/models.js.map +1 -0
- package/src/module-federation/package-json.d.ts +8 -0
- package/src/module-federation/package-json.js +14 -0
- package/src/module-federation/package-json.js.map +1 -0
- package/src/module-federation/utils.d.ts +10 -0
- package/src/module-federation/utils.js +38 -0
- package/src/module-federation/utils.js.map +1 -0
- package/src/module-federation/with-module-federation-ssr.d.ts +2 -0
- package/src/module-federation/with-module-federation-ssr.js +48 -0
- package/src/module-federation/with-module-federation-ssr.js.map +1 -0
- package/src/module-federation/with-module-federation.d.ts +7 -0
- package/src/module-federation/with-module-federation.js +50 -0
- package/src/module-federation/with-module-federation.js.map +1 -0
- package/src/rules/add-styled-dependencies.d.ts +2 -0
- package/src/rules/add-styled-dependencies.js +16 -0
- package/src/rules/add-styled-dependencies.js.map +1 -0
- package/src/rules/update-module-federation-project.d.ts +6 -0
- package/src/rules/update-module-federation-project.js +34 -0
- package/src/rules/update-module-federation-project.js.map +1 -0
- package/src/utils/assertion.d.ts +1 -0
- package/src/utils/assertion.js +20 -0
- package/src/utils/assertion.js.map +1 -0
- package/src/utils/ast-utils.d.ts +29 -0
- package/src/utils/ast-utils.js +526 -0
- package/src/utils/ast-utils.js.map +1 -0
- package/src/utils/component-props.d.ts +15 -0
- package/src/utils/component-props.js +61 -0
- package/src/utils/component-props.js.map +1 -0
- package/src/utils/create-ts-config.d.ts +9 -0
- package/src/utils/create-ts-config.js +64 -0
- package/src/utils/create-ts-config.js.map +1 -0
- package/src/utils/dependencies.d.ts +7 -0
- package/src/utils/dependencies.js +3 -0
- package/src/utils/dependencies.js.map +1 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +13 -0
- package/src/utils/format-file.js.map +1 -0
- package/src/utils/get-in-source-vitest-tests-template.d.ts +1 -0
- package/src/utils/get-in-source-vitest-tests-template.js +22 -0
- package/src/utils/get-in-source-vitest-tests-template.js.map +1 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +10 -0
- package/src/utils/jest-utils.js.map +1 -0
- package/src/utils/lint.d.ts +37 -0
- package/src/utils/lint.js +68 -0
- package/src/utils/lint.js.map +1 -0
- package/src/utils/styled.d.ts +4 -0
- package/src/utils/styled.js +33 -0
- package/src/utils/styled.js.map +1 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +35 -0
- package/src/utils/testing-generators.js.map +1 -0
- package/src/utils/versions.d.ts +43 -0
- package/src/utils/versions.js +51 -0
- package/src/utils/versions.js.map +1 -0
- package/tailwind.d.ts +6 -0
- package/tailwind.js +30 -0
- package/tailwind.js.map +1 -0
- package/typings/cssmodule.d.ts +24 -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 @@
|
|
|
1
|
+
{"version":3,"file":"redux.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/redux/redux.ts"],"names":[],"mappings":";;;;AAAA,6BAA6B;AAC7B,qDAI+B;AAC/B,mDAAgF;AAEhF,uCAYoB;AACpB,+BAAmD;AACnD,qFAAiF;AAEjF,IAAI,QAAqC,CAAC;AAE1C,SAAsB,cAAc,CAAC,IAAU,EAAE,MAAc;;QAC7D,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/C,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClC,MAAM,WAAW,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAC;QACtD,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE1C,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA;AAXD,wCAWC;AAED,SAAS,kBAAkB,CAAC,IAAU,EAAE,OAAyB;IAC/D,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,SAAS,CAAC,EACvC,OAAO,CAAC,SAAS,kCAEZ,OAAO,KACV,IAAI,EAAE,EAAE,IAEX,CAAC;IAEF,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,IAAA,aAAI,EAAC,IAAI,CAAC,CAAC;KACZ;AACH,CAAC;AAED,SAAS,2BAA2B,CAAC,IAAU;IAC7C,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ;QACE,kBAAkB,EAAE,gCAAqB;QACzC,aAAa,EAAE,4BAAiB;KACjC,EACD,EAAE,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AAK,aAAa,EAAE;YAC3C,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,CAAC,UAAU,iCAAiC,SAAS,CAAC,WAAW,EAAE,CACvF,CAAC;SACH;QACD,oBAAoB,GAAG,SAAS,CAAC,UAAU,CAAC;QAC5C,eAAe,GAAG,IAAI,CAAC,IAAI,CACzB,oBAAoB,EACpB,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CACpC,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CACb,kBAAkB,eAAe,6BAA6B,CAC/D,CAAC;SACH;KACF;IACD,qDACK,OAAO,GACP,UAAU,KACb,YAAY,EAAE,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,EAC5D,SAAS,EAAE,IAAA,cAAK,EAAC,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,CAAC,CAAC,QAAQ,EAClD,WAAW,EACX,iBAAiB,EAAE,UAAU,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,oBAAoB;QACpB,eAAe,EACf,SAAS,EAAE,IAAA,0BAAiB,EAC1B,UAAU,EACV,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,IACD;AACJ,CAAC;AAED,kBAAe,cAAc,CAAC;AACjB,QAAA,cAAc,GAAG,IAAA,2BAAkB,EAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Schema {
|
|
2
|
+
name: string;
|
|
3
|
+
project: string;
|
|
4
|
+
directory?: string;
|
|
5
|
+
appProject?: string;
|
|
6
|
+
js?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface NormalizedSchema extends Schema {
|
|
10
|
+
projectType: string;
|
|
11
|
+
projectSourcePath: string;
|
|
12
|
+
projectModulePath: string;
|
|
13
|
+
appProjectSourcePath: string;
|
|
14
|
+
appMainFilePath: string;
|
|
15
|
+
filesPath: string;
|
|
16
|
+
className: string;
|
|
17
|
+
constantName: string;
|
|
18
|
+
propertyName: string;
|
|
19
|
+
fileName: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "redux",
|
|
5
|
+
"title": "Create Redux state",
|
|
6
|
+
"description": "Create a Redux state slice for a React project.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Redux slice name.",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-priority": "important"
|
|
17
|
+
},
|
|
18
|
+
"project": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The name of the project to add the slice to. If it is an application, then the store configuration will be updated too.",
|
|
21
|
+
"alias": "p",
|
|
22
|
+
"$default": {
|
|
23
|
+
"$source": "projectName"
|
|
24
|
+
},
|
|
25
|
+
"x-prompt": "What is the name of the project for this slice?",
|
|
26
|
+
"x-priority": "important"
|
|
27
|
+
},
|
|
28
|
+
"directory": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"alias": "dir",
|
|
31
|
+
"default": "",
|
|
32
|
+
"description": "The name of the folder used to contain/group the generated Redux files.",
|
|
33
|
+
"x-priority": "important"
|
|
34
|
+
},
|
|
35
|
+
"appProject": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "The application project to add the slice to.",
|
|
38
|
+
"alias": "a"
|
|
39
|
+
},
|
|
40
|
+
"js": {
|
|
41
|
+
"type": "boolean",
|
|
42
|
+
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
43
|
+
"default": false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["name"]
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import('./bootstrap');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './app/app';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { composePlugins, withNx } = require('@nrwl/webpack');
|
|
2
|
+
const { withReact } = require('@nrwl/react');
|
|
3
|
+
const { withModuleFederation } = require('@nrwl/react/module-federation');
|
|
4
|
+
|
|
5
|
+
const baseConfig = require('./module-federation.config');
|
|
6
|
+
|
|
7
|
+
const config = {
|
|
8
|
+
...baseConfig,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Nx plugins for webpack to build config object from Nx options and context.
|
|
12
|
+
module.exports = composePlugins(withNx(), withReact(), withModuleFederation(config));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./webpack.config');
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
|
|
5
|
+
import { handleRequest } from './src/main.server';
|
|
6
|
+
|
|
7
|
+
const port = process.env['PORT'] || 4200;
|
|
8
|
+
const app = express();
|
|
9
|
+
|
|
10
|
+
const browserDist = path.join(process.cwd(), '<%= browserBuildOutputPath %>');
|
|
11
|
+
const serverDist = path.join(process.cwd(), '<%= serverBuildOutputPath %>');
|
|
12
|
+
const indexPath = path.join(browserDist, 'index.html');
|
|
13
|
+
|
|
14
|
+
app.use(cors());
|
|
15
|
+
|
|
16
|
+
// Client-side static bundles
|
|
17
|
+
app.get(
|
|
18
|
+
'*.*',
|
|
19
|
+
express.static(browserDist, {
|
|
20
|
+
maxAge: '1y',
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// Static bundles for server-side module federation
|
|
25
|
+
app.use('/server',
|
|
26
|
+
express.static(serverDist, {
|
|
27
|
+
maxAge: '1y'
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
app.use('*', handleRequest(indexPath));
|
|
32
|
+
|
|
33
|
+
const server = app.listen(port, () => {
|
|
34
|
+
console.log(`Express server listening on http://localhost:${port}`);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* DO NOT REMOVE IF USING @nrwl/react:module-federation-dev-ssr executor
|
|
38
|
+
* to serve your Host application with this Remote application.
|
|
39
|
+
* This message allows Nx to determine when the Remote is ready to be
|
|
40
|
+
* consumed by the Host.
|
|
41
|
+
*/
|
|
42
|
+
process.send?.('nx.server.ready');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
server.on('error', console.error);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { composePlugins, withNx } = require('@nrwl/webpack');
|
|
2
|
+
const { withReact } = require('@nrwl/react');
|
|
3
|
+
const { withModuleFederationForSSR } = require('@nrwl/react/module-federation');
|
|
4
|
+
|
|
5
|
+
const baseConfig = require("./module-federation.server.config");
|
|
6
|
+
|
|
7
|
+
const defaultConfig = {
|
|
8
|
+
...baseConfig,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Nx plugins for webpack to build config object from Nx options and context.
|
|
12
|
+
module.exports = composePlugins(withNx(), withReact(), withModuleFederationForSSR(defaultConfig));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { NormalizedSchema } from '../../application/schema';
|
|
3
|
+
import type { Schema } from '../schema';
|
|
4
|
+
export declare function setupSsrForRemote(tree: Tree, options: NormalizedSchema<Schema>, appName: string): Promise<GeneratorCallback>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupSsrForRemote = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
|
+
function setupSsrForRemote(tree, options, appName) {
|
|
8
|
+
var _a, _b, _c;
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const tasks = [];
|
|
11
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
|
12
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/module-federation-ssr'), project.root, Object.assign(Object.assign({}, options), { appName, tmpl: '', browserBuildOutputPath: project.targets.build.options.outputPath, serverBuildOutputPath: project.targets.server.options.outputPath }));
|
|
13
|
+
// For hosts to use when running remotes in static mode.
|
|
14
|
+
const originalOutputPath = (_b = (_a = project.targets.build) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.outputPath;
|
|
15
|
+
project.targets['serve-static'] = {
|
|
16
|
+
dependsOn: ['build', 'server'],
|
|
17
|
+
executor: 'nx:run-commands',
|
|
18
|
+
defaultConfiguration: 'development',
|
|
19
|
+
options: {
|
|
20
|
+
command: `PORT=${(_c = options.devServerPort) !== null && _c !== void 0 ? _c : 4200} node ${(0, devkit_1.joinPathFragments)(originalOutputPath, 'server', 'main.js')}`,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
(0, devkit_1.updateProjectConfiguration)(tree, appName, project);
|
|
24
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
25
|
+
'@module-federation/node': versions_1.moduleFederationNodeVersion,
|
|
26
|
+
}, {});
|
|
27
|
+
tasks.push(installTask);
|
|
28
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.setupSsrForRemote = setupSsrForRemote;
|
|
32
|
+
//# sourceMappingURL=setup-ssr-for-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-ssr-for-remote.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/remote/lib/setup-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A,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;;CACnC;AA/CD,8CA+CC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateHostWithRemote = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const ast_utils_1 = require("../../../module-federation/ast-utils");
|
|
6
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
7
|
+
let tsModule;
|
|
8
|
+
function updateHostWithRemote(host, hostName, remoteName) {
|
|
9
|
+
if (!tsModule) {
|
|
10
|
+
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
11
|
+
}
|
|
12
|
+
const hostConfig = (0, devkit_1.readProjectConfiguration)(host, hostName);
|
|
13
|
+
const moduleFederationConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'module-federation.config.js');
|
|
14
|
+
const remoteDefsPath = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'remotes.d.ts');
|
|
15
|
+
const appComponentPath = findAppComponentPath(host, hostConfig.sourceRoot);
|
|
16
|
+
if (host.exists(moduleFederationConfigPath)) {
|
|
17
|
+
// find the host project path
|
|
18
|
+
// Update remotes inside ${host_path}/src/remotes.d.ts
|
|
19
|
+
let sourceCode = host.read(moduleFederationConfigPath).toString();
|
|
20
|
+
const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
|
|
21
|
+
host.write(moduleFederationConfigPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteToConfig)(source, remoteName)));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// TODO(jack): Point to the nx.dev guide when ready.
|
|
25
|
+
devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nrwl/react:host"?`);
|
|
26
|
+
}
|
|
27
|
+
if (host.exists(remoteDefsPath)) {
|
|
28
|
+
let sourceCode = host.read(remoteDefsPath).toString();
|
|
29
|
+
const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
|
|
30
|
+
host.write(remoteDefsPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteDefinition)(source, remoteName)));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
devkit_1.logger.warn(`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nrwl/react:host"?`);
|
|
34
|
+
}
|
|
35
|
+
if (host.exists(appComponentPath)) {
|
|
36
|
+
let sourceCode = host.read(appComponentPath).toString();
|
|
37
|
+
const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
|
|
38
|
+
host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nrwl/react:host"?`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.updateHostWithRemote = updateHostWithRemote;
|
|
45
|
+
function findAppComponentPath(host, sourceRoot) {
|
|
46
|
+
const locations = ['app/app.tsx', 'app/App.tsx', 'app.tsx', 'App.tsx'];
|
|
47
|
+
for (const loc of locations) {
|
|
48
|
+
if (host.exists((0, devkit_1.joinPathFragments)(sourceRoot, loc))) {
|
|
49
|
+
return (0, devkit_1.joinPathFragments)(sourceRoot, loc);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=update-host-with-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-host-with-remote.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/remote/lib/update-host-with-remote.ts"],"names":[],"mappings":";;;AAA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AAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { NormalizedSchema } from '../application/schema';
|
|
3
|
+
import { Schema } from './schema';
|
|
4
|
+
export declare function addModuleFederationFiles(host: Tree, options: NormalizedSchema): void;
|
|
5
|
+
export declare function remoteGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
6
|
+
export default remoteGenerator;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.remoteGenerator = exports.addModuleFederationFiles = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const normalize_options_1 = require("../application/lib/normalize-options");
|
|
8
|
+
const application_1 = require("../application/application");
|
|
9
|
+
const update_host_with_remote_1 = require("./lib/update-host-with-remote");
|
|
10
|
+
const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
|
|
11
|
+
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
|
12
|
+
const setup_ssr_for_remote_1 = require("./lib/setup-ssr-for-remote");
|
|
13
|
+
function addModuleFederationFiles(host, options) {
|
|
14
|
+
const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '' });
|
|
15
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `./files/module-federation`), options.appProjectRoot, templateVariables);
|
|
16
|
+
}
|
|
17
|
+
exports.addModuleFederationFiles = addModuleFederationFiles;
|
|
18
|
+
function remoteGenerator(host, schema) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const tasks = [];
|
|
21
|
+
const options = (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
22
|
+
const initAppTask = yield (0, application_1.default)(host, Object.assign(Object.assign({}, options), {
|
|
23
|
+
// Only webpack works with module federation for now.
|
|
24
|
+
bundler: 'webpack', skipFormat: true }));
|
|
25
|
+
tasks.push(initAppTask);
|
|
26
|
+
if (schema.host) {
|
|
27
|
+
(0, update_host_with_remote_1.updateHostWithRemote)(host, schema.host, options.name);
|
|
28
|
+
}
|
|
29
|
+
// Module federation requires bootstrap code to be dynamically imported.
|
|
30
|
+
// Renaming original entry file so we can use `import(./bootstrap)` in
|
|
31
|
+
// new entry file.
|
|
32
|
+
host.rename((0, path_1.join)(options.appProjectRoot, 'src/main.tsx'), (0, path_1.join)(options.appProjectRoot, 'src/bootstrap.tsx'));
|
|
33
|
+
addModuleFederationFiles(host, options);
|
|
34
|
+
(0, update_module_federation_project_1.updateModuleFederationProject)(host, options);
|
|
35
|
+
if (options.ssr) {
|
|
36
|
+
const setupSsrTask = yield (0, setup_ssr_1.default)(host, {
|
|
37
|
+
project: options.projectName,
|
|
38
|
+
serverPort: options.devServerPort,
|
|
39
|
+
skipFormat: true,
|
|
40
|
+
});
|
|
41
|
+
tasks.push(setupSsrTask);
|
|
42
|
+
const setupSsrForRemoteTask = yield (0, setup_ssr_for_remote_1.setupSsrForRemote)(host, options, options.projectName);
|
|
43
|
+
tasks.push(setupSsrForRemoteTask);
|
|
44
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
45
|
+
projectConfig.targets.server.options.webpackConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, 'webpack.server.config.js');
|
|
46
|
+
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
|
|
47
|
+
}
|
|
48
|
+
if (!options.skipFormat) {
|
|
49
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
50
|
+
}
|
|
51
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.remoteGenerator = remoteGenerator;
|
|
55
|
+
exports.default = remoteGenerator;
|
|
56
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/remote/remote.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,uCAUoB;AAEpB,4EAAwE;AACxE,4DAA8D;AAE9D,2EAAqE;AACrE,mGAA6F;AAE7F,sDAAuD;AACvD,qEAA+D;AAE/D,SAAgB,wBAAwB,CACtC,IAAU,EACV,OAAyB;IAEzB,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,GACT,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,2BAA2B,CAAC,EAC5C,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAhBD,4DAgBC;AAED,SAAsB,eAAe,CAAC,IAAU,EAAE,MAAc;;QAC9D,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAS,IAAI,EAAE,MAAM,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,MAAM,IAAA,qBAAoB,EAAC,IAAI,kCAC9C,OAAO;YACV,qDAAqD;YACrD,OAAO,EAAE,SAAS,EAClB,UAAU,EAAE,IAAI,IAChB,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,IAAI,MAAM,CAAC,IAAI,EAAE;YACf,IAAA,8CAAoB,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;SACvD;QAED,wEAAwE;QACxE,sEAAsE;QACtE,kBAAkB;QAClB,IAAI,CAAC,MAAM,CACT,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAC5C,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAClD,CAAC;QAEF,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,IAAA,gEAA6B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE7C,IAAI,OAAO,CAAC,GAAG,EAAE;YACf,MAAM,YAAY,GAAG,MAAM,IAAA,mBAAiB,EAAC,IAAI,EAAE;gBACjD,OAAO,EAAE,OAAO,CAAC,WAAW;gBAC5B,UAAU,EAAE,OAAO,CAAC,aAAa;gBACjC,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAEzB,MAAM,qBAAqB,GAAG,MAAM,IAAA,wCAAiB,EACnD,IAAI,EACJ,OAAO,EACP,OAAO,CAAC,WAAW,CACpB,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAElC,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAC1E,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,IAAA,0BAAiB,EACpE,aAAa,CAAC,IAAI,EAClB,0BAA0B,CAC3B,CAAC;YACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;SACtE;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAtDD,0CAsDC;AAED,kBAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Linter } from '@nx/linter';
|
|
2
|
+
|
|
3
|
+
import { SupportedStyles } from '../../../typings';
|
|
4
|
+
|
|
5
|
+
export interface Schema {
|
|
6
|
+
classComponent?: boolean;
|
|
7
|
+
compiler?: 'babel' | 'swc';
|
|
8
|
+
devServerPort?: number;
|
|
9
|
+
directory?: string;
|
|
10
|
+
e2eTestRunner: 'cypress' | 'none';
|
|
11
|
+
globalCss?: boolean;
|
|
12
|
+
host?: string;
|
|
13
|
+
js?: boolean;
|
|
14
|
+
linter: Linter;
|
|
15
|
+
name: string;
|
|
16
|
+
pascalCaseFiles?: boolean;
|
|
17
|
+
routing?: boolean;
|
|
18
|
+
setParserOptionsProject?: boolean;
|
|
19
|
+
skipFormat: boolean;
|
|
20
|
+
skipWorkspaceJson?: boolean;
|
|
21
|
+
ssr?: boolean;
|
|
22
|
+
strict?: boolean;
|
|
23
|
+
style: SupportedStyles;
|
|
24
|
+
tags?: string;
|
|
25
|
+
unitTestRunner: 'jest' | 'vitest' | 'none';
|
|
26
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "GeneratorReactRemote",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Generate Module Federation Setup for React Remote App",
|
|
6
|
+
"description": "Create Module Federation configuration files for given React Remote Application.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The name of the remote application to generate the Module Federation configuration",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-prompt": "What name would you like to use as the remote application?",
|
|
17
|
+
"pattern": "^[a-zA-Z].*$",
|
|
18
|
+
"x-priority": "important"
|
|
19
|
+
},
|
|
20
|
+
"directory": {
|
|
21
|
+
"description": "The directory of the new application.",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"alias": "dir",
|
|
24
|
+
"x-priority": "important"
|
|
25
|
+
},
|
|
26
|
+
"style": {
|
|
27
|
+
"description": "The file extension to be used for style files.",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"default": "css",
|
|
30
|
+
"alias": "s",
|
|
31
|
+
"x-prompt": {
|
|
32
|
+
"message": "Which stylesheet format would you like to use?",
|
|
33
|
+
"type": "list",
|
|
34
|
+
"items": [
|
|
35
|
+
{
|
|
36
|
+
"value": "css",
|
|
37
|
+
"label": "CSS"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"value": "scss",
|
|
41
|
+
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"value": "less",
|
|
45
|
+
"label": "LESS [ http://lesscss.org ]"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"value": "styled-components",
|
|
49
|
+
"label": "styled-components [ https://styled-components.com ]"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"value": "@emotion/styled",
|
|
53
|
+
"label": "emotion [ https://emotion.sh ]"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": "styled-jsx",
|
|
57
|
+
"label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"value": "styl",
|
|
61
|
+
"label": "DEPRECATD: Stylus(.styl) [ http://stylus-lang.com ]"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"value": "none",
|
|
65
|
+
"label": "None"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"linter": {
|
|
71
|
+
"description": "The tool to use for running lint checks.",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": ["eslint"],
|
|
74
|
+
"default": "eslint"
|
|
75
|
+
},
|
|
76
|
+
"routing": {
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Generate application with routes.",
|
|
79
|
+
"default": false
|
|
80
|
+
},
|
|
81
|
+
"skipFormat": {
|
|
82
|
+
"description": "Skip formatting files.",
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"default": false,
|
|
85
|
+
"x-priority": "internal"
|
|
86
|
+
},
|
|
87
|
+
"skipWorkspaceJson": {
|
|
88
|
+
"description": "Skip updating workspace.json with default options based on values provided to this app (e.g. babel, style).",
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"default": false,
|
|
91
|
+
"x-priority": "internal"
|
|
92
|
+
},
|
|
93
|
+
"unitTestRunner": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"enum": ["jest", "none"],
|
|
96
|
+
"description": "Test runner to use for unit tests.",
|
|
97
|
+
"default": "jest"
|
|
98
|
+
},
|
|
99
|
+
"e2eTestRunner": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"enum": ["cypress", "none"],
|
|
102
|
+
"description": "Test runner to use for end to end (e2e) tests.",
|
|
103
|
+
"default": "cypress"
|
|
104
|
+
},
|
|
105
|
+
"tags": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"description": "Add tags to the application (used for linting).",
|
|
108
|
+
"alias": "t"
|
|
109
|
+
},
|
|
110
|
+
"pascalCaseFiles": {
|
|
111
|
+
"type": "boolean",
|
|
112
|
+
"description": "Use pascal case component file name (e.g. App.tsx).",
|
|
113
|
+
"alias": "P",
|
|
114
|
+
"default": false
|
|
115
|
+
},
|
|
116
|
+
"classComponent": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"description": "Use class components instead of functional component.",
|
|
119
|
+
"alias": "C",
|
|
120
|
+
"default": false
|
|
121
|
+
},
|
|
122
|
+
"js": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
125
|
+
"default": false
|
|
126
|
+
},
|
|
127
|
+
"globalCss": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"description": "Default is false. When true, the component is generated with *.css/*.scss instead of *.module.css/*.module.scss.",
|
|
130
|
+
"default": false
|
|
131
|
+
},
|
|
132
|
+
"strict": {
|
|
133
|
+
"type": "boolean",
|
|
134
|
+
"description": "Creates an application with strict mode and strict type checking.",
|
|
135
|
+
"default": true
|
|
136
|
+
},
|
|
137
|
+
"setParserOptionsProject": {
|
|
138
|
+
"type": "boolean",
|
|
139
|
+
"description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
|
|
140
|
+
"default": false
|
|
141
|
+
},
|
|
142
|
+
"compiler": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "The compiler to use.",
|
|
145
|
+
"enum": ["babel", "swc"],
|
|
146
|
+
"default": "babel"
|
|
147
|
+
},
|
|
148
|
+
"host": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"description": "The host / shell application for this remote.",
|
|
151
|
+
"x-priority": "important"
|
|
152
|
+
},
|
|
153
|
+
"devServerPort": {
|
|
154
|
+
"type": "number",
|
|
155
|
+
"description": "The port for the dev server of the remote app.",
|
|
156
|
+
"default": 4200,
|
|
157
|
+
"x-priority": "important"
|
|
158
|
+
},
|
|
159
|
+
"ssr": {
|
|
160
|
+
"description": "Whether to configure SSR for the host application",
|
|
161
|
+
"type": "boolean",
|
|
162
|
+
"default": false
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"required": ["name"],
|
|
166
|
+
"additionalProperties": false
|
|
167
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
|
|
5
|
+
import { handleRequest } from './src/main.server';
|
|
6
|
+
|
|
7
|
+
const port = process.env['PORT'] || 4200;
|
|
8
|
+
const app = express();
|
|
9
|
+
|
|
10
|
+
const browserDist = path.join(process.cwd(), '<%= browserBuildOutputPath %>');
|
|
11
|
+
const indexPath =path.join(browserDist, 'index.html');
|
|
12
|
+
|
|
13
|
+
app.use(cors());
|
|
14
|
+
|
|
15
|
+
app.get(
|
|
16
|
+
'*.*',
|
|
17
|
+
express.static(browserDist, {
|
|
18
|
+
maxAge: '1y',
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
app.use('*', handleRequest(indexPath));
|
|
23
|
+
|
|
24
|
+
const server = app.listen(port, () => {
|
|
25
|
+
// Server has started
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
server.on('error', console.error);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Request, Response } from 'express';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as ReactDOMServer from 'react-dom/server';
|
|
4
|
+
import isbot from 'isbot'
|
|
5
|
+
|
|
6
|
+
import App from './<%= appComponentImport %>';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
let indexHtml: null | string = null;
|
|
10
|
+
|
|
11
|
+
export function handleRequest(indexPath: string) {
|
|
12
|
+
return function render(req: Request, res: Response) {
|
|
13
|
+
let didError = false;
|
|
14
|
+
|
|
15
|
+
if (!indexHtml) {
|
|
16
|
+
indexHtml = fs.readFileSync(indexPath).toString();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const [htmlStart, htmlEnd] = indexHtml.split(`<div id="root"></div>`);
|
|
20
|
+
|
|
21
|
+
// For bots (e.g. search engines), the content will not be streamed but render all at once.
|
|
22
|
+
// For users, content should be streamed to the user as they are ready.
|
|
23
|
+
const callbackName = isbot(req.headers['user-agent']) ? 'onAllReady' : 'onShellReady';
|
|
24
|
+
|
|
25
|
+
const stream = ReactDOMServer.renderToPipeableStream(
|
|
26
|
+
<App />,
|
|
27
|
+
{
|
|
28
|
+
[callbackName]() {
|
|
29
|
+
res.statusCode = didError ? 500 : 200;
|
|
30
|
+
res.setHeader('Content-type', 'text/html; charset=utf-8');
|
|
31
|
+
res.write(`${htmlStart}<div id="root">`);
|
|
32
|
+
stream.pipe(res);
|
|
33
|
+
res.write(`</div>${htmlEnd}`);
|
|
34
|
+
},
|
|
35
|
+
onShellError(error) {
|
|
36
|
+
console.error(error);
|
|
37
|
+
res.statusCode = 500;
|
|
38
|
+
res.send('<!doctype html><h1>Server Error</h1>');
|
|
39
|
+
},
|
|
40
|
+
onError(error) {
|
|
41
|
+
didError = true;
|
|
42
|
+
console.error(error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|