@absolutejs/absolute 0.20.0-beta.177 → 0.20.0-beta.178

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/changelog.json +51 -0
  3. package/dist/angular/browser.js +17 -2
  4. package/dist/angular/browser.js.map +4 -4
  5. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  6. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  7. package/dist/angular/index.js +57 -33
  8. package/dist/angular/index.js.map +9 -8
  9. package/dist/angular/server.js +57 -33
  10. package/dist/angular/server.js.map +9 -8
  11. package/dist/build.js +532 -416
  12. package/dist/build.js.map +15 -15
  13. package/dist/cli/{compile-w2z6c9vt.js → compile-p5yv6ecp.js} +2 -2
  14. package/dist/cli/config/server.js +45 -12
  15. package/dist/cli/{dev-8br5mr7t.js → dev-2hbcsvkp.js} +1 -1
  16. package/dist/cli/{index-420h9hq7.js → index-1ewba8ye.js} +32 -3
  17. package/dist/cli/{index-7z1hh3fg.js → index-9dzdbbfc.js} +1 -1
  18. package/dist/cli/index.js +7 -7
  19. package/dist/cli/{islands-bx67g15t.js → islands-6zgb7501.js} +1 -1
  20. package/dist/cli/{mobile-we5q51ey.js → mobile-c92dh8s2.js} +2 -2
  21. package/dist/cli/{start-srs11bm8.js → start-asxb79rc.js} +2 -2
  22. package/dist/cli/{typecheck-7fvww3b7.js → typecheck-m2j4tkdk.js} +165 -35
  23. package/dist/client/chunks/{index-8m2qq61n.js → index-58svs66p.js} +13 -3
  24. package/dist/client/chunks/{index-8m2qq61n.js.map → index-58svs66p.js.map} +5 -4
  25. package/dist/client/chunks/{islands-mfjmdwnb.js → islands-tcadmgcx.js} +3 -6
  26. package/dist/client/chunks/{islands-mfjmdwnb.js.map → islands-tcadmgcx.js.map} +3 -4
  27. package/dist/client/chunks/{react-sprprqzs.js → react-khr6ewhr.js} +2 -2
  28. package/dist/client/index.js +82 -6
  29. package/dist/client/index.js.map +7 -6
  30. package/dist/dev/client/handlers/islands.ts +2 -0
  31. package/dist/dev/client/handlers/react.ts +92 -111
  32. package/dist/dev/client/handlers/reactUpdateQueue.ts +153 -0
  33. package/dist/index.js +505 -389
  34. package/dist/index.js.map +15 -15
  35. package/dist/islands/browser.js +2 -2
  36. package/dist/islands/browser.js.map +3 -3
  37. package/dist/islands/index.js +13 -6
  38. package/dist/islands/index.js.map +6 -5
  39. package/dist/react/browser.js +113 -12
  40. package/dist/react/browser.js.map +10 -7
  41. package/dist/react/components/index.js +31 -7
  42. package/dist/react/components/index.js.map +5 -4
  43. package/dist/react/components/server/index.js +22 -6
  44. package/dist/react/index.js +190 -46
  45. package/dist/react/index.js.map +15 -11
  46. package/dist/react/server.js +82 -23
  47. package/dist/react/server.js.map +11 -9
  48. package/dist/src/build/compileSvelte.d.ts +12 -1
  49. package/dist/src/build/compileVue.d.ts +1 -0
  50. package/dist/src/build/islandEntries.d.ts +3 -1
  51. package/dist/src/cli/scripts/typecheck.d.ts +8 -0
  52. package/dist/src/cli/scripts/typecheckDiagnostics.d.ts +17 -0
  53. package/dist/src/client/preserveIslandMarkup.d.ts +4 -0
  54. package/dist/src/core/islandManifest.d.ts +6 -0
  55. package/dist/src/core/islandStylesheet.d.ts +17 -0
  56. package/dist/src/react/Island.d.ts +9 -2
  57. package/dist/src/react/IslandStyleLink.d.ts +11 -0
  58. package/dist/src/react/createIsland.d.ts +1 -1
  59. package/dist/src/react/serverComponents/nodeRendererRef.d.ts +13 -0
  60. package/dist/src/utils/requestRenderUrl.d.ts +1 -0
  61. package/dist/src/utils/resolveConvention.d.ts +1 -0
  62. package/dist/src/vue/Island.browser.d.ts +3 -1
  63. package/dist/src/vue/Island.d.ts +2 -2
  64. package/dist/src/vue/createIsland.browser.d.ts +2 -2
  65. package/dist/src/vue/createIsland.d.ts +2 -2
  66. package/dist/src/vue/islandStyleLink.d.ts +30 -0
  67. package/dist/svelte/browser.js +2 -2
  68. package/dist/svelte/browser.js.map +3 -3
  69. package/dist/svelte/index.js +51 -49
  70. package/dist/svelte/index.js.map +9 -8
  71. package/dist/svelte/server.js +48 -45
  72. package/dist/svelte/server.js.map +8 -7
  73. package/dist/types/globals.d.ts +3 -0
  74. package/dist/vue/browser.js +105 -10
  75. package/dist/vue/browser.js.map +10 -7
  76. package/dist/vue/index.js +170 -47
  77. package/dist/vue/index.js.map +14 -11
  78. package/dist/vue/server.js +81 -22
  79. package/dist/vue/server.js.map +9 -7
  80. package/package.json +1 -1
  81. /package/dist/cli/{index-6522t968.js → index-yd672jyq.js} +0 -0
  82. /package/dist/client/chunks/{react-sprprqzs.js.map → react-khr6ewhr.js.map} +0 -0
@@ -35,7 +35,7 @@ import {
35
35
  } from "./index-2bxfhs32.js";
36
36
  import {
37
37
  withBuildDirectoryLock
38
- } from "./index-420h9hq7.js";
38
+ } from "./index-1ewba8ye.js";
39
39
  import {
40
40
  loadConfig
41
41
  } from "./index-wk0pyxrg.js";
@@ -45,7 +45,7 @@ import {
45
45
  } from "./index-tx0kx9zx.js";
46
46
  import {
47
47
  loadIslandRegistryBuildInfo
48
- } from "./index-6522t968.js";
48
+ } from "./index-yd672jyq.js";
49
49
  import {
50
50
  stripStringsAndComments
51
51
  } from "./index-prs14ys9.js";
@@ -46255,6 +46255,18 @@ var TIME_PRECISION = 2;
46255
46255
  var TWO_THIRDS = 2 / 3;
46256
46256
  var UNFOUND_INDEX = -1;
46257
46257
 
46258
+ // src/utils/requestRenderUrl.ts
46259
+ var requestRenderUrl = (request) => {
46260
+ if (!request)
46261
+ return;
46262
+ try {
46263
+ const parsed = new URL(request.url);
46264
+ return `${parsed.pathname.replace(/\/{2,}/g, "/")}${parsed.search}`;
46265
+ } catch {
46266
+ return;
46267
+ }
46268
+ };
46269
+
46258
46270
  // src/utils/cspNonceRef.ts
46259
46271
  var GETTER_KEY = Symbol.for("absolutejs.cspNonceGetter");
46260
46272
  var nonceAttr = (nonce = readCspNonce()) => nonce ? ` nonce="${nonce}"` : "";
@@ -46395,7 +46407,11 @@ var logWarn = (message) => {
46395
46407
  // src/core/islandManifest.ts
46396
46408
  var ISLAND_BOOTSTRAP_MANIFEST_KEY = "AbsoluteIslandBootstrap";
46397
46409
  var LEGACY_ISLAND_BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
46410
+ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1);
46398
46411
  var getIslandBootstrapPath = (manifest) => manifest[ISLAND_BOOTSTRAP_MANIFEST_KEY] ?? manifest[LEGACY_ISLAND_BOOTSTRAP_MANIFEST_KEY];
46412
+ var ISLAND_STYLE_PREFIX = "IslandStyle";
46413
+ var getIslandStyleManifestEntries = (manifest) => Object.entries(manifest).filter(([key]) => key.startsWith(ISLAND_STYLE_PREFIX));
46414
+ var getIslandStyleManifestKey = (framework, component) => `${ISLAND_STYLE_PREFIX}${toIslandFrameworkSegment(framework)}${component}`;
46399
46415
 
46400
46416
  // src/core/islandPageContext.ts
46401
46417
  var ISLAND_MARKER = 'data-island="true"';
@@ -46443,12 +46459,38 @@ var toBrowserManifest = (manifest) => {
46443
46459
  }
46444
46460
  return browserManifest;
46445
46461
  };
46446
- var buildIslandsHeadMarkup = (manifest) => {
46462
+ var ISLAND_MARKER_TAG = /<[^>]*\bdata-island="true"[^>]*>/g;
46463
+ var ISLAND_FRAMEWORKS = [
46464
+ "react",
46465
+ "svelte",
46466
+ "vue",
46467
+ "angular"
46468
+ ];
46469
+ var readMarkerAttribute = (tag, name) => new RegExp(`\\b${name}="([^"]*)"`).exec(tag)?.[1]?.replaceAll("&quot;", '"').replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
46470
+ var toIslandFramework = (value) => ISLAND_FRAMEWORKS.find((framework) => framework === value);
46471
+ var collectRenderedIslandStyleKeys = (html) => {
46472
+ const keys = new Set;
46473
+ for (const [tag] of html.matchAll(ISLAND_MARKER_TAG)) {
46474
+ const framework = toIslandFramework(readMarkerAttribute(tag, "data-framework"));
46475
+ const component = readMarkerAttribute(tag, "data-component");
46476
+ if (framework && component)
46477
+ keys.add(getIslandStyleManifestKey(framework, component));
46478
+ }
46479
+ return keys;
46480
+ };
46481
+ var buildIslandStyleLinks = (manifest, html) => {
46482
+ if (html === undefined)
46483
+ return "";
46484
+ const renderedKeys = collectRenderedIslandStyleKeys(html);
46485
+ return getIslandStyleManifestEntries(manifest).filter(([key]) => renderedKeys.has(key)).filter(([, href]) => !html.includes(`href="${href}"`)).map(([key, href]) => `<link rel="stylesheet" href="${href}" data-island-style="${key}"${nonceAttr()}>`).join("");
46486
+ };
46487
+ var buildIslandsHeadMarkup = (manifest, html) => {
46488
+ const styleLinks = buildIslandStyleLinks(manifest, html);
46447
46489
  const manifestScript = `<script${nonceAttr()}>window.__ABSOLUTE_MANIFEST__ = ${escapeScriptContent(JSON.stringify(toBrowserManifest(manifest)))}</script>`;
46448
46490
  const islandStateScript = `<script${nonceAttr()}>window.__ABS_ISLAND_STATE__ = ${escapeScriptContent(JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {}))}</script>`;
46449
46491
  const bootstrapPath = getIslandBootstrapPath(manifest);
46450
46492
  const bootstrapScript = bootstrapPath ? `<script${nonceAttr()} type="module" src="${bootstrapPath}"></script>` : "";
46451
- return `${manifestScript}${islandStateScript}${bootstrapScript}`;
46493
+ return `${styleLinks}${manifestScript}${islandStateScript}${bootstrapScript}`;
46452
46494
  };
46453
46495
  var injectHeadMarkup = (html, markup) => {
46454
46496
  const closingHeadIndex = html.indexOf("</head>");
@@ -48530,16 +48572,7 @@ var BROWSER_TRANSLATION_BASELINE_SCRIPT = "window.__ABSOLUTE_SSR_TEXT_BASELINES_
48530
48572
 
48531
48573
  // src/react/pageHandler.ts
48532
48574
  var withRequestUrl = (props, url) => Object.assign(Object.create(null), props, { url });
48533
- var resolveRequestPathname = (request) => {
48534
- if (!request)
48535
- return;
48536
- try {
48537
- const parsed = new URL(request.url);
48538
- return `${parsed.pathname}${parsed.search}`;
48539
- } catch {
48540
- return;
48541
- }
48542
- };
48575
+ var resolveRequestPathname = (request) => requestRenderUrl(request);
48543
48576
  var buildRefreshSetup = () => {
48544
48577
  if (isProductionRuntime()) {
48545
48578
  return "";
@@ -25,7 +25,7 @@ import"./index-43a1vvb7.js";
25
25
  import {
26
26
  updateLockMetadata,
27
27
  acquireBuildDirectoryLock
28
- } from "./index-420h9hq7.js";
28
+ } from "./index-1ewba8ye.js";
29
29
  import {
30
30
  instanceLogPath,
31
31
  deregisterInstance,
@@ -1,7 +1,13 @@
1
1
  // @bun
2
2
  // src/utils/buildDirectoryLock.ts
3
- import { mkdirSync, unlinkSync, writeFileSync, readFileSync } from "fs";
4
- import { dirname, join } from "path";
3
+ import {
4
+ mkdirSync,
5
+ readFileSync,
6
+ realpathSync,
7
+ unlinkSync,
8
+ writeFileSync
9
+ } from "fs";
10
+ import { dirname, join, resolve } from "path";
5
11
  var heldLocks = new Map;
6
12
  var HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS";
7
13
  var exitHandlersRegistered = false;
@@ -54,6 +60,14 @@ var unmarkHeldLock = (buildDirectory) => {
54
60
  locks.delete(buildDirectory);
55
61
  writeHeldLockEnv(locks);
56
62
  };
63
+ var lockProjectRoot = (buildDirectory) => {
64
+ const projectRoot = dirname(resolve(buildDirectory));
65
+ try {
66
+ return realpathSync.native(projectRoot);
67
+ } catch {
68
+ return projectRoot;
69
+ }
70
+ };
57
71
  var writeLockFileSync = (lockPath, metadata) => {
58
72
  mkdirSync(dirname(lockPath), { recursive: true });
59
73
  writeFileSync(lockPath, JSON.stringify(metadata, null, 2), { flag: "wx" });
@@ -63,11 +77,13 @@ var readLockMetadata = (lockPath) => {
63
77
  const raw = readFileSync(lockPath, "utf-8");
64
78
  const parsed = JSON.parse(raw);
65
79
  if (typeof parsed === "object" && parsed !== null && typeof parsed.pid === "number") {
66
- return {
80
+ const metadata = {
67
81
  pid: parsed.pid,
68
82
  port: typeof parsed.port === "number" ? parsed.port : null,
83
+ projectRoot: typeof parsed.projectRoot === "string" ? parsed.projectRoot : undefined,
69
84
  startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : new Date().toISOString()
70
85
  };
86
+ return metadata;
71
87
  }
72
88
  } catch {}
73
89
  return null;
@@ -91,6 +107,12 @@ var removeStaleLockSync = (lockPath, pid) => {
91
107
  console.warn(`[absolutejs] removed stale lock from PID ${pid}`);
92
108
  } catch {}
93
109
  };
110
+ var removeForeignLockSync = (lockPath, existing) => {
111
+ try {
112
+ unlinkSync(lockPath);
113
+ console.warn(`[absolutejs] removed a build lock copied from ${existing.projectRoot} (PID ${existing.pid} holds the original project, not this one)`);
114
+ } catch {}
115
+ };
94
116
  var updateLockMetadata = (buildDirectory, updates) => {
95
117
  const lockPath = lockPathForBuildDirectory(buildDirectory);
96
118
  const current = readLockMetadata(lockPath);
@@ -102,6 +124,7 @@ var updateLockMetadata = (buildDirectory, updates) => {
102
124
  const next = {
103
125
  pid: updates.pid ?? current.pid,
104
126
  port: updates.port !== undefined ? updates.port : current.port,
127
+ projectRoot: current.projectRoot,
105
128
  startedAt: current.startedAt
106
129
  };
107
130
  try {
@@ -131,9 +154,11 @@ var acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
131
154
  const waitTimeoutMs = options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
132
155
  const start = Date.now();
133
156
  const tryCreate = () => {
157
+ mkdirSync(dirname(lockPath), { recursive: true });
134
158
  writeLockFileSync(lockPath, {
135
159
  pid: process.pid,
136
160
  port: options.port ?? null,
161
+ projectRoot: lockProjectRoot(buildDirectory),
137
162
  startedAt: new Date().toISOString()
138
163
  });
139
164
  };
@@ -155,6 +180,10 @@ var acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
155
180
  removeStaleLockSync(lockPath, existing.pid);
156
181
  continue;
157
182
  }
183
+ if (existing.projectRoot !== undefined && existing.projectRoot !== lockProjectRoot(buildDirectory)) {
184
+ removeForeignLockSync(lockPath, existing);
185
+ continue;
186
+ }
158
187
  if (wait && Date.now() - start < waitTimeoutMs) {
159
188
  await Bun.sleep(LOCK_POLL_MS);
160
189
  continue;
@@ -29,7 +29,7 @@ import {
29
29
  } from "./index-wk0pyxrg.js";
30
30
  import {
31
31
  loadIslandRegistryBuildInfo
32
- } from "./index-6522t968.js";
32
+ } from "./index-yd672jyq.js";
33
33
  import {
34
34
  stripStringsAndComments
35
35
  } from "./index-prs14ys9.js";
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-8br5mr7t.js");
57
+ const { dev } = await import("./dev-2hbcsvkp.js");
58
58
  await dev(serverEntry, configPath, {
59
59
  androidDevice,
60
60
  eager: args.includes("--eager"),
@@ -70,7 +70,7 @@ if (command === "dev") {
70
70
  const configPath = parseNamedArg("--config");
71
71
  const positionalArgs = stripNamedArgs("--outdir", "--config").filter((arg) => arg !== "--prebuilt");
72
72
  const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
73
- const { start } = await import("./start-srs11bm8.js");
73
+ const { start } = await import("./start-asxb79rc.js");
74
74
  await start(serverEntry, outdir, configPath, {
75
75
  prebuilt: args.includes("--prebuilt")
76
76
  });
@@ -80,7 +80,7 @@ if (command === "dev") {
80
80
  const configPath = parseNamedArg("--config");
81
81
  const positionalArgs = stripNamedArgs("--outdir", "--config");
82
82
  const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
83
- const { start } = await import("./start-srs11bm8.js");
83
+ const { start } = await import("./start-asxb79rc.js");
84
84
  await start(serverEntry, outdir, configPath, { prepareOnly: true });
85
85
  } else if (command === "build") {
86
86
  sendTelemetryEvent("cli:command", { command });
@@ -188,7 +188,7 @@ if (command === "dev") {
188
188
  await runInspect(args);
189
189
  } else if (command === "islands") {
190
190
  sendTelemetryEvent("cli:command", { command: "islands" });
191
- const { runIslands } = await import("./islands-bx67g15t.js");
191
+ const { runIslands } = await import("./islands-6zgb7501.js");
192
192
  await runIslands(args);
193
193
  } else if (command === "info") {
194
194
  sendTelemetryEvent("cli:command", { command });
@@ -205,13 +205,13 @@ if (command === "dev") {
205
205
  const configPath = parseNamedArg("--config");
206
206
  const positionalArgs = stripNamedArgs("--outdir", "--outfile", "--config");
207
207
  const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
208
- const { compile } = await import("./compile-w2z6c9vt.js");
208
+ const { compile } = await import("./compile-p5yv6ecp.js");
209
209
  await compile(serverEntry, outdir, outfile, configPath);
210
210
  } else if (command === "mobile") {
211
211
  sendTelemetryEvent("cli:command", {
212
212
  command: `mobile:${workspaceCommand ?? "unknown"}`
213
213
  });
214
- const { runMobile } = await import("./mobile-we5q51ey.js");
214
+ const { runMobile } = await import("./mobile-c92dh8s2.js");
215
215
  try {
216
216
  await runMobile(args);
217
217
  } catch (error) {
@@ -221,7 +221,7 @@ if (command === "dev") {
221
221
  } else if (command === "typecheck") {
222
222
  sendTelemetryEvent("cli:command", { command });
223
223
  const configPath = parseNamedArg("--config");
224
- const { typecheck } = await import("./typecheck-7fvww3b7.js");
224
+ const { typecheck } = await import("./typecheck-m2j4tkdk.js");
225
225
  await typecheck(configPath);
226
226
  } else if (command === "migrate") {
227
227
  sendTelemetryEvent("cli:command", { command });
@@ -15,7 +15,7 @@ import {
15
15
  getIslandManifestKey,
16
16
  resolveIslandSourceFile,
17
17
  loadIslandRegistryBuildInfo
18
- } from "./index-6522t968.js";
18
+ } from "./index-yd672jyq.js";
19
19
 
20
20
  // src/cli/scripts/islands.ts
21
21
  import { existsSync as existsSync2, readFileSync as readFileSync2, statSync } from "fs";
@@ -79,7 +79,7 @@ import {
79
79
  } from "./index-prza6tkp.js";
80
80
  import {
81
81
  start2
82
- } from "./index-7z1hh3fg.js";
82
+ } from "./index-9dzdbbfc.js";
83
83
  import {
84
84
  captureAbsoluteRemoteMacCommand2,
85
85
  getAbsoluteRemoteMacProfile2,
@@ -99,7 +99,7 @@ import {
99
99
  import {
100
100
  formatBytes
101
101
  } from "./index-7854xf0m.js";
102
- import"./index-6522t968.js";
102
+ import"./index-yd672jyq.js";
103
103
  import {
104
104
  sendTelemetryEvent
105
105
  } from "./index-qyxd5n9a.js";
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  start2
4
- } from "./index-7z1hh3fg.js";
4
+ } from "./index-9dzdbbfc.js";
5
5
  import"./index-zyd80s3h.js";
6
- import"./index-6522t968.js";
6
+ import"./index-yd672jyq.js";
7
7
  import"./index-71gchbzt.js";
8
8
  import"./index-wk0pyxrg.js";
9
9
  import"./index-qyxd5n9a.js";