@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.
package/dist/index.js CHANGED
@@ -17623,7 +17623,8 @@ var init_rewriteImports = __esm(() => {
17623
17623
  // src/dev/angular/resolveOwningComponents.ts
17624
17624
  var exports_resolveOwningComponents = {};
17625
17625
  __export(exports_resolveOwningComponents, {
17626
- resolveOwningComponents: () => resolveOwningComponents
17626
+ resolveOwningComponents: () => resolveOwningComponents,
17627
+ invalidateResourceIndex: () => invalidateResourceIndex
17627
17628
  });
17628
17629
  import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
17629
17630
  import { dirname as dirname18, extname as extname9, join as join29, resolve as resolve32 } from "path";
@@ -17754,27 +17755,42 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
17754
17755
  }
17755
17756
  if (!rootStat.isDirectory())
17756
17757
  return out;
17758
+ const index = getOrBuildResourceIndex(userAngularRoot);
17759
+ const owners = index.get(changedAbs);
17760
+ if (owners) {
17761
+ out.push(...owners);
17762
+ }
17763
+ return out;
17764
+ }, resourceIndexByRoot, getOrBuildResourceIndex = (userAngularRoot) => {
17765
+ const cached = resourceIndexByRoot.get(userAngularRoot);
17766
+ if (cached)
17767
+ return cached;
17768
+ const index = new Map;
17757
17769
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
17758
17770
  const classes = parseDecoratedClasses(tsPath);
17759
17771
  const componentDir = dirname18(tsPath);
17760
- const matchesResource = (relativeUrl) => {
17761
- const abs = safeNormalize(resolve32(componentDir, relativeUrl));
17762
- return abs === changedAbs;
17763
- };
17764
17772
  for (const cls of classes) {
17765
17773
  if (cls.kind !== "component")
17766
17774
  continue;
17767
- const referencesChanged = cls.templateUrls.some(matchesResource) || cls.styleUrls.some(matchesResource);
17768
- if (!referencesChanged)
17769
- continue;
17770
- out.push({
17775
+ const owner = {
17771
17776
  className: cls.className,
17772
17777
  componentFilePath: tsPath,
17773
17778
  kind: "component"
17774
- });
17779
+ };
17780
+ for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
17781
+ const abs = safeNormalize(resolve32(componentDir, url));
17782
+ const existing = index.get(abs);
17783
+ if (existing)
17784
+ existing.push(owner);
17785
+ else
17786
+ index.set(abs, [owner]);
17787
+ }
17775
17788
  }
17776
17789
  }
17777
- return out;
17790
+ resourceIndexByRoot.set(userAngularRoot, index);
17791
+ return index;
17792
+ }, invalidateResourceIndex = () => {
17793
+ resourceIndexByRoot.clear();
17778
17794
  };
17779
17795
  var init_resolveOwningComponents = __esm(() => {
17780
17796
  ENTITY_DECORATORS = {
@@ -17783,6 +17799,7 @@ var init_resolveOwningComponents = __esm(() => {
17783
17799
  Pipe: "pipe",
17784
17800
  Injectable: "service"
17785
17801
  };
17802
+ resourceIndexByRoot = new Map;
17786
17803
  });
17787
17804
 
17788
17805
  // src/dev/angular/hmrImportGenerator.ts
@@ -19476,7 +19493,8 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
19476
19493
  const filePathRel = decoded.slice(0, at2);
19477
19494
  const className = decoded.slice(at2 + 1);
19478
19495
  const componentFilePath = resolve34(process.cwd(), filePathRel);
19479
- const cacheKey2 = encodeURIComponent(`${componentFilePath}@${className}`);
19496
+ const projectRelPath = relative14(process.cwd(), componentFilePath).replace(/\\/g, "/");
19497
+ const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
19480
19498
  const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
19481
19499
  const cached = takePendingModule2(cacheKey2);
19482
19500
  if (cached !== undefined) {
@@ -20098,21 +20116,51 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20098
20116
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
20099
20117
  Object.assign(state.manifest, clientManifest);
20100
20118
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
20119
+ }, angularDispatcherModules = null, loadAngularDispatcherModules = async () => {
20120
+ if (angularDispatcherModules)
20121
+ return angularDispatcherModules;
20122
+ const [resolveMod, hmrMod, fastMod] = await Promise.all([
20123
+ Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents)),
20124
+ Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler)),
20125
+ Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler))
20126
+ ]);
20127
+ angularDispatcherModules = {
20128
+ encodeHmrComponentId: hmrMod.encodeHmrComponentId,
20129
+ invalidateResourceIndex: resolveMod.invalidateResourceIndex,
20130
+ resolveOwningComponents: resolveMod.resolveOwningComponents,
20131
+ tryFastHmr: fastMod.tryFastHmr
20132
+ };
20133
+ return angularDispatcherModules;
20101
20134
  }, decideAngularTier = async (state, angularDir) => {
20102
20135
  const userEdited = state.lastUserEditedFiles ?? new Set;
20103
20136
  if (userEdited.size === 0)
20104
20137
  return { queue: [], tier: 0 };
20105
- const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
20106
- const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
20107
- const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
20138
+ const importsStart = performance.now();
20139
+ const {
20140
+ resolveOwningComponents: resolveOwningComponents2,
20141
+ invalidateResourceIndex: invalidateResourceIndex2,
20142
+ encodeHmrComponentId: encodeHmrComponentId2,
20143
+ tryFastHmr: tryFastHmr2
20144
+ } = await loadAngularDispatcherModules();
20145
+ const importsMs = performance.now() - importsStart;
20146
+ for (const editedFile of userEdited) {
20147
+ if (editedFile.endsWith(".ts") || editedFile.endsWith(".tsx")) {
20148
+ invalidateResourceIndex2();
20149
+ break;
20150
+ }
20151
+ }
20108
20152
  const queue = [];
20109
20153
  const queueIds = new Set;
20110
20154
  let anyFingerprintChanged = false;
20155
+ let totalResolveMs = 0;
20156
+ let totalCompileMs = 0;
20111
20157
  for (const editedFile of userEdited) {
20158
+ const resolveStart = performance.now();
20112
20159
  const owners = resolveOwningComponents2({
20113
20160
  changedFilePath: editedFile,
20114
20161
  userAngularRoot: angularDir
20115
20162
  });
20163
+ totalResolveMs += performance.now() - resolveStart;
20116
20164
  if (owners.length === 0 && (editedFile.endsWith(".component.ts") || editedFile.endsWith(".directive.ts") || editedFile.endsWith(".pipe.ts") || editedFile.endsWith(".service.ts"))) {
20117
20165
  return {
20118
20166
  kind: "rebootstrap",
@@ -20124,11 +20172,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20124
20172
  const id = encodeHmrComponentId2(componentFilePath, className);
20125
20173
  if (queueIds.has(id))
20126
20174
  continue;
20175
+ const compileStart = performance.now();
20127
20176
  const result = await tryFastHmr2({
20128
20177
  className,
20129
20178
  componentFilePath,
20130
20179
  kind
20131
20180
  });
20181
+ totalCompileMs += performance.now() - compileStart;
20132
20182
  if (!result.ok) {
20133
20183
  return {
20134
20184
  kind: "rebootstrap",
@@ -20143,10 +20193,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20143
20193
  queue.push({ className, id });
20144
20194
  }
20145
20195
  }
20196
+ const breakdown = {
20197
+ importsMs: Math.round(importsMs),
20198
+ resolveMs: Math.round(totalResolveMs),
20199
+ compileMs: Math.round(totalCompileMs)
20200
+ };
20146
20201
  if (anyFingerprintChanged) {
20147
- return { kind: "remount", queue, tier: 1 };
20202
+ return { breakdown, kind: "remount", queue, tier: 1 };
20148
20203
  }
20149
- return { queue, tier: 0 };
20204
+ return { breakdown, queue, tier: 0 };
20150
20205
  }, broadcastSurgical = (state, queue) => {
20151
20206
  const timestamp = Date.now();
20152
20207
  for (const { id } of queue) {
@@ -20226,13 +20281,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
20226
20281
  const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
20227
20282
  if (verdict.tier === 0) {
20228
20283
  broadcastSurgical(state, verdict.queue);
20229
- logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20284
+ const b2 = verdict.breakdown;
20285
+ logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20230
20286
  runBundle().catch((err) => {
20231
20287
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20232
20288
  });
20233
20289
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
20234
20290
  broadcastRemount(state, verdict.queue);
20235
- logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms; awaiting client apply)`);
20291
+ const b2 = verdict.breakdown;
20292
+ logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
20236
20293
  runBundle().catch((err) => {
20237
20294
  logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
20238
20295
  });
@@ -30540,5 +30597,5 @@ export {
30540
30597
  ANGULAR_INIT_TIMEOUT_MS
30541
30598
  };
30542
30599
 
30543
- //# debugId=5A13955C630604EE64756E2164756E21
30600
+ //# debugId=9196AF65F1A3263464756E2164756E21
30544
30601
  //# sourceMappingURL=index.js.map