chanjs 1.1.2 → 1.1.3

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.
Files changed (2) hide show
  1. package/core/config.js +4 -5
  2. package/package.json +11 -11
package/core/config.js CHANGED
@@ -2,18 +2,17 @@ import path from 'path';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
4
 
5
+ const require = createRequire(import.meta.url);
6
+
5
7
  /**
6
8
  * @description 根目录(ESM 兼容写法)
7
9
  */
8
10
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
9
- console.log(__dirname)
10
11
  const ROOT_PATH = process.cwd();
11
12
 
12
- // 异步读取 package.json(ESM 标准方式)
13
- const packageUrl = pathToFileURL(path.join(ROOT_PATH, 'package.json')).href;
14
- const { default: pkg } = await import(packageUrl,{ assert: { type: 'json' } });
13
+ // 使用 require 读取 package.json(更简单可靠)
14
+ const pkg = require(path.join(ROOT_PATH, 'package.json'));
15
15
  const { version = '1.0.0', author = '明空' } = pkg;
16
-
17
16
  /**
18
17
  * @description 程序目录
19
18
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "chanjs",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "description": "chanjs基于express5 纯js研发的轻量级mvc框架。",
6
6
  "main": "index.js",
7
7
  "module": "index.js",
@@ -17,15 +17,15 @@
17
17
  "author": "明空",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "art-template": "4.13.4",
21
- "body-parser": "2.2.0",
22
- "cookie-parser": "1.4.7",
23
- "cors": "2.8.5",
24
- "express": "5.1.0",
25
- "express-art-template": "1.0.1",
26
- "knex": "3.1.0",
27
- "morgan": "1.10.0",
28
- "mysql2": "3.14.0",
29
- "dayjs": "1.11.13"
20
+ "art-template": "^4.13.4",
21
+ "body-parser": "^2.2.0",
22
+ "cookie-parser": "^1.4.7",
23
+ "cors": "^2.8.5",
24
+ "express": "^5.1.0",
25
+ "express-art-template": "^1.0.1",
26
+ "knex": "^3.1.0",
27
+ "morgan": "^1.10.0",
28
+ "mysql2": "^3.14.1",
29
+ "dayjs": "^1.11.13"
30
30
  }
31
31
  }