@kubb/core 3.0.0-alpha.10 → 3.0.0-alpha.11
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/chunk-2EU7DMPM.js +2 -3
- package/dist/chunk-2EU7DMPM.js.map +1 -1
- package/dist/chunk-4X5FFJPJ.js +8 -13
- package/dist/chunk-4X5FFJPJ.js.map +1 -1
- package/dist/{chunk-NB4JMN75.cjs → chunk-52WA2JF5.cjs} +130 -142
- package/dist/chunk-52WA2JF5.cjs.map +1 -0
- package/dist/{chunk-SEH6NUCX.cjs → chunk-ADFKVVPE.cjs} +10 -10
- package/dist/chunk-ADFKVVPE.cjs.map +1 -0
- package/dist/{chunk-MU3CBCQT.js → chunk-E6CN2CZC.js} +12 -27
- package/dist/chunk-E6CN2CZC.js.map +1 -0
- package/dist/chunk-HBQM723K.js +12 -26
- package/dist/chunk-HBQM723K.js.map +1 -1
- package/dist/{chunk-A6PCLWEY.cjs → chunk-HMCSWG5L.cjs} +25 -26
- package/dist/chunk-HMCSWG5L.cjs.map +1 -0
- package/dist/chunk-L6YLVCKM.js +14 -49
- package/dist/chunk-L6YLVCKM.js.map +1 -1
- package/dist/{chunk-5E2I6KH4.cjs → chunk-PJLUPV3P.cjs} +54 -37
- package/dist/chunk-PJLUPV3P.cjs.map +1 -0
- package/dist/{chunk-DID47EQD.cjs → chunk-TTDCUWK7.cjs} +6 -7
- package/dist/chunk-TTDCUWK7.cjs.map +1 -0
- package/dist/{chunk-M7NLNCSM.cjs → chunk-YEVCYV36.cjs} +33 -36
- package/dist/chunk-YEVCYV36.cjs.map +1 -0
- package/dist/index.cjs +138 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -47
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +25 -14
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +3 -13
- package/dist/logger.js.map +1 -1
- package/dist/mocks.cjs +13 -18
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.js +5 -12
- package/dist/mocks.js.map +1 -1
- package/dist/{prompt-DVQN7JTN.cjs → prompt-L5KFKY73.cjs} +89 -89
- package/dist/prompt-L5KFKY73.cjs.map +1 -0
- package/dist/prompt-WQQUN22Z.js +8 -13
- package/dist/prompt-WQQUN22Z.js.map +1 -1
- package/dist/transformers.cjs +62 -52
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +9 -37
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +65 -34
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +3 -33
- package/dist/utils.js.map +1 -1
- package/package.json +7 -7
- package/src/logger.ts +3 -3
- package/dist/chunk-5E2I6KH4.cjs.map +0 -1
- package/dist/chunk-A6PCLWEY.cjs.map +0 -1
- package/dist/chunk-DID47EQD.cjs.map +0 -1
- package/dist/chunk-M7NLNCSM.cjs.map +0 -1
- package/dist/chunk-MU3CBCQT.js.map +0 -1
- package/dist/chunk-NB4JMN75.cjs.map +0 -1
- package/dist/chunk-SEH6NUCX.cjs.map +0 -1
- package/dist/prompt-DVQN7JTN.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var chunkTTDCUWK7_cjs = require('./chunk-TTDCUWK7.cjs');
|
|
6
|
+
var chunkYEVCYV36_cjs = require('./chunk-YEVCYV36.cjs');
|
|
7
|
+
var chunk52WA2JF5_cjs = require('./chunk-52WA2JF5.cjs');
|
|
8
|
+
require('./chunk-HMCSWG5L.cjs');
|
|
9
|
+
require('./chunk-PJLUPV3P.cjs');
|
|
10
|
+
var chunkADFKVVPE_cjs = require('./chunk-ADFKVVPE.cjs');
|
|
11
|
+
var fs = require('@kubb/fs');
|
|
12
|
+
var path3 = require('path');
|
|
13
|
+
var mod = require('module');
|
|
14
|
+
var os = require('os');
|
|
15
|
+
var url = require('url');
|
|
16
|
+
var process = require('process');
|
|
17
|
+
var fs$1 = require('fs');
|
|
18
|
+
var semver = require('semver');
|
|
5
19
|
|
|
20
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
21
|
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _chunkNB4JMN75cjs = require('./chunk-NB4JMN75.cjs');
|
|
14
|
-
require('./chunk-A6PCLWEY.cjs');
|
|
15
|
-
require('./chunk-5E2I6KH4.cjs');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkSEH6NUCXcjs = require('./chunk-SEH6NUCX.cjs');
|
|
22
|
+
var path3__default = /*#__PURE__*/_interopDefault(path3);
|
|
23
|
+
var mod__default = /*#__PURE__*/_interopDefault(mod);
|
|
24
|
+
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
25
|
+
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
26
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs$1);
|
|
19
27
|
|
|
20
28
|
// src/index.ts
|
|
21
|
-
|
|
29
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
22
30
|
|
|
23
31
|
// src/build.ts
|
|
24
|
-
|
|
25
|
-
var _fs = require('@kubb/fs');
|
|
32
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
26
33
|
|
|
27
34
|
// src/PluginManager.ts
|
|
28
|
-
|
|
35
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
29
36
|
|
|
30
37
|
// src/PromiseManager.ts
|
|
31
|
-
|
|
38
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
32
39
|
|
|
33
40
|
// src/utils/executeStrategies.ts
|
|
34
|
-
|
|
41
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
35
42
|
function hookSeq(promises) {
|
|
36
43
|
return promises.filter(Boolean).reduce(
|
|
37
44
|
(promise, func) => {
|
|
@@ -86,23 +93,22 @@ var PromiseManager = class {
|
|
|
86
93
|
}
|
|
87
94
|
};
|
|
88
95
|
function isPromise(result) {
|
|
89
|
-
return !!result && typeof
|
|
96
|
+
return !!result && typeof result?.then === "function";
|
|
90
97
|
}
|
|
91
98
|
function isPromiseRejectedResult(result) {
|
|
92
99
|
return result.status === "rejected";
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
// src/errors.ts
|
|
96
|
-
|
|
103
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
97
104
|
var ValidationPluginError = class extends Error {
|
|
98
105
|
};
|
|
99
106
|
|
|
100
107
|
// src/plugin.ts
|
|
101
|
-
|
|
102
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
108
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
103
109
|
|
|
104
110
|
// src/utils/cache.ts
|
|
105
|
-
|
|
111
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
106
112
|
function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
|
|
107
113
|
return {
|
|
108
114
|
set(id, value) {
|
|
@@ -169,8 +175,8 @@ var pluginCore = createPlugin((options) => {
|
|
|
169
175
|
};
|
|
170
176
|
},
|
|
171
177
|
resolvePath(baseName) {
|
|
172
|
-
const root =
|
|
173
|
-
return
|
|
178
|
+
const root = path3__default.default.resolve(options.config.root, options.config.output.path);
|
|
179
|
+
return path3__default.default.resolve(root, baseName);
|
|
174
180
|
},
|
|
175
181
|
resolveName(name) {
|
|
176
182
|
return name;
|
|
@@ -179,24 +185,24 @@ var pluginCore = createPlugin((options) => {
|
|
|
179
185
|
});
|
|
180
186
|
|
|
181
187
|
// src/PluginManager.ts
|
|
182
|
-
var PluginManager =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
var PluginManager = class {
|
|
189
|
+
plugins;
|
|
190
|
+
fileManager;
|
|
191
|
+
events = new chunkYEVCYV36_cjs.EventEmitter();
|
|
192
|
+
config;
|
|
193
|
+
executed = [];
|
|
194
|
+
logger;
|
|
195
|
+
options;
|
|
190
196
|
#core;
|
|
191
197
|
#usedPluginNames = {};
|
|
192
198
|
#promiseManager;
|
|
193
|
-
constructor(config, options) {
|
|
199
|
+
constructor(config, options) {
|
|
194
200
|
this.config = config;
|
|
195
201
|
this.options = options;
|
|
196
202
|
this.logger = options.logger;
|
|
197
|
-
this.fileManager = new
|
|
203
|
+
this.fileManager = new chunk52WA2JF5_cjs.FileManager();
|
|
198
204
|
this.#promiseManager = new PromiseManager({
|
|
199
|
-
nullCheck: (state) => !!
|
|
205
|
+
nullCheck: (state) => !!state?.result
|
|
200
206
|
});
|
|
201
207
|
const plugins = config.plugins || [];
|
|
202
208
|
const core = pluginCore({
|
|
@@ -229,7 +235,7 @@ var PluginManager = (_class = class {
|
|
|
229
235
|
sources: []
|
|
230
236
|
};
|
|
231
237
|
}
|
|
232
|
-
|
|
238
|
+
resolvePath = (params) => {
|
|
233
239
|
if (params.pluginKey) {
|
|
234
240
|
const paths = this.hookForPluginSync({
|
|
235
241
|
pluginKey: params.pluginKey,
|
|
@@ -237,7 +243,7 @@ var PluginManager = (_class = class {
|
|
|
237
243
|
parameters: [params.baseName, params.mode, params.options],
|
|
238
244
|
message: `Resolving path '${params.baseName}'`
|
|
239
245
|
});
|
|
240
|
-
if (paths &&
|
|
246
|
+
if (paths && paths?.length > 1) {
|
|
241
247
|
this.logger.emit("debug", {
|
|
242
248
|
date: /* @__PURE__ */ new Date(),
|
|
243
249
|
logs: [
|
|
@@ -250,16 +256,16 @@ Falling back on the first item.
|
|
|
250
256
|
]
|
|
251
257
|
});
|
|
252
258
|
}
|
|
253
|
-
return
|
|
259
|
+
return paths?.at(0);
|
|
254
260
|
}
|
|
255
261
|
return this.hookFirstSync({
|
|
256
262
|
hookName: "resolvePath",
|
|
257
263
|
parameters: [params.baseName, params.mode, params.options],
|
|
258
264
|
message: `Resolving path '${params.baseName}'`
|
|
259
265
|
}).result;
|
|
260
|
-
}
|
|
266
|
+
};
|
|
261
267
|
//TODO refactor by using the order of plugins and the cache of the fileManager instead of guessing and recreating the name/path
|
|
262
|
-
|
|
268
|
+
resolveName = (params) => {
|
|
263
269
|
if (params.pluginKey) {
|
|
264
270
|
const names = this.hookForPluginSync({
|
|
265
271
|
pluginKey: params.pluginKey,
|
|
@@ -267,7 +273,7 @@ Falling back on the first item.
|
|
|
267
273
|
parameters: [params.name, params.type],
|
|
268
274
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
269
275
|
});
|
|
270
|
-
if (names &&
|
|
276
|
+
if (names && names?.length > 1) {
|
|
271
277
|
this.logger.emit("debug", {
|
|
272
278
|
date: /* @__PURE__ */ new Date(),
|
|
273
279
|
logs: [
|
|
@@ -280,15 +286,15 @@ Falling back on the first item.
|
|
|
280
286
|
]
|
|
281
287
|
});
|
|
282
288
|
}
|
|
283
|
-
return
|
|
289
|
+
return chunkTTDCUWK7_cjs.transformReservedWord(names?.at(0) || params.name);
|
|
284
290
|
}
|
|
285
291
|
const name = this.hookFirstSync({
|
|
286
292
|
hookName: "resolveName",
|
|
287
293
|
parameters: [params.name, params.type],
|
|
288
294
|
message: `Resolving name '${params.name}' and type '${params.type}'`
|
|
289
295
|
}).result;
|
|
290
|
-
return
|
|
291
|
-
}
|
|
296
|
+
return chunkTTDCUWK7_cjs.transformReservedWord(name);
|
|
297
|
+
};
|
|
292
298
|
/**
|
|
293
299
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
294
300
|
*/
|
|
@@ -396,7 +402,7 @@ Falling back on the first item.
|
|
|
396
402
|
}),
|
|
397
403
|
plugin
|
|
398
404
|
};
|
|
399
|
-
if (
|
|
405
|
+
if (parseResult?.result != null) {
|
|
400
406
|
break;
|
|
401
407
|
}
|
|
402
408
|
}
|
|
@@ -493,10 +499,10 @@ Falling back on the first item.
|
|
|
493
499
|
}
|
|
494
500
|
return plugin;
|
|
495
501
|
}).sort((a, b) => {
|
|
496
|
-
if (
|
|
502
|
+
if (b.pre?.includes(a.name)) {
|
|
497
503
|
return 1;
|
|
498
504
|
}
|
|
499
|
-
if (
|
|
505
|
+
if (b.post?.includes(a.name)) {
|
|
500
506
|
return -1;
|
|
501
507
|
}
|
|
502
508
|
return 0;
|
|
@@ -507,14 +513,14 @@ Falling back on the first item.
|
|
|
507
513
|
const [searchPluginName, searchIdentifier] = pluginKey;
|
|
508
514
|
const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
|
|
509
515
|
const [name, identifier] = item.key;
|
|
510
|
-
const identifierCheck =
|
|
516
|
+
const identifierCheck = identifier?.toString() === searchIdentifier?.toString();
|
|
511
517
|
const nameCheck = name === searchPluginName;
|
|
512
518
|
if (searchIdentifier) {
|
|
513
519
|
return identifierCheck && nameCheck;
|
|
514
520
|
}
|
|
515
521
|
return nameCheck;
|
|
516
522
|
});
|
|
517
|
-
if (!
|
|
523
|
+
if (!pluginByPluginName?.length) {
|
|
518
524
|
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
519
525
|
if (corePlugin) {
|
|
520
526
|
this.logger.emit("debug", {
|
|
@@ -637,13 +643,13 @@ Falling back on the first item.
|
|
|
637
643
|
}
|
|
638
644
|
}
|
|
639
645
|
#catcher(cause, plugin, hookName) {
|
|
640
|
-
const text = `${cause.message} (plugin: ${
|
|
646
|
+
const text = `${cause.message} (plugin: ${plugin?.name || "unknown"}, hook: ${hookName || "unknown"})`;
|
|
641
647
|
this.logger.emit("error", text, cause);
|
|
642
648
|
this.events.emit("error", cause);
|
|
643
649
|
}
|
|
644
650
|
#parse(plugin, pluginManager, context) {
|
|
645
651
|
const usedPluginNames = pluginManager.#usedPluginNames;
|
|
646
|
-
|
|
652
|
+
chunk52WA2JF5_cjs.setUniqueName(plugin.name, usedPluginNames);
|
|
647
653
|
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
648
654
|
if (plugin.context && typeof plugin.context === "function") {
|
|
649
655
|
return {
|
|
@@ -675,25 +681,21 @@ Falling back on the first item.
|
|
|
675
681
|
static get hooks() {
|
|
676
682
|
return ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
677
683
|
}
|
|
678
|
-
}
|
|
684
|
+
};
|
|
679
685
|
|
|
680
686
|
// src/config.ts
|
|
681
|
-
|
|
687
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
682
688
|
function defineConfig(options) {
|
|
683
689
|
return options;
|
|
684
690
|
}
|
|
685
691
|
function isInputPath(result) {
|
|
686
692
|
return !!result && "path" in result;
|
|
687
693
|
}
|
|
688
|
-
|
|
689
|
-
// src/build.ts
|
|
690
|
-
|
|
691
|
-
|
|
692
694
|
async function setup(options) {
|
|
693
|
-
const { config, logger =
|
|
695
|
+
const { config, logger = chunkYEVCYV36_cjs.createLogger() } = options;
|
|
694
696
|
try {
|
|
695
|
-
if (isInputPath(config) && !new
|
|
696
|
-
await
|
|
697
|
+
if (isInputPath(config) && !new chunk52WA2JF5_cjs.URLPath(config.input.path).isURL) {
|
|
698
|
+
await fs.read(config.input.path);
|
|
697
699
|
}
|
|
698
700
|
} catch (e) {
|
|
699
701
|
if (isInputPath(config)) {
|
|
@@ -703,8 +705,8 @@ async function setup(options) {
|
|
|
703
705
|
}
|
|
704
706
|
}
|
|
705
707
|
if (config.output.clean) {
|
|
706
|
-
await
|
|
707
|
-
await
|
|
708
|
+
await fs.clean(config.output.path);
|
|
709
|
+
await fs.clean(path3.join(config.root, ".kubb"));
|
|
708
710
|
}
|
|
709
711
|
return new PluginManager(config, { logger });
|
|
710
712
|
}
|
|
@@ -722,12 +724,12 @@ async function safeBuild(options) {
|
|
|
722
724
|
const pluginManager = await setup(options);
|
|
723
725
|
try {
|
|
724
726
|
pluginManager.events.on("executing", ({ plugin, message }) => {
|
|
725
|
-
pluginManager.logger.emit("debug", { date: /* @__PURE__ */ new Date(), logs: [`Executing pluginKey ${
|
|
727
|
+
pluginManager.logger.emit("debug", { date: /* @__PURE__ */ new Date(), logs: [`Executing pluginKey ${plugin.key?.join(".")} | ${message}`] });
|
|
726
728
|
});
|
|
727
729
|
pluginManager.events.on("executed", ({ plugin, message, output }) => {
|
|
728
730
|
pluginManager.logger.emit("debug", {
|
|
729
731
|
date: /* @__PURE__ */ new Date(),
|
|
730
|
-
logs: [`Executed pluginKey ${
|
|
732
|
+
logs: [`Executed pluginKey ${plugin.key?.join(".")} | ${message} | ${JSON.stringify(output, void 0, 2)}`]
|
|
731
733
|
});
|
|
732
734
|
});
|
|
733
735
|
await pluginManager.hookParallel({
|
|
@@ -735,8 +737,8 @@ async function safeBuild(options) {
|
|
|
735
737
|
parameters: [options.config],
|
|
736
738
|
message: "buildStart"
|
|
737
739
|
});
|
|
738
|
-
const root =
|
|
739
|
-
const rootPath =
|
|
740
|
+
const root = path3.resolve(options.config.root);
|
|
741
|
+
const rootPath = path3.resolve(root, options.config.output.path, "index.ts");
|
|
740
742
|
const barrelFiles = pluginManager.fileManager.files.filter((file) => {
|
|
741
743
|
return file.sources.some((source) => source.isIndexable);
|
|
742
744
|
});
|
|
@@ -744,26 +746,26 @@ async function safeBuild(options) {
|
|
|
744
746
|
path: rootPath,
|
|
745
747
|
baseName: "index.ts",
|
|
746
748
|
exports: barrelFiles.flatMap((file) => {
|
|
747
|
-
return
|
|
749
|
+
return file.sources?.map((source) => {
|
|
748
750
|
if (!file.path || !source.isIndexable) {
|
|
749
751
|
return void 0;
|
|
750
752
|
}
|
|
751
753
|
const plugin = pluginManager.plugins.find((item) => {
|
|
752
754
|
const meta = file.meta;
|
|
753
|
-
return item.name ===
|
|
755
|
+
return item.name === meta?.pluginKey?.[0];
|
|
754
756
|
});
|
|
755
|
-
if (
|
|
757
|
+
if (plugin?.output?.exportType === false) {
|
|
756
758
|
return void 0;
|
|
757
759
|
}
|
|
758
|
-
if (
|
|
760
|
+
if (chunk52WA2JF5_cjs.FileManager.getMode(plugin?.output?.path) === "single") {
|
|
759
761
|
return void 0;
|
|
760
762
|
}
|
|
761
763
|
return {
|
|
762
764
|
name: options.config.output.exportType === "barrel" ? void 0 : [source.name],
|
|
763
|
-
path:
|
|
765
|
+
path: fs.getRelativePath(rootPath, file.path),
|
|
764
766
|
isTypeOnly: source.isTypeOnly
|
|
765
767
|
};
|
|
766
|
-
})
|
|
768
|
+
}).filter(Boolean);
|
|
767
769
|
}).filter(Boolean),
|
|
768
770
|
sources: [],
|
|
769
771
|
meta: {}
|
|
@@ -771,7 +773,7 @@ async function safeBuild(options) {
|
|
|
771
773
|
if (options.config.output.exportType) {
|
|
772
774
|
await pluginManager.fileManager.add(rootFile);
|
|
773
775
|
}
|
|
774
|
-
files = await
|
|
776
|
+
files = await chunk52WA2JF5_cjs.processFiles({
|
|
775
777
|
config: options.config,
|
|
776
778
|
dryRun: !options.config.output.write,
|
|
777
779
|
files: pluginManager.fileManager.files,
|
|
@@ -793,7 +795,7 @@ async function safeBuild(options) {
|
|
|
793
795
|
}
|
|
794
796
|
|
|
795
797
|
// src/BaseGenerator.ts
|
|
796
|
-
|
|
798
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
797
799
|
var BaseGenerator = class {
|
|
798
800
|
#options = {};
|
|
799
801
|
#context = {};
|
|
@@ -818,33 +820,25 @@ var BaseGenerator = class {
|
|
|
818
820
|
};
|
|
819
821
|
|
|
820
822
|
// src/PackageManager.ts
|
|
821
|
-
|
|
822
|
-
var _module = require('module'); var _module2 = _interopRequireDefault(_module);
|
|
823
|
-
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
824
|
-
var _url = require('url');
|
|
823
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
825
824
|
|
|
826
825
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
827
|
-
|
|
828
|
-
|
|
826
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
829
827
|
|
|
830
828
|
// ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
831
|
-
|
|
832
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
833
|
-
|
|
834
|
-
var _fs3 = require('fs'); var _fs4 = _interopRequireDefault(_fs3);
|
|
835
|
-
|
|
829
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
836
830
|
|
|
837
831
|
// ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
838
|
-
|
|
832
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
839
833
|
|
|
840
834
|
// ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
841
|
-
|
|
835
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
842
836
|
|
|
843
837
|
// ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
|
|
844
|
-
|
|
838
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
845
839
|
var Node = class {
|
|
846
|
-
|
|
847
|
-
|
|
840
|
+
value;
|
|
841
|
+
next;
|
|
848
842
|
constructor(value) {
|
|
849
843
|
this.value = value;
|
|
850
844
|
}
|
|
@@ -912,7 +906,7 @@ function pLimit(concurrency) {
|
|
|
912
906
|
resolve2(result);
|
|
913
907
|
try {
|
|
914
908
|
await result;
|
|
915
|
-
} catch
|
|
909
|
+
} catch {
|
|
916
910
|
}
|
|
917
911
|
next();
|
|
918
912
|
};
|
|
@@ -988,9 +982,9 @@ function checkType(type) {
|
|
|
988
982
|
throw new Error(`Invalid type specified: ${type}`);
|
|
989
983
|
}
|
|
990
984
|
var matchType = (type, stat) => stat[typeMappings[type]]();
|
|
991
|
-
var toPath = (urlOrPath) => urlOrPath instanceof URL ?
|
|
985
|
+
var toPath = (urlOrPath) => urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
|
|
992
986
|
async function locatePath(paths, {
|
|
993
|
-
cwd =
|
|
987
|
+
cwd = process__default.default.cwd(),
|
|
994
988
|
type = "file",
|
|
995
989
|
allowSymlinks = true,
|
|
996
990
|
concurrency,
|
|
@@ -998,27 +992,27 @@ async function locatePath(paths, {
|
|
|
998
992
|
} = {}) {
|
|
999
993
|
checkType(type);
|
|
1000
994
|
cwd = toPath(cwd);
|
|
1001
|
-
const statFunction = allowSymlinks ?
|
|
995
|
+
const statFunction = allowSymlinks ? fs$1.promises.stat : fs$1.promises.lstat;
|
|
1002
996
|
return pLocate(paths, async (path_) => {
|
|
1003
997
|
try {
|
|
1004
|
-
const stat = await statFunction(
|
|
998
|
+
const stat = await statFunction(path3__default.default.resolve(cwd, path_));
|
|
1005
999
|
return matchType(type, stat);
|
|
1006
|
-
} catch
|
|
1000
|
+
} catch {
|
|
1007
1001
|
return false;
|
|
1008
1002
|
}
|
|
1009
1003
|
}, { concurrency, preserveOrder });
|
|
1010
1004
|
}
|
|
1011
1005
|
function locatePathSync(paths, {
|
|
1012
|
-
cwd =
|
|
1006
|
+
cwd = process__default.default.cwd(),
|
|
1013
1007
|
type = "file",
|
|
1014
1008
|
allowSymlinks = true
|
|
1015
1009
|
} = {}) {
|
|
1016
1010
|
checkType(type);
|
|
1017
1011
|
cwd = toPath(cwd);
|
|
1018
|
-
const statFunction = allowSymlinks ?
|
|
1012
|
+
const statFunction = allowSymlinks ? fs__default.default.statSync : fs__default.default.lstatSync;
|
|
1019
1013
|
for (const path_ of paths) {
|
|
1020
1014
|
try {
|
|
1021
|
-
const stat = statFunction(
|
|
1015
|
+
const stat = statFunction(path3__default.default.resolve(cwd, path_), {
|
|
1022
1016
|
throwIfNoEntry: false
|
|
1023
1017
|
});
|
|
1024
1018
|
if (!stat) {
|
|
@@ -1027,29 +1021,27 @@ function locatePathSync(paths, {
|
|
|
1027
1021
|
if (matchType(type, stat)) {
|
|
1028
1022
|
return path_;
|
|
1029
1023
|
}
|
|
1030
|
-
} catch
|
|
1024
|
+
} catch {
|
|
1031
1025
|
}
|
|
1032
1026
|
}
|
|
1033
1027
|
}
|
|
1034
1028
|
|
|
1035
1029
|
// ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
|
|
1036
|
-
|
|
1037
|
-
|
|
1030
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
1038
1031
|
function toPath2(urlOrPath) {
|
|
1039
|
-
return urlOrPath instanceof URL ?
|
|
1032
|
+
return urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
|
|
1040
1033
|
}
|
|
1041
1034
|
|
|
1042
1035
|
// ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
|
|
1043
|
-
|
|
1044
|
-
|
|
1036
|
+
chunkADFKVVPE_cjs.init_cjs_shims();
|
|
1045
1037
|
|
|
1046
1038
|
// ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
1047
1039
|
var findUpStop = Symbol("findUpStop");
|
|
1048
1040
|
async function findUpMultiple(name, options = {}) {
|
|
1049
|
-
let directory =
|
|
1050
|
-
const { root } =
|
|
1051
|
-
const stopAt =
|
|
1052
|
-
const limit =
|
|
1041
|
+
let directory = path3__default.default.resolve(toPath2(options.cwd) ?? "");
|
|
1042
|
+
const { root } = path3__default.default.parse(directory);
|
|
1043
|
+
const stopAt = path3__default.default.resolve(directory, toPath2(options.stopAt ?? root));
|
|
1044
|
+
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
1053
1045
|
const paths = [name].flat();
|
|
1054
1046
|
const runMatcher = async (locateOptions) => {
|
|
1055
1047
|
if (typeof name !== "function") {
|
|
@@ -1068,20 +1060,20 @@ async function findUpMultiple(name, options = {}) {
|
|
|
1068
1060
|
break;
|
|
1069
1061
|
}
|
|
1070
1062
|
if (foundPath) {
|
|
1071
|
-
matches.push(
|
|
1063
|
+
matches.push(path3__default.default.resolve(directory, foundPath));
|
|
1072
1064
|
}
|
|
1073
1065
|
if (directory === stopAt || matches.length >= limit) {
|
|
1074
1066
|
break;
|
|
1075
1067
|
}
|
|
1076
|
-
directory =
|
|
1068
|
+
directory = path3__default.default.dirname(directory);
|
|
1077
1069
|
}
|
|
1078
1070
|
return matches;
|
|
1079
1071
|
}
|
|
1080
1072
|
function findUpMultipleSync(name, options = {}) {
|
|
1081
|
-
let directory =
|
|
1082
|
-
const { root } =
|
|
1083
|
-
const stopAt =
|
|
1084
|
-
const limit =
|
|
1073
|
+
let directory = path3__default.default.resolve(toPath2(options.cwd) ?? "");
|
|
1074
|
+
const { root } = path3__default.default.parse(directory);
|
|
1075
|
+
const stopAt = path3__default.default.resolve(directory, toPath2(options.stopAt) ?? root);
|
|
1076
|
+
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
1085
1077
|
const paths = [name].flat();
|
|
1086
1078
|
const runMatcher = (locateOptions) => {
|
|
1087
1079
|
if (typeof name !== "function") {
|
|
@@ -1100,12 +1092,12 @@ function findUpMultipleSync(name, options = {}) {
|
|
|
1100
1092
|
break;
|
|
1101
1093
|
}
|
|
1102
1094
|
if (foundPath) {
|
|
1103
|
-
matches.push(
|
|
1095
|
+
matches.push(path3__default.default.resolve(directory, foundPath));
|
|
1104
1096
|
}
|
|
1105
1097
|
if (directory === stopAt || matches.length >= limit) {
|
|
1106
1098
|
break;
|
|
1107
1099
|
}
|
|
1108
|
-
directory =
|
|
1100
|
+
directory = path3__default.default.dirname(directory);
|
|
1109
1101
|
}
|
|
1110
1102
|
return matches;
|
|
1111
1103
|
}
|
|
@@ -1117,10 +1109,6 @@ function findUpSync(name, options = {}) {
|
|
|
1117
1109
|
const matches = findUpMultipleSync(name, { ...options, limit: 1 });
|
|
1118
1110
|
return matches[0];
|
|
1119
1111
|
}
|
|
1120
|
-
|
|
1121
|
-
// src/PackageManager.ts
|
|
1122
|
-
var _semver = require('semver');
|
|
1123
|
-
|
|
1124
1112
|
var PackageManager = class _PackageManager {
|
|
1125
1113
|
static #cache = {};
|
|
1126
1114
|
#cwd;
|
|
@@ -1146,7 +1134,7 @@ var PackageManager = class _PackageManager {
|
|
|
1146
1134
|
getLocation(path4) {
|
|
1147
1135
|
let location = path4;
|
|
1148
1136
|
if (this.#cwd) {
|
|
1149
|
-
const require2 =
|
|
1137
|
+
const require2 = mod__default.default.createRequire(this.normalizeDirectory(this.#cwd));
|
|
1150
1138
|
location = require2.resolve(path4);
|
|
1151
1139
|
}
|
|
1152
1140
|
return location;
|
|
@@ -1154,11 +1142,11 @@ var PackageManager = class _PackageManager {
|
|
|
1154
1142
|
async import(path4) {
|
|
1155
1143
|
try {
|
|
1156
1144
|
let location = this.getLocation(path4);
|
|
1157
|
-
if (
|
|
1158
|
-
location =
|
|
1145
|
+
if (os__default.default.platform() === "win32") {
|
|
1146
|
+
location = url.pathToFileURL(location).href;
|
|
1159
1147
|
}
|
|
1160
|
-
const module = await
|
|
1161
|
-
return
|
|
1148
|
+
const module = await import(location);
|
|
1149
|
+
return module?.default ?? module;
|
|
1162
1150
|
} catch (e) {
|
|
1163
1151
|
console.error(e);
|
|
1164
1152
|
return void 0;
|
|
@@ -1171,7 +1159,7 @@ var PackageManager = class _PackageManager {
|
|
|
1171
1159
|
if (!pkgPath) {
|
|
1172
1160
|
return void 0;
|
|
1173
1161
|
}
|
|
1174
|
-
const json = await
|
|
1162
|
+
const json = await fs.read(pkgPath);
|
|
1175
1163
|
return JSON.parse(json);
|
|
1176
1164
|
}
|
|
1177
1165
|
getPackageJSONSync() {
|
|
@@ -1181,7 +1169,7 @@ var PackageManager = class _PackageManager {
|
|
|
1181
1169
|
if (!pkgPath) {
|
|
1182
1170
|
return void 0;
|
|
1183
1171
|
}
|
|
1184
|
-
const json =
|
|
1172
|
+
const json = fs.readSync(pkgPath);
|
|
1185
1173
|
return JSON.parse(json);
|
|
1186
1174
|
}
|
|
1187
1175
|
static setVersion(dependency, version) {
|
|
@@ -1226,35 +1214,38 @@ var PackageManager = class _PackageManager {
|
|
|
1226
1214
|
if (packageVersion === version) {
|
|
1227
1215
|
return true;
|
|
1228
1216
|
}
|
|
1229
|
-
const semVer =
|
|
1217
|
+
const semVer = semver.coerce(packageVersion);
|
|
1230
1218
|
if (!semVer) {
|
|
1231
1219
|
throw new Error(`${packageVersion} is not valid`);
|
|
1232
1220
|
}
|
|
1233
|
-
return
|
|
1221
|
+
return semver.satisfies(semVer, version);
|
|
1234
1222
|
}
|
|
1235
1223
|
isValidSync(dependency, version) {
|
|
1236
1224
|
const packageVersion = this.getVersionSync(dependency);
|
|
1237
1225
|
if (!packageVersion) {
|
|
1238
1226
|
return false;
|
|
1239
1227
|
}
|
|
1240
|
-
const semVer =
|
|
1228
|
+
const semVer = semver.coerce(packageVersion);
|
|
1241
1229
|
if (!semVer) {
|
|
1242
1230
|
throw new Error(`${packageVersion} is not valid`);
|
|
1243
1231
|
}
|
|
1244
|
-
return
|
|
1232
|
+
return semver.satisfies(semVer, version);
|
|
1245
1233
|
}
|
|
1246
1234
|
};
|
|
1247
1235
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
exports.
|
|
1236
|
+
Object.defineProperty(exports, "FileManager", {
|
|
1237
|
+
enumerable: true,
|
|
1238
|
+
get: function () { return chunk52WA2JF5_cjs.FileManager; }
|
|
1239
|
+
});
|
|
1240
|
+
exports.BaseGenerator = BaseGenerator;
|
|
1241
|
+
exports.PackageManager = PackageManager;
|
|
1242
|
+
exports.PluginManager = PluginManager;
|
|
1243
|
+
exports.PromiseManager = PromiseManager;
|
|
1244
|
+
exports.build = build;
|
|
1245
|
+
exports.createPlugin = createPlugin;
|
|
1246
|
+
exports.default = build;
|
|
1247
|
+
exports.defineConfig = defineConfig;
|
|
1248
|
+
exports.isInputPath = isInputPath;
|
|
1249
|
+
exports.safeBuild = safeBuild;
|
|
1250
|
+
//# sourceMappingURL=index.cjs.map
|
|
1260
1251
|
//# sourceMappingURL=index.cjs.map
|