vizmatic 0.1.29 → 0.1.30
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 +16 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6652,8 +6652,15 @@ function readDimensionLine(line) {
|
|
|
6652
6652
|
return { name: match[1].toLowerCase(), value: Number(match[2]) };
|
|
6653
6653
|
}
|
|
6654
6654
|
function readPresetLine(line) {
|
|
6655
|
-
const
|
|
6656
|
-
|
|
6655
|
+
const withoutComment = line.replace(/\s*\/\/.*$/, "").trim();
|
|
6656
|
+
const match = withoutComment.match(/^(?:export\s+)?(?:(?:const|let|var)\s+)?preset(?:\s*:\s*ThemePreset)?\s*[:=]\s*(.+)$/i);
|
|
6657
|
+
if (!match?.[1]) return void 0;
|
|
6658
|
+
const expression = match[1].trim().replace(/;\s*$/, "").trim();
|
|
6659
|
+
const quoted = expression.match(/^(["'])(.*)\1$/);
|
|
6660
|
+
const requested = (quoted?.[2] ?? expression).trim();
|
|
6661
|
+
const normalized = requested.toLowerCase();
|
|
6662
|
+
const preset = quoted && (normalized === "default" || normalized === "engineering") ? normalized : void 0;
|
|
6663
|
+
return { preset, requested };
|
|
6657
6664
|
}
|
|
6658
6665
|
function readFrameDimension(jsx, name) {
|
|
6659
6666
|
const frameOpen = jsx.match(/<Frame\b[^>]*>/)?.[0];
|
|
@@ -6714,7 +6721,13 @@ function buildBareFrameModule(framePath, source) {
|
|
|
6714
6721
|
}
|
|
6715
6722
|
const framePreset = readPresetLine(line);
|
|
6716
6723
|
if (framePreset) {
|
|
6717
|
-
preset
|
|
6724
|
+
if (framePreset.preset) {
|
|
6725
|
+
preset = framePreset.preset;
|
|
6726
|
+
} else {
|
|
6727
|
+
console.warn(
|
|
6728
|
+
`warning: Unknown preset ${JSON.stringify(framePreset.requested)}; using "default". Available presets: "default", "engineering".`
|
|
6729
|
+
);
|
|
6730
|
+
}
|
|
6718
6731
|
continue;
|
|
6719
6732
|
}
|
|
6720
6733
|
bodyLines.push(line);
|
package/package.json
CHANGED