@aomex/internal-file-import 3.30.6 → 3.30.8-alpha.62.sha-92b25bb

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
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.30.7](https://github.com/aomex/aomex/compare/v3.30.6...v3.30.7) (2026-11-01)
7
+
8
+ **Note:** Version bump only for package @aomex/internal-file-import
9
+
10
+
11
+
12
+
13
+
6
14
  ## [3.30.6](https://github.com/aomex/aomex/compare/v3.30.5...v3.30.6) (2026-10-19)
7
15
 
8
16
  **Note:** Version bump only for package @aomex/internal-file-import
package/dist/index.d.ts CHANGED
@@ -1,13 +1,9 @@
1
- interface GlobPathFullOptions {
2
- pattern: string[];
3
- ignore?: string[];
4
- dot?: boolean;
1
+ export interface GlobPathFullOptions {
2
+ pattern: string[];
3
+ ignore?: string[];
4
+ dot?: boolean;
5
5
  }
6
- type GlobPathOptions = string | string[] | GlobPathFullOptions | GlobPathFullOptions[];
7
- declare const normalizeGlobPath: (paths: GlobPathOptions) => GlobPathFullOptions[];
8
-
9
- declare const pathToFiles: (paths: GlobPathOptions) => Promise<string[]>;
10
-
11
- declare const getFileValues: <T extends unknown>(files: string[], filterValues?: (item?: unknown) => boolean) => Promise<T[]>;
12
-
13
- export { type GlobPathFullOptions, type GlobPathOptions, getFileValues, normalizeGlobPath, pathToFiles };
6
+ export type GlobPathOptions = string | string[] | GlobPathFullOptions | GlobPathFullOptions[];
7
+ export declare const normalizeGlobPath: (paths: GlobPathOptions) => GlobPathFullOptions[];
8
+ export declare const pathToFiles: (paths: GlobPathOptions) => Promise<string[]>;
9
+ export declare const getFileValues: <T extends unknown>(files: string[], filterValues?: (item?: unknown) => boolean) => Promise<T[]>;
package/dist/index.js CHANGED
@@ -1,78 +1,64 @@
1
- // src/path-to-file.ts
2
- import path from "path";
3
- import { stat } from "fs/promises";
1
+ import path from "node:path";
2
+ import { stat } from "node:fs/promises";
4
3
  import { glob, hasMagic } from "glob";
5
-
4
+ import { pathToFileURL } from "node:url";
6
5
  // src/normalize-glob-path.ts
7
- var normalizeGlobPath = (paths) => {
8
- if (typeof paths === "string") {
9
- return [{ pattern: [paths] }];
10
- }
11
- if (Array.isArray(paths)) {
12
- if (!paths.length) return [];
13
- return isStringArray(paths) ? [{ pattern: paths }] : paths;
14
- }
15
- return [paths];
6
+ const normalizeGlobPath = (paths) => {
7
+ if (typeof paths === "string") return [{ pattern: [paths] }];
8
+ if (Array.isArray(paths)) {
9
+ if (!paths.length) return [];
10
+ return isStringArray(paths) ? [{ pattern: paths }] : paths;
11
+ }
12
+ return [paths];
16
13
  };
17
- var isStringArray = (data) => {
18
- return typeof data[0] === "string";
14
+ const isStringArray = (data) => {
15
+ return typeof data[0] === "string";
19
16
  };
20
-
21
17
  // src/path-to-file.ts
22
- var pathToFiles = async (paths) => {
23
- const opts = normalizeGlobPath(paths);
24
- const files = await Promise.all(
25
- opts.map((opt) => {
26
- const { dot, pattern: patterns } = opt;
27
- const ignore = (opt.ignore || []).slice();
28
- ignore.push("**/node_modules/**/**", "**/*.d.{ts,mts}");
29
- const options = {
30
- nodir: true,
31
- dot,
32
- ignore,
33
- absolute: true,
34
- withFileTypes: false,
35
- maxDepth: Infinity
36
- };
37
- return Promise.all(
38
- patterns.map(async (pattern) => {
39
- if (!path.isAbsolute(pattern)) {
40
- pattern = path.resolve(pattern);
41
- }
42
- pattern = pattern.replace(/\\/g, path.posix.sep);
43
- if (!hasMagic(pattern, { magicalBraces: true })) {
44
- const stats = await stat(pattern);
45
- if (!stats.isFile()) {
46
- pattern = path.posix.join(pattern, "**", "*.{ts,js,mts,mjs}");
47
- }
48
- }
49
- return glob(pattern, options);
50
- })
51
- );
52
- })
53
- );
54
- return [...new Set(files.flat(2))].sort();
18
+ const pathToFiles = async (paths) => {
19
+ const opts = normalizeGlobPath(paths);
20
+ const files = await Promise.all(opts.map((opt) => {
21
+ const { dot, pattern: patterns } = opt;
22
+ const ignore = (opt.ignore || []).slice();
23
+ ignore.push("**/node_modules/**/**", "**/*.d.{ts,mts}");
24
+ const options = {
25
+ nodir: true,
26
+ dot,
27
+ ignore,
28
+ absolute: true,
29
+ withFileTypes: false,
30
+ maxDepth: Infinity
31
+ };
32
+ return Promise.all(patterns.map(async (pattern) => {
33
+ if (!path.isAbsolute(pattern)) pattern = path.resolve(pattern);
34
+ /**
35
+ * 在windows系统默认使用反斜杠`\`拼接路径,但是glob只支持正斜杠`/`.
36
+ * @link https://github.com/isaacs/node-glob#windows
37
+ */
38
+ pattern = pattern.replace(/\\/g, path.posix.sep);
39
+ /**
40
+ * glob.hasMagic 不支持带反斜杠(\)的路径。从glob@9.0.0起,花括号不再是魔术路径
41
+ * @see https://github.com/isaacs/node-glob/issues/496
42
+ */
43
+ if (!hasMagic(pattern, { magicalBraces: true })) {
44
+ if (!(await stat(pattern)).isFile()) pattern = path.posix.join(pattern, "**", "*.{ts,js,mts,mjs}");
45
+ }
46
+ return glob(pattern, options);
47
+ }));
48
+ }));
49
+ return [...new Set(files.flat(2))].sort();
55
50
  };
56
-
57
51
  // src/get-file-values.ts
58
- import { pathToFileURL } from "url";
59
- var getFileValues = async (files, filterValues) => {
60
- const totalFiles = /* @__PURE__ */ new Set();
61
- await Promise.all(
62
- files.map(async (file) => {
63
- const modules = await import(pathToFileURL(file).toString());
64
- if (typeof modules === "object") {
65
- Object.values(modules).forEach((item) => {
66
- totalFiles.add(item);
67
- });
68
- }
69
- })
70
- );
71
- return filterValues ? [...totalFiles].filter(filterValues) : [...totalFiles];
72
- };
73
- export {
74
- getFileValues,
75
- normalizeGlobPath,
76
- pathToFiles
52
+ const getFileValues = async (files, filterValues) => {
53
+ const totalFiles = /* @__PURE__ */ new Set();
54
+ await Promise.all(files.map(async (file) => {
55
+ const modules = await import(pathToFileURL(file).toString());
56
+ if (typeof modules === "object") Object.values(modules).forEach((item) => {
57
+ totalFiles.add(item);
58
+ });
59
+ }));
60
+ return filterValues ? [...totalFiles].filter(filterValues) : [...totalFiles];
77
61
  };
62
+ export { getFileValues, normalizeGlobPath, pathToFiles };
63
+
78
64
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/path-to-file.ts","../src/normalize-glob-path.ts","../src/get-file-values.ts"],"sourcesContent":["import path from 'node:path';\nimport { stat } from 'node:fs/promises';\nimport { glob, type GlobOptionsWithFileTypesFalse, hasMagic } from 'glob';\nimport { normalizeGlobPath, type GlobPathOptions } from './normalize-glob-path';\n\nexport const pathToFiles = async (paths: GlobPathOptions): Promise<string[]> => {\n const opts = normalizeGlobPath(paths);\n\n const files = await Promise.all(\n opts.map((opt) => {\n const { dot, pattern: patterns } = opt;\n const ignore = (opt.ignore || []).slice();\n ignore.push('**/node_modules/**/**', '**/*.d.{ts,mts}');\n\n const options: GlobOptionsWithFileTypesFalse = {\n nodir: true,\n dot,\n ignore,\n absolute: true,\n withFileTypes: false,\n maxDepth: Infinity,\n };\n\n return Promise.all(\n patterns.map(async (pattern) => {\n if (!path.isAbsolute(pattern)) {\n pattern = path.resolve(pattern);\n }\n\n /**\n * 在windows系统默认使用反斜杠`\\`拼接路径,但是glob只支持正斜杠`/`.\n * @link https://github.com/isaacs/node-glob#windows\n */\n pattern = pattern.replace(/\\\\/g, path.posix.sep);\n\n /**\n * glob.hasMagic 不支持带反斜杠(\\)的路径。从glob@9.0.0起,花括号不再是魔术路径\n * @see https://github.com/isaacs/node-glob/issues/496\n */\n if (!hasMagic(pattern, { magicalBraces: true })) {\n const stats = await stat(pattern);\n if (!stats.isFile()) {\n pattern = path.posix.join(pattern, '**', '*.{ts,js,mts,mjs}');\n }\n }\n\n return glob(pattern, options);\n }),\n );\n }),\n );\n\n return [...new Set(files.flat(2))].sort();\n};\n","export interface GlobPathFullOptions {\n pattern: string[];\n ignore?: string[];\n dot?: boolean;\n}\n\nexport type GlobPathOptions =\n | string\n | string[]\n | GlobPathFullOptions\n | GlobPathFullOptions[];\n\nexport const normalizeGlobPath = (paths: GlobPathOptions): GlobPathFullOptions[] => {\n if (typeof paths === 'string') {\n return [{ pattern: [paths] }];\n }\n\n if (Array.isArray(paths)) {\n if (!paths.length) return [];\n return isStringArray(paths) ? [{ pattern: paths }] : paths;\n }\n\n return [paths];\n};\n\nconst isStringArray = (data: string[] | GlobPathFullOptions[]): data is string[] => {\n return typeof data[0] === 'string';\n};\n","import { pathToFileURL } from 'node:url';\n\nexport const getFileValues = async <T extends unknown>(\n files: string[],\n filterValues?: (item?: unknown) => boolean,\n): Promise<T[]> => {\n const totalFiles = new Set<T>();\n await Promise.all(\n files.map(async (file) => {\n // Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'\n const modules = await import(pathToFileURL(file).toString());\n if (typeof modules === 'object') {\n Object.values(modules).forEach((item) => {\n totalFiles.add(item as any);\n });\n }\n }),\n );\n return filterValues ? [...totalFiles].filter(filterValues) : [...totalFiles];\n};\n"],"mappings":";AAAA,OAAO,UAAU;AACjB,SAAS,YAAY;AACrB,SAAS,MAA0C,gBAAgB;;;ACU5D,IAAM,oBAAoB,CAAC,UAAkD;AAClF,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;AAAA,EAC9B;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,QAAI,CAAC,MAAM,OAAQ,QAAO,CAAC;AAC3B,WAAO,cAAc,KAAK,IAAI,CAAC,EAAE,SAAS,MAAM,CAAC,IAAI;AAAA,EACvD;AAEA,SAAO,CAAC,KAAK;AACf;AAEA,IAAM,gBAAgB,CAAC,SAA6D;AAClF,SAAO,OAAO,KAAK,CAAC,MAAM;AAC5B;;;ADtBO,IAAM,cAAc,OAAO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S;AACvC,qBAAW,IAAI,IAAW;AAAA,QAC5B,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO,eAAe,CAAC,GAAG,UAAU,EAAE,OAAO,YAAY,IAAI,CAAC,GAAG,UAAU;AAC7E;","names":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/normalize-glob-path.ts","../src/path-to-file.ts","../src/get-file-values.ts"],"sourcesContent":["export interface GlobPathFullOptions {\n pattern: string[];\n ignore?: string[];\n dot?: boolean;\n}\n\nexport type GlobPathOptions =\n string | string[] | GlobPathFullOptions | GlobPathFullOptions[];\n\nexport const normalizeGlobPath = (paths: GlobPathOptions): GlobPathFullOptions[] => {\n if (typeof paths === 'string') {\n return [{ pattern: [paths] }];\n }\n\n if (Array.isArray(paths)) {\n if (!paths.length) return [];\n return isStringArray(paths) ? [{ pattern: paths }] : paths;\n }\n\n return [paths];\n};\n\nconst isStringArray = (data: string[] | GlobPathFullOptions[]): data is string[] => {\n return typeof data[0] === 'string';\n};\n","import path from 'node:path';\nimport { stat } from 'node:fs/promises';\nimport { glob, type GlobOptionsWithFileTypesFalse, hasMagic } from 'glob';\nimport { normalizeGlobPath, type GlobPathOptions } from './normalize-glob-path';\n\nexport const pathToFiles = async (paths: GlobPathOptions): Promise<string[]> => {\n const opts = normalizeGlobPath(paths);\n\n const files = await Promise.all(\n opts.map((opt) => {\n const { dot, pattern: patterns } = opt;\n const ignore = (opt.ignore || []).slice();\n ignore.push('**/node_modules/**/**', '**/*.d.{ts,mts}');\n\n const options: GlobOptionsWithFileTypesFalse = {\n nodir: true,\n dot,\n ignore,\n absolute: true,\n withFileTypes: false,\n maxDepth: Infinity,\n };\n\n return Promise.all(\n patterns.map(async (pattern) => {\n if (!path.isAbsolute(pattern)) {\n pattern = path.resolve(pattern);\n }\n\n /**\n * 在windows系统默认使用反斜杠`\\`拼接路径,但是glob只支持正斜杠`/`.\n * @link https://github.com/isaacs/node-glob#windows\n */\n pattern = pattern.replace(/\\\\/g, path.posix.sep);\n\n /**\n * glob.hasMagic 不支持带反斜杠(\\)的路径。从glob@9.0.0起,花括号不再是魔术路径\n * @see https://github.com/isaacs/node-glob/issues/496\n */\n if (!hasMagic(pattern, { magicalBraces: true })) {\n const stats = await stat(pattern);\n if (!stats.isFile()) {\n pattern = path.posix.join(pattern, '**', '*.{ts,js,mts,mjs}');\n }\n }\n\n return glob(pattern, options);\n }),\n );\n }),\n );\n\n return [...new Set(files.flat(2))].sort();\n};\n","import { pathToFileURL } from 'node:url';\n\nexport const getFileValues = async <T extends unknown>(\n files: string[],\n filterValues?: (item?: unknown) => boolean,\n): Promise<T[]> => {\n const totalFiles = new Set<T>();\n await Promise.all(\n files.map(async (file) => {\n // Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'\n const modules = await import(pathToFileURL(file).toString());\n if (typeof modules === 'object') {\n Object.values(modules).forEach((item) => {\n totalFiles.add(item as any);\n });\n }\n }),\n );\n return filterValues ? [...totalFiles].filter(filterValues) : [...totalFiles];\n};\n"],"mappings":";;;;;AASA,MAAa,qBAAqB,UAAkD;CAClF,IAAI,OAAO,UAAU,UACnB,OAAO,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;CAG9B,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,IAAI,CAAC,MAAM,QAAQ,OAAO,CAAC;EAC3B,OAAO,cAAc,KAAK,IAAI,CAAC,EAAE,SAAS,MAAM,CAAC,IAAI;CACvD;CAEA,OAAO,CAAC,KAAK;AACf;AAEA,MAAM,iBAAiB,SAA6D;CAClF,OAAO,OAAO,KAAK,OAAO;AAC5B;;ACnBA,MAAa,cAAc,OAAO,UAA8C;CAC9E,MAAM,OAAO,kBAAkB,KAAK;CAEpC,MAAM,QAAQ,MAAM,QAAQ,IAC1B,KAAK,KAAK,QAAQ;EAChB,MAAM,EAAE,KAAK,SAAS,aAAa;EACnC,MAAM,UAAU,IAAI,UAAU,CAAC,EAAA,CAAG,MAAM;EACxC,OAAO,KAAK,yBAAyB,iBAAiB;EAEtD,MAAM,UAAyC;GAC7C,OAAO;GACP;GACA;GACA,UAAU;GACV,eAAe;GACf,UAAU;EACZ;EAEA,OAAO,QAAQ,IACb,SAAS,IAAI,OAAO,YAAY;GAC9B,IAAI,CAAC,KAAK,WAAW,OAAO,GAC1B,UAAU,KAAK,QAAQ,OAAO;;;;;GAOhC,UAAU,QAAQ,QAAQ,OAAO,KAAK,MAAM,GAAG;;;;;GAM/C,IAAI,CAAC,SAAS,SAAS,EAAE,eAAe,KAAK,CAAC,GAExC;QAAA,EAAC,MADe,KAAK,OAAO,EAAA,CACrB,OAAO,GAChB,UAAU,KAAK,MAAM,KAAK,SAAS,MAAM,mBAAmB;GAAA;GAIhE,OAAO,KAAK,SAAS,OAAO;EAC9B,CAAC,CACH;CACF,CAAC,CACH;CAEA,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;AAC1C;;ACnDA,MAAa,gBAAgB,OAC3B,OACA,iBACiB;CACjB,MAAM,6BAAa,IAAI,IAAO;CAC9B,MAAM,QAAQ,IACZ,MAAM,IAAI,OAAO,SAAS;EAExB,MAAM,UAAU,MAAM,OAAO,cAAc,IAAI,CAAC,CAAC,SAAS;EAC1D,IAAI,OAAO,YAAY,UACrB,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,SAAS;GACvC,WAAW,IAAI,IAAW;EAC5B,CAAC;CAEL,CAAC,CACH;CACA,OAAO,eAAe,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,YAAY,IAAI,CAAC,GAAG,UAAU;AAC7E"}
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "@aomex/internal-file-import",
3
- "version": "3.30.6",
3
+ "version": "3.30.8-alpha.62.sha-92b25bb",
4
4
  "description": "aomex根据文件路径导入模块",
5
- "type": "module",
6
- "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.js"
11
- },
12
- "./package.json": "./package.json"
5
+ "scripts": {
6
+ "prepublishOnly": "tsdown"
13
7
  },
8
+ "type": "module",
9
+ "types": "src/index.ts",
10
+ "exports": "./src/index.ts",
14
11
  "publishConfig": {
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
15
20
  "access": "public"
16
21
  },
17
22
  "files": [
@@ -22,14 +27,11 @@
22
27
  "CHANGELOG.md"
23
28
  ],
24
29
  "keywords": [],
25
- "repository": {
26
- "type": "git",
27
- "url": "git@github.com:aomex/aomex.git"
28
- },
30
+ "repository": "git@github.com:aomex/aomex.git",
29
31
  "homepage": "https://aomex.js.org",
30
32
  "license": "MIT",
31
33
  "dependencies": {
32
- "glob": "^10.3.10"
34
+ "glob": "^14.0.6"
33
35
  },
34
- "scripts": {}
35
- }
36
+ "gitHead": "92b25bbcd6c3ae28160316117a74c88619b5bc8d"
37
+ }