@absolutejs/absolute 0.19.0-beta.881 → 0.19.0-beta.883

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-Xhhant/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-3wcO1H/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-Xhhant/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-3wcO1H/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-Xhhant/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-3wcO1H/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
@@ -17526,7 +17526,8 @@ var init_rewriteImports = __esm(() => {
17526
17526
  // src/dev/angular/resolveOwningComponents.ts
17527
17527
  var exports_resolveOwningComponents = {};
17528
17528
  __export(exports_resolveOwningComponents, {
17529
- resolveOwningComponents: () => resolveOwningComponents
17529
+ resolveOwningComponents: () => resolveOwningComponents,
17530
+ invalidateResourceIndex: () => invalidateResourceIndex
17530
17531
  });
17531
17532
  import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
17532
17533
  import { dirname as dirname17, extname as extname9, join as join28, resolve as resolve30 } from "path";
@@ -17657,27 +17658,42 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
17657
17658
  }
17658
17659
  if (!rootStat.isDirectory())
17659
17660
  return out;
17661
+ const index = getOrBuildResourceIndex(userAngularRoot);
17662
+ const owners = index.get(changedAbs);
17663
+ if (owners) {
17664
+ out.push(...owners);
17665
+ }
17666
+ return out;
17667
+ }, resourceIndexByRoot, getOrBuildResourceIndex = (userAngularRoot) => {
17668
+ const cached = resourceIndexByRoot.get(userAngularRoot);
17669
+ if (cached)
17670
+ return cached;
17671
+ const index = new Map;
17660
17672
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17661
17673
  const classes = parseDecoratedClasses(tsPath);
17662
17674
  const componentDir = dirname17(tsPath);
17663
- const matchesResource = (relativeUrl) => {
17664
- const abs = safeNormalize(resolve30(componentDir, relativeUrl));
17665
- return abs === changedAbs;
17666
- };
17667
17675
  for (const cls of classes) {
17668
17676
  if (cls.kind !== "component")
17669
17677
  continue;
17670
- const referencesChanged = cls.templateUrls.some(matchesResource) || cls.styleUrls.some(matchesResource);
17671
- if (!referencesChanged)
17672
- continue;
17673
- out.push({
17678
+ const owner = {
17674
17679
  className: cls.className,
17675
17680
  componentFilePath: tsPath,
17676
17681
  kind: "component"
17677
- });
17682
+ };
17683
+ for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17684
+ const abs = safeNormalize(resolve30(componentDir, url));
17685
+ const existing = index.get(abs);
17686
+ if (existing)
17687
+ existing.push(owner);
17688
+ else
17689
+ index.set(abs, [owner]);
17690
+ }
17678
17691
  }
17679
17692
  }
17680
- return out;
17693
+ resourceIndexByRoot.set(userAngularRoot, index);
17694
+ return index;
17695
+ }, invalidateResourceIndex = () => {
17696
+ resourceIndexByRoot.clear();
17681
17697
  };
17682
17698
  var init_resolveOwningComponents = __esm(() => {
17683
17699
  ENTITY_DECORATORS = {
@@ -17686,6 +17702,7 @@ var init_resolveOwningComponents = __esm(() => {
17686
17702
  Pipe: "pipe",
17687
17703
  Injectable: "service"
17688
17704
  };
17705
+ resourceIndexByRoot = new Map;
17689
17706
  });
17690
17707
 
17691
17708
  // src/dev/angular/hmrImportGenerator.ts
@@ -20002,21 +20019,51 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20002
20019
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
20003
20020
  Object.assign(state.manifest, clientManifest);
20004
20021
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
20022
+ }, angularDispatcherModules = null, loadAngularDispatcherModules = async () => {
20023
+ if (angularDispatcherModules)
20024
+ return angularDispatcherModules;
20025
+ const [resolveMod, hmrMod, fastMod] = await Promise.all([
20026
+ Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents)),
20027
+ Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler)),
20028
+ Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler))
20029
+ ]);
20030
+ angularDispatcherModules = {
20031
+ encodeHmrComponentId: hmrMod.encodeHmrComponentId,
20032
+ invalidateResourceIndex: resolveMod.invalidateResourceIndex,
20033
+ resolveOwningComponents: resolveMod.resolveOwningComponents,
20034
+ tryFastHmr: fastMod.tryFastHmr
20035
+ };
20036
+ return angularDispatcherModules;
20005
20037
  }, decideAngularTier = async (state, angularDir) => {
20006
20038
  const userEdited = state.lastUserEditedFiles ?? new Set;
20007
20039
  if (userEdited.size === 0)
20008
20040
  return { queue: [], tier: 0 };
20009
- const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
20010
- const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
20011
- const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
20041
+ const importsStart = performance.now();
20042
+ const {
20043
+ resolveOwningComponents: resolveOwningComponents2,
20044
+ invalidateResourceIndex: invalidateResourceIndex2,
20045
+ encodeHmrComponentId: encodeHmrComponentId2,
20046
+ tryFastHmr: tryFastHmr2
20047
+ } = await loadAngularDispatcherModules();
20048
+ const importsMs = performance.now() - importsStart;
20049
+ for (const editedFile of userEdited) {
20050
+ if (editedFile.endsWith(".ts") || editedFile.endsWith(".tsx")) {
20051
+ invalidateResourceIndex2();
20052
+ break;
20053
+ }
20054
+ }
20012
20055
  const queue = [];
20013
20056
  const queueIds = new Set;
20014
20057
  let anyFingerprintChanged = false;
20058
+ let totalResolveMs = 0;
20059
+ let totalCompileMs = 0;
20015
20060
  for (const editedFile of userEdited) {
20061
+ const resolveStart = performance.now();
20016
20062
  const owners = resolveOwningComponents2({
20017
20063
  changedFilePath: editedFile,
20018
20064
  userAngularRoot: angularDir
20019
20065
  });
20066
+ totalResolveMs += performance.now() - resolveStart;
20020
20067
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
20021
20068
  return {
20022
20069
  kind: "rebootstrap",
@@ -20028,11 +20075,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20028
20075
  const id = encodeHmrComponentId2(componentFilePath, className);
20029
20076
  if (queueIds.has(id))
20030
20077
  continue;
20078
+ const compileStart = performance.now();
20031
20079
  const result = await tryFastHmr2({
20032
20080
  className,
20033
20081
  componentFilePath,
20034
20082
  kind
20035
20083
  });
20084
+ totalCompileMs += performance.now() - compileStart;
20036
20085
  if (!result.ok) {
20037
20086
  return {
20038
20087
  kind: "rebootstrap",
@@ -20047,10 +20096,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20047
20096
  queue.push({ className, id });
20048
20097
  }
20049
20098
  }
20099
+ const breakdown = {
20100
+ importsMs: Math.round(importsMs),
20101
+ resolveMs: Math.round(totalResolveMs),
20102
+ compileMs: Math.round(totalCompileMs)
20103
+ };
20050
20104
  if (anyFingerprintChanged) {
20051
- return { kind: "remount", queue, tier: 1 };
20105
+ return { breakdown, kind: "remount", queue, tier: 1 };
20052
20106
  }
20053
- return { queue, tier: 0 };
20107
+ return { breakdown, queue, tier: 0 };
20054
20108
  }, broadcastSurgical = (state, queue) => {
20055
20109
  const timestamp = Date.now();
20056
20110
  for (const { id } of queue) {
@@ -20130,13 +20184,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20130
20184
  const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20131
20185
  if (verdict.tier === 0) {
20132
20186
  broadcastSurgical(state, verdict.queue);
20133
- logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20187
+ const b2 = verdict.breakdown;
20188
+ logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20134
20189
  runBundle().catch((err) => {
20135
20190
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20136
20191
  });
20137
20192
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
20138
20193
  broadcastRemount(state, verdict.queue);
20139
- logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20194
+ const b2 = verdict.breakdown;
20195
+ logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20140
20196
  runBundle().catch((err) => {
20141
20197
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20142
20198
  });
@@ -21864,5 +21920,5 @@ export {
21864
21920
  build
21865
21921
  };
21866
21922
 
21867
- //# debugId=D6B6989A00DDAE4A64756E2164756E21
21923
+ //# debugId=7F4CD5C3EC21A0D064756E2164756E21
21868
21924
  //# sourceMappingURL=build.js.map