pdfn 0.8.11 → 0.9.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.
package/dist/cli.js CHANGED
@@ -489,7 +489,9 @@ async function scanTemplates(templatesDir) {
489
489
  const filePath = join(templatesDir, file);
490
490
  try {
491
491
  const content = readFileSync(filePath, "utf-8");
492
- if (!content.includes("export default") || !content.includes("function")) {
492
+ const hasDefaultExport = content.includes("export default");
493
+ const hasComponent = content.includes("function") || /const\s+\w+\s*=\s*\(/.test(content);
494
+ if (!hasDefaultExport || !hasComponent) {
493
495
  continue;
494
496
  }
495
497
  if (!content.includes("Document") && !content.includes("Page")) {
@@ -2373,8 +2375,9 @@ async function startDevServer(options) {
2373
2375
  const Component = mod.default;
2374
2376
  const { pdfn: pdfn2 } = await vite.ssrLoadModule("@pdfn/react");
2375
2377
  const client = pdfn2();
2378
+ const previewProps = Component.PreviewProps || {};
2376
2379
  const { data, error } = await client.render({
2377
- react: React.createElement(Component, {}),
2380
+ react: React.createElement(Component, previewProps),
2378
2381
  debug: debugOptions || void 0
2379
2382
  });
2380
2383
  if (error) {