@kubb/core 3.0.0-alpha.0 → 3.0.0-alpha.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/FileManager-BW--rO8q.d.ts +437 -0
- package/dist/FileManager-Bw-FNS3q.d.cts +437 -0
- package/dist/{chunk-XRC6KXC3.cjs → chunk-67C6RBGQ.cjs} +5 -5
- package/dist/{chunk-XRC6KXC3.cjs.map → chunk-67C6RBGQ.cjs.map} +1 -1
- package/dist/{chunk-Y3LLJA4H.cjs → chunk-ADC5UNZ5.cjs} +145 -145
- package/dist/{chunk-Y3LLJA4H.cjs.map → chunk-ADC5UNZ5.cjs.map} +1 -1
- package/dist/{chunk-XRUOSVKX.cjs → chunk-LM2YQC3T.cjs} +12 -12
- package/dist/{chunk-XRUOSVKX.cjs.map → chunk-LM2YQC3T.cjs.map} +1 -1
- package/dist/{chunk-DKW7IBJV.cjs → chunk-PZT4CTBV.cjs} +18 -18
- package/dist/{chunk-DKW7IBJV.cjs.map → chunk-PZT4CTBV.cjs.map} +1 -1
- package/dist/{chunk-LKXUCYWU.cjs → chunk-XCPFG6DO.cjs} +3 -3
- package/dist/chunk-XCPFG6DO.cjs.map +1 -0
- package/dist/{chunk-OPOT6TCT.cjs → chunk-YTSNYMHW.cjs} +28 -28
- package/dist/{chunk-OPOT6TCT.cjs.map → chunk-YTSNYMHW.cjs.map} +1 -1
- package/dist/index.cjs +152 -196
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -465
- package/dist/index.d.ts +10 -465
- package/dist/index.js +11 -55
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +3 -3
- package/dist/mocks.cjs +8 -8
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/transformers.cjs +4 -4
- package/dist/utils.cjs +4 -4
- package/package.json +9 -12
- package/src/PluginManager.ts +10 -19
- package/src/build.ts +3 -52
- package/src/index.ts +0 -3
- package/src/plugin.ts +1 -1
- package/src/types.ts +12 -37
- package/dist/chunk-LKXUCYWU.cjs.map +0 -1
- package/globals.d.ts +0 -49
- package/src/kubb.ts +0 -11
package/dist/index.cjs
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkLM2YQC3Tcjs = require('./chunk-LM2YQC3T.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkADC5UNZ5cjs = require('./chunk-ADC5UNZ5.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkPZT4CTBVcjs = require('./chunk-PZT4CTBV.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
19
|
-
require('./chunk-
|
|
18
|
+
var _chunkYTSNYMHWcjs = require('./chunk-YTSNYMHW.cjs');
|
|
19
|
+
require('./chunk-67C6RBGQ.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -25,24 +25,24 @@ require('./chunk-XRC6KXC3.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkXCPFG6DOcjs = require('./chunk-XCPFG6DO.cjs');
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
|
|
31
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
32
32
|
|
|
33
33
|
// src/build.ts
|
|
34
|
-
|
|
34
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
35
35
|
var _fs = require('@kubb/fs');
|
|
36
36
|
|
|
37
37
|
// src/PluginManager.ts
|
|
38
|
-
|
|
38
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
// src/PromiseManager.ts
|
|
42
|
-
|
|
42
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
43
43
|
|
|
44
44
|
// src/utils/executeStrategies.ts
|
|
45
|
-
|
|
45
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
46
46
|
function hookSeq(promises) {
|
|
47
47
|
return promises.filter(Boolean).reduce(
|
|
48
48
|
(promise, func) => {
|
|
@@ -80,8 +80,8 @@ function hookParallel(promises) {
|
|
|
80
80
|
var _options;
|
|
81
81
|
var PromiseManager = class {
|
|
82
82
|
constructor(options = {}) {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _options, {});
|
|
84
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options, options);
|
|
85
85
|
return this;
|
|
86
86
|
}
|
|
87
87
|
run(strategy, promises) {
|
|
@@ -89,7 +89,7 @@ var PromiseManager = class {
|
|
|
89
89
|
return hookSeq(promises);
|
|
90
90
|
}
|
|
91
91
|
if (strategy === "first") {
|
|
92
|
-
return hookFirst(promises,
|
|
92
|
+
return hookFirst(promises, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options).nullCheck);
|
|
93
93
|
}
|
|
94
94
|
if (strategy === "parallel") {
|
|
95
95
|
return hookParallel(promises);
|
|
@@ -106,7 +106,7 @@ function isPromiseRejectedResult(result) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// src/errors.ts
|
|
109
|
-
|
|
109
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
110
110
|
var Warning = class extends Error {
|
|
111
111
|
constructor(message, options) {
|
|
112
112
|
super(message, { cause: _optionalChain([options, 'optionalAccess', _3 => _3.cause]) });
|
|
@@ -117,11 +117,11 @@ var ValidationPluginError = class extends Error {
|
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
// src/plugin.ts
|
|
120
|
-
|
|
121
|
-
var
|
|
120
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
121
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
122
122
|
|
|
123
123
|
// src/utils/cache.ts
|
|
124
|
-
|
|
124
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
125
125
|
function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
|
|
126
126
|
return {
|
|
127
127
|
set(id, value) {
|
|
@@ -161,7 +161,7 @@ var pluginCore = createPlugin((options) => {
|
|
|
161
161
|
name: "core",
|
|
162
162
|
options,
|
|
163
163
|
key: ["core"],
|
|
164
|
-
|
|
164
|
+
context() {
|
|
165
165
|
return {
|
|
166
166
|
get config() {
|
|
167
167
|
return options.config;
|
|
@@ -188,8 +188,8 @@ var pluginCore = createPlugin((options) => {
|
|
|
188
188
|
};
|
|
189
189
|
},
|
|
190
190
|
resolvePath(baseName) {
|
|
191
|
-
const root =
|
|
192
|
-
return
|
|
191
|
+
const root = _path2.default.resolve(this.config.root, this.config.output.path);
|
|
192
|
+
return _path2.default.resolve(root, baseName);
|
|
193
193
|
},
|
|
194
194
|
resolveName(name) {
|
|
195
195
|
return name;
|
|
@@ -201,12 +201,12 @@ var pluginCore = createPlugin((options) => {
|
|
|
201
201
|
var _core, _usedPluginNames, _promiseManager, _PluginManager_instances, getSortedPlugins_fn, addExecutedToCallStack_fn, execute_fn, executeSync_fn, catcher_fn, parse_fn;
|
|
202
202
|
var PluginManager = class {
|
|
203
203
|
constructor(config, options) {
|
|
204
|
-
|
|
205
|
-
this.events = new (0,
|
|
204
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _PluginManager_instances);
|
|
205
|
+
this.events = new (0, _chunkLM2YQC3Tcjs.EventEmitter)();
|
|
206
206
|
this.executed = [];
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _core);
|
|
208
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _usedPluginNames, {});
|
|
209
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _promiseManager);
|
|
210
210
|
this.resolvePath = (params) => {
|
|
211
211
|
if (params.pluginKey) {
|
|
212
212
|
const paths = this.hookForPluginSync({
|
|
@@ -248,22 +248,22 @@ Falling back on the first item.
|
|
|
248
248
|
`
|
|
249
249
|
]);
|
|
250
250
|
}
|
|
251
|
-
return
|
|
251
|
+
return _chunkPZT4CTBVcjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _8 => _8.at, 'call', _9 => _9(0)]) || params.name);
|
|
252
252
|
}
|
|
253
253
|
const name = this.hookFirstSync({
|
|
254
254
|
hookName: "resolveName",
|
|
255
255
|
parameters: [params.name, params.type]
|
|
256
256
|
}).result;
|
|
257
|
-
return
|
|
257
|
+
return _chunkPZT4CTBVcjs.transformReservedWord.call(void 0, name);
|
|
258
258
|
};
|
|
259
259
|
this.config = config;
|
|
260
260
|
this.logger = options.logger;
|
|
261
|
-
this.queue = new (0,
|
|
262
|
-
this.fileManager = new (0,
|
|
261
|
+
this.queue = new (0, _chunkADC5UNZ5cjs.PQueue)({ concurrency: 1 });
|
|
262
|
+
this.fileManager = new (0, _chunkADC5UNZ5cjs.FileManager)({
|
|
263
263
|
task: options.task,
|
|
264
264
|
queue: this.queue
|
|
265
265
|
});
|
|
266
|
-
|
|
266
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _promiseManager, new PromiseManager({
|
|
267
267
|
nullCheck: (state) => !!_optionalChain([state, 'optionalAccess', _10 => _10.result])
|
|
268
268
|
}));
|
|
269
269
|
const plugins = config.plugins || [];
|
|
@@ -274,11 +274,11 @@ Falling back on the first item.
|
|
|
274
274
|
fileManager: this.fileManager,
|
|
275
275
|
resolvePath: this.resolvePath.bind(this),
|
|
276
276
|
resolveName: this.resolveName.bind(this),
|
|
277
|
-
getPlugins:
|
|
277
|
+
getPlugins: _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).bind(this)
|
|
278
278
|
});
|
|
279
|
-
|
|
280
|
-
this.plugins = [
|
|
281
|
-
return
|
|
279
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _core, _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, parse_fn).call(this, core, this, core.context.call(null)));
|
|
280
|
+
this.plugins = [_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core), ...plugins].map((plugin) => {
|
|
281
|
+
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, parse_fn).call(this, plugin, this, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context);
|
|
282
282
|
});
|
|
283
283
|
return this;
|
|
284
284
|
}
|
|
@@ -318,7 +318,7 @@ Falling back on the first item.
|
|
|
318
318
|
}) {
|
|
319
319
|
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
320
320
|
const promises = plugins.map((plugin) => {
|
|
321
|
-
return
|
|
321
|
+
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
322
322
|
strategy: "hookFirst",
|
|
323
323
|
hookName,
|
|
324
324
|
parameters,
|
|
@@ -337,7 +337,7 @@ Falling back on the first item.
|
|
|
337
337
|
}) {
|
|
338
338
|
const plugins = this.getPluginsByKey(hookName, pluginKey);
|
|
339
339
|
return plugins.map((plugin) => {
|
|
340
|
-
return
|
|
340
|
+
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, executeSync_fn).call(this, {
|
|
341
341
|
strategy: "hookFirst",
|
|
342
342
|
hookName,
|
|
343
343
|
parameters,
|
|
@@ -353,11 +353,11 @@ Falling back on the first item.
|
|
|
353
353
|
parameters,
|
|
354
354
|
skipped
|
|
355
355
|
}) {
|
|
356
|
-
const promises =
|
|
356
|
+
const promises = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this).filter((plugin) => {
|
|
357
357
|
return skipped ? skipped.has(plugin) : true;
|
|
358
358
|
}).map((plugin) => {
|
|
359
359
|
return async () => {
|
|
360
|
-
const value = await
|
|
360
|
+
const value = await _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
361
361
|
strategy: "hookFirst",
|
|
362
362
|
hookName,
|
|
363
363
|
parameters,
|
|
@@ -369,7 +369,7 @@ Falling back on the first item.
|
|
|
369
369
|
});
|
|
370
370
|
};
|
|
371
371
|
});
|
|
372
|
-
return
|
|
372
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("first", promises);
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* First non-null result stops and will return it's value.
|
|
@@ -380,12 +380,12 @@ Falling back on the first item.
|
|
|
380
380
|
skipped
|
|
381
381
|
}) {
|
|
382
382
|
let parseResult = null;
|
|
383
|
-
for (const plugin of
|
|
383
|
+
for (const plugin of _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this)) {
|
|
384
384
|
if (_optionalChain([skipped, 'optionalAccess', _11 => _11.has, 'call', _12 => _12(plugin)])) {
|
|
385
385
|
continue;
|
|
386
386
|
}
|
|
387
387
|
parseResult = {
|
|
388
|
-
result:
|
|
388
|
+
result: _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, executeSync_fn).call(this, {
|
|
389
389
|
strategy: "hookFirst",
|
|
390
390
|
hookName,
|
|
391
391
|
parameters,
|
|
@@ -406,19 +406,19 @@ Falling back on the first item.
|
|
|
406
406
|
hookName,
|
|
407
407
|
parameters
|
|
408
408
|
}) {
|
|
409
|
-
const promises =
|
|
410
|
-
return () =>
|
|
409
|
+
const promises = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this).map((plugin) => {
|
|
410
|
+
return () => _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
411
411
|
strategy: "hookParallel",
|
|
412
412
|
hookName,
|
|
413
413
|
parameters,
|
|
414
414
|
plugin
|
|
415
415
|
});
|
|
416
416
|
});
|
|
417
|
-
const results = await
|
|
417
|
+
const results = await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("parallel", promises);
|
|
418
418
|
results.forEach((result, index) => {
|
|
419
419
|
if (isPromiseRejectedResult(result)) {
|
|
420
|
-
const plugin =
|
|
421
|
-
|
|
420
|
+
const plugin = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this)[index];
|
|
421
|
+
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, result.reason, plugin, hookName);
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
@@ -433,16 +433,16 @@ Falling back on the first item.
|
|
|
433
433
|
}) {
|
|
434
434
|
const [argument0, ...rest] = parameters;
|
|
435
435
|
let promise = Promise.resolve(argument0);
|
|
436
|
-
for (const plugin of
|
|
436
|
+
for (const plugin of _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this)) {
|
|
437
437
|
promise = promise.then((arg0) => {
|
|
438
|
-
const value =
|
|
438
|
+
const value = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
439
439
|
strategy: "hookReduceArg0",
|
|
440
440
|
hookName,
|
|
441
441
|
parameters: [arg0, ...rest],
|
|
442
442
|
plugin
|
|
443
443
|
});
|
|
444
444
|
return value;
|
|
445
|
-
}).then((result) => reduce.call(
|
|
445
|
+
}).then((result) => reduce.call(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, argument0, result, plugin));
|
|
446
446
|
}
|
|
447
447
|
return promise;
|
|
448
448
|
}
|
|
@@ -450,15 +450,15 @@ Falling back on the first item.
|
|
|
450
450
|
* Chains plugins
|
|
451
451
|
*/
|
|
452
452
|
async hookSeq({ hookName, parameters }) {
|
|
453
|
-
const promises =
|
|
454
|
-
return () =>
|
|
453
|
+
const promises = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this).map((plugin) => {
|
|
454
|
+
return () => _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
|
|
455
455
|
strategy: "hookSeq",
|
|
456
456
|
hookName,
|
|
457
457
|
parameters,
|
|
458
458
|
plugin
|
|
459
459
|
});
|
|
460
460
|
});
|
|
461
|
-
return
|
|
461
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("seq", promises);
|
|
462
462
|
}
|
|
463
463
|
getPluginsByKey(hookName, pluginKey) {
|
|
464
464
|
const plugins = [...this.plugins];
|
|
@@ -499,7 +499,7 @@ Falling back on the first item.
|
|
|
499
499
|
});
|
|
500
500
|
}
|
|
501
501
|
static get hooks() {
|
|
502
|
-
return ["buildStart", "resolvePath", "resolveName", "
|
|
502
|
+
return ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
505
|
_core = new WeakMap();
|
|
@@ -509,7 +509,7 @@ _PluginManager_instances = new WeakSet();
|
|
|
509
509
|
getSortedPlugins_fn = function(hookName) {
|
|
510
510
|
const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
|
|
511
511
|
if (hookName) {
|
|
512
|
-
if (this.logger.logLevel ===
|
|
512
|
+
if (this.logger.logLevel === _chunkLM2YQC3Tcjs.LogLevel.info) {
|
|
513
513
|
const containsHookName = plugins.some((item) => item[hookName]);
|
|
514
514
|
if (!containsHookName) {
|
|
515
515
|
this.logger.emit("warning", `No hook ${hookName} found`);
|
|
@@ -562,7 +562,7 @@ execute_fn = function({
|
|
|
562
562
|
this.events.emit("execute", { strategy, hookName, parameters, plugin });
|
|
563
563
|
const task = Promise.resolve().then(() => {
|
|
564
564
|
if (typeof hook === "function") {
|
|
565
|
-
const possiblePromiseResult = hook.apply({ ...
|
|
565
|
+
const possiblePromiseResult = hook.apply({ ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, plugin }, parameters);
|
|
566
566
|
if (isPromise(possiblePromiseResult)) {
|
|
567
567
|
return Promise.resolve(possiblePromiseResult);
|
|
568
568
|
}
|
|
@@ -571,7 +571,7 @@ execute_fn = function({
|
|
|
571
571
|
return hook;
|
|
572
572
|
}).then((result) => {
|
|
573
573
|
output = result;
|
|
574
|
-
|
|
574
|
+
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, addExecutedToCallStack_fn).call(this, {
|
|
575
575
|
parameters,
|
|
576
576
|
output,
|
|
577
577
|
strategy,
|
|
@@ -580,7 +580,7 @@ execute_fn = function({
|
|
|
580
580
|
});
|
|
581
581
|
return result;
|
|
582
582
|
}).catch((e) => {
|
|
583
|
-
|
|
583
|
+
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, e, plugin, hookName);
|
|
584
584
|
return null;
|
|
585
585
|
});
|
|
586
586
|
return task;
|
|
@@ -606,12 +606,12 @@ executeSync_fn = function({
|
|
|
606
606
|
this.events.emit("execute", { strategy, hookName, parameters, plugin });
|
|
607
607
|
try {
|
|
608
608
|
if (typeof hook === "function") {
|
|
609
|
-
const fn = hook.apply({ ...
|
|
609
|
+
const fn = hook.apply({ ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, plugin }, parameters);
|
|
610
610
|
output = fn;
|
|
611
611
|
return fn;
|
|
612
612
|
}
|
|
613
613
|
output = hook;
|
|
614
|
-
|
|
614
|
+
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, addExecutedToCallStack_fn).call(this, {
|
|
615
615
|
parameters,
|
|
616
616
|
output,
|
|
617
617
|
strategy,
|
|
@@ -620,7 +620,7 @@ executeSync_fn = function({
|
|
|
620
620
|
});
|
|
621
621
|
return hook;
|
|
622
622
|
} catch (e) {
|
|
623
|
-
|
|
623
|
+
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, e, plugin, hookName);
|
|
624
624
|
return null;
|
|
625
625
|
}
|
|
626
626
|
};
|
|
@@ -630,20 +630,14 @@ catcher_fn = function(cause, plugin, hookName) {
|
|
|
630
630
|
this.events.emit("error", cause);
|
|
631
631
|
};
|
|
632
632
|
parse_fn = function(plugin, pluginManager, context) {
|
|
633
|
-
const usedPluginNames =
|
|
634
|
-
|
|
633
|
+
const usedPluginNames = _chunkXCPFG6DOcjs.__privateGet.call(void 0, pluginManager, _usedPluginNames);
|
|
634
|
+
_chunkYTSNYMHWcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
|
|
635
635
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
636
|
-
if (
|
|
637
|
-
plugin.transform = function transform(_path, code) {
|
|
638
|
-
return code;
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
if (plugin.api && typeof plugin.api === "function") {
|
|
642
|
-
const api = plugin.api.call(context);
|
|
636
|
+
if (plugin.context && typeof plugin.context === "function") {
|
|
643
637
|
return {
|
|
644
638
|
...plugin,
|
|
645
639
|
key,
|
|
646
|
-
|
|
640
|
+
context: plugin.context.call(context)
|
|
647
641
|
};
|
|
648
642
|
}
|
|
649
643
|
return {
|
|
@@ -653,7 +647,7 @@ parse_fn = function(plugin, pluginManager, context) {
|
|
|
653
647
|
};
|
|
654
648
|
|
|
655
649
|
// src/config.ts
|
|
656
|
-
|
|
650
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
657
651
|
function defineConfig(options) {
|
|
658
652
|
return options;
|
|
659
653
|
}
|
|
@@ -662,20 +656,17 @@ function isInputPath(result) {
|
|
|
662
656
|
}
|
|
663
657
|
|
|
664
658
|
// src/build.ts
|
|
665
|
-
async function transformReducer(_previousCode, result, _plugin) {
|
|
666
|
-
return result;
|
|
667
|
-
}
|
|
668
659
|
async function setup(options) {
|
|
669
|
-
const { config, logger =
|
|
660
|
+
const { config, logger = _chunkLM2YQC3Tcjs.createLogger.call(void 0, { logLevel: _chunkLM2YQC3Tcjs.LogLevel.silent }) } = options;
|
|
670
661
|
let count = 0;
|
|
671
662
|
try {
|
|
672
|
-
if (isInputPath(config) && !new (0,
|
|
663
|
+
if (isInputPath(config) && !new (0, _chunkYTSNYMHWcjs.URLPath)(config.input.path).isURL) {
|
|
673
664
|
await _fs.read.call(void 0, config.input.path);
|
|
674
665
|
}
|
|
675
666
|
} catch (e) {
|
|
676
667
|
if (isInputPath(config)) {
|
|
677
668
|
throw new Error(
|
|
678
|
-
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${
|
|
669
|
+
`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${_chunkLM2YQC3Tcjs.p.dim(config.input.path)}`,
|
|
679
670
|
{
|
|
680
671
|
cause: e
|
|
681
672
|
}
|
|
@@ -687,35 +678,10 @@ async function setup(options) {
|
|
|
687
678
|
}
|
|
688
679
|
const task = async (file) => {
|
|
689
680
|
const { path: path4 } = file;
|
|
690
|
-
|
|
691
|
-
const { result: loadedResult } = await pluginManager.hookFirst({
|
|
692
|
-
hookName: "load",
|
|
693
|
-
parameters: [path4]
|
|
694
|
-
});
|
|
695
|
-
if (loadedResult && isPromise(loadedResult)) {
|
|
696
|
-
source = await loadedResult;
|
|
697
|
-
}
|
|
698
|
-
if (loadedResult && !isPromise(loadedResult)) {
|
|
699
|
-
source = loadedResult;
|
|
700
|
-
}
|
|
681
|
+
const source = await _chunkADC5UNZ5cjs.FileManager.getSource(file);
|
|
701
682
|
if (source) {
|
|
702
|
-
source = await pluginManager.hookReduceArg0({
|
|
703
|
-
hookName: "transform",
|
|
704
|
-
parameters: [path4, source],
|
|
705
|
-
reduce: transformReducer
|
|
706
|
-
});
|
|
707
683
|
if (config.output.write || config.output.write === void 0) {
|
|
708
|
-
|
|
709
|
-
await pluginManager.hookForPlugin({
|
|
710
|
-
pluginKey: _optionalChain([file, 'access', _28 => _28.meta, 'optionalAccess', _29 => _29.pluginKey]),
|
|
711
|
-
hookName: "writeFile",
|
|
712
|
-
parameters: [path4, source]
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
await pluginManager.hookFirst({
|
|
716
|
-
hookName: "writeFile",
|
|
717
|
-
parameters: [path4, source]
|
|
718
|
-
});
|
|
684
|
+
await pluginManager.fileManager.write(path4, source, { sanity: false });
|
|
719
685
|
}
|
|
720
686
|
}
|
|
721
687
|
return {
|
|
@@ -724,18 +690,8 @@ async function setup(options) {
|
|
|
724
690
|
};
|
|
725
691
|
};
|
|
726
692
|
const pluginManager = new PluginManager(config, { logger, task });
|
|
727
|
-
pluginManager.on("execute", (executer) => {
|
|
728
|
-
const { hookName, parameters, plugin } = executer;
|
|
729
|
-
if (hookName === "writeFile") {
|
|
730
|
-
const [code] = parameters;
|
|
731
|
-
logger.emit("debug", [`PluginKey ${_chunkXRUOSVKXcjs.p.dim(JSON.stringify(plugin.key))}
|
|
732
|
-
with source
|
|
733
|
-
|
|
734
|
-
${code}`]);
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
693
|
pluginManager.queue.on("add", () => {
|
|
738
|
-
if (logger.logLevel !==
|
|
694
|
+
if (logger.logLevel !== _chunkLM2YQC3Tcjs.LogLevel.info) {
|
|
739
695
|
return;
|
|
740
696
|
}
|
|
741
697
|
if (count === 0) {
|
|
@@ -743,31 +699,31 @@ ${code}`]);
|
|
|
743
699
|
}
|
|
744
700
|
});
|
|
745
701
|
pluginManager.queue.on("active", () => {
|
|
746
|
-
if (logger.logLevel !==
|
|
702
|
+
if (logger.logLevel !== _chunkLM2YQC3Tcjs.LogLevel.info) {
|
|
747
703
|
return;
|
|
748
704
|
}
|
|
749
705
|
if (logger.spinner && pluginManager.queue.size > 0) {
|
|
750
706
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
751
|
-
logger.spinner.suffixText =
|
|
707
|
+
logger.spinner.suffixText = _chunkLM2YQC3Tcjs.p.dim(text);
|
|
752
708
|
}
|
|
753
709
|
++count;
|
|
754
710
|
});
|
|
755
711
|
pluginManager.queue.on("completed", () => {
|
|
756
|
-
if (logger.logLevel !==
|
|
712
|
+
if (logger.logLevel !== _chunkLM2YQC3Tcjs.LogLevel.info) {
|
|
757
713
|
return;
|
|
758
714
|
}
|
|
759
715
|
if (logger.spinner) {
|
|
760
716
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
761
|
-
logger.spinner.suffixText =
|
|
717
|
+
logger.spinner.suffixText = _chunkLM2YQC3Tcjs.p.dim(text);
|
|
762
718
|
}
|
|
763
719
|
});
|
|
764
720
|
pluginManager.on("executed", (executer) => {
|
|
765
721
|
const { hookName, plugin, output, parameters } = executer;
|
|
766
722
|
const logs = [
|
|
767
|
-
`${
|
|
768
|
-
parameters && `${
|
|
723
|
+
`${_chunkLM2YQC3Tcjs.randomCliColour.call(void 0, plugin.name)} Executing ${hookName}`,
|
|
724
|
+
parameters && `${_chunkLM2YQC3Tcjs.p.bgWhite("Parameters")} ${_chunkLM2YQC3Tcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
|
|
769
725
|
JSON.stringify(parameters, void 0, 2),
|
|
770
|
-
output && `${
|
|
726
|
+
output && `${_chunkLM2YQC3Tcjs.p.bgWhite("Output")} ${_chunkLM2YQC3Tcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
|
|
771
727
|
output
|
|
772
728
|
].filter(Boolean);
|
|
773
729
|
logger.emit("debug", logs);
|
|
@@ -782,13 +738,13 @@ async function build(options) {
|
|
|
782
738
|
parameters: [options.config]
|
|
783
739
|
});
|
|
784
740
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
785
|
-
if (logger.logLevel ===
|
|
741
|
+
if (logger.logLevel === _chunkLM2YQC3Tcjs.LogLevel.info) {
|
|
786
742
|
logger.emit("end", "\u{1F4BE} Writing completed");
|
|
787
743
|
}
|
|
788
744
|
const files = await Promise.all(
|
|
789
745
|
fileManager.files.map(async (file) => ({
|
|
790
746
|
...file,
|
|
791
|
-
source: await
|
|
747
|
+
source: await _chunkADC5UNZ5cjs.FileManager.getSource(file)
|
|
792
748
|
}))
|
|
793
749
|
);
|
|
794
750
|
return {
|
|
@@ -805,14 +761,14 @@ async function safeBuild(options) {
|
|
|
805
761
|
parameters: [options.config]
|
|
806
762
|
});
|
|
807
763
|
await pluginManager.hookParallel({ hookName: "buildEnd" });
|
|
808
|
-
if (logger.logLevel ===
|
|
764
|
+
if (logger.logLevel === _chunkLM2YQC3Tcjs.LogLevel.info) {
|
|
809
765
|
logger.emit("end", "\u{1F4BE} Writing completed");
|
|
810
766
|
}
|
|
811
767
|
} catch (e) {
|
|
812
768
|
const files2 = await Promise.all(
|
|
813
769
|
fileManager.files.map(async (file) => ({
|
|
814
770
|
...file,
|
|
815
|
-
source: await
|
|
771
|
+
source: await _chunkADC5UNZ5cjs.FileManager.getSource(file)
|
|
816
772
|
}))
|
|
817
773
|
);
|
|
818
774
|
return {
|
|
@@ -824,7 +780,7 @@ async function safeBuild(options) {
|
|
|
824
780
|
const files = await Promise.all(
|
|
825
781
|
fileManager.files.map(async (file) => ({
|
|
826
782
|
...file,
|
|
827
|
-
source: await
|
|
783
|
+
source: await _chunkADC5UNZ5cjs.FileManager.getSource(file)
|
|
828
784
|
}))
|
|
829
785
|
);
|
|
830
786
|
return {
|
|
@@ -834,103 +790,103 @@ async function safeBuild(options) {
|
|
|
834
790
|
}
|
|
835
791
|
|
|
836
792
|
// src/Generator.ts
|
|
837
|
-
|
|
793
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
838
794
|
var _options2, _context;
|
|
839
795
|
var Generator = class {
|
|
840
796
|
constructor(options, context) {
|
|
841
|
-
|
|
842
|
-
|
|
797
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _options2, {});
|
|
798
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _context, {});
|
|
843
799
|
if (context) {
|
|
844
|
-
|
|
800
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _context, context);
|
|
845
801
|
}
|
|
846
802
|
if (options) {
|
|
847
|
-
|
|
803
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options2, options);
|
|
848
804
|
}
|
|
849
805
|
return this;
|
|
850
806
|
}
|
|
851
807
|
get options() {
|
|
852
|
-
return
|
|
808
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options2);
|
|
853
809
|
}
|
|
854
810
|
get context() {
|
|
855
|
-
return
|
|
811
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _context);
|
|
856
812
|
}
|
|
857
813
|
set options(options) {
|
|
858
|
-
|
|
814
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options2, { ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options2), ...options });
|
|
859
815
|
}
|
|
860
816
|
};
|
|
861
817
|
_options2 = new WeakMap();
|
|
862
818
|
_context = new WeakMap();
|
|
863
819
|
|
|
864
820
|
// src/PackageManager.ts
|
|
865
|
-
|
|
821
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
866
822
|
var _module = require('module'); var _module2 = _interopRequireDefault(_module);
|
|
867
823
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
868
824
|
var _url = require('url');
|
|
869
825
|
|
|
870
826
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
871
|
-
|
|
827
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
872
828
|
|
|
873
829
|
|
|
874
830
|
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
875
|
-
|
|
831
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
876
832
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
877
833
|
|
|
878
834
|
var _fs3 = require('fs'); var _fs4 = _interopRequireDefault(_fs3);
|
|
879
835
|
|
|
880
836
|
|
|
881
837
|
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
882
|
-
|
|
838
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
883
839
|
|
|
884
840
|
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
885
|
-
|
|
841
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
886
842
|
|
|
887
843
|
// ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
|
|
888
|
-
|
|
844
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
889
845
|
var Node = class {
|
|
890
846
|
constructor(value) {
|
|
891
|
-
|
|
892
|
-
|
|
847
|
+
_chunkXCPFG6DOcjs.__publicField.call(void 0, this, "value");
|
|
848
|
+
_chunkXCPFG6DOcjs.__publicField.call(void 0, this, "next");
|
|
893
849
|
this.value = value;
|
|
894
850
|
}
|
|
895
851
|
};
|
|
896
852
|
var _head, _tail, _size;
|
|
897
853
|
var Queue = class {
|
|
898
854
|
constructor() {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
855
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _head);
|
|
856
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _tail);
|
|
857
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _size);
|
|
902
858
|
this.clear();
|
|
903
859
|
}
|
|
904
860
|
enqueue(value) {
|
|
905
861
|
const node = new Node(value);
|
|
906
|
-
if (
|
|
907
|
-
|
|
908
|
-
|
|
862
|
+
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head)) {
|
|
863
|
+
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _tail).next = node;
|
|
864
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _tail, node);
|
|
909
865
|
} else {
|
|
910
|
-
|
|
911
|
-
|
|
866
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _head, node);
|
|
867
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _tail, node);
|
|
912
868
|
}
|
|
913
|
-
|
|
869
|
+
_chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _size)._++;
|
|
914
870
|
}
|
|
915
871
|
dequeue() {
|
|
916
|
-
const current =
|
|
872
|
+
const current = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head);
|
|
917
873
|
if (!current) {
|
|
918
874
|
return;
|
|
919
875
|
}
|
|
920
|
-
|
|
921
|
-
|
|
876
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _head, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head).next);
|
|
877
|
+
_chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _size)._--;
|
|
922
878
|
return current.value;
|
|
923
879
|
}
|
|
924
880
|
clear() {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
881
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _head, void 0);
|
|
882
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _tail, void 0);
|
|
883
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _size, 0);
|
|
928
884
|
}
|
|
929
885
|
get size() {
|
|
930
|
-
return
|
|
886
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _size);
|
|
931
887
|
}
|
|
932
888
|
*[Symbol.iterator]() {
|
|
933
|
-
let current =
|
|
889
|
+
let current = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head);
|
|
934
890
|
while (current) {
|
|
935
891
|
yield current.value;
|
|
936
892
|
current = current.next;
|
|
@@ -1049,7 +1005,7 @@ async function locatePath(paths, {
|
|
|
1049
1005
|
const statFunction = allowSymlinks ? _fs3.promises.stat : _fs3.promises.lstat;
|
|
1050
1006
|
return pLocate(paths, async (path_) => {
|
|
1051
1007
|
try {
|
|
1052
|
-
const stat = await statFunction(
|
|
1008
|
+
const stat = await statFunction(_path2.default.resolve(cwd, path_));
|
|
1053
1009
|
return matchType(type, stat);
|
|
1054
1010
|
} catch (e3) {
|
|
1055
1011
|
return false;
|
|
@@ -1066,7 +1022,7 @@ function locatePathSync(paths, {
|
|
|
1066
1022
|
const statFunction = allowSymlinks ? _fs4.default.statSync : _fs4.default.lstatSync;
|
|
1067
1023
|
for (const path_ of paths) {
|
|
1068
1024
|
try {
|
|
1069
|
-
const stat = statFunction(
|
|
1025
|
+
const stat = statFunction(_path2.default.resolve(cwd, path_), {
|
|
1070
1026
|
throwIfNoEntry: false
|
|
1071
1027
|
});
|
|
1072
1028
|
if (!stat) {
|
|
@@ -1081,22 +1037,22 @@ function locatePathSync(paths, {
|
|
|
1081
1037
|
}
|
|
1082
1038
|
|
|
1083
1039
|
// ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
|
|
1084
|
-
|
|
1040
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
1085
1041
|
|
|
1086
1042
|
function toPath2(urlOrPath) {
|
|
1087
1043
|
return urlOrPath instanceof URL ? _url.fileURLToPath.call(void 0, urlOrPath) : urlOrPath;
|
|
1088
1044
|
}
|
|
1089
1045
|
|
|
1090
1046
|
// ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
1091
|
-
|
|
1047
|
+
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
1092
1048
|
|
|
1093
1049
|
|
|
1094
1050
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
1095
1051
|
var findUpStop = Symbol("findUpStop");
|
|
1096
1052
|
async function findUpMultiple(name, options = {}) {
|
|
1097
|
-
let directory =
|
|
1098
|
-
const { root } =
|
|
1099
|
-
const stopAt =
|
|
1053
|
+
let directory = _path2.default.resolve(_nullishCoalesce(toPath2(options.cwd), () => ( "")));
|
|
1054
|
+
const { root } = _path2.default.parse(directory);
|
|
1055
|
+
const stopAt = _path2.default.resolve(directory, toPath2(_nullishCoalesce(options.stopAt, () => ( root))));
|
|
1100
1056
|
const limit = _nullishCoalesce(options.limit, () => ( Number.POSITIVE_INFINITY));
|
|
1101
1057
|
const paths = [name].flat();
|
|
1102
1058
|
const runMatcher = async (locateOptions) => {
|
|
@@ -1116,19 +1072,19 @@ async function findUpMultiple(name, options = {}) {
|
|
|
1116
1072
|
break;
|
|
1117
1073
|
}
|
|
1118
1074
|
if (foundPath) {
|
|
1119
|
-
matches.push(
|
|
1075
|
+
matches.push(_path2.default.resolve(directory, foundPath));
|
|
1120
1076
|
}
|
|
1121
1077
|
if (directory === stopAt || matches.length >= limit) {
|
|
1122
1078
|
break;
|
|
1123
1079
|
}
|
|
1124
|
-
directory =
|
|
1080
|
+
directory = _path2.default.dirname(directory);
|
|
1125
1081
|
}
|
|
1126
1082
|
return matches;
|
|
1127
1083
|
}
|
|
1128
1084
|
function findUpMultipleSync(name, options = {}) {
|
|
1129
|
-
let directory =
|
|
1130
|
-
const { root } =
|
|
1131
|
-
const stopAt =
|
|
1085
|
+
let directory = _path2.default.resolve(_nullishCoalesce(toPath2(options.cwd), () => ( "")));
|
|
1086
|
+
const { root } = _path2.default.parse(directory);
|
|
1087
|
+
const stopAt = _path2.default.resolve(directory, _nullishCoalesce(toPath2(options.stopAt), () => ( root)));
|
|
1132
1088
|
const limit = _nullishCoalesce(options.limit, () => ( Number.POSITIVE_INFINITY));
|
|
1133
1089
|
const paths = [name].flat();
|
|
1134
1090
|
const runMatcher = (locateOptions) => {
|
|
@@ -1148,12 +1104,12 @@ function findUpMultipleSync(name, options = {}) {
|
|
|
1148
1104
|
break;
|
|
1149
1105
|
}
|
|
1150
1106
|
if (foundPath) {
|
|
1151
|
-
matches.push(
|
|
1107
|
+
matches.push(_path2.default.resolve(directory, foundPath));
|
|
1152
1108
|
}
|
|
1153
1109
|
if (directory === stopAt || matches.length >= limit) {
|
|
1154
1110
|
break;
|
|
1155
1111
|
}
|
|
1156
|
-
directory =
|
|
1112
|
+
directory = _path2.default.dirname(directory);
|
|
1157
1113
|
}
|
|
1158
1114
|
return matches;
|
|
1159
1115
|
}
|
|
@@ -1172,30 +1128,30 @@ var _semver = require('semver');
|
|
|
1172
1128
|
var _cache, _cwd, _SLASHES, _PackageManager_instances, match_fn;
|
|
1173
1129
|
var _PackageManager = class _PackageManager {
|
|
1174
1130
|
constructor(workspace) {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1131
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _PackageManager_instances);
|
|
1132
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _cwd);
|
|
1133
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _SLASHES, /* @__PURE__ */ new Set(["/", "\\"]));
|
|
1178
1134
|
if (workspace) {
|
|
1179
|
-
|
|
1135
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _cwd, workspace);
|
|
1180
1136
|
}
|
|
1181
1137
|
return this;
|
|
1182
1138
|
}
|
|
1183
1139
|
set workspace(workspace) {
|
|
1184
|
-
|
|
1140
|
+
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _cwd, workspace);
|
|
1185
1141
|
}
|
|
1186
1142
|
get workspace() {
|
|
1187
|
-
return
|
|
1143
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd);
|
|
1188
1144
|
}
|
|
1189
1145
|
normalizeDirectory(directory) {
|
|
1190
|
-
if (!
|
|
1146
|
+
if (!_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _SLASHES).has(directory[directory.length - 1])) {
|
|
1191
1147
|
return `${directory}/`;
|
|
1192
1148
|
}
|
|
1193
1149
|
return directory;
|
|
1194
1150
|
}
|
|
1195
1151
|
getLocation(path4) {
|
|
1196
1152
|
let location = path4;
|
|
1197
|
-
if (
|
|
1198
|
-
const require2 = _module2.default.createRequire(this.normalizeDirectory(
|
|
1153
|
+
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)) {
|
|
1154
|
+
const require2 = _module2.default.createRequire(this.normalizeDirectory(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)));
|
|
1199
1155
|
location = require2.resolve(path4);
|
|
1200
1156
|
}
|
|
1201
1157
|
return location;
|
|
@@ -1207,7 +1163,7 @@ var _PackageManager = class _PackageManager {
|
|
|
1207
1163
|
location = _url.pathToFileURL.call(void 0, location).href;
|
|
1208
1164
|
}
|
|
1209
1165
|
const module = await Promise.resolve().then(() => _interopRequireWildcard(require(location)));
|
|
1210
|
-
return _nullishCoalesce(_optionalChain([module, 'optionalAccess',
|
|
1166
|
+
return _nullishCoalesce(_optionalChain([module, 'optionalAccess', _26 => _26.default]), () => ( module));
|
|
1211
1167
|
} catch (e) {
|
|
1212
1168
|
console.log(e);
|
|
1213
1169
|
return void 0;
|
|
@@ -1215,7 +1171,7 @@ var _PackageManager = class _PackageManager {
|
|
|
1215
1171
|
}
|
|
1216
1172
|
async getPackageJSON() {
|
|
1217
1173
|
const pkgPath = await findUp(["package.json"], {
|
|
1218
|
-
cwd:
|
|
1174
|
+
cwd: _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)
|
|
1219
1175
|
});
|
|
1220
1176
|
if (!pkgPath) {
|
|
1221
1177
|
return void 0;
|
|
@@ -1225,7 +1181,7 @@ var _PackageManager = class _PackageManager {
|
|
|
1225
1181
|
}
|
|
1226
1182
|
getPackageJSONSync() {
|
|
1227
1183
|
const pkgPath = findUpSync(["package.json"], {
|
|
1228
|
-
cwd:
|
|
1184
|
+
cwd: _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)
|
|
1229
1185
|
});
|
|
1230
1186
|
if (!pkgPath) {
|
|
1231
1187
|
return void 0;
|
|
@@ -1234,27 +1190,27 @@ var _PackageManager = class _PackageManager {
|
|
|
1234
1190
|
return JSON.parse(json);
|
|
1235
1191
|
}
|
|
1236
1192
|
static setVersion(dependency, version) {
|
|
1237
|
-
|
|
1193
|
+
_chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency] = version;
|
|
1238
1194
|
}
|
|
1239
1195
|
async getVersion(dependency) {
|
|
1240
|
-
if (typeof dependency === "string" &&
|
|
1241
|
-
return
|
|
1196
|
+
if (typeof dependency === "string" && _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency]) {
|
|
1197
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency];
|
|
1242
1198
|
}
|
|
1243
1199
|
const packageJSON = await this.getPackageJSON();
|
|
1244
1200
|
if (!packageJSON) {
|
|
1245
1201
|
return void 0;
|
|
1246
1202
|
}
|
|
1247
|
-
return
|
|
1203
|
+
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PackageManager_instances, match_fn).call(this, packageJSON, dependency);
|
|
1248
1204
|
}
|
|
1249
1205
|
getVersionSync(dependency) {
|
|
1250
|
-
if (typeof dependency === "string" &&
|
|
1251
|
-
return
|
|
1206
|
+
if (typeof dependency === "string" && _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency]) {
|
|
1207
|
+
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency];
|
|
1252
1208
|
}
|
|
1253
1209
|
const packageJSON = this.getPackageJSONSync();
|
|
1254
1210
|
if (!packageJSON) {
|
|
1255
1211
|
return void 0;
|
|
1256
1212
|
}
|
|
1257
|
-
return
|
|
1213
|
+
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PackageManager_instances, match_fn).call(this, packageJSON, dependency);
|
|
1258
1214
|
}
|
|
1259
1215
|
async isValid(dependency, version) {
|
|
1260
1216
|
const packageVersion = await this.getVersion(dependency);
|
|
@@ -1297,7 +1253,7 @@ match_fn = function(packageJSON, dependency) {
|
|
|
1297
1253
|
const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency));
|
|
1298
1254
|
return matchedDependency ? dependencies[matchedDependency] : void 0;
|
|
1299
1255
|
};
|
|
1300
|
-
|
|
1256
|
+
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, _PackageManager, _cache, {});
|
|
1301
1257
|
var PackageManager = _PackageManager;
|
|
1302
1258
|
|
|
1303
1259
|
|
|
@@ -1312,5 +1268,5 @@ var PackageManager = _PackageManager;
|
|
|
1312
1268
|
|
|
1313
1269
|
|
|
1314
1270
|
|
|
1315
|
-
exports.FileManager =
|
|
1271
|
+
exports.FileManager = _chunkADC5UNZ5cjs.FileManager; exports.Generator = Generator; exports.PackageManager = PackageManager; exports.PluginManager = PluginManager; exports.PromiseManager = PromiseManager; exports.Warning = Warning; exports.build = build; exports.createPlugin = createPlugin; exports.default = build; exports.defineConfig = defineConfig; exports.isInputPath = isInputPath; exports.safeBuild = safeBuild;
|
|
1316
1272
|
//# sourceMappingURL=index.cjs.map
|