@module-federation/cli 0.0.0-fix-lazy-comile-20250925082726

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present hanric(2heal1)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ <p align="center">
2
+ <a href="https://module-federation.io/" target="blank"><img src="https://module-federation.io/module-federation.svg" alt="Module Federation 2.0" /></a>
3
+ </p>
4
+
5
+ # @module-federation/cli
6
+
7
+ Module Federation CLI
8
+
9
+ <p>
10
+ <a href="https://npmjs.com/package/@module-federation/cli">
11
+ <img src="https://img.shields.io/npm/v/@module-federation/cli?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
12
+ </a>
13
+ <img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
14
+ <a href="https://npmcharts.com/compare/@module-federation/cli?minimal=true"><img src="https://img.shields.io/npm/dm/@module-federation/cli.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
15
+ </p>
package/bin/mf.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ const { runCli } = require('../dist/index.cjs.js');
3
+
4
+ runCli();
package/dist/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present hanric(2heal1)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,613 @@
1
+ 'use strict';
2
+
3
+ var commander = require('commander');
4
+ var dtsPlugin = require('@module-federation/dts-plugin');
5
+ var sdk = require('@module-federation/sdk');
6
+ var chalk = require('chalk');
7
+ var path = require('path');
8
+ var nodeBundleRequire = require('@modern-js/node-bundle-require');
9
+ var url = require('url');
10
+
11
+ /******************************************************************************
12
+ Copyright (c) Microsoft Corporation.
13
+
14
+ Permission to use, copy, modify, and/or distribute this software for any
15
+ purpose with or without fee is hereby granted.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
+ PERFORMANCE OF THIS SOFTWARE.
24
+ ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ function _instanceof(left, right) {
25
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
26
+ return !!right[Symbol.hasInstance](left);
27
+ } else {
28
+ return left instanceof right;
29
+ }
30
+ }
31
+ function __awaiter(thisArg, _arguments, P, generator) {
32
+ function adopt(value) {
33
+ return _instanceof(value, P) ? value : new P(function(resolve) {
34
+ resolve(value);
35
+ });
36
+ }
37
+ return new (P || (P = Promise))(function(resolve, reject) {
38
+ function fulfilled(value) {
39
+ try {
40
+ step(generator.next(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ }
45
+ function rejected(value) {
46
+ try {
47
+ step(generator["throw"](value));
48
+ } catch (e) {
49
+ reject(e);
50
+ }
51
+ }
52
+ function step(result) {
53
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
54
+ }
55
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
56
+ });
57
+ }
58
+ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedError(error, suppressed, message) {
59
+ var e = new Error(message);
60
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
61
+ };
62
+
63
+ var applyCommonOptions = function(command) {
64
+ command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path');
65
+ command.option('-m --mode <mode>', 'Specify the runtime environment. You can choose "dev" or "prod". The default value is "dev". After setting, the process.env.NODE_ENV environment variable will be automatically injected with "development" or "production" according to the value.', function(value) {
66
+ var validChoices = {
67
+ dev: 'development',
68
+ prod: 'production'
69
+ };
70
+ if (!Object.keys(validChoices).includes(value)) {
71
+ throw new Error("Invalid mode: ".concat(value, ". Valid choices are: ").concat(Object.keys(validChoices).join(', ')));
72
+ }
73
+ var targetEnv = validChoices[value];
74
+ if (process.env.NODE_ENV !== targetEnv) {
75
+ console.log("process.env.NODE_ENV is set to ".concat(targetEnv));
76
+ }
77
+ process.env.NODE_ENV = targetEnv;
78
+ return value;
79
+ }, 'dev');
80
+ };
81
+
82
+ function _tagged_template_literal(strings, raw) {
83
+ if (!raw) {
84
+ raw = strings.slice(0);
85
+ }
86
+ return Object.freeze(Object.defineProperties(strings, {
87
+ raw: {
88
+ value: Object.freeze(raw)
89
+ }
90
+ }));
91
+ }
92
+ function _templateObject() {
93
+ var data = _tagged_template_literal([
94
+ "{bold {cyan ",
95
+ "}}"
96
+ ]);
97
+ _templateObject = function _templateObject() {
98
+ return data;
99
+ };
100
+ return data;
101
+ }
102
+ var PREFIX = '[ Module Federation CLI ]';
103
+ var logger = sdk.createLogger(chalk(_templateObject(), PREFIX));
104
+
105
+ function _ts_generator$2(thisArg, body) {
106
+ var f, y, t, g, _ = {
107
+ label: 0,
108
+ sent: function() {
109
+ if (t[0] & 1) throw t[1];
110
+ return t[1];
111
+ },
112
+ trys: [],
113
+ ops: []
114
+ };
115
+ return g = {
116
+ next: verb(0),
117
+ "throw": verb(1),
118
+ "return": verb(2)
119
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
120
+ return this;
121
+ }), g;
122
+ function verb(n) {
123
+ return function(v) {
124
+ return step([
125
+ n,
126
+ v
127
+ ]);
128
+ };
129
+ }
130
+ function step(op) {
131
+ if (f) throw new TypeError("Generator is already executing.");
132
+ while(_)try {
133
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
134
+ if (y = 0, t) op = [
135
+ op[0] & 2,
136
+ t.value
137
+ ];
138
+ switch(op[0]){
139
+ case 0:
140
+ case 1:
141
+ t = op;
142
+ break;
143
+ case 4:
144
+ _.label++;
145
+ return {
146
+ value: op[1],
147
+ done: false
148
+ };
149
+ case 5:
150
+ _.label++;
151
+ y = op[1];
152
+ op = [
153
+ 0
154
+ ];
155
+ continue;
156
+ case 7:
157
+ op = _.ops.pop();
158
+ _.trys.pop();
159
+ continue;
160
+ default:
161
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
162
+ _ = 0;
163
+ continue;
164
+ }
165
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
166
+ _.label = op[1];
167
+ break;
168
+ }
169
+ if (op[0] === 6 && _.label < t[1]) {
170
+ _.label = t[1];
171
+ t = op;
172
+ break;
173
+ }
174
+ if (t && _.label < t[2]) {
175
+ _.label = t[2];
176
+ _.ops.push(op);
177
+ break;
178
+ }
179
+ if (t[2]) _.ops.pop();
180
+ _.trys.pop();
181
+ continue;
182
+ }
183
+ op = body.call(thisArg, _);
184
+ } catch (e) {
185
+ op = [
186
+ 6,
187
+ e
188
+ ];
189
+ y = 0;
190
+ } finally{
191
+ f = t = 0;
192
+ }
193
+ if (op[0] & 5) throw op[1];
194
+ return {
195
+ value: op[0] ? op[1] : void 0,
196
+ done: true
197
+ };
198
+ }
199
+ }
200
+ function dts(options_1, _a) {
201
+ return __awaiter(this, arguments, void 0, function(options, param) {
202
+ var readConfig, _options_fetch, fetch, _options_generate, generate, _options_root, root, output, config, mfConfig, normalizedDtsOptions, dtsManagerOptions, dtsManagerOptions1;
203
+ return _ts_generator$2(this, function(_state) {
204
+ switch(_state.label){
205
+ case 0:
206
+ readConfig = param.readConfig;
207
+ _options_fetch = options.fetch, fetch = _options_fetch === void 0 ? true : _options_fetch, _options_generate = options.generate, generate = _options_generate === void 0 ? true : _options_generate, _options_root = options.root, root = _options_root === void 0 ? process.cwd() : _options_root, output = options.output, config = options.config;
208
+ return [
209
+ 4,
210
+ readConfig(config)
211
+ ];
212
+ case 1:
213
+ mfConfig = _state.sent();
214
+ if (!dtsPlugin.isTSProject(mfConfig.dts, root)) {
215
+ logger.error('dts is only supported for TypeScript projects');
216
+ return [
217
+ 2
218
+ ];
219
+ }
220
+ normalizedDtsOptions = dtsPlugin.normalizeDtsOptions(mfConfig, root, {
221
+ defaultGenerateOptions: {
222
+ generateAPITypes: true,
223
+ compileInChildProcess: false,
224
+ abortOnError: true,
225
+ extractThirdParty: false,
226
+ extractRemoteTypes: false
227
+ },
228
+ defaultConsumeOptions: {
229
+ abortOnError: true,
230
+ consumeAPITypes: true
231
+ }
232
+ });
233
+ if (!normalizedDtsOptions) {
234
+ logger.error('dts is not enabled in module-federation.config.ts');
235
+ return [
236
+ 2
237
+ ];
238
+ }
239
+ if (!fetch) return [
240
+ 3,
241
+ 4
242
+ ];
243
+ dtsManagerOptions = dtsPlugin.normalizeConsumeTypesOptions({
244
+ context: root,
245
+ dtsOptions: normalizedDtsOptions,
246
+ pluginOptions: mfConfig
247
+ });
248
+ if (!!dtsManagerOptions) return [
249
+ 3,
250
+ 2
251
+ ];
252
+ logger.warn('dts.consumeTypes is not enabled in module-federation.config.ts, skip fetching remote types');
253
+ return [
254
+ 3,
255
+ 4
256
+ ];
257
+ case 2:
258
+ logger.debug('start fetching remote types...');
259
+ return [
260
+ 4,
261
+ dtsPlugin.consumeTypesAPI(dtsManagerOptions)
262
+ ];
263
+ case 3:
264
+ _state.sent();
265
+ logger.debug('fetch remote types success!');
266
+ _state.label = 4;
267
+ case 4:
268
+ if (!generate) return [
269
+ 3,
270
+ 6
271
+ ];
272
+ dtsManagerOptions1 = dtsPlugin.normalizeGenerateTypesOptions({
273
+ context: root,
274
+ outputDir: output,
275
+ dtsOptions: normalizedDtsOptions,
276
+ pluginOptions: mfConfig
277
+ });
278
+ if (!dtsManagerOptions1) {
279
+ logger.warn('dts.generateTypes is not enabled in module-federation.config.ts, skip generating types');
280
+ return [
281
+ 2
282
+ ];
283
+ }
284
+ logger.debug('start generating types...');
285
+ return [
286
+ 4,
287
+ dtsPlugin.generateTypesAPI({
288
+ dtsManagerOptions: dtsManagerOptions1
289
+ })
290
+ ];
291
+ case 5:
292
+ _state.sent();
293
+ logger.debug('generate types success!');
294
+ _state.label = 6;
295
+ case 6:
296
+ return [
297
+ 2
298
+ ];
299
+ }
300
+ });
301
+ });
302
+ }
303
+
304
+ function prepareCli(param) {
305
+ var welcomeMsg = param.welcomeMsg;
306
+ if (!process.env.NODE_ENV) {
307
+ process.env.NODE_ENV = 'development';
308
+ }
309
+ var npm_execpath = process.env.npm_execpath;
310
+ if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) {
311
+ console.log();
312
+ }
313
+ logger.info(welcomeMsg);
314
+ }
315
+
316
+ function _ts_generator$1(thisArg, body) {
317
+ var f, y, t, g, _ = {
318
+ label: 0,
319
+ sent: function() {
320
+ if (t[0] & 1) throw t[1];
321
+ return t[1];
322
+ },
323
+ trys: [],
324
+ ops: []
325
+ };
326
+ return g = {
327
+ next: verb(0),
328
+ "throw": verb(1),
329
+ "return": verb(2)
330
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
331
+ return this;
332
+ }), g;
333
+ function verb(n) {
334
+ return function(v) {
335
+ return step([
336
+ n,
337
+ v
338
+ ]);
339
+ };
340
+ }
341
+ function step(op) {
342
+ if (f) throw new TypeError("Generator is already executing.");
343
+ while(_)try {
344
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
345
+ if (y = 0, t) op = [
346
+ op[0] & 2,
347
+ t.value
348
+ ];
349
+ switch(op[0]){
350
+ case 0:
351
+ case 1:
352
+ t = op;
353
+ break;
354
+ case 4:
355
+ _.label++;
356
+ return {
357
+ value: op[1],
358
+ done: false
359
+ };
360
+ case 5:
361
+ _.label++;
362
+ y = op[1];
363
+ op = [
364
+ 0
365
+ ];
366
+ continue;
367
+ case 7:
368
+ op = _.ops.pop();
369
+ _.trys.pop();
370
+ continue;
371
+ default:
372
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
373
+ _ = 0;
374
+ continue;
375
+ }
376
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
377
+ _.label = op[1];
378
+ break;
379
+ }
380
+ if (op[0] === 6 && _.label < t[1]) {
381
+ _.label = t[1];
382
+ t = op;
383
+ break;
384
+ }
385
+ if (t && _.label < t[2]) {
386
+ _.label = t[2];
387
+ _.ops.push(op);
388
+ break;
389
+ }
390
+ if (t[2]) _.ops.pop();
391
+ _.trys.pop();
392
+ continue;
393
+ }
394
+ op = body.call(thisArg, _);
395
+ } catch (e) {
396
+ op = [
397
+ 6,
398
+ e
399
+ ];
400
+ y = 0;
401
+ } finally{
402
+ f = t = 0;
403
+ }
404
+ if (op[0] & 5) throw op[1];
405
+ return {
406
+ value: op[0] ? op[1] : void 0,
407
+ done: true
408
+ };
409
+ }
410
+ }
411
+ var DEFAULT_CONFIG_PATH = 'module-federation.config.ts';
412
+ var getConfigPath = function(userConfigPath) {
413
+ var defaultPath = path.resolve(process.cwd(), DEFAULT_CONFIG_PATH);
414
+ var filepath = userConfigPath !== null && userConfigPath !== void 0 ? userConfigPath : defaultPath;
415
+ return path.isAbsolute(filepath) ? filepath : path.resolve(process.cwd(), filepath);
416
+ };
417
+ function readConfig(userConfigPath) {
418
+ return __awaiter(this, void 0, void 0, function() {
419
+ var configPath, preBundlePath, mfConfig;
420
+ return _ts_generator$1(this, function(_state) {
421
+ switch(_state.label){
422
+ case 0:
423
+ configPath = getConfigPath(userConfigPath);
424
+ return [
425
+ 4,
426
+ nodeBundleRequire.bundle(configPath)
427
+ ];
428
+ case 1:
429
+ preBundlePath = _state.sent();
430
+ return [
431
+ 4,
432
+ import(url.pathToFileURL(preBundlePath).href)
433
+ ];
434
+ case 2:
435
+ mfConfig = _state.sent().default.default;
436
+ return [
437
+ 2,
438
+ mfConfig
439
+ ];
440
+ }
441
+ });
442
+ });
443
+ }
444
+
445
+ function _ts_generator(thisArg, body) {
446
+ var f, y, t, g, _ = {
447
+ label: 0,
448
+ sent: function() {
449
+ if (t[0] & 1) throw t[1];
450
+ return t[1];
451
+ },
452
+ trys: [],
453
+ ops: []
454
+ };
455
+ return g = {
456
+ next: verb(0),
457
+ "throw": verb(1),
458
+ "return": verb(2)
459
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
460
+ return this;
461
+ }), g;
462
+ function verb(n) {
463
+ return function(v) {
464
+ return step([
465
+ n,
466
+ v
467
+ ]);
468
+ };
469
+ }
470
+ function step(op) {
471
+ if (f) throw new TypeError("Generator is already executing.");
472
+ while(_)try {
473
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
474
+ if (y = 0, t) op = [
475
+ op[0] & 2,
476
+ t.value
477
+ ];
478
+ switch(op[0]){
479
+ case 0:
480
+ case 1:
481
+ t = op;
482
+ break;
483
+ case 4:
484
+ _.label++;
485
+ return {
486
+ value: op[1],
487
+ done: false
488
+ };
489
+ case 5:
490
+ _.label++;
491
+ y = op[1];
492
+ op = [
493
+ 0
494
+ ];
495
+ continue;
496
+ case 7:
497
+ op = _.ops.pop();
498
+ _.trys.pop();
499
+ continue;
500
+ default:
501
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
502
+ _ = 0;
503
+ continue;
504
+ }
505
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
506
+ _.label = op[1];
507
+ break;
508
+ }
509
+ if (op[0] === 6 && _.label < t[1]) {
510
+ _.label = t[1];
511
+ t = op;
512
+ break;
513
+ }
514
+ if (t && _.label < t[2]) {
515
+ _.label = t[2];
516
+ _.ops.push(op);
517
+ break;
518
+ }
519
+ if (t[2]) _.ops.pop();
520
+ _.trys.pop();
521
+ continue;
522
+ }
523
+ op = body.call(thisArg, _);
524
+ } catch (e) {
525
+ op = [
526
+ 6,
527
+ e
528
+ ];
529
+ y = 0;
530
+ } finally{
531
+ f = t = 0;
532
+ }
533
+ if (op[0] & 5) throw op[1];
534
+ return {
535
+ value: op[0] ? op[1] : void 0,
536
+ done: true
537
+ };
538
+ }
539
+ }
540
+ function cli(cliOptions) {
541
+ var _this = this;
542
+ var name = cliOptions.name, version = cliOptions.version, applyCommands = cliOptions.applyCommands;
543
+ commander.program.name(name).usage('<command> [options]').version(version);
544
+ var dtsCommand = commander.program.command('dts');
545
+ dtsCommand.option('--root <root>', 'specify the project root directory').option('--output <output>', 'specify the generated dts output directory').option('--fetch <boolean>', 'fetch types from remote, default is true', function(value) {
546
+ return value === 'true';
547
+ }, true).option('--generate <boolean>', 'generate types, default is true', function(value) {
548
+ return value === 'true';
549
+ }, true);
550
+ applyCommonOptions(dtsCommand);
551
+ dtsCommand.description('generate or fetch the mf types').action(function(options) {
552
+ return __awaiter(_this, void 0, void 0, function() {
553
+ var err;
554
+ return _ts_generator(this, function(_state) {
555
+ switch(_state.label){
556
+ case 0:
557
+ _state.trys.push([
558
+ 0,
559
+ 2,
560
+ ,
561
+ 3
562
+ ]);
563
+ return [
564
+ 4,
565
+ dts(options, cliOptions)
566
+ ];
567
+ case 1:
568
+ _state.sent();
569
+ return [
570
+ 3,
571
+ 3
572
+ ];
573
+ case 2:
574
+ err = _state.sent();
575
+ console.error(err);
576
+ process.exit(1);
577
+ return [
578
+ 3,
579
+ 3
580
+ ];
581
+ case 3:
582
+ return [
583
+ 2
584
+ ];
585
+ }
586
+ });
587
+ });
588
+ });
589
+ if (typeof applyCommands === 'function') {
590
+ applyCommands(commander.program, applyCommonOptions);
591
+ }
592
+ commander.program.parse();
593
+ }
594
+ function runCli(options) {
595
+ var normalizedOptions = Object.assign({
596
+ loggerPrefix: PREFIX,
597
+ welcomeMsg: "".concat("Module Federation v".concat("0.0.0-fix-lazy-comile-20250925082726"), "\n"),
598
+ name: 'mf',
599
+ readConfig: readConfig,
600
+ version: "0.0.0-fix-lazy-comile-20250925082726",
601
+ applyCommands: function() {}
602
+ }, options);
603
+ logger.setPrefix(normalizedOptions.loggerPrefix);
604
+ prepareCli(normalizedOptions);
605
+ try {
606
+ cli(normalizedOptions);
607
+ } catch (err) {
608
+ console.error(err);
609
+ }
610
+ }
611
+
612
+ exports.runCli = runCli;
613
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ export * from "./src/index";
@@ -0,0 +1,2 @@
1
+ import type { CliOptions } from './types';
2
+ export declare function runCli(options: CliOptions): void;
@@ -0,0 +1,2 @@
1
+ import type { CliOptions, DtsOptions } from '../types';
2
+ export declare function dts(options: DtsOptions, { readConfig }: Required<CliOptions>): Promise<void>;
@@ -0,0 +1 @@
1
+ export { runCli } from './cli';
@@ -0,0 +1,20 @@
1
+ import type { Command } from 'commander';
2
+ import type { moduleFederationPlugin } from '@module-federation/sdk';
3
+ export type CommonOptions = {
4
+ config?: string;
5
+ mode?: string;
6
+ };
7
+ export type DtsOptions = {
8
+ fetch?: boolean;
9
+ generate?: boolean;
10
+ root?: string;
11
+ output?: string;
12
+ } & CommonOptions;
13
+ export type CliOptions = {
14
+ welcomeMsg?: string;
15
+ loggerPrefix?: string;
16
+ name?: string;
17
+ version?: string;
18
+ readConfig?: (userConfigPath?: string) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
19
+ applyCommands?: (command: Command, applyCommonOptions: (command: Command) => void) => void;
20
+ };
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare const applyCommonOptions: (command: Command) => void;
@@ -0,0 +1,4 @@
1
+ import { type Logger } from '@module-federation/sdk';
2
+ export declare const PREFIX = "[ Module Federation CLI ]";
3
+ declare const logger: Logger;
4
+ export default logger;
@@ -0,0 +1,2 @@
1
+ import type { CliOptions } from '../types';
2
+ export declare function prepareCli({ welcomeMsg }: Required<CliOptions>): void;
@@ -0,0 +1,3 @@
1
+ import type { moduleFederationPlugin } from '@module-federation/sdk';
2
+ export declare const getConfigPath: (userConfigPath?: string) => string;
3
+ export declare function readConfig(userConfigPath?: string): Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@module-federation/cli",
3
+ "version": "0.0.0-fix-lazy-comile-20250925082726",
4
+ "type": "commonjs",
5
+ "description": "Module Federation CLI",
6
+ "homepage": "https://module-federation.io",
7
+ "bugs": {
8
+ "url": "https://github.com/module-federation/core/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/module-federation/core.git",
13
+ "directory": "packages/cli"
14
+ },
15
+ "bin": {
16
+ "mf": "./bin/mf.js"
17
+ },
18
+ "types": "./dist/index.d.ts",
19
+ "license": "MIT",
20
+ "main": "./dist/index.cjs.js",
21
+ "files": [
22
+ "dist",
23
+ "bin"
24
+ ],
25
+ "dependencies": {
26
+ "commander": "11.1.0",
27
+ "chalk": "3.0.0",
28
+ "@modern-js/node-bundle-require": "2.68.2",
29
+ "@module-federation/dts-plugin": "0.0.0-fix-lazy-comile-20250925082726",
30
+ "@module-federation/sdk": "0.0.0-fix-lazy-comile-20250925082726"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "~16.11.7"
34
+ },
35
+ "engines": {
36
+ "node": ">=16.0.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "registry": "https://registry.npmjs.org/"
41
+ }
42
+ }