@static-pages/core 7.0.0-beta.1 → 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.
@@ -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
- let { from, to, controller } = route;
11
+ const { from, to, controller } = route;
12
12
  if (!isIterable(from) && !isAsyncIterable(from))
13
- throw new TypeError(`Expected 'Iterable' or 'AsyncIterable' at 'from' property.`);
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')
@@ -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
- let { from, to, controller } = route;
8
+ const { from, to, controller } = route;
9
9
  if (!isIterable(from) && !isAsyncIterable(from))
10
- throw new TypeError(`Expected 'Iterable' or 'AsyncIterable' at 'from' property.`);
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,16 +1,16 @@
1
1
  {
2
2
  "name": "@static-pages/core",
3
- "version": "7.0.0-beta.1",
3
+ "version": "7.0.0-beta.3",
4
4
  "description": "General purpose static pages renderer.",
5
5
  "type": "module",
6
- "main": "./cjs/index.js",
7
- "module": "./esm/index.js",
8
- "types": "./esm/index.d.ts",
6
+ "module": "./index.js",
7
+ "main": "./index.cjs",
8
+ "types": "./index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js",
13
- "types": "./types/index.d.ts"
11
+ "import": "./index.js",
12
+ "require": "./index.cjs",
13
+ "types": "./index.d.ts"
14
14
  },
15
15
  "./package.json": "./package.json"
16
16
  },
@@ -19,27 +19,26 @@
19
19
  "deno": ">=1.0.0"
20
20
  },
21
21
  "scripts": {
22
+ "clean": "rimraf --glob \"!(.*).{d.ts,js,cjs,mjs}\" build coverage",
22
23
  "preversion": "npm run build && npm run test",
23
24
  "postversion": "git push && git push --tags",
24
- "clean": "rimraf esm cjs types coverage",
25
- "prewatch:esm": "npm run build:esm",
26
- "watch:esm": "tsc --watch",
27
- "prewatch:cjs": "npm run build:cjs",
28
- "watch:cjs": "tsc --outDir cjs --module commonjs --moduleResolution node --watch",
25
+ "watch": "chokidar src tsconfig.json -c \"npm run build\" --initial",
29
26
  "build": "npm run build:esm && npm run build:cjs && npm run build:types",
30
- "build:esm": "tsc",
31
- "build:cjs": "tsc --outDir cjs --module commonjs --moduleResolution node",
32
- "postbuild:cjs": "echo { \"type\": \"commonjs\" }>cjs/package.json",
33
- "build:types": "tsc --outDir types --declaration --emitDeclarationOnly",
34
- "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",
35
32
  "test": "mocha",
36
- "coverage": "c8 -r text -r text-summary -r lcov --include \"esm/*\" npm test"
33
+ "coverage": "c8 -r text -r text-summary -r lcov --include \"*.js\" npm test"
37
34
  },
38
35
  "devDependencies": {
39
- "@types/node": "^20.10.5",
36
+ "@types/node": "^20.11.5",
40
37
  "@typescript-eslint/eslint-plugin": "^6.15.0",
41
38
  "@typescript-eslint/parser": "^6.15.0",
42
- "c8": "^8.0.0",
39
+ "c8": "^9.1.0",
40
+ "chokidar": "^3.5.3",
41
+ "chokidar-cli": "^3.0.0",
43
42
  "eslint": "^8.1.0",
44
43
  "mocha": "^10.2.0",
45
44
  "rimraf": "^5.0.1",
package/cjs/package.json DELETED
@@ -1 +0,0 @@
1
- { "type": "commonjs" }
File without changes