@kaathewise/ssg 0.9.1 → 0.9.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/dist/render.d.ts +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +2 -10
- package/package.json +1 -1
package/dist/render.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Page = {
|
|
|
6
6
|
contentType: string | null;
|
|
7
7
|
};
|
|
8
8
|
export type ArbitraryModule = {
|
|
9
|
-
getStaticParams
|
|
9
|
+
getStaticParams?: (() => Params[]) | (() => Promise<Params[]>);
|
|
10
10
|
getContentType?(params: Params): string;
|
|
11
11
|
default?: ((params: Params) => string) | ((params: Params) => Promise<string>);
|
|
12
12
|
};
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC7B,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC7B,eAAe,CAAC,EAAE,CAAC,MAAM,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAC9D,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvC,OAAO,CAAC,EACL,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,GAC5B,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CACxC,CAAA;AAED,wBAAsB,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAGvE;AAED,wBAAsB,MAAM,CAC3B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAkCf;AAED,wBAAsB,SAAS,CAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,EAAE,CAAC,CAgBjB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAgB1E"}
|
package/dist/render.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
1
|
import * as path from "node:path";
|
|
10
2
|
import { tsImport } from "tsx/esm/api";
|
|
11
3
|
export async function load(modulePath) {
|
|
@@ -42,9 +34,9 @@ export async function render(modulePath, params, config) {
|
|
|
42
34
|
return { path: pagePath, src, contentType };
|
|
43
35
|
}
|
|
44
36
|
export async function renderAll(modulePath, config) {
|
|
45
|
-
const module = await
|
|
37
|
+
const module = await load(modulePath);
|
|
46
38
|
const out = [];
|
|
47
|
-
if (
|
|
39
|
+
if (module.getStaticParams) {
|
|
48
40
|
const paramsList = await module.getStaticParams();
|
|
49
41
|
for (const params of paramsList) {
|
|
50
42
|
out.push(await render(modulePath, params, config));
|