feat: prepare VS Code extension for marketplace

This commit is contained in:
2026-07-13 19:52:28 +05:30
parent 577c38a965
commit 0592c69f29
10 changed files with 133 additions and 25 deletions
+23 -2
View File
@@ -22,6 +22,7 @@ for (const rel of [
"package.json",
"language-configuration.json",
"syntaxes/wrn.tmLanguage.json",
"syntaxes/wrn.injection.tmLanguage.json",
"snippets/wrn.json",
]) {
try {
@@ -36,7 +37,27 @@ for (const rel of [
const grammar = JSON.parse(readFileSync(join(root, "syntaxes/wrn.tmLanguage.json"), "utf8"));
grammar.scopeName === "source.wrn" ? ok("grammar scopeName") : bad("grammar scopeName");
// 3. Bundled compiler: valid source compiles, invalid source throws with an offset.
// 3. Marketplace metadata and the gallery icon meet vsce requirements.
try {
const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
manifest.publisher === "wrnexus" ? ok("publisher id") : bad("publisher id");
manifest.icon?.endsWith(".png") ? ok("Marketplace icon is PNG") : bad("Marketplace icon is PNG");
const icon = readFileSync(join(root, manifest.icon));
const isPng = icon.subarray(1, 4).toString("ascii") === "PNG";
const width = isPng ? icon.readUInt32BE(16) : 0;
const height = isPng ? icon.readUInt32BE(20) : 0;
isPng && width >= 128 && height >= 128
? ok(`Marketplace icon dimensions (${width}x${height})`)
: bad("Marketplace icon is at least 128x128 PNG");
for (const rel of ["README.md", "CHANGELOG.md", "SUPPORT.md", "LICENSE"]) {
readFileSync(join(root, rel), "utf8");
ok(`Marketplace document exists: ${rel}`);
}
} catch (e) {
bad("Marketplace metadata", e.message);
}
// 4. Bundled compiler: valid source compiles, invalid source throws with an offset.
try {
const compiler = require(join(root, "src/compiler.cjs"));
const good = `page Home {\n view { <h1>Hi</h1> }\n}`;
@@ -58,7 +79,7 @@ try {
bad("compiler bundle loads", e.message);
}
// 4. Formatter normalizes nested WRN blocks and is idempotent.
// 5. Formatter normalizes nested WRN blocks and is idempotent.
try {
const { formatWrn } = require(join(root, "src/formatter.js"));
const source = `page Home {\nview {\n<main>\n<h1>Hello</h1>\n</main>\n}\n}\n`;