@modern-js/utils 2.3.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 CHANGED
@@ -1,5 +1,17 @@
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
+
3
15
  ## 2.3.0
4
16
 
5
17
  ### 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
- 现代 Web 工程体系
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
- # Introduction
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
- - [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
13
+ Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
21
14
 
22
- ## Getting Started
15
+ ## Documentation
23
16
 
24
- - [Quick Start](https://modernjs.dev/docs/start)
25
- - [Guides](https://modernjs.dev/docs/guides)
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
- - [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)
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).
@@ -10,3 +10,4 @@ export declare const requireExistModule: (filename: string, opt?: {
10
10
  interop?: boolean;
11
11
  }) => any;
12
12
  export declare const cleanRequireCache: (filelist: string[]) => void;
13
+ export declare function deleteRequireCache(path: string): void;
@@ -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;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Get the current NODE_ENV, or default to 'development' if not set.
3
+ */
4
+ export declare const getNodeEnv: () => string;
1
5
  export declare const isDev: () => boolean;
2
6
  export declare const isProd: () => boolean;
3
7
  export declare const isTest: () => boolean;
@@ -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
- const isDev = () => process.env.NODE_ENV === 'development';
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 = () => process.env.NODE_ENV === 'production';
11
+ const isProd = () => (0, exports.getNodeEnv)() === 'production';
7
12
  exports.isProd = isProd;
8
- const isTest = () => process.env.NODE_ENV === 'test';
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": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
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.3.0",
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.3.0",
138
- "@scripts/build": "2.3.0",
139
- "@scripts/jest-config": "2.3.0"
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": {