@modern-js/utils 1.1.6-rc.0 → 1.2.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/CHANGELOG.md +18 -1
- package/dist/js/modern/constants.js +2 -1
- package/dist/js/modern/getBrowserslist.js +1 -1
- package/dist/js/modern/prettyInstructions.js +1 -1
- package/dist/js/node/constants.js +2 -1
- package/dist/js/node/getBrowserslist.js +2 -2
- package/dist/js/node/prettyInstructions.js +1 -1
- package/dist/js/treeshaking/constants.js +2 -1
- package/dist/js/treeshaking/getBrowserslist.js +1 -1
- package/dist/js/treeshaking/prettyInstructions.js +1 -1
- package/dist/types/getBrowserslist.d.ts +1 -1
- package/jest.config.js +8 -0
- package/package.json +18 -12
- package/src/constants.ts +5 -2
- package/src/getBrowserslist.ts +1 -1
- package/src/prettyInstructions.ts +1 -1
- package/tests/applyOptionsChain.test.ts +1 -1
- package/tests/compatRequire.test.ts +1 -1
- package/tests/debug.test.ts +4 -2
- package/tests/ensureAbsolutePath.test.ts +1 -1
- package/tests/findExists.test.ts +1 -1
- 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/removeSlash.test.ts +1 -1
- package/tests/tsconfig.json +1 -3
- package/tsconfig.json +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# @modern-js/utils
|
|
2
2
|
|
|
3
|
-
## 1.1
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 823809c6: fix: remove plugin-polyfill from app-tools
|
|
8
|
+
|
|
9
|
+
## 1.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- cfe11628: Make Modern.js self bootstraping
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 2da09c69: Add "typescript" to the dependency list
|
|
18
|
+
- c3d46ee4: fix: test config invalid
|
|
19
|
+
|
|
20
|
+
## 1.1.6
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
6
23
|
|
|
@@ -158,6 +158,7 @@ export const INTERNAL_PLUGINS = {
|
|
|
158
158
|
cli: '@modern-js/plugin-static-hosting/cli'
|
|
159
159
|
},
|
|
160
160
|
'@modern-js/plugin-polyfill': {
|
|
161
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
|
161
162
|
server: '@modern-js/plugin-polyfill'
|
|
162
163
|
},
|
|
163
164
|
'@modern-js/plugin-multiprocess': {
|
|
@@ -297,7 +298,7 @@ export const PLUGIN_SCHEMAS = {
|
|
|
297
298
|
}, {
|
|
298
299
|
target: 'tools.jest',
|
|
299
300
|
schema: {
|
|
300
|
-
typeof: ['object']
|
|
301
|
+
typeof: ['object', 'function']
|
|
301
302
|
}
|
|
302
303
|
}],
|
|
303
304
|
'@modern-js/plugin-micro-frontend': [{
|
|
@@ -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
|
}
|
|
@@ -179,6 +179,7 @@ const INTERNAL_PLUGINS = {
|
|
|
179
179
|
cli: '@modern-js/plugin-static-hosting/cli'
|
|
180
180
|
},
|
|
181
181
|
'@modern-js/plugin-polyfill': {
|
|
182
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
|
182
183
|
server: '@modern-js/plugin-polyfill'
|
|
183
184
|
},
|
|
184
185
|
'@modern-js/plugin-multiprocess': {
|
|
@@ -319,7 +320,7 @@ const PLUGIN_SCHEMAS = {
|
|
|
319
320
|
}, {
|
|
320
321
|
target: 'tools.jest',
|
|
321
322
|
schema: {
|
|
322
|
-
typeof: ['object']
|
|
323
|
+
typeof: ['object', 'function']
|
|
323
324
|
}
|
|
324
325
|
}],
|
|
325
326
|
'@modern-js/plugin-micro-frontend': [{
|
|
@@ -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
|
|
|
@@ -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
|
}
|
|
@@ -160,6 +160,7 @@ export var INTERNAL_PLUGINS = {
|
|
|
160
160
|
cli: '@modern-js/plugin-static-hosting/cli'
|
|
161
161
|
},
|
|
162
162
|
'@modern-js/plugin-polyfill': {
|
|
163
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
|
163
164
|
server: '@modern-js/plugin-polyfill'
|
|
164
165
|
},
|
|
165
166
|
'@modern-js/plugin-multiprocess': {
|
|
@@ -297,7 +298,7 @@ export var PLUGIN_SCHEMAS = {
|
|
|
297
298
|
}, {
|
|
298
299
|
target: 'tools.jest',
|
|
299
300
|
schema: {
|
|
300
|
-
"typeof": ['object']
|
|
301
|
+
"typeof": ['object', 'function']
|
|
301
302
|
}
|
|
302
303
|
}],
|
|
303
304
|
'@modern-js/plugin-micro-frontend': [{
|
|
@@ -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
|
}
|
|
@@ -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/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.1
|
|
14
|
+
"version": "1.2.1",
|
|
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
|
"*": {
|
|
@@ -55,7 +62,8 @@
|
|
|
55
62
|
"strip-ansi": "6.0.0",
|
|
56
63
|
"upath": "^2.0.1",
|
|
57
64
|
"yaml": "^1.10.2",
|
|
58
|
-
"execa": "5"
|
|
65
|
+
"execa": "5",
|
|
66
|
+
"typescript": "^4"
|
|
59
67
|
},
|
|
60
68
|
"devDependencies": {
|
|
61
69
|
"@types/debug": "^4.1.7",
|
|
@@ -64,23 +72,21 @@
|
|
|
64
72
|
"@types/jest": "^26",
|
|
65
73
|
"@types/node": "^14",
|
|
66
74
|
"@types/recursive-readdir": "^2.2.0",
|
|
67
|
-
"typescript": "^4",
|
|
68
75
|
"webpack": "^5.54.0",
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
"peerDependencies": {
|
|
73
|
-
"typescript": "^4.4.3"
|
|
76
|
+
"@scripts/build": "0.0.0",
|
|
77
|
+
"jest": "^27",
|
|
78
|
+
"@scripts/jest-config": "0.0.0"
|
|
74
79
|
},
|
|
75
80
|
"sideEffects": false,
|
|
76
81
|
"publishConfig": {
|
|
77
82
|
"registry": "https://registry.npmjs.org/",
|
|
78
|
-
"access": "public"
|
|
83
|
+
"access": "public",
|
|
84
|
+
"types": "./dist/types/index.d.ts"
|
|
79
85
|
},
|
|
80
86
|
"scripts": {
|
|
81
87
|
"new": "modern new",
|
|
82
88
|
"build": "modern build",
|
|
83
|
-
"test": "
|
|
89
|
+
"test": "jest --passWithNoTests"
|
|
84
90
|
},
|
|
85
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"
|
|
86
92
|
}
|
package/src/constants.ts
CHANGED
|
@@ -119,7 +119,10 @@ export const INTERNAL_PLUGINS: {
|
|
|
119
119
|
'@modern-js/plugin-static-hosting': {
|
|
120
120
|
cli: '@modern-js/plugin-static-hosting/cli',
|
|
121
121
|
},
|
|
122
|
-
'@modern-js/plugin-polyfill': {
|
|
122
|
+
'@modern-js/plugin-polyfill': {
|
|
123
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
|
124
|
+
server: '@modern-js/plugin-polyfill',
|
|
125
|
+
},
|
|
123
126
|
'@modern-js/plugin-multiprocess': {
|
|
124
127
|
cli: '@modern-js/plugin-multiprocess/cli',
|
|
125
128
|
},
|
|
@@ -245,7 +248,7 @@ export const PLUGIN_SCHEMAS = {
|
|
|
245
248
|
},
|
|
246
249
|
{
|
|
247
250
|
target: 'tools.jest',
|
|
248
|
-
schema: { typeof: ['object'] },
|
|
251
|
+
schema: { typeof: ['object', 'function'] },
|
|
249
252
|
},
|
|
250
253
|
],
|
|
251
254
|
'@modern-js/plugin-micro-frontend': [
|
package/src/getBrowserslist.ts
CHANGED
|
@@ -34,7 +34,7 @@ const getAddressUrls = (protocol = 'http', port: number) => {
|
|
|
34
34
|
(memo: { type: string; url: string }[], detail) => {
|
|
35
35
|
let type = 'Network: ';
|
|
36
36
|
let url = `${protocol}://${detail.address}:${port}`;
|
|
37
|
-
if (detail.address.includes(`
|
|
37
|
+
if (detail.address.includes(`localhost`)) {
|
|
38
38
|
type = 'Local: ';
|
|
39
39
|
url = `${protocol}://localhost:${port}`;
|
|
40
40
|
}
|
package/tests/debug.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import debug from 'debug';
|
|
2
|
-
import
|
|
2
|
+
import stripAnsi from 'strip-ansi';
|
|
3
|
+
import { createDebugger } from '../src/debug';
|
|
3
4
|
|
|
4
5
|
describe('debug utility', () => {
|
|
5
6
|
test('should return file path', () => {
|
|
@@ -10,7 +11,8 @@ describe('debug utility', () => {
|
|
|
10
11
|
debug.enable('modern-js:test2');
|
|
11
12
|
|
|
12
13
|
debug.log = (...args) => {
|
|
13
|
-
|
|
14
|
+
// XXX: args[0] 的内容有时候是 ' \x1B[38;5;167;1mmodern-js:test2 \x1B[0m22222' 这种格式
|
|
15
|
+
expect(stripAnsi(args[0])).toContain('modern-js:test2 22222');
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
debug1('11111');
|
package/tests/findExists.test.ts
CHANGED
package/tests/index.test.ts
CHANGED
package/tests/logger.test.ts
CHANGED
package/tests/tsconfig.json
CHANGED