Files
hyperframes/packages/core/src/lightEntries.test.ts
T
Miguel Ángel 45882027bd feat(cli): check warns when text leaves the 9:16 social safe areas (#7680)
* feat(cli): check warns when text leaves the 9:16 social safe areas

* feat(core): safe areas owned by core; check adds --safe-zone standard

* style(cli): format

* refactor(core): name the safe-area band fields

* fix(cli): defects outrank safe-zone warnings at the issue cap

* style(cli): format

* test: read the safe-box constants from core
2026-11-14 02:00:15 +00:00

32 lines
1.0 KiB
TypeScript

// @vitest-environment node
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { buildSync } from "esbuild";
import { describe, expect, it } from "vitest";
const packageDir = resolve(import.meta.dirname, "..");
const { subpaths } = JSON.parse(readFileSync(resolve(packageDir, "package-subpaths.json"), "utf8"));
const HEAVY = /[\\/](recast|ast-types|@babel[\\/]parser|acorn|esprima|linkedom|postcss)[\\/]/;
function loadedModules(entry: string): string[] {
const { metafile } = buildSync({
entryPoints: [resolve(packageDir, subpaths[entry].source)],
bundle: true,
platform: "node",
format: "esm",
write: false,
metafile: true,
logLevel: "silent",
});
return Object.keys(metafile.inputs);
}
describe("entries a host imports for one helper", () => {
it.each(["./safe-path", "./safe-areas", "./asset-paths", "./preview-quality"])(
"%s loads none of the parsers",
(entry) => {
expect(loadedModules(entry).filter((path) => HEAVY.test(path))).toEqual([]);
},
);
});