kerria 0.2.4 → 0.3.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/dist/index.d.ts CHANGED
@@ -40,16 +40,16 @@ declare function useSource<C extends object>(kind: number, options: UseSourceOpt
40
40
 
41
41
  //#endregion
42
42
  //#region src/core/processor.d.ts
43
- interface ProcessorContext {
43
+ interface KerriaContext {
44
44
  sign: string;
45
45
  loadInfos: LoadInfo[];
46
46
  sourceInfos: SourceInfo[];
47
47
  }
48
- declare function useCurrentContext(): ProcessorContext;
49
- declare function createProcessor(sign: string, setup: (ctx: ProcessorContext) => void): {
48
+ declare function useCurrentContext(): KerriaContext;
49
+ declare function createKerria(sign: string, setup: (ctx: KerriaContext) => void): {
50
50
  build: () => Promise<void>;
51
51
  watch: () => Promise<void>;
52
52
  };
53
53
 
54
54
  //#endregion
55
- export { LoadInfo, SourceInfo, UseLoadOptions, createProcessor, useCurrentContext, useLoad, useSource };
55
+ export { LoadInfo, SourceInfo, UseLoadOptions, createKerria, useCurrentContext, useLoad, useSource };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { existsSync, mkdirSync, readFileSync, rmdirSync, writeFileSync } from "node:fs";
2
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { readFile, stat, writeFile } from "node:fs/promises";
4
4
  import chokidar from "chokidar";
5
5
  import consola from "consola";
@@ -38,7 +38,7 @@ let currentContext = null;
38
38
  function useCurrentContext() {
39
39
  return currentContext;
40
40
  }
41
- function createProcessor(sign, setup) {
41
+ function createKerria(sign, setup) {
42
42
  const ctx = {
43
43
  sign,
44
44
  loadInfos: [],
@@ -122,7 +122,7 @@ function createProcessor(sign, setup) {
122
122
  }
123
123
  function outputLoads() {
124
124
  if (isDev) writeJsonSync(cachePath, caches);
125
- else rmdirSync(cachePath);
125
+ else rmSync(cachePath);
126
126
  for (const info of ctx.loadInfos) info.output();
127
127
  }
128
128
  return {
@@ -185,4 +185,4 @@ function useSource(kind, options) {
185
185
  }
186
186
 
187
187
  //#endregion
188
- export { createProcessor, useCurrentContext, useLoad, useSource };
188
+ export { createKerria, useCurrentContext, useLoad, useSource };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kerria",
3
3
  "type": "module",
4
- "version": "0.2.4",
4
+ "version": "0.3.0",
5
5
  "description": "Composable source processor",
6
6
  "author": "KazariEX",
7
7
  "license": "MIT",