@static-pages/core 2.0.0 → 2.1.0
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/README.md +2 -2
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +4 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Yes! Because I browsed the whole jamstack scene, but could not find one which
|
|
|
15
15
|
3. can render with any template engine (Twig, ejs, Pug, Mustache etc.)
|
|
16
16
|
4. supports incremental builds
|
|
17
17
|
5. has a flexible CLI tool (see [@static-pages/cli](https://www.npmjs.com/package/@static-pages/cli) on npm)
|
|
18
|
-
6. has a Docker image (see [
|
|
18
|
+
6. has a Docker image (see [staticpages/cli](https://hub.docker.com/repository/docker/staticpages/cli) on dockerhub)
|
|
19
19
|
7. written in JS (preferably TypeScript)
|
|
20
20
|
8. easy to extend with JS code
|
|
21
21
|
9. learning and using is easy (Gatsby, Hugo, Jekyll, Eleventy etc. are so cool but harder to learn and configure)
|
|
@@ -75,7 +75,7 @@ type Options = {
|
|
|
75
75
|
from: Iterable<Data> | AsyncIterable<Data>;
|
|
76
76
|
to: (data: Data) => void | Promise<void>;
|
|
77
77
|
controller?: (data: Data) => undefined | Data | Data[] | Promise<undefined | Data | Data[]>;
|
|
78
|
-
variables
|
|
78
|
+
variables?: Record<string, unknown>;
|
|
79
79
|
}[];
|
|
80
80
|
|
|
81
81
|
// Where `Data` is:
|
package/cjs/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export declare type Route = {
|
|
|
6
6
|
controller?: Controller;
|
|
7
7
|
variables?: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
export declare const staticPages: (routes: Route | Route[]) => Promise<void>;
|
|
10
|
+
export default staticPages;
|
package/cjs/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.staticPages = void 0;
|
|
3
4
|
const getType = (x) => typeof x === 'object' ? (x ? 'object' : 'null') : typeof x;
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
const isIterable = (x) => typeof (x === null || x === void 0 ? void 0 : x[Symbol.iterator]) === 'function';
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
8
|
const isAsyncIterable = (x) => typeof (x === null || x === void 0 ? void 0 : x[Symbol.asyncIterator]) === 'function';
|
|
8
|
-
|
|
9
|
+
const staticPages = async (routes) => {
|
|
9
10
|
for (const route of Array.isArray(routes) ? routes : [routes]) {
|
|
10
11
|
if (typeof route !== 'object' || !route)
|
|
11
12
|
throw new Error(`Route type mismatch, expected 'object', got '${getType(route)}'.`);
|
|
@@ -32,3 +33,5 @@ exports.default = async (routes) => {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
};
|
|
36
|
+
exports.staticPages = staticPages;
|
|
37
|
+
exports.default = exports.staticPages;
|
package/esm/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export declare type Route = {
|
|
|
6
6
|
controller?: Controller;
|
|
7
7
|
variables?: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
export declare const staticPages: (routes: Route | Route[]) => Promise<void>;
|
|
10
|
+
export default staticPages;
|
package/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ const getType = (x) => typeof x === 'object' ? (x ? 'object' : 'null') : typeof
|
|
|
3
3
|
const isIterable = (x) => typeof (x === null || x === void 0 ? void 0 : x[Symbol.iterator]) === 'function';
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
5
|
const isAsyncIterable = (x) => typeof (x === null || x === void 0 ? void 0 : x[Symbol.asyncIterator]) === 'function';
|
|
6
|
-
export
|
|
6
|
+
export const staticPages = async (routes) => {
|
|
7
7
|
for (const route of Array.isArray(routes) ? routes : [routes]) {
|
|
8
8
|
if (typeof route !== 'object' || !route)
|
|
9
9
|
throw new Error(`Route type mismatch, expected 'object', got '${getType(route)}'.`);
|
|
@@ -30,3 +30,4 @@ export default async (routes) => {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
+
export default staticPages;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@static-pages/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "General purpose static pages renderer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./cjs/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://staticpagesjs.github.io/",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^14.18.9",
|
|
49
49
|
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
50
50
|
"@typescript-eslint/parser": "^5.3.0",
|
|
51
51
|
"coveralls": "^3.1.1",
|