weifuwu 0.67.0 → 0.67.1
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 +12 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4567,11 +4567,16 @@ async function jsCacheFresh(inputs) {
|
|
|
4567
4567
|
for (const [file, mtime] of Object.entries(inputs)) {
|
|
4568
4568
|
try {
|
|
4569
4569
|
const st = await stat(file);
|
|
4570
|
-
if (st.mtimeMs !== mtime)
|
|
4570
|
+
if (st.mtimeMs !== mtime) {
|
|
4571
|
+
console.log(`[ui:js-cache] \u5931\u6548: ${file} (cached=${mtime} now=${st.mtimeMs})`);
|
|
4572
|
+
return false;
|
|
4573
|
+
}
|
|
4571
4574
|
} catch {
|
|
4575
|
+
console.log(`[ui:js-cache] \u5931\u6548: stat \u5931\u8D25 ${file}`);
|
|
4572
4576
|
return false;
|
|
4573
4577
|
}
|
|
4574
4578
|
}
|
|
4579
|
+
console.log(`[ui:js-cache] \u547D\u4E2D: ${Object.keys(inputs).length} inputs`);
|
|
4575
4580
|
return true;
|
|
4576
4581
|
}
|
|
4577
4582
|
var cssCache = /* @__PURE__ */ new Map();
|
|
@@ -4623,6 +4628,7 @@ function ui() {
|
|
|
4623
4628
|
async js(entryPath) {
|
|
4624
4629
|
const absPath = resolveEntry(entryPath);
|
|
4625
4630
|
const cached = jsCache.get(absPath);
|
|
4631
|
+
console.log(`[ui:js-cache] \u8BF7\u6C42: ${absPath.split("/").pop()} (cached=${!!cached})`);
|
|
4626
4632
|
if (cached && await jsCacheFresh(cached.inputs)) {
|
|
4627
4633
|
return new Response(cached.code, {
|
|
4628
4634
|
headers: { "Content-Type": "application/javascript", "Cache-Control": "no-cache" }
|
|
@@ -4647,6 +4653,11 @@ function ui() {
|
|
|
4647
4653
|
} catch {
|
|
4648
4654
|
}
|
|
4649
4655
|
}
|
|
4656
|
+
try {
|
|
4657
|
+
inputs[absPath] = (await stat(absPath)).mtimeMs;
|
|
4658
|
+
} catch {
|
|
4659
|
+
}
|
|
4660
|
+
console.log(`[ui:js-cache] \u7F16\u8BD1: ${absPath.split("/").pop()} (${Object.keys(inputs).length} inputs, ${(code.length / 1024).toFixed(0)}KB)`);
|
|
4650
4661
|
jsCache.set(absPath, { code, inputs });
|
|
4651
4662
|
return new Response(code, {
|
|
4652
4663
|
headers: { "Content-Type": "application/javascript", "Cache-Control": "no-cache" }
|