@0x-jerry/x 2.12.4 → 2.12.6

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.
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.12.4";
2
+ var version = "2.12.6";
3
3
 
4
4
  export {
5
5
  version
@@ -1,6 +1,7 @@
1
1
  // src/hooks/register.ts
2
2
  import { register } from "module";
3
- register("./tsx.js", import.meta.url);
3
+ import { register as registerTsx } from "tsx/esm/api";
4
+ registerTsx();
4
5
  register("./text.js", import.meta.url);
5
6
  register("./jsonc.js", import.meta.url);
6
7
  register("./yaml.js", import.meta.url);
package/dist/x.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  version
4
- } from "./chunk-MLK4NZGK.js";
4
+ } from "./chunk-WWG7Y7EF.js";
5
5
 
6
6
  // src/x.ts
7
7
  import { sliver } from "@0x-jerry/silver";
package/dist/xn.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-ELIYGHQS.js";
7
7
  import {
8
8
  version
9
- } from "./chunk-MLK4NZGK.js";
9
+ } from "./chunk-WWG7Y7EF.js";
10
10
 
11
11
  // src/xn.ts
12
12
  import { sliver } from "@0x-jerry/silver";
@@ -117,7 +117,7 @@ async function detectPkgManagerCommand(cwd = process.cwd()) {
117
117
  if (exists(pnpmLockFile)) {
118
118
  return "pnpm";
119
119
  }
120
- const bunLockFile = join(cwd, "bun.lockb");
120
+ const bunLockFile = join(cwd, "bun.lock");
121
121
  if (exists(bunLockFile)) {
122
122
  return "bun";
123
123
  }
package/dist/xr.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-ELIYGHQS.js";
5
5
  import {
6
6
  version
7
- } from "./chunk-MLK4NZGK.js";
7
+ } from "./chunk-WWG7Y7EF.js";
8
8
 
9
9
  // src/xr.ts
10
10
  import { sliver } from "@0x-jerry/silver";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0x-jerry/x",
3
- "version": "2.12.4",
3
+ "version": "2.12.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/0x-jerry/x.git"
@@ -8,6 +8,16 @@
8
8
  "author": "Jerry Wang <x.jerry.wang@gmail.com>",
9
9
  "license": "MIT",
10
10
  "type": "module",
11
+ "description": "Some useful command for myself.",
12
+ "main": "index.js",
13
+ "directories": {
14
+ "test": "tests"
15
+ },
16
+ "keywords": [],
17
+ "bugs": {
18
+ "url": "https://github.com/0x-jerry/x/issues"
19
+ },
20
+ "homepage": "https://github.com/0x-jerry/x#readme",
11
21
  "publishConfig": {
12
22
  "access": "public",
13
23
  "registry": "https://registry.npmjs.org"
@@ -38,8 +48,7 @@
38
48
  "src/hooks/register.ts",
39
49
  "src/hooks/text.ts",
40
50
  "src/hooks/jsonc.ts",
41
- "src/hooks/yaml.ts",
42
- "src/hooks/tsx.ts"
51
+ "src/hooks/yaml.ts"
43
52
  ],
44
53
  "format": [
45
54
  "esm"
@@ -48,30 +57,30 @@
48
57
  },
49
58
  "dependencies": {
50
59
  "@0x-jerry/silver": "^1.2.4",
51
- "@0x-jerry/utils": "^5.0.0",
60
+ "@0x-jerry/utils": "^6.2.0",
52
61
  "decompress": "^4.2.1",
53
- "fs-extra": "^11.3.1",
54
- "global-agent": "^3.0.0",
55
- "got": "^14.4.8",
62
+ "fs-extra": "^11.3.3",
63
+ "global-agent": "^4.1.2",
64
+ "got": "^14.6.6",
56
65
  "jsonc-parser": "^3.3.1",
57
- "ora": "^8.2.0",
66
+ "ora": "^9.3.0",
58
67
  "picocolors": "^1.1.1",
59
68
  "prompts": "^2.4.2",
60
69
  "strip-json-comments": "^5.0.3",
61
- "tsx": "^4.20.5",
62
- "yaml": "^2.8.1"
70
+ "tsx": "^4.21.0",
71
+ "yaml": "^2.8.2"
63
72
  },
64
73
  "devDependencies": {
65
- "@0x-jerry/x-release": "^2.4.0",
66
- "@biomejs/biome": "^2.2.4",
74
+ "@0x-jerry/x-release": "^3.0.1",
75
+ "@biomejs/biome": "^2.4.4",
67
76
  "@types/decompress": "^4.2.7",
68
77
  "@types/fs-extra": "^11.0.4",
69
78
  "@types/global-agent": "^3.0.0",
70
- "@types/node": "^24.3.1",
79
+ "@types/node": "^25.3.1",
71
80
  "@types/prompts": "^2.4.9",
72
- "@vitest/coverage-v8": "^3.2.4",
73
- "tsup": "^8.5.0",
74
- "typescript": "^5.9.2",
75
- "vitest": "^3.2.4"
81
+ "@vitest/coverage-v8": "^4.0.18",
82
+ "tsup": "^8.5.1",
83
+ "typescript": "^5.9.3",
84
+ "vitest": "^4.0.18"
76
85
  }
77
86
  }
package/readme.md CHANGED
@@ -31,9 +31,38 @@ xr dev
31
31
  deno run -A main.ts
32
32
  ```
33
33
 
34
+ `xr` can execute js/ts file directly, also support import any `string/yaml/jsonc` file directly with import attribute.
35
+
36
+ Example:
37
+
38
+ `script.ts`
39
+
40
+ ```ts
41
+ const count: number = 3;
42
+ console.log(count)
43
+
44
+ import textData from './test.txt' with { type: 'text' }
45
+ console.log(textData) // => typeof textData === 'string'
46
+
47
+ import yamlData from './test.yaml' with { type: 'yaml' }
48
+ console.log(yamlData) // => typeof yamlData === 'object'
49
+
50
+ import jsoncData from './test.jsonc' with { type: 'jsonc' }
51
+ console.log(jsoncData) // => typeof jsoncData === 'object'
52
+
53
+ import sqlStr from './files/test.sql' with { type: 'text' }
54
+ console.log(sqlStr) // => typeof sqlStr === 'string'
55
+ ```
56
+
57
+ Execute it:
58
+
59
+ ```sh
60
+ xr ./script.ts
61
+ ```
62
+
34
63
  ## Dependency Manager `xn`
35
64
 
36
- `xn` command can install modules by detect the correct tool, it detects lockfile to decide which dependency manager tools should be used.
65
+ `xn` command can install modules by detect the correct tool automatically, it detects lockfile to decide which dependency manager tool should be used.
37
66
 
38
67
  Example: install packages in a node project with `pnpm-lock.yaml`
39
68
 
@@ -85,11 +114,12 @@ cargo remove log
85
114
 
86
115
  ## Command Completions
87
116
 
88
- Add this code to `~/.zshrc`
117
+ This feature only support zsh.
118
+
119
+ Add those code to `~/.zshrc`
89
120
 
90
121
  ```zsh
91
122
  source <(x completion)
92
123
  source <(xr completion)
93
124
  source <(xn completion)
94
125
  ```
95
-
package/dist/hooks/tsx.js DELETED
@@ -1,6 +0,0 @@
1
- // src/hooks/tsx.ts
2
- import { load, resolve } from "tsx/esm";
3
- export {
4
- load,
5
- resolve
6
- };