@modern-js/utils 1.1.7-alpha.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +40 -0
- package/dist/js/modern/clearConsole.js +1 -1
- package/dist/js/modern/compatRequire.js +5 -0
- package/dist/js/modern/constants.js +5 -19
- package/dist/js/modern/getBrowserslist.js +1 -1
- package/dist/js/modern/index.js +2 -1
- package/dist/js/modern/prettyInstructions.js +5 -4
- package/dist/js/modern/wait.js +5 -0
- package/dist/js/node/clearConsole.js +1 -1
- package/dist/js/node/compatRequire.js +10 -2
- package/dist/js/node/constants.js +7 -24
- package/dist/js/node/getBrowserslist.js +2 -2
- package/dist/js/node/index.js +14 -0
- package/dist/js/node/prettyInstructions.js +5 -4
- package/dist/js/node/wait.js +12 -0
- package/dist/js/treeshaking/clearConsole.js +1 -1
- package/dist/js/treeshaking/compatRequire.js +5 -0
- package/dist/js/treeshaking/constants.js +5 -19
- package/dist/js/treeshaking/getBrowserslist.js +1 -1
- package/dist/js/treeshaking/index.js +2 -1
- package/dist/js/treeshaking/prettyInstructions.js +6 -5
- package/dist/js/treeshaking/wait.js +8 -0
- package/dist/types/compatRequire.d.ts +2 -1
- package/dist/types/constants.d.ts +1 -16
- package/dist/types/getBrowserslist.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/wait.d.ts +2 -0
- package/jest.config.js +8 -0
- package/package.json +20 -11
- package/tests/__snapshots__/prettyInstructions.test.ts.snap +19 -0
- package/tests/applyOptionsChain.test.ts +1 -1
- package/tests/compatRequire.test.ts +11 -1
- package/tests/debug.test.ts +4 -2
- package/tests/ensureAbsolutePath.test.ts +1 -1
- package/tests/findExists.test.ts +1 -1
- package/tests/fixtures/compat-require/foo.js +3 -0
- package/tests/getBrowserslist.test.ts +1 -1
- package/tests/getCacheIdentifier.test.ts +1 -1
- package/tests/getEntryOptions.test.ts +1 -1
- package/tests/index.test.ts +1 -1
- package/tests/logger.test.ts +1 -1
- package/tests/prettyInstructions.test.ts +139 -0
- package/tests/removeSlash.test.ts +1 -1
- package/tests/tsconfig.json +1 -3
- package/tests/wait.ts +38 -0
- package/tsconfig.json +1 -3
- package/src/FileSizeReporter.ts +0 -181
- package/src/alias.ts +0 -90
- package/src/applyOptionsChain.ts +0 -44
- package/src/chalk.ts +0 -3
- package/src/clearConsole.ts +0 -5
- package/src/compatRequire.ts +0 -25
- package/src/constants.ts +0 -262
- package/src/debug.ts +0 -8
- package/src/ensureAbsolutePath.ts +0 -10
- package/src/findExists.ts +0 -15
- package/src/formatWebpackMessages.ts +0 -131
- package/src/generateMetaTags.ts +0 -75
- package/src/getBrowserslist.ts +0 -6
- package/src/getCacheIdentifier.ts +0 -30
- package/src/getEntryOptions.ts +0 -37
- package/src/getPackageManager.ts +0 -30
- package/src/getPort.ts +0 -62
- package/src/import.ts +0 -10
- package/src/index.ts +0 -31
- package/src/is/index.ts +0 -78
- package/src/is/node-env.ts +0 -9
- package/src/is/platform.ts +0 -7
- package/src/is/type.ts +0 -43
- package/src/logger.ts +0 -184
- package/src/monorepo.ts +0 -106
- package/src/nodeEnv.ts +0 -28
- package/src/path.ts +0 -9
- package/src/pkgUp.ts +0 -3
- package/src/prettyInstructions.ts +0 -88
- package/src/printBuildError.ts +0 -47
- package/src/readTsConfig.ts +0 -21
- package/src/removeSlash.ts +0 -6
- package/src/runtimeExports.ts +0 -68
- package/src/types.d.ts +0 -1
- package/src/watch.ts +0 -56
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,45 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 1.3.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- ec4dbffb: feat: support as a pure api service
|
8
|
+
- bada2879: refactor plugin-garfish:
|
9
|
+
- change @modern-js/plugin-micro-frontend => @modern-js/plugin-garfish
|
10
|
+
- remove disableCustomerRouter logic
|
11
|
+
- adding unit test
|
12
|
+
- fix plugin-garfish type error
|
13
|
+
|
14
|
+
### Patch Changes
|
15
|
+
|
16
|
+
- d099e5c5: fix error when modify modern.config.js
|
17
|
+
- 24f616ca: feat: support custom meta info
|
18
|
+
- bd819a8d: feat: add wait function
|
19
|
+
|
20
|
+
## 1.2.2
|
21
|
+
|
22
|
+
### Patch Changes
|
23
|
+
|
24
|
+
- 83166714: change .npmignore
|
25
|
+
|
26
|
+
## 1.2.1
|
27
|
+
|
28
|
+
### Patch Changes
|
29
|
+
|
30
|
+
- 823809c6: fix: remove plugin-polyfill from app-tools
|
31
|
+
|
32
|
+
## 1.2.0
|
33
|
+
|
34
|
+
### Minor Changes
|
35
|
+
|
36
|
+
- cfe11628: Make Modern.js self bootstraping
|
37
|
+
|
38
|
+
### Patch Changes
|
39
|
+
|
40
|
+
- 2da09c69: Add "typescript" to the dependency list
|
41
|
+
- c3d46ee4: fix: test config invalid
|
42
|
+
|
3
43
|
## 1.1.6
|
4
44
|
|
5
45
|
### Patch Changes
|
@@ -1,16 +1,6 @@
|
|
1
|
-
/**
|
2
|
-
* alias to src directory
|
3
|
-
*/
|
4
|
-
export const INTERNAL_SRC_ALIAS = '@_modern_js_src';
|
5
|
-
/**
|
6
|
-
* alias to node_modules/.modern-js
|
7
|
-
*/
|
8
|
-
|
9
|
-
export const INTERNAL_DIR_ALAIS = '@_modern_js_internal';
|
10
1
|
/**
|
11
2
|
* hmr socket connect path
|
12
3
|
*/
|
13
|
-
|
14
4
|
export const HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
15
5
|
/**
|
16
6
|
* route specification file
|
@@ -47,11 +37,6 @@ export const SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
47
37
|
*/
|
48
38
|
|
49
39
|
export const LOADABLE_STATS_FILE = 'loadable-stats.json';
|
50
|
-
/**
|
51
|
-
* real entry generate by modern.js
|
52
|
-
*/
|
53
|
-
|
54
|
-
export const HIDE_MODERN_JS_DIR = './node_modules/.modern-js';
|
55
40
|
/**
|
56
41
|
* internal specified folder
|
57
42
|
*/
|
@@ -133,8 +118,8 @@ export const INTERNAL_PLUGINS = {
|
|
133
118
|
cli: '@modern-js/plugin-server/cli',
|
134
119
|
server: '@modern-js/plugin-server/server'
|
135
120
|
},
|
136
|
-
'@modern-js/plugin-
|
137
|
-
cli: '@modern-js/plugin-
|
121
|
+
'@modern-js/plugin-garfish': {
|
122
|
+
cli: '@modern-js/plugin-garfish/cli'
|
138
123
|
},
|
139
124
|
'@modern-js/plugin-jarvis': {
|
140
125
|
cli: '@modern-js/plugin-jarvis/cli'
|
@@ -158,6 +143,7 @@ export const INTERNAL_PLUGINS = {
|
|
158
143
|
cli: '@modern-js/plugin-static-hosting/cli'
|
159
144
|
},
|
160
145
|
'@modern-js/plugin-polyfill': {
|
146
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
161
147
|
server: '@modern-js/plugin-polyfill'
|
162
148
|
},
|
163
149
|
'@modern-js/plugin-multiprocess': {
|
@@ -297,10 +283,10 @@ export const PLUGIN_SCHEMAS = {
|
|
297
283
|
}, {
|
298
284
|
target: 'tools.jest',
|
299
285
|
schema: {
|
300
|
-
typeof: ['object']
|
286
|
+
typeof: ['object', 'function']
|
301
287
|
}
|
302
288
|
}],
|
303
|
-
'@modern-js/plugin-
|
289
|
+
'@modern-js/plugin-garfish': [{
|
304
290
|
target: 'runtime.masterApp',
|
305
291
|
schema: {
|
306
292
|
type: ['object']
|
package/dist/js/modern/index.js
CHANGED
@@ -21,7 +21,7 @@ const getAddressUrls = (protocol = 'http', port) => {
|
|
21
21
|
let type = 'Network: ';
|
22
22
|
let url = `${protocol}://${detail.address}:${port}`;
|
23
23
|
|
24
|
-
if (detail.address.includes(`
|
24
|
+
if (detail.address.includes(`localhost`)) {
|
25
25
|
type = 'Local: ';
|
26
26
|
url = `${protocol}://localhost:${port}`;
|
27
27
|
}
|
@@ -38,13 +38,14 @@ export const prettyInstructions = (appContext, config) => {
|
|
38
38
|
const {
|
39
39
|
entrypoints,
|
40
40
|
serverRoutes,
|
41
|
-
port
|
41
|
+
port,
|
42
|
+
existSrc
|
42
43
|
} = appContext;
|
43
44
|
const urls = getAddressUrls(config.dev.https && isDev() ? 'https' : 'http', port);
|
44
|
-
const routes = serverRoutes.filter(route => route.entryName);
|
45
|
+
const routes = existSrc ? serverRoutes.filter(route => route.entryName) : serverRoutes;
|
45
46
|
let message = 'App running at:\n\n';
|
46
47
|
|
47
|
-
if (isSingleEntry(entrypoints)) {
|
48
|
+
if (isSingleEntry(entrypoints) || !existSrc) {
|
48
49
|
message += urls.map(({
|
49
50
|
type,
|
50
51
|
url
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.requireExistModule = exports.compatRequire = void 0;
|
6
|
+
exports.requireExistModule = exports.compatRequire = exports.cleanRequireCache = void 0;
|
7
7
|
|
8
8
|
var _findExists = require("./findExists");
|
9
9
|
|
@@ -30,4 +30,12 @@ const requireExistModule = (filename, extensions = ['.ts', '.js']) => {
|
|
30
30
|
return compatRequire(exist);
|
31
31
|
};
|
32
32
|
|
33
|
-
exports.requireExistModule = requireExistModule;
|
33
|
+
exports.requireExistModule = requireExistModule;
|
34
|
+
|
35
|
+
const cleanRequireCache = filelist => {
|
36
|
+
filelist.forEach(filepath => {
|
37
|
+
delete require.cache[filepath];
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
exports.cleanRequireCache = cleanRequireCache;
|
@@ -3,23 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
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.
|
6
|
+
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;
|
7
7
|
|
8
|
-
/**
|
9
|
-
* alias to src directory
|
10
|
-
*/
|
11
|
-
const INTERNAL_SRC_ALIAS = '@_modern_js_src';
|
12
|
-
/**
|
13
|
-
* alias to node_modules/.modern-js
|
14
|
-
*/
|
15
|
-
|
16
|
-
exports.INTERNAL_SRC_ALIAS = INTERNAL_SRC_ALIAS;
|
17
|
-
const INTERNAL_DIR_ALAIS = '@_modern_js_internal';
|
18
8
|
/**
|
19
9
|
* hmr socket connect path
|
20
10
|
*/
|
21
|
-
|
22
|
-
exports.INTERNAL_DIR_ALAIS = INTERNAL_DIR_ALAIS;
|
23
11
|
const HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
24
12
|
/**
|
25
13
|
* route specification file
|
@@ -63,17 +51,11 @@ const SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
63
51
|
|
64
52
|
exports.SERVER_RENDER_FUNCTION_NAME = SERVER_RENDER_FUNCTION_NAME;
|
65
53
|
const LOADABLE_STATS_FILE = 'loadable-stats.json';
|
66
|
-
/**
|
67
|
-
* real entry generate by modern.js
|
68
|
-
*/
|
69
|
-
|
70
|
-
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
71
|
-
const HIDE_MODERN_JS_DIR = './node_modules/.modern-js';
|
72
54
|
/**
|
73
55
|
* internal specified folder
|
74
56
|
*/
|
75
57
|
|
76
|
-
exports.
|
58
|
+
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
77
59
|
const API_DIR = 'api';
|
78
60
|
exports.API_DIR = API_DIR;
|
79
61
|
const SERVER_DIR = 'server';
|
@@ -154,8 +136,8 @@ const INTERNAL_PLUGINS = {
|
|
154
136
|
cli: '@modern-js/plugin-server/cli',
|
155
137
|
server: '@modern-js/plugin-server/server'
|
156
138
|
},
|
157
|
-
'@modern-js/plugin-
|
158
|
-
cli: '@modern-js/plugin-
|
139
|
+
'@modern-js/plugin-garfish': {
|
140
|
+
cli: '@modern-js/plugin-garfish/cli'
|
159
141
|
},
|
160
142
|
'@modern-js/plugin-jarvis': {
|
161
143
|
cli: '@modern-js/plugin-jarvis/cli'
|
@@ -179,6 +161,7 @@ const INTERNAL_PLUGINS = {
|
|
179
161
|
cli: '@modern-js/plugin-static-hosting/cli'
|
180
162
|
},
|
181
163
|
'@modern-js/plugin-polyfill': {
|
164
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
182
165
|
server: '@modern-js/plugin-polyfill'
|
183
166
|
},
|
184
167
|
'@modern-js/plugin-multiprocess': {
|
@@ -319,10 +302,10 @@ const PLUGIN_SCHEMAS = {
|
|
319
302
|
}, {
|
320
303
|
target: 'tools.jest',
|
321
304
|
schema: {
|
322
|
-
typeof: ['object']
|
305
|
+
typeof: ['object', 'function']
|
323
306
|
}
|
324
307
|
}],
|
325
|
-
'@modern-js/plugin-
|
308
|
+
'@modern-js/plugin-garfish': [{
|
326
309
|
target: 'runtime.masterApp',
|
327
310
|
schema: {
|
328
311
|
type: ['object']
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getBrowserslist = exports.defaults = void 0;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _browserslist = require("browserslist");
|
9
9
|
|
10
10
|
const defaults = ['> 0.01%', 'not dead', 'not op_mini all'];
|
11
11
|
exports.defaults = defaults;
|
12
12
|
|
13
|
-
const getBrowserslist = appDirectory => (0,
|
13
|
+
const getBrowserslist = appDirectory => (0, _browserslist.loadConfig)({
|
14
14
|
path: appDirectory
|
15
15
|
}) || defaults;
|
16
16
|
|
package/dist/js/node/index.js
CHANGED
@@ -432,6 +432,20 @@ Object.keys(_nodeEnv).forEach(function (key) {
|
|
432
432
|
});
|
433
433
|
});
|
434
434
|
|
435
|
+
var _wait = require("./wait");
|
436
|
+
|
437
|
+
Object.keys(_wait).forEach(function (key) {
|
438
|
+
if (key === "default" || key === "__esModule") return;
|
439
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
440
|
+
if (key in exports && exports[key] === _wait[key]) return;
|
441
|
+
Object.defineProperty(exports, key, {
|
442
|
+
enumerable: true,
|
443
|
+
get: function () {
|
444
|
+
return _wait[key];
|
445
|
+
}
|
446
|
+
});
|
447
|
+
});
|
448
|
+
|
435
449
|
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); }
|
436
450
|
|
437
451
|
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; }
|
@@ -35,7 +35,7 @@ const getAddressUrls = (protocol = 'http', port) => {
|
|
35
35
|
let type = 'Network: ';
|
36
36
|
let url = `${protocol}://${detail.address}:${port}`;
|
37
37
|
|
38
|
-
if (detail.address.includes(`
|
38
|
+
if (detail.address.includes(`localhost`)) {
|
39
39
|
type = 'Local: ';
|
40
40
|
url = `${protocol}://localhost:${port}`;
|
41
41
|
}
|
@@ -52,13 +52,14 @@ const prettyInstructions = (appContext, config) => {
|
|
52
52
|
const {
|
53
53
|
entrypoints,
|
54
54
|
serverRoutes,
|
55
|
-
port
|
55
|
+
port,
|
56
|
+
existSrc
|
56
57
|
} = appContext;
|
57
58
|
const urls = getAddressUrls(config.dev.https && (0, _is.isDev)() ? 'https' : 'http', port);
|
58
|
-
const routes = serverRoutes.filter(route => route.entryName);
|
59
|
+
const routes = existSrc ? serverRoutes.filter(route => route.entryName) : serverRoutes;
|
59
60
|
let message = 'App running at:\n\n';
|
60
61
|
|
61
|
-
if (isSingleEntry(entrypoints)) {
|
62
|
+
if (isSingleEntry(entrypoints) || !existSrc) {
|
62
63
|
message += urls.map(({
|
63
64
|
type,
|
64
65
|
url
|
@@ -21,4 +21,9 @@ export var requireExistModule = function requireExistModule(filename) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
return compatRequire(exist);
|
24
|
+
};
|
25
|
+
export var cleanRequireCache = function cleanRequireCache(filelist) {
|
26
|
+
filelist.forEach(function (filepath) {
|
27
|
+
delete require.cache[filepath];
|
28
|
+
});
|
24
29
|
};
|
@@ -1,18 +1,8 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
/**
|
4
|
-
* alias to src directory
|
5
|
-
*/
|
6
|
-
export var INTERNAL_SRC_ALIAS = '@_modern_js_src';
|
7
|
-
/**
|
8
|
-
* alias to node_modules/.modern-js
|
9
|
-
*/
|
10
|
-
|
11
|
-
export var INTERNAL_DIR_ALAIS = '@_modern_js_internal';
|
12
3
|
/**
|
13
4
|
* hmr socket connect path
|
14
5
|
*/
|
15
|
-
|
16
6
|
export var HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
17
7
|
/**
|
18
8
|
* route specification file
|
@@ -49,11 +39,6 @@ export var SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
49
39
|
*/
|
50
40
|
|
51
41
|
export var LOADABLE_STATS_FILE = 'loadable-stats.json';
|
52
|
-
/**
|
53
|
-
* real entry generate by modern.js
|
54
|
-
*/
|
55
|
-
|
56
|
-
export var HIDE_MODERN_JS_DIR = './node_modules/.modern-js';
|
57
42
|
/**
|
58
43
|
* internal specified folder
|
59
44
|
*/
|
@@ -135,8 +120,8 @@ export var INTERNAL_PLUGINS = {
|
|
135
120
|
cli: '@modern-js/plugin-server/cli',
|
136
121
|
server: '@modern-js/plugin-server/server'
|
137
122
|
},
|
138
|
-
'@modern-js/plugin-
|
139
|
-
cli: '@modern-js/plugin-
|
123
|
+
'@modern-js/plugin-garfish': {
|
124
|
+
cli: '@modern-js/plugin-garfish/cli'
|
140
125
|
},
|
141
126
|
'@modern-js/plugin-jarvis': {
|
142
127
|
cli: '@modern-js/plugin-jarvis/cli'
|
@@ -160,6 +145,7 @@ export var INTERNAL_PLUGINS = {
|
|
160
145
|
cli: '@modern-js/plugin-static-hosting/cli'
|
161
146
|
},
|
162
147
|
'@modern-js/plugin-polyfill': {
|
148
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
163
149
|
server: '@modern-js/plugin-polyfill'
|
164
150
|
},
|
165
151
|
'@modern-js/plugin-multiprocess': {
|
@@ -297,10 +283,10 @@ export var PLUGIN_SCHEMAS = {
|
|
297
283
|
}, {
|
298
284
|
target: 'tools.jest',
|
299
285
|
schema: {
|
300
|
-
"typeof": ['object']
|
286
|
+
"typeof": ['object', 'function']
|
301
287
|
}
|
302
288
|
}],
|
303
|
-
'@modern-js/plugin-
|
289
|
+
'@modern-js/plugin-garfish': [{
|
304
290
|
target: 'runtime.masterApp',
|
305
291
|
schema: {
|
306
292
|
type: ['object']
|
@@ -39,7 +39,7 @@ var getAddressUrls = function getAddressUrls() {
|
|
39
39
|
var type = 'Network: ';
|
40
40
|
var url = "".concat(protocol, "://").concat(detail.address, ":").concat(port);
|
41
41
|
|
42
|
-
if (detail.address.includes("
|
42
|
+
if (detail.address.includes("localhost")) {
|
43
43
|
type = 'Local: ';
|
44
44
|
url = "".concat(protocol, "://localhost:").concat(port);
|
45
45
|
}
|
@@ -56,14 +56,15 @@ export var prettyInstructions = function prettyInstructions(appContext, config)
|
|
56
56
|
var _ref = appContext,
|
57
57
|
entrypoints = _ref.entrypoints,
|
58
58
|
serverRoutes = _ref.serverRoutes,
|
59
|
-
port = _ref.port
|
59
|
+
port = _ref.port,
|
60
|
+
existSrc = _ref.existSrc;
|
60
61
|
var urls = getAddressUrls(config.dev.https && isDev() ? 'https' : 'http', port);
|
61
|
-
var routes = serverRoutes.filter(function (route) {
|
62
|
+
var routes = existSrc ? serverRoutes.filter(function (route) {
|
62
63
|
return route.entryName;
|
63
|
-
});
|
64
|
+
}) : serverRoutes;
|
64
65
|
var message = 'App running at:\n\n';
|
65
66
|
|
66
|
-
if (isSingleEntry(entrypoints)) {
|
67
|
+
if (isSingleEntry(entrypoints) || !existSrc) {
|
67
68
|
message += urls.map(function (_ref2) {
|
68
69
|
var type = _ref2.type,
|
69
70
|
url = _ref2.url;
|
@@ -4,4 +4,5 @@
|
|
4
4
|
* @returns module export object.
|
5
5
|
*/
|
6
6
|
export declare const compatRequire: (filePath: string) => any;
|
7
|
-
export declare const requireExistModule: (filename: string, extensions?: string[]) => any;
|
7
|
+
export declare const requireExistModule: (filename: string, extensions?: string[]) => any;
|
8
|
+
export declare const cleanRequireCache: (filelist: string[]) => void;
|
@@ -1,16 +1,6 @@
|
|
1
|
-
/**
|
2
|
-
* alias to src directory
|
3
|
-
*/
|
4
|
-
export declare const INTERNAL_SRC_ALIAS = "@_modern_js_src";
|
5
|
-
/**
|
6
|
-
* alias to node_modules/.modern-js
|
7
|
-
*/
|
8
|
-
|
9
|
-
export declare const INTERNAL_DIR_ALAIS = "@_modern_js_internal";
|
10
1
|
/**
|
11
2
|
* hmr socket connect path
|
12
3
|
*/
|
13
|
-
|
14
4
|
export declare const HMR_SOCK_PATH = "/_modern_js_hmr_ws";
|
15
5
|
/**
|
16
6
|
* route specification file
|
@@ -47,11 +37,6 @@ export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
|
47
37
|
*/
|
48
38
|
|
49
39
|
export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
|
50
|
-
/**
|
51
|
-
* real entry generate by modern.js
|
52
|
-
*/
|
53
|
-
|
54
|
-
export declare const HIDE_MODERN_JS_DIR = "./node_modules/.modern-js";
|
55
40
|
/**
|
56
41
|
* internal specified folder
|
57
42
|
*/
|
@@ -188,7 +173,7 @@ export declare const PLUGIN_SCHEMAS: {
|
|
188
173
|
typeof: string[];
|
189
174
|
};
|
190
175
|
}[];
|
191
|
-
'@modern-js/plugin-
|
176
|
+
'@modern-js/plugin-garfish': {
|
192
177
|
target: string;
|
193
178
|
schema: {
|
194
179
|
type: string[];
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const defaults: string[];
|
2
|
-
export declare const getBrowserslist: (appDirectory: string) =>
|
2
|
+
export declare const getBrowserslist: (appDirectory: string) => string[];
|
package/dist/types/index.d.ts
CHANGED
package/jest.config.js
ADDED
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.
|
14
|
+
"version": "1.3.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -20,13 +20,20 @@
|
|
20
20
|
"exports": {
|
21
21
|
".": {
|
22
22
|
"node": {
|
23
|
+
"jsnext:source": "./src/index.ts",
|
23
24
|
"import": "./dist/js/modern/index.js",
|
24
25
|
"require": "./dist/js/node/index.js"
|
25
26
|
},
|
26
27
|
"default": "./dist/js/treeshaking/index.js"
|
27
28
|
},
|
28
|
-
"./formatWebpackMessages":
|
29
|
-
|
29
|
+
"./formatWebpackMessages": {
|
30
|
+
"jsnext:source": "./src/formatWebpackMessages.ts",
|
31
|
+
"default": "./dist/js/treeshaking/formatWebpackMessages.js"
|
32
|
+
},
|
33
|
+
"./constants": {
|
34
|
+
"jsnext:source": "./src/constants.ts",
|
35
|
+
"default": "./dist/js/treeshaking/constants.js"
|
36
|
+
}
|
30
37
|
},
|
31
38
|
"typesVersions": {
|
32
39
|
"*": {
|
@@ -40,7 +47,6 @@
|
|
40
47
|
},
|
41
48
|
"dependencies": {
|
42
49
|
"@babel/runtime": "^7",
|
43
|
-
"typescript": "^4.4.3",
|
44
50
|
"@types/fs-extra": "^9.0.12",
|
45
51
|
"browserslist": "^4.16.7",
|
46
52
|
"chalk": "^4.1.2",
|
@@ -56,7 +62,8 @@
|
|
56
62
|
"strip-ansi": "6.0.0",
|
57
63
|
"upath": "^2.0.1",
|
58
64
|
"yaml": "^1.10.2",
|
59
|
-
"execa": "5"
|
65
|
+
"execa": "5",
|
66
|
+
"typescript": "^4"
|
60
67
|
},
|
61
68
|
"devDependencies": {
|
62
69
|
"@types/debug": "^4.1.7",
|
@@ -65,19 +72,21 @@
|
|
65
72
|
"@types/jest": "^26",
|
66
73
|
"@types/node": "^14",
|
67
74
|
"@types/recursive-readdir": "^2.2.0",
|
68
|
-
"typescript": "^4",
|
69
75
|
"webpack": "^5.54.0",
|
70
|
-
"@
|
71
|
-
"
|
76
|
+
"@scripts/build": "0.0.0",
|
77
|
+
"jest": "^27",
|
78
|
+
"@scripts/jest-config": "0.0.0"
|
72
79
|
},
|
73
80
|
"sideEffects": false,
|
74
81
|
"publishConfig": {
|
75
82
|
"registry": "https://registry.npmjs.org/",
|
76
|
-
"access": "public"
|
83
|
+
"access": "public",
|
84
|
+
"types": "./dist/types/index.d.ts"
|
77
85
|
},
|
78
86
|
"scripts": {
|
79
87
|
"new": "modern new",
|
80
88
|
"build": "modern build",
|
81
|
-
"test": "
|
82
|
-
}
|
89
|
+
"test": "jest --passWithNoTests"
|
90
|
+
},
|
91
|
+
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
83
92
|
}
|