@hile/cli 1.0.20 → 1.0.21

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/dist/index.js +3 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { glob } from 'glob';
6
6
  import { resolve } from 'node:path';
7
7
  import { container, isService, loadService } from '@hile/core';
8
8
  import { createRequire } from 'node:module';
9
+ import { pathToFileURL } from 'node:url';
9
10
  const require = createRequire(import.meta.url);
10
11
  /** 加载 env 文件到 process.env(Node 20.12+ 原生 process.loadEnvFile) */
11
12
  function loadEnvFile(filePath) {
@@ -112,7 +113,8 @@ program
112
113
  // 加载所有自启动服务
113
114
  // file: 文件路径或者模块名称
114
115
  await Promise.all(files.map(async (file) => {
115
- const target = await import(file);
116
+ const _file = pathToFileURL(file).href;
117
+ const target = await import(_file);
116
118
  const fn = target?.default ?? target;
117
119
  if (!fn || !isService(fn))
118
120
  throw new Error(`invalid service file: ${file}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/cli",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -25,11 +25,11 @@
25
25
  "vitest": "^4.0.18"
26
26
  },
27
27
  "dependencies": {
28
- "@hile/core": "^1.0.21",
28
+ "@hile/core": "^1.0.22",
29
29
  "async-exit-hook": "^2.0.1",
30
30
  "commander": "^14.0.3",
31
31
  "glob": "^13.0.6",
32
32
  "tsx": "^4.21.0"
33
33
  },
34
- "gitHead": "a913724465de986a7891746ced001ff6dcd3ff88"
34
+ "gitHead": "ffc0bf9ab4d0e251244c174536bac79c1f2f77fe"
35
35
  }