@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.
@@ -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,CAwBzD"}
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 = `:${key}`;
57
- const multiple = `*${key}`;
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: "segment", value: piece.slice(1) });
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: "repeat", value: piece.slice(1) });
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 });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaathewise/ssg",
3
3
  "description": "JSX static site generator",
4
- "version": "0.7.1",
4
+ "version": "0.8.1",
5
5
  "license": "MPL-2.0",
6
6
  "author": "Andrej Kolčin",
7
7
  "type": "module",