olum-compiler 2.0.0 → 2.0.2
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/ssg.js +4 -3
- package/lib/helpers.js +3 -1
- package/package.json +1 -1
package/bin/ssg.js
CHANGED
|
@@ -156,8 +156,9 @@ function siteUrl() {
|
|
|
156
156
|
return "";
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
const DEFAULT_DELAY = 500;
|
|
159
160
|
function readDelay(raw, source) {
|
|
160
|
-
if (raw === undefined || raw === null || raw === "") return
|
|
161
|
+
if (raw === undefined || raw === null || raw === "") return DEFAULT_DELAY;
|
|
161
162
|
|
|
162
163
|
const ms =
|
|
163
164
|
typeof raw === "number" || typeof raw === "string" ? Number(raw) : NaN;
|
|
@@ -166,7 +167,7 @@ function readDelay(raw, source) {
|
|
|
166
167
|
fail(
|
|
167
168
|
`ignoring ${source} — expected a number of milliseconds, got ${shown}`,
|
|
168
169
|
);
|
|
169
|
-
return
|
|
170
|
+
return DEFAULT_DELAY;
|
|
170
171
|
}
|
|
171
172
|
return Math.round(ms);
|
|
172
173
|
}
|
|
@@ -181,7 +182,7 @@ function ssgDelay() {
|
|
|
181
182
|
'package.json "olum.SSG_DELAY"',
|
|
182
183
|
);
|
|
183
184
|
} catch (err) {
|
|
184
|
-
return
|
|
185
|
+
return DEFAULT_DELAY;
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
|
package/lib/helpers.js
CHANGED
|
@@ -20,6 +20,8 @@ const base64ToString = (base64) =>
|
|
|
20
20
|
Buffer.from(base64, "base64").toString("ascii");
|
|
21
21
|
const acorn = require("acorn");
|
|
22
22
|
|
|
23
|
+
const routesPath = path.resolve(__dirname, "../routes.json");
|
|
24
|
+
|
|
23
25
|
const cleanParentheses = (filePath, type = "name") => {
|
|
24
26
|
if (type == "name") {
|
|
25
27
|
return filePath.replace(/\([^)]*\)/g, "");
|
|
@@ -757,7 +759,7 @@ ${routes
|
|
|
757
759
|
.join(",\n")}
|
|
758
760
|
];`;
|
|
759
761
|
|
|
760
|
-
fs.writeFileSync(
|
|
762
|
+
fs.writeFileSync(routesPath, `${JSON.stringify(paths, null, 2)}`);
|
|
761
763
|
return result;
|
|
762
764
|
}
|
|
763
765
|
|