@absolutejs/absolute 0.20.0-beta.174 → 0.20.0-beta.176

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 (84) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/changelog.json +76 -0
  3. package/dist/angular/browser.js +13 -2
  4. package/dist/angular/browser.js.map +3 -3
  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 +67 -8
  8. package/dist/angular/index.js.map +10 -8
  9. package/dist/angular/server.js +67 -8
  10. package/dist/angular/server.js.map +10 -8
  11. package/dist/build.js +315 -120
  12. package/dist/build.js.map +21 -19
  13. package/dist/cli/{compile-n6fs2vmx.js → compile-w2z6c9vt.js} +1 -1
  14. package/dist/cli/{dev-6h1f0mzq.js → dev-8br5mr7t.js} +16 -2
  15. package/dist/cli/{index-mqevg32w.js → index-6522t968.js} +21 -2
  16. package/dist/cli/{index-bhyd3ejc.js → index-7z1hh3fg.js} +1 -1
  17. package/dist/cli/index.js +6 -6
  18. package/dist/cli/{islands-vk05sj6v.js → islands-bx67g15t.js} +4 -4
  19. package/dist/cli/{mobile-62b6j3j7.js → mobile-we5q51ey.js} +2 -2
  20. package/dist/cli/{start-jh6kyp92.js → start-srs11bm8.js} +2 -2
  21. package/dist/client/chunks/index-4j1snyh2.js +18 -0
  22. package/dist/client/chunks/index-4j1snyh2.js.map +10 -0
  23. package/dist/client/chunks/{index-6b66nzyf.js → index-a3rpg5kw.js} +6 -16
  24. package/dist/client/chunks/{index-6b66nzyf.js.map → index-a3rpg5kw.js.map} +3 -4
  25. package/dist/client/chunks/{islands-s2ta5ajb.js → islands-mfjmdwnb.js} +11 -4
  26. package/dist/client/chunks/{islands-s2ta5ajb.js.map → islands-mfjmdwnb.js.map} +3 -3
  27. package/dist/client/chunks/{react-dcvkaba2.js → react-sprprqzs.js} +20 -4
  28. package/dist/client/chunks/react-sprprqzs.js.map +10 -0
  29. package/dist/client/chunks/svelte-6ewphsvj.js +30 -0
  30. package/dist/client/chunks/svelte-6ewphsvj.js.map +10 -0
  31. package/dist/client/chunks/{vue-a84fzp3v.js → vue-db6ppn1f.js} +14 -4
  32. package/dist/client/chunks/vue-db6ppn1f.js.map +10 -0
  33. package/dist/client/index.js +65 -8
  34. package/dist/client/index.js.map +4 -4
  35. package/dist/client/navigation.js +5 -3
  36. package/dist/client/navigation.js.map +2 -2
  37. package/dist/client/prefetch.js +1 -1
  38. package/dist/dev/client/handlers/islands.ts +85 -0
  39. package/dist/dev/client/hmrClient.ts +6 -0
  40. package/dist/index.js +460 -244
  41. package/dist/index.js.map +23 -21
  42. package/dist/islands/index.js +57 -10
  43. package/dist/islands/index.js.map +9 -7
  44. package/dist/react/browser.js +15 -4
  45. package/dist/react/browser.js.map +5 -5
  46. package/dist/react/components/client.js +506 -0
  47. package/dist/react/components/index.js +14 -15
  48. package/dist/react/components/index.js.map +4 -4
  49. package/dist/react/components/server/index.js +728 -0
  50. package/dist/react/hooks/index.js +14 -15
  51. package/dist/react/hooks/index.js.map +4 -4
  52. package/dist/react/index.js +66 -6
  53. package/dist/react/index.js.map +11 -9
  54. package/dist/react/router/browser.js +7 -8
  55. package/dist/react/router/browser.js.map +4 -4
  56. package/dist/react/router/index.js +7 -8
  57. package/dist/react/router/index.js.map +4 -4
  58. package/dist/react/server.js +14 -1
  59. package/dist/react/server.js.map +4 -4
  60. package/dist/src/build/buildReactServerComponents.d.ts +4 -0
  61. package/dist/src/build/islandEntries.d.ts +5 -0
  62. package/dist/src/client/hydrators/react.d.ts +7 -0
  63. package/dist/src/client/hydrators/svelte.d.ts +3 -0
  64. package/dist/src/client/hydrators/vue.d.ts +3 -0
  65. package/dist/src/client/preserveIslandMarkup.d.ts +5 -0
  66. package/dist/src/core/islandServerGeneration.d.ts +3 -0
  67. package/dist/src/react/components/client.d.ts +4 -0
  68. package/dist/src/react/components/server/index.d.ts +8 -0
  69. package/dist/src/react/serverComponents/constants.d.ts +2 -1
  70. package/dist/svelte/index.js +66 -6
  71. package/dist/svelte/index.js.map +10 -8
  72. package/dist/svelte/server.js +38 -3
  73. package/dist/svelte/server.js.map +6 -5
  74. package/dist/types/build.d.ts +3 -2
  75. package/dist/types/globals.d.ts +15 -0
  76. package/dist/vue/browser.js +26 -16
  77. package/dist/vue/browser.js.map +5 -5
  78. package/dist/vue/index.js +65 -21
  79. package/dist/vue/index.js.map +10 -9
  80. package/package.json +1 -1
  81. package/dist/client/chunks/react-dcvkaba2.js.map +0 -10
  82. package/dist/client/chunks/svelte-4yfa5bxa.js +0 -17
  83. package/dist/client/chunks/svelte-4yfa5bxa.js.map +0 -10
  84. package/dist/client/chunks/vue-a84fzp3v.js.map +0 -10
@@ -1665,6 +1665,19 @@ var init_ssrRender = __esm(() => {
1665
1665
  selectorCache = new Map;
1666
1666
  });
1667
1667
 
1668
+ // src/dev/client/cspNonce.ts
1669
+ var applyPageNonce = (element) => {
1670
+ const nonce = readPageNonce();
1671
+ if (nonce)
1672
+ element.nonce = nonce;
1673
+ return element;
1674
+ }, readPageNonce = () => {
1675
+ if (typeof document === "undefined")
1676
+ return;
1677
+ const carrier = document.querySelector("script[nonce], style[nonce]");
1678
+ return carrier?.nonce || undefined;
1679
+ };
1680
+
1668
1681
  // src/angular/islands.ts
1669
1682
  var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
1670
1683
  const requestId = getSsrContextId();
@@ -3158,10 +3171,25 @@ var init_lazyModule = __esm(() => {
3158
3171
  LAZY_RESOLVED_KEY = Symbol.for("absolutejs.svelte.lazy-resolved");
3159
3172
  });
3160
3173
 
3174
+ // src/core/islandServerGeneration.ts
3175
+ var readGeneration = () => globalThis.__absoluteIslandServerGeneration ?? 0, bumpIslandServerGeneration = () => {
3176
+ globalThis.__absoluteIslandServerGeneration = readGeneration() + 1;
3177
+ }, createIslandGenerationGuard = (reset) => {
3178
+ let seen = readGeneration();
3179
+ return () => {
3180
+ const current = readGeneration();
3181
+ if (current === seen)
3182
+ return current;
3183
+ seen = current;
3184
+ reset();
3185
+ return current;
3186
+ };
3187
+ };
3188
+
3161
3189
  // src/core/svelteServerModule.ts
3162
3190
  import { mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
3163
3191
  import { basename as basename3, dirname as dirname3, extname as extname2, join as join6, relative as relative3, resolve as resolve4 } from "path";
3164
- var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
3192
+ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
3165
3193
  const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
3166
3194
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
3167
3195
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
@@ -3228,7 +3256,9 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
3228
3256
  }, getCachedModulePath2 = (sourcePath) => {
3229
3257
  const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
3230
3258
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
3231
- return join6(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
3259
+ const generation = syncIslandGeneration();
3260
+ const generationSuffix = generation > 0 ? `.g${generation}` : "";
3261
+ return join6(serverCacheRoot2, `${normalizedSourcePath}${generationSuffix}.server.js`);
3232
3262
  }, resolveSvelteImport = async (spec, from) => {
3233
3263
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
3234
3264
  const resolved = resolvePackageImport(spec);
@@ -3260,6 +3290,7 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
3260
3290
  }
3261
3291
  await Bun.write(path, content);
3262
3292
  }, compileSvelteServerModule = async (sourcePath) => {
3293
+ syncIslandGeneration();
3263
3294
  const cachedModulePath = compiledModuleCache2.get(sourcePath);
3264
3295
  if (cachedModulePath) {
3265
3296
  return cachedModulePath;
@@ -3342,6 +3373,10 @@ var init_svelteServerModule = __esm(() => {
3342
3373
  serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "svelte");
3343
3374
  compiledModuleCache2 = new Map;
3344
3375
  originalSourcePathCache = new Map;
3376
+ syncIslandGeneration = createIslandGenerationGuard(() => {
3377
+ compiledModuleCache2.clear();
3378
+ originalSourcePathCache.clear();
3379
+ });
3345
3380
  transpiler = new Bun.Transpiler({
3346
3381
  loader: "ts",
3347
3382
  target: "browser"
@@ -3375,13 +3410,15 @@ import { readFileSync as readFileSync4, realpathSync } from "fs";
3375
3410
  import { mkdir as mkdir3 } from "fs/promises";
3376
3411
  import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve5 } from "path";
3377
3412
  var {Transpiler } = globalThis.Bun;
3378
- var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
3413
+ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
3379
3414
  const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
3380
3415
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
3381
3416
  }, getCachedModulePath3 = (sourcePath) => {
3382
3417
  const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
3383
3418
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
3384
- return join7(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
3419
+ const generation = syncIslandGeneration2();
3420
+ const generationSuffix = generation > 0 ? `.g${generation}` : "";
3421
+ return join7(serverCacheRoot3, `${normalizedSourcePath}${generationSuffix}.server.js`);
3385
3422
  }, writeIfChanged2 = async (path, content) => {
3386
3423
  const targetFile = Bun.file(path);
3387
3424
  if (await targetFile.exists()) {
@@ -3408,6 +3445,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, tran
3408
3445
  `) : nonVueLines.join(`
3409
3446
  `);
3410
3447
  }, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
3448
+ syncIslandGeneration2();
3411
3449
  const cachedModulePath = compiledModuleCache3.get(sourcePath);
3412
3450
  if (cachedModulePath)
3413
3451
  return cachedModulePath;
@@ -3468,6 +3506,9 @@ var init_vueServerModule = __esm(() => {
3468
3506
  init_isFile();
3469
3507
  serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
3470
3508
  compiledModuleCache3 = new Map;
3509
+ syncIslandGeneration2 = createIslandGenerationGuard(() => {
3510
+ compiledModuleCache3.clear();
3511
+ });
3471
3512
  transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
3472
3513
  });
3473
3514
 
@@ -3510,7 +3551,7 @@ var init_islandMarkupAttributes = __esm(() => {
3510
3551
  });
3511
3552
 
3512
3553
  // src/core/renderIslandMarkup.ts
3513
- var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
3554
+ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, syncIslandGeneration3, nextIslandId = () => {
3514
3555
  islandSequence += 1;
3515
3556
  return `island-${islandSequence}`;
3516
3557
  }, isRecord5 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord5(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
@@ -3524,6 +3565,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
3524
3565
  const loadedModule = await import(compiledModulePath);
3525
3566
  return "default" in loadedModule ? loadedModule.default : loadedModule;
3526
3567
  }, loadServerBuildComponent = async (buildReferencePath) => {
3568
+ syncIslandGeneration3();
3527
3569
  const cachedBuildComponent = resolvedServerBuildComponentCache.get(buildReferencePath);
3528
3570
  if (cachedBuildComponent) {
3529
3571
  return cachedBuildComponent;
@@ -3562,6 +3604,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
3562
3604
  }
3563
3605
  return loadServerImportComponent(resolvedComponent);
3564
3606
  }, resolveServerIslandComponent = async (component) => {
3607
+ syncIslandGeneration3();
3565
3608
  const cachedResolvedComponent = resolvedServerComponentCache.get(component);
3566
3609
  if (cachedResolvedComponent) {
3567
3610
  return cachedResolvedComponent;
@@ -3660,6 +3703,10 @@ var init_renderIslandMarkup = __esm(() => {
3660
3703
  init_islands2();
3661
3704
  resolvedServerComponentCache = new Map;
3662
3705
  resolvedServerBuildComponentCache = new Map;
3706
+ syncIslandGeneration3 = createIslandGenerationGuard(() => {
3707
+ resolvedServerComponentCache.clear();
3708
+ resolvedServerBuildComponentCache.clear();
3709
+ });
3663
3710
  });
3664
3711
 
3665
3712
  // src/core/devRouteRegistrationCallsite.ts
@@ -6711,7 +6758,7 @@ import '@angular/compiler';
6711
6758
  import { bootstrapApplication } from '@angular/platform-browser';
6712
6759
  import { provideClientHydration } from '@angular/platform-browser';
6713
6760
  import { withHttpTransferCacheOptions } from '@angular/platform-browser';
6714
- import { ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
6761
+ import { ${changeDetectionImport}, CSP_NONCE, REQUEST_CONTEXT } from '@angular/core';
6715
6762
  import { APP_BASE_HREF as __abs_APP_BASE_HREF } from '@angular/common';
6716
6763
  import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
6717
6764
  import * as pageModule from '${normalizedImportPath}';
@@ -6728,6 +6775,12 @@ var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-ra
6728
6775
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
6729
6776
  var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
6730
6777
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
6778
+ // Under secureHeaders() the policy only allows <style> elements that carry
6779
+ // the page's nonce. Angular adds one for every component it renders or
6780
+ // hot-updates in the browser, so hand it the nonce the server put on the
6781
+ // page (browsers hide the attribute's value; the property keeps it).
6782
+ var cspNonce = (document.querySelector('script[nonce], style[nonce]') || {}).nonce;
6783
+ if (cspNonce) contextProviders.push({ provide: CSP_NONCE, useValue: cspNonce });
6731
6784
  // Page-level providers are injected directly into the page module's
6732
6785
  // server output by \`compileAngular\`'s providers-injection step
6733
6786
  // (\`...appProviders, provideRouter(routes), { APP_BASE_HREF }\`),
@@ -6831,7 +6884,7 @@ ${zoneImport}import '@angular/compiler';
6831
6884
  import { bootstrapApplication } from '@angular/platform-browser';
6832
6885
  import { provideClientHydration } from '@angular/platform-browser';
6833
6886
  import { withHttpTransferCacheOptions } from '@angular/platform-browser';
6834
- import { enableProdMode, ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
6887
+ import { enableProdMode, ${changeDetectionImport}, CSP_NONCE, REQUEST_CONTEXT } from '@angular/core';
6835
6888
  import { APP_BASE_HREF as __abs_APP_BASE_HREF } from '@angular/common';
6836
6889
  import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
6837
6890
  import * as pageModule from '${normalizedImportPath}';
@@ -6848,6 +6901,12 @@ var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-ra
6848
6901
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
6849
6902
  var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
6850
6903
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
6904
+ // Under secureHeaders() the policy only allows <style> elements that carry
6905
+ // the page's nonce. Angular adds one for every component it renders or
6906
+ // hot-updates in the browser, so hand it the nonce the server put on the
6907
+ // page (browsers hide the attribute's value; the property keeps it).
6908
+ var cspNonce = (document.querySelector('script[nonce], style[nonce]') || {}).nonce;
6909
+ if (cspNonce) contextProviders.push({ provide: CSP_NONCE, useValue: cspNonce });
6851
6910
  // Page-level providers are injected directly into the page module's
6852
6911
  // server output by \`compileAngular\`'s providers-injection step
6853
6912
  // (\`...appProviders, provideRouter(routes), { APP_BASE_HREF }\`),
@@ -7843,5 +7902,5 @@ export {
7843
7902
  withPendingTask
7844
7903
  };
7845
7904
 
7846
- //# debugId=9C3D9250ADEAC18364756E2164756E21
7905
+ //# debugId=3FD4269B8E368DF764756E2164756E21
7847
7906
  //# sourceMappingURL=server.js.map