@module-federation/cli 0.16.0 → 0.17.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/dist/index.cjs.js +62 -137
- package/package.json +5 -4
- /package/dist/{index.cjs.d.ts → index.d.ts} +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -8,6 +8,58 @@ var path = require('path');
|
|
|
8
8
|
var nodeBundleRequire = require('@modern-js/node-bundle-require');
|
|
9
9
|
var url = require('url');
|
|
10
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
|
+
|
|
11
63
|
var applyCommonOptions = function(command) {
|
|
12
64
|
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path');
|
|
13
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) {
|
|
@@ -50,35 +102,6 @@ function _templateObject() {
|
|
|
50
102
|
var PREFIX = '[ Module Federation CLI ]';
|
|
51
103
|
var logger = sdk.createLogger(chalk(_templateObject(), PREFIX));
|
|
52
104
|
|
|
53
|
-
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
54
|
-
try {
|
|
55
|
-
var info = gen[key](arg);
|
|
56
|
-
var value = info.value;
|
|
57
|
-
} catch (error) {
|
|
58
|
-
reject(error);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (info.done) {
|
|
62
|
-
resolve(value);
|
|
63
|
-
} else {
|
|
64
|
-
Promise.resolve(value).then(_next, _throw);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function _async_to_generator$2(fn) {
|
|
68
|
-
return function() {
|
|
69
|
-
var self = this, args = arguments;
|
|
70
|
-
return new Promise(function(resolve, reject) {
|
|
71
|
-
var gen = fn.apply(self, args);
|
|
72
|
-
function _next(value) {
|
|
73
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
74
|
-
}
|
|
75
|
-
function _throw(err) {
|
|
76
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
77
|
-
}
|
|
78
|
-
_next(undefined);
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
105
|
function _ts_generator$2(thisArg, body) {
|
|
83
106
|
var f, y, t, g, _ = {
|
|
84
107
|
label: 0,
|
|
@@ -174,11 +197,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
174
197
|
};
|
|
175
198
|
}
|
|
176
199
|
}
|
|
177
|
-
function dts(
|
|
178
|
-
return
|
|
179
|
-
}
|
|
180
|
-
function _dts() {
|
|
181
|
-
_dts = _async_to_generator$2(function(options, param) {
|
|
200
|
+
function dts(options_1, _a) {
|
|
201
|
+
return __awaiter(this, arguments, void 0, function(options, param) {
|
|
182
202
|
var readConfig, _options_fetch, fetch, _options_generate, generate, _options_root, root, output, config, mfConfig, normalizedDtsOptions, dtsManagerOptions, dtsManagerOptions1;
|
|
183
203
|
return _ts_generator$2(this, function(_state) {
|
|
184
204
|
switch(_state.label){
|
|
@@ -279,7 +299,6 @@ function _dts() {
|
|
|
279
299
|
}
|
|
280
300
|
});
|
|
281
301
|
});
|
|
282
|
-
return _dts.apply(this, arguments);
|
|
283
302
|
}
|
|
284
303
|
|
|
285
304
|
function prepareCli(param) {
|
|
@@ -287,8 +306,6 @@ function prepareCli(param) {
|
|
|
287
306
|
if (!process.env.NODE_ENV) {
|
|
288
307
|
process.env.NODE_ENV = 'development';
|
|
289
308
|
}
|
|
290
|
-
// Print a blank line to keep the greet log nice.
|
|
291
|
-
// Some package managers automatically output a blank line, some do not.
|
|
292
309
|
var npm_execpath = process.env.npm_execpath;
|
|
293
310
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) {
|
|
294
311
|
console.log();
|
|
@@ -296,35 +313,6 @@ function prepareCli(param) {
|
|
|
296
313
|
logger.info(welcomeMsg);
|
|
297
314
|
}
|
|
298
315
|
|
|
299
|
-
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
300
|
-
try {
|
|
301
|
-
var info = gen[key](arg);
|
|
302
|
-
var value = info.value;
|
|
303
|
-
} catch (error) {
|
|
304
|
-
reject(error);
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
if (info.done) {
|
|
308
|
-
resolve(value);
|
|
309
|
-
} else {
|
|
310
|
-
Promise.resolve(value).then(_next, _throw);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
function _async_to_generator$1(fn) {
|
|
314
|
-
return function() {
|
|
315
|
-
var self = this, args = arguments;
|
|
316
|
-
return new Promise(function(resolve, reject) {
|
|
317
|
-
var gen = fn.apply(self, args);
|
|
318
|
-
function _next(value) {
|
|
319
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
320
|
-
}
|
|
321
|
-
function _throw(err) {
|
|
322
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
323
|
-
}
|
|
324
|
-
_next(undefined);
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
316
|
function _ts_generator$1(thisArg, body) {
|
|
329
317
|
var f, y, t, g, _ = {
|
|
330
318
|
label: 0,
|
|
@@ -427,10 +415,7 @@ var getConfigPath = function(userConfigPath) {
|
|
|
427
415
|
return path.isAbsolute(filepath) ? filepath : path.resolve(process.cwd(), filepath);
|
|
428
416
|
};
|
|
429
417
|
function readConfig(userConfigPath) {
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
function _readConfig() {
|
|
433
|
-
_readConfig = _async_to_generator$1(function(userConfigPath) {
|
|
418
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
434
419
|
var configPath, preBundlePath, mfConfig;
|
|
435
420
|
return _ts_generator$1(this, function(_state) {
|
|
436
421
|
switch(_state.label){
|
|
@@ -455,66 +440,8 @@ function _readConfig() {
|
|
|
455
440
|
}
|
|
456
441
|
});
|
|
457
442
|
});
|
|
458
|
-
return _readConfig.apply(this, arguments);
|
|
459
443
|
}
|
|
460
444
|
|
|
461
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
462
|
-
try {
|
|
463
|
-
var info = gen[key](arg);
|
|
464
|
-
var value = info.value;
|
|
465
|
-
} catch (error) {
|
|
466
|
-
reject(error);
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
if (info.done) {
|
|
470
|
-
resolve(value);
|
|
471
|
-
} else {
|
|
472
|
-
Promise.resolve(value).then(_next, _throw);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
function _async_to_generator(fn) {
|
|
476
|
-
return function() {
|
|
477
|
-
var self = this, args = arguments;
|
|
478
|
-
return new Promise(function(resolve, reject) {
|
|
479
|
-
var gen = fn.apply(self, args);
|
|
480
|
-
function _next(value) {
|
|
481
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
482
|
-
}
|
|
483
|
-
function _throw(err) {
|
|
484
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
485
|
-
}
|
|
486
|
-
_next(undefined);
|
|
487
|
-
});
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
function _define_property(obj, key, value) {
|
|
491
|
-
if (key in obj) {
|
|
492
|
-
Object.defineProperty(obj, key, {
|
|
493
|
-
value: value,
|
|
494
|
-
enumerable: true,
|
|
495
|
-
configurable: true,
|
|
496
|
-
writable: true
|
|
497
|
-
});
|
|
498
|
-
} else {
|
|
499
|
-
obj[key] = value;
|
|
500
|
-
}
|
|
501
|
-
return obj;
|
|
502
|
-
}
|
|
503
|
-
function _object_spread(target) {
|
|
504
|
-
for(var i = 1; i < arguments.length; i++){
|
|
505
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
506
|
-
var ownKeys = Object.keys(source);
|
|
507
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
508
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
509
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
510
|
-
}));
|
|
511
|
-
}
|
|
512
|
-
ownKeys.forEach(function(key) {
|
|
513
|
-
_define_property(target, key, source[key]);
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
return target;
|
|
517
|
-
}
|
|
518
445
|
function _ts_generator(thisArg, body) {
|
|
519
446
|
var f, y, t, g, _ = {
|
|
520
447
|
label: 0,
|
|
@@ -611,6 +538,7 @@ function _ts_generator(thisArg, body) {
|
|
|
611
538
|
}
|
|
612
539
|
}
|
|
613
540
|
function cli(cliOptions) {
|
|
541
|
+
var _this = this;
|
|
614
542
|
var name = cliOptions.name, version = cliOptions.version, applyCommands = cliOptions.applyCommands;
|
|
615
543
|
commander.program.name(name).usage('<command> [options]').version(version);
|
|
616
544
|
var dtsCommand = commander.program.command('dts');
|
|
@@ -620,8 +548,8 @@ function cli(cliOptions) {
|
|
|
620
548
|
return value === 'true';
|
|
621
549
|
}, true);
|
|
622
550
|
applyCommonOptions(dtsCommand);
|
|
623
|
-
dtsCommand.description('generate or fetch the mf types').action(
|
|
624
|
-
|
|
551
|
+
dtsCommand.description('generate or fetch the mf types').action(function(options) {
|
|
552
|
+
return __awaiter(_this, void 0, void 0, function() {
|
|
625
553
|
var err;
|
|
626
554
|
return _ts_generator(this, function(_state) {
|
|
627
555
|
switch(_state.label){
|
|
@@ -657,22 +585,19 @@ function cli(cliOptions) {
|
|
|
657
585
|
}
|
|
658
586
|
});
|
|
659
587
|
});
|
|
660
|
-
|
|
661
|
-
return _ref.apply(this, arguments);
|
|
662
|
-
};
|
|
663
|
-
}());
|
|
588
|
+
});
|
|
664
589
|
if (typeof applyCommands === 'function') {
|
|
665
590
|
applyCommands(commander.program, applyCommonOptions);
|
|
666
591
|
}
|
|
667
592
|
commander.program.parse();
|
|
668
593
|
}
|
|
669
594
|
function runCli(options) {
|
|
670
|
-
var normalizedOptions =
|
|
595
|
+
var normalizedOptions = Object.assign({
|
|
671
596
|
loggerPrefix: PREFIX,
|
|
672
|
-
welcomeMsg: "".concat("Module Federation v".concat("0.
|
|
597
|
+
welcomeMsg: "".concat("Module Federation v".concat("0.17.1"), "\n"),
|
|
673
598
|
name: 'mf',
|
|
674
599
|
readConfig: readConfig,
|
|
675
|
-
version: "0.
|
|
600
|
+
version: "0.17.1",
|
|
676
601
|
applyCommands: function() {}
|
|
677
602
|
}, options);
|
|
678
603
|
logger.setPrefix(normalizedOptions.loggerPrefix);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Module Federation CLI",
|
|
6
6
|
"homepage": "https://module-federation.io",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"bin": {
|
|
16
16
|
"mf": "./bin/mf.js"
|
|
17
17
|
},
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"main": "./dist/index.cjs.js",
|
|
20
21
|
"files": [
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"commander": "11.1.0",
|
|
26
27
|
"chalk": "3.0.0",
|
|
27
|
-
"@modern-js/node-bundle-require": "2.
|
|
28
|
-
"@module-federation/sdk": "0.
|
|
29
|
-
"@module-federation/dts-plugin": "0.
|
|
28
|
+
"@modern-js/node-bundle-require": "2.68.2",
|
|
29
|
+
"@module-federation/sdk": "0.17.1",
|
|
30
|
+
"@module-federation/dts-plugin": "0.17.1"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/node": "~16.11.7"
|
|
File without changes
|