@resourcexjs/core 2.17.0 → 2.17.2

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/dist/index.js CHANGED
@@ -15138,8 +15138,8 @@ async function loadResource(source, config2) {
15138
15138
  return loader.load(source);
15139
15139
  }
15140
15140
  // src/loader/NpmSourceLoader.ts
15141
- import { dirname } from "node:path";
15142
- import { fileURLToPath } from "node:url";
15141
+ import { dirname, join as join3 } from "node:path";
15142
+ import { fileURLToPath, pathToFileURL } from "node:url";
15143
15143
  var NPM_PREFIX = "npm:";
15144
15144
 
15145
15145
  class NpmSourceLoader {
@@ -15160,8 +15160,10 @@ class NpmSourceLoader {
15160
15160
  return { source, files: rxs.files };
15161
15161
  }
15162
15162
  resolvePackageDir(packageName) {
15163
+ const entry = globalThis.Bun?.main ?? process.argv[1] ?? join3(process.cwd(), "noop.js");
15164
+ const parent = pathToFileURL(entry).href;
15163
15165
  try {
15164
- const url2 = import.meta.resolve(`${packageName}/package.json`);
15166
+ const url2 = import.meta.resolve(`${packageName}/package.json`, parent);
15165
15167
  return dirname(fileURLToPath(url2));
15166
15168
  } catch {
15167
15169
  throw new ResourceXError(`Cannot resolve npm package: ${packageName}`);
@@ -15477,7 +15479,7 @@ class CASRegistry {
15477
15479
  }
15478
15480
  // src/registry/registries/LinkedRegistry.ts
15479
15481
  import { lstat, mkdir, readdir as readdir3, readlink, rm, symlink } from "node:fs/promises";
15480
- import { join as join3, resolve as resolvePath } from "node:path";
15482
+ import { join as join4, resolve as resolvePath } from "node:path";
15481
15483
  class LinkedRegistry {
15482
15484
  basePath;
15483
15485
  constructor(basePath) {
@@ -15486,11 +15488,11 @@ class LinkedRegistry {
15486
15488
  buildLinkPath(rxi) {
15487
15489
  const registry2 = rxi.registry ?? "localhost";
15488
15490
  const tag = rxi.tag ?? "latest";
15489
- let linkPath = join3(this.basePath, registry2);
15491
+ let linkPath = join4(this.basePath, registry2);
15490
15492
  if (rxi.path) {
15491
- linkPath = join3(linkPath, rxi.path);
15493
+ linkPath = join4(linkPath, rxi.path);
15492
15494
  }
15493
- return join3(linkPath, rxi.name, tag);
15495
+ return join4(linkPath, rxi.name, tag);
15494
15496
  }
15495
15497
  async isSymlink(path) {
15496
15498
  try {
@@ -15552,7 +15554,7 @@ class LinkedRegistry {
15552
15554
  await rm(linkPath, { recursive: true });
15553
15555
  }
15554
15556
  } catch {}
15555
- const parentPath = join3(linkPath, "..");
15557
+ const parentPath = join4(linkPath, "..");
15556
15558
  await mkdir(parentPath, { recursive: true });
15557
15559
  const absolutePath = resolvePath(devPath);
15558
15560
  await symlink(absolutePath, linkPath);
@@ -15569,7 +15571,7 @@ class LinkedRegistry {
15569
15571
  return;
15570
15572
  }
15571
15573
  for (const entry of entries) {
15572
- const fullPath = join3(dirPath, entry);
15574
+ const fullPath = join4(dirPath, entry);
15573
15575
  const relPath = relativePath ? `${relativePath}/${entry}` : entry;
15574
15576
  try {
15575
15577
  const stats = await lstat(fullPath);
@@ -15996,4 +15998,4 @@ export {
15996
15998
  CASRegistry
15997
15999
  };
15998
16000
 
15999
- //# debugId=8B42B108D3A1492364756E2164756E21
16001
+ //# debugId=124BD7881166D2C664756E2164756E21