@kubb/core 5.12.4 → 5.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,7 +19,7 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
19
19
|
});
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region package.json
|
|
22
|
-
var version = "5.12.
|
|
22
|
+
var version = "5.12.6";
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region ../../internals/utils/src/casing.ts
|
|
25
25
|
/**
|
|
@@ -29,12 +29,23 @@ var version = "5.12.4";
|
|
|
29
29
|
*
|
|
30
30
|
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
31
31
|
*/
|
|
32
|
-
function
|
|
32
|
+
function convert(text, pascal) {
|
|
33
33
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
34
34
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
35
35
|
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
36
36
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
37
37
|
}
|
|
38
|
+
const cache = /* @__PURE__ */ new Map();
|
|
39
|
+
const cacheLimit = 1e4;
|
|
40
|
+
function toCamelOrPascal(text, pascal) {
|
|
41
|
+
const key = `${pascal ? "P" : "c"}${text}`;
|
|
42
|
+
const cached = cache.get(key);
|
|
43
|
+
if (cached !== void 0) return cached;
|
|
44
|
+
const result = convert(text, pascal);
|
|
45
|
+
if (cache.size >= cacheLimit) cache.clear();
|
|
46
|
+
cache.set(key, result);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
38
49
|
/**
|
|
39
50
|
* Converts `text` to camelCase.
|
|
40
51
|
*
|
|
@@ -2124,6 +2135,7 @@ function createProgress(files, config, hooks) {
|
|
|
2124
2135
|
*/
|
|
2125
2136
|
var FileManager = class {
|
|
2126
2137
|
#cache = /* @__PURE__ */ new Map();
|
|
2138
|
+
#pending = /* @__PURE__ */ new Set();
|
|
2127
2139
|
#sorted = null;
|
|
2128
2140
|
add(...files) {
|
|
2129
2141
|
return this.#store(files, false);
|
|
@@ -2137,20 +2149,35 @@ var FileManager = class {
|
|
|
2137
2149
|
var _usingCtx$1 = _usingCtx();
|
|
2138
2150
|
if (!result) return;
|
|
2139
2151
|
if (Array.isArray(result)) {
|
|
2140
|
-
this
|
|
2152
|
+
this.#defer(result);
|
|
2141
2153
|
return;
|
|
2142
2154
|
}
|
|
2143
2155
|
if (!renderer) return;
|
|
2144
2156
|
const instance = _usingCtx$1.u(renderer());
|
|
2145
2157
|
await instance.render(result);
|
|
2146
|
-
this
|
|
2158
|
+
this.#defer(instance.files);
|
|
2147
2159
|
} catch (_) {
|
|
2148
2160
|
_usingCtx$1.e = _;
|
|
2149
2161
|
} finally {
|
|
2150
2162
|
_usingCtx$1.d();
|
|
2151
2163
|
}
|
|
2152
2164
|
}
|
|
2165
|
+
/** Upserts without normalizing: the raw merge waits in `#pending` until the file is read. */
|
|
2166
|
+
#defer(files) {
|
|
2167
|
+
for (const file of files) {
|
|
2168
|
+
const existing = this.#cache.get(file.path);
|
|
2169
|
+
this.#cache.set(file.path, existing ? mergeFile(existing, file) : file);
|
|
2170
|
+
this.#pending.add(file.path);
|
|
2171
|
+
}
|
|
2172
|
+
if (files.length > 0) this.#sorted = null;
|
|
2173
|
+
}
|
|
2174
|
+
/** Normalizes the pending raw merges, so every entry in `#cache` is a `createFile` result. */
|
|
2175
|
+
#flush() {
|
|
2176
|
+
for (const path of this.#pending) this.#cache.set(path, ast.factory.createFile(this.#cache.get(path)));
|
|
2177
|
+
this.#pending.clear();
|
|
2178
|
+
}
|
|
2153
2179
|
#store(files, mergeExisting) {
|
|
2180
|
+
this.#flush();
|
|
2154
2181
|
const batch = /* @__PURE__ */ new Set();
|
|
2155
2182
|
const resolved = files.map((file) => {
|
|
2156
2183
|
const existing = this.#cache.get(file.path);
|
|
@@ -2167,6 +2194,7 @@ var FileManager = class {
|
|
|
2167
2194
|
*/
|
|
2168
2195
|
dispose() {
|
|
2169
2196
|
this.#cache.clear();
|
|
2197
|
+
this.#pending.clear();
|
|
2170
2198
|
this.#sorted = null;
|
|
2171
2199
|
}
|
|
2172
2200
|
/**
|
|
@@ -2174,6 +2202,7 @@ var FileManager = class {
|
|
|
2174
2202
|
* last within a length bucket). Returns a cached view, do not mutate.
|
|
2175
2203
|
*/
|
|
2176
2204
|
get files() {
|
|
2205
|
+
this.#flush();
|
|
2177
2206
|
return this.#sorted ??= [...this.#cache.values()].sort(compareFiles);
|
|
2178
2207
|
}
|
|
2179
2208
|
/**
|
|
@@ -3088,4 +3117,4 @@ var Hookable = class {
|
|
|
3088
3117
|
//#endregion
|
|
3089
3118
|
export { formatMs as A, toError as B, useConfig as C, defineExtension as D, checkCompatibility as E, listFiles as F, __name as H, read as I, rm$1 as L, inParallel as M, existsSync$1 as N, resolveMeta as O, isPathInside as P, write as R, tryUseKubb as S, useOptions as T, camelCase as V, kubbContext as _, FileManager as a, setOptions as b, Resolver as c, isPublicAddress as d, assertPluginOption as f, injectFile as g, addMacro as h, createNodeCache as i, getElapsedMs as j, Diagnostics as k, getInputKind as l, addGenerator as m, KubbDriver as n, _usingCtx as o, definePlugin as p, pluginNotFoundError as r, createResolver as s, Hookable as t, checkoutGitInput as u, requirePlugin as v, useKubb as w, setResolver as x, setMacros as y, writeRaw as z };
|
|
3090
3119
|
|
|
3091
|
-
//# sourceMappingURL=Hookable-
|
|
3120
|
+
//# sourceMappingURL=Hookable-C36PcF-8.js.map
|