refactor: migrate legacy wire namespace to wrn
Quality / quality (ubuntu-latest) (push) Failing after 9m49s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 18:51:15 +05:30
parent ec23dd4c93
commit 2c960fc1dc
488 changed files with 27306 additions and 19063 deletions
@@ -3,7 +3,7 @@ import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { tmpdir } from "node:os";
import {
compileWireArtifacts,
compileWrnArtifacts,
setCompileCacheDir,
setCompileImportOptions,
} from "../src/pipeline.ts";
@@ -31,24 +31,24 @@ function fixture(): { root: string; page: string } {
test("legacy, compatible, and explicit import modes are enforced from app config", () => {
const { root, page } = fixture();
setCompileImportOptions(root, { mode: "legacy" });
expect(() => compileWireArtifacts(page, 1)).not.toThrow();
expect(() => compileWrnArtifacts(page, 1)).not.toThrow();
const warnings: string[] = [];
const originalWarn = console.warn;
console.warn = (...args) => warnings.push(args.join(" "));
try {
setCompileImportOptions(root, { mode: "compatible" });
expect(() => compileWireArtifacts(page, 2)).not.toThrow();
expect(() => compileWrnArtifacts(page, 2)).not.toThrow();
expect(warnings.some((message) => message.includes("WRN-IMPORT-IMPLICIT"))).toBe(true);
setCompileImportOptions(root, { mode: "explicit" });
expect(() => compileWireArtifacts(page, 3)).toThrow("WRN-IMPORT-IMPLICIT");
expect(() => compileWrnArtifacts(page, 3)).toThrow("WRN-IMPORT-IMPLICIT");
writeFileSync(
page,
'import Card from "@/components/Card.wrn"\npage Home { view { <Card /> } }',
);
expect(() => compileWireArtifacts(page, 4)).not.toThrow();
expect(() => compileWrnArtifacts(page, 4)).not.toThrow();
} finally {
console.warn = originalWarn;
}
@@ -68,5 +68,5 @@ test("compiler-native reactive elements do not require application imports", ()
}`,
);
setCompileImportOptions(root, { mode: "explicit" });
expect(() => compileWireArtifacts(page, 5)).not.toThrow();
expect(() => compileWrnArtifacts(page, 5)).not.toThrow();
});