@stacksjs/path 0.75.329 → 0.75.334

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
@@ -4,7 +4,7 @@ import {
4
4
  existsSync as existsSync3,
5
5
  lstatSync as lstatSync2,
6
6
  mkdirSync,
7
- readFileSync,
7
+ readFileSync as readFileSync2,
8
8
  readdirSync,
9
9
  readlinkSync,
10
10
  realpathSync as realpathSync2,
@@ -30,7 +30,7 @@ import {
30
30
  import process2 from "process";
31
31
 
32
32
  // src/project.ts
33
- import { existsSync, lstatSync, realpathSync, rmSync, symlinkSync } from "fs";
33
+ import { existsSync, lstatSync, readFileSync, realpathSync, rmSync, symlinkSync } from "fs";
34
34
  import { dirname, join, relative, resolve, sep } from "path";
35
35
  import process from "process";
36
36
  var cachedCwd;
@@ -38,6 +38,15 @@ var cachedProjectRoot = "";
38
38
  function projectRootFor(cwd) {
39
39
  if (existsSync(join(cwd, "storage", "framework")))
40
40
  return cwd;
41
+ const manifest = join(cwd, "package.json");
42
+ if (existsSync(manifest)) {
43
+ if (existsSync(join(cwd, "config", "app.ts")))
44
+ return cwd;
45
+ try {
46
+ if (JSON.parse(readFileSync(manifest, "utf8")).stacks?.type === "native")
47
+ return cwd;
48
+ } catch {}
49
+ }
41
50
  const segments = cwd.split(sep);
42
51
  const candidates = [];
43
52
  for (let i = segments.length - 1;i > 0; i--) {
@@ -480,7 +489,7 @@ function defaultsPackagePath(projectRoot = projectPath()) {
480
489
  }
481
490
  function manifestVersion(packageRoot) {
482
491
  try {
483
- const version = JSON.parse(readFileSync(join2(packageRoot, "package.json"), "utf8"))?.version;
492
+ const version = JSON.parse(readFileSync2(join2(packageRoot, "package.json"), "utf8"))?.version;
484
493
  return typeof version === "string" ? version : null;
485
494
  } catch {
486
495
  return null;
@@ -513,7 +522,7 @@ function inspectDefaultsProvenance(projectRoot = projectPath()) {
513
522
  return notApplicable();
514
523
  let marker = null;
515
524
  try {
516
- const raw = JSON.parse(readFileSync(join2(targetDefaults, DEFAULTS_SYNC_MARKER), "utf8"));
525
+ const raw = JSON.parse(readFileSync2(join2(targetDefaults, DEFAULTS_SYNC_MARKER), "utf8"));
517
526
  if (typeof raw?.version === "string")
518
527
  marker = { version: raw.version, syncedAt: typeof raw.syncedAt === "string" ? raw.syncedAt : "" };
519
528
  } catch {}
package/dist/project.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/project.ts
3
- import { existsSync, lstatSync, realpathSync, rmSync, symlinkSync } from "fs";
3
+ import { existsSync, lstatSync, readFileSync, realpathSync, rmSync, symlinkSync } from "fs";
4
4
  import { dirname, join, relative, resolve, sep } from "path";
5
5
  import process from "process";
6
6
  var cachedCwd;
@@ -8,6 +8,15 @@ var cachedProjectRoot = "";
8
8
  function projectRootFor(cwd) {
9
9
  if (existsSync(join(cwd, "storage", "framework")))
10
10
  return cwd;
11
+ const manifest = join(cwd, "package.json");
12
+ if (existsSync(manifest)) {
13
+ if (existsSync(join(cwd, "config", "app.ts")))
14
+ return cwd;
15
+ try {
16
+ if (JSON.parse(readFileSync(manifest, "utf8")).stacks?.type === "native")
17
+ return cwd;
18
+ } catch {}
19
+ }
11
20
  const segments = cwd.split(sep);
12
21
  const candidates = [];
13
22
  for (let i = segments.length - 1;i > 0; i--) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/path",
3
3
  "type": "module",
4
- "version": "0.75.329",
4
+ "version": "0.75.334",
5
5
  "description": "The Stacks path.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [