@modern-js/utils 2.2.0 → 2.4.0
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 +28 -0
- package/README.md +14 -18
- package/compiled/ajv/types/vocabularies/errors.d.ts +1 -0
- package/compiled/ajv/{uri-js/dist/es5/uri.all.d.ts → uri-js.d.ts} +0 -0
- package/dist/commands.d.ts +2 -0
- package/dist/commands.js +14 -0
- package/dist/compatRequire.d.ts +1 -0
- package/dist/compatRequire.js +10 -1
- package/dist/constants.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/is/node-env.d.ts +4 -0
- package/dist/is/node-env.js +9 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,33 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 2.4.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 98a2733: fix(tailwind): fix webpack cache not work when using twin.macro
|
8
|
+
|
9
|
+
fix(tailwind): 修复使用 twin.macro 时 webpack 缓存不生效的问题
|
10
|
+
|
11
|
+
- 8c2db5f: feat(core): improve support for exporting a function in config file
|
12
|
+
|
13
|
+
feat(core): 完善对配置文件中导出函数的支持
|
14
|
+
|
15
|
+
## 2.3.0
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- fd5a3ed: fix: failed to exit new command
|
20
|
+
|
21
|
+
fix: 修复 new 命令执行完成后未退出进程的问题
|
22
|
+
|
23
|
+
- 6ca1c0b: fix: .ejs is not a valid config file extension
|
24
|
+
|
25
|
+
fix: 修复配置文件使用 .ejs 作为后缀的问题
|
26
|
+
|
27
|
+
- 89b6739: fix(utils): fix pre-bundled ajv types
|
28
|
+
|
29
|
+
fix(utils): 修复预打包后的 ajv 中的类型问题
|
30
|
+
|
3
31
|
## 2.2.0
|
4
32
|
|
5
33
|
### Patch Changes
|
package/README.md
CHANGED
@@ -1,30 +1,26 @@
|
|
1
|
-
|
2
1
|
<p align="center">
|
3
2
|
<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>
|
4
3
|
</p>
|
4
|
+
|
5
|
+
<h1 align="center">Modern.js</h1>
|
6
|
+
|
5
7
|
<p align="center">
|
6
|
-
|
7
|
-
<br/>
|
8
|
-
<a href="https://modernjs.dev" target="blank">
|
9
|
-
modernjs.dev
|
10
|
-
</a>
|
11
|
-
</p>
|
12
|
-
<p align="center">
|
13
|
-
The meta-framework suite designed from scratch for frontend-focused modern web development
|
8
|
+
A Progressive React Framework for modern web development.
|
14
9
|
</p>
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
> 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.
|
11
|
+
## Getting Started
|
19
12
|
|
20
|
-
|
13
|
+
Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
|
21
14
|
|
22
|
-
##
|
15
|
+
## Documentation
|
23
16
|
|
24
|
-
- [
|
25
|
-
- [
|
26
|
-
- [API References](https://modernjs.dev/docs/apis)
|
17
|
+
- [English Documentation](https://modernjs.dev/en/)
|
18
|
+
- [中文文档](https://modernjs.dev)
|
27
19
|
|
28
20
|
## Contributing
|
29
21
|
|
30
|
-
|
22
|
+
Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
|
23
|
+
|
24
|
+
## License
|
25
|
+
|
26
|
+
Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
|
@@ -0,0 +1 @@
|
|
1
|
+
export type DefinedError = any;
|
File without changes
|
package/dist/commands.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isDevCommand = exports.getCommand = void 0;
|
4
|
+
const getCommand = () => {
|
5
|
+
const args = process.argv.slice(2);
|
6
|
+
const command = args[0];
|
7
|
+
return command;
|
8
|
+
};
|
9
|
+
exports.getCommand = getCommand;
|
10
|
+
const isDevCommand = () => {
|
11
|
+
const command = (0, exports.getCommand)();
|
12
|
+
return command === 'dev' || command === 'start';
|
13
|
+
};
|
14
|
+
exports.isDevCommand = isDevCommand;
|
package/dist/compatRequire.d.ts
CHANGED
package/dist/compatRequire.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.cleanRequireCache = exports.requireExistModule = exports.dynamicImport = exports.compatRequire = void 0;
|
3
|
+
exports.deleteRequireCache = exports.cleanRequireCache = exports.requireExistModule = exports.dynamicImport = exports.compatRequire = void 0;
|
4
4
|
const findExists_1 = require("./findExists");
|
5
5
|
/**
|
6
6
|
* Require function compatible with esm and cjs module.
|
@@ -35,3 +35,12 @@ const cleanRequireCache = (filelist) => {
|
|
35
35
|
});
|
36
36
|
};
|
37
37
|
exports.cleanRequireCache = cleanRequireCache;
|
38
|
+
function deleteRequireCache(path) {
|
39
|
+
if (require.cache[path]) {
|
40
|
+
delete require.cache[path];
|
41
|
+
}
|
42
|
+
if (module.children) {
|
43
|
+
module.children = module.children.filter(item => item.filename !== path);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
exports.deleteRequireCache = deleteRequireCache;
|
package/dist/constants.js
CHANGED
@@ -43,7 +43,7 @@ exports.SHARED_DIR = 'shared';
|
|
43
43
|
* Modern.config.ts cached dir
|
44
44
|
*/
|
45
45
|
exports.CONFIG_CACHE_DIR = './node_modules/.cache/node-bundle-require';
|
46
|
-
exports.CONFIG_FILE_EXTENSIONS = ['.js', '.ts', '.
|
46
|
+
exports.CONFIG_FILE_EXTENSIONS = ['.js', '.ts', '.mjs'];
|
47
47
|
/**
|
48
48
|
* Serialized config path
|
49
49
|
*/
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./compiled"), exports);
|
18
|
+
__exportStar(require("./commands"), exports);
|
18
19
|
__exportStar(require("./format"), exports);
|
19
20
|
__exportStar(require("./FileSizeReporter"), exports);
|
20
21
|
__exportStar(require("./printBuildError"), exports);
|
package/dist/is/node-env.d.ts
CHANGED
package/dist/is/node-env.js
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = void 0;
|
4
|
-
|
3
|
+
exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = exports.getNodeEnv = void 0;
|
4
|
+
/**
|
5
|
+
* Get the current NODE_ENV, or default to 'development' if not set.
|
6
|
+
*/
|
7
|
+
const getNodeEnv = () => process.env.NODE_ENV || 'development';
|
8
|
+
exports.getNodeEnv = getNodeEnv;
|
9
|
+
const isDev = () => (0, exports.getNodeEnv)() === 'development';
|
5
10
|
exports.isDev = isDev;
|
6
|
-
const isProd = () =>
|
11
|
+
const isProd = () => (0, exports.getNodeEnv)() === 'production';
|
7
12
|
exports.isProd = isProd;
|
8
|
-
const isTest = () =>
|
13
|
+
const isTest = () => (0, exports.getNodeEnv)() === 'test';
|
9
14
|
exports.isTest = isTest;
|
10
15
|
// Variable used for enabling profiling in Production.
|
11
16
|
const isProdProfile = () => (0, exports.isProd)() && process.argv.includes('--profile');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@modern-js/utils",
|
3
|
-
"description": "
|
3
|
+
"description": "A Progressive React Framework for modern web development.",
|
4
4
|
"homepage": "https://modernjs.dev",
|
5
5
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
6
6
|
"repository": "modern-js-dev/modern.js",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.4.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
@@ -134,9 +134,9 @@
|
|
134
134
|
"jest": "^27",
|
135
135
|
"typescript": "^4",
|
136
136
|
"webpack": "^5.75.0",
|
137
|
-
"@modern-js/types": "2.
|
138
|
-
"@scripts/jest-config": "2.
|
139
|
-
"@scripts/build": "2.
|
137
|
+
"@modern-js/types": "2.4.0",
|
138
|
+
"@scripts/jest-config": "2.4.0",
|
139
|
+
"@scripts/build": "2.4.0"
|
140
140
|
},
|
141
141
|
"sideEffects": false,
|
142
142
|
"scripts": {
|