kerria 0.3.2 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -132,9 +132,9 @@ function createKerria(sign, setup) {
132
132
  //#region src/core/useLoad.ts
133
133
  function useLoad(name, options) {
134
134
  const ctx = useCurrentContext();
135
+ const { defaultValue = {}, onUpdate, beforeOutput } = options;
135
136
  const src = options.src ? resolve(options.src) : void 0;
136
137
  const out = resolve(options.out);
137
- const { defaultValue = {}, onUpdate, beforeOutput } = options;
138
138
  const info = {
139
139
  name,
140
140
  src,
@@ -155,10 +155,11 @@ function useLoad(name, options) {
155
155
  //#region src/core/useSource.ts
156
156
  function useSource(kind, options) {
157
157
  const ctx = useCurrentContext();
158
+ const { deep = true, skip = 0 } = options;
158
159
  const base = resolve(options.base);
159
160
  const dist = options.dist ? resolve(options.dist) : void 0;
160
161
  const folders = options.folders?.map((folder) => resolve(base, folder)) ?? [base];
161
- const patterns = folders.map((path) => resolve(path, (options.deep ? "**/*" : "*") + options.ext));
162
+ const patterns = folders.map((path) => resolve(path, (deep ? "**/*" : "*") + options.ext));
162
163
  const info = {
163
164
  ...options,
164
165
  kind,
@@ -166,11 +167,11 @@ function useSource(kind, options) {
166
167
  dist,
167
168
  folders,
168
169
  patterns,
169
- deep: options.deep ?? true,
170
- skip: options.skip ?? 0,
170
+ deep,
171
+ skip,
171
172
  filter(path) {
172
173
  const depth = path.split("/").length - folders[0].split("/").length;
173
- return info.skip < depth;
174
+ return skip < depth;
174
175
  },
175
176
  async output(path, data) {
176
177
  const outPath = path.replace(base, dist).replace(info.ext, ".json");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kerria",
3
3
  "type": "module",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "description": "Composable source processor",
6
6
  "author": "KazariEX",
7
7
  "license": "MIT",