@vizejs/vite-plugin-musea 0.105.0 → 0.107.0

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.
Files changed (29) hide show
  1. package/dist/gallery/assets/{MonacoEditor-VccI_xm1.js → MonacoEditor-ChPO-ZtO.js} +2 -2
  2. package/dist/gallery/assets/{cssMode-DYl_gbi2.js → cssMode-tpEf1wjZ.js} +1 -1
  3. package/dist/gallery/assets/{editor.api2-C1iuJsz5.js → editor.api2-D2V4qV43.js} +1 -1
  4. package/dist/gallery/assets/{editor.main-CB_LUZEd.js → editor.main-B3fhJ8X5.js} +2 -2
  5. package/dist/gallery/assets/{freemarker2-CwuG5RrE.js → freemarker2-D9q7dgOY.js} +1 -1
  6. package/dist/gallery/assets/{handlebars-DQnqIqtZ.js → handlebars-dCjq6t-4.js} +1 -1
  7. package/dist/gallery/assets/{html-Cj3GxbMF.js → html-l0AO0O65.js} +1 -1
  8. package/dist/gallery/assets/{htmlMode-ckJrF6jc.js → htmlMode-DX8C44PK.js} +1 -1
  9. package/dist/gallery/assets/{index-6QLn8Kxp.js → index-SaDls6HF.js} +22 -22
  10. package/dist/gallery/assets/{javascript-DNOPgN7f.js → javascript-DwD4tp-i.js} +1 -1
  11. package/dist/gallery/assets/{jsonMode-BMPHk4yv.js → jsonMode-6FizhbWG.js} +1 -1
  12. package/dist/gallery/assets/{liquid-cUC3T7D4.js → liquid-DcyqPOD8.js} +1 -1
  13. package/dist/gallery/assets/{lspLanguageFeatures-DnNJLDpx.js → lspLanguageFeatures-DHY9tXb5.js} +1 -1
  14. package/dist/gallery/assets/{mdx-DDDAX75G.js → mdx-CwEaAM87.js} +1 -1
  15. package/dist/gallery/assets/{monaco.contribution-BsZfIZIS.js → monaco.contribution-DTmtm_Kx.js} +2 -2
  16. package/dist/gallery/assets/{python-CkEL94qN.js → python-knXrGY--.js} +1 -1
  17. package/dist/gallery/assets/{razor-DpH3myLF.js → razor-BM2_GyF3.js} +1 -1
  18. package/dist/gallery/assets/{tsMode-D4vJtygH.js → tsMode-C5FA3F_c.js} +1 -1
  19. package/dist/gallery/assets/{typescript-f3jEZleA.js → typescript-x3O9BFS4.js} +1 -1
  20. package/dist/gallery/assets/{workers-7fp33vpu.js → workers-CioQ1cEs.js} +1 -1
  21. package/dist/gallery/assets/{xml-CrndFNV8.js → xml-CDZz0d4E.js} +1 -1
  22. package/dist/gallery/assets/{yaml-BAl6eAY9.js → yaml-Dfe1aVPk.js} +1 -1
  23. package/dist/gallery/index.html +1 -1
  24. package/dist/{gallery-zu8hc8Lc.mjs → gallery-kaxHo2Kt.mjs} +10 -2
  25. package/dist/gallery-kaxHo2Kt.mjs.map +1 -0
  26. package/dist/index.mjs +14 -11
  27. package/dist/index.mjs.map +1 -1
  28. package/package.json +6 -5
  29. package/dist/gallery-zu8hc8Lc.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as collectRequestBody, c as resolveInside, d as serializeScriptValue, f as validateDevApiRequest, i as HttpError, l as resolveInsideAny, n as generateGalleryModule, o as createDevSessionToken, s as decodeUrlComponent, u as resolveUrlPathInside } from "./gallery-zu8hc8Lc.mjs";
1
+ import { a as collectRequestBody, c as parseJsonBody, d as resolveUrlPathInside, f as serializeScriptValue, i as HttpError, l as resolveInside, n as generateGalleryModule, o as createDevSessionToken, p as validateDevApiRequest, s as decodeUrlComponent, u as resolveInsideAny } from "./gallery-kaxHo2Kt.mjs";
2
2
  import { i as MuseaVrtRunner, n as generateVrtJsonReport, r as generateVrtReport } from "./vrt-Cv1PK1EF.mjs";
3
3
  import { t as MuseaA11yRunner } from "./a11y-62l8G1tr.mjs";
4
4
  import { n as writeArtFile, t as generateArtFile } from "./autogen-CywxMrJH.mjs";
@@ -1175,7 +1175,7 @@ async function tryLoadSourceGalleryHtml(devServer, url, basePath, devSessionToke
1175
1175
  return devServer.transformIndexHtml(url, html);
1176
1176
  }
1177
1177
  async function generateFallbackGalleryHtml(basePath, devSessionToken, themeConfig) {
1178
- const { generateGalleryHtml } = await import("./gallery-zu8hc8Lc.mjs").then((n) => n.t);
1178
+ const { generateGalleryHtml } = await import("./gallery-kaxHo2Kt.mjs").then((n) => n.t);
1179
1179
  return generateGalleryHtml(basePath, devSessionToken, themeConfig);
1180
1180
  }
1181
1181
  async function serveGalleryAsset(galleryDistDir, requestUrl, res) {
@@ -1847,7 +1847,7 @@ async function handleTokensCreate(ctx, readBody, sendJson, sendError) {
1847
1847
  }
1848
1848
  const body = await readBody();
1849
1849
  try {
1850
- const { path: dotPath, token } = JSON.parse(body);
1850
+ const { path: dotPath, token } = parseJsonBody(body);
1851
1851
  if (!dotPath || !token || token.value === void 0) {
1852
1852
  sendError("Missing required fields: path, token.value", 400);
1853
1853
  return;
@@ -1888,7 +1888,7 @@ async function handleTokensUpdate(ctx, readBody, sendJson, sendError) {
1888
1888
  }
1889
1889
  const body = await readBody();
1890
1890
  try {
1891
- const { path: dotPath, token } = JSON.parse(body);
1891
+ const { path: dotPath, token } = parseJsonBody(body);
1892
1892
  if (!dotPath || !token || token.value === void 0) {
1893
1893
  sendError("Missing required fields: path, token.value", 400);
1894
1894
  return;
@@ -1924,7 +1924,7 @@ async function handleTokensDelete(ctx, readBody, sendJson, sendError) {
1924
1924
  }
1925
1925
  const body = await readBody();
1926
1926
  try {
1927
- const { path: dotPath } = JSON.parse(body);
1927
+ const { path: dotPath } = parseJsonBody(body);
1928
1928
  if (!dotPath) {
1929
1929
  sendError("Missing required field: path", 400);
1930
1930
  return;
@@ -2141,7 +2141,7 @@ function handleArtA11y(ctx, match, sendJson, sendError) {
2141
2141
  /** POST /api/preview-with-props */
2142
2142
  function handlePreviewWithProps(ctx, body, res, sendJson, sendError) {
2143
2143
  try {
2144
- const { artPath: reqArtPath, variantName, props: propsOverride } = JSON.parse(body);
2144
+ const { artPath: reqArtPath, variantName, props: propsOverride } = parseJsonBody(body);
2145
2145
  const art = ctx.artFiles.get(reqArtPath);
2146
2146
  if (!art) {
2147
2147
  sendError("Art not found", 404);
@@ -2166,7 +2166,7 @@ function handlePreviewWithProps(ctx, body, res, sendJson, sendError) {
2166
2166
  /** POST /api/generate */
2167
2167
  async function handleGenerate(ctx, body, sendJson, sendError) {
2168
2168
  try {
2169
- const { componentPath: reqComponentPath, options: autogenOptions } = JSON.parse(body);
2169
+ const { componentPath: reqComponentPath, options: autogenOptions } = parseJsonBody(body);
2170
2170
  if (typeof reqComponentPath !== "string") {
2171
2171
  sendError("Missing required field: componentPath", 400);
2172
2172
  return;
@@ -2190,7 +2190,7 @@ async function handleGenerate(ctx, body, sendJson, sendError) {
2190
2190
  /** POST /api/run-vrt */
2191
2191
  async function handleRunVrt(ctx, body, sendJson, sendError) {
2192
2192
  try {
2193
- const { artPath, updateSnapshots } = JSON.parse(body);
2193
+ const { artPath, updateSnapshots } = parseJsonBody(body);
2194
2194
  const { MuseaVrtRunner, generateVrtJsonReport, generateVrtReport } = await import("./vrt.mjs");
2195
2195
  const snapshotDir = path.resolve(ctx.config.root, ".vize/snapshots");
2196
2196
  const reportDir = path.resolve(ctx.config.root, ".vize/reports");
@@ -2210,7 +2210,7 @@ async function handleRunVrt(ctx, body, sendJson, sendError) {
2210
2210
  await runner.stop();
2211
2211
  }
2212
2212
  })();
2213
- const reportBaseName = artPath ? `vrt-${path.basename(artPath, ".art.vue")}` : "vrt";
2213
+ const reportBaseName = typeof artPath === "string" ? `vrt-${path.basename(artPath, ".art.vue")}` : "vrt";
2214
2214
  const jsonReportPath = path.join(reportDir, `${reportBaseName}-report.json`);
2215
2215
  const htmlReportPath = path.join(reportDir, `${reportBaseName}-report.html`);
2216
2216
  await fs.promises.mkdir(reportDir, { recursive: true });
@@ -2241,6 +2241,10 @@ async function handleRunVrt(ctx, body, sendJson, sendError) {
2241
2241
  }
2242
2242
  });
2243
2243
  } catch (e) {
2244
+ if (e instanceof HttpError) {
2245
+ sendError(e.message, e.status);
2246
+ return;
2247
+ }
2244
2248
  sendError(e instanceof Error ? e.message : String(e));
2245
2249
  }
2246
2250
  }
@@ -2303,8 +2307,7 @@ function createApiMiddleware(ctx) {
2303
2307
  return;
2304
2308
  }
2305
2309
  const safeArtPath = resolveInside(ctx.config.root, artPath, "art path");
2306
- const body = await readBody();
2307
- const { source } = JSON.parse(body);
2310
+ const { source } = parseJsonBody(await readBody());
2308
2311
  if (typeof source !== "string") {
2309
2312
  sendError("Missing required field: source", 400);
2310
2313
  return;