@absolutejs/absolute 0.19.0-beta.880 → 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-0pNeWY/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-0pNeWY/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-0pNeWY/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
@@ -19379,7 +19396,8 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
19379
19396
  const filePathRel = decoded.slice(0, at2);
19380
19397
  const className = decoded.slice(at2 + 1);
19381
19398
  const componentFilePath = resolve32(process.cwd(), filePathRel);
19382
- const cacheKey2 = encodeURIComponent(`${componentFilePath}@${className}`);
19399
+ const projectRelPath = relative14(process.cwd(), componentFilePath).replace(/\\/g, "/");
19400
+ const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
19383
19401
  const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
19384
19402
  const cached = takePendingModule2(cacheKey2);
19385
19403
  if (cached !== undefined) {
@@ -20001,21 +20019,51 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20001
20019
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
20002
20020
  Object.assign(state.manifest, clientManifest);
20003
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;
20004
20037
  }, decideAngularTier = async (state, angularDir) => {
20005
20038
  const userEdited = state.lastUserEditedFiles ?? new Set;
20006
20039
  if (userEdited.size === 0)
20007
20040
  return { queue: [], tier: 0 };
20008
- const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
20009
- const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
20010
- 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
+ }
20011
20055
  const queue = [];
20012
20056
  const queueIds = new Set;
20013
20057
  let anyFingerprintChanged = false;
20058
+ let totalResolveMs = 0;
20059
+ let totalCompileMs = 0;
20014
20060
  for (const editedFile of userEdited) {
20061
+ const resolveStart = performance.now();
20015
20062
  const owners = resolveOwningComponents2({
20016
20063
  changedFilePath: editedFile,
20017
20064
  userAngularRoot: angularDir
20018
20065
  });
20066
+ totalResolveMs += performance.now() - resolveStart;
20019
20067
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
20020
20068
  return {
20021
20069
  kind: "rebootstrap",
@@ -20027,11 +20075,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20027
20075
  const id = encodeHmrComponentId2(componentFilePath, className);
20028
20076
  if (queueIds.has(id))
20029
20077
  continue;
20078
+ const compileStart = performance.now();
20030
20079
  const result = await tryFastHmr2({
20031
20080
  className,
20032
20081
  componentFilePath,
20033
20082
  kind
20034
20083
  });
20084
+ totalCompileMs += performance.now() - compileStart;
20035
20085
  if (!result.ok) {
20036
20086
  return {
20037
20087
  kind: "rebootstrap",
@@ -20046,10 +20096,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20046
20096
  queue.push({ className, id });
20047
20097
  }
20048
20098
  }
20099
+ const breakdown = {
20100
+ importsMs: Math.round(importsMs),
20101
+ resolveMs: Math.round(totalResolveMs),
20102
+ compileMs: Math.round(totalCompileMs)
20103
+ };
20049
20104
  if (anyFingerprintChanged) {
20050
- return { kind: "remount", queue, tier: 1 };
20105
+ return { breakdown, kind: "remount", queue, tier: 1 };
20051
20106
  }
20052
- return { queue, tier: 0 };
20107
+ return { breakdown, queue, tier: 0 };
20053
20108
  }, broadcastSurgical = (state, queue) => {
20054
20109
  const timestamp = Date.now();
20055
20110
  for (const { id } of queue) {
@@ -20129,13 +20184,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20129
20184
  const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20130
20185
  if (verdict.tier === 0) {
20131
20186
  broadcastSurgical(state, verdict.queue);
20132
- 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)`);
20133
20189
  runBundle().catch((err) => {
20134
20190
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20135
20191
  });
20136
20192
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
20137
20193
  broadcastRemount(state, verdict.queue);
20138
- 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)`);
20139
20196
  runBundle().catch((err) => {
20140
20197
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20141
20198
  });
@@ -21863,5 +21920,5 @@ export {
21863
21920
  build
21864
21921
  };
21865
21922
 
21866
- //# debugId=8A827EBBA39BF30864756E2164756E21
21923
+ //# debugId=7F4CD5C3EC21A0D064756E2164756E21
21867
21924
  //# sourceMappingURL=build.js.map