@absolutejs/absolute 0.19.0-beta.746 → 0.19.0-beta.748

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.
@@ -4118,46 +4118,57 @@ var absoluteHttpTransferCacheOptions = {
4118
4118
  }
4119
4119
  };
4120
4120
 
4121
- // Re-Bootstrap HMR with View Transitions API
4122
- if (window.__ANGULAR_APP__) {
4123
- try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
4124
- window.__ANGULAR_APP__ = null;
4125
- }
4126
-
4127
- // Ensure root element exists after destroy (Angular removes it)
4128
- var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
4129
- if (!document.querySelector(_sel)) {
4130
- (document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
4131
- }
4132
-
4133
- var providers = [provideZonelessChangeDetection()];
4134
- if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
4135
- providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
4136
- }
4137
- delete window.__HMR_SKIP_HYDRATION__;
4138
- providers.push.apply(providers, pageProviders);
4139
- providers.push.apply(providers, propProviders);
4140
- window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
4141
-
4142
- if (pageHasRawStreamingSlots) {
4143
- window.__ABS_SLOT_HYDRATION_PENDING__ = false;
4144
- if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
4145
- requestAnimationFrame(function() {
4146
- window.__ABS_SLOT_FLUSH__();
4147
- });
4148
- }
4149
- } else {
4150
- bootstrapApplication(${componentClassName}, {
4151
- providers: providers
4152
- }).then(function (appRef) {
4153
- window.__ANGULAR_APP__ = appRef;
4121
+ // Re-export the page module so HMR fast-patch (in handlers/angular.ts) can
4122
+ // dynamically import this chunk and discover the freshly-built component
4123
+ // classes without needing a separate build artifact.
4124
+ export * from '${normalizedImportPath}';
4125
+
4126
+ // Re-Bootstrap HMR with View Transitions API.
4127
+ // Skipped during fast-patch: the HMR client sets
4128
+ // window.__ANGULAR_HMR_FAST_PATCH__ = true before \`import()\`-ing this
4129
+ // chunk so it can read the new component classes via \`export *\` above
4130
+ // without destroying the running app.
4131
+ if (!window.__ANGULAR_HMR_FAST_PATCH__) {
4132
+ if (window.__ANGULAR_APP__) {
4133
+ try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
4134
+ window.__ANGULAR_APP__ = null;
4135
+ }
4136
+
4137
+ // Ensure root element exists after destroy (Angular removes it)
4138
+ var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
4139
+ if (!document.querySelector(_sel)) {
4140
+ (document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
4141
+ }
4142
+
4143
+ var providers = [provideZonelessChangeDetection()];
4144
+ if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
4145
+ providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
4146
+ }
4147
+ delete window.__HMR_SKIP_HYDRATION__;
4148
+ providers.push.apply(providers, pageProviders);
4149
+ providers.push.apply(providers, propProviders);
4150
+ window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
4151
+
4152
+ if (pageHasRawStreamingSlots) {
4154
4153
  window.__ABS_SLOT_HYDRATION_PENDING__ = false;
4155
4154
  if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
4156
4155
  requestAnimationFrame(function() {
4157
4156
  window.__ABS_SLOT_FLUSH__();
4158
4157
  });
4159
4158
  }
4160
- });
4159
+ } else {
4160
+ bootstrapApplication(${componentClassName}, {
4161
+ providers: providers
4162
+ }).then(function (appRef) {
4163
+ window.__ANGULAR_APP__ = appRef;
4164
+ window.__ABS_SLOT_HYDRATION_PENDING__ = false;
4165
+ if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
4166
+ requestAnimationFrame(function() {
4167
+ window.__ABS_SLOT_FLUSH__();
4168
+ });
4169
+ }
4170
+ });
4171
+ }
4161
4172
  }
4162
4173
  `.trim() : `
4163
4174
  import '@angular/compiler';
@@ -14339,6 +14350,39 @@ var handleAngularPageRequest = async (input) => {
14339
14350
  };
14340
14351
  // src/angular/page.ts
14341
14352
  var defineAngularPage = (definition) => definition;
14353
+ // src/angular/preserveAcrossHmr.ts
14354
+ var isDev2 = () => {
14355
+ const scope = globalThis;
14356
+ return Boolean(scope.__DEV__) || Boolean(scope.ngDevMode);
14357
+ };
14358
+ var getCache = () => {
14359
+ const scope = globalThis;
14360
+ return scope.__ABS_HMR_INSTANCE_STATE__ ??= new Map;
14361
+ };
14362
+ var getTracker = () => {
14363
+ const scope = globalThis;
14364
+ return scope.__ABS_HMR_TRACKED_INSTANCES__ ??= new Set;
14365
+ };
14366
+ var restoreFromCache = (instance, key) => {
14367
+ const cache = getCache();
14368
+ const stored = cache.get(key);
14369
+ if (!stored)
14370
+ return;
14371
+ for (const [prop, value] of Object.entries(stored)) {
14372
+ try {
14373
+ instance[prop] = value;
14374
+ } catch {}
14375
+ }
14376
+ };
14377
+ var preserveAcrossHmr = (instance) => {
14378
+ if (!isDev2())
14379
+ return;
14380
+ const key = instance.constructor?.name;
14381
+ if (!key || key === "Object")
14382
+ return;
14383
+ restoreFromCache(instance, key);
14384
+ getTracker().add(new WeakRef(instance));
14385
+ };
14342
14386
  // src/angular/pendingTask.ts
14343
14387
  import { inject, PendingTasks } from "@angular/core";
14344
14388
  var withPendingTask = async (work) => {
@@ -14655,6 +14699,7 @@ export {
14655
14699
  withPendingTask,
14656
14700
  renderIsland,
14657
14701
  provideDeterministicEnv,
14702
+ preserveAcrossHmr,
14658
14703
  handleAngularPageRequest,
14659
14704
  getCachedRouteData,
14660
14705
  defineAngularPage,
@@ -14673,5 +14718,5 @@ export {
14673
14718
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
14674
14719
  };
14675
14720
 
14676
- //# debugId=0B479276B930773364756E2164756E21
14721
+ //# debugId=8D1E0475EE1846E464756E2164756E21
14677
14722
  //# sourceMappingURL=index.js.map