@kubb/core 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -85,7 +85,13 @@ declare class Queue {
|
|
|
85
85
|
private work;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
declare function
|
|
88
|
+
declare function escape(text?: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on
|
|
91
|
+
* @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
|
|
92
|
+
* @link https://github.com/joliss/js-string-escape/blob/master/index.js
|
|
93
|
+
*/
|
|
94
|
+
declare function jsStringEscape(input: any): string;
|
|
89
95
|
|
|
90
96
|
declare function transformReservedWord(word: string): string;
|
|
91
97
|
|
|
@@ -93,7 +99,7 @@ declare function combineCodes(codes: string[]): string;
|
|
|
93
99
|
|
|
94
100
|
declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
|
|
95
101
|
|
|
96
|
-
declare function clean(path: string): Promise<
|
|
102
|
+
declare function clean(path: string): Promise<void>;
|
|
97
103
|
|
|
98
104
|
type TreeNodeOptions = DirectoryTreeOptions;
|
|
99
105
|
declare class TreeNode<T = unknown> {
|
|
@@ -714,4 +720,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
|
|
|
714
720
|
abstract build(schema: TInput, name: string, description?: string): TOutput;
|
|
715
721
|
}
|
|
716
722
|
|
|
717
|
-
export { Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, Export, Extension, File, FileManager, FileName, Generator, Import, KubbConfig, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, OptionalPath, ParallelPluginError, ParseResult, Path, PathMode, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Queue, QueueJob, Register, ResolveNameParams, ResolvePathParams, ResolvedFile, SafeParseResult, SchemaGenerator, Source, Status, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLPath, UUID, ValidationPluginError, Warning, build, clean, combineCodes, combineFiles, createFunctionParams, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, extensions, getDependedPlugins,
|
|
723
|
+
export { Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, Export, Extension, File, FileManager, FileName, Generator, Import, KubbConfig, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, OptionalPath, ParallelPluginError, ParseResult, Path, PathMode, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Queue, QueueJob, Register, ResolveNameParams, ResolvePathParams, ResolvedFile, SafeParseResult, SchemaGenerator, Source, Status, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLPath, UUID, ValidationPluginError, Warning, build, clean, combineCodes, combineFiles, createFunctionParams, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getFileSource, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
package/dist/index.d.ts
CHANGED
|
@@ -85,7 +85,13 @@ declare class Queue {
|
|
|
85
85
|
private work;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
declare function
|
|
88
|
+
declare function escape(text?: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on
|
|
91
|
+
* @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
|
|
92
|
+
* @link https://github.com/joliss/js-string-escape/blob/master/index.js
|
|
93
|
+
*/
|
|
94
|
+
declare function jsStringEscape(input: any): string;
|
|
89
95
|
|
|
90
96
|
declare function transformReservedWord(word: string): string;
|
|
91
97
|
|
|
@@ -93,7 +99,7 @@ declare function combineCodes(codes: string[]): string;
|
|
|
93
99
|
|
|
94
100
|
declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
|
|
95
101
|
|
|
96
|
-
declare function clean(path: string): Promise<
|
|
102
|
+
declare function clean(path: string): Promise<void>;
|
|
97
103
|
|
|
98
104
|
type TreeNodeOptions = DirectoryTreeOptions;
|
|
99
105
|
declare class TreeNode<T = unknown> {
|
|
@@ -714,4 +720,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
|
|
|
714
720
|
abstract build(schema: TInput, name: string, description?: string): TOutput;
|
|
715
721
|
}
|
|
716
722
|
|
|
717
|
-
export { Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, Export, Extension, File, FileManager, FileName, Generator, Import, KubbConfig, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, OptionalPath, ParallelPluginError, ParseResult, Path, PathMode, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Queue, QueueJob, Register, ResolveNameParams, ResolvePathParams, ResolvedFile, SafeParseResult, SchemaGenerator, Source, Status, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLPath, UUID, ValidationPluginError, Warning, build, clean, combineCodes, combineFiles, createFunctionParams, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, extensions, getDependedPlugins,
|
|
723
|
+
export { Argument0, BuildOutput, CLIOptions, Cache, CacheItem, Executer, Export, Extension, File, FileManager, FileName, Generator, Import, KubbConfig, KubbJSONPlugins, KubbObjectPlugin, KubbObjectPlugins, KubbPlugin, KubbPluginKind, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, OptionalPath, ParallelPluginError, ParseResult, Path, PathMode, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PossiblePromise, Queue, QueueJob, Register, ResolveNameParams, ResolvePathParams, ResolvedFile, SafeParseResult, SchemaGenerator, Source, Status, Strategy, SummaryError, TransformResult, TreeNode, TreeNodeOptions, URLPath, UUID, ValidationPluginError, Warning, build, clean, combineCodes, combineFiles, createFunctionParams, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getFileSource, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
|
-
import fs from 'fs-extra';
|
|
3
|
+
import fs, { remove } from 'fs-extra';
|
|
4
4
|
import pathParser2 from 'node:path';
|
|
5
5
|
import { switcher } from 'js-runtime';
|
|
6
6
|
import { camelCase, camelCaseTransformMerge } from 'change-case';
|
|
7
|
+
import { orderBy } from 'natural-orderby';
|
|
7
8
|
import { performance } from 'node:perf_hooks';
|
|
8
|
-
import { rimraf } from 'rimraf';
|
|
9
9
|
import dirTree from 'directory-tree';
|
|
10
10
|
import mod from 'node:module';
|
|
11
11
|
import { pathToFileURL } from 'node:url';
|
|
@@ -128,11 +128,8 @@ async function read(path) {
|
|
|
128
128
|
return reader(path);
|
|
129
129
|
}
|
|
130
130
|
function createFunctionParams(data) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const requiredB = b.required ?? true;
|
|
134
|
-
return requiredA === requiredB ? 0 : requiredA ? -1 : 1;
|
|
135
|
-
}).filter(({ enabled = true }) => enabled).reduce((acc, { name, type = false, required = true, ...rest }) => {
|
|
131
|
+
const sortedData = orderBy(data, [(v) => v.default, (v) => v.required ?? true], ["desc", "desc"]);
|
|
132
|
+
return sortedData.filter(({ enabled = true }) => enabled).reduce((acc, { name, type, required = true, ...rest }) => {
|
|
136
133
|
const parameterName = camelCase(name, { delimiter: "", transform: camelCaseTransformMerge });
|
|
137
134
|
if (type) {
|
|
138
135
|
if (required) {
|
|
@@ -244,10 +241,30 @@ var Queue = class {
|
|
|
244
241
|
}
|
|
245
242
|
};
|
|
246
243
|
|
|
247
|
-
// src/utils/transformers/
|
|
248
|
-
function
|
|
244
|
+
// src/utils/transformers/escape.ts
|
|
245
|
+
function escape(text) {
|
|
249
246
|
return text ? text.replaceAll("`", "\\`") : "";
|
|
250
247
|
}
|
|
248
|
+
function jsStringEscape(input) {
|
|
249
|
+
return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
|
|
250
|
+
switch (character) {
|
|
251
|
+
case '"':
|
|
252
|
+
case "'":
|
|
253
|
+
case "\\":
|
|
254
|
+
return "\\" + character;
|
|
255
|
+
case "\n":
|
|
256
|
+
return "\\n";
|
|
257
|
+
case "\r":
|
|
258
|
+
return "\\r";
|
|
259
|
+
case "\u2028":
|
|
260
|
+
return "\\u2028";
|
|
261
|
+
case "\u2029":
|
|
262
|
+
return "\\u2029";
|
|
263
|
+
default:
|
|
264
|
+
return "";
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
251
268
|
|
|
252
269
|
// src/utils/transformers/transformReservedWord.ts
|
|
253
270
|
var reservedWords = [
|
|
@@ -367,7 +384,7 @@ function renderTemplate(template, data = void 0) {
|
|
|
367
384
|
}, template) || "";
|
|
368
385
|
}
|
|
369
386
|
async function clean(path) {
|
|
370
|
-
return
|
|
387
|
+
return remove(path);
|
|
371
388
|
}
|
|
372
389
|
var TreeNode = class _TreeNode {
|
|
373
390
|
data;
|
|
@@ -1532,6 +1549,6 @@ var SchemaGenerator = class extends Generator {
|
|
|
1532
1549
|
// src/index.ts
|
|
1533
1550
|
var src_default = build;
|
|
1534
1551
|
|
|
1535
|
-
export { FileManager, Generator, LogLevel, ParallelPluginError, PluginError, PluginManager, Queue, SchemaGenerator, SummaryError, TreeNode, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineFiles, createFunctionParams, createJSDocBlockText, createLogger, createPlugin, createPluginCache, src_default as default, defaultColours, defineConfig, extensions, getDependedPlugins,
|
|
1552
|
+
export { FileManager, Generator, LogLevel, ParallelPluginError, PluginError, PluginManager, Queue, SchemaGenerator, SummaryError, TreeNode, URLPath, ValidationPluginError, Warning, build, clean, combineCodes, combineFiles, createFunctionParams, createJSDocBlockText, createLogger, createPlugin, createPluginCache, src_default as default, defaultColours, defineConfig, escape, extensions, getDependedPlugins, getFileSource, getIndexes, getLocation, getPathMode, getRelativePath, getUniqueName, hooks, importModule, isExtensionAllowed, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, jsStringEscape, pluginName as name, nameSorter, normalizeDirectory, pluginName, randomColour, randomPicoColour, read, renderTemplate, throttle, timeout, transformReservedWord, uniqueIdFactory, write };
|
|
1536
1553
|
//# sourceMappingURL=out.js.map
|
|
1537
1554
|
//# sourceMappingURL=index.js.map
|