@absolutejs/absolute 0.19.0-beta.886 → 0.19.0-beta.888

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,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-sgkxwm/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-JQt65h/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-sgkxwm/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-JQt65h/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-sgkxwm/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-JQt65h/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
package/dist/build.js CHANGED
@@ -9557,7 +9557,8 @@ var init_angularLinkerPlugin = __esm(() => {
9557
9557
  // src/dev/angular/hmrInjectionPlugin.ts
9558
9558
  var exports_hmrInjectionPlugin = {};
9559
9559
  __export(exports_hmrInjectionPlugin, {
9560
- createAngularHmrInjectionPlugin: () => createAngularHmrInjectionPlugin
9560
+ createAngularHmrInjectionPlugin: () => createAngularHmrInjectionPlugin,
9561
+ applyAngularHmrInjection: () => applyAngularHmrInjection
9561
9562
  });
9562
9563
  import { readFile as readFile5 } from "fs/promises";
9563
9564
  import { relative as relative6, resolve as resolve12 } from "path";
@@ -9721,50 +9722,53 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9721
9722
  });
9722
9723
  }
9723
9724
  }
9724
- `, createAngularHmrInjectionPlugin = (params) => {
9725
+ `, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
9725
9726
  const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
9726
9727
  const normalizedGenRoot = resolve12(generatedAngularRoot).replace(/\\/g, "/");
9727
- return {
9728
- name: "absolute-angular-hmr-injection",
9729
- setup(build) {
9730
- build.onLoad({ filter: /\.component\.js$/ }, async (args) => {
9731
- const normalizedPath = args.path.replace(/\\/g, "/");
9732
- if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
9733
- return;
9734
- const text = await readFile5(args.path, "utf8");
9735
- const seen = new Set;
9736
- const classNames = [];
9737
- let match;
9738
- const re2 = new RegExp(ENTITY_DECORATOR_RE.source, ENTITY_DECORATOR_RE.flags);
9739
- while ((match = re2.exec(text)) !== null) {
9740
- const className = match[1];
9741
- if (className && !seen.has(className)) {
9742
- seen.add(className);
9743
- classNames.push(className);
9744
- }
9745
- }
9746
- if (classNames.length === 0)
9747
- return;
9748
- const relFromGenRoot = relative6(generatedAngularRoot, args.path).replace(/\\/g, "/");
9749
- const userTsPath = resolve12(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
9750
- const projectRel = relative6(projectRoot, userTsPath).replace(/\\/g, "/");
9751
- const tail = classNames.map((className) => {
9752
- const id = `${projectRel}@${className}`;
9753
- return buildHmrTail(className, JSON.stringify(id));
9754
- }).join("");
9755
- const topLevelNames = extractAllTopLevelNames(text);
9756
- const depsKeys = topLevelNames.filter((n) => !classNames.includes(n)).join(", ");
9757
- const depsBlock = classNames.length > 0 && depsKeys ? `
9728
+ const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
9729
+ if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
9730
+ return;
9731
+ const seen = new Set;
9732
+ const classNames = [];
9733
+ let match;
9734
+ const re2 = new RegExp(ENTITY_DECORATOR_RE.source, ENTITY_DECORATOR_RE.flags);
9735
+ while ((match = re2.exec(jsSource)) !== null) {
9736
+ const className = match[1];
9737
+ if (className && !seen.has(className)) {
9738
+ seen.add(className);
9739
+ classNames.push(className);
9740
+ }
9741
+ }
9742
+ if (classNames.length === 0)
9743
+ return;
9744
+ const relFromGenRoot = relative6(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
9745
+ const userTsPath = resolve12(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
9746
+ const projectRel = relative6(projectRoot, userTsPath).replace(/\\/g, "/");
9747
+ const tail = classNames.map((className) => {
9748
+ const id = `${projectRel}@${className}`;
9749
+ return buildHmrTail(className, JSON.stringify(id));
9750
+ }).join("");
9751
+ const topLevelNames = extractAllTopLevelNames(jsSource);
9752
+ const depsKeys = topLevelNames.filter((n) => !classNames.includes(n)).join(", ");
9753
+ const depsBlock = classNames.length > 0 && depsKeys ? `
9758
9754
 
9759
9755
  // absolutejs HMR \u2014 Tier 1a class-deps registry
9760
9756
  ` + classNames.map((c) => `try { ${c}.__abs_deps = { ${depsKeys} }; } catch {}`).join(`
9761
9757
  `) + `
9762
9758
  ` : "";
9763
- return { contents: text + tail + depsBlock, loader: "js" };
9764
- });
9765
- }
9766
- };
9767
- };
9759
+ return jsSource + tail + depsBlock;
9760
+ }, createAngularHmrInjectionPlugin = (params) => ({
9761
+ name: "absolute-angular-hmr-injection",
9762
+ setup(build) {
9763
+ build.onLoad({ filter: /\.component\.js$/ }, async (args) => {
9764
+ const text = await readFile5(args.path, "utf8");
9765
+ const transformed = applyAngularHmrInjection(text, args.path, params);
9766
+ if (transformed === undefined)
9767
+ return;
9768
+ return { contents: transformed, loader: "js" };
9769
+ });
9770
+ }
9771
+ });
9768
9772
  var init_hmrInjectionPlugin = __esm(() => {
9769
9773
  ENTITY_DECORATOR_RE = /([A-Z][A-Za-z0-9_$]*)\s*=\s*__legacyDecorateClassTS[A-Za-z0-9_$]*\s*\(\s*\[[\s\S]*?\b(?:Component|Directive|Pipe|Injectable)[A-Za-z0-9_$]*\s*\(/g;
9770
9774
  IMPORT_RE = /^\s*import\s+(?:(?:(\*)\s+as\s+([A-Za-z_$][\w$]*)\s+from)|(?:([A-Za-z_$][\w$]*)(?:\s*,\s*\{([^}]*)\})?\s+from)|(?:\{([^}]*)\}\s+from))\s*['"][^'"]+['"]/gm;
@@ -14845,13 +14849,14 @@ ${content.slice(firstUseIdx)}`;
14845
14849
  ];
14846
14850
  const reactClientEntryPoints = [...reactEntries];
14847
14851
  const urlReferencedFiles = await urlReferencedFilesPromise;
14852
+ const skipAngularClientBundle = hmr && angularClientPaths.length > 0;
14848
14853
  const nonReactClientEntryPoints = [
14849
14854
  ...svelteIndexPaths,
14850
14855
  ...svelteClientPaths,
14851
14856
  ...htmlEntries,
14852
14857
  ...vueIndexPaths,
14853
14858
  ...vueClientPaths,
14854
- ...angularClientPaths,
14859
+ ...skipAngularClientBundle ? [] : angularClientPaths,
14855
14860
  ...islandBootstrapPath ? [islandBootstrapPath] : [],
14856
14861
  ...urlReferencedFiles
14857
14862
  ];
@@ -15237,6 +15242,13 @@ ${content.slice(firstUseIdx)}`;
15237
15242
  const fileBase = basename8(serverPath, ".js");
15238
15243
  manifest[toPascal(fileBase)] = serverPath;
15239
15244
  }
15245
+ if (skipAngularClientBundle) {
15246
+ for (const clientPath of angularClientPaths) {
15247
+ const fileBase = basename8(clientPath, ".js");
15248
+ const relFromCwd = relative11(projectRoot, clientPath).replace(/\\/g, "/");
15249
+ manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
15250
+ }
15251
+ }
15240
15252
  const shouldCopyHtmx = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && f2.endsWith(".html"));
15241
15253
  const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
15242
15254
  const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && (f2.endsWith(".html") || isStylePath(f2)));
@@ -17372,10 +17384,31 @@ export default {};
17372
17384
  return;
17373
17385
  const stat3 = statSync2(filePath);
17374
17386
  const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
17375
- const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
17387
+ let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
17388
+ const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
17389
+ if (isComponentJs) {
17390
+ const userAngularRoot = await getAngularUserRoot(projectRoot);
17391
+ if (userAngularRoot) {
17392
+ const { applyAngularHmrInjection: applyAngularHmrInjection2 } = await Promise.resolve().then(() => (init_hmrInjectionPlugin(), exports_hmrInjectionPlugin));
17393
+ const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
17394
+ const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
17395
+ const transformed = applyAngularHmrInjection2(content, filePath, {
17396
+ generatedAngularRoot,
17397
+ projectRoot,
17398
+ userAngularRoot
17399
+ });
17400
+ if (transformed !== undefined)
17401
+ content = transformed;
17402
+ }
17403
+ }
17376
17404
  setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
17377
17405
  return jsResponse(content);
17378
- }, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
17406
+ }, cachedAngularUserRoot, getAngularUserRoot = async (_projectRoot) => {
17407
+ if (cachedAngularUserRoot !== undefined)
17408
+ return cachedAngularUserRoot;
17409
+ cachedAngularUserRoot = configuredAngularUserRoot ?? null;
17410
+ return cachedAngularUserRoot;
17411
+ }, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
17379
17412
  const stat3 = statSync2(filePath);
17380
17413
  const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
17381
17414
  setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
@@ -17394,6 +17427,10 @@ export default {};
17394
17427
  }, createModuleServer = (config) => {
17395
17428
  const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
17396
17429
  const rewriter = buildImportRewriter(vendorPaths);
17430
+ if (frameworkDirs?.angular) {
17431
+ configuredAngularUserRoot = frameworkDirs.angular;
17432
+ cachedAngularUserRoot = undefined;
17433
+ }
17397
17434
  return async (pathname) => {
17398
17435
  if (pathname.startsWith("/@stub/"))
17399
17436
  return handleStubRequest(pathname);
@@ -20210,6 +20247,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20210
20247
  }
20211
20248
  return ctx.debouncedPromise;
20212
20249
  };
20250
+ }, runAngularHmrIncremental = async (state) => {
20251
+ try {
20252
+ const { compileAngularForHmr: compileAngularForHmr2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
20253
+ await compileAngularForHmr2([], state.resolvedPaths.buildDir, state.lastUserEditedFiles ?? null);
20254
+ } catch (err) {
20255
+ logWarn(`[hmr] surgical-HMR shadow compile skipped: ${err instanceof Error ? err.message : String(err)}`);
20256
+ }
20213
20257
  }, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
20214
20258
  const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
20215
20259
  const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
@@ -20255,19 +20299,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20255
20299
  const runBundle = scheduleAngularBundleRebuild(state, pageEntries, angularDir);
20256
20300
  const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20257
20301
  if (verdict.tier === 0) {
20302
+ await runAngularHmrIncremental(state);
20258
20303
  broadcastSurgical(state, verdict.queue);
20259
20304
  const b2 = verdict.breakdown;
20260
20305
  logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20261
- runBundle().catch((err) => {
20262
- logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20263
- });
20264
20306
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
20307
+ await runAngularHmrIncremental(state);
20265
20308
  broadcastRemount(state, verdict.queue);
20266
20309
  const b2 = verdict.breakdown;
20267
20310
  logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20268
- runBundle().catch((err) => {
20269
- logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20270
- });
20271
20311
  } else if (verdict.tier === 1 && verdict.kind === "rebootstrap") {
20272
20312
  await runBundle({ immediate: true });
20273
20313
  await broadcastRebootstrap(state, verdict.reason);
@@ -21993,5 +22033,5 @@ export {
21993
22033
  build
21994
22034
  };
21995
22035
 
21996
- //# debugId=8D490F35E105C28E64756E2164756E21
22036
+ //# debugId=FEFBF8E9997AAD7364756E2164756E21
21997
22037
  //# sourceMappingURL=build.js.map