@modern-js/dependence-generator 1.2.1 → 1.2.2
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/js/node/index.js +103 -0
- package/dist/js/node/main.js +181 -145
- package/package.json +2 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleTemplateFile = exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
10
|
+
var _codesmithApiApp = require("@modern-js/codesmith-api-app");
|
|
11
|
+
|
|
12
|
+
var _codesmithApiJson = require("@modern-js/codesmith-api-json");
|
|
13
|
+
|
|
14
|
+
var _generatorCommon = require("@modern-js/generator-common");
|
|
15
|
+
|
|
16
|
+
var _generatorUtils = require("@modern-js/generator-utils");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
const handleTemplateFile = async (context, generator) => {
|
|
21
|
+
const jsonAPI = new _codesmithApiJson.JsonAPI(generator);
|
|
22
|
+
const {
|
|
23
|
+
devDependencies,
|
|
24
|
+
dependencies,
|
|
25
|
+
peerDependencies,
|
|
26
|
+
appendTypeContent,
|
|
27
|
+
sourceTypeFile,
|
|
28
|
+
projectPath
|
|
29
|
+
} = context.config;
|
|
30
|
+
const setJSON = {};
|
|
31
|
+
Object.keys(devDependencies || {}).forEach(key => {
|
|
32
|
+
setJSON[`devDependencies.${key}`] = devDependencies[key];
|
|
33
|
+
});
|
|
34
|
+
Object.keys(dependencies || {}).forEach(key => {
|
|
35
|
+
setJSON[`dependencies.${key}`] = dependencies[key];
|
|
36
|
+
});
|
|
37
|
+
Object.keys(peerDependencies || {}).forEach(key => {
|
|
38
|
+
setJSON[`peerDependencies.${key}`] = peerDependencies[key];
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (Object.keys(setJSON).length > 0) {
|
|
42
|
+
await jsonAPI.update(context.materials.default.get(_path.default.join(projectPath || '', 'package.json')), {
|
|
43
|
+
query: {},
|
|
44
|
+
update: {
|
|
45
|
+
$set: setJSON
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (appendTypeContent) {
|
|
51
|
+
const appDir = context.materials.default.basePath;
|
|
52
|
+
|
|
53
|
+
const typePath = _path.default.join(appDir, projectPath || '', 'src', sourceTypeFile || 'modern-app-env.d.ts');
|
|
54
|
+
|
|
55
|
+
if (_generatorUtils.fs.existsSync(typePath)) {
|
|
56
|
+
const npmrc = _generatorUtils.fs.readFileSync(typePath, 'utf-8');
|
|
57
|
+
|
|
58
|
+
if (!npmrc.includes(appendTypeContent)) {
|
|
59
|
+
_generatorUtils.fs.writeFileSync(typePath, `${npmrc}${appendTypeContent}\n`, 'utf-8');
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
_generatorUtils.fs.ensureFileSync(typePath);
|
|
63
|
+
|
|
64
|
+
_generatorUtils.fs.writeFileSync(typePath, appendTypeContent, 'utf-8');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.handleTemplateFile = handleTemplateFile;
|
|
70
|
+
|
|
71
|
+
var _default = async (context, generator) => {
|
|
72
|
+
const appApi = new _codesmithApiApp.AppAPI(context, generator);
|
|
73
|
+
const {
|
|
74
|
+
locale
|
|
75
|
+
} = context.config;
|
|
76
|
+
|
|
77
|
+
_generatorCommon.i18n.changeLanguage({
|
|
78
|
+
locale
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
appApi.i18n.changeLanguage({
|
|
82
|
+
locale
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (!(await appApi.checkEnvironment())) {
|
|
86
|
+
// eslint-disable-next-line no-process-exit
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
generator.logger.debug(`start run @modern-js/dependence-generator`);
|
|
91
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
92
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
93
|
+
await handleTemplateFile(context, generator);
|
|
94
|
+
|
|
95
|
+
if (!context.config.isSubGenerator) {
|
|
96
|
+
await appApi.runInstall();
|
|
97
|
+
appApi.showSuccessInfo();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
generator.logger.debug(`forge @modern-js/dependence-generator succeed `);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
exports.default = _default;
|
package/dist/js/node/main.js
CHANGED
|
@@ -466,7 +466,7 @@ Object.defineProperty(exports, "I18n", ({
|
|
|
466
466
|
}));
|
|
467
467
|
exports.localeKeys = exports.i18n = void 0;
|
|
468
468
|
|
|
469
|
-
var _pluginI18n = __webpack_require__(
|
|
469
|
+
var _pluginI18n = __webpack_require__(54207);
|
|
470
470
|
|
|
471
471
|
var _zh = __webpack_require__(57724);
|
|
472
472
|
|
|
@@ -5689,7 +5689,7 @@ exports.pointer = pointer;
|
|
|
5689
5689
|
|
|
5690
5690
|
/***/ }),
|
|
5691
5691
|
|
|
5692
|
-
/***/
|
|
5692
|
+
/***/ 54207:
|
|
5693
5693
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5694
5694
|
|
|
5695
5695
|
"use strict";
|
|
@@ -5702,7 +5702,7 @@ exports.I18n = void 0;
|
|
|
5702
5702
|
|
|
5703
5703
|
var _get2 = _interopRequireDefault(__webpack_require__(71189));
|
|
5704
5704
|
|
|
5705
|
-
var _utils = __webpack_require__(
|
|
5705
|
+
var _utils = __webpack_require__(41083);
|
|
5706
5706
|
|
|
5707
5707
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5708
5708
|
|
|
@@ -5771,7 +5771,7 @@ exports.I18n = I18n;
|
|
|
5771
5771
|
|
|
5772
5772
|
/***/ }),
|
|
5773
5773
|
|
|
5774
|
-
/***/
|
|
5774
|
+
/***/ 41083:
|
|
5775
5775
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5776
5776
|
|
|
5777
5777
|
"use strict";
|
|
@@ -269421,7 +269421,7 @@ const SubSolutionSchema = {
|
|
|
269421
269421
|
}));
|
|
269422
269422
|
|
|
269423
269423
|
if (data.solution && data.solution !== 'custom') {
|
|
269424
|
-
items.
|
|
269424
|
+
items.unshift({
|
|
269425
269425
|
key: data.solution,
|
|
269426
269426
|
label: `${SubSolutionText[data.solution]()}(${_locale.i18n.t(_locale.localeKeys.solution.default)})`
|
|
269427
269427
|
});
|
|
@@ -269870,7 +269870,7 @@ const ZH_LOCALE = {
|
|
|
269870
269870
|
runtime_api: '启用「Rumtime API」',
|
|
269871
269871
|
mwa_storybook: '启用「Visual Testing (Storybook)」模式',
|
|
269872
269872
|
ssg: '启用「SSG」功能',
|
|
269873
|
-
polyfill: '
|
|
269873
|
+
polyfill: '启用「基于 UA 的 Polyfill」功能',
|
|
269874
269874
|
deploy: '启用「部署」功能'
|
|
269875
269875
|
},
|
|
269876
269876
|
element: {
|
|
@@ -270965,7 +270965,7 @@ const MWAActionFunctionsDependencies = {
|
|
|
270965
270965
|
[_common.ActionFunction.Less]: '@modern-js/plugin-less',
|
|
270966
270966
|
[_common.ActionFunction.Sass]: '@modern-js/plugin-sass',
|
|
270967
270967
|
[_common.ActionFunction.BFF]: '@modern-js/plugin-bff',
|
|
270968
|
-
[_common.ActionFunction.MicroFrontend]: '@modern-js/plugin-
|
|
270968
|
+
[_common.ActionFunction.MicroFrontend]: '@modern-js/plugin-garfish',
|
|
270969
270969
|
[_common.ActionFunction.I18n]: '@modern-js/plugin-i18n',
|
|
270970
270970
|
[_common.ActionFunction.SSG]: '@modern-js/plugin-ssg',
|
|
270971
270971
|
[_common.ActionFunction.Polyfill]: '@modern-js/plugin-polyfill'
|
|
@@ -270973,7 +270973,7 @@ const MWAActionFunctionsDependencies = {
|
|
|
270973
270973
|
exports.MWAActionFunctionsDependencies = MWAActionFunctionsDependencies;
|
|
270974
270974
|
const MWAActionFunctionsAppendTypeContent = {
|
|
270975
270975
|
[_common.ActionFunction.Test]: `/// <reference types='@modern-js/plugin-testing/type' />`,
|
|
270976
|
-
[_common.ActionFunction.MicroFrontend]: `/// <reference types='@modern-js/plugin-
|
|
270976
|
+
[_common.ActionFunction.MicroFrontend]: `/// <reference types='@modern-js/plugin-garfish/type' />`
|
|
270977
270977
|
};
|
|
270978
270978
|
exports.MWAActionFunctionsAppendTypeContent = MWAActionFunctionsAppendTypeContent;
|
|
270979
270979
|
const MWANewActionGenerators = {
|
|
@@ -271371,6 +271371,116 @@ function stripAnsi(string) {
|
|
|
271371
271371
|
|
|
271372
271372
|
/***/ }),
|
|
271373
271373
|
|
|
271374
|
+
/***/ 34701:
|
|
271375
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
271376
|
+
|
|
271377
|
+
"use strict";
|
|
271378
|
+
|
|
271379
|
+
|
|
271380
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
271381
|
+
value: true
|
|
271382
|
+
}));
|
|
271383
|
+
exports.handleTemplateFile = exports["default"] = void 0;
|
|
271384
|
+
|
|
271385
|
+
var _path = _interopRequireDefault(__webpack_require__(71017));
|
|
271386
|
+
|
|
271387
|
+
var _codesmithApiApp = __webpack_require__(83028);
|
|
271388
|
+
|
|
271389
|
+
var _codesmithApiJson = __webpack_require__(54517);
|
|
271390
|
+
|
|
271391
|
+
var _generatorCommon = __webpack_require__(50828);
|
|
271392
|
+
|
|
271393
|
+
var _generatorUtils = __webpack_require__(89489);
|
|
271394
|
+
|
|
271395
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
271396
|
+
|
|
271397
|
+
const handleTemplateFile = async (context, generator) => {
|
|
271398
|
+
const jsonAPI = new _codesmithApiJson.JsonAPI(generator);
|
|
271399
|
+
const {
|
|
271400
|
+
devDependencies,
|
|
271401
|
+
dependencies,
|
|
271402
|
+
peerDependencies,
|
|
271403
|
+
appendTypeContent,
|
|
271404
|
+
sourceTypeFile,
|
|
271405
|
+
projectPath
|
|
271406
|
+
} = context.config;
|
|
271407
|
+
const setJSON = {};
|
|
271408
|
+
Object.keys(devDependencies || {}).forEach(key => {
|
|
271409
|
+
setJSON[`devDependencies.${key}`] = devDependencies[key];
|
|
271410
|
+
});
|
|
271411
|
+
Object.keys(dependencies || {}).forEach(key => {
|
|
271412
|
+
setJSON[`dependencies.${key}`] = dependencies[key];
|
|
271413
|
+
});
|
|
271414
|
+
Object.keys(peerDependencies || {}).forEach(key => {
|
|
271415
|
+
setJSON[`peerDependencies.${key}`] = peerDependencies[key];
|
|
271416
|
+
});
|
|
271417
|
+
|
|
271418
|
+
if (Object.keys(setJSON).length > 0) {
|
|
271419
|
+
await jsonAPI.update(context.materials.default.get(_path.default.join(projectPath || '', 'package.json')), {
|
|
271420
|
+
query: {},
|
|
271421
|
+
update: {
|
|
271422
|
+
$set: setJSON
|
|
271423
|
+
}
|
|
271424
|
+
});
|
|
271425
|
+
}
|
|
271426
|
+
|
|
271427
|
+
if (appendTypeContent) {
|
|
271428
|
+
const appDir = context.materials.default.basePath;
|
|
271429
|
+
|
|
271430
|
+
const typePath = _path.default.join(appDir, projectPath || '', 'src', sourceTypeFile || 'modern-app-env.d.ts');
|
|
271431
|
+
|
|
271432
|
+
if (_generatorUtils.fs.existsSync(typePath)) {
|
|
271433
|
+
const npmrc = _generatorUtils.fs.readFileSync(typePath, 'utf-8');
|
|
271434
|
+
|
|
271435
|
+
if (!npmrc.includes(appendTypeContent)) {
|
|
271436
|
+
_generatorUtils.fs.writeFileSync(typePath, `${npmrc}${appendTypeContent}\n`, 'utf-8');
|
|
271437
|
+
}
|
|
271438
|
+
} else {
|
|
271439
|
+
_generatorUtils.fs.ensureFileSync(typePath);
|
|
271440
|
+
|
|
271441
|
+
_generatorUtils.fs.writeFileSync(typePath, appendTypeContent, 'utf-8');
|
|
271442
|
+
}
|
|
271443
|
+
}
|
|
271444
|
+
};
|
|
271445
|
+
|
|
271446
|
+
exports.handleTemplateFile = handleTemplateFile;
|
|
271447
|
+
|
|
271448
|
+
var _default = async (context, generator) => {
|
|
271449
|
+
const appApi = new _codesmithApiApp.AppAPI(context, generator);
|
|
271450
|
+
const {
|
|
271451
|
+
locale
|
|
271452
|
+
} = context.config;
|
|
271453
|
+
|
|
271454
|
+
_generatorCommon.i18n.changeLanguage({
|
|
271455
|
+
locale
|
|
271456
|
+
});
|
|
271457
|
+
|
|
271458
|
+
appApi.i18n.changeLanguage({
|
|
271459
|
+
locale
|
|
271460
|
+
});
|
|
271461
|
+
|
|
271462
|
+
if (!(await appApi.checkEnvironment())) {
|
|
271463
|
+
// eslint-disable-next-line no-process-exit
|
|
271464
|
+
process.exit(1);
|
|
271465
|
+
}
|
|
271466
|
+
|
|
271467
|
+
generator.logger.debug(`start run @modern-js/dependence-generator`);
|
|
271468
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
271469
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
271470
|
+
await handleTemplateFile(context, generator);
|
|
271471
|
+
|
|
271472
|
+
if (!context.config.isSubGenerator) {
|
|
271473
|
+
await appApi.runInstall();
|
|
271474
|
+
appApi.showSuccessInfo();
|
|
271475
|
+
}
|
|
271476
|
+
|
|
271477
|
+
generator.logger.debug(`forge @modern-js/dependence-generator succeed `);
|
|
271478
|
+
};
|
|
271479
|
+
|
|
271480
|
+
exports["default"] = _default;
|
|
271481
|
+
|
|
271482
|
+
/***/ }),
|
|
271483
|
+
|
|
271374
271484
|
/***/ 13076:
|
|
271375
271485
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
271376
271486
|
|
|
@@ -271735,7 +271845,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
271735
271845
|
exports.clearConsole = void 0;
|
|
271736
271846
|
|
|
271737
271847
|
const clearConsole = () => {
|
|
271738
|
-
if (process.stdout.isTTY) {
|
|
271848
|
+
if (process.stdout.isTTY && !process.env.DEBUG) {
|
|
271739
271849
|
process.stdout.write('\x1B[H\x1B[2J');
|
|
271740
271850
|
}
|
|
271741
271851
|
};
|
|
@@ -271745,7 +271855,7 @@ exports.clearConsole = clearConsole;
|
|
|
271745
271855
|
/***/ }),
|
|
271746
271856
|
|
|
271747
271857
|
/***/ 4002:
|
|
271748
|
-
/***/ ((
|
|
271858
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
271749
271859
|
|
|
271750
271860
|
"use strict";
|
|
271751
271861
|
|
|
@@ -271753,7 +271863,7 @@ exports.clearConsole = clearConsole;
|
|
|
271753
271863
|
Object.defineProperty(exports, "__esModule", ({
|
|
271754
271864
|
value: true
|
|
271755
271865
|
}));
|
|
271756
|
-
exports.requireExistModule = exports.compatRequire = void 0;
|
|
271866
|
+
exports.requireExistModule = exports.compatRequire = exports.cleanRequireCache = void 0;
|
|
271757
271867
|
|
|
271758
271868
|
var _findExists = __webpack_require__(3664);
|
|
271759
271869
|
|
|
@@ -271782,6 +271892,14 @@ const requireExistModule = (filename, extensions = ['.ts', '.js']) => {
|
|
|
271782
271892
|
|
|
271783
271893
|
exports.requireExistModule = requireExistModule;
|
|
271784
271894
|
|
|
271895
|
+
const cleanRequireCache = filelist => {
|
|
271896
|
+
filelist.forEach(filepath => {
|
|
271897
|
+
delete __webpack_require__.c[filepath];
|
|
271898
|
+
});
|
|
271899
|
+
};
|
|
271900
|
+
|
|
271901
|
+
exports.cleanRequireCache = cleanRequireCache;
|
|
271902
|
+
|
|
271785
271903
|
/***/ }),
|
|
271786
271904
|
|
|
271787
271905
|
/***/ 36762:
|
|
@@ -271793,23 +271911,11 @@ exports.requireExistModule = requireExistModule;
|
|
|
271793
271911
|
Object.defineProperty(exports, "__esModule", ({
|
|
271794
271912
|
value: true
|
|
271795
271913
|
}));
|
|
271796
|
-
exports.SHARED_DIR = exports.SERVER_RENDER_FUNCTION_NAME = exports.SERVER_DIR = exports.SERVER_BUNDLE_DIRECTORY = exports.ROUTE_SPEC_FILE = exports.PLUGIN_SCHEMAS = exports.MAIN_ENTRY_NAME = exports.LOADABLE_STATS_FILE = exports.LAUNCH_EDITOR_ENDPOINT = exports.
|
|
271914
|
+
exports.SHARED_DIR = exports.SERVER_RENDER_FUNCTION_NAME = exports.SERVER_DIR = exports.SERVER_BUNDLE_DIRECTORY = exports.ROUTE_SPEC_FILE = exports.PLUGIN_SCHEMAS = exports.MAIN_ENTRY_NAME = exports.LOADABLE_STATS_FILE = exports.LAUNCH_EDITOR_ENDPOINT = exports.INTERNAL_PLUGINS = exports.HMR_SOCK_PATH = exports.ENTRY_NAME_PATTERN = exports.API_DIR = void 0;
|
|
271797
271915
|
|
|
271798
|
-
/**
|
|
271799
|
-
* alias to src directory
|
|
271800
|
-
*/
|
|
271801
|
-
const INTERNAL_SRC_ALIAS = '@_modern_js_src';
|
|
271802
|
-
/**
|
|
271803
|
-
* alias to node_modules/.modern-js
|
|
271804
|
-
*/
|
|
271805
|
-
|
|
271806
|
-
exports.INTERNAL_SRC_ALIAS = INTERNAL_SRC_ALIAS;
|
|
271807
|
-
const INTERNAL_DIR_ALAIS = '@_modern_js_internal';
|
|
271808
271916
|
/**
|
|
271809
271917
|
* hmr socket connect path
|
|
271810
271918
|
*/
|
|
271811
|
-
|
|
271812
|
-
exports.INTERNAL_DIR_ALAIS = INTERNAL_DIR_ALAIS;
|
|
271813
271919
|
const HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
|
271814
271920
|
/**
|
|
271815
271921
|
* route specification file
|
|
@@ -271853,17 +271959,11 @@ const SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
|
271853
271959
|
|
|
271854
271960
|
exports.SERVER_RENDER_FUNCTION_NAME = SERVER_RENDER_FUNCTION_NAME;
|
|
271855
271961
|
const LOADABLE_STATS_FILE = 'loadable-stats.json';
|
|
271856
|
-
/**
|
|
271857
|
-
* real entry generate by modern.js
|
|
271858
|
-
*/
|
|
271859
|
-
|
|
271860
|
-
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
|
271861
|
-
const HIDE_MODERN_JS_DIR = './node_modules/.modern-js';
|
|
271862
271962
|
/**
|
|
271863
271963
|
* internal specified folder
|
|
271864
271964
|
*/
|
|
271865
271965
|
|
|
271866
|
-
exports.
|
|
271966
|
+
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
|
271867
271967
|
const API_DIR = 'api';
|
|
271868
271968
|
exports.API_DIR = API_DIR;
|
|
271869
271969
|
const SERVER_DIR = 'server';
|
|
@@ -271944,8 +272044,8 @@ const INTERNAL_PLUGINS = {
|
|
|
271944
272044
|
cli: '@modern-js/plugin-server/cli',
|
|
271945
272045
|
server: '@modern-js/plugin-server/server'
|
|
271946
272046
|
},
|
|
271947
|
-
'@modern-js/plugin-
|
|
271948
|
-
cli: '@modern-js/plugin-
|
|
272047
|
+
'@modern-js/plugin-garfish': {
|
|
272048
|
+
cli: '@modern-js/plugin-garfish/cli'
|
|
271949
272049
|
},
|
|
271950
272050
|
'@modern-js/plugin-jarvis': {
|
|
271951
272051
|
cli: '@modern-js/plugin-jarvis/cli'
|
|
@@ -272113,7 +272213,7 @@ const PLUGIN_SCHEMAS = {
|
|
|
272113
272213
|
typeof: ['object', 'function']
|
|
272114
272214
|
}
|
|
272115
272215
|
}],
|
|
272116
|
-
'@modern-js/plugin-
|
|
272216
|
+
'@modern-js/plugin-garfish': [{
|
|
272117
272217
|
target: 'runtime.masterApp',
|
|
272118
272218
|
schema: {
|
|
272119
272219
|
type: ['object']
|
|
@@ -273093,6 +273193,20 @@ Object.keys(_nodeEnv).forEach(function (key) {
|
|
|
273093
273193
|
});
|
|
273094
273194
|
});
|
|
273095
273195
|
|
|
273196
|
+
var _wait = __webpack_require__(96649);
|
|
273197
|
+
|
|
273198
|
+
Object.keys(_wait).forEach(function (key) {
|
|
273199
|
+
if (key === "default" || key === "__esModule") return;
|
|
273200
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
273201
|
+
if (key in exports && exports[key] === _wait[key]) return;
|
|
273202
|
+
Object.defineProperty(exports, key, {
|
|
273203
|
+
enumerable: true,
|
|
273204
|
+
get: function () {
|
|
273205
|
+
return _wait[key];
|
|
273206
|
+
}
|
|
273207
|
+
});
|
|
273208
|
+
});
|
|
273209
|
+
|
|
273096
273210
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
273097
273211
|
|
|
273098
273212
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -273835,13 +273949,14 @@ const prettyInstructions = (appContext, config) => {
|
|
|
273835
273949
|
const {
|
|
273836
273950
|
entrypoints,
|
|
273837
273951
|
serverRoutes,
|
|
273838
|
-
port
|
|
273952
|
+
port,
|
|
273953
|
+
existSrc
|
|
273839
273954
|
} = appContext;
|
|
273840
273955
|
const urls = getAddressUrls(config.dev.https && (0, _is.isDev)() ? 'https' : 'http', port);
|
|
273841
|
-
const routes = serverRoutes.filter(route => route.entryName);
|
|
273956
|
+
const routes = existSrc ? serverRoutes.filter(route => route.entryName) : serverRoutes;
|
|
273842
273957
|
let message = 'App running at:\n\n';
|
|
273843
273958
|
|
|
273844
|
-
if (isSingleEntry(entrypoints)) {
|
|
273959
|
+
if (isSingleEntry(entrypoints) || !existSrc) {
|
|
273845
273960
|
message += urls.map(({
|
|
273846
273961
|
type,
|
|
273847
273962
|
url
|
|
@@ -274065,6 +274180,25 @@ exports.createRuntimeExportsUtils = createRuntimeExportsUtils;
|
|
|
274065
274180
|
|
|
274066
274181
|
/***/ }),
|
|
274067
274182
|
|
|
274183
|
+
/***/ 96649:
|
|
274184
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
274185
|
+
|
|
274186
|
+
"use strict";
|
|
274187
|
+
|
|
274188
|
+
|
|
274189
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
274190
|
+
value: true
|
|
274191
|
+
}));
|
|
274192
|
+
exports.wait = void 0;
|
|
274193
|
+
|
|
274194
|
+
const wait = (time = 0) => new Promise(resolve => {
|
|
274195
|
+
setTimeout(resolve, time);
|
|
274196
|
+
});
|
|
274197
|
+
|
|
274198
|
+
exports.wait = wait;
|
|
274199
|
+
|
|
274200
|
+
/***/ }),
|
|
274201
|
+
|
|
274068
274202
|
/***/ 31116:
|
|
274069
274203
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
274070
274204
|
|
|
@@ -281096,6 +281230,9 @@ module.exports = JSON.parse('{"v0.8":{"start":"2012-06-25","end":"2014-07-31"},"
|
|
|
281096
281230
|
/******/ return module.exports;
|
|
281097
281231
|
/******/ }
|
|
281098
281232
|
/******/
|
|
281233
|
+
/******/ // expose the module cache
|
|
281234
|
+
/******/ __webpack_require__.c = __webpack_module_cache__;
|
|
281235
|
+
/******/
|
|
281099
281236
|
/************************************************************************/
|
|
281100
281237
|
/******/ /* webpack/runtime/define property getters */
|
|
281101
281238
|
/******/ (() => {
|
|
@@ -281135,113 +281272,12 @@ module.exports = JSON.parse('{"v0.8":{"start":"2012-06-25","end":"2014-07-31"},"
|
|
|
281135
281272
|
/******/ })();
|
|
281136
281273
|
/******/
|
|
281137
281274
|
/************************************************************************/
|
|
281138
|
-
|
|
281139
|
-
//
|
|
281140
|
-
|
|
281141
|
-
|
|
281142
|
-
var
|
|
281143
|
-
|
|
281144
|
-
|
|
281145
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
281146
|
-
value: true
|
|
281147
|
-
}));
|
|
281148
|
-
exports["default"] = void 0;
|
|
281149
|
-
|
|
281150
|
-
var _path = _interopRequireDefault(__webpack_require__(71017));
|
|
281151
|
-
|
|
281152
|
-
var _codesmithApiApp = __webpack_require__(83028);
|
|
281153
|
-
|
|
281154
|
-
var _codesmithApiJson = __webpack_require__(54517);
|
|
281155
|
-
|
|
281156
|
-
var _generatorCommon = __webpack_require__(50828);
|
|
281157
|
-
|
|
281158
|
-
var _generatorUtils = __webpack_require__(89489);
|
|
281159
|
-
|
|
281160
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
281161
|
-
|
|
281162
|
-
const handleTemplateFile = async (context, generator) => {
|
|
281163
|
-
const jsonAPI = new _codesmithApiJson.JsonAPI(generator);
|
|
281164
|
-
const {
|
|
281165
|
-
devDependencies,
|
|
281166
|
-
dependencies,
|
|
281167
|
-
peerDependencies,
|
|
281168
|
-
appendTypeContent,
|
|
281169
|
-
sourceTypeFile
|
|
281170
|
-
} = context.config;
|
|
281171
|
-
const setJSON = {};
|
|
281172
|
-
Object.keys(devDependencies || {}).forEach(key => {
|
|
281173
|
-
setJSON[`devDependencies.${key}`] = devDependencies[key];
|
|
281174
|
-
});
|
|
281175
|
-
Object.keys(dependencies || {}).forEach(key => {
|
|
281176
|
-
setJSON[`dependencies.${key}`] = dependencies[key];
|
|
281177
|
-
});
|
|
281178
|
-
Object.keys(peerDependencies || {}).forEach(key => {
|
|
281179
|
-
setJSON[`peerDependencies.${key}`] = peerDependencies[key];
|
|
281180
|
-
});
|
|
281181
|
-
|
|
281182
|
-
if (Object.keys(setJSON).length > 0) {
|
|
281183
|
-
await jsonAPI.update(context.materials.default.get(`package.json`), {
|
|
281184
|
-
query: {},
|
|
281185
|
-
update: {
|
|
281186
|
-
$set: setJSON
|
|
281187
|
-
}
|
|
281188
|
-
});
|
|
281189
|
-
}
|
|
281190
|
-
|
|
281191
|
-
if (appendTypeContent) {
|
|
281192
|
-
const appDir = context.materials.default.basePath;
|
|
281193
|
-
|
|
281194
|
-
const typePath = _path.default.join(appDir, 'src', sourceTypeFile || 'modern-app-env.d.ts');
|
|
281195
|
-
|
|
281196
|
-
if (_generatorUtils.fs.existsSync(typePath)) {
|
|
281197
|
-
const npmrc = _generatorUtils.fs.readFileSync(typePath, 'utf-8');
|
|
281198
|
-
|
|
281199
|
-
if (!npmrc.includes(appendTypeContent)) {
|
|
281200
|
-
_generatorUtils.fs.writeFileSync(typePath, `${npmrc}${appendTypeContent}\n`, 'utf-8');
|
|
281201
|
-
}
|
|
281202
|
-
} else {
|
|
281203
|
-
_generatorUtils.fs.ensureFileSync(typePath);
|
|
281204
|
-
|
|
281205
|
-
_generatorUtils.fs.writeFileSync(typePath, appendTypeContent, 'utf-8');
|
|
281206
|
-
}
|
|
281207
|
-
}
|
|
281208
|
-
};
|
|
281209
|
-
|
|
281210
|
-
var _default = async (context, generator) => {
|
|
281211
|
-
const appApi = new _codesmithApiApp.AppAPI(context, generator);
|
|
281212
|
-
const {
|
|
281213
|
-
locale
|
|
281214
|
-
} = context.config;
|
|
281215
|
-
|
|
281216
|
-
_generatorCommon.i18n.changeLanguage({
|
|
281217
|
-
locale
|
|
281218
|
-
});
|
|
281219
|
-
|
|
281220
|
-
appApi.i18n.changeLanguage({
|
|
281221
|
-
locale
|
|
281222
|
-
});
|
|
281223
|
-
|
|
281224
|
-
if (!(await appApi.checkEnvironment())) {
|
|
281225
|
-
// eslint-disable-next-line no-process-exit
|
|
281226
|
-
process.exit(1);
|
|
281227
|
-
}
|
|
281228
|
-
|
|
281229
|
-
generator.logger.debug(`start run @modern-js/dependence-generator`);
|
|
281230
|
-
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
281231
|
-
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
281232
|
-
await handleTemplateFile(context, generator);
|
|
281233
|
-
|
|
281234
|
-
if (!context.config.isSubGenerator) {
|
|
281235
|
-
await appApi.runInstall();
|
|
281236
|
-
appApi.showSuccessInfo();
|
|
281237
|
-
}
|
|
281238
|
-
|
|
281239
|
-
generator.logger.debug(`forge @modern-js/dependence-generator succeed `);
|
|
281240
|
-
};
|
|
281241
|
-
|
|
281242
|
-
exports["default"] = _default;
|
|
281243
|
-
})();
|
|
281244
|
-
|
|
281245
|
-
module.exports = __webpack_exports__;
|
|
281275
|
+
/******/
|
|
281276
|
+
/******/ // module cache are used so entry inlining is disabled
|
|
281277
|
+
/******/ // startup
|
|
281278
|
+
/******/ // Load entry module and return exports
|
|
281279
|
+
/******/ var __webpack_exports__ = __webpack_require__(34701);
|
|
281280
|
+
/******/ module.exports = __webpack_exports__;
|
|
281281
|
+
/******/
|
|
281246
281282
|
/******/ })()
|
|
281247
281283
|
;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.2.
|
|
14
|
+
"version": "1.2.2",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"main": "./dist/js/node/main.js",
|
|
17
17
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@modern-js/codesmith-api-app": "^1.0.7",
|
|
25
25
|
"@modern-js/codesmith-api-json": "^1.0.7",
|
|
26
26
|
"@modern-js/codesmith-tools": "^1.0.9",
|
|
27
|
-
"@modern-js/generator-common": "^1.
|
|
27
|
+
"@modern-js/generator-common": "^1.4.0",
|
|
28
28
|
"@modern-js/generator-utils": "^1.2.1",
|
|
29
29
|
"@types/jest": "^26",
|
|
30
30
|
"@types/lodash": "^4.14.168",
|