@static-pages/core 2.0.2 → 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/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 _default: (routes: Route | Route[]) => Promise<void>;
10
- export default _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
- exports.default = async (routes) => {
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 _default: (routes: Route | Route[]) => Promise<void>;
10
- export default _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 default async (routes) => {
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.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "General purpose static pages renderer.",
5
5
  "type": "module",
6
6
  "main": "./cjs/index.js",