@absolutejs/absolute 0.20.0-beta.140 → 0.20.0-beta.143

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,11 +1,12 @@
1
1
  // @bun
2
+ import {
3
+ isTestSourcePath,
4
+ isWorkspacePackageSpecifier
5
+ } from "./index-6vpdsqa1.js";
2
6
  import"./index-fgz435qn.js";
3
7
  import {
4
8
  devProfileEnabled
5
9
  } from "./index-ys2rzqhg.js";
6
- import {
7
- isTestSourcePath
8
- } from "./index-65kqn88a.js";
9
10
  import"./index-kye08pjx.js";
10
11
 
11
12
  // src/build/buildDepVendor.ts
@@ -61,7 +62,7 @@ var FRAMEWORK_EXTERNALS = [
61
62
  ...FRAMEWORK_NAMESPACE_PREFIXES.map((prefix) => `${prefix}*`)
62
63
  ];
63
64
  var isSkippedFile = (file) => file.includes("node_modules") || file.includes("/build/") || file.includes("/dist/") || file.includes("/indexes/") || isTestSourcePath(file);
64
- var isDepSpecifier = (path) => isBareSpecifier(path) && !isBuiltin(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path);
65
+ var isDepSpecifier = (path) => isBareSpecifier(path) && !isBuiltin(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path) && !isWorkspacePackageSpecifier(path);
65
66
  var isFrameworkRootCandidate = (path) => isBareSpecifier(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path);
66
67
  var readFileSpecifiers = async (file, transpiler) => {
67
68
  const dep = [];
@@ -9,6 +9,11 @@ import {
9
9
  SIGTERM_EXIT_CODE,
10
10
  UNFOUND_INDEX
11
11
  } from "./index-fgz435qn.js";
12
+ import {
13
+ isTestSourcePath,
14
+ isWorkspacePackageSpecifier,
15
+ workspacePackageDirs
16
+ } from "./index-6vpdsqa1.js";
12
17
  import {
13
18
  bootTimelineChildEnv,
14
19
  markBoot
@@ -52,9 +57,6 @@ import {
52
57
  import {
53
58
  sendTelemetryEvent
54
59
  } from "./index-qyxd5n9a.js";
55
- import {
56
- isTestSourcePath
57
- } from "./index-65kqn88a.js";
58
60
  import {
59
61
  COMPOSE_PATH,
60
62
  isWSLEnvironment,
@@ -299,7 +301,7 @@ var resolveBuildPaths = (config) => {
299
301
  };
300
302
 
301
303
  // src/dev/dependencyGraph.ts
302
- import { existsSync, readFileSync } from "fs";
304
+ import { existsSync, readFileSync, realpathSync as realpathSync2 } from "fs";
303
305
  var {Glob } = globalThis.Bun;
304
306
  import { resolve as resolve2 } from "path";
305
307
  var emptyDependencyGraph = {
@@ -319,10 +321,16 @@ var loaderForFile = (filePath) => {
319
321
  return null;
320
322
  };
321
323
  var resolveImportPath = (importPath, fromFile) => {
324
+ const fromDir = resolve2(fromFile, "..");
322
325
  if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
323
- return null;
326
+ if (!isWorkspacePackageSpecifier(importPath, fromDir))
327
+ return null;
328
+ try {
329
+ return realpathSync2(Bun.resolveSync(importPath, fromDir));
330
+ } catch {
331
+ return null;
332
+ }
324
333
  }
325
- const fromDir = resolve2(fromFile, "..");
326
334
  const normalized = resolve2(fromDir, importPath);
327
335
  const extensions = [
328
336
  ".ts",
@@ -649,6 +657,11 @@ var collectPositiveWatchRoots = (config, resolved) => {
649
657
  const extraDirs = config.dev?.watchDirs ?? [];
650
658
  for (const dir of extraDirs)
651
659
  push(dir);
660
+ for (const dir of workspacePackageDirs(cwd)) {
661
+ const abs = normalizePath(dir);
662
+ if (!roots.includes(abs))
663
+ roots.push(abs);
664
+ }
652
665
  if (cfg.angularDir) {
653
666
  const resourceDirs = collectAngularResourceDirs(cfg.angularDir);
654
667
  for (const dir of resourceDirs) {
@@ -690,7 +703,7 @@ var getWatchPaths = (config, resolved) => {
690
703
  }
691
704
  return paths;
692
705
  };
693
- var HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|dist)(\/|$)/;
706
+ var HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|test-results|playwright-report|blob-report|\.playwright-mcp|\.playwright-artifacts(?:-[^/]+)?|dist)(\/|$)/;
694
707
  var shouldIgnorePath = (path, resolved) => {
695
708
  const normalized = path.replace(/\\/g, "/");
696
709
  if (resolved?.stylesDir) {
@@ -762,7 +775,7 @@ var serializeDependencies = (graph) => {
762
775
  return dependencies;
763
776
  };
764
777
  var computePayload = async (config, vendorSourceDirs) => {
765
- const { computeDepVendorPaths } = await import("./buildDepVendor-bpac1bhq.js");
778
+ const { computeDepVendorPaths } = await import("./buildDepVendor-e2zz9x78.js");
766
779
  const vendors = computeDepVendorPaths(vendorSourceDirs);
767
780
  const graph = {
768
781
  dependencies: new Map,
@@ -0,0 +1,50 @@
1
+ // @bun
2
+ // src/utils/isTestSourcePath.ts
3
+ var isTestSourcePath = (file) => {
4
+ const normalized = file.replace(/\\/g, "/");
5
+ return normalized.includes("/__tests__/") || /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(normalized);
6
+ };
7
+
8
+ // src/build/workspacePackages.ts
9
+ import { readFileSync, realpathSync } from "fs";
10
+ import { join, sep } from "path";
11
+ var NODE_MODULES_SEGMENT = `${sep}node_modules${sep}`;
12
+ var verdicts = new Map;
13
+ var isWorkspacePackageSpecifier = (specifier, projectRoot = process.cwd()) => {
14
+ const key = `${projectRoot}\x00${specifier}`;
15
+ const known = verdicts.get(key);
16
+ if (known !== undefined)
17
+ return known;
18
+ let verdict = false;
19
+ try {
20
+ const resolved = realpathSync(Bun.resolveSync(specifier, projectRoot));
21
+ verdict = !resolved.includes(NODE_MODULES_SEGMENT);
22
+ } catch {
23
+ verdict = false;
24
+ }
25
+ verdicts.set(key, verdict);
26
+ return verdict;
27
+ };
28
+ var workspacePackageDirs = (projectRoot = process.cwd()) => {
29
+ let manifest;
30
+ try {
31
+ manifest = JSON.parse(readFileSync(join(projectRoot, "package.json"), "utf-8"));
32
+ } catch {
33
+ return [];
34
+ }
35
+ const names = ["dependencies", "devDependencies", "optionalDependencies"].flatMap((field) => {
36
+ const deps = manifest[field];
37
+ return deps && typeof deps === "object" ? Object.keys(deps) : [];
38
+ });
39
+ const dirs = new Set;
40
+ for (const name of names) {
41
+ try {
42
+ const linked = realpathSync(join(projectRoot, "node_modules", name));
43
+ if (!`${linked}${sep}`.includes(NODE_MODULES_SEGMENT))
44
+ dirs.add(linked);
45
+ } catch {}
46
+ }
47
+ return [...dirs];
48
+ };
49
+
50
+ export { isTestSourcePath, isWorkspacePackageSpecifier, workspacePackageDirs };
package/dist/cli/index.js CHANGED
@@ -54,7 +54,7 @@ if (command === "dev") {
54
54
  }
55
55
  const positionalArgs = stripNamedArgs("--config", "--android-device", "--ios-device").filter((arg) => arg !== "--no-mobile" && arg !== "--eager");
56
56
  const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
57
- const { dev } = await import("./dev-4ps2yg1z.js");
57
+ const { dev } = await import("./dev-e4w5nq6y.js");
58
58
  await dev(serverEntry, configPath, {
59
59
  androidDevice,
60
60
  eager: args.includes("--eager"),
@@ -701,6 +701,35 @@ var init_hotResources = __esm(() => {
701
701
  };
702
702
  });
703
703
 
704
+ // src/build/workspacePackages.ts
705
+ import { readFileSync as readFileSync2, realpathSync } from "fs";
706
+ import { join as join2, sep } from "path";
707
+ var NODE_MODULES_SEGMENT, verdicts, workspacePackageDirs = (projectRoot = process.cwd()) => {
708
+ let manifest;
709
+ try {
710
+ manifest = JSON.parse(readFileSync2(join2(projectRoot, "package.json"), "utf-8"));
711
+ } catch {
712
+ return [];
713
+ }
714
+ const names = ["dependencies", "devDependencies", "optionalDependencies"].flatMap((field) => {
715
+ const deps = manifest[field];
716
+ return deps && typeof deps === "object" ? Object.keys(deps) : [];
717
+ });
718
+ const dirs = new Set;
719
+ for (const name of names) {
720
+ try {
721
+ const linked = realpathSync(join2(projectRoot, "node_modules", name));
722
+ if (!`${linked}${sep}`.includes(NODE_MODULES_SEGMENT))
723
+ dirs.add(linked);
724
+ } catch {}
725
+ }
726
+ return [...dirs];
727
+ };
728
+ var init_workspacePackages = __esm(() => {
729
+ NODE_MODULES_SEGMENT = `${sep}node_modules${sep}`;
730
+ verdicts = new Map;
731
+ });
732
+
704
733
  // src/dev/hot/analyze.ts
705
734
  import { dirname, extname } from "path";
706
735
  var ANALYZER_VERSION = 1, hashText = (text) => Bun.hash(text).toString(36), scriptKindFor = (tsc, path) => {
@@ -172530,11 +172559,11 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
172530
172559
  });
172531
172560
 
172532
172561
  // src/dev/hot/plugin.ts
172533
- import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, realpathSync, writeFileSync } from "fs";
172534
- import { extname as extname2, join as join2, relative as relative2, resolve as resolve2, sep } from "path";
172562
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, realpathSync as realpathSync2, writeFileSync } from "fs";
172563
+ import { extname as extname2, join as join3, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
172535
172564
  var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LOADERS, loaderFor = (path) => LOADERS[extname2(path)] ?? TS_LOADER, realPath = (path) => {
172536
172565
  try {
172537
- return realpathSync(path);
172566
+ return realpathSync2(path);
172538
172567
  } catch {
172539
172568
  return path;
172540
172569
  }
@@ -172548,13 +172577,14 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172548
172577
  const file = realPath(path);
172549
172578
  if (!SOURCE.test(file))
172550
172579
  return false;
172551
- if (!file.startsWith(`${state.root}${sep}`))
172580
+ const root = [state.root, ...state.extraRoots ?? []].find((candidate) => file.startsWith(`${candidate}${sep2}`));
172581
+ if (root === undefined)
172552
172582
  return false;
172553
- if (file.startsWith(`${ABSOLUTE_ROOT}${sep}src${sep}`))
172583
+ if (file.startsWith(`${ABSOLUTE_ROOT}${sep2}src${sep2}`))
172554
172584
  return false;
172555
- if (file.startsWith(`${ABSOLUTE_ROOT}${sep}dist${sep}`))
172585
+ if (file.startsWith(`${ABSOLUTE_ROOT}${sep2}dist${sep2}`))
172556
172586
  return false;
172557
- if (GENERATED.test(file.slice(state.root.length)))
172587
+ if (GENERATED.test(file.slice(root.length)))
172558
172588
  return false;
172559
172589
  if (TEST_FILE.test(file))
172560
172590
  return false;
@@ -172562,7 +172592,7 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172562
172592
  return false;
172563
172593
  if (isAbsoluteServerEntryCopyPath(file))
172564
172594
  return false;
172565
- return !state.excludedDirs.some((dir) => file === dir || file.startsWith(`${dir}${sep}`));
172595
+ return !state.excludedDirs.some((dir) => file === dir || file.startsWith(`${dir}${sep2}`));
172566
172596
  }, isAnalysis = (value) => {
172567
172597
  if (typeof value !== "object" || value === null)
172568
172598
  return false;
@@ -172570,12 +172600,12 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172570
172600
  if (status === false)
172571
172601
  return typeof Reflect.get(value, "reason") === "string";
172572
172602
  return status === true && typeof Reflect.get(value, "code") === "string" && typeof Reflect.get(value, "exports") === "object" && Array.isArray(Reflect.get(value, "reexports")) && Array.isArray(Reflect.get(value, "plan"));
172573
- }, cachePath = (cacheDir, key) => join2(cacheDir, `${key}.json`), readCached = (key) => {
172603
+ }, cachePath = (cacheDir, key) => join3(cacheDir, `${key}.json`), readCached = (key) => {
172574
172604
  const state = shared.installed;
172575
172605
  if (!state)
172576
172606
  return;
172577
172607
  try {
172578
- const cached = JSON.parse(readFileSync2(cachePath(state.cacheDir, key), "utf-8"));
172608
+ const cached = JSON.parse(readFileSync3(cachePath(state.cacheDir, key), "utf-8"));
172579
172609
  return isAnalysis(cached) ? cached : undefined;
172580
172610
  } catch {
172581
172611
  return;
@@ -172602,14 +172632,14 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172602
172632
  analyses.set(canonicalPath, { analysis, source });
172603
172633
  return analysis;
172604
172634
  }, loadImplementation = async (canonicalPath, filePath) => {
172605
- const source = readFileSync2(filePath, "utf-8");
172635
+ const source = readFileSync3(filePath, "utf-8");
172606
172636
  const analysis = await analyzeSource(canonicalPath, source);
172607
172637
  if (!analysis.ok)
172608
172638
  return { contents: source, loader: loaderFor(filePath) };
172609
172639
  setAnalysis(canonicalPath, analysis, source);
172610
172640
  return { contents: analysis.code, loader: loaderFor(filePath) };
172611
172641
  }, loadFacade = async (path) => {
172612
- const source = readFileSync2(path, "utf-8");
172642
+ const source = readFileSync3(path, "utf-8");
172613
172643
  const analysis = await analyzeSource(path, source);
172614
172644
  if (!analysis.ok)
172615
172645
  return { contents: source, loader: loaderFor(path) };
@@ -172624,7 +172654,7 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172624
172654
  return false;
172625
172655
  }
172626
172656
  const root = realPath(resolve2(options.root));
172627
- const cacheDir = join2(root, ".absolutejs", "hot");
172657
+ const cacheDir = join3(root, ".absolutejs", "hot");
172628
172658
  mkdirSync2(cacheDir, { recursive: true });
172629
172659
  const installed = {
172630
172660
  ...options,
@@ -172632,6 +172662,7 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172632
172662
  configPath: realPath(resolve2(options.configPath)),
172633
172663
  entryPath: realPath(resolve2(options.entryPath)),
172634
172664
  excludedDirs: options.excludedDirs.map((dir) => realPath(resolve2(dir))),
172665
+ extraRoots: (options.extraRoots ?? []).map((dir) => realPath(resolve2(dir))).filter((dir) => dir !== root),
172635
172666
  root
172636
172667
  };
172637
172668
  shared.installed = installed;
@@ -172648,7 +172679,7 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172648
172679
  return loadImplementation(entryPath, filePath);
172649
172680
  if (!isHotManaged(filePath) || query && !HOT_QUERY.test(query))
172650
172681
  return {
172651
- contents: readFileSync2(filePath, "utf-8"),
172682
+ contents: readFileSync3(filePath, "utf-8"),
172652
172683
  loader: loaderFor(filePath)
172653
172684
  };
172654
172685
  const canonical = realPath(filePath);
@@ -172659,29 +172690,29 @@ var HOT_QUERY, SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, TS_LOADER = "ts", LO
172659
172690
  }
172660
172691
  });
172661
172692
  return true;
172662
- }, managedFilter = (options) => {
172693
+ }, managedPattern = (root, options) => {
172663
172694
  const under = (dir) => {
172664
- const rel = relative2(options.root, dir);
172695
+ const rel = relative2(root, dir);
172665
172696
  if (rel === "" || rel.startsWith(".."))
172666
172697
  return;
172667
- return `(?!${escapeRegex(rel).split(sep).join(SEPARATOR)}(?:${SEPARATOR}|\\?|$))`;
172698
+ return `(?!${escapeRegex(rel).split(sep2).join(SEPARATOR)}(?:${SEPARATOR}|\\?|$))`;
172668
172699
  };
172669
172700
  const excluded = [
172670
172701
  ...options.excludedDirs,
172671
- join2(ABSOLUTE_ROOT, "src"),
172672
- join2(ABSOLUTE_ROOT, "dist")
172702
+ join3(ABSOLUTE_ROOT, "src"),
172703
+ join3(ABSOLUTE_ROOT, "dist")
172673
172704
  ].map(under).filter((pattern) => pattern !== undefined);
172674
- const config = relative2(options.root, options.configPath);
172675
- const configPattern = config && !config.startsWith("..") ? `(?!${escapeRegex(config).split(sep).join(SEPARATOR)}(?:\\?|$))` : "";
172676
- return new RegExp([
172677
- `^${escapeRegex(options.root)}${SEPARATOR}`,
172705
+ const config = relative2(root, options.configPath);
172706
+ const configPattern = config && !config.startsWith("..") ? `(?!${escapeRegex(config).split(sep2).join(SEPARATOR)}(?:\\?|$))` : "";
172707
+ return [
172708
+ `^${escapeRegex(root)}${SEPARATOR}`,
172678
172709
  `(?!(?:[^?]*${SEPARATOR})?(?:node_modules|build|dist|generated|compiled|indexes|\\.absolutejs)${SEPARATOR})`,
172679
172710
  `(?![^?]*(?:\\.(?:spec|test)\\.[cm]?[jt]sx?|${SEPARATOR}__tests__${SEPARATOR}))`,
172680
172711
  ...excluded,
172681
172712
  configPattern,
172682
172713
  `[^?]*\\.(?:m?[jt]sx?|mts|cts)(?:\\?.*)?$`
172683
- ].join(""));
172684
- };
172714
+ ].join("");
172715
+ }, managedFilter = (options) => new RegExp([options.root, ...options.extraRoots ?? []].map((root) => `(?:${managedPattern(root, options)})`).join("|"));
172685
172716
  var init_plugin = __esm(() => {
172686
172717
  init_serverEntryCopies();
172687
172718
  init_analyze();
@@ -172737,6 +172768,7 @@ var configuredDirectories = async (configPath) => {
172737
172768
  configPath,
172738
172769
  entryPath,
172739
172770
  excludedDirs: await configuredDirectories(configPath),
172771
+ extraRoots: workspacePackageDirs(process.cwd()),
172740
172772
  root: process.cwd()
172741
172773
  });
172742
172774
  globalThis.__absoluteBackendHmr = installed;
@@ -172745,13 +172777,14 @@ var configuredDirectories = async (configPath) => {
172745
172777
  var init_install = __esm(() => {
172746
172778
  init_loadConfig();
172747
172779
  init_hotResources();
172780
+ init_workspacePackages();
172748
172781
  init_plugin();
172749
172782
  });
172750
172783
 
172751
172784
  // src/dev/serverBootstrap.ts
172752
172785
  init_constants();
172753
172786
  import { copyFileSync as copyFileSync2, existsSync as existsSync2, readdirSync, unlinkSync } from "fs";
172754
- import { dirname as dirname2, extname as extname3, join as join3, resolve as resolve4 } from "path";
172787
+ import { dirname as dirname2, extname as extname3, join as join4, resolve as resolve4 } from "path";
172755
172788
 
172756
172789
  // src/utils/bootTimeline.ts
172757
172790
  init_constants();
@@ -172934,7 +172967,7 @@ if (!isHotReevaluation) {
172934
172967
  }
172935
172968
  if (!isStaleAbsoluteServerEntryCopy(name))
172936
172969
  continue;
172937
- removeEntryCopy(join3(entryDir, name));
172970
+ removeEntryCopy(join4(entryDir, name));
172938
172971
  }
172939
172972
  }
172940
172973
  var entryCopies = globalThis.__absoluteEntryCopies ?? new Set;
@@ -172942,7 +172975,7 @@ globalThis.__absoluteEntryCopies = entryCopies;
172942
172975
  var createBootstrapCopy = () => {
172943
172976
  const sequence = (globalThis.__absoluteEntryBootstrapSequence ?? 0) + 1;
172944
172977
  globalThis.__absoluteEntryBootstrapSequence = sequence;
172945
- const path = join3(entryDir, `${copyPrefix}${process.pid}-bootstrap-${sequence}${entryExtension}`);
172978
+ const path = join4(entryDir, `${copyPrefix}${process.pid}-bootstrap-${sequence}${entryExtension}`);
172946
172979
  copyFileSync2(entryPath, path);
172947
172980
  entryCopies.add(path);
172948
172981
  return path;
@@ -172988,8 +173021,8 @@ if (!isHotReevaluation && !globalThis.__absoluteBunServer && process.env.ABSOLUT
172988
173021
  }
172989
173022
  }
172990
173023
  if (!isHotReevaluation && true && process.env.ABSOLUTE_DEV_PREBUILD !== "0" && process.env.ABSOLUTE_DEV_IMPORT_COST !== "1") {
172991
- const compiledRuntime = join3(import.meta.dir, "..", "index.js");
172992
- const runtimeEntry = existsSync2(compiledRuntime) ? compiledRuntime : join3(import.meta.dir, "..", "index.ts");
173024
+ const compiledRuntime = join4(import.meta.dir, "..", "index.js");
173025
+ const runtimeEntry = existsSync2(compiledRuntime) ? compiledRuntime : join4(import.meta.dir, "..", "index.ts");
172993
173026
  markBoot("prebuild import issued");
172994
173027
  import(runtimeEntry).then((runtime) => {
172995
173028
  markBoot("prebuild started");