@nx/rspack 19.5.0 → 19.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/executors.json +15 -0
  2. package/migrations.json +17 -0
  3. package/module-federation.d.ts +1 -0
  4. package/module-federation.js +5 -0
  5. package/module-federation.js.map +1 -0
  6. package/package.json +10 -4
  7. package/src/executors/dev-server/dev-server.impl.d.ts +4 -1
  8. package/src/executors/dev-server/dev-server.impl.js +11 -11
  9. package/src/executors/dev-server/dev-server.impl.js.map +1 -1
  10. package/src/executors/dev-server/lib/get-dev-server-config.d.ts +4 -0
  11. package/src/executors/dev-server/lib/get-dev-server-config.js +71 -0
  12. package/src/executors/dev-server/lib/get-dev-server-config.js.map +1 -0
  13. package/src/executors/dev-server/lib/serve-path.d.ts +3 -0
  14. package/src/executors/dev-server/lib/serve-path.js +45 -0
  15. package/src/executors/dev-server/lib/serve-path.js.map +1 -0
  16. package/src/executors/dev-server/schema.d.ts +5 -1
  17. package/src/executors/dev-server/schema.json +30 -2
  18. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +19 -0
  19. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +230 -0
  20. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
  21. package/src/executors/module-federation-dev-server/schema.json +100 -0
  22. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +21 -0
  23. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +209 -0
  24. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +1 -0
  25. package/src/executors/module-federation-ssr-dev-server/schema.json +82 -0
  26. package/src/executors/rspack/rspack.impl.js +3 -3
  27. package/src/executors/rspack/rspack.impl.js.map +1 -1
  28. package/src/executors/rspack/schema.d.ts +10 -1
  29. package/src/executors/rspack/schema.json +61 -7
  30. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts +1 -0
  31. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +40 -0
  32. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js.map +1 -0
  33. package/src/executors/ssr-dev-server/schema.d.ts +11 -0
  34. package/src/executors/ssr-dev-server/schema.json +39 -0
  35. package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts +8 -0
  36. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +52 -0
  37. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js.map +1 -0
  38. package/src/generators/application/application.js +2 -2
  39. package/src/generators/application/application.js.map +1 -1
  40. package/src/utils/create-compiler.d.ts +3 -1
  41. package/src/utils/create-compiler.js +12 -2
  42. package/src/utils/create-compiler.js.map +1 -1
  43. package/src/utils/module-federation/dependencies.d.ts +6 -0
  44. package/src/utils/module-federation/dependencies.js +58 -0
  45. package/src/utils/module-federation/dependencies.js.map +1 -0
  46. package/src/utils/module-federation/get-remotes-for-host.d.ts +16 -0
  47. package/src/utils/module-federation/get-remotes-for-host.js +103 -0
  48. package/src/utils/module-federation/get-remotes-for-host.js.map +1 -0
  49. package/src/utils/module-federation/index.d.ts +6 -0
  50. package/src/utils/module-federation/index.js +10 -0
  51. package/src/utils/module-federation/index.js.map +1 -0
  52. package/src/utils/module-federation/models/index.d.ts +47 -0
  53. package/src/utils/module-federation/models/index.js +3 -0
  54. package/src/utils/module-federation/models/index.js.map +1 -0
  55. package/src/utils/module-federation/package-json.d.ts +8 -0
  56. package/src/utils/module-federation/package-json.js +13 -0
  57. package/src/utils/module-federation/package-json.js.map +1 -0
  58. package/src/utils/module-federation/parse-static-remotes-config.d.ts +13 -0
  59. package/src/utils/module-federation/parse-static-remotes-config.js +35 -0
  60. package/src/utils/module-federation/parse-static-remotes-config.js.map +1 -0
  61. package/src/utils/module-federation/plugins/runtime-library-control.plugin.d.ts +3 -0
  62. package/src/utils/module-federation/plugins/runtime-library-control.plugin.js +55 -0
  63. package/src/utils/module-federation/plugins/runtime-library-control.plugin.js.map +1 -0
  64. package/src/utils/module-federation/public-api.d.ts +8 -0
  65. package/src/utils/module-federation/public-api.js +21 -0
  66. package/src/utils/module-federation/public-api.js.map +1 -0
  67. package/src/utils/module-federation/remotes.d.ts +19 -0
  68. package/src/utils/module-federation/remotes.js +78 -0
  69. package/src/utils/module-federation/remotes.js.map +1 -0
  70. package/src/utils/module-federation/secondary-entry-points.d.ts +12 -0
  71. package/src/utils/module-federation/secondary-entry-points.js +105 -0
  72. package/src/utils/module-federation/secondary-entry-points.js.map +1 -0
  73. package/src/utils/module-federation/share.d.ts +48 -0
  74. package/src/utils/module-federation/share.js +232 -0
  75. package/src/utils/module-federation/share.js.map +1 -0
  76. package/src/utils/module-federation/start-remote-proxies.d.ts +5 -0
  77. package/src/utils/module-federation/start-remote-proxies.js +46 -0
  78. package/src/utils/module-federation/start-remote-proxies.js.map +1 -0
  79. package/src/utils/module-federation/start-ssr-remote-proxies.d.ts +5 -0
  80. package/src/utils/module-federation/start-ssr-remote-proxies.js +60 -0
  81. package/src/utils/module-federation/start-ssr-remote-proxies.js.map +1 -0
  82. package/src/utils/module-federation/typescript.d.ts +4 -0
  83. package/src/utils/module-federation/typescript.js +53 -0
  84. package/src/utils/module-federation/typescript.js.map +1 -0
  85. package/src/utils/module-federation/with-module-federation/package-json.d.ts +8 -0
  86. package/src/utils/module-federation/with-module-federation/package-json.js +13 -0
  87. package/src/utils/module-federation/with-module-federation/package-json.js.map +1 -0
  88. package/src/utils/module-federation/with-module-federation/utils.d.ts +12 -0
  89. package/src/utils/module-federation/with-module-federation/utils.js +78 -0
  90. package/src/utils/module-federation/with-module-federation/utils.js.map +1 -0
  91. package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.d.ts +3 -0
  92. package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js +42 -0
  93. package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js.map +1 -0
  94. package/src/utils/module-federation/with-module-federation/with-module-federation.d.ts +8 -0
  95. package/src/utils/module-federation/with-module-federation/with-module-federation.js +52 -0
  96. package/src/utils/module-federation/with-module-federation/with-module-federation.js.map +1 -0
  97. package/src/utils/versions.d.ts +3 -3
  98. package/src/utils/versions.js +3 -3
  99. package/src/utils/with-nx.js +41 -15
  100. package/src/utils/with-nx.js.map +1 -1
  101. package/src/utils/with-web.js +7 -0
  102. package/src/utils/with-web.js.map +1 -1
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitUntilServerIsListening = waitUntilServerIsListening;
4
+ const tslib_1 = require("tslib");
5
+ const net = tslib_1.__importStar(require("net"));
6
+ function waitUntilServerIsListening(port) {
7
+ const allowedErrorCodes = ['ECONNREFUSED', 'ECONNRESET'];
8
+ const maxAttempts = 25;
9
+ let attempts = 0;
10
+ const client = new net.Socket();
11
+ const cleanup = () => {
12
+ client.removeAllListeners('connect');
13
+ client.removeAllListeners('error');
14
+ client.end();
15
+ client.destroy();
16
+ client.unref();
17
+ };
18
+ return new Promise((resolve, reject) => {
19
+ const listen = () => {
20
+ client.once('connect', () => {
21
+ cleanup();
22
+ resolve();
23
+ });
24
+ client.on('error', (err) => {
25
+ if (attempts > maxAttempts ||
26
+ !allowedErrorCodes.includes(err['code'])) {
27
+ cleanup();
28
+ reject(err);
29
+ }
30
+ else {
31
+ attempts++;
32
+ setTimeout(listen, 100 * attempts);
33
+ }
34
+ });
35
+ client.connect({ port, host: 'localhost' });
36
+ };
37
+ listen();
38
+ });
39
+ }
40
+ //# sourceMappingURL=wait-until-server-is-listening.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-until-server-is-listening.js","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.ts"],"names":[],"mappings":";;AAEA,gEAmCC;;AArCD,iDAA2B;AAE3B,SAAgB,0BAA0B,CAAC,IAAY;IACrD,MAAM,iBAAiB,GAAG,CAAC,cAAc,EA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{
2
+ [key: string]: string | boolean | number | TargetOptions;
3
+ }
4
+
5
+ export interface RspackSsrDevServerOptions {
6
+ browserTarget: string;
7
+ serverTarget: string;
8
+ port: number;
9
+ browserTargetOptions: TargetOptions;
10
+ serverTargetOptions: TargetOptions;
11
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "outputCapture": "direct-nodejs",
3
+ "title": "Rspack SSR Dev Server",
4
+ "description": "Serve a SSR application using rspack.",
5
+ "cli": "nx",
6
+ "type": "object",
7
+ "properties": {
8
+ "browserTarget": {
9
+ "type": "string",
10
+ "description": "Target which builds the browser application.",
11
+ "x-priority": "important"
12
+ },
13
+ "serverTarget": {
14
+ "type": "string",
15
+ "description": "Target which builds the server application.",
16
+ "x-priority": "important"
17
+ },
18
+ "port": {
19
+ "type": "number",
20
+ "description": "The port to be set on `process.env.PORT` for use in the server.",
21
+ "default": 4200,
22
+ "x-priority": "important"
23
+ },
24
+ "browserTargetOptions": {
25
+ "type": "object",
26
+ "description": "Additional options to pass into the browser build target.",
27
+ "default": {}
28
+ },
29
+ "serverTargetOptions": {
30
+ "type": "object",
31
+ "description": "Additional options to pass into the server build target.",
32
+ "default": {}
33
+ }
34
+ },
35
+ "required": [
36
+ "browserTarget",
37
+ "serverTarget"
38
+ ]
39
+ }
@@ -0,0 +1,8 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { RspackSsrDevServerOptions, TargetOptions } from './schema';
3
+ export declare function ssrDevServerExecutor(options: RspackSsrDevServerOptions, context: ExecutorContext): AsyncGenerator<{
4
+ baseUrl: string;
5
+ success: boolean;
6
+ options: TargetOptions;
7
+ }, void, unknown>;
8
+ export default ssrDevServerExecutor;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ssrDevServerExecutor = ssrDevServerExecutor;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
7
+ const chalk = tslib_1.__importStar(require("chalk"));
8
+ const wait_until_server_is_listening_1 = require("./lib/wait-until-server-is-listening");
9
+ function ssrDevServerExecutor(options, context) {
10
+ return tslib_1.__asyncGenerator(this, arguments, function* ssrDevServerExecutor_1() {
11
+ var _a, e_1, _b, _c;
12
+ var _d, _e;
13
+ const browserTarget = (0, devkit_1.parseTargetString)(options.browserTarget, context.projectGraph);
14
+ const serverTarget = (0, devkit_1.parseTargetString)(options.serverTarget, context);
15
+ const browserOptions = (0, devkit_1.readTargetOptions)(browserTarget, context);
16
+ const serverOptions = (0, devkit_1.readTargetOptions)(serverTarget, context);
17
+ const runBrowser = yield tslib_1.__await((0, devkit_1.runExecutor)(browserTarget, Object.assign(Object.assign({}, browserOptions), options.browserTargetOptions), context));
18
+ const runServer = yield tslib_1.__await((0, devkit_1.runExecutor)(serverTarget, Object.assign(Object.assign({}, serverOptions), options.serverTargetOptions), context));
19
+ let browserBuilt = false;
20
+ let nodeStarted = false;
21
+ const combined = (0, async_iterable_1.combineAsyncIterables)(runBrowser, runServer);
22
+ try {
23
+ for (var _f = true, combined_1 = tslib_1.__asyncValues(combined), combined_1_1; combined_1_1 = yield tslib_1.__await(combined_1.next()), _a = combined_1_1.done, !_a; _f = true) {
24
+ _c = combined_1_1.value;
25
+ _f = false;
26
+ const output = _c;
27
+ if (!output.success)
28
+ throw new Error('Could not build application');
29
+ if (((_d = output.options) === null || _d === void 0 ? void 0 : _d.target) === 'node') {
30
+ nodeStarted = true;
31
+ }
32
+ else if (((_e = output.options) === null || _e === void 0 ? void 0 : _e.target) === 'web') {
33
+ browserBuilt = true;
34
+ }
35
+ if (nodeStarted && browserBuilt) {
36
+ yield tslib_1.__await((0, wait_until_server_is_listening_1.waitUntilServerIsListening)(options.port));
37
+ console.log(`[ ${chalk.green('ready')} ] on http://localhost:${options.port}`);
38
+ yield yield tslib_1.__await(Object.assign(Object.assign({}, output), { baseUrl: `http://localhost:${options.port}` }));
39
+ }
40
+ }
41
+ }
42
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
43
+ finally {
44
+ try {
45
+ if (!_f && !_a && (_b = combined_1.return)) yield tslib_1.__await(_b.call(combined_1));
46
+ }
47
+ finally { if (e_1) throw e_1.error; }
48
+ }
49
+ });
50
+ }
51
+ exports.default = ssrDevServerExecutor;
52
+ //# sourceMappingURL=ssr-dev-server.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssr-dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/executors/ssr-dev-server/ssr-dev-server.impl.ts"],"names":[],"mappings":";;AAaA,oDA2DC;;AAxED,uCAKoB;AACpB,wEAA4E;AAC5E,qDAA+B;AAG/B,yFAAkF;AAGlF,SAAuB,oBAAoB,CACzC,OAAkC,EAClC,OAAwB;;;;QAExB,MAAM,aAAa,GAAG,IAAA,0BAAiB,EACrC,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,YAAY,CACrB,CAAC;QACF,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACtE,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,aAAa,EACb,OAAO,CACR,CAAC;QACF,MAAM,aAAa,GAAG,IAAA,0BAAiB,EACrC,YAAY,EACZ,OAAO,CACR,CAAC;QAEF,MAAM,UAAU,GAAG,sBAAM,IAAA,oBAAW,EAKlC,aAAa,kCACR,cAAc,GAAK,OAAO,CAAC,oBAAoB,GACpD,OAAO,CACR,CAAA,CAAC;QACF,MAAM,SAAS,GAAG,sBAAM,IAAA,oBAAW,EAKjC,YAAY,kCACP,aAAa,GAAK,OAAO,CAAC,mBAAmB,GAClD,OAAO,CACR,CAAA,CAAC;QACF,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,MAAM,QAAQ,GAAG,IAAA,sCAAqB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;;YAE9D,KAA2B,eAAA,aAAA,sBAAA,QAAQ,CAAA,cAAA,mGAAE,CAAC;gBAAX,wBAAQ;gBAAR,WAAQ;gBAAxB,MAAM,MAAM,KAAA,CAAA;gBACrB,IAAI,CAAC,MAAM,CAAC,OAAO;oBAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;gBACpE,IAAI,CAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,MAAM,MAAK,MAAM,EAAE,CAAC;oBACtC,WAAW,GAAG,IAAI,CAAC;gBACrB,CAAC;qBAAM,IAAI,CAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,MAAM,MAAK,KAAK,EAAE,CAAC;oBAC5C,YAAY,GAAG,IAAI,CAAC;gBACtB,CAAC;gBAED,IAAI,WAAW,IAAI,YAAY,EAAE,CAAC;oBAChC,sBAAM,IAAA,2DAA0B,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAC;oBAC/C,OAAO,CAAC,GAAG,CACT,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,0BAA0B,OAAO,CAAC,IAAI,EAAE,CAClE,CAAC;oBACF,4DACK,MAAM,KACT,OAAO,EAAE,oBAAoB,OAAO,CAAC,IAAI,EAAE,IAC5C,CAAC;gBACJ,CAAC;YACH,CAAC;;;;;;;;;IACH,CAAC;CAAA;AAED,kBAAe,oBAAoB,CAAC"}
@@ -36,7 +36,7 @@ function default_1(tree, _options) {
36
36
  bundler: 'webpack',
37
37
  name: options.name,
38
38
  style: options.style,
39
- directorsy: options.directory,
39
+ directory: options.directory,
40
40
  tags: (_c = options.tags) !== null && _c !== void 0 ? _c : '',
41
41
  unitTestRunner: options.unitTestRunner,
42
42
  e2eTestRunner: options.e2eTestRunner,
@@ -62,7 +62,7 @@ function default_1(tree, _options) {
62
62
  bundler: 'webpack',
63
63
  name: options.name,
64
64
  style: options.style,
65
- directorsy: options.directory,
65
+ directory: options.directory,
66
66
  tags: (_d = options.tags) !== null && _d !== void 0 ? _d : '',
67
67
  unitTestRunner: options.unitTestRunner,
68
68
  e2eTestRunner: options.e2eTestRunner,
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/generators/application/application.ts"],"names":[],"mappings":";;AAOA,4BAiGC;;AAxGD,uCAAgF;AAChF,kDAAuD;AACvD,2FAAoE;AACpE,gEAA+C;AAC/C,+DAA2D;AAG3D,mBACE,IAAU,EACV,QAAoC;;;QAEpC,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAA,cAAmB,EAAC,IAAI,kCAC1C,QAAQ;YACX,sDAAsD;YACtD,2DAA2D;YAC3D,SAAS,EAAE,KAAK,IAChB,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAA,OAAO,CAAC,KAAK,oCAAb,OAAO,CAAC,KAAK,GAAK,KAAK,EAAC;QAExB,IAAI,OAAO,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;YACjC,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,GAAG,IAAA,sBAAa,EAC9D,UAAU,EACV,sBAAS,CACV,CAAC;YACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,IAAI,kCAC5C,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,EAAE,EACxB,SAAS,EAAE,KAAK,IAChB,CAAC;YAEH,MAAM,cAAc,GAAG,MAAM,IAAA,uBAAsB,EAAC,IAAI,EAAE;gBACxD,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,KAAK;gBACjB,WAAW,EAAE,OAAO;gBACpB,SAAS,EAAE,MAAM;aAClB,CAAC,CAAC;YAEH,KAAK,CAAC,IAAI,C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E,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,SAAS;gBAC7B,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,EAAE;gBACxB,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,KAAK;aACjB,CAAC,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,IAAA,uBAAsB,EAAC,IAAI,EAAE;gBACxD,OAAO,EAAE,OAAO,CAAC,IAAI;gBACrB,MAAM,EAAE,KAAK;gBACb,UAAU,EAAE,KAAK;gBACjB,WAAW,EAAE,OAAO;gBACpB,WAAW,EAAE,OAAO;gBACpB,SAAS,EAAE,OAAO;aACnB,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA"}
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/generators/application/application.ts"],"names":[],"mappings":";;AAOA,4BAiGC;;AAxGD,uCAAgF;AAChF,kDAAuD;AACvD,2FAAoE;AACpE,gEAA+C;AAC/C,+DAA2D;AAG3D,mBACE,IAAU,EACV,QAAoC;;;QAEpC,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAA,cAAmB,EAAC,IAAI,kCAC1C,QAAQ;YACX,sDAAsD;YACtD,2DAA2D;YAC3D,SAAS,EAAE,KAAK,IAChB,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAA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,EAAE,cAAc,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA"}
@@ -1,5 +1,7 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { Compiler, MultiCompiler } from '@rspack/core';
3
3
  import { RspackExecutorSchema } from '../executors/rspack/schema';
4
- export declare function createCompiler(options: RspackExecutorSchema, context: ExecutorContext): Promise<Compiler | MultiCompiler>;
4
+ export declare function createCompiler(options: RspackExecutorSchema & {
5
+ devServer?: any;
6
+ }, context: ExecutorContext): Promise<Compiler | MultiCompiler>;
5
7
  export declare function isMultiCompiler(compiler: Compiler | MultiCompiler): compiler is MultiCompiler;
@@ -5,18 +5,28 @@ exports.isMultiCompiler = isMultiCompiler;
5
5
  const tslib_1 = require("tslib");
6
6
  const core_1 = require("@rspack/core");
7
7
  const path = tslib_1.__importStar(require("path"));
8
+ const resolve_user_defined_rspack_config_1 = require("./resolve-user-defined-rspack-config");
8
9
  function createCompiler(options, context) {
9
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
- let userDefinedConfig = yield Promise.resolve(`${path.join(context.root, options.rspackConfig)}`).then(s => tslib_1.__importStar(require(s))).then((x) => x.default || x);
11
+ var _a;
12
+ const pathToConfig = path.join(context.root, options.rspackConfig);
13
+ let userDefinedConfig = {};
14
+ if (options.tsConfig) {
15
+ userDefinedConfig = (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)(pathToConfig, options.tsConfig);
16
+ }
17
+ else {
18
+ userDefinedConfig = yield Promise.resolve(`${pathToConfig}`).then(s => tslib_1.__importStar(require(s))).then((x) => x.default || x);
19
+ }
11
20
  if (typeof userDefinedConfig.then === 'function') {
12
21
  userDefinedConfig = yield userDefinedConfig;
13
22
  }
14
23
  let config = {};
15
24
  if (typeof userDefinedConfig === 'function') {
16
- config = yield userDefinedConfig({}, { options, context });
25
+ config = yield userDefinedConfig({ devServer: options.devServer }, { options, context });
17
26
  }
18
27
  else {
19
28
  config = userDefinedConfig;
29
+ (_a = config.devServer) !== null && _a !== void 0 ? _a : (config.devServer = options.devServer);
20
30
  }
21
31
  return (0, core_1.rspack)(config);
22
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create-compiler.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/create-compiler.ts"],"names":[],"mappings":";;AAKA,wCAoBC;AAED,0CAEC;;AA5BD,uCAA+D;AAC/D,mDAA6B;AAG7B,SAAsB,cAAc,CAClC,OAA6B,EAC7B,OAAwB;;QAExB,IAAI,iBAAiB,GAAG,MAAM,mBAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,gDAC7C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;QAE9B,IAAI,OAAO,iBAAiB,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACjD,iBAAiB,GAAG,MAAM,iBAAiB,CAAC;QAC9C,CAAC;QAED,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAG,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC3C,MAAM,GAAG,MAAM,iBAAiB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,iBAAiB,CAAC;QAC7B,CAAC;QAED,OAAO,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC;IACxB,CAAC;CAAA;AAED,SAAgB,eAAe,CAAC,QAAkC;IAChE,OAAO,WAAW,IAAI,QAAQ,CAAA;AAChC,CAAC"}
1
+ {"version":3,"file":"create-compiler.js","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/create-compiler.ts"],"names":[],"mappings":";;AAWA,wCAiCC;AAED,0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type { WorkspaceLibrary } from './models';
3
+ export declare function getDependentPackagesForProject(projectGraph: ProjectGraph, name: string): {
4
+ workspaceLibraries: WorkspaceLibrary[];
5
+ npmPackages: string[];
6
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDependentPackagesForProject = getDependentPackagesForProject;
4
+ const typescript_1 = require("./typescript");
5
+ const devkit_1 = require("@nx/devkit");
6
+ function getDependentPackagesForProject(projectGraph, name) {
7
+ const { npmPackages, workspaceLibraries } = collectDependencies(projectGraph, name);
8
+ return {
9
+ workspaceLibraries: [...workspaceLibraries.values()],
10
+ npmPackages: [...npmPackages],
11
+ };
12
+ }
13
+ function collectDependencies(projectGraph, name, dependencies = {
14
+ workspaceLibraries: new Map(),
15
+ npmPackages: new Set(),
16
+ }, seen = new Set()) {
17
+ var _a;
18
+ if (seen.has(name)) {
19
+ return dependencies;
20
+ }
21
+ seen.add(name);
22
+ ((_a = projectGraph.dependencies[name]) !== null && _a !== void 0 ? _a : []).forEach((dependency) => {
23
+ if (dependency.target.startsWith('npm:')) {
24
+ dependencies.npmPackages.add(dependency.target.replace('npm:', ''));
25
+ }
26
+ else {
27
+ dependencies.workspaceLibraries.set(dependency.target, {
28
+ name: dependency.target,
29
+ root: projectGraph.nodes[dependency.target].data.root,
30
+ importKey: getLibraryImportPath(dependency.target, projectGraph),
31
+ });
32
+ collectDependencies(projectGraph, dependency.target, dependencies, seen);
33
+ }
34
+ });
35
+ return dependencies;
36
+ }
37
+ function getLibraryImportPath(library, projectGraph) {
38
+ let buildLibsFromSource = true;
39
+ if (process.env.NX_BUILD_LIBS_FROM_SOURCE) {
40
+ buildLibsFromSource = process.env.NX_BUILD_LIBS_FROM_SOURCE === 'true';
41
+ }
42
+ const libraryNode = projectGraph.nodes[library];
43
+ let sourceRoots = [libraryNode.data.sourceRoot];
44
+ if (!buildLibsFromSource && process.env.NX_BUILD_TARGET) {
45
+ const buildTarget = (0, devkit_1.parseTargetString)(process.env.NX_BUILD_TARGET, projectGraph);
46
+ sourceRoots = (0, devkit_1.getOutputsForTargetAndConfiguration)(buildTarget, {}, libraryNode);
47
+ }
48
+ const tsConfigPathMappings = (0, typescript_1.readTsPathMappings)();
49
+ for (const [key, value] of Object.entries(tsConfigPathMappings)) {
50
+ for (const src of sourceRoots) {
51
+ if (value.find((path) => path.startsWith(src))) {
52
+ return key;
53
+ }
54
+ }
55
+ }
56
+ return undefined;
57
+ }
58
+ //# sourceMappingURL=dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/dependencies.ts"],"names":[],"mappings":";;AAQA,wEAgBC;AAtBD,6CAAkD;AAClD,uCAGoB;AAEpB,SAAgB,8BAA8B,CAC5C,YAA0B,EAC1B,IAAY;IAKZ,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,CAC7D,YAAY,EACZ,IAAI,CACL,CAAC;IAEF,OAAO;QACL,kBAAkB,EAAE,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACpD,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,YAA0B,EAC1B,IAAY,EACZ,eAAe;IACb,kBAAkB,EAAE,IAAI,GAAG,EAA4B;IACvD,WAAW,EAAE,IAAI,GAAG,EAAU;CAC/B,EACD,OAAoB,IAAI,GAAG,EAAE;;IAK7B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEf,CAAC,MAAA,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QAC7D,IAAI,UAAU,CAAC,MAA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,CAAC;IACJ,CAAC;IAED,MAAM,oBAAoB,GAAG,IAAA,+BAAkB,GAAE,CAAC;IAElD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAChE,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC/C,OAAO,GAAG,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { type ProjectGraph } from '@nx/devkit';
2
+ import { ModuleFederationConfig } from './models';
3
+ interface ModuleFederationExecutorContext {
4
+ projectName: string;
5
+ projectGraph: ProjectGraph;
6
+ root: string;
7
+ }
8
+ export declare function getRemotes(devRemotes: string[], skipRemotes: string[], config: ModuleFederationConfig, context: ModuleFederationExecutorContext, pathToManifestFile?: string): {
9
+ staticRemotes: string[];
10
+ devRemotes: any[];
11
+ dynamicRemotes: any[];
12
+ remotePorts: any[];
13
+ staticRemotePort: number;
14
+ };
15
+ export declare function getModuleFederationConfig(tsconfigPath: string, workspaceRoot: string, projectRoot: string, pluginName?: 'react' | 'angular'): any;
16
+ export {};
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRemotes = getRemotes;
4
+ exports.getModuleFederationConfig = getModuleFederationConfig;
5
+ const tslib_1 = require("tslib");
6
+ const devkit_1 = require("@nx/devkit");
7
+ const internal_1 = require("@nx/js/src/internal");
8
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
+ const fs_1 = require("fs");
10
+ const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
11
+ const path_1 = require("path");
12
+ function extractRemoteProjectsFromConfig(config, pathToManifestFile) {
13
+ var _a, _b;
14
+ const remotes = [];
15
+ const dynamicRemotes = [];
16
+ if (pathToManifestFile && (0, fs_1.existsSync)(pathToManifestFile)) {
17
+ const moduleFederationManifestJson = (0, fs_1.readFileSync)(pathToManifestFile, 'utf-8');
18
+ if (moduleFederationManifestJson) {
19
+ // This should have shape of
20
+ // {
21
+ // "remoteName": "remoteLocation",
22
+ // }
23
+ const parsedManifest = JSON.parse(moduleFederationManifestJson);
24
+ if (Object.keys(parsedManifest).every((key) => typeof key === 'string' && typeof parsedManifest[key] === 'string')) {
25
+ dynamicRemotes.push(...Object.keys(parsedManifest));
26
+ }
27
+ }
28
+ }
29
+ const staticRemotes = (_b = (_a = config.remotes) === null || _a === void 0 ? void 0 : _a.map((r) => (Array.isArray(r) ? r[0] : r))) !== null && _b !== void 0 ? _b : [];
30
+ remotes.push(...staticRemotes);
31
+ return { remotes, dynamicRemotes };
32
+ }
33
+ function collectRemoteProjects(remote, collected, context) {
34
+ var _a;
35
+ const remoteProject = (_a = context.projectGraph.nodes[remote]) === null || _a === void 0 ? void 0 : _a.data;
36
+ if (!context.projectGraph.nodes[remote] || collected.has(remote)) {
37
+ return;
38
+ }
39
+ collected.add(remote);
40
+ const remoteProjectRoot = remoteProject.root;
41
+ const remoteProjectTsConfig = remoteProject.targets['build'].options.tsConfig;
42
+ const remoteProjectConfig = getModuleFederationConfig(remoteProjectTsConfig, context.root, remoteProjectRoot);
43
+ const { remotes: remoteProjectRemotes } = extractRemoteProjectsFromConfig(remoteProjectConfig);
44
+ remoteProjectRemotes.forEach((r) => collectRemoteProjects(r, collected, context));
45
+ }
46
+ function getRemotes(devRemotes, skipRemotes, config, context, pathToManifestFile) {
47
+ var _a;
48
+ const collectedRemotes = new Set();
49
+ const { remotes, dynamicRemotes } = extractRemoteProjectsFromConfig(config, pathToManifestFile);
50
+ remotes.forEach((r) => collectRemoteProjects(r, collectedRemotes, context));
51
+ const remotesToSkip = new Set((_a = (0, find_matching_projects_1.findMatchingProjects)(skipRemotes, context.projectGraph.nodes)) !== null && _a !== void 0 ? _a : []);
52
+ if (remotesToSkip.size > 0) {
53
+ devkit_1.logger.info(`Remotes not served automatically: ${[...remotesToSkip.values()].join(', ')}`);
54
+ }
55
+ const knownRemotes = Array.from(collectedRemotes).filter((r) => !remotesToSkip.has(r));
56
+ const knownDynamicRemotes = dynamicRemotes.filter((r) => !remotesToSkip.has(r) && context.projectGraph.nodes[r]);
57
+ devkit_1.logger.info(`NX Starting module federation dev-server for ${chalk_1.default.bold(context.projectName)} with ${[...knownRemotes, ...knownDynamicRemotes].length} remotes`);
58
+ const devServeApps = new Set(!devRemotes
59
+ ? []
60
+ : Array.isArray(devRemotes)
61
+ ? (0, find_matching_projects_1.findMatchingProjects)(devRemotes, context.projectGraph.nodes)
62
+ : (0, find_matching_projects_1.findMatchingProjects)([devRemotes], context.projectGraph.nodes));
63
+ const staticRemotes = knownRemotes.filter((r) => !devServeApps.has(r));
64
+ const devServeRemotes = [...knownRemotes, ...knownDynamicRemotes].filter((r) => devServeApps.has(r));
65
+ const staticDynamicRemotes = knownDynamicRemotes.filter((r) => !devServeApps.has(r));
66
+ const remotePorts = [...devServeRemotes, ...staticDynamicRemotes].map((r) => context.projectGraph.nodes[r].data.targets['serve'].options.port);
67
+ const staticRemotePort = Math.max(...[
68
+ ...remotePorts,
69
+ ...staticRemotes.map((r) => context.projectGraph.nodes[r].data.targets['serve'].options.port),
70
+ ]) +
71
+ (remotesToSkip.size + 1);
72
+ return {
73
+ staticRemotes,
74
+ devRemotes: devServeRemotes,
75
+ dynamicRemotes: staticDynamicRemotes,
76
+ remotePorts,
77
+ staticRemotePort,
78
+ };
79
+ }
80
+ function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot, pluginName = 'react') {
81
+ const moduleFederationConfigPathJS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.js');
82
+ const moduleFederationConfigPathTS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.ts');
83
+ let moduleFederationConfigPath = moduleFederationConfigPathJS;
84
+ // create a no-op so this can be called with issue
85
+ const fullTSconfigPath = tsconfigPath.startsWith(workspaceRoot)
86
+ ? tsconfigPath
87
+ : (0, path_1.join)(workspaceRoot, tsconfigPath);
88
+ let cleanupTranspiler = () => undefined;
89
+ if ((0, fs_1.existsSync)(moduleFederationConfigPathTS)) {
90
+ cleanupTranspiler = (0, internal_1.registerTsProject)(fullTSconfigPath);
91
+ moduleFederationConfigPath = moduleFederationConfigPathTS;
92
+ }
93
+ try {
94
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
95
+ const config = require(moduleFederationConfigPath);
96
+ cleanupTranspiler();
97
+ return config.default || config;
98
+ }
99
+ catch (_a) {
100
+ throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/${pluginName}:host"?\nSee: https://nx.dev/concepts/more-concepts/faster-builds-with-module-federation`);
101
+ }
102
+ }
103
+ //# sourceMappingURL=get-remotes-for-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-remotes-for-host.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/get-remotes-for-host.ts"],"names":[],"mappings":";;AA2EA,gCA4EC;AAED,8DAyCC;;AAlMD,uCAAuD;AACvD,kDAAwD;AACxD,0DAA0B;AAC1B,2BAA8C;AAC9C,gFAA2E;AAC3E,+BAA4B;AAS5B,SAAS,+BAA+B,CACtC,MAA8B,EAC9B,kBAA2B;;IAE3B,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,IAAI,kBAAkB,IAAI,IAAA,eAAU,EAAC,kBAAkB,CAAC,EAAE,CAAC;QACzD,MAAM,4BAA4B,GAAG,IAAA,iBAAY,EAC/C,kBAAkB,EAClB,OAAO,CACR,CAAC;QAEF,IAAI,4BAA4B,EAAE,CAAC;YACjC,4BAA4B;YAC5B,IAAI;YACJ,oCAAoC;YACpC,IAAI;YACJ,MAAM,cAAc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D,MAAM,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACnD,iBAAiB,EAAE,CAAC;QAEpB,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;IAClC,CAAC;IAAC,WAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,kBAAkB,0BAA0B,0CAA0C,UAAU,0FAA0F,CAC3L,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './share';
2
+ export * from './dependencies';
3
+ export * from './package-json';
4
+ export * from './remotes';
5
+ export * from './models';
6
+ export * from './get-remotes-for-host';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./share"), exports);
5
+ tslib_1.__exportStar(require("./dependencies"), exports);
6
+ tslib_1.__exportStar(require("./package-json"), exports);
7
+ tslib_1.__exportStar(require("./remotes"), exports);
8
+ tslib_1.__exportStar(require("./models"), exports);
9
+ tslib_1.__exportStar(require("./get-remotes-for-host"), exports);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,yDAA+B;AAC/B,yDAA+B;AAC/B,oDAA0B;AAC1B,mDAAyB;AACzB,iEAAuC"}
@@ -0,0 +1,47 @@
1
+ import type { moduleFederationPlugin } from '@module-federation/sdk';
2
+ import type { NormalModuleReplacementPlugin } from '@rspack/core';
3
+ export type ModuleFederationLibrary = {
4
+ type: string;
5
+ name: string;
6
+ };
7
+ export type WorkspaceLibrary = {
8
+ name: string;
9
+ root: string;
10
+ importKey: string | undefined;
11
+ };
12
+ export type SharedWorkspaceLibraryConfig = {
13
+ getAliases: () => Record<string, string>;
14
+ getLibraries: (projectRoot: string, eager?: boolean) => Record<string, SharedLibraryConfig>;
15
+ getReplacementPlugin: () => NormalModuleReplacementPlugin;
16
+ };
17
+ export type Remotes = Array<string | [remoteName: string, remoteUrl: string]>;
18
+ export interface SharedLibraryConfig {
19
+ singleton?: boolean;
20
+ strictVersion?: boolean;
21
+ requiredVersion?: false | string;
22
+ eager?: boolean;
23
+ }
24
+ export type SharedFunction = (libraryName: string, sharedConfig: SharedLibraryConfig) => undefined | false | SharedLibraryConfig;
25
+ export type AdditionalSharedConfig = Array<string | [libraryName: string, sharedConfig: SharedLibraryConfig] | {
26
+ libraryName: string;
27
+ sharedConfig: SharedLibraryConfig;
28
+ }>;
29
+ export interface ModuleFederationConfig {
30
+ name: string;
31
+ remotes?: Remotes;
32
+ library?: ModuleFederationLibrary;
33
+ exposes?: Record<string, string>;
34
+ shared?: SharedFunction;
35
+ additionalShared?: AdditionalSharedConfig;
36
+ /**
37
+ * `nxRuntimeLibraryControlPlugin` is a runtime module federation plugin to ensure
38
+ * that shared libraries are resolved from a remote with live reload capabilities.
39
+ * If you run into any issues with loading shared libraries, try disabling this option.
40
+ */
41
+ disableNxRuntimeLibraryControlPlugin?: boolean;
42
+ }
43
+ export type NxModuleFederationConfigOverride = Omit<moduleFederationPlugin.ModuleFederationPluginOptions, 'exposes' | 'remotes' | 'name' | 'library' | 'shared' | 'filename' | 'remoteType'>;
44
+ export type WorkspaceLibrarySecondaryEntryPoint = {
45
+ name: string;
46
+ path: string;
47
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/rspack/src/utils/module-federation/models/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export declare function readRootPackageJson(): {
2
+ dependencies?: {
3
+ [key: string]: string;
4
+ };
5
+ devDependencies?: {
6
+ [key: string]: string;
7
+ };
8
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readRootPackageJson = readRootPackageJson;
4
+ const fs_1 = require("fs");
5
+ const devkit_1 = require("@nx/devkit");
6
+ function readRootPackageJson() {
7
+ const pkgJsonPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'package.json');
8
+ if (!(0, fs_1.existsSync)(pkgJsonPath)) {
9
+ throw new Error('NX MF: Could not find root package.json to determine dependency versions.');
10
+ }
11
+ return (0, devkit_1.readJsonFile)(pkgJsonPath);
12
+ }
13
+ //# sourceMappingURL=package-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/package-json.ts"],"names":[],"mappings":";;AAGA,kDAYC;AAfD,2BAAgC;AAChC,uCAA4E;AAE5E,SAAgB,mBAAmB;IAIjC,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC,sBAAa,EAAE,cAAc,CAAC,CAAC;IACrE,IAAI,CAAC,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,qBAAY,EAAC,WAAW,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ export type StaticRemoteConfig = {
3
+ basePath: string;
4
+ outputPath: string;
5
+ urlSegment: string;
6
+ port: number;
7
+ };
8
+ export type StaticRemotesConfig = {
9
+ remotes: string[];
10
+ config: Record<string, StaticRemoteConfig> | undefined;
11
+ };
12
+ export declare function parseStaticRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
13
+ export declare function parseStaticSsrRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseStaticRemotesConfig = parseStaticRemotesConfig;
4
+ exports.parseStaticSsrRemotesConfig = parseStaticSsrRemotesConfig;
5
+ const path_1 = require("path");
6
+ function parseStaticRemotesConfig(staticRemotes, context) {
7
+ if (!(staticRemotes === null || staticRemotes === void 0 ? void 0 : staticRemotes.length)) {
8
+ return { remotes: [], config: undefined };
9
+ }
10
+ const config = {};
11
+ for (const app of staticRemotes) {
12
+ const outputPath = context.projectGraph.nodes[app].data.targets['build'].options.outputPath;
13
+ const basePath = (0, path_1.dirname)(outputPath);
14
+ const urlSegment = (0, path_1.basename)(outputPath);
15
+ const port = context.projectGraph.nodes[app].data.targets['serve'].options.port;
16
+ config[app] = { basePath, outputPath, urlSegment, port };
17
+ }
18
+ return { remotes: staticRemotes, config };
19
+ }
20
+ function parseStaticSsrRemotesConfig(staticRemotes, context) {
21
+ if (!(staticRemotes === null || staticRemotes === void 0 ? void 0 : staticRemotes.length)) {
22
+ return { remotes: [], config: undefined };
23
+ }
24
+ const config = {};
25
+ for (const app of staticRemotes) {
26
+ const outputPath = (0, path_1.dirname)(context.projectGraph.nodes[app].data.targets['build'].options.outputPath // dist/checkout/browser -> checkout
27
+ );
28
+ const basePath = (0, path_1.dirname)(outputPath); // dist/checkout -> dist
29
+ const urlSegment = (0, path_1.basename)(outputPath); // dist/checkout -> checkout
30
+ const port = context.projectGraph.nodes[app].data.targets['serve'].options.port;
31
+ config[app] = { basePath, outputPath, urlSegment, port };
32
+ }
33
+ return { remotes: staticRemotes, config };
34
+ }
35
+ //# sourceMappingURL=parse-static-remotes-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-static-remotes-config.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/utils/module-federation/parse-static-remotes-config.ts"],"names":[],"mappings":";;AAcA,4DAoBC;AAED,kEAoBC;AAvDD,+BAAyC;AAazC,SAAgB,wBAAwB,CACtC,aAAmC,EACnC,OAAwB;IAExB,IAAI,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,C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