@modern-js/utils 1.1.7-alpha.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -0
- package/dist/js/modern/constants.js +1 -1
- package/dist/js/modern/getBrowserslist.js +1 -1
- package/dist/js/modern/prettyInstructions.js +1 -1
- package/dist/js/node/constants.js +1 -1
- package/dist/js/node/getBrowserslist.js +2 -2
- package/dist/js/node/prettyInstructions.js +1 -1
- package/dist/js/treeshaking/constants.js +1 -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 +20 -11
- package/src/constants.ts +1 -1
- 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,5 +1,16 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 1.2.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- cfe11628: Make Modern.js self bootstraping
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- 2da09c69: Add "typescript" to the dependency list
|
12
|
+
- c3d46ee4: fix: test config invalid
|
13
|
+
|
3
14
|
## 1.1.6
|
4
15
|
|
5
16
|
### Patch Changes
|
@@ -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
|
}
|
@@ -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
|
}
|
@@ -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.
|
14
|
+
"version": "1.2.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
|
}
|
package/src/constants.ts
CHANGED
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