65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import * as lib from "@heroui-vue/components";
|
|
|
|
const checks = JSON.parse(
|
|
readFileSync(new URL("./client-checks.json", import.meta.url), "utf8"),
|
|
);
|
|
const css = readFileSync(
|
|
new URL(import.meta.resolve("@heroui-vue/styles/css")),
|
|
"utf8",
|
|
);
|
|
for (const id of process.argv.slice(2)) {
|
|
const spec = checks[id];
|
|
assert(spec, `Unknown package contract: ${id}`);
|
|
for (const name of spec.exports) assert(lib[name], `Missing export ${name}`);
|
|
for (const token of spec.css)
|
|
assert(css.includes(token), `Missing CSS ${token}`);
|
|
for (const name of spec.absent ?? [])
|
|
assert(!(name in lib), `Private component exposed: ${name}`);
|
|
if (id === "b02-pickers") {
|
|
assert(
|
|
lib
|
|
.comboBoxVariants({ fullWidth: true })
|
|
.base()
|
|
.includes("hv-combo-box--full-width"),
|
|
);
|
|
assert(
|
|
lib
|
|
.autocompleteVariants({ variant: "secondary" })
|
|
.base()
|
|
.includes("hv-autocomplete--secondary"),
|
|
);
|
|
}
|
|
if (id === "list-box") {
|
|
assert(lib.listboxVariants().includes("hv-list-box"));
|
|
assert(
|
|
lib
|
|
.listboxItemVariants()
|
|
.indicator()
|
|
.includes("hv-list-box-item__indicator"),
|
|
);
|
|
}
|
|
if (id === "slider")
|
|
assert(lib.sliderVariants().thumb().includes("hv-slider__thumb"));
|
|
if (id === "select")
|
|
assert(
|
|
lib
|
|
.selectVariants({ variant: "secondary" })
|
|
.base()
|
|
.includes("hv-select--secondary"),
|
|
);
|
|
if (id === "b03-tag-error-message") {
|
|
assert(/\.hv-tag-group\s*\[data-slot=["']?error-message/.test(css));
|
|
assert(lib.tagVariants({ size: "sm" }).base().includes("hv-tag--sm"));
|
|
assert(
|
|
lib
|
|
.tagVariants({ variant: "surface" })
|
|
.base()
|
|
.includes("hv-tag--surface"),
|
|
);
|
|
assert(lib.errorMessageVariants().includes("hv-error-message"));
|
|
}
|
|
console.log(`${id}: packed ESM exports and CSS passed (client scope)`);
|
|
}
|