mnfst-render 0.5.9 → 0.5.10

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.
@@ -1,2 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import '../manifest.render.mjs';
2
+ import { main } from '../manifest.render.mjs';
3
+
4
+ main().catch((err) => {
5
+ console.error('prerender:', err);
6
+ process.exit(1);
7
+ });
@@ -3042,25 +3042,24 @@ async function runPrerender(config) {
3042
3042
 
3043
3043
  }
3044
3044
 
3045
- // Only run main() when invoked as the CLI entry point this lets tests
3046
- // import this module to access internal helpers (e.g.
3047
- // markPrerenderedManifestComponents) without triggering a full prerender.
3048
- const isCliEntry = (() => {
3045
+ // Auto-run main() when this file is the direct entry point (node manifest.render.mjs)
3046
+ // but NOT when imported by the bin wrapper or test harness. The bin wrapper
3047
+ // calls main() explicitly; test harnesses only need the exported helpers.
3048
+ const _isDirectEntry = (() => {
3049
3049
  try {
3050
- const invoked = process.argv[1] && new URL('file://' + process.argv[1]).href;
3050
+ const arg1 = process.argv[1];
3051
+ if (!arg1) return false;
3052
+ const invoked = String(new URL('file://' + resolve(arg1)));
3051
3053
  return invoked === import.meta.url;
3052
- } catch {
3053
- return false;
3054
- }
3054
+ } catch { return false; }
3055
3055
  })();
3056
3056
 
3057
- if (isCliEntry) {
3057
+ if (_isDirectEntry) {
3058
3058
  main().catch((err) => {
3059
3059
  console.error('prerender:', err);
3060
3060
  process.exit(1);
3061
3061
  });
3062
3062
  }
3063
3063
 
3064
- // Exports for unit testing. These are intentionally not part of any public
3065
- // API they exist so the e2e harness can directly exercise pure helpers.
3066
- export { markPrerenderedManifestComponents };
3064
+ // Exports for the CLI bin script and for unit testing.
3065
+ export { main, markPrerenderedManifestComponents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {