@kubb/core 3.0.0-alpha.6 → 3.0.0-alpha.8
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-wyXRkgIk.d.cts → FileManager-B0GJlthB.d.cts} +30 -16
- package/dist/{FileManager-Ceski1W9.d.ts → FileManager-BFycBDqG.d.ts} +30 -16
- package/dist/chunk-27CPVXAT.js +945 -0
- package/dist/chunk-27CPVXAT.js.map +1 -0
- package/dist/{chunk-34BPAXR2.cjs → chunk-5E2I6KH4.cjs} +7 -7
- package/dist/{chunk-34BPAXR2.cjs.map → chunk-5E2I6KH4.cjs.map} +1 -1
- package/dist/chunk-5IGANEGE.cjs +1564 -0
- package/dist/chunk-5IGANEGE.cjs.map +1 -0
- package/dist/{chunk-67C6RBGQ.cjs → chunk-A6PCLWEY.cjs} +5 -5
- package/dist/{chunk-67C6RBGQ.cjs.map → chunk-A6PCLWEY.cjs.map} +1 -1
- package/dist/{chunk-5HN4LW3R.cjs → chunk-DID47EQD.cjs} +3 -3
- package/dist/{chunk-5HN4LW3R.cjs.map → chunk-DID47EQD.cjs.map} +1 -1
- package/dist/{chunk-25NKJ3DV.js → chunk-HBQM723K.js} +6 -6
- package/dist/{chunk-LOLEBOMW.cjs → chunk-IPZQXBA2.cjs} +16 -21
- package/dist/chunk-IPZQXBA2.cjs.map +1 -0
- package/dist/{chunk-76UEJFFE.js → chunk-SCR3LUXT.js} +9 -16
- package/dist/{chunk-76UEJFFE.js.map → chunk-SCR3LUXT.js.map} +1 -1
- package/dist/{chunk-XCPFG6DO.cjs → chunk-SEH6NUCX.cjs} +4 -28
- package/dist/chunk-SEH6NUCX.cjs.map +1 -0
- package/dist/index.cjs +380 -378
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +325 -319
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +4 -4
- package/dist/logger.js +2 -3
- package/dist/mocks.cjs +20 -15
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +6 -5
- package/dist/mocks.d.ts +6 -5
- package/dist/mocks.js +15 -11
- package/dist/mocks.js.map +1 -1
- package/dist/{prompt-6FWP747F.cjs → prompt-DVQN7JTN.cjs} +61 -61
- package/dist/{prompt-6FWP747F.cjs.map → prompt-DVQN7JTN.cjs.map} +1 -1
- package/dist/{prompt-HK3MWREM.js → prompt-WQQUN22Z.js} +5 -6
- package/dist/{prompt-HK3MWREM.js.map → prompt-WQQUN22Z.js.map} +1 -1
- package/dist/transformers.cjs +19 -19
- package/dist/transformers.js +0 -1
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +8 -4
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +25 -24
- package/dist/utils.d.ts +25 -24
- package/dist/utils.js +5 -2
- package/package.json +7 -7
- package/src/BarrelManager.ts +90 -40
- package/src/FileManager.ts +89 -109
- package/src/PluginManager.ts +2 -1
- package/src/__snapshots__/barrel.json +91 -0
- package/src/__snapshots__/grouped.json +114 -0
- package/src/__snapshots__/ordered.json +62 -0
- package/src/build.ts +60 -23
- package/src/plugin.ts +2 -2
- package/src/types.ts +22 -2
- package/src/utils/TreeNode.ts +43 -1
- package/src/utils/index.ts +1 -1
- package/src/utils/parser.ts +128 -67
- package/dist/chunk-AWAZR3D5.js +0 -360
- package/dist/chunk-AWAZR3D5.js.map +0 -1
- package/dist/chunk-DCZQYCCO.cjs +0 -1155
- package/dist/chunk-DCZQYCCO.cjs.map +0 -1
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-HMLY7DHA.js.map +0 -1
- package/dist/chunk-L3JJLZ5Q.cjs +0 -371
- package/dist/chunk-L3JJLZ5Q.cjs.map +0 -1
- package/dist/chunk-LOLEBOMW.cjs.map +0 -1
- package/dist/chunk-RIEGCND2.js +0 -525
- package/dist/chunk-RIEGCND2.js.map +0 -1
- package/dist/chunk-XCPFG6DO.cjs.map +0 -1
- package/schema.json +0 -86
- /package/dist/{chunk-25NKJ3DV.js.map → chunk-HBQM723K.js.map} +0 -0
package/dist/chunk-DCZQYCCO.cjs
DELETED
|
@@ -1,1155 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkL3JJLZ5Qcjs = require('./chunk-L3JJLZ5Q.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunk67C6RBGQcjs = require('./chunk-67C6RBGQ.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkXCPFG6DOcjs = require('./chunk-XCPFG6DO.cjs');
|
|
19
|
-
|
|
20
|
-
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
|
|
21
|
-
var require_eventemitter3 = _chunkXCPFG6DOcjs.__commonJS.call(void 0, {
|
|
22
|
-
"../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
|
|
23
|
-
"use strict";
|
|
24
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
25
|
-
var has = Object.prototype.hasOwnProperty;
|
|
26
|
-
var prefix = "~";
|
|
27
|
-
function Events() {
|
|
28
|
-
}
|
|
29
|
-
if (Object.create) {
|
|
30
|
-
Events.prototype = /* @__PURE__ */ Object.create(null);
|
|
31
|
-
if (!new Events().__proto__) prefix = false;
|
|
32
|
-
}
|
|
33
|
-
function EE(fn, context, once) {
|
|
34
|
-
this.fn = fn;
|
|
35
|
-
this.context = context;
|
|
36
|
-
this.once = once || false;
|
|
37
|
-
}
|
|
38
|
-
function addListener(emitter, event, fn, context, once) {
|
|
39
|
-
if (typeof fn !== "function") {
|
|
40
|
-
throw new TypeError("The listener must be a function");
|
|
41
|
-
}
|
|
42
|
-
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
43
|
-
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
44
|
-
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
45
|
-
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
46
|
-
return emitter;
|
|
47
|
-
}
|
|
48
|
-
function clearEvent(emitter, evt) {
|
|
49
|
-
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
50
|
-
else delete emitter._events[evt];
|
|
51
|
-
}
|
|
52
|
-
function EventEmitter2() {
|
|
53
|
-
this._events = new Events();
|
|
54
|
-
this._eventsCount = 0;
|
|
55
|
-
}
|
|
56
|
-
EventEmitter2.prototype.eventNames = function eventNames() {
|
|
57
|
-
var names = [], events, name;
|
|
58
|
-
if (this._eventsCount === 0) return names;
|
|
59
|
-
for (name in events = this._events) {
|
|
60
|
-
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
61
|
-
}
|
|
62
|
-
if (Object.getOwnPropertySymbols) {
|
|
63
|
-
return names.concat(Object.getOwnPropertySymbols(events));
|
|
64
|
-
}
|
|
65
|
-
return names;
|
|
66
|
-
};
|
|
67
|
-
EventEmitter2.prototype.listeners = function listeners(event) {
|
|
68
|
-
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
69
|
-
if (!handlers) return [];
|
|
70
|
-
if (handlers.fn) return [handlers.fn];
|
|
71
|
-
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
72
|
-
ee[i] = handlers[i].fn;
|
|
73
|
-
}
|
|
74
|
-
return ee;
|
|
75
|
-
};
|
|
76
|
-
EventEmitter2.prototype.listenerCount = function listenerCount(event) {
|
|
77
|
-
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
78
|
-
if (!listeners) return 0;
|
|
79
|
-
if (listeners.fn) return 1;
|
|
80
|
-
return listeners.length;
|
|
81
|
-
};
|
|
82
|
-
EventEmitter2.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
83
|
-
var evt = prefix ? prefix + event : event;
|
|
84
|
-
if (!this._events[evt]) return false;
|
|
85
|
-
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
86
|
-
if (listeners.fn) {
|
|
87
|
-
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
88
|
-
switch (len) {
|
|
89
|
-
case 1:
|
|
90
|
-
return listeners.fn.call(listeners.context), true;
|
|
91
|
-
case 2:
|
|
92
|
-
return listeners.fn.call(listeners.context, a1), true;
|
|
93
|
-
case 3:
|
|
94
|
-
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
95
|
-
case 4:
|
|
96
|
-
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
97
|
-
case 5:
|
|
98
|
-
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
99
|
-
case 6:
|
|
100
|
-
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
101
|
-
}
|
|
102
|
-
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
|
103
|
-
args[i - 1] = arguments[i];
|
|
104
|
-
}
|
|
105
|
-
listeners.fn.apply(listeners.context, args);
|
|
106
|
-
} else {
|
|
107
|
-
var length = listeners.length, j;
|
|
108
|
-
for (i = 0; i < length; i++) {
|
|
109
|
-
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
110
|
-
switch (len) {
|
|
111
|
-
case 1:
|
|
112
|
-
listeners[i].fn.call(listeners[i].context);
|
|
113
|
-
break;
|
|
114
|
-
case 2:
|
|
115
|
-
listeners[i].fn.call(listeners[i].context, a1);
|
|
116
|
-
break;
|
|
117
|
-
case 3:
|
|
118
|
-
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
119
|
-
break;
|
|
120
|
-
case 4:
|
|
121
|
-
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
122
|
-
break;
|
|
123
|
-
default:
|
|
124
|
-
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
|
|
125
|
-
args[j - 1] = arguments[j];
|
|
126
|
-
}
|
|
127
|
-
listeners[i].fn.apply(listeners[i].context, args);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
};
|
|
133
|
-
EventEmitter2.prototype.on = function on(event, fn, context) {
|
|
134
|
-
return addListener(this, event, fn, context, false);
|
|
135
|
-
};
|
|
136
|
-
EventEmitter2.prototype.once = function once(event, fn, context) {
|
|
137
|
-
return addListener(this, event, fn, context, true);
|
|
138
|
-
};
|
|
139
|
-
EventEmitter2.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
140
|
-
var evt = prefix ? prefix + event : event;
|
|
141
|
-
if (!this._events[evt]) return this;
|
|
142
|
-
if (!fn) {
|
|
143
|
-
clearEvent(this, evt);
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
var listeners = this._events[evt];
|
|
147
|
-
if (listeners.fn) {
|
|
148
|
-
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
149
|
-
clearEvent(this, evt);
|
|
150
|
-
}
|
|
151
|
-
} else {
|
|
152
|
-
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
153
|
-
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
|
|
154
|
-
events.push(listeners[i]);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
158
|
-
else clearEvent(this, evt);
|
|
159
|
-
}
|
|
160
|
-
return this;
|
|
161
|
-
};
|
|
162
|
-
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
163
|
-
var evt;
|
|
164
|
-
if (event) {
|
|
165
|
-
evt = prefix ? prefix + event : event;
|
|
166
|
-
if (this._events[evt]) clearEvent(this, evt);
|
|
167
|
-
} else {
|
|
168
|
-
this._events = new Events();
|
|
169
|
-
this._eventsCount = 0;
|
|
170
|
-
}
|
|
171
|
-
return this;
|
|
172
|
-
};
|
|
173
|
-
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
|
|
174
|
-
EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
|
|
175
|
-
EventEmitter2.prefixed = prefix;
|
|
176
|
-
EventEmitter2.EventEmitter = EventEmitter2;
|
|
177
|
-
if ("undefined" !== typeof module) {
|
|
178
|
-
module.exports = EventEmitter2;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// src/FileManager.ts
|
|
184
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
185
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
186
|
-
var _remeda = require('remeda');
|
|
187
|
-
var _fs = require('@kubb/fs');
|
|
188
|
-
|
|
189
|
-
// src/BarrelManager.ts
|
|
190
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// src/utils/TreeNode.ts
|
|
194
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
195
|
-
var TreeNode = class _TreeNode {
|
|
196
|
-
constructor(data, parent) {
|
|
197
|
-
this.children = [];
|
|
198
|
-
this.data = data;
|
|
199
|
-
this.parent = parent;
|
|
200
|
-
return this;
|
|
201
|
-
}
|
|
202
|
-
addChild(data) {
|
|
203
|
-
const child = new _TreeNode(data, this);
|
|
204
|
-
if (!this.children) {
|
|
205
|
-
this.children = [];
|
|
206
|
-
}
|
|
207
|
-
this.children.push(child);
|
|
208
|
-
return child;
|
|
209
|
-
}
|
|
210
|
-
find(data) {
|
|
211
|
-
if (!data) {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
if (data === this.data) {
|
|
215
|
-
return this;
|
|
216
|
-
}
|
|
217
|
-
if (_optionalChain([this, 'access', _2 => _2.children, 'optionalAccess', _3 => _3.length])) {
|
|
218
|
-
for (let i = 0, { length } = this.children, target = null; i < length; i++) {
|
|
219
|
-
target = this.children[i].find(data);
|
|
220
|
-
if (target) {
|
|
221
|
-
return target;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
227
|
-
get leaves() {
|
|
228
|
-
if (!this.children || this.children.length === 0) {
|
|
229
|
-
return [this];
|
|
230
|
-
}
|
|
231
|
-
const leaves = [];
|
|
232
|
-
if (this.children) {
|
|
233
|
-
for (let i = 0, { length } = this.children; i < length; i++) {
|
|
234
|
-
leaves.push.apply(leaves, this.children[i].leaves);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return leaves;
|
|
238
|
-
}
|
|
239
|
-
get root() {
|
|
240
|
-
if (!this.parent) {
|
|
241
|
-
return this;
|
|
242
|
-
}
|
|
243
|
-
return this.parent.root;
|
|
244
|
-
}
|
|
245
|
-
forEach(callback) {
|
|
246
|
-
if (typeof callback !== "function") {
|
|
247
|
-
throw new TypeError("forEach() callback must be a function");
|
|
248
|
-
}
|
|
249
|
-
callback(this);
|
|
250
|
-
if (this.children) {
|
|
251
|
-
for (let i = 0, { length } = this.children; i < length; i++) {
|
|
252
|
-
_optionalChain([this, 'access', _4 => _4.children, 'access', _5 => _5[i], 'optionalAccess', _6 => _6.forEach, 'call', _7 => _7(callback)]);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return this;
|
|
256
|
-
}
|
|
257
|
-
static build(files, root) {
|
|
258
|
-
try {
|
|
259
|
-
const filteredTree = buildDirectoryTree(files, root);
|
|
260
|
-
if (!filteredTree) {
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
const treeNode = new _TreeNode({
|
|
264
|
-
name: filteredTree.name,
|
|
265
|
-
path: filteredTree.path,
|
|
266
|
-
file: filteredTree.file,
|
|
267
|
-
type: FileManager.getMode(filteredTree.path)
|
|
268
|
-
});
|
|
269
|
-
const recurse = (node, item) => {
|
|
270
|
-
const subNode = node.addChild({
|
|
271
|
-
name: item.name,
|
|
272
|
-
path: item.path,
|
|
273
|
-
file: item.file,
|
|
274
|
-
type: FileManager.getMode(item.path)
|
|
275
|
-
});
|
|
276
|
-
if (_optionalChain([item, 'access', _8 => _8.children, 'optionalAccess', _9 => _9.length])) {
|
|
277
|
-
_optionalChain([item, 'access', _10 => _10.children, 'optionalAccess', _11 => _11.forEach, 'call', _12 => _12((child) => {
|
|
278
|
-
recurse(subNode, child);
|
|
279
|
-
})]);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
_optionalChain([filteredTree, 'access', _13 => _13.children, 'optionalAccess', _14 => _14.forEach, 'call', _15 => _15((child) => recurse(treeNode, child))]);
|
|
283
|
-
return treeNode;
|
|
284
|
-
} catch (e) {
|
|
285
|
-
throw new Error("Something went wrong with creating index files with the TreehNode class", { cause: e });
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
function buildDirectoryTree(files, rootFolder = "") {
|
|
290
|
-
const rootPrefix = rootFolder.endsWith("/") ? rootFolder : `${rootFolder}/`;
|
|
291
|
-
const filteredFiles = files.filter((file) => rootFolder ? file.path.startsWith(rootPrefix) && !file.path.endsWith(".json") : !file.path.endsWith(".json"));
|
|
292
|
-
if (filteredFiles.length === 0) {
|
|
293
|
-
return null;
|
|
294
|
-
}
|
|
295
|
-
const root = {
|
|
296
|
-
name: rootFolder || "",
|
|
297
|
-
path: rootFolder || "",
|
|
298
|
-
children: []
|
|
299
|
-
};
|
|
300
|
-
filteredFiles.forEach((file) => {
|
|
301
|
-
const path2 = file.path.slice(rootFolder.length);
|
|
302
|
-
const parts = path2.split("/");
|
|
303
|
-
let currentLevel = root.children;
|
|
304
|
-
let currentPath = rootFolder;
|
|
305
|
-
parts.forEach((part, index) => {
|
|
306
|
-
if (index !== 0) {
|
|
307
|
-
currentPath += `/${part}`;
|
|
308
|
-
} else {
|
|
309
|
-
currentPath += `${part}`;
|
|
310
|
-
}
|
|
311
|
-
let existingNode = currentLevel.find((node) => node.name === part);
|
|
312
|
-
if (!existingNode) {
|
|
313
|
-
if (index === parts.length - 1) {
|
|
314
|
-
existingNode = {
|
|
315
|
-
name: part,
|
|
316
|
-
file,
|
|
317
|
-
path: currentPath
|
|
318
|
-
};
|
|
319
|
-
} else {
|
|
320
|
-
existingNode = {
|
|
321
|
-
name: part,
|
|
322
|
-
path: currentPath,
|
|
323
|
-
children: []
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
currentLevel.push(existingNode);
|
|
327
|
-
}
|
|
328
|
-
if (!existingNode.file) {
|
|
329
|
-
currentLevel = existingNode.children;
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
return root;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// src/BarrelManager.ts
|
|
337
|
-
|
|
338
|
-
var _options;
|
|
339
|
-
var BarrelManager = class {
|
|
340
|
-
constructor(options = {}) {
|
|
341
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _options);
|
|
342
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options, options);
|
|
343
|
-
return this;
|
|
344
|
-
}
|
|
345
|
-
getIndexes(generatedFiles, root) {
|
|
346
|
-
const { isTypeOnly, extName } = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options);
|
|
347
|
-
const tree = TreeNode.build(generatedFiles, root);
|
|
348
|
-
if (!tree) {
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
|
-
const fileReducer = (files, treeNode) => {
|
|
352
|
-
if (!treeNode.children) {
|
|
353
|
-
return [];
|
|
354
|
-
}
|
|
355
|
-
const indexPath = _path2.default.resolve(treeNode.data.path, "index.ts");
|
|
356
|
-
const exports = treeNode.children.filter((item) => !!item.data.name).map((treeNode2) => {
|
|
357
|
-
const importPath = treeNode2.data.file ? `./${_fs.trimExtName.call(void 0, treeNode2.data.name)}` : `./${treeNode2.data.name}/index`;
|
|
358
|
-
if (importPath.endsWith("index") && treeNode2.data.file) {
|
|
359
|
-
return void 0;
|
|
360
|
-
}
|
|
361
|
-
return {
|
|
362
|
-
path: extName ? `${importPath}${extName}` : importPath,
|
|
363
|
-
isTypeOnly
|
|
364
|
-
};
|
|
365
|
-
}).filter(Boolean);
|
|
366
|
-
files.push({
|
|
367
|
-
path: indexPath,
|
|
368
|
-
baseName: "index.ts",
|
|
369
|
-
exports,
|
|
370
|
-
sources: []
|
|
371
|
-
});
|
|
372
|
-
treeNode.children.forEach((childItem) => {
|
|
373
|
-
fileReducer(files, childItem);
|
|
374
|
-
});
|
|
375
|
-
return files;
|
|
376
|
-
};
|
|
377
|
-
return fileReducer([], tree).reverse();
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
_options = new WeakMap();
|
|
381
|
-
|
|
382
|
-
// src/FileManager.ts
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
|
|
386
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
387
|
-
|
|
388
|
-
// ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
|
|
389
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
390
|
-
var import_index = _chunkXCPFG6DOcjs.__toESM.call(void 0, require_eventemitter3(), 1);
|
|
391
|
-
|
|
392
|
-
// ../../node_modules/.pnpm/p-timeout@6.1.2/node_modules/p-timeout/index.js
|
|
393
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
394
|
-
var TimeoutError = class extends Error {
|
|
395
|
-
constructor(message) {
|
|
396
|
-
super(message);
|
|
397
|
-
this.name = "TimeoutError";
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
var AbortError = class extends Error {
|
|
401
|
-
constructor(message) {
|
|
402
|
-
super();
|
|
403
|
-
this.name = "AbortError";
|
|
404
|
-
this.message = message;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new AbortError(errorMessage) : new DOMException(errorMessage);
|
|
408
|
-
var getAbortedReason = (signal) => {
|
|
409
|
-
const reason = signal.reason === void 0 ? getDOMException("This operation was aborted.") : signal.reason;
|
|
410
|
-
return reason instanceof Error ? reason : getDOMException(reason);
|
|
411
|
-
};
|
|
412
|
-
function pTimeout(promise, options) {
|
|
413
|
-
const {
|
|
414
|
-
milliseconds,
|
|
415
|
-
fallback,
|
|
416
|
-
message,
|
|
417
|
-
customTimers = { setTimeout, clearTimeout }
|
|
418
|
-
} = options;
|
|
419
|
-
let timer;
|
|
420
|
-
const wrappedPromise = new Promise((resolve2, reject) => {
|
|
421
|
-
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
422
|
-
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
423
|
-
}
|
|
424
|
-
if (options.signal) {
|
|
425
|
-
const { signal } = options;
|
|
426
|
-
if (signal.aborted) {
|
|
427
|
-
reject(getAbortedReason(signal));
|
|
428
|
-
}
|
|
429
|
-
signal.addEventListener("abort", () => {
|
|
430
|
-
reject(getAbortedReason(signal));
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
if (milliseconds === Number.POSITIVE_INFINITY) {
|
|
434
|
-
promise.then(resolve2, reject);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
const timeoutError = new TimeoutError();
|
|
438
|
-
timer = customTimers.setTimeout.call(void 0, () => {
|
|
439
|
-
if (fallback) {
|
|
440
|
-
try {
|
|
441
|
-
resolve2(fallback());
|
|
442
|
-
} catch (error) {
|
|
443
|
-
reject(error);
|
|
444
|
-
}
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
if (typeof promise.cancel === "function") {
|
|
448
|
-
promise.cancel();
|
|
449
|
-
}
|
|
450
|
-
if (message === false) {
|
|
451
|
-
resolve2();
|
|
452
|
-
} else if (message instanceof Error) {
|
|
453
|
-
reject(message);
|
|
454
|
-
} else {
|
|
455
|
-
timeoutError.message = _nullishCoalesce(message, () => ( `Promise timed out after ${milliseconds} milliseconds`));
|
|
456
|
-
reject(timeoutError);
|
|
457
|
-
}
|
|
458
|
-
}, milliseconds);
|
|
459
|
-
(async () => {
|
|
460
|
-
try {
|
|
461
|
-
resolve2(await promise);
|
|
462
|
-
} catch (error) {
|
|
463
|
-
reject(error);
|
|
464
|
-
}
|
|
465
|
-
})();
|
|
466
|
-
});
|
|
467
|
-
const cancelablePromise = wrappedPromise.finally(() => {
|
|
468
|
-
cancelablePromise.clear();
|
|
469
|
-
});
|
|
470
|
-
cancelablePromise.clear = () => {
|
|
471
|
-
customTimers.clearTimeout.call(void 0, timer);
|
|
472
|
-
timer = void 0;
|
|
473
|
-
};
|
|
474
|
-
return cancelablePromise;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
|
|
478
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
479
|
-
|
|
480
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/lower-bound.js
|
|
481
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
482
|
-
function lowerBound(array, value, comparator) {
|
|
483
|
-
let first = 0;
|
|
484
|
-
let count = array.length;
|
|
485
|
-
while (count > 0) {
|
|
486
|
-
const step = Math.trunc(count / 2);
|
|
487
|
-
let it = first + step;
|
|
488
|
-
if (comparator(array[it], value) <= 0) {
|
|
489
|
-
first = ++it;
|
|
490
|
-
count -= step + 1;
|
|
491
|
-
} else {
|
|
492
|
-
count = step;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
return first;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
|
|
499
|
-
var _queue;
|
|
500
|
-
var PriorityQueue = class {
|
|
501
|
-
constructor() {
|
|
502
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _queue, []);
|
|
503
|
-
}
|
|
504
|
-
enqueue(run, options) {
|
|
505
|
-
options = {
|
|
506
|
-
priority: 0,
|
|
507
|
-
...options
|
|
508
|
-
};
|
|
509
|
-
const element = {
|
|
510
|
-
priority: options.priority,
|
|
511
|
-
run
|
|
512
|
-
};
|
|
513
|
-
if (this.size && _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue)[this.size - 1].priority >= options.priority) {
|
|
514
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue).push(element);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
const index = lowerBound(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue), element, (a, b) => b.priority - a.priority);
|
|
518
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue).splice(index, 0, element);
|
|
519
|
-
}
|
|
520
|
-
dequeue() {
|
|
521
|
-
const item = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue).shift();
|
|
522
|
-
return _optionalChain([item, 'optionalAccess', _16 => _16.run]);
|
|
523
|
-
}
|
|
524
|
-
filter(options) {
|
|
525
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue).filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
526
|
-
}
|
|
527
|
-
get size() {
|
|
528
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue).length;
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
_queue = new WeakMap();
|
|
532
|
-
|
|
533
|
-
// ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
|
|
534
|
-
var _carryoverConcurrencyCount, _isIntervalIgnored, _intervalCount, _intervalCap, _interval, _intervalEnd, _intervalId, _timeoutId, _queue2, _queueClass, _pending, _concurrency, _isPaused, _throwOnTimeout, _PQueue_instances, doesIntervalAllowAnother_get, doesConcurrentAllowAnother_get, next_fn, onResumeInterval_fn, isIntervalPaused_get, tryToStartAnother_fn, initializeIntervalIfNeeded_fn, onInterval_fn, processQueue_fn, throwOnAbort_fn, onEvent_fn;
|
|
535
|
-
var PQueue = class extends import_index.default {
|
|
536
|
-
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
537
|
-
constructor(options) {
|
|
538
|
-
super();
|
|
539
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _PQueue_instances);
|
|
540
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _carryoverConcurrencyCount);
|
|
541
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _isIntervalIgnored);
|
|
542
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _intervalCount, 0);
|
|
543
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _intervalCap);
|
|
544
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _interval);
|
|
545
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _intervalEnd, 0);
|
|
546
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _intervalId);
|
|
547
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _timeoutId);
|
|
548
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _queue2);
|
|
549
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _queueClass);
|
|
550
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _pending, 0);
|
|
551
|
-
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
552
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _concurrency);
|
|
553
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _isPaused);
|
|
554
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _throwOnTimeout);
|
|
555
|
-
/**
|
|
556
|
-
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
557
|
-
|
|
558
|
-
Applies to each future operation.
|
|
559
|
-
*/
|
|
560
|
-
_chunkXCPFG6DOcjs.__publicField.call(void 0, this, "timeout");
|
|
561
|
-
options = {
|
|
562
|
-
carryoverConcurrencyCount: false,
|
|
563
|
-
intervalCap: Number.POSITIVE_INFINITY,
|
|
564
|
-
interval: 0,
|
|
565
|
-
concurrency: Number.POSITIVE_INFINITY,
|
|
566
|
-
autoStart: true,
|
|
567
|
-
queueClass: PriorityQueue,
|
|
568
|
-
...options
|
|
569
|
-
};
|
|
570
|
-
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
571
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _17 => _17.intervalCap, 'optionalAccess', _18 => _18.toString, 'call', _19 => _19()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
572
|
-
}
|
|
573
|
-
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
574
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _20 => _20.interval, 'optionalAccess', _21 => _21.toString, 'call', _22 => _22()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
575
|
-
}
|
|
576
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _carryoverConcurrencyCount, options.carryoverConcurrencyCount);
|
|
577
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _isIntervalIgnored, options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0);
|
|
578
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalCap, options.intervalCap);
|
|
579
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _interval, options.interval);
|
|
580
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _queue2, new options.queueClass());
|
|
581
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _queueClass, options.queueClass);
|
|
582
|
-
this.concurrency = options.concurrency;
|
|
583
|
-
this.timeout = options.timeout;
|
|
584
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _throwOnTimeout, options.throwOnTimeout === true);
|
|
585
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _isPaused, options.autoStart === false);
|
|
586
|
-
}
|
|
587
|
-
get concurrency() {
|
|
588
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _concurrency);
|
|
589
|
-
}
|
|
590
|
-
set concurrency(newConcurrency) {
|
|
591
|
-
if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
|
|
592
|
-
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
|
|
593
|
-
}
|
|
594
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _concurrency, newConcurrency);
|
|
595
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, processQueue_fn).call(this);
|
|
596
|
-
}
|
|
597
|
-
async add(function_, options = {}) {
|
|
598
|
-
options = {
|
|
599
|
-
timeout: this.timeout,
|
|
600
|
-
throwOnTimeout: _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _throwOnTimeout),
|
|
601
|
-
...options
|
|
602
|
-
};
|
|
603
|
-
return new Promise((resolve2, reject) => {
|
|
604
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).enqueue(async () => {
|
|
605
|
-
_chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _pending)._++;
|
|
606
|
-
_chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _intervalCount)._++;
|
|
607
|
-
try {
|
|
608
|
-
_optionalChain([options, 'access', _23 => _23.signal, 'optionalAccess', _24 => _24.throwIfAborted, 'call', _25 => _25()]);
|
|
609
|
-
let operation = function_({ signal: options.signal });
|
|
610
|
-
if (options.timeout) {
|
|
611
|
-
operation = pTimeout(Promise.resolve(operation), { milliseconds: options.timeout });
|
|
612
|
-
}
|
|
613
|
-
if (options.signal) {
|
|
614
|
-
operation = Promise.race([operation, _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, throwOnAbort_fn).call(this, options.signal)]);
|
|
615
|
-
}
|
|
616
|
-
const result = await operation;
|
|
617
|
-
resolve2(result);
|
|
618
|
-
this.emit("completed", result);
|
|
619
|
-
} catch (error) {
|
|
620
|
-
if (error instanceof TimeoutError && !options.throwOnTimeout) {
|
|
621
|
-
resolve2();
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
reject(error);
|
|
625
|
-
this.emit("error", error);
|
|
626
|
-
} finally {
|
|
627
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, next_fn).call(this);
|
|
628
|
-
}
|
|
629
|
-
}, options);
|
|
630
|
-
this.emit("add");
|
|
631
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, tryToStartAnother_fn).call(this);
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
async addAll(functions, options) {
|
|
635
|
-
return Promise.all(functions.map(async (function_) => this.add(function_, options)));
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
639
|
-
*/
|
|
640
|
-
start() {
|
|
641
|
-
if (!_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _isPaused)) {
|
|
642
|
-
return this;
|
|
643
|
-
}
|
|
644
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _isPaused, false);
|
|
645
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, processQueue_fn).call(this);
|
|
646
|
-
return this;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
Put queue execution on hold.
|
|
650
|
-
*/
|
|
651
|
-
pause() {
|
|
652
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _isPaused, true);
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
Clear the queue.
|
|
656
|
-
*/
|
|
657
|
-
clear() {
|
|
658
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _queue2, new (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queueClass))());
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
662
|
-
|
|
663
|
-
@returns A promise that settles when the queue becomes empty.
|
|
664
|
-
*/
|
|
665
|
-
async onEmpty() {
|
|
666
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
await _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, onEvent_fn).call(this, "empty");
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
673
|
-
|
|
674
|
-
If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.
|
|
675
|
-
|
|
676
|
-
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
677
|
-
*/
|
|
678
|
-
async onSizeLessThan(limit) {
|
|
679
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).size < limit) {
|
|
680
|
-
return;
|
|
681
|
-
}
|
|
682
|
-
await _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, onEvent_fn).call(this, "next", () => _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).size < limit);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
686
|
-
|
|
687
|
-
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
688
|
-
*/
|
|
689
|
-
async onIdle() {
|
|
690
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending) === 0 && _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
await _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, onEvent_fn).call(this, "idle");
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
Size of the queue, the number of queued items waiting to run.
|
|
697
|
-
*/
|
|
698
|
-
get size() {
|
|
699
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).size;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
Size of the queue, filtered by the given options.
|
|
703
|
-
|
|
704
|
-
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
705
|
-
*/
|
|
706
|
-
sizeBy(options) {
|
|
707
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).filter(options).length;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
Number of running items (no longer in the queue).
|
|
711
|
-
*/
|
|
712
|
-
get pending() {
|
|
713
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending);
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
Whether the queue is currently paused.
|
|
717
|
-
*/
|
|
718
|
-
get isPaused() {
|
|
719
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _isPaused);
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
_carryoverConcurrencyCount = new WeakMap();
|
|
723
|
-
_isIntervalIgnored = new WeakMap();
|
|
724
|
-
_intervalCount = new WeakMap();
|
|
725
|
-
_intervalCap = new WeakMap();
|
|
726
|
-
_interval = new WeakMap();
|
|
727
|
-
_intervalEnd = new WeakMap();
|
|
728
|
-
_intervalId = new WeakMap();
|
|
729
|
-
_timeoutId = new WeakMap();
|
|
730
|
-
_queue2 = new WeakMap();
|
|
731
|
-
_queueClass = new WeakMap();
|
|
732
|
-
_pending = new WeakMap();
|
|
733
|
-
_concurrency = new WeakMap();
|
|
734
|
-
_isPaused = new WeakMap();
|
|
735
|
-
_throwOnTimeout = new WeakMap();
|
|
736
|
-
_PQueue_instances = new WeakSet();
|
|
737
|
-
doesIntervalAllowAnother_get = function() {
|
|
738
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _isIntervalIgnored) || _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalCount) < _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalCap);
|
|
739
|
-
};
|
|
740
|
-
doesConcurrentAllowAnother_get = function() {
|
|
741
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending) < _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _concurrency);
|
|
742
|
-
};
|
|
743
|
-
next_fn = function() {
|
|
744
|
-
_chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _pending)._--;
|
|
745
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, tryToStartAnother_fn).call(this);
|
|
746
|
-
this.emit("next");
|
|
747
|
-
};
|
|
748
|
-
onResumeInterval_fn = function() {
|
|
749
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, onInterval_fn).call(this);
|
|
750
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, initializeIntervalIfNeeded_fn).call(this);
|
|
751
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _timeoutId, void 0);
|
|
752
|
-
};
|
|
753
|
-
isIntervalPaused_get = function() {
|
|
754
|
-
const now = Date.now();
|
|
755
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalId) === void 0) {
|
|
756
|
-
const delay = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalEnd) - now;
|
|
757
|
-
if (delay < 0) {
|
|
758
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalCount, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _carryoverConcurrencyCount) ? _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending) : 0);
|
|
759
|
-
} else {
|
|
760
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _timeoutId) === void 0) {
|
|
761
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _timeoutId, setTimeout(() => {
|
|
762
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, onResumeInterval_fn).call(this);
|
|
763
|
-
}, delay));
|
|
764
|
-
}
|
|
765
|
-
return true;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
return false;
|
|
769
|
-
};
|
|
770
|
-
tryToStartAnother_fn = function() {
|
|
771
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
|
|
772
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalId)) {
|
|
773
|
-
clearInterval(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalId));
|
|
774
|
-
}
|
|
775
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalId, void 0);
|
|
776
|
-
this.emit("empty");
|
|
777
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending) === 0) {
|
|
778
|
-
this.emit("idle");
|
|
779
|
-
}
|
|
780
|
-
return false;
|
|
781
|
-
}
|
|
782
|
-
if (!_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _isPaused)) {
|
|
783
|
-
const canInitializeInterval = !_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _PQueue_instances, isIntervalPaused_get);
|
|
784
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _PQueue_instances, doesIntervalAllowAnother_get) && _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _PQueue_instances, doesConcurrentAllowAnother_get)) {
|
|
785
|
-
const job = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _queue2).dequeue();
|
|
786
|
-
if (!job) {
|
|
787
|
-
return false;
|
|
788
|
-
}
|
|
789
|
-
this.emit("active");
|
|
790
|
-
job();
|
|
791
|
-
if (canInitializeInterval) {
|
|
792
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, initializeIntervalIfNeeded_fn).call(this);
|
|
793
|
-
}
|
|
794
|
-
return true;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return false;
|
|
798
|
-
};
|
|
799
|
-
initializeIntervalIfNeeded_fn = function() {
|
|
800
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _isIntervalIgnored) || _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalId) !== void 0) {
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalId, setInterval(() => {
|
|
804
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, onInterval_fn).call(this);
|
|
805
|
-
}, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _interval)));
|
|
806
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalEnd, Date.now() + _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _interval));
|
|
807
|
-
};
|
|
808
|
-
onInterval_fn = function() {
|
|
809
|
-
if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalCount) === 0 && _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending) === 0 && _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalId)) {
|
|
810
|
-
clearInterval(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _intervalId));
|
|
811
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalId, void 0);
|
|
812
|
-
}
|
|
813
|
-
_chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _intervalCount, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _carryoverConcurrencyCount) ? _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _pending) : 0);
|
|
814
|
-
_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, processQueue_fn).call(this);
|
|
815
|
-
};
|
|
816
|
-
/**
|
|
817
|
-
Executes all queued functions until it reaches the limit.
|
|
818
|
-
*/
|
|
819
|
-
processQueue_fn = function() {
|
|
820
|
-
while (_chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PQueue_instances, tryToStartAnother_fn).call(this)) {
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
throwOnAbort_fn = async function(signal) {
|
|
824
|
-
return new Promise((_resolve, reject) => {
|
|
825
|
-
signal.addEventListener("abort", () => {
|
|
826
|
-
reject(signal.reason);
|
|
827
|
-
}, { once: true });
|
|
828
|
-
});
|
|
829
|
-
};
|
|
830
|
-
onEvent_fn = async function(event, filter) {
|
|
831
|
-
return new Promise((resolve2) => {
|
|
832
|
-
const listener = () => {
|
|
833
|
-
if (filter && !filter()) {
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
836
|
-
this.off(event, listener);
|
|
837
|
-
resolve2();
|
|
838
|
-
};
|
|
839
|
-
this.on(event, listener);
|
|
840
|
-
});
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
// src/FileManager.ts
|
|
844
|
-
var _filesByPath, _files, _FileManager_instances, add_fn, addOrAppend_fn;
|
|
845
|
-
var _FileManager = class _FileManager {
|
|
846
|
-
constructor() {
|
|
847
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _FileManager_instances);
|
|
848
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _filesByPath, /* @__PURE__ */ new Map());
|
|
849
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _files, /* @__PURE__ */ new Set());
|
|
850
|
-
return this;
|
|
851
|
-
}
|
|
852
|
-
get files() {
|
|
853
|
-
return Array.from(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files));
|
|
854
|
-
}
|
|
855
|
-
get orderedFiles() {
|
|
856
|
-
return _chunk67C6RBGQcjs.orderBy.call(void 0, Array.from(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files)), [
|
|
857
|
-
(v) => v.path.length,
|
|
858
|
-
(v) => _fs.trimExtName.call(void 0, v.path).endsWith("index"),
|
|
859
|
-
(v) => _fs.trimExtName.call(void 0, v.baseName),
|
|
860
|
-
(v) => v.path.split(".").pop()
|
|
861
|
-
]);
|
|
862
|
-
}
|
|
863
|
-
get groupedFiles() {
|
|
864
|
-
return buildDirectoryTree(Array.from(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files)));
|
|
865
|
-
}
|
|
866
|
-
get treeNode() {
|
|
867
|
-
return TreeNode.build(Array.from(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files)));
|
|
868
|
-
}
|
|
869
|
-
async add(...files) {
|
|
870
|
-
const promises = files.map((file) => {
|
|
871
|
-
if (file.override) {
|
|
872
|
-
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _FileManager_instances, add_fn).call(this, file);
|
|
873
|
-
}
|
|
874
|
-
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _FileManager_instances, addOrAppend_fn).call(this, file);
|
|
875
|
-
});
|
|
876
|
-
const resolvedFiles = await Promise.all(promises);
|
|
877
|
-
if (files.length > 1) {
|
|
878
|
-
return resolvedFiles;
|
|
879
|
-
}
|
|
880
|
-
return resolvedFiles[0];
|
|
881
|
-
}
|
|
882
|
-
getCacheById(id) {
|
|
883
|
-
let cache;
|
|
884
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files).forEach((file) => {
|
|
885
|
-
if (file.id === id) {
|
|
886
|
-
cache = file;
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
return cache;
|
|
890
|
-
}
|
|
891
|
-
getByPath(path2) {
|
|
892
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _filesByPath).get(path2);
|
|
893
|
-
}
|
|
894
|
-
deleteByPath(path2) {
|
|
895
|
-
const cacheItem = this.getByPath(path2);
|
|
896
|
-
if (!cacheItem) {
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _filesByPath).delete(path2);
|
|
900
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files).delete(cacheItem);
|
|
901
|
-
}
|
|
902
|
-
async getIndexFiles({ files, plugin, root, output, logger, options = {} }) {
|
|
903
|
-
const { exportType = "barrel" } = output;
|
|
904
|
-
if (exportType === false) {
|
|
905
|
-
return [];
|
|
906
|
-
}
|
|
907
|
-
const pathToBuildFrom = _path.resolve.call(void 0, root, output.path);
|
|
908
|
-
if (_fs.trimExtName.call(void 0, pathToBuildFrom).endsWith("index")) {
|
|
909
|
-
logger.emit("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation");
|
|
910
|
-
return [];
|
|
911
|
-
}
|
|
912
|
-
const exportPath = output.path.startsWith("./") ? output.path : `./${output.path}`;
|
|
913
|
-
const mode = _FileManager.getMode(output.path);
|
|
914
|
-
const barrelManager = new BarrelManager({ ...options, extName: output.extName });
|
|
915
|
-
let indexFiles = barrelManager.getIndexes(files, pathToBuildFrom);
|
|
916
|
-
if (!indexFiles) {
|
|
917
|
-
return [];
|
|
918
|
-
}
|
|
919
|
-
const rootPath = mode === "split" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
|
|
920
|
-
const rootFile = {
|
|
921
|
-
path: _path.resolve.call(void 0, root, "index.ts"),
|
|
922
|
-
baseName: "index.ts",
|
|
923
|
-
exports: [
|
|
924
|
-
output.exportAs ? {
|
|
925
|
-
name: output.exportAs,
|
|
926
|
-
asAlias: true,
|
|
927
|
-
path: rootPath,
|
|
928
|
-
isTypeOnly: options.isTypeOnly
|
|
929
|
-
} : {
|
|
930
|
-
path: rootPath,
|
|
931
|
-
isTypeOnly: options.isTypeOnly
|
|
932
|
-
}
|
|
933
|
-
],
|
|
934
|
-
sources: [],
|
|
935
|
-
meta: {
|
|
936
|
-
pluginKey: plugin.key
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
if (exportType === "barrel") {
|
|
940
|
-
indexFiles = indexFiles.map((file) => {
|
|
941
|
-
return {
|
|
942
|
-
...file,
|
|
943
|
-
exports: _optionalChain([file, 'access', _26 => _26.exports, 'optionalAccess', _27 => _27.map, 'call', _28 => _28((exportItem) => {
|
|
944
|
-
return {
|
|
945
|
-
...exportItem,
|
|
946
|
-
name: void 0
|
|
947
|
-
};
|
|
948
|
-
})])
|
|
949
|
-
};
|
|
950
|
-
});
|
|
951
|
-
rootFile.exports = _optionalChain([rootFile, 'access', _29 => _29.exports, 'optionalAccess', _30 => _30.map, 'call', _31 => _31((item) => {
|
|
952
|
-
return {
|
|
953
|
-
...item,
|
|
954
|
-
name: void 0
|
|
955
|
-
};
|
|
956
|
-
})]);
|
|
957
|
-
}
|
|
958
|
-
return [
|
|
959
|
-
...indexFiles.map((indexFile) => {
|
|
960
|
-
return {
|
|
961
|
-
...indexFile,
|
|
962
|
-
meta: {
|
|
963
|
-
pluginKey: plugin.key
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
}),
|
|
967
|
-
rootFile
|
|
968
|
-
];
|
|
969
|
-
}
|
|
970
|
-
async write(...params) {
|
|
971
|
-
return _fs.write.call(void 0, ...params);
|
|
972
|
-
}
|
|
973
|
-
async read(...params) {
|
|
974
|
-
return _fs.read.call(void 0, ...params);
|
|
975
|
-
}
|
|
976
|
-
// statics
|
|
977
|
-
static getMode(path2) {
|
|
978
|
-
if (!path2) {
|
|
979
|
-
return "split";
|
|
980
|
-
}
|
|
981
|
-
return _path.extname.call(void 0, path2) ? "single" : "split";
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
_filesByPath = new WeakMap();
|
|
985
|
-
_files = new WeakMap();
|
|
986
|
-
_FileManager_instances = new WeakSet();
|
|
987
|
-
add_fn = async function(file) {
|
|
988
|
-
const resolvedFile = _chunkL3JJLZ5Qcjs.createFile.call(void 0, file);
|
|
989
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _filesByPath).set(resolvedFile.path, resolvedFile);
|
|
990
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files).add(resolvedFile);
|
|
991
|
-
return resolvedFile;
|
|
992
|
-
};
|
|
993
|
-
addOrAppend_fn = async function(file) {
|
|
994
|
-
const previousFile = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _filesByPath).get(file.path);
|
|
995
|
-
if (previousFile) {
|
|
996
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _filesByPath).delete(previousFile.path);
|
|
997
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _files).delete(previousFile);
|
|
998
|
-
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _FileManager_instances, add_fn).call(this, {
|
|
999
|
-
...file,
|
|
1000
|
-
sources: [...previousFile.sources || [], ...file.sources || []],
|
|
1001
|
-
imports: [...previousFile.imports || [], ...file.imports || []],
|
|
1002
|
-
exports: [...previousFile.exports || [], ...file.exports || []]
|
|
1003
|
-
});
|
|
1004
|
-
}
|
|
1005
|
-
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _FileManager_instances, add_fn).call(this, file);
|
|
1006
|
-
};
|
|
1007
|
-
var FileManager = _FileManager;
|
|
1008
|
-
async function getSource(file) {
|
|
1009
|
-
const parser = await _chunkL3JJLZ5Qcjs.getFileParser.call(void 0, file.extName);
|
|
1010
|
-
const source = file.sources.map((item) => item.value).join("\n\n");
|
|
1011
|
-
const exports = file.exports ? combineExports(file.exports) : [];
|
|
1012
|
-
const imports = file.imports && source ? combineImports(file.imports, exports, source) : [];
|
|
1013
|
-
const importNodes = imports.filter((item) => {
|
|
1014
|
-
const path2 = item.root ? _fs.getRelativePath.call(void 0, item.root, item.path) : item.path;
|
|
1015
|
-
return path2 !== _fs.trimExtName.call(void 0, file.path);
|
|
1016
|
-
}).map((item) => {
|
|
1017
|
-
const path2 = item.root ? _fs.getRelativePath.call(void 0, item.root, item.path) : item.path;
|
|
1018
|
-
return parser.createImport({
|
|
1019
|
-
name: item.name,
|
|
1020
|
-
path: item.extName ? `${path2}${item.extName}` : path2,
|
|
1021
|
-
isTypeOnly: item.isTypeOnly
|
|
1022
|
-
});
|
|
1023
|
-
});
|
|
1024
|
-
const exportNodes = exports.map((item) => {
|
|
1025
|
-
if (item.path) {
|
|
1026
|
-
return parser.createExport({
|
|
1027
|
-
name: item.name,
|
|
1028
|
-
path: item.extName ? `${item.path}${item.extName}` : item.path,
|
|
1029
|
-
isTypeOnly: item.isTypeOnly,
|
|
1030
|
-
asAlias: item.asAlias
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
}).filter(Boolean);
|
|
1034
|
-
return parser.print({
|
|
1035
|
-
imports: importNodes,
|
|
1036
|
-
exports: exportNodes,
|
|
1037
|
-
source
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
function combineExports(exports) {
|
|
1041
|
-
const combinedExports = _chunk67C6RBGQcjs.orderBy.call(void 0, exports, [(v) => !v.isTypeOnly], ["asc"]).reduce(
|
|
1042
|
-
(prev, curr) => {
|
|
1043
|
-
const name = curr.name;
|
|
1044
|
-
const prevByPath = prev.findLast((imp) => imp.path === curr.path);
|
|
1045
|
-
const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && _remeda.isDeepEqual.call(void 0, imp.name, name) && imp.isTypeOnly);
|
|
1046
|
-
if (prevByPathAndIsTypeOnly) {
|
|
1047
|
-
return prev;
|
|
1048
|
-
}
|
|
1049
|
-
const uniquePrev = prev.findLast(
|
|
1050
|
-
(imp) => imp.path === curr.path && _remeda.isDeepEqual.call(void 0, imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
|
|
1051
|
-
);
|
|
1052
|
-
if (uniquePrev || Array.isArray(name) && !name.length || _optionalChain([prevByPath, 'optionalAccess', _32 => _32.asAlias]) && !curr.asAlias) {
|
|
1053
|
-
return prev;
|
|
1054
|
-
}
|
|
1055
|
-
if (!prevByPath) {
|
|
1056
|
-
return [
|
|
1057
|
-
...prev,
|
|
1058
|
-
{
|
|
1059
|
-
...curr,
|
|
1060
|
-
name: Array.isArray(name) ? [...new Set(name)] : name
|
|
1061
|
-
}
|
|
1062
|
-
];
|
|
1063
|
-
}
|
|
1064
|
-
if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
|
|
1065
|
-
prevByPath.name = [.../* @__PURE__ */ new Set([...prevByPath.name, ...curr.name])];
|
|
1066
|
-
return prev;
|
|
1067
|
-
}
|
|
1068
|
-
return [...prev, curr];
|
|
1069
|
-
},
|
|
1070
|
-
[]
|
|
1071
|
-
);
|
|
1072
|
-
return _chunk67C6RBGQcjs.orderBy.call(void 0, combinedExports, [(v) => !v.isTypeOnly, (v) => v.asAlias]);
|
|
1073
|
-
}
|
|
1074
|
-
function combineImports(imports, exports, source) {
|
|
1075
|
-
const combinedImports = _chunk67C6RBGQcjs.orderBy.call(void 0, imports, [(v) => !v.isTypeOnly], ["asc"]).reduce(
|
|
1076
|
-
(prev, curr) => {
|
|
1077
|
-
let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
|
|
1078
|
-
const hasImportInSource = (importName) => {
|
|
1079
|
-
if (!source) {
|
|
1080
|
-
return true;
|
|
1081
|
-
}
|
|
1082
|
-
const checker = (name2) => name2 && !!source.includes(name2);
|
|
1083
|
-
return checker(importName) || exports.some(({ name: name2 }) => Array.isArray(name2) ? name2.some(checker) : checker(name2));
|
|
1084
|
-
};
|
|
1085
|
-
if (curr.path === curr.root) {
|
|
1086
|
-
return prev;
|
|
1087
|
-
}
|
|
1088
|
-
if (Array.isArray(name)) {
|
|
1089
|
-
name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
|
|
1090
|
-
}
|
|
1091
|
-
const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
|
|
1092
|
-
const uniquePrev = prev.findLast((imp) => imp.path === curr.path && _remeda.isDeepEqual.call(void 0, imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
|
|
1093
|
-
const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && _remeda.isDeepEqual.call(void 0, imp.name, name) && imp.isTypeOnly);
|
|
1094
|
-
if (prevByPathNameAndIsTypeOnly) {
|
|
1095
|
-
return prev;
|
|
1096
|
-
}
|
|
1097
|
-
if (uniquePrev || Array.isArray(name) && !name.length) {
|
|
1098
|
-
return prev;
|
|
1099
|
-
}
|
|
1100
|
-
if (!prevByPath) {
|
|
1101
|
-
return [
|
|
1102
|
-
...prev,
|
|
1103
|
-
{
|
|
1104
|
-
...curr,
|
|
1105
|
-
name
|
|
1106
|
-
}
|
|
1107
|
-
];
|
|
1108
|
-
}
|
|
1109
|
-
if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
|
|
1110
|
-
prevByPath.name = [.../* @__PURE__ */ new Set([...prevByPath.name, ...name])];
|
|
1111
|
-
return prev;
|
|
1112
|
-
}
|
|
1113
|
-
if (!Array.isArray(name) && name && !hasImportInSource(name)) {
|
|
1114
|
-
return prev;
|
|
1115
|
-
}
|
|
1116
|
-
return [...prev, curr];
|
|
1117
|
-
},
|
|
1118
|
-
[]
|
|
1119
|
-
);
|
|
1120
|
-
return _chunk67C6RBGQcjs.orderBy.call(void 0, combinedImports, [(v) => !v.isTypeOnly]);
|
|
1121
|
-
}
|
|
1122
|
-
var queue = new PQueue({ concurrency: 100 });
|
|
1123
|
-
async function processFiles({ dryRun, config, logger, files }) {
|
|
1124
|
-
const orderedFiles = _chunk67C6RBGQcjs.orderBy.call(void 0, files, [
|
|
1125
|
-
(v) => _optionalChain([v, 'optionalAccess', _33 => _33.meta]) && "pluginKey" in v.meta && !v.meta.pluginKey,
|
|
1126
|
-
(v) => v.path.length,
|
|
1127
|
-
(v) => _fs.trimExtName.call(void 0, v.path).endsWith("index")
|
|
1128
|
-
]);
|
|
1129
|
-
logger.emit("debug", {
|
|
1130
|
-
logs: [JSON.stringify({ files: orderedFiles }, null, 2)],
|
|
1131
|
-
fileName: "kubb-files.json",
|
|
1132
|
-
override: true
|
|
1133
|
-
});
|
|
1134
|
-
if (!dryRun) {
|
|
1135
|
-
const size = orderedFiles.length;
|
|
1136
|
-
logger.emit("progress_start", { id: "files", size });
|
|
1137
|
-
const promises = orderedFiles.map(async (file) => {
|
|
1138
|
-
await queue.add(async () => {
|
|
1139
|
-
const source = await getSource(file);
|
|
1140
|
-
await _fs.write.call(void 0, file.path, source, { sanity: false });
|
|
1141
|
-
logger.emit("progress", { id: "files", data: file ? _path.relative.call(void 0, config.root, file.path) : "" });
|
|
1142
|
-
});
|
|
1143
|
-
});
|
|
1144
|
-
await Promise.all(promises);
|
|
1145
|
-
logger.emit("progress_stop", { id: "files" });
|
|
1146
|
-
}
|
|
1147
|
-
return files;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
exports.FileManager = FileManager; exports.getSource = getSource; exports.processFiles = processFiles;
|
|
1155
|
-
//# sourceMappingURL=chunk-DCZQYCCO.cjs.map
|