@formepdf/cli 0.1.3 → 0.2.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 (2) hide show
  1. package/dist/dev.js +17 -0
  2. package/package.json +3 -3
package/dist/dev.js CHANGED
@@ -174,6 +174,11 @@ export function startDevServer(inputPath, options) {
174
174
  lastError = null;
175
175
  lastRenderTime = Math.round(performance.now() - start);
176
176
  const pageCount = layout?.pages?.length ?? 0;
177
+ // Warn once if no source locations found (click-to-inspect won't work)
178
+ if (firstRender && !hasAnySourceLocation(doc)) {
179
+ console.warn(`\n Warning: No source locations found — click-to-inspect is disabled.\n` +
180
+ ` Ensure your tsconfig.json has "jsx": "react-jsx" (not "react").\n`);
181
+ }
177
182
  if (firstRender) {
178
183
  firstRender = false;
179
184
  const url = `http://localhost:${port}`;
@@ -288,3 +293,15 @@ async function getPreviewHtml() {
288
293
  // Inline fallback
289
294
  return `<!DOCTYPE html><html><body><h1>Preview HTML not found</h1></body></html>`;
290
295
  }
296
+ function hasAnySourceLocation(doc) {
297
+ const children = doc.children;
298
+ if (!children)
299
+ return false;
300
+ function check(node) {
301
+ if (node.sourceLocation)
302
+ return true;
303
+ const kids = node.children;
304
+ return kids?.some(check) ?? false;
305
+ }
306
+ return children.some(check);
307
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formepdf/cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "CLI for Forme PDF rendering engine — dev server with live preview and build command",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,8 +14,8 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@formepdf/core": "0.1.0",
18
- "@formepdf/react": "0.1.0",
17
+ "@formepdf/core": "0.2.0",
18
+ "@formepdf/react": "0.2.0",
19
19
  "esbuild": "^0.24.0",
20
20
  "chokidar": "^4.0.0",
21
21
  "ws": "^8.18.0",