@0x-jerry/x 2.12.7 → 2.12.9

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.7";
2
+ var version = "2.12.9";
3
3
 
4
4
  export {
5
5
  version
package/dist/x.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  version
4
- } from "./chunk-LBTVWMZC.js";
4
+ } from "./chunk-DLLDG7JW.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-RDZVDWJQ.js";
7
7
  import {
8
8
  version
9
- } from "./chunk-LBTVWMZC.js";
9
+ } from "./chunk-DLLDG7JW.js";
10
10
 
11
11
  // src/xn.ts
12
12
  import { sliver } from "@0x-jerry/silver";
package/dist/xr.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-RDZVDWJQ.js";
6
6
  import {
7
7
  version
8
- } from "./chunk-LBTVWMZC.js";
8
+ } from "./chunk-DLLDG7JW.js";
9
9
 
10
10
  // src/xr.ts
11
11
  import { sliver } from "@0x-jerry/silver";
@@ -60,18 +60,28 @@ var NodeTaskDetecter = class {
60
60
  return envPaths;
61
61
  }
62
62
  async check(cwd) {
63
- const pkgInfo = await detectPackageRoot(cwd);
64
- return pkgInfo?.pkgDir;
63
+ const rootPkgInfo = await detectPackageRoot(cwd);
64
+ return getClosestProjectInfo(rootPkgInfo)?.pkgDir;
65
65
  }
66
66
  async task(cwd, taskName) {
67
67
  return (await this.tasks(cwd))[taskName];
68
68
  }
69
69
  async tasks(cwd) {
70
- const pkgInfo = await detectPackageRoot(cwd);
71
- const tasks = pkgInfo?.package.scripts || {};
70
+ const rootPkgInfo = await detectPackageRoot(cwd);
71
+ const tasks = getClosestProjectInfo(rootPkgInfo)?.package.scripts || {};
72
72
  return tasks;
73
73
  }
74
74
  };
75
+ function getClosestProjectInfo(rootPkgInfo) {
76
+ if (!rootPkgInfo) {
77
+ return void 0;
78
+ }
79
+ let pkgInfo = rootPkgInfo;
80
+ while (pkgInfo.subProject) {
81
+ pkgInfo = pkgInfo.subProject;
82
+ }
83
+ return pkgInfo;
84
+ }
75
85
  async function getBinariesPairs() {
76
86
  let dir = process.cwd();
77
87
  const binaries = {};
@@ -177,11 +187,20 @@ async function defaultAction(_, arg) {
177
187
  const [commandOrFile, ...params] = arg._;
178
188
  try {
179
189
  if (isJsFile(commandOrFile)) {
180
- await exec(
181
- "node",
182
- ["--import", import.meta.resolve(`./hooks/register.js`), commandOrFile],
183
- { silent: true }
184
- );
190
+ const pkg = await detectPackageRoot(process.cwd());
191
+ if (pkg?.pm === "bun") {
192
+ await exec(
193
+ "bun",
194
+ ["run", commandOrFile],
195
+ { silent: true }
196
+ );
197
+ } else {
198
+ await exec(
199
+ "node",
200
+ ["--import", import.meta.resolve(`./hooks/register.js`), commandOrFile],
201
+ { silent: true }
202
+ );
203
+ }
185
204
  } else {
186
205
  await runScript(commandOrFile, params);
187
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0x-jerry/x",
3
- "version": "2.12.7",
3
+ "version": "2.12.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/0x-jerry/x.git"