@vesk/vesk-cli 0.2.29 → 0.2.30
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/cli.js +28 -8
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -52411,6 +52411,24 @@ function countFilesNamed(dir, name) {
|
|
|
52411
52411
|
}
|
|
52412
52412
|
return n;
|
|
52413
52413
|
}
|
|
52414
|
+
function cachedSsrCompile(cache2, src2, filePath) {
|
|
52415
|
+
const compileHydrate = (source) => {
|
|
52416
|
+
resetVskState(true);
|
|
52417
|
+
return compileFile(source, { sourcePath: filePath });
|
|
52418
|
+
};
|
|
52419
|
+
const st = statSync21(filePath, { throwIfNoEntry: false });
|
|
52420
|
+
if (st) {
|
|
52421
|
+
const cur = cache2.get(filePath);
|
|
52422
|
+
if (cur && cur.mtimeMs === st.mtimeMs && cur.size === st.size) return cur.result;
|
|
52423
|
+
const result = compileHydrate(src2);
|
|
52424
|
+
cache2.set(filePath, { mtimeMs: st.mtimeMs, size: st.size, result });
|
|
52425
|
+
return result;
|
|
52426
|
+
}
|
|
52427
|
+
return compileHydrate(src2);
|
|
52428
|
+
}
|
|
52429
|
+
function invalidateSsrCompile(cache2, filePath) {
|
|
52430
|
+
cache2.delete(filePath);
|
|
52431
|
+
}
|
|
52414
52432
|
async function startDevServer(port, projectDir, config, host) {
|
|
52415
52433
|
const bindHost = host || "127.0.0.1";
|
|
52416
52434
|
if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
|
|
@@ -52562,6 +52580,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
52562
52580
|
let runtimeBundle = "";
|
|
52563
52581
|
let devBundleBytes = 0;
|
|
52564
52582
|
const bundleCache = { files: /* @__PURE__ */ new Map() };
|
|
52583
|
+
const ssrCompileCache = /* @__PURE__ */ new Map();
|
|
52565
52584
|
function runtimeImportNamesFrom(clientJs) {
|
|
52566
52585
|
const m = clientJs.match(/^import\s*\{([^}]*)\}\s*from\s*['"]\/_vesk\/runtime\.js['"];?\s*$/m);
|
|
52567
52586
|
if (!m) return null;
|
|
@@ -52770,6 +52789,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
52770
52789
|
const lastSeenContent = /* @__PURE__ */ new Map();
|
|
52771
52790
|
let chunkRefresh = Promise.resolve();
|
|
52772
52791
|
const queueClientChunksRefresh = (fullPath, filename, fileExists) => {
|
|
52792
|
+
invalidateSsrCompile(ssrCompileCache, fullPath);
|
|
52773
52793
|
chunkRefresh = chunkRefresh.then(async () => {
|
|
52774
52794
|
try {
|
|
52775
52795
|
const hot = await buildClientChunks(fullPath);
|
|
@@ -53277,7 +53297,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
53277
53297
|
try {
|
|
53278
53298
|
const nfSrc = readFileSync38(nfPath, "utf-8");
|
|
53279
53299
|
const nfCompName = extractCompName2(nfSrc) || rootNode.notFound;
|
|
53280
|
-
notFoundHtml = await renderFullPage(nfSrc, nfCompName, { params: {}, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, plugins: getActiveDevPlugins() });
|
|
53300
|
+
notFoundHtml = await renderFullPage(nfSrc, nfCompName, { params: {}, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, cached: cachedSsrCompile(ssrCompileCache, nfSrc, nfPath), plugins: getActiveDevPlugins() });
|
|
53281
53301
|
} catch {
|
|
53282
53302
|
}
|
|
53283
53303
|
}
|
|
@@ -53322,7 +53342,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
53322
53342
|
if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
|
|
53323
53343
|
const src2 = readFileSync38(pageFilePath, "utf-8");
|
|
53324
53344
|
const compName = extractCompName2(src2) || node.page;
|
|
53325
|
-
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
|
|
53345
|
+
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
|
|
53326
53346
|
body = result.body;
|
|
53327
53347
|
head = result.head || "";
|
|
53328
53348
|
props = result.props;
|
|
@@ -53330,7 +53350,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
53330
53350
|
if (node.layout && existsSync42(layoutFilePath)) {
|
|
53331
53351
|
const src2 = readFileSync38(layoutFilePath, "utf-8");
|
|
53332
53352
|
const compName = extractCompName2(src2) || node.layout;
|
|
53333
|
-
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
|
|
53353
|
+
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
|
|
53334
53354
|
body = result.body;
|
|
53335
53355
|
head = (result.head || "") + head;
|
|
53336
53356
|
}
|
|
@@ -53375,7 +53395,7 @@ ${prettifyHtml(body)}
|
|
|
53375
53395
|
if (leaf) {
|
|
53376
53396
|
const src2 = readFileSync38(resolve38(appDirPath, leaf.sourceDir, "page.vsk"), "utf-8");
|
|
53377
53397
|
const compName = extractCompName2(src2) || leaf.page;
|
|
53378
|
-
html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf.sourceDir, "page.vsk"), plugins: getActiveDevPlugins() });
|
|
53398
|
+
html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve38(appDirPath, leaf.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
|
|
53379
53399
|
html = html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>');
|
|
53380
53400
|
html = await applyHtmlPlugins(html, getActiveDevPlugins(), { sourcePath: url.pathname });
|
|
53381
53401
|
} else {
|
|
@@ -53405,7 +53425,7 @@ ${prettifyHtml(body)}
|
|
|
53405
53425
|
if (leaf) {
|
|
53406
53426
|
const src2 = readFileSync38(resolve38(appDirPath, leaf.sourceDir, "page.vsk"), "utf-8");
|
|
53407
53427
|
const compName = extractCompName2(src2) || leaf.page;
|
|
53408
|
-
yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf.sourceDir, "page.vsk"), plugins: getActiveDevPlugins() });
|
|
53428
|
+
yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve38(appDirPath, leaf.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
|
|
53409
53429
|
} else {
|
|
53410
53430
|
throw new Error("No page or layout matched");
|
|
53411
53431
|
}
|
|
@@ -53421,7 +53441,7 @@ ${prettifyHtml(body)}
|
|
|
53421
53441
|
if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
|
|
53422
53442
|
const src2 = readFileSync38(pageFilePath, "utf-8");
|
|
53423
53443
|
const compName = extractCompName2(src2) || node.page;
|
|
53424
|
-
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
|
|
53444
|
+
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
|
|
53425
53445
|
body = result.body;
|
|
53426
53446
|
head = result.head || "";
|
|
53427
53447
|
props = result.props;
|
|
@@ -53429,7 +53449,7 @@ ${prettifyHtml(body)}
|
|
|
53429
53449
|
if (node.layout && existsSync42(layoutFilePath)) {
|
|
53430
53450
|
const src2 = readFileSync38(layoutFilePath, "utf-8");
|
|
53431
53451
|
const compName = extractCompName2(src2) || node.layout;
|
|
53432
|
-
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
|
|
53452
|
+
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
|
|
53433
53453
|
body = result.body;
|
|
53434
53454
|
head = (result.head || "") + head;
|
|
53435
53455
|
}
|
|
@@ -53569,7 +53589,7 @@ ${prettifyHtml(body)}
|
|
|
53569
53589
|
try {
|
|
53570
53590
|
const nfSrc = readFileSync38(nfPath, "utf-8");
|
|
53571
53591
|
const nfCompName = extractCompName2(nfSrc) || node.notFound;
|
|
53572
|
-
const html = await renderFullPage(nfSrc, nfCompName, { params: match.params, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, plugins: getActiveDevPlugins() });
|
|
53592
|
+
const html = await renderFullPage(nfSrc, nfCompName, { params: match.params, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, cached: cachedSsrCompile(ssrCompileCache, nfSrc, nfPath), plugins: getActiveDevPlugins() });
|
|
53573
53593
|
notFoundHtml = injectDevScripts(html);
|
|
53574
53594
|
} catch {
|
|
53575
53595
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
|
|
6
6
|
"bin": {
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/cli.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@vesk/adapter": "^0.2.
|
|
12
|
-
"@vesk/compiler": "^0.2.
|
|
13
|
-
"@vesk/plugin-tailwind": "^0.2.
|
|
14
|
-
"@vesk/runtime": "^0.2.
|
|
11
|
+
"@vesk/adapter": "^0.2.30",
|
|
12
|
+
"@vesk/compiler": "^0.2.30",
|
|
13
|
+
"@vesk/plugin-tailwind": "^0.2.30",
|
|
14
|
+
"@vesk/runtime": "^0.2.30",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|