kerria 0.3.3 → 0.3.4

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/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ interface UseSourceOptions<T = any> {
37
37
  }
38
38
  declare function useSource<C extends object>(kind: number, options: UseSourceOptions<C>): SourceInfo;
39
39
  //#endregion
40
- //#region src/core/processor.d.ts
40
+ //#region src/core/kerria.d.ts
41
41
  interface KerriaContext {
42
42
  sign: string;
43
43
  loadInfos: LoadInfo[];
@@ -49,4 +49,4 @@ declare function createKerria(sign: string, setup: (ctx: KerriaContext) => void)
49
49
  watch: () => Promise<void>;
50
50
  };
51
51
  //#endregion
52
- export { LoadInfo, SourceInfo, UseLoadOptions, createKerria, useCurrentContext, useLoad, useSource };
52
+ export { KerriaContext, LoadInfo, SourceInfo, UseLoadOptions, UseSourceOptions, createKerria, useCurrentContext, useLoad, useSource };
package/dist/index.js CHANGED
@@ -4,9 +4,8 @@ import { readFile, stat, writeFile } from "node:fs/promises";
4
4
  import chokidar from "chokidar";
5
5
  import consola from "consola";
6
6
  import * as pkg from "empathic/package";
7
- import { join, resolve } from "pathe";
7
+ import { dirname, join, resolve } from "pathe";
8
8
  import { glob } from "tinyglobby";
9
- import { dirname } from "node:path";
10
9
 
11
10
  //#region src/utils.ts
12
11
  const isDev = process.env.NODE_ENV === "development";
@@ -33,7 +32,7 @@ function writeJsonSync(path, data) {
33
32
  }
34
33
 
35
34
  //#endregion
36
- //#region src/core/processor.ts
35
+ //#region src/core/kerria.ts
37
36
  let currentContext = null;
38
37
  function useCurrentContext() {
39
38
  return currentContext;
@@ -93,12 +92,11 @@ function createKerria(sign, setup) {
93
92
  info.onCacheHit?.(cache);
94
93
  return false;
95
94
  }
96
- cache = { hash };
97
95
  const data = await info.parse(path, info);
98
96
  if (data !== null) {
99
97
  cache = {
100
- ...cache,
101
- ...data ?? {}
98
+ hash,
99
+ ...data
102
100
  };
103
101
  info.onCacheHit?.(cache);
104
102
  caches[path] = cache;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kerria",
3
3
  "type": "module",
4
- "version": "0.3.3",
4
+ "version": "0.3.4",
5
5
  "description": "Composable source processor",
6
6
  "author": "KazariEX",
7
7
  "license": "MIT",
@@ -19,18 +19,18 @@
19
19
  "dependencies": {
20
20
  "chokidar": "^4.0.3",
21
21
  "consola": "^3.4.2",
22
- "empathic": "^1.1.0",
22
+ "empathic": "^2.0.0",
23
23
  "pathe": "^2.0.3",
24
24
  "tinyglobby": "^0.2.14"
25
25
  },
26
26
  "devDependencies": {
27
- "@antfu/eslint-config": "^4.13.2",
28
- "@types/node": "^22.15.29",
27
+ "@antfu/eslint-config": "^4.16.2",
28
+ "@types/node": "^24.0.10",
29
29
  "@zinkawaii/eslint-config": "^0.3.0",
30
30
  "@zinkawaii/tsconfig": "^0.0.2",
31
- "bumpp": "^10.1.1",
32
- "eslint": "^9.28.0",
33
- "tsdown": "^0.12.5"
31
+ "bumpp": "^10.2.0",
32
+ "eslint": "^9.30.1",
33
+ "tsdown": "^0.12.9"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsdown",