@static-pages/core 7.0.0-beta.4 → 7.0.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/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.staticPages = void 0;
4
- const isIterable = (x) => !!x && typeof x === 'object' && Symbol.iterator in x && typeof x[Symbol.iterator] === 'function';
5
- const isAsyncIterable = (x) => !!x && typeof x === 'object' && Symbol.asyncIterator in x && typeof x[Symbol.asyncIterator] === 'function';
4
+ const isIterable = (x) => !!x && typeof x === 'object' && typeof x[Symbol.iterator] === 'function';
5
+ const isAsyncIterable = (x) => !!x && typeof x === 'object' && typeof x[Symbol.asyncIterator] === 'function';
6
6
  const getType = (x) => typeof x === 'object' ? (x ? (Array.isArray(x) ? 'array' : 'object') : 'null') : typeof x;
7
7
  async function staticPages(...routes) {
8
8
  for (const route of routes) {
package/index.d.mts ADDED
@@ -0,0 +1,13 @@
1
+ export interface Route<F = any, T = any> {
2
+ from: Iterable<F> | AsyncIterable<F>;
3
+ to(data: T): void | Promise<void>;
4
+ controller?(data: F): undefined | T | Iterable<T> | AsyncIterable<T> | Promise<undefined | T | Iterable<T> | AsyncIterable<T>>;
5
+ }
6
+ export declare function staticPages<F1, T1>(...route: [Route<F1, T1>]): Promise<void>;
7
+ export declare function staticPages<F1, T1, F2, T2>(...route: [Route<F1, T1>, Route<F2, T2>]): Promise<void>;
8
+ export declare function staticPages<F1, T1, F2, T2, F3, T3>(...route: [Route<F1, T1>, Route<F2, T2>, Route<F3, T3>]): Promise<void>;
9
+ export declare function staticPages<F1, T1, F2, T2, F3, T3, F4, T4>(...route: [Route<F1, T1>, Route<F2, T2>, Route<F3, T3>, Route<F4, T4>]): Promise<void>;
10
+ export declare function staticPages<F1, T1, F2, T2, F3, T3, F4, T4, F5, T5>(...route: [Route<F1, T1>, Route<F2, T2>, Route<F3, T3>, Route<F4, T4>, Route<F5, T5>]): Promise<void>;
11
+ export declare function staticPages<F1, T1, F2, T2, F3, T3, F4, T4, F5, T5, F6, T6>(...route: [Route<F1, T1>, Route<F2, T2>, Route<F3, T3>, Route<F4, T4>, Route<F5, T5>, Route<F6, T6>]): Promise<void>;
12
+ export declare function staticPages(...routes: Route[]): Promise<void>;
13
+ export default staticPages;
@@ -1,5 +1,5 @@
1
- const isIterable = (x) => !!x && typeof x === 'object' && Symbol.iterator in x && typeof x[Symbol.iterator] === 'function';
2
- const isAsyncIterable = (x) => !!x && typeof x === 'object' && Symbol.asyncIterator in x && typeof x[Symbol.asyncIterator] === 'function';
1
+ const isIterable = (x) => !!x && typeof x === 'object' && typeof x[Symbol.iterator] === 'function';
2
+ const isAsyncIterable = (x) => !!x && typeof x === 'object' && typeof x[Symbol.asyncIterator] === 'function';
3
3
  const getType = (x) => typeof x === 'object' ? (x ? (Array.isArray(x) ? 'array' : 'object') : 'null') : typeof x;
4
4
  export async function staticPages(...routes) {
5
5
  for (const route of routes) {
package/package.json CHANGED
@@ -1,68 +1,41 @@
1
- {
2
- "name": "@static-pages/core",
3
- "version": "7.0.0-beta.4",
4
- "description": "General purpose static pages renderer.",
5
- "type": "module",
6
- "module": "./index.js",
7
- "main": "./index.cjs",
8
- "types": "./index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./index.js",
12
- "require": "./index.cjs",
13
- "types": "./index.d.ts"
14
- },
15
- "./package.json": "./package.json"
16
- },
17
- "engines": {
18
- "node": ">=16.0.0",
19
- "deno": ">=1.0.0"
20
- },
21
- "scripts": {
22
- "clean": "rimraf --glob \"!(.*).{d.ts,js,cjs,mjs}\" build coverage",
23
- "preversion": "npm run build && npm run test",
24
- "postversion": "git push && git push --tags",
25
- "watch": "chokidar src tsconfig.json -c \"npm run build\" --initial",
26
- "build": "npm run build:esm && npm run build:cjs && npm run build:types",
27
- "build:esm": "rimraf build && tsc && npm run move-build && rimraf build",
28
- "build:cjs": "rimraf build && tsc --module commonjs --moduleResolution node && npm run move-build -- -- --cjs && rimraf build",
29
- "build:types": "rimraf build && tsc --declaration --emitDeclarationOnly && npm run move-build && rimraf build",
30
- "move-build": "node -e \"process.chdir('build');const fs=require('fs');const path=require('path');fs.readdirSync('.',{recursive:true,withFileTypes:true}).filter(x=>x.isFile()).forEach(x=>{const f=path.join(x.path,x.name);const o=path.join('..',f);fs.mkdirSync(path.dirname(o),{recursive:true});if(process.argv[1]==='--cjs'){fs.writeFileSync(o.slice(0,-2)+'cjs',fs.readFileSync(f,'utf8').replace(/require\\(\\\"(.+?)\\.js\\\"\\)/g,'require\\(\\\"\\$1.cjs\\\"\\)'));}else{fs.renameSync(f,o);}});\"",
31
- "lint": "eslint src",
32
- "test": "mocha",
33
- "coverage": "c8 -r text -r text-summary -r lcov --include \"*.js\" npm test"
34
- },
35
- "devDependencies": {
36
- "@types/node": "^20.11.5",
37
- "@typescript-eslint/eslint-plugin": "^6.15.0",
38
- "@typescript-eslint/parser": "^6.15.0",
39
- "c8": "^9.1.0",
40
- "chokidar": "^3.5.3",
41
- "chokidar-cli": "^3.0.0",
42
- "eslint": "^8.1.0",
43
- "mocha": "^10.2.0",
44
- "rimraf": "^5.0.1",
45
- "typescript": "^5.1.6"
46
- },
47
- "author": "László BULIK",
48
- "license": "MPL-2.0",
49
- "homepage": "https://staticpagesjs.github.io/",
50
- "repository": {
51
- "type": "git",
52
- "url": "git+https://github.com/staticpagesjs/core.git"
53
- },
54
- "bugs": {
55
- "url": "https://github.com/staticpagesjs/core/issues"
56
- },
57
- "keywords": [
58
- "static",
59
- "pages",
60
- "generator",
61
- "renderer",
62
- "mvc",
63
- "jamstack",
64
- "view",
65
- "template",
66
- "controller"
67
- ]
68
- }
1
+ {
2
+ "name": "@static-pages/core",
3
+ "version": "7.0.0",
4
+ "description": "General purpose static pages renderer.",
5
+ "main": "./index.cjs",
6
+ "module": "./index.mjs",
7
+ "types": "./index.d.mts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./index.cjs",
11
+ "import": "./index.mjs",
12
+ "types": "./index.d.mts"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "engines": {
17
+ "node": ">=16.0.0",
18
+ "deno": ">=1.0.0"
19
+ },
20
+ "author": "László BULIK",
21
+ "license": "MPL-2.0",
22
+ "homepage": "https://staticpagesjs.github.io/",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/staticpagesjs/core.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/staticpagesjs/core/issues"
29
+ },
30
+ "keywords": [
31
+ "static",
32
+ "pages",
33
+ "generator",
34
+ "renderer",
35
+ "mvc",
36
+ "jamstack",
37
+ "view",
38
+ "template",
39
+ "controller"
40
+ ]
41
+ }
package/CHANGELOG.md DELETED
@@ -1,110 +0,0 @@
1
- # CHANGELOG
2
-
3
- ## 7.0.0
4
- - Reverted `route.to` callbacks to work as it was in `v4.0.0`. The function is called per doucument, recieving the current page data.
5
- - Type defintion improvements.
6
- - Test suite switched from tap to mocha for now.
7
- - Coverage reports switched from nyc to c8.
8
-
9
-
10
- ## 6.0.0
11
- - Use JS iterator protocol for the `route.to` callbacks.
12
- - Removed the `.teardown()` call on the `route.to` when iteration finished.
13
-
14
-
15
- ## 5.0.3
16
- - Updated .npmignore to remove unneeded files from package.
17
-
18
- ## 5.0.2
19
- - Use Github Actions instead of Travis-CI, replace Build status badge.
20
-
21
- ## 5.0.1
22
- - Updated maintenance badge in README.md.
23
-
24
- ## 5.0.0
25
- - Added a `.teardown()` call on the `route.to` which is executed when iteration finished.
26
- - Provided better type definitions.
27
-
28
-
29
- ## 4.0.0
30
- - Now types are exported in a namespace.
31
-
32
-
33
- ## 3.0.4
34
- - Updated eslint config.
35
-
36
- ## 3.0.3
37
- - Added esm tests.
38
- - Improved build configuration.
39
-
40
- ## 3.0.2
41
- - Improved examples.
42
-
43
- ## 3.0.1
44
- - Updated docs.
45
-
46
- ## 3.0.0
47
- - Removed `variables` option on `Route` type. You can use `.bind()` on the writer to achieve the same functionality.
48
- - Updated tests.
49
- - Updated README.md.
50
-
51
-
52
- ## 2.1.0
53
- - In addition to the default export, now the main function also gets exported as `staticPages`.
54
-
55
- ## 2.0.2
56
- - Updated dependencies.
57
- - Updated docker image link in README.md.
58
-
59
- ## 2.0.1
60
- - Fixed a typo in README.md.
61
-
62
- ## 2.0.0
63
- - Made configuration a bit cleaner and predictable by wrapping additional variables in a `variables` key in the `Route` type.
64
- - Updated tests.
65
- - Updated docs.
66
- - Changed some eslint configuration.
67
-
68
-
69
- ## 1.0.4
70
- - Improved esmodule compatibility.
71
- - Simplified syntax of `Data` type.
72
-
73
- ## 1.0.3
74
- - Made `isIterable` test a bit cleaner.
75
-
76
- ## 1.0.2
77
- - Added eslint support.
78
-
79
- ## 1.0.1
80
- - First stable release.
81
- - Added node12 support.
82
- - Updated .npmignore to remove unneeded files from package.
83
- - Updated dependencies.
84
- - Updated examples in README.md.
85
- - Added badges to README.md.
86
-
87
-
88
- ## 0.1.6
89
- - Updated tests to get 100% coverage.
90
- - Added test cases when `staticPages()` should throw.
91
- - Fixed a faulty throws case.
92
-
93
- ## 0.1.5
94
- - Added Travis testing and Coveralls coverage badge to README.md.
95
-
96
- ## 0.1.4
97
- - Improved README.md.
98
-
99
- ## 0.1.3
100
- - Added error handling which should throw when invalid params provided.
101
-
102
- ## 0.1.2
103
- - Configured a `prepack` script to automatically test before publish.
104
-
105
- ## 0.1.1
106
- - Updated .npmignore to omit /src folder from release.
107
- - Updated package keywords.
108
-
109
- ## 0.1.0
110
- - Initial work in progress release.
File without changes