@kubb/core 3.0.0-alpha.4 → 3.0.0-alpha.6
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/{FileManager-CaejIVBd.d.ts → FileManager-Ceski1W9.d.ts} +47 -47
- package/dist/{FileManager--scIq4y4.d.cts → FileManager-wyXRkgIk.d.cts} +47 -47
- package/dist/chunk-2EU7DMPM.js +97 -0
- package/dist/chunk-2EU7DMPM.js.map +1 -0
- package/dist/chunk-5HN4LW3R.cjs +102 -0
- package/dist/chunk-5HN4LW3R.cjs.map +1 -0
- package/dist/{chunk-EFQPHF4E.js → chunk-76UEJFFE.js} +1 -4
- package/dist/chunk-76UEJFFE.js.map +1 -0
- package/dist/{chunk-5JZNFPUP.js → chunk-AWAZR3D5.js} +61 -10
- package/dist/chunk-AWAZR3D5.js.map +1 -0
- package/dist/{chunk-V5THHXXQ.cjs → chunk-DCZQYCCO.cjs} +218 -299
- package/dist/chunk-DCZQYCCO.cjs.map +1 -0
- package/dist/{chunk-YTSNYMHW.cjs → chunk-L3JJLZ5Q.cjs} +62 -11
- package/dist/chunk-L3JJLZ5Q.cjs.map +1 -0
- package/dist/{chunk-QRIDQ4RG.cjs → chunk-LOLEBOMW.cjs} +1 -4
- package/dist/chunk-LOLEBOMW.cjs.map +1 -0
- package/dist/chunk-RIEGCND2.js +525 -0
- package/dist/chunk-RIEGCND2.js.map +1 -0
- package/dist/index.cjs +81 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +68 -64
- package/dist/index.js.map +1 -1
- package/dist/{logger-dzAcLeAA.d.cts → logger-BWFeedRk.d.cts} +17 -2
- package/dist/{logger-dzAcLeAA.d.ts → logger-BWFeedRk.d.ts} +17 -2
- package/dist/logger.cjs +2 -2
- package/dist/logger.d.cts +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +1 -1
- package/dist/mocks.cjs +4 -6
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +3 -5
- package/dist/mocks.d.ts +3 -5
- package/dist/mocks.js +5 -7
- package/dist/mocks.js.map +1 -1
- package/dist/transformers.cjs +189 -33
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.d.cts +1 -3
- package/dist/transformers.d.ts +1 -3
- package/dist/transformers.js +156 -14
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +6 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +30 -3
- package/dist/utils.d.ts +30 -3
- package/dist/utils.js +7 -3
- package/package.json +9 -8
- package/src/BarrelManager.ts +27 -93
- package/src/FileManager.ts +165 -266
- package/src/PackageManager.ts +1 -1
- package/src/PluginManager.ts +89 -57
- package/src/build.ts +7 -26
- package/src/logger.ts +6 -7
- package/src/transformers/index.ts +2 -3
- package/src/transformers/trim.ts +0 -4
- package/src/types.ts +1 -1
- package/src/utils/TreeNode.ts +91 -26
- package/src/utils/executeStrategies.ts +1 -1
- package/src/utils/index.ts +2 -1
- package/src/utils/parser.ts +96 -0
- package/dist/chunk-5JZNFPUP.js.map +0 -1
- package/dist/chunk-EFQPHF4E.js.map +0 -1
- package/dist/chunk-JKZG2IJR.js +0 -283
- package/dist/chunk-JKZG2IJR.js.map +0 -1
- package/dist/chunk-PZT4CTBV.cjs +0 -299
- package/dist/chunk-PZT4CTBV.cjs.map +0 -1
- package/dist/chunk-QRIDQ4RG.cjs.map +0 -1
- package/dist/chunk-UUBPTMRW.js +0 -608
- package/dist/chunk-UUBPTMRW.js.map +0 -1
- package/dist/chunk-V5THHXXQ.cjs.map +0 -1
- package/dist/chunk-YTSNYMHW.cjs.map +0 -1
- package/src/utils/getParser.ts +0 -17
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunk5HN4LW3Rcjs = require('./chunk-5HN4LW3R.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
var _chunkQRIDQ4RGcjs = require('./chunk-QRIDQ4RG.cjs');
|
|
7
7
|
|
|
8
|
+
var _chunkLOLEBOMWcjs = require('./chunk-LOLEBOMW.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
var _chunkV5THHXXQcjs = require('./chunk-V5THHXXQ.cjs');
|
|
11
11
|
|
|
12
|
+
var _chunkDCZQYCCOcjs = require('./chunk-DCZQYCCO.cjs');
|
|
12
13
|
|
|
13
|
-
var _chunkPZT4CTBVcjs = require('./chunk-PZT4CTBV.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
var _chunkYTSNYMHWcjs = require('./chunk-YTSNYMHW.cjs');
|
|
16
|
+
var _chunkL3JJLZ5Qcjs = require('./chunk-L3JJLZ5Q.cjs');
|
|
18
17
|
require('./chunk-67C6RBGQ.cjs');
|
|
19
18
|
require('./chunk-34BPAXR2.cjs');
|
|
20
19
|
|
|
@@ -37,7 +36,6 @@ var _fs = require('@kubb/fs');
|
|
|
37
36
|
// src/PluginManager.ts
|
|
38
37
|
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
39
38
|
|
|
40
|
-
|
|
41
39
|
// src/PromiseManager.ts
|
|
42
40
|
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
43
41
|
|
|
@@ -196,7 +194,7 @@ var _core, _usedPluginNames, _promiseManager, _PluginManager_instances, getSorte
|
|
|
196
194
|
var PluginManager = class {
|
|
197
195
|
constructor(config, options) {
|
|
198
196
|
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _PluginManager_instances);
|
|
199
|
-
this.events = new (0,
|
|
197
|
+
this.events = new (0, _chunkLOLEBOMWcjs.EventEmitter)();
|
|
200
198
|
this.executed = [];
|
|
201
199
|
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _core);
|
|
202
200
|
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _usedPluginNames, {});
|
|
@@ -209,14 +207,16 @@ var PluginManager = class {
|
|
|
209
207
|
parameters: [params.baseName, params.mode, params.options]
|
|
210
208
|
});
|
|
211
209
|
if (paths && _optionalChain([paths, 'optionalAccess', _3 => _3.length]) > 1) {
|
|
212
|
-
this.logger.emit("debug",
|
|
213
|
-
|
|
210
|
+
this.logger.emit("debug", {
|
|
211
|
+
logs: [
|
|
212
|
+
`Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
214
213
|
|
|
215
214
|
Paths: ${JSON.stringify(paths, void 0, 2)}
|
|
216
215
|
|
|
217
216
|
Falling back on the first item.
|
|
218
217
|
`
|
|
219
|
-
|
|
218
|
+
]
|
|
219
|
+
});
|
|
220
220
|
}
|
|
221
221
|
return _optionalChain([paths, 'optionalAccess', _4 => _4.at, 'call', _5 => _5(0)]);
|
|
222
222
|
}
|
|
@@ -233,26 +233,29 @@ Falling back on the first item.
|
|
|
233
233
|
parameters: [params.name, params.type]
|
|
234
234
|
});
|
|
235
235
|
if (names && _optionalChain([names, 'optionalAccess', _6 => _6.length]) > 1) {
|
|
236
|
-
this.logger.emit("debug",
|
|
237
|
-
|
|
236
|
+
this.logger.emit("debug", {
|
|
237
|
+
logs: [
|
|
238
|
+
`Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
|
|
238
239
|
|
|
239
240
|
Names: ${JSON.stringify(names, void 0, 2)}
|
|
240
241
|
|
|
241
242
|
Falling back on the first item.
|
|
242
243
|
`
|
|
243
|
-
|
|
244
|
+
]
|
|
245
|
+
});
|
|
244
246
|
}
|
|
245
|
-
return
|
|
247
|
+
return _chunk5HN4LW3Rcjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _7 => _7.at, 'call', _8 => _8(0)]) || params.name);
|
|
246
248
|
}
|
|
247
249
|
const name = this.hookFirstSync({
|
|
248
250
|
hookName: "resolveName",
|
|
249
251
|
parameters: [params.name, params.type]
|
|
250
252
|
}).result;
|
|
251
|
-
return
|
|
253
|
+
return _chunk5HN4LW3Rcjs.transformReservedWord.call(void 0, name);
|
|
252
254
|
};
|
|
253
255
|
this.config = config;
|
|
256
|
+
this.options = options;
|
|
254
257
|
this.logger = options.logger;
|
|
255
|
-
this.fileManager = new (0,
|
|
258
|
+
this.fileManager = new (0, _chunkDCZQYCCOcjs.FileManager)();
|
|
256
259
|
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _promiseManager, new PromiseManager({
|
|
257
260
|
nullCheck: (state) => !!_optionalChain([state, 'optionalAccess', _9 => _9.result])
|
|
258
261
|
}));
|
|
@@ -273,23 +276,18 @@ Falling back on the first item.
|
|
|
273
276
|
return this;
|
|
274
277
|
}
|
|
275
278
|
getFile({ name, mode, extName, pluginKey, options }) {
|
|
276
|
-
let source = "";
|
|
277
279
|
const baseName = `${name}${extName}`;
|
|
278
280
|
const path4 = this.resolvePath({ baseName, mode, pluginKey, options });
|
|
279
281
|
if (!path4) {
|
|
280
282
|
throw new Error(`Filepath should be defined for resolvedName "${name}" and pluginKey [${JSON.stringify(pluginKey)}]`);
|
|
281
283
|
}
|
|
282
|
-
try {
|
|
283
|
-
source = _fs.readSync.call(void 0, path4);
|
|
284
|
-
} catch (_e) {
|
|
285
|
-
}
|
|
286
284
|
return {
|
|
287
285
|
path: path4,
|
|
288
286
|
baseName,
|
|
289
287
|
meta: {
|
|
290
288
|
pluginKey
|
|
291
289
|
},
|
|
292
|
-
|
|
290
|
+
sources: []
|
|
293
291
|
};
|
|
294
292
|
}
|
|
295
293
|
/**
|
|
@@ -301,12 +299,13 @@ Falling back on the first item.
|
|
|
301
299
|
/**
|
|
302
300
|
* Run a specific hookName for plugin x.
|
|
303
301
|
*/
|
|
304
|
-
hookForPlugin({
|
|
302
|
+
async hookForPlugin({
|
|
305
303
|
pluginKey,
|
|
306
304
|
hookName,
|
|
307
305
|
parameters
|
|
308
306
|
}) {
|
|
309
307
|
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
308
|
+
this.logger.emit("progress_start", { id: hookName, size: plugins.length });
|
|
310
309
|
const promises = plugins.map((plugin) => {
|
|
311
310
|
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
312
311
|
strategy: "hookFirst",
|
|
@@ -315,7 +314,9 @@ Falling back on the first item.
|
|
|
315
314
|
plugin
|
|
316
315
|
});
|
|
317
316
|
}).filter(Boolean);
|
|
318
|
-
|
|
317
|
+
const items = await Promise.all(promises);
|
|
318
|
+
this.logger.emit("progress_stop", { id: hookName });
|
|
319
|
+
return items;
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
321
322
|
* Run a specific hookName for plugin x.
|
|
@@ -326,7 +327,7 @@ Falling back on the first item.
|
|
|
326
327
|
parameters
|
|
327
328
|
}) {
|
|
328
329
|
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
329
|
-
|
|
330
|
+
const result = plugins.map((plugin) => {
|
|
330
331
|
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, executeSync_fn).call(this, {
|
|
331
332
|
strategy: "hookFirst",
|
|
332
333
|
hookName,
|
|
@@ -334,6 +335,7 @@ Falling back on the first item.
|
|
|
334
335
|
plugin
|
|
335
336
|
});
|
|
336
337
|
}).filter(Boolean);
|
|
338
|
+
return result;
|
|
337
339
|
}
|
|
338
340
|
/**
|
|
339
341
|
* First non-null result stops and will return it's value.
|
|
@@ -343,9 +345,11 @@ Falling back on the first item.
|
|
|
343
345
|
parameters,
|
|
344
346
|
skipped
|
|
345
347
|
}) {
|
|
346
|
-
const
|
|
348
|
+
const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName).filter((plugin) => {
|
|
347
349
|
return skipped ? skipped.has(plugin) : true;
|
|
348
|
-
})
|
|
350
|
+
});
|
|
351
|
+
this.logger.emit("progress_start", { id: hookName, size: plugins.length });
|
|
352
|
+
const promises = plugins.map((plugin) => {
|
|
349
353
|
return async () => {
|
|
350
354
|
const value = await _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
351
355
|
strategy: "hookFirst",
|
|
@@ -359,7 +363,9 @@ Falling back on the first item.
|
|
|
359
363
|
});
|
|
360
364
|
};
|
|
361
365
|
});
|
|
362
|
-
|
|
366
|
+
const result = await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("first", promises);
|
|
367
|
+
this.logger.emit("progress_stop", { id: hookName });
|
|
368
|
+
return result;
|
|
363
369
|
}
|
|
364
370
|
/**
|
|
365
371
|
* First non-null result stops and will return it's value.
|
|
@@ -370,10 +376,10 @@ Falling back on the first item.
|
|
|
370
376
|
skipped
|
|
371
377
|
}) {
|
|
372
378
|
let parseResult = null;
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
379
|
+
const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName).filter((plugin) => {
|
|
380
|
+
return skipped ? skipped.has(plugin) : true;
|
|
381
|
+
});
|
|
382
|
+
for (const plugin of plugins) {
|
|
377
383
|
parseResult = {
|
|
378
384
|
result: _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, executeSync_fn).call(this, {
|
|
379
385
|
strategy: "hookFirst",
|
|
@@ -383,7 +389,7 @@ Falling back on the first item.
|
|
|
383
389
|
}),
|
|
384
390
|
plugin
|
|
385
391
|
};
|
|
386
|
-
if (_optionalChain([parseResult, 'optionalAccess',
|
|
392
|
+
if (_optionalChain([parseResult, 'optionalAccess', _10 => _10.result]) != null) {
|
|
387
393
|
break;
|
|
388
394
|
}
|
|
389
395
|
}
|
|
@@ -396,7 +402,9 @@ Falling back on the first item.
|
|
|
396
402
|
hookName,
|
|
397
403
|
parameters
|
|
398
404
|
}) {
|
|
399
|
-
const
|
|
405
|
+
const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName);
|
|
406
|
+
this.logger.emit("progress_start", { id: hookName, size: plugins.length });
|
|
407
|
+
const promises = plugins.map((plugin) => {
|
|
400
408
|
return () => _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
401
409
|
strategy: "hookParallel",
|
|
402
410
|
hookName,
|
|
@@ -407,10 +415,11 @@ Falling back on the first item.
|
|
|
407
415
|
const results = await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("parallel", promises);
|
|
408
416
|
results.forEach((result, index) => {
|
|
409
417
|
if (isPromiseRejectedResult(result)) {
|
|
410
|
-
const plugin = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this)[index];
|
|
418
|
+
const plugin = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName)[index];
|
|
411
419
|
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, result.reason, plugin, hookName);
|
|
412
420
|
}
|
|
413
421
|
});
|
|
422
|
+
this.logger.emit("progress_stop", { id: hookName });
|
|
414
423
|
return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
415
424
|
}
|
|
416
425
|
/**
|
|
@@ -422,8 +431,9 @@ Falling back on the first item.
|
|
|
422
431
|
reduce
|
|
423
432
|
}) {
|
|
424
433
|
const [argument0, ...rest] = parameters;
|
|
434
|
+
const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName);
|
|
425
435
|
let promise = Promise.resolve(argument0);
|
|
426
|
-
for (const plugin of
|
|
436
|
+
for (const plugin of plugins) {
|
|
427
437
|
promise = promise.then((arg0) => {
|
|
428
438
|
const value = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
429
439
|
strategy: "hookReduceArg0",
|
|
@@ -440,7 +450,9 @@ Falling back on the first item.
|
|
|
440
450
|
* Chains plugins
|
|
441
451
|
*/
|
|
442
452
|
async hookSeq({ hookName, parameters }) {
|
|
443
|
-
const
|
|
453
|
+
const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName);
|
|
454
|
+
this.logger.emit("progress_start", { id: hookName, size: plugins.length });
|
|
455
|
+
const promises = plugins.map((plugin) => {
|
|
444
456
|
return () => _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
445
457
|
strategy: "hookSeq",
|
|
446
458
|
hookName,
|
|
@@ -448,26 +460,31 @@ Falling back on the first item.
|
|
|
448
460
|
plugin
|
|
449
461
|
});
|
|
450
462
|
});
|
|
451
|
-
|
|
463
|
+
await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("seq", promises);
|
|
464
|
+
this.logger.emit("progress_stop", { id: hookName });
|
|
452
465
|
}
|
|
453
466
|
getPluginsByKey(hookName, pluginKey) {
|
|
454
467
|
const plugins = [...this.plugins];
|
|
455
468
|
const [searchPluginName, searchIdentifier] = pluginKey;
|
|
456
469
|
const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
|
|
457
470
|
const [name, identifier] = item.key;
|
|
458
|
-
const identifierCheck = _optionalChain([identifier, 'optionalAccess',
|
|
471
|
+
const identifierCheck = _optionalChain([identifier, 'optionalAccess', _11 => _11.toString, 'call', _12 => _12()]) === _optionalChain([searchIdentifier, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]);
|
|
459
472
|
const nameCheck = name === searchPluginName;
|
|
460
473
|
if (searchIdentifier) {
|
|
461
474
|
return identifierCheck && nameCheck;
|
|
462
475
|
}
|
|
463
476
|
return nameCheck;
|
|
464
477
|
});
|
|
465
|
-
if (!_optionalChain([pluginByPluginName, 'optionalAccess',
|
|
478
|
+
if (!_optionalChain([pluginByPluginName, 'optionalAccess', _15 => _15.length])) {
|
|
466
479
|
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
467
480
|
if (corePlugin) {
|
|
468
|
-
this.logger.emit("debug",
|
|
481
|
+
this.logger.emit("debug", {
|
|
482
|
+
logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]
|
|
483
|
+
});
|
|
469
484
|
} else {
|
|
470
|
-
this.logger.emit("debug",
|
|
485
|
+
this.logger.emit("debug", {
|
|
486
|
+
logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]
|
|
487
|
+
});
|
|
471
488
|
}
|
|
472
489
|
return corePlugin ? [corePlugin] : [];
|
|
473
490
|
}
|
|
@@ -501,7 +518,7 @@ getSortedPlugins_fn = function(hookName) {
|
|
|
501
518
|
if (hookName) {
|
|
502
519
|
const containsHookName = plugins.some((item) => item[hookName]);
|
|
503
520
|
if (!containsHookName) {
|
|
504
|
-
this.logger.emit("
|
|
521
|
+
this.logger.emit("debug", { logs: [`No hook ${hookName} found`] });
|
|
505
522
|
}
|
|
506
523
|
return plugins.filter((item) => item[hookName]);
|
|
507
524
|
}
|
|
@@ -514,10 +531,10 @@ getSortedPlugins_fn = function(hookName) {
|
|
|
514
531
|
}
|
|
515
532
|
return plugin;
|
|
516
533
|
}).sort((a, b) => {
|
|
517
|
-
if (_optionalChain([b, 'access',
|
|
534
|
+
if (_optionalChain([b, 'access', _16 => _16.pre, 'optionalAccess', _17 => _17.includes, 'call', _18 => _18(a.name)])) {
|
|
518
535
|
return 1;
|
|
519
536
|
}
|
|
520
|
-
if (_optionalChain([b, 'access',
|
|
537
|
+
if (_optionalChain([b, 'access', _19 => _19.post, 'optionalAccess', _20 => _20.includes, 'call', _21 => _21(a.name)])) {
|
|
521
538
|
return -1;
|
|
522
539
|
}
|
|
523
540
|
return 0;
|
|
@@ -527,6 +544,7 @@ addExecutedToCallStack_fn = function(executer) {
|
|
|
527
544
|
if (executer) {
|
|
528
545
|
this.events.emit("executed", executer);
|
|
529
546
|
this.executed.push(executer);
|
|
547
|
+
this.logger.emit("progress", { id: executer.hookName, data: `${executer.plugin.name}` });
|
|
530
548
|
}
|
|
531
549
|
};
|
|
532
550
|
/**
|
|
@@ -548,7 +566,10 @@ execute_fn = function({
|
|
|
548
566
|
return null;
|
|
549
567
|
}
|
|
550
568
|
this.events.emit("execute", { strategy, hookName, parameters, plugin });
|
|
551
|
-
const
|
|
569
|
+
const promise = new Promise((resolve) => {
|
|
570
|
+
resolve(void 0);
|
|
571
|
+
});
|
|
572
|
+
const task = promise.then(() => {
|
|
552
573
|
if (typeof hook === "function") {
|
|
553
574
|
const possiblePromiseResult = hook.apply({ ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, plugin }, parameters);
|
|
554
575
|
if (isPromise(possiblePromiseResult)) {
|
|
@@ -613,13 +634,13 @@ executeSync_fn = function({
|
|
|
613
634
|
}
|
|
614
635
|
};
|
|
615
636
|
catcher_fn = function(cause, plugin, hookName) {
|
|
616
|
-
const text = `${cause.message} (plugin: ${_optionalChain([plugin, 'optionalAccess',
|
|
637
|
+
const text = `${cause.message} (plugin: ${_optionalChain([plugin, 'optionalAccess', _22 => _22.name]) || "unknown"}, hook: ${hookName || "unknown"})`;
|
|
617
638
|
this.logger.emit("error", text, cause);
|
|
618
639
|
this.events.emit("error", cause);
|
|
619
640
|
};
|
|
620
641
|
parse_fn = function(plugin, pluginManager, context) {
|
|
621
642
|
const usedPluginNames = _chunkXCPFG6DOcjs.__privateGet.call(void 0, pluginManager, _usedPluginNames);
|
|
622
|
-
|
|
643
|
+
_chunkL3JJLZ5Qcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
|
|
623
644
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
624
645
|
if (plugin.context && typeof plugin.context === "function") {
|
|
625
646
|
return {
|
|
@@ -645,15 +666,15 @@ function isInputPath(result) {
|
|
|
645
666
|
|
|
646
667
|
// src/build.ts
|
|
647
668
|
async function setup(options) {
|
|
648
|
-
const { config, logger =
|
|
669
|
+
const { config, logger = _chunkLOLEBOMWcjs.createLogger.call(void 0, ) } = options;
|
|
649
670
|
try {
|
|
650
|
-
if (isInputPath(config) && !new (0,
|
|
671
|
+
if (isInputPath(config) && !new (0, _chunkL3JJLZ5Qcjs.URLPath)(config.input.path).isURL) {
|
|
651
672
|
await _fs.read.call(void 0, config.input.path);
|
|
652
673
|
}
|
|
653
674
|
} catch (e) {
|
|
654
675
|
if (isInputPath(config)) {
|
|
655
676
|
throw new Error(
|
|
656
|
-
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${
|
|
677
|
+
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${_chunkLOLEBOMWcjs.p.dim(config.input.path)}`,
|
|
657
678
|
{
|
|
658
679
|
cause: e
|
|
659
680
|
}
|
|
@@ -663,19 +684,7 @@ async function setup(options) {
|
|
|
663
684
|
if (config.output.clean) {
|
|
664
685
|
await _fs.clean.call(void 0, config.output.path);
|
|
665
686
|
}
|
|
666
|
-
|
|
667
|
-
pluginManager.on("executed", (executer) => {
|
|
668
|
-
const { hookName, plugin, output, parameters } = executer;
|
|
669
|
-
const logs = [
|
|
670
|
-
`${_chunkQRIDQ4RGcjs.randomCliColour.call(void 0, plugin.name)} Executing ${hookName}`,
|
|
671
|
-
parameters && `${_chunkQRIDQ4RGcjs.p.bgWhite("Parameters")} ${_chunkQRIDQ4RGcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
|
|
672
|
-
JSON.stringify(parameters, void 0, 2),
|
|
673
|
-
output && `${_chunkQRIDQ4RGcjs.p.bgWhite("Output")} ${_chunkQRIDQ4RGcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
|
|
674
|
-
output
|
|
675
|
-
].filter(Boolean);
|
|
676
|
-
logger.emit("debug", logs);
|
|
677
|
-
});
|
|
678
|
-
return pluginManager;
|
|
687
|
+
return new PluginManager(config, { logger });
|
|
679
688
|
}
|
|
680
689
|
async function build(options) {
|
|
681
690
|
const pluginManager = await setup(options);
|
|
@@ -683,7 +692,8 @@ async function build(options) {
|
|
|
683
692
|
hookName: "buildStart",
|
|
684
693
|
parameters: [options.config]
|
|
685
694
|
});
|
|
686
|
-
const files = await
|
|
695
|
+
const files = await _chunkDCZQYCCOcjs.processFiles.call(void 0, {
|
|
696
|
+
config: options.config,
|
|
687
697
|
dryRun: !options.config.output.write,
|
|
688
698
|
files: pluginManager.fileManager.files,
|
|
689
699
|
logger: pluginManager.logger
|
|
@@ -702,20 +712,16 @@ async function safeBuild(options) {
|
|
|
702
712
|
hookName: "buildStart",
|
|
703
713
|
parameters: [options.config]
|
|
704
714
|
});
|
|
705
|
-
files = await
|
|
715
|
+
files = await _chunkDCZQYCCOcjs.processFiles.call(void 0, {
|
|
716
|
+
config: options.config,
|
|
706
717
|
dryRun: !options.config.output.write,
|
|
707
718
|
files: pluginManager.fileManager.files,
|
|
708
719
|
logger: pluginManager.logger
|
|
709
720
|
});
|
|
710
721
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
711
722
|
} catch (e) {
|
|
712
|
-
const files2 = await _chunkV5THHXXQcjs.processFiles.call(void 0, {
|
|
713
|
-
dryRun: true,
|
|
714
|
-
files: pluginManager.fileManager.files,
|
|
715
|
-
logger: pluginManager.logger
|
|
716
|
-
});
|
|
717
723
|
return {
|
|
718
|
-
files:
|
|
724
|
+
files: [],
|
|
719
725
|
pluginManager,
|
|
720
726
|
error: e
|
|
721
727
|
};
|
|
@@ -1100,9 +1106,9 @@ var _PackageManager = class _PackageManager {
|
|
|
1100
1106
|
location = _url.pathToFileURL.call(void 0, location).href;
|
|
1101
1107
|
}
|
|
1102
1108
|
const module = await Promise.resolve().then(() => _interopRequireWildcard(require(location)));
|
|
1103
|
-
return _nullishCoalesce(_optionalChain([module, 'optionalAccess',
|
|
1109
|
+
return _nullishCoalesce(_optionalChain([module, 'optionalAccess', _23 => _23.default]), () => ( module));
|
|
1104
1110
|
} catch (e) {
|
|
1105
|
-
console.
|
|
1111
|
+
console.error(e);
|
|
1106
1112
|
return void 0;
|
|
1107
1113
|
}
|
|
1108
1114
|
}
|
|
@@ -1204,5 +1210,5 @@ var PackageManager = _PackageManager;
|
|
|
1204
1210
|
|
|
1205
1211
|
|
|
1206
1212
|
|
|
1207
|
-
exports.FileManager =
|
|
1213
|
+
exports.FileManager = _chunkDCZQYCCOcjs.FileManager; exports.Generator = Generator; exports.PackageManager = PackageManager; exports.PluginManager = PluginManager; exports.PromiseManager = PromiseManager; exports.build = build; exports.createPlugin = createPlugin; exports.default = build; exports.defineConfig = defineConfig; exports.isInputPath = isInputPath; exports.safeBuild = safeBuild;
|
|
1208
1214
|
//# sourceMappingURL=index.cjs.map
|