primate 0.20.1 → 0.20.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primate",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Expressive, minimal and extensible web framework",
5
5
  "homepage": "https://primatejs.com",
6
6
  "bugs": "https://github.com/primatejs/primate/issues",
@@ -20,6 +20,9 @@
20
20
  "dependencies": {
21
21
  "runtime-compat": "^0.20.2"
22
22
  },
23
+ "engines": {
24
+ "node": ">=18.16"
25
+ },
23
26
  "type": "module",
24
27
  "exports": "./src/exports.js"
25
28
  }
package/src/app.js CHANGED
@@ -8,6 +8,7 @@ import * as hooks from "./hooks/exports.js";
8
8
  import * as loaders from "./loaders/exports.js";
9
9
  import dispatch from "./dispatch.js";
10
10
  import {print} from "./Logger.js";
11
+ import toSorted from "./toSorted.js";
11
12
 
12
13
  const base = new Path(import.meta.url).up(1);
13
14
  // do not hard-depend on node
@@ -101,8 +102,8 @@ export default async (config, root, log) => {
101
102
  const style = ({inline, code, href, rel = "stylesheet"}) => inline
102
103
  ? tag({name: "style", code})
103
104
  : tag({name: "link", attributes: {rel, href}, close: false});
104
- const heads = app.assets
105
- .toSorted(({type}) => -1 * (type === "importmap"))
105
+ const heads = toSorted(app.assets,
106
+ ({type}) => -1 * (type === "importmap"))
106
107
  .map(({src, code, type, inline, integrity}) =>
107
108
  type === "style"
108
109
  ? style({inline, code, href: src})
@@ -1,13 +1,14 @@
1
1
  import {Path} from "runtime-compat/fs";
2
2
  import errors from "../../errors.js";
3
+ import toSorted from "../../toSorted.js";
3
4
 
4
5
  export default type => async (log, directory, load) => {
5
6
  const filter = path => new RegExp(`^\\+${type}.js$`, "u").test(path.name);
6
7
 
7
8
  const replace = new RegExp(`\\+${type}`, "u");
8
- const objects = (await load({log, directory, filter, warn: false}))
9
- .map(([name, object]) => [name.replace(replace, () => ""), object])
10
- .toSorted(([a], [b]) => a.length - b.length);
9
+ const objects = toSorted((await load({log, directory, filter, warn: false}))
10
+ .map(([name, object]) => [name.replace(replace, () => ""), object]),
11
+ ([a], [b]) => a.length - b.length);
11
12
 
12
13
  const resolve = name => new Path(directory, name, `+${type}.js`);
13
14
  objects.some(([name, value]) => typeof value !== "function"
@@ -0,0 +1 @@
1
+ export default (array, compareFn) => [...array].sort(compareFn);