@absolutejs/absolute 0.20.0-beta.4 → 0.20.0-beta.6

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.
Files changed (46) hide show
  1. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  2. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  3. package/dist/angular/index.js +341 -22
  4. package/dist/angular/index.js.map +8 -5
  5. package/dist/angular/server.js +341 -22
  6. package/dist/angular/server.js.map +8 -5
  7. package/dist/build.js +94 -22
  8. package/dist/build.js.map +9 -9
  9. package/dist/cli/index.js +986 -557
  10. package/dist/dev/client/cssUtils.ts +16 -2
  11. package/dist/dev/client/handlers/rebuild.ts +11 -1
  12. package/dist/dev/client/hmrTiming.ts +14 -7
  13. package/dist/index.js +364 -191
  14. package/dist/index.js.map +17 -17
  15. package/dist/mobile/browser.js +14 -1
  16. package/dist/mobile/browser.js.map +3 -3
  17. package/dist/mobile/index.js +588 -99
  18. package/dist/mobile/index.js.map +15 -13
  19. package/dist/mobile/remoteMacAgentEntry.js +8 -8
  20. package/dist/src/angular/pageHandler.d.ts +3 -0
  21. package/dist/src/cli/config/server.d.ts +1 -1
  22. package/dist/src/core/pageHandlers.d.ts +11 -2
  23. package/dist/src/mobile/androidEmulatorController.d.ts +6 -1
  24. package/dist/src/mobile/buildPipeline.d.ts +1 -0
  25. package/dist/src/mobile/capacitorBundle.d.ts +11 -1
  26. package/dist/src/mobile/client.d.ts +4 -0
  27. package/dist/src/mobile/index.d.ts +1 -0
  28. package/dist/src/mobile/nativeAuth.d.ts +17 -0
  29. package/dist/src/mobile/releaseArtifact.d.ts +2 -0
  30. package/dist/src/mobile/shellAuth.d.ts +8 -0
  31. package/dist/src/mobile/shellBootstrap.d.ts +11 -1
  32. package/dist/src/mobile/shellSync.d.ts +2 -0
  33. package/dist/src/mobile/staticDocument.d.ts +5 -0
  34. package/dist/src/mobile/transport.d.ts +9 -1
  35. package/dist/src/plugins/imageOptimizer.d.ts +1 -1
  36. package/dist/src/svelte/pageHandler.d.ts +3 -0
  37. package/dist/src/vue/pageHandler.d.ts +3 -0
  38. package/dist/svelte/index.js +312 -23
  39. package/dist/svelte/index.js.map +7 -4
  40. package/dist/svelte/server.js +307 -18
  41. package/dist/svelte/server.js.map +7 -4
  42. package/dist/vue/index.js +312 -23
  43. package/dist/vue/index.js.map +7 -4
  44. package/dist/vue/server.js +307 -18
  45. package/dist/vue/server.js.map +7 -4
  46. package/package.json +21 -9
@@ -151,7 +151,8 @@ const findManifestHref = (
151
151
 
152
152
  const replaceStylesheetLink = (
153
153
  existingLink: HTMLLinkElement,
154
- newHref: string
154
+ newHref: string,
155
+ attempt = 0
155
156
  ) => {
156
157
  const replacement = existingLink.cloneNode(true);
157
158
  if (!(replacement instanceof HTMLLinkElement)) {
@@ -167,7 +168,20 @@ const replaceStylesheetLink = (
167
168
  resolve(applied);
168
169
  };
169
170
  replacement.onload = () => finish(true);
170
- replacement.onerror = () => finish(false);
171
+ replacement.onerror = () => {
172
+ if (attempt >= 1) {
173
+ finish(false);
174
+
175
+ return;
176
+ }
177
+ replacement.remove();
178
+ settled = true;
179
+ void replaceStylesheetLink(
180
+ existingLink,
181
+ `${newHref}${newHref.includes('?') ? '&' : '?'}retry=${Date.now()}`,
182
+ attempt + 1
183
+ ).then(resolve);
184
+ };
171
185
  replacement.href = newHref;
172
186
  existingLink.after(replacement);
173
187
  setTimeout(() => {
@@ -7,12 +7,22 @@ import {
7
7
  isRuntimeErrorOverlay,
8
8
  showErrorOverlay
9
9
  } from '../errorOverlay';
10
+ import { detectCurrentFramework } from '../frameworkDetect';
10
11
  import { sendAbsoluteHmrTiming } from '../hmrTiming';
11
12
 
12
13
  export const handleFullReload = (message?: {
13
- data: { serverDuration?: number };
14
+ data: { affectedFrameworks?: string[]; serverDuration?: number };
14
15
  timestamp?: number;
15
16
  }) => {
17
+ const affectedFrameworks = message?.data.affectedFrameworks;
18
+ const currentFramework = detectCurrentFramework();
19
+ if (
20
+ affectedFrameworks?.length &&
21
+ currentFramework &&
22
+ !affectedFrameworks.includes(currentFramework)
23
+ ) {
24
+ return;
25
+ }
16
26
  const clientStart = performance.now();
17
27
  sendAbsoluteHmrTiming({
18
28
  clientStart,
@@ -47,14 +47,14 @@ const getSessionStorage = () => {
47
47
  return storage;
48
48
  };
49
49
 
50
- const persistHmrApply = (timing: HmrApply) => {
50
+ const persistHmrApplies = (timings: HmrApply[]) => {
51
51
  try {
52
52
  const storage = getSessionStorage();
53
53
  const setItem = storage && Reflect.get(storage, 'setItem');
54
54
  if (typeof setItem !== 'function') return;
55
55
  Reflect.apply(setItem, storage, [
56
56
  HMR_APPLY_STORAGE_KEY,
57
- JSON.stringify(timing)
57
+ JSON.stringify(timings)
58
58
  ]);
59
59
  } catch {
60
60
  // Storage may be unavailable in sandboxed or privacy-restricted documents.
@@ -100,10 +100,17 @@ export const restoreAbsoluteHmrApply = () => {
100
100
  HMR_APPLY_STORAGE_KEY
101
101
  ]);
102
102
  if (typeof serialized !== 'string') return;
103
- const timing: unknown = JSON.parse(serialized);
104
- if (!isHmrApply(timing)) return;
105
- window.__ABS_HMR_LAST_APPLY__ = timing;
106
- window.__ABS_HMR_APPLIES__ = [timing];
103
+ const stored: unknown = JSON.parse(serialized);
104
+ let timings: HmrApply[] = [];
105
+ if (Array.isArray(stored)) {
106
+ timings = stored
107
+ .filter(isHmrApply)
108
+ .slice(-MAX_RETAINED_HMR_APPLIES);
109
+ } else if (isHmrApply(stored)) timings = [stored];
110
+ const last = timings.at(-1);
111
+ if (!last) return;
112
+ window.__ABS_HMR_LAST_APPLY__ = last;
113
+ window.__ABS_HMR_APPLIES__ = timings;
107
114
  } catch {
108
115
  // A malformed or inaccessible entry should never affect HMR startup.
109
116
  }
@@ -135,7 +142,7 @@ export const sendAbsoluteHmrTiming = (options: SendHmrTimingOptions) => {
135
142
  if (applies.length > MAX_RETAINED_HMR_APPLIES) {
136
143
  applies.splice(0, applies.length - MAX_RETAINED_HMR_APPLIES);
137
144
  }
138
- persistHmrApply(timing);
145
+ persistHmrApplies(applies);
139
146
  if (!window.__HMR_WS__) return;
140
147
  window.__HMR_WS__.send(JSON.stringify({ ...timing, type: 'hmr-timing' }));
141
148
  };