@vesk/vesk-cli 0.2.35 → 0.2.36
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 +153 -135
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -18230,115 +18230,12 @@ var init_tokens = __esm({
|
|
|
18230
18230
|
}
|
|
18231
18231
|
});
|
|
18232
18232
|
|
|
18233
|
-
// ../compiler/src/vsk-imports.ts
|
|
18234
|
-
import { dirname as dirname2, resolve } from "node:path";
|
|
18235
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
18236
|
-
import { print as print2 } from "esrap";
|
|
18237
|
-
import ts2 from "esrap/languages/ts";
|
|
18238
|
-
function vskImportTarget(importText) {
|
|
18239
|
-
const spec = importModuleTarget(importText);
|
|
18240
|
-
if (spec === null || !spec.endsWith(".vsk")) return null;
|
|
18241
|
-
const tokens = tokenizeCode(importText);
|
|
18242
|
-
if (tokens === null) return null;
|
|
18243
|
-
const hasFrom = tokens.some((t) => t.label === "name" && t.value === "from");
|
|
18244
|
-
if (!hasFrom) return null;
|
|
18245
|
-
return spec;
|
|
18246
|
-
}
|
|
18247
|
-
function extractImportStatements(source) {
|
|
18248
|
-
try {
|
|
18249
|
-
const ast = parse4(source, { filename: "imports.vsk" });
|
|
18250
|
-
const out = [];
|
|
18251
|
-
for (const stmt of ast.body) {
|
|
18252
|
-
if (stmt.type === "ImportDeclaration") {
|
|
18253
|
-
out.push(source.slice(stmt.start, stmt.end));
|
|
18254
|
-
}
|
|
18255
|
-
}
|
|
18256
|
-
return out;
|
|
18257
|
-
} catch {
|
|
18258
|
-
return tokenExtractImportStatements(source);
|
|
18259
|
-
}
|
|
18260
|
-
}
|
|
18261
|
-
function tokenExtractImportStatements(source) {
|
|
18262
|
-
const tokens = tokenizeCode(source);
|
|
18263
|
-
if (tokens === null) return [];
|
|
18264
|
-
const out = [];
|
|
18265
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
18266
|
-
if (tokens[i].label !== "import") continue;
|
|
18267
|
-
const start = tokens[i].start;
|
|
18268
|
-
let lastStringEnd = -1;
|
|
18269
|
-
let end = -1;
|
|
18270
|
-
let j = i + 1;
|
|
18271
|
-
while (j < tokens.length) {
|
|
18272
|
-
if (tokens[j].label === ";") {
|
|
18273
|
-
end = tokens[j].end;
|
|
18274
|
-
break;
|
|
18275
|
-
}
|
|
18276
|
-
if (tokens[j].label === "import") break;
|
|
18277
|
-
if (tokens[j].label === "string") lastStringEnd = tokens[j].end;
|
|
18278
|
-
j++;
|
|
18279
|
-
}
|
|
18280
|
-
if (end === -1) end = lastStringEnd !== -1 ? lastStringEnd : tokens[i].end;
|
|
18281
|
-
const stmt = source.slice(start, end).trim();
|
|
18282
|
-
if (stmt) out.push(stmt);
|
|
18283
|
-
if (tokens[j] && tokens[j].label === ";") i = j;
|
|
18284
|
-
}
|
|
18285
|
-
return out;
|
|
18286
|
-
}
|
|
18287
|
-
function collectVskImportPaths(imports, sourcePath2) {
|
|
18288
|
-
const out = [];
|
|
18289
|
-
for (const imp of imports) {
|
|
18290
|
-
if (stripTypeImport(imp) === null) continue;
|
|
18291
|
-
const target = vskImportTarget(imp);
|
|
18292
|
-
if (!target || !target.startsWith(".")) continue;
|
|
18293
|
-
const full = resolve(dirname2(sourcePath2), target);
|
|
18294
|
-
if (existsSync2(full)) out.push(full);
|
|
18295
|
-
}
|
|
18296
|
-
return out;
|
|
18297
|
-
}
|
|
18298
|
-
function vskImportLines(source) {
|
|
18299
|
-
return extractImportStatements(source).filter((imp) => vskImportTarget(imp) !== null && stripTypeImport(imp) !== null);
|
|
18300
|
-
}
|
|
18301
|
-
function isTypeOnlyImport(stmt) {
|
|
18302
|
-
if (!stmt || stmt.type !== "ImportDeclaration") return false;
|
|
18303
|
-
if (stmt.importKind === "type") return true;
|
|
18304
|
-
const specs = stmt.specifiers || [];
|
|
18305
|
-
return specs.length > 0 && specs.every((s) => s.importKind === "type");
|
|
18306
|
-
}
|
|
18307
|
-
function stripTypeImport(importSrc) {
|
|
18308
|
-
let ast;
|
|
18309
|
-
try {
|
|
18310
|
-
ast = parse4(importSrc, { filename: "import.mjs" });
|
|
18311
|
-
} catch {
|
|
18312
|
-
return importSrc;
|
|
18313
|
-
}
|
|
18314
|
-
const stmt = (ast.body || []).find((n) => n.type === "ImportDeclaration");
|
|
18315
|
-
if (!stmt) return importSrc;
|
|
18316
|
-
if (isTypeOnlyImport(stmt)) return null;
|
|
18317
|
-
const specs = stmt.specifiers || [];
|
|
18318
|
-
const kept = specs.filter((s) => s.importKind !== "type");
|
|
18319
|
-
if (specs.length > 0 && kept.length === 0) return null;
|
|
18320
|
-
if (kept.length === specs.length) return importSrc;
|
|
18321
|
-
try {
|
|
18322
|
-
const rewritten = { ...stmt, specifiers: kept };
|
|
18323
|
-
return print2({ type: "Program", body: [rewritten], sourceType: "module" }, ts2()).code.trim();
|
|
18324
|
-
} catch {
|
|
18325
|
-
return importSrc;
|
|
18326
|
-
}
|
|
18327
|
-
}
|
|
18328
|
-
var init_vsk_imports = __esm({
|
|
18329
|
-
"../compiler/src/vsk-imports.ts"() {
|
|
18330
|
-
"use strict";
|
|
18331
|
-
init_parser();
|
|
18332
|
-
init_tokens();
|
|
18333
|
-
}
|
|
18334
|
-
});
|
|
18335
|
-
|
|
18336
18233
|
// ../compiler/src/module-imports.ts
|
|
18337
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
18234
|
+
import { readFileSync as readFileSync2, existsSync as existsSync2, realpathSync, statSync } from "node:fs";
|
|
18338
18235
|
import { createRequire as createRequire2 } from "node:module";
|
|
18339
|
-
import { dirname as
|
|
18340
|
-
import { print as
|
|
18341
|
-
import
|
|
18236
|
+
import { dirname as dirname2, extname, isAbsolute, join as join2, resolve } from "node:path";
|
|
18237
|
+
import { print as print2 } from "esrap";
|
|
18238
|
+
import ts2 from "esrap/languages/ts";
|
|
18342
18239
|
import { walk as walk2 } from "zimmerframe";
|
|
18343
18240
|
function cacheModule(p, val) {
|
|
18344
18241
|
MODULE_CACHE.delete(p);
|
|
@@ -18396,7 +18293,7 @@ function localValueImportNames(importStrs) {
|
|
|
18396
18293
|
}
|
|
18397
18294
|
function applyLocalModuleImports(__vesk, importStrs, sourcePath2) {
|
|
18398
18295
|
if (!sourcePath2) return;
|
|
18399
|
-
const fromDir =
|
|
18296
|
+
const fromDir = dirname2(sourcePath2);
|
|
18400
18297
|
for (const imp of importStrs) {
|
|
18401
18298
|
const target = importModuleTarget(imp);
|
|
18402
18299
|
if (!target || isCompilerOwnedTarget(target) || isValueLessTarget(target)) continue;
|
|
@@ -18458,7 +18355,7 @@ function loadSsrModule(absPath) {
|
|
|
18458
18355
|
const src2 = readSsrSource(absPath);
|
|
18459
18356
|
const body = src2?.ast?.body || [];
|
|
18460
18357
|
if (src2 && isPureReexportBarrel(body)) {
|
|
18461
|
-
exportsObj = createLazyBarrelExports(buildBarrelSpec(body),
|
|
18358
|
+
exportsObj = createLazyBarrelExports(buildBarrelSpec(body), dirname2(absPath));
|
|
18462
18359
|
} else {
|
|
18463
18360
|
exportsObj = {};
|
|
18464
18361
|
EVALUATING.set(absPath, exportsObj);
|
|
@@ -18673,7 +18570,7 @@ function evaluateModuleFile(absPath, exportsObj, src2) {
|
|
|
18673
18570
|
if (!ast) {
|
|
18674
18571
|
try {
|
|
18675
18572
|
const fn = new Function("require", "module", "exports", "__dirname", "__filename", raw2);
|
|
18676
|
-
fn(createModuleRequire(
|
|
18573
|
+
fn(createModuleRequire(dirname2(absPath)), { exports: exportsObj }, exportsObj, dirname2(absPath), absPath);
|
|
18677
18574
|
} catch (err) {
|
|
18678
18575
|
console.warn(`[vesk] SSR: failed to load ${absPath}: ${err?.message ?? String(err)}`);
|
|
18679
18576
|
return false;
|
|
@@ -18695,7 +18592,7 @@ function evaluateModuleFile(absPath, exportsObj, src2) {
|
|
|
18695
18592
|
const body = esmToCjs(stripped.body);
|
|
18696
18593
|
try {
|
|
18697
18594
|
const fn = new Function("require", "module", "exports", "__dirname", "__filename", "'use strict';\n" + body);
|
|
18698
|
-
fn(createModuleRequire(
|
|
18595
|
+
fn(createModuleRequire(dirname2(absPath)), { exports: exportsObj }, exportsObj, dirname2(absPath), absPath);
|
|
18699
18596
|
} catch (err) {
|
|
18700
18597
|
console.warn(`[vesk] SSR: failed to load ${absPath}: ${err?.message ?? String(err)}`);
|
|
18701
18598
|
return false;
|
|
@@ -18789,7 +18686,7 @@ function findTsconfigPath(fromDir) {
|
|
|
18789
18686
|
for (let depth = 0; depth < 64; depth++) {
|
|
18790
18687
|
const st = statOrNull(join2(dir, "tsconfig.json"));
|
|
18791
18688
|
if (st && st.isFile()) return join2(dir, "tsconfig.json");
|
|
18792
|
-
const parent =
|
|
18689
|
+
const parent = dirname2(dir);
|
|
18793
18690
|
if (parent === dir) break;
|
|
18794
18691
|
dir = parent;
|
|
18795
18692
|
}
|
|
@@ -18810,13 +18707,13 @@ function buildAliases(tsconfig) {
|
|
|
18810
18707
|
}
|
|
18811
18708
|
const co = parsed?.compilerOptions;
|
|
18812
18709
|
if (!co || typeof co.paths !== "object" || co.paths === null) return EMPTY_ALIASES;
|
|
18813
|
-
const configDir =
|
|
18814
|
-
const baseUrl = typeof co.baseUrl === "string" && co.baseUrl.length > 0 ?
|
|
18710
|
+
const configDir = dirname2(tsconfig);
|
|
18711
|
+
const baseUrl = typeof co.baseUrl === "string" && co.baseUrl.length > 0 ? resolve(configDir, co.baseUrl) : configDir;
|
|
18815
18712
|
const exact = /* @__PURE__ */ new Map();
|
|
18816
18713
|
const wildcard = [];
|
|
18817
18714
|
for (const [key, value] of Object.entries(co.paths)) {
|
|
18818
18715
|
if (!Array.isArray(value)) continue;
|
|
18819
|
-
const targets = value.filter((t) => typeof t === "string").map((t) =>
|
|
18716
|
+
const targets = value.filter((t) => typeof t === "string").map((t) => resolve(baseUrl, t));
|
|
18820
18717
|
if (targets.length === 0) continue;
|
|
18821
18718
|
const star = key.indexOf("*");
|
|
18822
18719
|
if (star === -1) exact.set(key, targets);
|
|
@@ -18857,12 +18754,12 @@ function resolveAliasModule(spec, fromDir) {
|
|
|
18857
18754
|
}
|
|
18858
18755
|
function resolveImportPath(spec, fromDir) {
|
|
18859
18756
|
if (spec.startsWith("./") || spec.startsWith("../")) {
|
|
18860
|
-
const base =
|
|
18757
|
+
const base = resolve(fromDir, spec);
|
|
18861
18758
|
if (extname(base)) return base;
|
|
18862
18759
|
for (const suffix of EXTENSIONS) {
|
|
18863
|
-
if (
|
|
18760
|
+
if (existsSync2(base + suffix)) return base + suffix;
|
|
18864
18761
|
}
|
|
18865
|
-
if (
|
|
18762
|
+
if (existsSync2(`${base}.vsk`)) return `${base}.vsk`;
|
|
18866
18763
|
return `${base}.ts`;
|
|
18867
18764
|
}
|
|
18868
18765
|
if (!isAbsolute(spec)) {
|
|
@@ -18874,11 +18771,11 @@ function resolveImportPath(spec, fromDir) {
|
|
|
18874
18771
|
function resolveSsrModule(specifier, fromDir) {
|
|
18875
18772
|
let resolved = null;
|
|
18876
18773
|
if (specifier === "." || specifier === "..") {
|
|
18877
|
-
resolved = probeFile(
|
|
18774
|
+
resolved = probeFile(resolve(fromDir, specifier));
|
|
18878
18775
|
} else if (isAbsolute(specifier)) {
|
|
18879
|
-
resolved = probeFile(
|
|
18776
|
+
resolved = probeFile(resolve(specifier));
|
|
18880
18777
|
} else if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
18881
|
-
resolved = probeFile(
|
|
18778
|
+
resolved = probeFile(resolve(fromDir, specifier));
|
|
18882
18779
|
} else {
|
|
18883
18780
|
const aliased = resolveAliasModule(specifier, fromDir);
|
|
18884
18781
|
if (aliased) return toRealPath(aliased);
|
|
@@ -18892,7 +18789,7 @@ function resolveSsrModule(specifier, fromDir) {
|
|
|
18892
18789
|
resolved = found;
|
|
18893
18790
|
break;
|
|
18894
18791
|
}
|
|
18895
|
-
const parent =
|
|
18792
|
+
const parent = dirname2(dir);
|
|
18896
18793
|
if (parent === dir) break;
|
|
18897
18794
|
dir = parent;
|
|
18898
18795
|
}
|
|
@@ -18955,7 +18852,7 @@ function probeFile(base) {
|
|
|
18955
18852
|
try {
|
|
18956
18853
|
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
18957
18854
|
if (typeof pkg.main === "string" && pkg.main.length > 0) {
|
|
18958
|
-
const viaMain = probeFile(
|
|
18855
|
+
const viaMain = probeFile(resolve(base, pkg.main));
|
|
18959
18856
|
if (viaMain) return viaMain;
|
|
18960
18857
|
}
|
|
18961
18858
|
} catch {
|
|
@@ -18980,7 +18877,7 @@ function astName(node) {
|
|
|
18980
18877
|
}
|
|
18981
18878
|
function printNode(node) {
|
|
18982
18879
|
try {
|
|
18983
|
-
return
|
|
18880
|
+
return print2(node, ts2()).code.trim();
|
|
18984
18881
|
} catch {
|
|
18985
18882
|
return "";
|
|
18986
18883
|
}
|
|
@@ -19154,7 +19051,7 @@ function collectModuleBundled(absPath, collector) {
|
|
|
19154
19051
|
if (existing) return existing;
|
|
19155
19052
|
const key = `__veskMod${collector.keysByAbs.size}`;
|
|
19156
19053
|
collector.keysByAbs.set(absPath, key);
|
|
19157
|
-
const dir =
|
|
19054
|
+
const dir = dirname2(absPath);
|
|
19158
19055
|
if (absPath.endsWith(".json")) {
|
|
19159
19056
|
let raw2 = "";
|
|
19160
19057
|
try {
|
|
@@ -19222,6 +19119,115 @@ var init_module_imports = __esm({
|
|
|
19222
19119
|
}
|
|
19223
19120
|
});
|
|
19224
19121
|
|
|
19122
|
+
// ../compiler/src/vsk-imports.ts
|
|
19123
|
+
import { dirname as dirname3, resolve as resolve2 } from "node:path";
|
|
19124
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
19125
|
+
import { print as print3 } from "esrap";
|
|
19126
|
+
import ts3 from "esrap/languages/ts";
|
|
19127
|
+
function vskImportTarget(importText) {
|
|
19128
|
+
const spec = importModuleTarget(importText);
|
|
19129
|
+
if (spec === null || !spec.endsWith(".vsk")) return null;
|
|
19130
|
+
const tokens = tokenizeCode(importText);
|
|
19131
|
+
if (tokens === null) return null;
|
|
19132
|
+
const hasFrom = tokens.some((t) => t.label === "name" && t.value === "from");
|
|
19133
|
+
if (!hasFrom) return null;
|
|
19134
|
+
return spec;
|
|
19135
|
+
}
|
|
19136
|
+
function extractImportStatements(source) {
|
|
19137
|
+
try {
|
|
19138
|
+
const ast = parse4(source, { filename: "imports.vsk" });
|
|
19139
|
+
const out = [];
|
|
19140
|
+
for (const stmt of ast.body) {
|
|
19141
|
+
if (stmt.type === "ImportDeclaration") {
|
|
19142
|
+
out.push(source.slice(stmt.start, stmt.end));
|
|
19143
|
+
}
|
|
19144
|
+
}
|
|
19145
|
+
return out;
|
|
19146
|
+
} catch {
|
|
19147
|
+
return tokenExtractImportStatements(source);
|
|
19148
|
+
}
|
|
19149
|
+
}
|
|
19150
|
+
function tokenExtractImportStatements(source) {
|
|
19151
|
+
const tokens = tokenizeCode(source);
|
|
19152
|
+
if (tokens === null) return [];
|
|
19153
|
+
const out = [];
|
|
19154
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
19155
|
+
if (tokens[i].label !== "import") continue;
|
|
19156
|
+
const start = tokens[i].start;
|
|
19157
|
+
let lastStringEnd = -1;
|
|
19158
|
+
let end = -1;
|
|
19159
|
+
let j = i + 1;
|
|
19160
|
+
while (j < tokens.length) {
|
|
19161
|
+
if (tokens[j].label === ";") {
|
|
19162
|
+
end = tokens[j].end;
|
|
19163
|
+
break;
|
|
19164
|
+
}
|
|
19165
|
+
if (tokens[j].label === "import") break;
|
|
19166
|
+
if (tokens[j].label === "string") lastStringEnd = tokens[j].end;
|
|
19167
|
+
j++;
|
|
19168
|
+
}
|
|
19169
|
+
if (end === -1) end = lastStringEnd !== -1 ? lastStringEnd : tokens[i].end;
|
|
19170
|
+
const stmt = source.slice(start, end).trim();
|
|
19171
|
+
if (stmt) out.push(stmt);
|
|
19172
|
+
if (tokens[j] && tokens[j].label === ";") i = j;
|
|
19173
|
+
}
|
|
19174
|
+
return out;
|
|
19175
|
+
}
|
|
19176
|
+
function collectVskImportPaths(imports, sourcePath2) {
|
|
19177
|
+
const out = [];
|
|
19178
|
+
for (const imp of imports) {
|
|
19179
|
+
if (stripTypeImport(imp) === null) continue;
|
|
19180
|
+
const target = vskImportTarget(imp);
|
|
19181
|
+
if (!target) continue;
|
|
19182
|
+
if (target.startsWith(".")) {
|
|
19183
|
+
const full = resolve2(dirname3(sourcePath2), target);
|
|
19184
|
+
if (existsSync3(full)) out.push(full);
|
|
19185
|
+
continue;
|
|
19186
|
+
}
|
|
19187
|
+
const aliased = resolveImportPath(target, dirname3(sourcePath2));
|
|
19188
|
+
if (aliased !== target && existsSync3(aliased)) out.push(aliased);
|
|
19189
|
+
}
|
|
19190
|
+
return out;
|
|
19191
|
+
}
|
|
19192
|
+
function vskImportLines(source) {
|
|
19193
|
+
return extractImportStatements(source).filter((imp) => vskImportTarget(imp) !== null && stripTypeImport(imp) !== null);
|
|
19194
|
+
}
|
|
19195
|
+
function isTypeOnlyImport(stmt) {
|
|
19196
|
+
if (!stmt || stmt.type !== "ImportDeclaration") return false;
|
|
19197
|
+
if (stmt.importKind === "type") return true;
|
|
19198
|
+
const specs = stmt.specifiers || [];
|
|
19199
|
+
return specs.length > 0 && specs.every((s) => s.importKind === "type");
|
|
19200
|
+
}
|
|
19201
|
+
function stripTypeImport(importSrc) {
|
|
19202
|
+
let ast;
|
|
19203
|
+
try {
|
|
19204
|
+
ast = parse4(importSrc, { filename: "import.mjs" });
|
|
19205
|
+
} catch {
|
|
19206
|
+
return importSrc;
|
|
19207
|
+
}
|
|
19208
|
+
const stmt = (ast.body || []).find((n) => n.type === "ImportDeclaration");
|
|
19209
|
+
if (!stmt) return importSrc;
|
|
19210
|
+
if (isTypeOnlyImport(stmt)) return null;
|
|
19211
|
+
const specs = stmt.specifiers || [];
|
|
19212
|
+
const kept = specs.filter((s) => s.importKind !== "type");
|
|
19213
|
+
if (specs.length > 0 && kept.length === 0) return null;
|
|
19214
|
+
if (kept.length === specs.length) return importSrc;
|
|
19215
|
+
try {
|
|
19216
|
+
const rewritten = { ...stmt, specifiers: kept };
|
|
19217
|
+
return print3({ type: "Program", body: [rewritten], sourceType: "module" }, ts3()).code.trim();
|
|
19218
|
+
} catch {
|
|
19219
|
+
return importSrc;
|
|
19220
|
+
}
|
|
19221
|
+
}
|
|
19222
|
+
var init_vsk_imports = __esm({
|
|
19223
|
+
"../compiler/src/vsk-imports.ts"() {
|
|
19224
|
+
"use strict";
|
|
19225
|
+
init_parser();
|
|
19226
|
+
init_module_imports();
|
|
19227
|
+
init_tokens();
|
|
19228
|
+
}
|
|
19229
|
+
});
|
|
19230
|
+
|
|
19225
19231
|
// ../compiler/src/ir-generator.ts
|
|
19226
19232
|
function parseExprNode(text) {
|
|
19227
19233
|
try {
|
|
@@ -39013,6 +39019,8 @@ import { readFileSync as readFileSync6, existsSync as existsSync7 } from "node:f
|
|
|
39013
39019
|
import { resolve as resolve6 } from "node:path";
|
|
39014
39020
|
var GLOBAL_CSS_URL = "/_vesk/static/global.css";
|
|
39015
39021
|
function resolveUserCssPath(appDir) {
|
|
39022
|
+
const appCssSrc = resolve6(appDir, "global.css");
|
|
39023
|
+
if (existsSync7(appCssSrc)) return appCssSrc;
|
|
39016
39024
|
const cssSrc = resolve6(appDir, "..", "src", "global.css");
|
|
39017
39025
|
if (existsSync7(cssSrc)) return cssSrc;
|
|
39018
39026
|
const altCssSrc = resolve6(appDir, "..", "src", "app.css");
|
|
@@ -39167,7 +39175,7 @@ ${layoutDecls.map((d) => " " + d.compiled + ",").join("\n")}
|
|
|
39167
39175
|
const plan = precompilePlan(compPath);
|
|
39168
39176
|
compRegEntries.push(` (() => {
|
|
39169
39177
|
const _compiled = (() => { try { return hydratePrecompile(${plan}); } catch { return null; } })();
|
|
39170
|
-
|
|
39178
|
+
__componentRegistry.set(${JSON.stringify(compName)}, async (props, __registry, __vesk) => {
|
|
39171
39179
|
const result = await renderPage('', ${JSON.stringify(compName)}, props, __registry, { hydrate: true, cached: _compiled });
|
|
39172
39180
|
return result.body;
|
|
39173
39181
|
});
|
|
@@ -48242,7 +48250,7 @@ async function addPluginToConfig2(projectDir, pkg) {
|
|
|
48242
48250
|
let source;
|
|
48243
48251
|
if (!path) {
|
|
48244
48252
|
const importName2 = importNameForPackage(pkg);
|
|
48245
|
-
const entry2 = pkg === "@vesk/plugin-tailwind" ? `${importName2}({ entry: '
|
|
48253
|
+
const entry2 = pkg === "@vesk/plugin-tailwind" ? `${importName2}({ entry: 'app/global.css', appDir: 'app' })` : `${importName2}()`;
|
|
48246
48254
|
source = `import { defineConfig } from '@vesk/compiler'
|
|
48247
48255
|
import ${importName2} from '${pkg}'
|
|
48248
48256
|
|
|
@@ -48326,7 +48334,7 @@ export default defineConfig({
|
|
|
48326
48334
|
source = importLine + source;
|
|
48327
48335
|
}
|
|
48328
48336
|
}
|
|
48329
|
-
const entry = pkg === "@vesk/plugin-tailwind" ? `${importName}({ entry: '
|
|
48337
|
+
const entry = pkg === "@vesk/plugin-tailwind" ? `${importName}({ entry: 'app/global.css', appDir: 'app' })` : `${importName}()`;
|
|
48330
48338
|
const newSource = insertIntoPluginsArray(source, entry);
|
|
48331
48339
|
if (newSource === source)
|
|
48332
48340
|
return;
|
|
@@ -51178,6 +51186,9 @@ import { readFileSync as readFileSync33, existsSync as existsSync37 } from "node
|
|
|
51178
51186
|
import { resolve as resolve33 } from "node:path";
|
|
51179
51187
|
var GLOBAL_CSS_URL2 = "/_vesk/static/global.css";
|
|
51180
51188
|
function resolveUserCssPath2(appDir) {
|
|
51189
|
+
const appCssSrc = resolve33(appDir, "global.css");
|
|
51190
|
+
if (existsSync37(appCssSrc))
|
|
51191
|
+
return appCssSrc;
|
|
51181
51192
|
const cssSrc = resolve33(appDir, "..", "src", "global.css");
|
|
51182
51193
|
if (existsSync37(cssSrc))
|
|
51183
51194
|
return cssSrc;
|
|
@@ -52793,13 +52804,20 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
52793
52804
|
}
|
|
52794
52805
|
let devGlobalCssContent = "";
|
|
52795
52806
|
let lastServedCssGlobal = "";
|
|
52807
|
+
const appCssPath = join24(appDirPath, "global.css");
|
|
52796
52808
|
const srcDir = join24(projectDir, "src");
|
|
52797
52809
|
const cssPath = join24(srcDir, "global.css");
|
|
52798
52810
|
const altCssPath = join24(srcDir, "app.css");
|
|
52799
52811
|
let rawCss = "";
|
|
52800
|
-
|
|
52812
|
+
let devCssSource = "";
|
|
52813
|
+
if (existsSync42(appCssPath)) {
|
|
52814
|
+
devCssSource = appCssPath;
|
|
52815
|
+
rawCss = readFileSync38(appCssPath, "utf-8");
|
|
52816
|
+
} else if (existsSync42(cssPath)) {
|
|
52817
|
+
devCssSource = cssPath;
|
|
52801
52818
|
rawCss = readFileSync38(cssPath, "utf-8");
|
|
52802
52819
|
} else if (existsSync42(altCssPath)) {
|
|
52820
|
+
devCssSource = altCssPath;
|
|
52803
52821
|
rawCss = readFileSync38(altCssPath, "utf-8");
|
|
52804
52822
|
}
|
|
52805
52823
|
if (rawCss) {
|
|
@@ -52812,7 +52830,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
52812
52830
|
devGlobalCssContent = rawCss;
|
|
52813
52831
|
for (const plugin of activeAtStart) {
|
|
52814
52832
|
if (typeof plugin.onCSS === "function") {
|
|
52815
|
-
const result = await plugin.onCSS(rawCss,
|
|
52833
|
+
const result = await plugin.onCSS(rawCss, devCssSource);
|
|
52816
52834
|
if (result !== null && typeof result === "string") {
|
|
52817
52835
|
devGlobalCssContent = result;
|
|
52818
52836
|
}
|
|
@@ -53016,7 +53034,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
53016
53034
|
const active = getActiveDevPlugins();
|
|
53017
53035
|
for (const plugin of active) {
|
|
53018
53036
|
if (typeof plugin.onCSS === "function") {
|
|
53019
|
-
const result = await plugin.onCSS(rawCss,
|
|
53037
|
+
const result = await plugin.onCSS(rawCss, devCssSource);
|
|
53020
53038
|
if (result !== null && typeof result === "string") {
|
|
53021
53039
|
nextGlobal = result;
|
|
53022
53040
|
}
|
|
@@ -54220,7 +54238,7 @@ function usage(code = 0) {
|
|
|
54220
54238
|
console.error(" vesk typecheck [--no-strict] Typecheck .vsk/.ts files via tsc-in-.vsk (strict by default)");
|
|
54221
54239
|
console.error(" vesk start [-p 3000] Start production server");
|
|
54222
54240
|
console.error(" vesk dev [-p 3000] Start dev server with HMR");
|
|
54223
|
-
console.error(" vesk init Create
|
|
54241
|
+
console.error(" vesk init Create app/global.css (Tailwind entrypoint) if missing");
|
|
54224
54242
|
console.error(" vesk --help Show this help");
|
|
54225
54243
|
console.error("");
|
|
54226
54244
|
console.error("Scaffolding: npx create-vesk@latest <project-name>");
|
|
@@ -54408,13 +54426,13 @@ if (cmd === "start") {
|
|
|
54408
54426
|
}
|
|
54409
54427
|
if (cmd === "init") {
|
|
54410
54428
|
const projectDir = process.cwd();
|
|
54411
|
-
const
|
|
54412
|
-
const target = join26(
|
|
54429
|
+
const appDirPath = join26(projectDir, "app");
|
|
54430
|
+
const target = join26(appDirPath, "global.css");
|
|
54413
54431
|
if (existsSync43(target)) {
|
|
54414
54432
|
console.error(`vesk init: ${target} already exists \u2014 skipping`);
|
|
54415
54433
|
process.exit(0);
|
|
54416
54434
|
}
|
|
54417
|
-
mkdirSync18(
|
|
54435
|
+
mkdirSync18(appDirPath, { recursive: true });
|
|
54418
54436
|
writeFileSync21(target, [
|
|
54419
54437
|
`@import 'tailwindcss';`,
|
|
54420
54438
|
``,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
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.36",
|
|
12
|
+
"@vesk/compiler": "^0.2.36",
|
|
13
|
+
"@vesk/plugin-tailwind": "^0.2.36",
|
|
14
|
+
"@vesk/runtime": "^0.2.36",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|