kerria 0.3.0 → 0.3.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/dist/index.d.ts +0 -3
- package/dist/index.js +3 -6
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ declare function useLoad(name: string, options: UseLoadOptions): LoadInfo;
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/types.d.ts
|
|
17
17
|
type MaybePromise<T> = T | Promise<T>;
|
|
18
|
-
|
|
19
18
|
//#endregion
|
|
20
19
|
//#region src/core/useSource.d.ts
|
|
21
20
|
interface SourceInfo extends Omit<UseSourceOptions, "folders"> {
|
|
@@ -37,7 +36,6 @@ interface UseSourceOptions<T = any> {
|
|
|
37
36
|
onCacheHit?: (cache: T) => void;
|
|
38
37
|
}
|
|
39
38
|
declare function useSource<C extends object>(kind: number, options: UseSourceOptions<C>): SourceInfo;
|
|
40
|
-
|
|
41
39
|
//#endregion
|
|
42
40
|
//#region src/core/processor.d.ts
|
|
43
41
|
interface KerriaContext {
|
|
@@ -50,6 +48,5 @@ declare function createKerria(sign: string, setup: (ctx: KerriaContext) => void)
|
|
|
50
48
|
build: () => Promise<void>;
|
|
51
49
|
watch: () => Promise<void>;
|
|
52
50
|
};
|
|
53
|
-
|
|
54
51
|
//#endregion
|
|
55
52
|
export { LoadInfo, SourceInfo, UseLoadOptions, createKerria, useCurrentContext, useLoad, useSource };
|
package/dist/index.js
CHANGED
|
@@ -55,10 +55,7 @@ function createKerria(sign, setup) {
|
|
|
55
55
|
const caches = existsSync(cachePath) && readJsonSync(cachePath) || {};
|
|
56
56
|
async function build() {
|
|
57
57
|
for (const info of ctx.sourceInfos) {
|
|
58
|
-
const paths = await glob(info.patterns, {
|
|
59
|
-
deep: info.deep ? Infinity : 2,
|
|
60
|
-
absolute: true
|
|
61
|
-
});
|
|
58
|
+
const paths = await glob(info.patterns, { absolute: true });
|
|
62
59
|
await Promise.all(paths.map((path) => path.replaceAll("\\", "/")).filter(info.filter).sort((a, b) => a.localeCompare(b)).map((path) => parse(path, info)));
|
|
63
60
|
}
|
|
64
61
|
outputLoads();
|
|
@@ -122,7 +119,7 @@ function createKerria(sign, setup) {
|
|
|
122
119
|
}
|
|
123
120
|
function outputLoads() {
|
|
124
121
|
if (isDev) writeJsonSync(cachePath, caches);
|
|
125
|
-
else rmSync(cachePath);
|
|
122
|
+
else rmSync(cachePath, { force: true });
|
|
126
123
|
for (const info of ctx.loadInfos) info.output();
|
|
127
124
|
}
|
|
128
125
|
return {
|
|
@@ -161,7 +158,7 @@ function useSource(kind, options) {
|
|
|
161
158
|
const base = resolve(options.base);
|
|
162
159
|
const dist = options.dist ? resolve(options.dist) : void 0;
|
|
163
160
|
const folders = options.folders?.map((folder) => resolve(base, folder)) ?? [base];
|
|
164
|
-
const patterns = folders.map((path) => resolve(path,
|
|
161
|
+
const patterns = folders.map((path) => resolve(path, (options.deep ? "**/*" : "*") + options.ext));
|
|
165
162
|
const info = {
|
|
166
163
|
...options,
|
|
167
164
|
kind,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kerria",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "Composable source processor",
|
|
6
6
|
"author": "KazariEX",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"consola": "^3.4.2",
|
|
22
22
|
"empathic": "^1.1.0",
|
|
23
23
|
"pathe": "^2.0.3",
|
|
24
|
-
"tinyglobby": "^0.2.
|
|
24
|
+
"tinyglobby": "^0.2.14"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@antfu/eslint-config": "^4.13.
|
|
28
|
-
"@types/node": "^22.15.
|
|
27
|
+
"@antfu/eslint-config": "^4.13.2",
|
|
28
|
+
"@types/node": "^22.15.29",
|
|
29
29
|
"@zinkawaii/eslint-config": "^0.3.0",
|
|
30
30
|
"@zinkawaii/tsconfig": "^0.0.2",
|
|
31
|
-
"bumpp": "^10.1.
|
|
32
|
-
"eslint": "^9.
|
|
33
|
-
"tsdown": "^0.
|
|
31
|
+
"bumpp": "^10.1.1",
|
|
32
|
+
"eslint": "^9.28.0",
|
|
33
|
+
"tsdown": "^0.12.5"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown",
|