@bagelink/blox 1.12.17 → 1.12.19
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/{prerender-mMYLIIC8.cjs → prerender-6jE_obPj.cjs} +2 -7
- package/dist/{prerender-BwmtiKjz.js → prerender-DYmDaqcz.js} +2 -7
- package/dist/ssg/cli.cjs +15 -14
- package/dist/ssg/cli.d.ts +1 -1
- package/dist/ssg/cli.mjs +3 -2
- package/dist/ssg/index.cjs +1 -1
- package/dist/ssg/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
const fs = require("node:fs/promises");
|
|
25
25
|
const path = require("node:path");
|
|
26
|
+
const process = require("node:process");
|
|
26
27
|
const node_url = require("node:url");
|
|
27
28
|
async function fetchCmsPrerenderPaths(apiBase, websiteName) {
|
|
28
29
|
const sitesRes = await fetch(`${apiBase}/cms/websites`);
|
|
@@ -65,7 +66,7 @@ async function fetchCmsPrerenderPaths(apiBase, websiteName) {
|
|
|
65
66
|
return [...new Set(routes)];
|
|
66
67
|
}
|
|
67
68
|
async function polyfillBloxSsgGlobals(options) {
|
|
68
|
-
const { env } = await
|
|
69
|
+
const { env } = await import("node:process");
|
|
69
70
|
const pageUrl = (options == null ? void 0 : options.pageUrl) ?? env.BAGELINK_API_URL ?? "https://example.com/";
|
|
70
71
|
const { Window: HappyWindow } = await import("happy-dom");
|
|
71
72
|
const _win = new HappyWindow({ url: pageUrl });
|
|
@@ -108,11 +109,6 @@ async function polyfillBloxSsgGlobals(options) {
|
|
|
108
109
|
g.window.location = _win.location;
|
|
109
110
|
g.window.document = _win.document;
|
|
110
111
|
}
|
|
111
|
-
const process = {};
|
|
112
|
-
const __viteBrowserExternal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
113
|
-
__proto__: null,
|
|
114
|
-
default: process
|
|
115
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
116
112
|
async function prerender({
|
|
117
113
|
root = process.cwd(),
|
|
118
114
|
clientOutDir = "dist/client",
|
|
@@ -305,4 +301,3 @@ function discoverInternalLinks(html) {
|
|
|
305
301
|
exports.fetchCmsPrerenderPaths = fetchCmsPrerenderPaths;
|
|
306
302
|
exports.polyfillBloxSsgGlobals = polyfillBloxSsgGlobals;
|
|
307
303
|
exports.prerender = prerender;
|
|
308
|
-
exports.process = process;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
3
4
|
import { pathToFileURL } from "node:url";
|
|
4
5
|
async function fetchCmsPrerenderPaths(apiBase, websiteName) {
|
|
5
6
|
const sitesRes = await fetch(`${apiBase}/cms/websites`);
|
|
@@ -42,7 +43,7 @@ async function fetchCmsPrerenderPaths(apiBase, websiteName) {
|
|
|
42
43
|
return [...new Set(routes)];
|
|
43
44
|
}
|
|
44
45
|
async function polyfillBloxSsgGlobals(options) {
|
|
45
|
-
const { env } = await
|
|
46
|
+
const { env } = await import("node:process");
|
|
46
47
|
const pageUrl = (options == null ? void 0 : options.pageUrl) ?? env.BAGELINK_API_URL ?? "https://example.com/";
|
|
47
48
|
const { Window: HappyWindow } = await import("happy-dom");
|
|
48
49
|
const _win = new HappyWindow({ url: pageUrl });
|
|
@@ -85,11 +86,6 @@ async function polyfillBloxSsgGlobals(options) {
|
|
|
85
86
|
g.window.location = _win.location;
|
|
86
87
|
g.window.document = _win.document;
|
|
87
88
|
}
|
|
88
|
-
const process = {};
|
|
89
|
-
const __viteBrowserExternal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
90
|
-
__proto__: null,
|
|
91
|
-
default: process
|
|
92
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
93
89
|
async function prerender({
|
|
94
90
|
root = process.cwd(),
|
|
95
91
|
clientOutDir = "dist/client",
|
|
@@ -281,7 +277,6 @@ function discoverInternalLinks(html) {
|
|
|
281
277
|
}
|
|
282
278
|
export {
|
|
283
279
|
prerender as a,
|
|
284
|
-
process as b,
|
|
285
280
|
fetchCmsPrerenderPaths as f,
|
|
286
281
|
polyfillBloxSsgGlobals as p
|
|
287
282
|
};
|
package/dist/ssg/cli.cjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
2
|
"use strict";
|
|
3
|
-
const
|
|
3
|
+
const process = require("node:process");
|
|
4
|
+
const prerender = require("../prerender-6jE_obPj.cjs");
|
|
4
5
|
async function resolveApiBase(mode) {
|
|
5
|
-
if (
|
|
6
|
-
return { apiBase:
|
|
6
|
+
if (process.env.BAGELINK_API_URL != null && process.env.BAGELINK_API_URL !== "") {
|
|
7
|
+
return { apiBase: process.env.BAGELINK_API_URL };
|
|
7
8
|
}
|
|
8
9
|
const configPaths = [
|
|
9
|
-
`${
|
|
10
|
-
`${
|
|
11
|
-
`${
|
|
12
|
-
`${
|
|
10
|
+
`${process.cwd()}/bgl.config.ts`,
|
|
11
|
+
`${process.cwd()}/bgl.config.js`,
|
|
12
|
+
`${process.cwd()}/../bgl.config.ts`,
|
|
13
|
+
`${process.cwd()}/../bgl.config.js`
|
|
13
14
|
];
|
|
14
15
|
for (const configPath of configPaths) {
|
|
15
16
|
try {
|
|
@@ -29,7 +30,7 @@ async function resolveApiBase(mode) {
|
|
|
29
30
|
return { apiBase: "https://localhost:8000" };
|
|
30
31
|
}
|
|
31
32
|
async function main() {
|
|
32
|
-
const argv =
|
|
33
|
+
const argv = process.argv.slice(2);
|
|
33
34
|
const extraPaths = [];
|
|
34
35
|
let crawl = false;
|
|
35
36
|
let mode = "production";
|
|
@@ -57,7 +58,7 @@ Environment:
|
|
|
57
58
|
BAGELINK_API_URL Override API base URL
|
|
58
59
|
WEBSITE_NAME Override CMS website name
|
|
59
60
|
`);
|
|
60
|
-
|
|
61
|
+
process.exit(0);
|
|
61
62
|
} else if (a.startsWith("--mode=")) {
|
|
62
63
|
mode = a.slice("--mode=".length);
|
|
63
64
|
} else if (a.startsWith("--exclude=")) {
|
|
@@ -68,7 +69,7 @@ Environment:
|
|
|
68
69
|
}
|
|
69
70
|
const { apiBase, websiteName: configWebsiteName } = await resolveApiBase(mode);
|
|
70
71
|
await prerender.polyfillBloxSsgGlobals({ pageUrl: apiBase });
|
|
71
|
-
const websiteName =
|
|
72
|
+
const websiteName = process.env.WEBSITE_NAME ?? configWebsiteName ?? "default";
|
|
72
73
|
console.log(`Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
|
|
73
74
|
let paths = [];
|
|
74
75
|
try {
|
|
@@ -84,7 +85,7 @@ Environment:
|
|
|
84
85
|
const startTime = Date.now();
|
|
85
86
|
try {
|
|
86
87
|
const result = await prerender.prerender({
|
|
87
|
-
root:
|
|
88
|
+
root: process.cwd(),
|
|
88
89
|
clientOutDir: "dist",
|
|
89
90
|
serverEntry: "dist/server/main.server.js",
|
|
90
91
|
paths,
|
|
@@ -114,11 +115,11 @@ ${"=".repeat(60)}`);
|
|
|
114
115
|
if (result.failures.length > 10) {
|
|
115
116
|
console.log(` ... and ${result.failures.length - 10} more`);
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
+
process.exitCode = 1;
|
|
118
119
|
}
|
|
119
120
|
} catch (err) {
|
|
120
121
|
console.error("Fatal error:", err);
|
|
121
|
-
|
|
122
|
+
process.exitCode = 1;
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
main();
|
package/dist/ssg/cli.d.ts
CHANGED
package/dist/ssg/cli.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
import
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { p as polyfillBloxSsgGlobals, f as fetchCmsPrerenderPaths, a as prerender } from "../prerender-DYmDaqcz.js";
|
|
3
4
|
async function resolveApiBase(mode) {
|
|
4
5
|
if (process.env.BAGELINK_API_URL != null && process.env.BAGELINK_API_URL !== "") {
|
|
5
6
|
return { apiBase: process.env.BAGELINK_API_URL };
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const prerender = require("../prerender-
|
|
3
|
+
const prerender = require("../prerender-6jE_obPj.cjs");
|
|
4
4
|
const ssg_client = require("./client.cjs");
|
|
5
5
|
async function renderBloxSsgPage(options) {
|
|
6
6
|
const {
|
package/dist/ssg/index.mjs
CHANGED
package/package.json
CHANGED