@kaathewise/ssg 0.7.1 → 0.8.1
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/build.d.ts.map +1 -1
- package/dist/build.js +0 -1
- package/dist/render.js +2 -2
- package/dist/router.js +4 -4
- package/package.json +1 -1
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIzC,wBAAsB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIzC,wBAAsB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBzD"}
|
package/dist/build.js
CHANGED
|
@@ -12,7 +12,6 @@ export async function build(config) {
|
|
|
12
12
|
await fs.mkdir(config.outputDir);
|
|
13
13
|
for (const page of pages) {
|
|
14
14
|
const destPath = path.join(config.outputDir, page.path);
|
|
15
|
-
const dir = path.dirname(destPath);
|
|
16
15
|
await fs.mkdir(path.dirname(destPath), {
|
|
17
16
|
recursive: true,
|
|
18
17
|
});
|
package/dist/render.js
CHANGED
|
@@ -53,8 +53,8 @@ export async function renderAll(modulePath, pagesDir) {
|
|
|
53
53
|
function substituteParams(inputPath, params) {
|
|
54
54
|
let path = inputPath;
|
|
55
55
|
for (const [key, value] of Object.entries(params)) {
|
|
56
|
-
const single =
|
|
57
|
-
const multiple =
|
|
56
|
+
const single = `[${key}]`;
|
|
57
|
+
const multiple = `[...${key}]`;
|
|
58
58
|
if (typeof value === "string") {
|
|
59
59
|
path = path.replace(single, value);
|
|
60
60
|
}
|
package/dist/router.js
CHANGED
|
@@ -76,11 +76,11 @@ function toFragments(pagePath) {
|
|
|
76
76
|
const pieces = barePath.split("/");
|
|
77
77
|
const out = [];
|
|
78
78
|
for (const piece of pieces) {
|
|
79
|
-
if (piece.startsWith("
|
|
80
|
-
out.push({ kind: "
|
|
79
|
+
if (piece.startsWith("[...") && piece.endsWith("]")) {
|
|
80
|
+
out.push({ kind: "repeat", value: piece.slice(4, -1) });
|
|
81
81
|
}
|
|
82
|
-
else if (piece.startsWith("
|
|
83
|
-
out.push({ kind: "
|
|
82
|
+
else if (piece.startsWith("[") && piece.endsWith("]")) {
|
|
83
|
+
out.push({ kind: "segment", value: piece.slice(1, -1) });
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
86
|
out.push({ kind: "literal", value: piece });
|