vizmatic 0.1.13 → 0.1.14
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 +30 -14
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -5403,6 +5403,7 @@ async function renderAnimatedGif(scenes, options) {
|
|
|
5403
5403
|
|
|
5404
5404
|
// src/cli.ts
|
|
5405
5405
|
var RENDER_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".mjs", ".ts", ".tsx"]);
|
|
5406
|
+
var IMPORT_RESOLUTION_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json"];
|
|
5406
5407
|
var cliRequire = createRequire(import.meta.url);
|
|
5407
5408
|
var frameDependencyAliasesInstalled = false;
|
|
5408
5409
|
var BARE_FRAME_EXTRA_EXPORTS = /* @__PURE__ */ new Set([
|
|
@@ -5492,13 +5493,12 @@ function resolveSelfEntry() {
|
|
|
5492
5493
|
return void 0;
|
|
5493
5494
|
}
|
|
5494
5495
|
}
|
|
5495
|
-
function
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
const
|
|
5500
|
-
|
|
5501
|
-
return "vizmatic";
|
|
5496
|
+
function resolveSelfRequireSpecifier() {
|
|
5497
|
+
return resolveSelfEntry() ?? "vizmatic";
|
|
5498
|
+
}
|
|
5499
|
+
function resolveReactRequireSpecifier() {
|
|
5500
|
+
const reactEntry = resolveFrameDependency("react");
|
|
5501
|
+
return reactEntry ?? "react";
|
|
5502
5502
|
}
|
|
5503
5503
|
function resolveFrameDependency(request) {
|
|
5504
5504
|
try {
|
|
@@ -5522,12 +5522,25 @@ function rewriteRelativeImports(line, framePath) {
|
|
|
5522
5522
|
const frameDir = dirname3(framePath);
|
|
5523
5523
|
return line.replace(
|
|
5524
5524
|
/(from\s+['"])(\.{1,2}\/[^'"]+)(['"])/g,
|
|
5525
|
-
(_match, before, specifier, after) => `${before}${
|
|
5525
|
+
(_match, before, specifier, after) => `${before}${resolveRelativeImportSpecifier(frameDir, specifier)}${after}`
|
|
5526
5526
|
).replace(
|
|
5527
5527
|
/(^\s*import\s+['"])(\.{1,2}\/[^'"]+)(['"])/g,
|
|
5528
|
-
(_match, before, specifier, after) => `${before}${
|
|
5528
|
+
(_match, before, specifier, after) => `${before}${resolveRelativeImportSpecifier(frameDir, specifier)}${after}`
|
|
5529
5529
|
);
|
|
5530
5530
|
}
|
|
5531
|
+
function resolveRelativeImportSpecifier(frameDir, specifier) {
|
|
5532
|
+
const absolute = resolve(frameDir, specifier);
|
|
5533
|
+
if (existsSync2(absolute)) return absolute;
|
|
5534
|
+
for (const extension of IMPORT_RESOLUTION_EXTENSIONS) {
|
|
5535
|
+
const candidate = `${absolute}${extension}`;
|
|
5536
|
+
if (existsSync2(candidate)) return candidate;
|
|
5537
|
+
}
|
|
5538
|
+
for (const extension of IMPORT_RESOLUTION_EXTENSIONS) {
|
|
5539
|
+
const candidate = join2(absolute, `index${extension}`);
|
|
5540
|
+
if (existsSync2(candidate)) return candidate;
|
|
5541
|
+
}
|
|
5542
|
+
return absolute;
|
|
5543
|
+
}
|
|
5531
5544
|
function readDimensionLine(line) {
|
|
5532
5545
|
const match = line.match(/^\s*(?:(?:\/\/\s*)?)(?:export\s+)?(?:(?:const|let|var)\s+)?(width|height)\s*[:=]\s*(\d+)\s*;?\s*$/i);
|
|
5533
5546
|
if (!match?.[1] || !match[2]) return void 0;
|
|
@@ -5559,10 +5572,10 @@ function bareFrameExportsForSource(source) {
|
|
|
5559
5572
|
});
|
|
5560
5573
|
}
|
|
5561
5574
|
function buildAutoImportStatement(names) {
|
|
5562
|
-
const specifiers = names.map((name) =>
|
|
5563
|
-
return `
|
|
5564
|
-
|
|
5565
|
-
}
|
|
5575
|
+
const specifiers = names.map((name) => ` ${name}: ${bareFrameAlias(name)}`).join(",\n");
|
|
5576
|
+
return `const {
|
|
5577
|
+
${specifiers}
|
|
5578
|
+
} = __require(${JSON.stringify(resolveSelfRequireSpecifier())})`;
|
|
5566
5579
|
}
|
|
5567
5580
|
function buildAutoImportDeclarations(names) {
|
|
5568
5581
|
return names.map((name) => {
|
|
@@ -5599,7 +5612,10 @@ function buildBareFrameModule(framePath, source) {
|
|
|
5599
5612
|
width ??= readFrameDimension(jsx, "width") ?? 960;
|
|
5600
5613
|
height ??= readFrameDimension(jsx, "height") ?? 540;
|
|
5601
5614
|
const autoImports = bareFrameExportsForSource(body);
|
|
5602
|
-
return
|
|
5615
|
+
return `/** @jsxRuntime classic */
|
|
5616
|
+
import { createRequire as __createRequire } from 'module'
|
|
5617
|
+
const __require = __createRequire(${JSON.stringify(import.meta.url)})
|
|
5618
|
+
const React = __require(${JSON.stringify(resolveReactRequireSpecifier())})
|
|
5603
5619
|
${buildAutoImportStatement(autoImports)}
|
|
5604
5620
|
${imports.join("\n")}
|
|
5605
5621
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vizmatic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Theme-aware visual primitives and render pipeline for AI-generated diagrams, figures, and presentation frames.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"site:build": "tsx scripts/build-site.ts",
|
|
65
65
|
"docs:check": "tsx scripts/check-docs.ts",
|
|
66
66
|
"site:serve": "node scripts/serve-docs.mjs docs 4173",
|
|
67
|
+
"sync:plugin-versions": "node scripts/sync-plugin-versions.mjs",
|
|
67
68
|
"security:audit": "pnpm audit --audit-level low",
|
|
68
69
|
"deps:check": "pnpm security:audit && npm pack --dry-run",
|
|
69
70
|
"verify": "pnpm lint && pnpm test && pnpm render:examples && pnpm docs:check && pnpm deps:check",
|