@aomex/console 1.5.1 → 1.7.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
@@ -3,6 +3,22 @@
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
+ # [1.7.0](https://github.com/aomex/aomex/compare/v1.6.0...v1.7.0) (2024-07-13)
7
+
8
+ **Note:** Version bump only for package @aomex/console
9
+
10
+
11
+
12
+
13
+
14
+ # [1.6.0](https://github.com/aomex/aomex/compare/v1.5.1...v1.6.0) (2024-07-05)
15
+
16
+ **Note:** Version bump only for package @aomex/console
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.5.1](https://github.com/aomex/aomex/compare/v1.5.0...v1.5.1) (2024-07-04)
7
23
 
8
24
  **Note:** Version bump only for package @aomex/console
package/bin.mjs ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { pathToFileURL } from 'node:url';
4
+ import { glob } from 'glob';
5
+ import { tsImport } from 'tsx/esm/api';
6
+
7
+ const fileName = 'cli.{ts,js,mts,mjs}';
8
+ const files = await glob([fileName, 'src/' + fileName], {
9
+ magicalBraces: true,
10
+ });
11
+ const cliEntry = files[0];
12
+
13
+ if (!cliEntry) {
14
+ const err = new Error(
15
+ 'CLI entry file is not found, Did you forget to create file "cli.ts" or "src/cli.ts"',
16
+ );
17
+ // @ts-expect-error
18
+ err.code = 'ENOENT';
19
+ throw err;
20
+ }
21
+
22
+ if (cliEntry.endsWith('ts')) {
23
+ await tsImport(pathToFileURL(cliEntry).toString(), import.meta.url);
24
+ } else {
25
+ await import(pathToFileURL(cliEntry).toString());
26
+ }
package/dist/index.d.ts CHANGED
@@ -215,7 +215,7 @@ declare const collectConsoleDocument: (data: {
215
215
  */
216
216
  declare const options: <T extends {
217
217
  [key: string]: P;
218
- }, P extends Validator<unknown>, Alias extends keyof T>(fields: T, aliasList?: { [key in Alias]: string | string[]; } | undefined) => ConsoleMiddleware<{
218
+ }, P extends Validator, Alias extends keyof T>(fields: T, aliasList?: { [key in Alias]: string | string[]; }) => ConsoleMiddleware<{
219
219
  readonly options: Validator.Infer<T>;
220
220
  }>;
221
221
 
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ i18n2.register("en_US", "console", {
13
13
  });
14
14
 
15
15
  // src/utils/meta.ts
16
- var version = "1.5.1";
16
+ var version = "1.7.0";
17
17
  var scriptName = "aomex";
18
18
 
19
19
  // src/override/console-middleware.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aomex/console",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "控制台应用",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "bin.mjs",
19
20
  "LICENSE",
20
21
  "package.json",
21
22
  "README.md",
@@ -32,19 +33,19 @@
32
33
  "@aomex/core": "^1.0.0"
33
34
  },
34
35
  "dependencies": {
36
+ "glob": "^10.3.10",
35
37
  "tsx": "^4.15.6",
36
38
  "yargs": "^17.7.1",
37
39
  "yargs-parser": "^21.1.1",
38
- "@aomex/internal-file-import": "^1.5.1",
39
- "@aomex/internal-tools": "^1.5.1"
40
+ "@aomex/internal-tools": "^1.7.0"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@types/yargs": "^17.0.23",
43
44
  "@types/yargs-parser": "^21.0.0",
44
- "@aomex/core": "^1.5.1"
45
+ "@aomex/core": "^1.7.0"
45
46
  },
46
47
  "scripts": {},
47
48
  "bin": {
48
- "aomex": "dist/bin.js"
49
+ "aomex": "bin.mjs"
49
50
  }
50
51
  }
package/dist/bin.d.ts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
package/dist/bin.js DELETED
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/bin.ts
4
- import { hideBin } from "yargs/helpers";
5
- import { spawn } from "node:child_process";
6
- import { pathToFileURL } from "node:url";
7
- import { pathToFiles } from "@aomex/internal-file-import";
8
- var fileName = "cli.{ts,js,mts,mjs}";
9
- var files = await pathToFiles([fileName, "src/" + fileName]);
10
- var cliEntry = files[0];
11
- if (!cliEntry) {
12
- const err = new Error(
13
- 'CLI entry file is not found, Did you forget to create file "cli.ts" or "src/cli.ts"'
14
- );
15
- err.code = "ENOENT";
16
- throw err;
17
- }
18
- if (cliEntry.endsWith("ts")) {
19
- const execArgv = [...process.execArgv];
20
- execArgv.unshift("--import", "tsx/esm");
21
- const streams = spawn(
22
- process.argv0,
23
- [...execArgv, cliEntry, ...hideBin(process.argv)],
24
- {
25
- cwd: process.cwd(),
26
- env: process.env,
27
- stdio: "inherit"
28
- }
29
- );
30
- streams.on("exit", (code) => {
31
- process.exit(code || 0);
32
- });
33
- } else {
34
- await import(pathToFileURL(cliEntry).toString());
35
- }
36
- //# sourceMappingURL=bin.js.map
package/dist/bin.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { hideBin } from 'yargs/helpers';\nimport { spawn } from 'node:child_process';\nimport { pathToFileURL } from 'node:url';\nimport { pathToFiles } from '@aomex/internal-file-import';\n\nconst fileName = 'cli.{ts,js,mts,mjs}';\nconst files = await pathToFiles([fileName, 'src/' + fileName]);\nconst cliEntry = files[0];\n\nif (!cliEntry) {\n const err = new Error(\n 'CLI entry file is not found, Did you forget to create file \"cli.ts\" or \"src/cli.ts\"',\n );\n // @ts-expect-error\n err.code = 'ENOENT';\n throw err;\n}\n\nif (cliEntry.endsWith('ts')) {\n const execArgv = [...process.execArgv];\n execArgv.unshift('--import', 'tsx/esm');\n const streams = spawn(\n process.argv0,\n [...execArgv, cliEntry, ...hideBin(process.argv)],\n {\n cwd: process.cwd(),\n env: process.env,\n stdio: 'inherit',\n },\n );\n streams.on('exit', (code) => {\n process.exit(code || 0);\n });\n} else {\n await import(pathToFileURL(cliEntry).toString());\n}\n"],"mappings":";;;AAEA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAE5B,IAAM,WAAW;AACjB,IAAM,QAAQ,MAAM,YAAY,CAAC,UAAU,SAAS,QAAQ,CAAC;AAC7D,IAAM,WAAW,MAAM,CAAC;AAExB,IAAI,CAAC,UAAU;AACb,QAAM,MAAM,IAAI;AAAA,IACd;AAAA,EACF;AAEA,MAAI,OAAO;AACX,QAAM;AACR;AAEA,IAAI,SAAS,SAAS,IAAI,GAAG;AAC3B,QAAM,WAAW,CAAC,GAAG,QAAQ,QAAQ;AACrC,WAAS,QAAQ,YAAY,SAAS;AACtC,QAAM,UAAU;AAAA,IACd,QAAQ;AAAA,IACR,CAAC,GAAG,UAAU,UAAU,GAAG,QAAQ,QAAQ,IAAI,CAAC;AAAA,IAChD;AAAA,MACE,KAAK,QAAQ,IAAI;AAAA,MACjB,KAAK,QAAQ;AAAA,MACb,OAAO;AAAA,IACT;AAAA,EACF;AACA,UAAQ,GAAG,QAAQ,CAAC,SAAS;AAC3B,YAAQ,KAAK,QAAQ,CAAC;AAAA,EACxB,CAAC;AACH,OAAO;AACL,QAAM,OAAO,cAAc,QAAQ,EAAE,SAAS;AAChD;","names":[]}