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.
- package/bin/mnfst-render.js +6 -1
- package/manifest.render.mjs +11 -12
- package/package.json +1 -1
package/bin/mnfst-render.js
CHANGED
package/manifest.render.mjs
CHANGED
|
@@ -3042,25 +3042,24 @@ async function runPrerender(config) {
|
|
|
3042
3042
|
|
|
3043
3043
|
}
|
|
3044
3044
|
|
|
3045
|
-
//
|
|
3046
|
-
//
|
|
3047
|
-
//
|
|
3048
|
-
const
|
|
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
|
|
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 (
|
|
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
|
|
3065
|
-
|
|
3066
|
-
export { markPrerenderedManifestComponents };
|
|
3064
|
+
// Exports for the CLI bin script and for unit testing.
|
|
3065
|
+
export { main, markPrerenderedManifestComponents };
|