@officexapp/catalogs-cli 0.2.3 → 0.2.5

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 (2) hide show
  1. package/dist/index.js +8 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -731,7 +731,7 @@ function getMime(filepath) {
731
731
  return MIME_TYPES[ext] || "application/octet-stream";
732
732
  }
733
733
  function buildPreviewHtml(schema, port) {
734
- const schemaJson = JSON.stringify(schema);
734
+ const schemaJson = JSON.stringify(schema).replace(/<\/script/gi, "<\\/script");
735
735
  const themeColor = schema.settings?.theme?.primary_color || "#6366f1";
736
736
  return `<!DOCTYPE html>
737
737
  <html lang="en">
@@ -897,12 +897,14 @@ function buildPreviewHtml(schema, port) {
897
897
  </div>
898
898
  <div id="catalog-root"></div>
899
899
 
900
+ <script id="__catalog_data" type="application/json">${schemaJson}</script>
901
+
900
902
  <script type="module">
901
903
  import React from 'https://esm.sh/react@18?bundle';
902
904
  import ReactDOM from 'https://esm.sh/react-dom@18/client?bundle';
903
905
 
904
906
  const h = React.createElement;
905
- const schema = ${schemaJson};
907
+ const schema = JSON.parse(document.getElementById('__catalog_data').textContent);
906
908
  const themeColor = '${themeColor}';
907
909
 
908
910
  // --- Markdown-ish text rendering ---
@@ -1542,7 +1544,10 @@ function buildPreviewHtml(schema, port) {
1542
1544
 
1543
1545
  // --- Auto-reload via SSE ---
1544
1546
  const evtSource = new EventSource('/__dev_sse');
1545
- evtSource.onmessage = () => window.location.reload();
1547
+ evtSource.onmessage = (e) => {
1548
+ if (e.data === 'connected') return; // ignore initial handshake
1549
+ window.location.reload();
1550
+ };
1546
1551
  evtSource.onerror = () => {};
1547
1552
 
1548
1553
  // --- Mount ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@officexapp/catalogs-cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "CLI for Catalog Kit — upload videos, push catalogs, manage assets",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "license": "UNLICENSED",
29
29
  "engines": {
30
- "node": ">=18"
30
+ "node": ">=18 <24"
31
31
  },
32
32
  "dependencies": {
33
33
  "commander": "^12.1.0",