@static-pages/core 7.0.0-beta.2 → 7.0.0-beta.3
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 +2 -2
- package/index.js +2 -2
- package/package.json +6 -11
package/index.cjs
CHANGED
|
@@ -8,9 +8,9 @@ async function staticPages(...routes) {
|
|
|
8
8
|
for (const route of routes) {
|
|
9
9
|
if (typeof route !== 'object' || !route)
|
|
10
10
|
throw new TypeError(`Expected 'object', recieved '${getType(route)}'.`);
|
|
11
|
-
|
|
11
|
+
const { from, to, controller } = route;
|
|
12
12
|
if (!isIterable(from) && !isAsyncIterable(from))
|
|
13
|
-
throw new TypeError(
|
|
13
|
+
throw new TypeError('Expected \'Iterable\' or \'AsyncIterable\' at \'from\' property.');
|
|
14
14
|
if (typeof to !== 'function')
|
|
15
15
|
throw new TypeError(`Expected 'function', recieved '${getType(to)}' at 'to' property.`);
|
|
16
16
|
if (typeof controller !== 'undefined' && typeof controller !== 'function')
|
package/index.js
CHANGED
|
@@ -5,9 +5,9 @@ export async function staticPages(...routes) {
|
|
|
5
5
|
for (const route of routes) {
|
|
6
6
|
if (typeof route !== 'object' || !route)
|
|
7
7
|
throw new TypeError(`Expected 'object', recieved '${getType(route)}'.`);
|
|
8
|
-
|
|
8
|
+
const { from, to, controller } = route;
|
|
9
9
|
if (!isIterable(from) && !isAsyncIterable(from))
|
|
10
|
-
throw new TypeError(
|
|
10
|
+
throw new TypeError('Expected \'Iterable\' or \'AsyncIterable\' at \'from\' property.');
|
|
11
11
|
if (typeof to !== 'function')
|
|
12
12
|
throw new TypeError(`Expected 'function', recieved '${getType(to)}' at 'to' property.`);
|
|
13
13
|
if (typeof controller !== 'undefined' && typeof controller !== 'function')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@static-pages/core",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.3",
|
|
4
4
|
"description": "General purpose static pages renderer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -24,16 +24,11 @@
|
|
|
24
24
|
"postversion": "git push && git push --tags",
|
|
25
25
|
"watch": "chokidar src tsconfig.json -c \"npm run build\" --initial",
|
|
26
26
|
"build": "npm run build:esm && npm run build:cjs && npm run build:types",
|
|
27
|
-
"
|
|
28
|
-
"build:
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"postbuild:cjs": "rimraf build",
|
|
33
|
-
"prebuild:types": "rimraf build",
|
|
34
|
-
"build:types": "tsc --declaration --emitDeclarationOnly && node -e \"require('fs').readdirSync('build').forEach(f=>require('fs').renameSync('build/'+f,f))\"",
|
|
35
|
-
"postbuild:types": "rimraf build",
|
|
36
|
-
"lint": "eslint",
|
|
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",
|
|
37
32
|
"test": "mocha",
|
|
38
33
|
"coverage": "c8 -r text -r text-summary -r lcov --include \"*.js\" npm test"
|
|
39
34
|
},
|