@absolutejs/absolute 0.19.0-beta.65 → 0.19.0-beta.66
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/.claude/settings.local.json +3 -1
- package/dist/build.js +49 -12
- package/dist/build.js.map +5 -5
- package/dist/dev/client/handlers/react.ts +16 -41
- package/dist/index.js +49 -12
- package/dist/index.js.map +5 -5
- package/dist/src/dev/transformCache.d.ts +2 -1
- package/package.json +1 -1
|
@@ -8,7 +8,6 @@ import { detectCurrentFramework } from '../frameworkDetect';
|
|
|
8
8
|
|
|
9
9
|
export const handleReactUpdate = (message: {
|
|
10
10
|
data: {
|
|
11
|
-
dataModuleUrl?: string;
|
|
12
11
|
hasCSSChanges?: boolean;
|
|
13
12
|
hasComponentChanges?: boolean;
|
|
14
13
|
manifest?: Record<string, string>;
|
|
@@ -33,25 +32,8 @@ export const handleReactUpdate = (message: {
|
|
|
33
32
|
|
|
34
33
|
const refreshRuntime = window.$RefreshRuntime$;
|
|
35
34
|
const serverDuration = message.data.serverDuration;
|
|
36
|
-
const dataModuleUrl = message.data.dataModuleUrl;
|
|
37
35
|
const pageModuleUrl = message.data.pageModuleUrl;
|
|
38
36
|
|
|
39
|
-
// Non-component file: import the data file first (cache bust),
|
|
40
|
-
// then re-import the page so the component re-renders with new data.
|
|
41
|
-
if (dataModuleUrl && refreshRuntime) {
|
|
42
|
-
const pageUrl = window.__REACT_PAGE_MODULE__;
|
|
43
|
-
if (pageUrl) {
|
|
44
|
-
applyDataThenPage(
|
|
45
|
-
dataModuleUrl,
|
|
46
|
-
pageUrl,
|
|
47
|
-
refreshRuntime,
|
|
48
|
-
serverDuration
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
37
|
if (pageModuleUrl && refreshRuntime) {
|
|
56
38
|
applyRefreshImport(pageModuleUrl, refreshRuntime, serverDuration);
|
|
57
39
|
|
|
@@ -93,33 +75,26 @@ const applyRefreshImport = (
|
|
|
93
75
|
const clientStart = performance.now();
|
|
94
76
|
import(`${moduleUrl}?t=${Date.now()}`)
|
|
95
77
|
.then(() => {
|
|
96
|
-
refreshRuntime.performReactRefresh();
|
|
97
|
-
|
|
78
|
+
const result = refreshRuntime.performReactRefresh();
|
|
79
|
+
|
|
80
|
+
// If Fast Refresh was a no-op (data/utility file with no
|
|
81
|
+
// component exports), re-import the page entry so the
|
|
82
|
+
// component tree re-renders with the updated data.
|
|
83
|
+
// Chain invalidation ensures all intermediate modules have
|
|
84
|
+
// fresh ?v= params, so the browser re-fetches the whole chain.
|
|
85
|
+
if (!result && window.__REACT_PAGE_MODULE__) {
|
|
86
|
+
return import(
|
|
87
|
+
`${window.__REACT_PAGE_MODULE__}?t=${Date.now()}`
|
|
88
|
+
).then(() => {
|
|
89
|
+
refreshRuntime.performReactRefresh();
|
|
90
|
+
|
|
91
|
+
return undefined;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
98
94
|
|
|
99
95
|
return undefined;
|
|
100
96
|
})
|
|
101
|
-
.catch((err) => {
|
|
102
|
-
console.warn(
|
|
103
|
-
'[HMR] React Fast Refresh failed, falling back to reload:',
|
|
104
|
-
err
|
|
105
|
-
);
|
|
106
|
-
window.location.reload();
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const applyDataThenPage = (
|
|
111
|
-
dataUrl: string,
|
|
112
|
-
pageUrl: string,
|
|
113
|
-
refreshRuntime: { performReactRefresh: () => unknown },
|
|
114
|
-
serverDuration?: number
|
|
115
|
-
) => {
|
|
116
|
-
const clientStart = performance.now();
|
|
117
|
-
// Import the changed data file first to bust the browser cache,
|
|
118
|
-
// then re-import the page so the component re-renders with new data.
|
|
119
|
-
import(`${dataUrl}?t=${Date.now()}`)
|
|
120
|
-
.then(() => import(`${pageUrl}?t=${Date.now()}`))
|
|
121
97
|
.then(() => {
|
|
122
|
-
refreshRuntime.performReactRefresh();
|
|
123
98
|
sendTiming(clientStart, serverDuration);
|
|
124
99
|
|
|
125
100
|
return undefined;
|
package/dist/index.js
CHANGED
|
@@ -202323,15 +202323,43 @@ var init_pageHandler = __esm(() => {
|
|
|
202323
202323
|
});
|
|
202324
202324
|
|
|
202325
202325
|
// src/dev/transformCache.ts
|
|
202326
|
-
var globalStore, cache, getTransformed = (filePath) => cache.get(filePath)?.content, setTransformed = (filePath, content, mtime) => {
|
|
202327
|
-
|
|
202328
|
-
|
|
202329
|
-
|
|
202326
|
+
var globalStore, cache, importers, getTransformed = (filePath) => cache.get(filePath)?.content, setTransformed = (filePath, content, mtime, imports) => {
|
|
202327
|
+
const resolvedImports = imports ?? [];
|
|
202328
|
+
cache.set(filePath, { content, imports: resolvedImports, mtime });
|
|
202329
|
+
for (const imp of resolvedImports) {
|
|
202330
|
+
if (!importers.has(imp)) {
|
|
202331
|
+
importers.set(imp, new Set);
|
|
202332
|
+
}
|
|
202333
|
+
importers.get(imp).add(filePath);
|
|
202334
|
+
}
|
|
202335
|
+
}, invalidationVersions, getInvalidationVersion = (filePath) => invalidationVersions.get(filePath) ?? 0, invalidate = (filePath) => {
|
|
202336
|
+
const queue = [filePath];
|
|
202337
|
+
const visited = new Set;
|
|
202338
|
+
while (queue.length > 0) {
|
|
202339
|
+
const current = queue.pop();
|
|
202340
|
+
if (visited.has(current))
|
|
202341
|
+
continue;
|
|
202342
|
+
visited.add(current);
|
|
202343
|
+
cache.delete(current);
|
|
202344
|
+
if (current !== filePath) {
|
|
202345
|
+
invalidationVersions.set(current, (invalidationVersions.get(current) ?? 0) + 1);
|
|
202346
|
+
}
|
|
202347
|
+
const parents = importers.get(current);
|
|
202348
|
+
if (parents) {
|
|
202349
|
+
for (const parent of parents) {
|
|
202350
|
+
queue.push(parent);
|
|
202351
|
+
}
|
|
202352
|
+
}
|
|
202353
|
+
}
|
|
202330
202354
|
};
|
|
202331
202355
|
var init_transformCache = __esm(() => {
|
|
202332
202356
|
globalStore = globalThis;
|
|
202333
202357
|
cache = globalStore.__transformCache ?? new Map;
|
|
202334
202358
|
globalStore.__transformCache = cache;
|
|
202359
|
+
importers = globalStore.__transformImporters ?? new Map;
|
|
202360
|
+
globalStore.__transformImporters = importers;
|
|
202361
|
+
invalidationVersions = globalStore.__transformInvalidationVersions ?? new Map;
|
|
202362
|
+
globalStore.__transformInvalidationVersions = invalidationVersions;
|
|
202335
202363
|
});
|
|
202336
202364
|
|
|
202337
202365
|
// src/dev/moduleServer.ts
|
|
@@ -202384,7 +202412,9 @@ ${stubs}
|
|
|
202384
202412
|
return base;
|
|
202385
202413
|
}
|
|
202386
202414
|
}
|
|
202387
|
-
|
|
202415
|
+
const iv = getInvalidationVersion(absPath);
|
|
202416
|
+
const version = iv > 0 ? `${mtime}.${iv}` : `${mtime}`;
|
|
202417
|
+
return `${base}?v=${version}`;
|
|
202388
202418
|
}, rewriteImports2 = (code, filePath, projectRoot, rewriter) => {
|
|
202389
202419
|
let result = code;
|
|
202390
202420
|
if (rewriter) {
|
|
@@ -202827,7 +202857,7 @@ export default {};
|
|
|
202827
202857
|
return jsResponse(cached2);
|
|
202828
202858
|
const stat3 = statSync(filePath);
|
|
202829
202859
|
const content2 = await transformSvelteFile(filePath, projectRoot, rewriter);
|
|
202830
|
-
setTransformed(filePath, content2, stat3.mtimeMs);
|
|
202860
|
+
setTransformed(filePath, content2, stat3.mtimeMs, extractImportedFiles(content2, projectRoot));
|
|
202831
202861
|
return jsResponse(content2);
|
|
202832
202862
|
}
|
|
202833
202863
|
if (ext === ".vue") {
|
|
@@ -202836,7 +202866,7 @@ export default {};
|
|
|
202836
202866
|
return jsResponse(cached2);
|
|
202837
202867
|
const stat3 = statSync(filePath);
|
|
202838
202868
|
const content2 = await transformVueFile(filePath, projectRoot, rewriter, frameworkDirs?.vue);
|
|
202839
|
-
setTransformed(filePath, content2, stat3.mtimeMs);
|
|
202869
|
+
setTransformed(filePath, content2, stat3.mtimeMs, extractImportedFiles(content2, projectRoot));
|
|
202840
202870
|
return jsResponse(content2);
|
|
202841
202871
|
}
|
|
202842
202872
|
if (!TRANSPILABLE.has(ext))
|
|
@@ -202846,7 +202876,7 @@ export default {};
|
|
|
202846
202876
|
return jsResponse(cached);
|
|
202847
202877
|
const stat2 = statSync(filePath);
|
|
202848
202878
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter);
|
|
202849
|
-
setTransformed(filePath, content, stat2.mtimeMs);
|
|
202879
|
+
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
202850
202880
|
return jsResponse(content);
|
|
202851
202881
|
} catch (err) {
|
|
202852
202882
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -202856,6 +202886,15 @@ export default {};
|
|
|
202856
202886
|
});
|
|
202857
202887
|
}
|
|
202858
202888
|
};
|
|
202889
|
+
}, SRC_IMPORT_RE, extractImportedFiles = (content, projectRoot) => {
|
|
202890
|
+
const files = [];
|
|
202891
|
+
let match;
|
|
202892
|
+
SRC_IMPORT_RE.lastIndex = 0;
|
|
202893
|
+
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
202894
|
+
if (match[1])
|
|
202895
|
+
files.push(resolve18(projectRoot, match[1]));
|
|
202896
|
+
}
|
|
202897
|
+
return files;
|
|
202859
202898
|
}, invalidateModule = (filePath) => {
|
|
202860
202899
|
invalidate(filePath);
|
|
202861
202900
|
mtimeCache.delete(filePath);
|
|
@@ -202923,6 +202962,7 @@ var init_moduleServer = __esm(() => {
|
|
|
202923
202962
|
trimUnusedImports: true
|
|
202924
202963
|
});
|
|
202925
202964
|
svelteExternalCss = new Map;
|
|
202965
|
+
SRC_IMPORT_RE = /\/@src\/([^"'?\s]+)/g;
|
|
202926
202966
|
SRC_URL_PREFIX = SRC_PREFIX;
|
|
202927
202967
|
});
|
|
202928
202968
|
|
|
@@ -203449,16 +203489,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203449
203489
|
for (const file4 of reactFiles) {
|
|
203450
203490
|
invalidateModule2(file4);
|
|
203451
203491
|
}
|
|
203452
|
-
const isComponentFile = primaryFile.endsWith(".tsx") || primaryFile.endsWith(".jsx");
|
|
203453
203492
|
const pageModuleUrl = await getReactModuleUrl(primaryFile);
|
|
203454
|
-
const dataModuleUrl = isComponentFile ? undefined : pageModuleUrl;
|
|
203455
203493
|
if (pageModuleUrl) {
|
|
203456
203494
|
const serverDuration = Date.now() - startTime;
|
|
203457
203495
|
state.lastHmrPath = relative9(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
203458
203496
|
state.lastHmrFramework = "react";
|
|
203459
203497
|
broadcastToClients(state, {
|
|
203460
203498
|
data: {
|
|
203461
|
-
dataModuleUrl,
|
|
203462
203499
|
framework: "react",
|
|
203463
203500
|
hasComponentChanges: true,
|
|
203464
203501
|
hasCSSChanges: false,
|
|
@@ -205222,5 +205259,5 @@ export {
|
|
|
205222
205259
|
ANGULAR_INIT_TIMEOUT_MS
|
|
205223
205260
|
};
|
|
205224
205261
|
|
|
205225
|
-
//# debugId=
|
|
205262
|
+
//# debugId=364C554C5D92BFFF64756E2164756E21
|
|
205226
205263
|
//# sourceMappingURL=index.js.map
|