adorn-api 1.0.18 → 1.0.19

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/cli.js CHANGED
@@ -3346,16 +3346,31 @@ var ADORN_VERSION = (() => {
3346
3346
  return null;
3347
3347
  }
3348
3348
  };
3349
- const cliDir = dirname3(fileURLToPath(import.meta.url));
3350
- const bundledPkgPath = resolve3(cliDir, "..", "package.json");
3351
- const bundledVersion = tryReadPackageJson(bundledPkgPath);
3352
- if (bundledVersion) return bundledVersion;
3353
- const localPkgPath = resolve3(process2.cwd(), "package.json");
3354
- const localVersion = tryReadPackageJson(localPkgPath);
3355
- if (localVersion) return localVersion;
3356
- const nodeModulesPath = resolve3(cliDir, "..", "package.json");
3357
- const nodeModulesVersion = tryReadPackageJson(nodeModulesPath);
3358
- if (nodeModulesVersion) return nodeModulesVersion;
3349
+ const potentialPaths = [];
3350
+ try {
3351
+ const importMetaUrl = import.meta?.url;
3352
+ if (importMetaUrl && typeof importMetaUrl === "string" && importMetaUrl.length > 0) {
3353
+ const cliDir = dirname3(fileURLToPath(importMetaUrl));
3354
+ potentialPaths.push(
3355
+ resolve3(cliDir, "..", "package.json"),
3356
+ resolve3(cliDir, "package.json")
3357
+ );
3358
+ }
3359
+ } catch {
3360
+ }
3361
+ const cwd = process2.cwd();
3362
+ potentialPaths.push(
3363
+ resolve3(cwd, "package.json"),
3364
+ resolve3(cwd, "node_modules", "adorn-api", "package.json"),
3365
+ resolve3(cwd, "..", "package.json"),
3366
+ resolve3(cwd, "..", "..", "package.json")
3367
+ );
3368
+ for (const pkgPath of potentialPaths) {
3369
+ const version = tryReadPackageJson(pkgPath);
3370
+ if (version) {
3371
+ return version;
3372
+ }
3373
+ }
3359
3374
  return "0.0.0";
3360
3375
  })();
3361
3376
  function log(msg, options) {