@powerlines/plugin-automd 0.1.341 → 0.1.343
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/README.md +14 -16
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -3
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/index.cjs +26 -27
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -6
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/toc.d.cts.map +1 -1
- package/dist/types/toc.d.mts.map +1 -1
- package/package.json +20 -18
- package/dist/_virtual/rolldown_runtime.mjs +0 -32
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -78
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -78
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.cjs +0 -5089
- package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.mjs +0 -5089
- package/dist/node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.mjs.map +0 -1
- package/dist/node_modules/.pnpm/automd@0.4.3_patch_hash_5b5d5334735dce5e1ae79d8924a5aa49e4139453056613d618786b961793a42b_magicast@0.5.2/node_modules/automd/dist/index.cjs +0 -654
- package/dist/node_modules/.pnpm/automd@0.4.3_patch_hash_5b5d5334735dce5e1ae79d8924a5aa49e4139453056613d618786b961793a42b_magicast@0.5.2/node_modules/automd/dist/index.mjs +0 -652
- package/dist/node_modules/.pnpm/automd@0.4.3_patch_hash_5b5d5334735dce5e1ae79d8924a5aa49e4139453056613d618786b961793a42b_magicast@0.5.2/node_modules/automd/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.cjs +0 -23
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs +0 -23
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs.map +0 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.cjs +0 -10
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs +0 -11
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs.map +0 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.cjs +0 -388
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs +0 -388
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs.map +0 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.cjs +0 -11
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs +0 -12
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs.map +0 -1
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.cjs +0 -46
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +0 -46
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.cjs +0 -204
- package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs +0 -203
- package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.cjs +0 -1013
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +0 -1008
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.cjs +0 -128
- package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs +0 -124
- package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs.map +0 -1
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.cjs +0 -41464
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.mjs +0 -41462
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.mjs.map +0 -1
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.cjs +0 -4387
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.mjs +0 -4385
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.mjs.map +0 -1
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.cjs +0 -26
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs +0 -27
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs.map +0 -1
- package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.cjs +0 -370
- package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs +0 -368
- package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -939
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -940
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.cjs +0 -67
- package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.mjs +0 -65
- package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.cjs +0 -1350
- package/dist/node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.mjs +0 -1343
- package/dist/node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -179
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -178
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs.map +0 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs +0 -20
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +0 -17
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.cjs +0 -3975
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +0 -3962
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs.map +0 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.cjs +0 -16
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +0 -15
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs.map +0 -1
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.cjs +0 -36
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs +0 -34
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs.map +0 -1
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.cjs +0 -227
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs +0 -226
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs.map +0 -1
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -139
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -134
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs.map +0 -1
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs +0 -78
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +0 -78
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.cjs +0 -72
- package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs +0 -70
- package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.cjs +0 -181
- package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs +0 -179
- package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.cjs +0 -12337
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs +0 -12338
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs.map +0 -1
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.cjs +0 -19
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs +0 -19
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs.map +0 -1
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.cjs +0 -71
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs +0 -72
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs.map +0 -1
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.cjs +0 -110
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs +0 -101
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs.map +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_jiti = require('../../../../../jiti@2.4.2/node_modules/jiti/lib/jiti.cjs');
|
|
3
|
-
const require_untyped_BTwOq8Jl = require('../shared/untyped.BTwOq8Jl.cjs');
|
|
4
|
-
const require_babel = require('./babel.cjs');
|
|
5
|
-
let defu = require("defu");
|
|
6
|
-
|
|
7
|
-
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
8
|
-
async function loadSchema(entryPath, options = {}) {
|
|
9
|
-
let rawSchema = await require_jiti.createJiti(options.cwd || process.cwd(), (0, defu.defu)(options.jiti, {
|
|
10
|
-
interopDefault: true,
|
|
11
|
-
transformOptions: { babel: { plugins: [[require_babel.babelPluginUntyped, { experimentalFunctions: true }]] } }
|
|
12
|
-
})).import(entryPath);
|
|
13
|
-
const rawSchemaKeys = Object.keys(rawSchema);
|
|
14
|
-
if (rawSchemaKeys.length === 1 && rawSchemaKeys[0] === "default") rawSchema = rawSchema.default;
|
|
15
|
-
return await require_untyped_BTwOq8Jl.resolveSchema(rawSchema, options.defaults, { ignoreDefaults: options.ignoreDefaults });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
exports.loadSchema = loadSchema;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createJiti } from "../../../../../jiti@2.4.2/node_modules/jiti/lib/jiti.mjs";
|
|
2
|
-
import { resolveSchema } from "../shared/untyped.BTwOq8Jl.mjs";
|
|
3
|
-
import { babelPluginUntyped } from "./babel.mjs";
|
|
4
|
-
import { defu as defu$1 } from "defu";
|
|
5
|
-
|
|
6
|
-
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
7
|
-
async function loadSchema(entryPath, options = {}) {
|
|
8
|
-
let rawSchema = await createJiti(options.cwd || process.cwd(), defu$1(options.jiti, {
|
|
9
|
-
interopDefault: true,
|
|
10
|
-
transformOptions: { babel: { plugins: [[babelPluginUntyped, { experimentalFunctions: true }]] } }
|
|
11
|
-
})).import(entryPath);
|
|
12
|
-
const rawSchemaKeys = Object.keys(rawSchema);
|
|
13
|
-
if (rawSchemaKeys.length === 1 && rawSchemaKeys[0] === "default") rawSchema = rawSchema.default;
|
|
14
|
-
return await resolveSchema(rawSchema, options.defaults, { ignoreDefaults: options.ignoreDefaults });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { loadSchema };
|
|
19
|
-
//# sourceMappingURL=loader.mjs.map
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.mjs","names":["defu"],"sources":["../../../../../../../../../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs"],"sourcesContent":["import { defu } from 'defu';\nimport { createJiti } from 'jiti';\nimport { r as resolveSchema } from '../shared/untyped.BTwOq8Jl.mjs';\nimport babelPluginUntyped from './babel.mjs';\nimport '../shared/untyped.Br_uXjZG.mjs';\nimport 'scule';\n\nasync function loadSchema(entryPath, options = {}) {\n const jiti = createJiti(\n options.cwd || process.cwd(),\n defu(options.jiti, {\n interopDefault: true,\n transformOptions: {\n babel: {\n plugins: [[babelPluginUntyped, { experimentalFunctions: true }]]\n }\n }\n })\n );\n let rawSchema = await jiti.import(entryPath);\n const rawSchemaKeys = Object.keys(rawSchema);\n if (rawSchemaKeys.length === 1 && rawSchemaKeys[0] === \"default\") {\n rawSchema = rawSchema.default;\n }\n const schema = await resolveSchema(rawSchema, options.defaults, {\n ignoreDefaults: options.ignoreDefaults\n });\n return schema;\n}\n\nexport { loadSchema };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAOA,eAAe,WAAW,WAAW,UAAU,EAAE,EAAE;CAYjD,IAAI,YAAY,MAXH,WACX,QAAQ,OAAO,QAAQ,KAAK,EAC5BA,OAAK,QAAQ,MAAM;EACjB,gBAAgB;EAChB,kBAAkB,EAChB,OAAO,EACL,SAAS,CAAC,CAAC,oBAAoB,EAAE,uBAAuB,MAAM,CAAC,CAAC,EACjE,EACF;EACF,CAAC,CACH,CAC0B,OAAO,UAAU;CAC5C,MAAM,gBAAgB,OAAO,KAAK,UAAU;AAC5C,KAAI,cAAc,WAAW,KAAK,cAAc,OAAO,UACrD,aAAY,UAAU;AAKxB,QAHe,MAAM,cAAc,WAAW,QAAQ,UAAU,EAC9D,gBAAgB,QAAQ,gBACzB,CAAC"}
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.cjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const require_untyped_Br_uXjZG = require('./untyped.Br_uXjZG.cjs');
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs
|
|
4
|
-
async function resolveSchema(obj, defaults, options = {}) {
|
|
5
|
-
return await _resolveSchema(obj, "", {
|
|
6
|
-
root: obj,
|
|
7
|
-
defaults,
|
|
8
|
-
resolveCache: {},
|
|
9
|
-
ignoreDefaults: !!options.ignoreDefaults
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
async function _resolveSchema(input, id, ctx) {
|
|
13
|
-
if (id in ctx.resolveCache) return ctx.resolveCache[id];
|
|
14
|
-
const schemaId = "#" + id.replace(/\./g, "/");
|
|
15
|
-
if (!require_untyped_Br_uXjZG.isObject(input)) {
|
|
16
|
-
const safeInput = Array.isArray(input) ? [...input] : input;
|
|
17
|
-
const schema2 = {
|
|
18
|
-
type: require_untyped_Br_uXjZG.getType(input),
|
|
19
|
-
id: schemaId,
|
|
20
|
-
default: ctx.ignoreDefaults ? void 0 : safeInput
|
|
21
|
-
};
|
|
22
|
-
normalizeSchema(schema2, { ignoreDefaults: ctx.ignoreDefaults });
|
|
23
|
-
ctx.resolveCache[id] = schema2;
|
|
24
|
-
if (ctx.defaults && require_untyped_Br_uXjZG.getValue(ctx.defaults, id) === void 0) require_untyped_Br_uXjZG.setValue(ctx.defaults, id, schema2.default);
|
|
25
|
-
return schema2;
|
|
26
|
-
}
|
|
27
|
-
const node = { ...input };
|
|
28
|
-
const schema = ctx.resolveCache[id] = {
|
|
29
|
-
...node.$schema,
|
|
30
|
-
id: schemaId
|
|
31
|
-
};
|
|
32
|
-
for (const key in node) {
|
|
33
|
-
if (key === "$resolve" || key === "$schema" || key === "$default") continue;
|
|
34
|
-
schema.properties = schema.properties || {};
|
|
35
|
-
if (!schema.properties[key]) {
|
|
36
|
-
const child = schema.properties[key] = await _resolveSchema(node[key], require_untyped_Br_uXjZG.joinPath(id, key), ctx);
|
|
37
|
-
if (Array.isArray(child.tags) && child.tags.includes("@required")) {
|
|
38
|
-
schema.required = schema.required || [];
|
|
39
|
-
if (!schema.required.includes(key)) schema.required.push(key);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!ctx.ignoreDefaults) {
|
|
44
|
-
if (ctx.defaults) schema.default = require_untyped_Br_uXjZG.getValue(ctx.defaults, id);
|
|
45
|
-
if (schema.default === void 0 && "$default" in node) schema.default = node.$default;
|
|
46
|
-
if (typeof node.$resolve === "function") schema.default = await node.$resolve(schema.default, async (key) => {
|
|
47
|
-
return (await _resolveSchema(require_untyped_Br_uXjZG.getValue(ctx.root, key), key, ctx)).default;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (ctx.defaults) require_untyped_Br_uXjZG.setValue(ctx.defaults, id, schema.default);
|
|
51
|
-
if (!schema.type) schema.type = require_untyped_Br_uXjZG.getType(schema.default) || (schema.properties ? "object" : "any");
|
|
52
|
-
normalizeSchema(schema, { ignoreDefaults: ctx.ignoreDefaults });
|
|
53
|
-
if (ctx.defaults && require_untyped_Br_uXjZG.getValue(ctx.defaults, id) === void 0) require_untyped_Br_uXjZG.setValue(ctx.defaults, id, schema.default);
|
|
54
|
-
return schema;
|
|
55
|
-
}
|
|
56
|
-
function normalizeSchema(schema, options) {
|
|
57
|
-
if (schema.type === "array" && !("items" in schema)) {
|
|
58
|
-
schema.items = { type: require_untyped_Br_uXjZG.nonEmpty(require_untyped_Br_uXjZG.unique(schema.default.map((i) => require_untyped_Br_uXjZG.getType(i)))) };
|
|
59
|
-
if (schema.items.type) {
|
|
60
|
-
if (schema.items.type.length === 0) schema.items.type = "any";
|
|
61
|
-
else if (schema.items.type.length === 1) schema.items.type = schema.items.type[0];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (!options.ignoreDefaults && schema.default === void 0 && ("properties" in schema || schema.type === "object" || schema.type === "any")) {
|
|
65
|
-
const propsWithDefaults = Object.entries(schema.properties || {}).filter(([, prop]) => "default" in prop).map(([key, value]) => [key, value.default]);
|
|
66
|
-
schema.default = Object.fromEntries(propsWithDefaults);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
exports.resolveSchema = resolveSchema;
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { getType, getValue, isObject, joinPath, nonEmpty, setValue, unique } from "./untyped.Br_uXjZG.mjs";
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs
|
|
4
|
-
async function resolveSchema(obj, defaults, options = {}) {
|
|
5
|
-
return await _resolveSchema(obj, "", {
|
|
6
|
-
root: obj,
|
|
7
|
-
defaults,
|
|
8
|
-
resolveCache: {},
|
|
9
|
-
ignoreDefaults: !!options.ignoreDefaults
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
async function _resolveSchema(input, id, ctx) {
|
|
13
|
-
if (id in ctx.resolveCache) return ctx.resolveCache[id];
|
|
14
|
-
const schemaId = "#" + id.replace(/\./g, "/");
|
|
15
|
-
if (!isObject(input)) {
|
|
16
|
-
const safeInput = Array.isArray(input) ? [...input] : input;
|
|
17
|
-
const schema2 = {
|
|
18
|
-
type: getType(input),
|
|
19
|
-
id: schemaId,
|
|
20
|
-
default: ctx.ignoreDefaults ? void 0 : safeInput
|
|
21
|
-
};
|
|
22
|
-
normalizeSchema(schema2, { ignoreDefaults: ctx.ignoreDefaults });
|
|
23
|
-
ctx.resolveCache[id] = schema2;
|
|
24
|
-
if (ctx.defaults && getValue(ctx.defaults, id) === void 0) setValue(ctx.defaults, id, schema2.default);
|
|
25
|
-
return schema2;
|
|
26
|
-
}
|
|
27
|
-
const node = { ...input };
|
|
28
|
-
const schema = ctx.resolveCache[id] = {
|
|
29
|
-
...node.$schema,
|
|
30
|
-
id: schemaId
|
|
31
|
-
};
|
|
32
|
-
for (const key in node) {
|
|
33
|
-
if (key === "$resolve" || key === "$schema" || key === "$default") continue;
|
|
34
|
-
schema.properties = schema.properties || {};
|
|
35
|
-
if (!schema.properties[key]) {
|
|
36
|
-
const child = schema.properties[key] = await _resolveSchema(node[key], joinPath(id, key), ctx);
|
|
37
|
-
if (Array.isArray(child.tags) && child.tags.includes("@required")) {
|
|
38
|
-
schema.required = schema.required || [];
|
|
39
|
-
if (!schema.required.includes(key)) schema.required.push(key);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!ctx.ignoreDefaults) {
|
|
44
|
-
if (ctx.defaults) schema.default = getValue(ctx.defaults, id);
|
|
45
|
-
if (schema.default === void 0 && "$default" in node) schema.default = node.$default;
|
|
46
|
-
if (typeof node.$resolve === "function") schema.default = await node.$resolve(schema.default, async (key) => {
|
|
47
|
-
return (await _resolveSchema(getValue(ctx.root, key), key, ctx)).default;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (ctx.defaults) setValue(ctx.defaults, id, schema.default);
|
|
51
|
-
if (!schema.type) schema.type = getType(schema.default) || (schema.properties ? "object" : "any");
|
|
52
|
-
normalizeSchema(schema, { ignoreDefaults: ctx.ignoreDefaults });
|
|
53
|
-
if (ctx.defaults && getValue(ctx.defaults, id) === void 0) setValue(ctx.defaults, id, schema.default);
|
|
54
|
-
return schema;
|
|
55
|
-
}
|
|
56
|
-
function normalizeSchema(schema, options) {
|
|
57
|
-
if (schema.type === "array" && !("items" in schema)) {
|
|
58
|
-
schema.items = { type: nonEmpty(unique(schema.default.map((i) => getType(i)))) };
|
|
59
|
-
if (schema.items.type) {
|
|
60
|
-
if (schema.items.type.length === 0) schema.items.type = "any";
|
|
61
|
-
else if (schema.items.type.length === 1) schema.items.type = schema.items.type[0];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (!options.ignoreDefaults && schema.default === void 0 && ("properties" in schema || schema.type === "object" || schema.type === "any")) {
|
|
65
|
-
const propsWithDefaults = Object.entries(schema.properties || {}).filter(([, prop]) => "default" in prop).map(([key, value]) => [key, value.default]);
|
|
66
|
-
schema.default = Object.fromEntries(propsWithDefaults);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { resolveSchema };
|
|
72
|
-
//# sourceMappingURL=untyped.BTwOq8Jl.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"untyped.BTwOq8Jl.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs"],"sourcesContent":["import { i as isObject, g as getType, a as getValue, s as setValue, j as joinPath, b as nonEmpty, u as unique } from './untyped.Br_uXjZG.mjs';\n\nasync function resolveSchema(obj, defaults, options = {}) {\n const schema = await _resolveSchema(obj, \"\", {\n root: obj,\n defaults,\n resolveCache: {},\n ignoreDefaults: !!options.ignoreDefaults\n });\n return schema;\n}\nasync function _resolveSchema(input, id, ctx) {\n if (id in ctx.resolveCache) {\n return ctx.resolveCache[id];\n }\n const schemaId = \"#\" + id.replace(/\\./g, \"/\");\n if (!isObject(input)) {\n const safeInput = Array.isArray(input) ? [...input] : input;\n const schema2 = {\n type: getType(input),\n id: schemaId,\n default: ctx.ignoreDefaults ? void 0 : safeInput\n };\n normalizeSchema(schema2, { ignoreDefaults: ctx.ignoreDefaults });\n ctx.resolveCache[id] = schema2;\n if (ctx.defaults && getValue(ctx.defaults, id) === void 0) {\n setValue(ctx.defaults, id, schema2.default);\n }\n return schema2;\n }\n const node = { ...input };\n const schema = ctx.resolveCache[id] = {\n ...node.$schema,\n id: schemaId\n };\n for (const key in node) {\n if (key === \"$resolve\" || key === \"$schema\" || key === \"$default\") {\n continue;\n }\n schema.properties = schema.properties || {};\n if (!schema.properties[key]) {\n const child = schema.properties[key] = await _resolveSchema(\n node[key],\n joinPath(id, key),\n ctx\n );\n if (Array.isArray(child.tags) && child.tags.includes(\"@required\")) {\n schema.required = schema.required || [];\n if (!schema.required.includes(key)) {\n schema.required.push(key);\n }\n }\n }\n }\n if (!ctx.ignoreDefaults) {\n if (ctx.defaults) {\n schema.default = getValue(ctx.defaults, id);\n }\n if (schema.default === void 0 && \"$default\" in node) {\n schema.default = node.$default;\n }\n if (typeof node.$resolve === \"function\") {\n schema.default = await node.$resolve(schema.default, async (key) => {\n return (await _resolveSchema(getValue(ctx.root, key), key, ctx)).default;\n });\n }\n }\n if (ctx.defaults) {\n setValue(ctx.defaults, id, schema.default);\n }\n if (!schema.type) {\n schema.type = getType(schema.default) || (schema.properties ? \"object\" : \"any\");\n }\n normalizeSchema(schema, { ignoreDefaults: ctx.ignoreDefaults });\n if (ctx.defaults && getValue(ctx.defaults, id) === void 0) {\n setValue(ctx.defaults, id, schema.default);\n }\n return schema;\n}\nasync function applyDefaults(ref, input) {\n await resolveSchema(ref, input);\n return input;\n}\nfunction normalizeSchema(schema, options) {\n if (schema.type === \"array\" && !(\"items\" in schema)) {\n schema.items = {\n type: nonEmpty(unique(schema.default.map((i) => getType(i))))\n };\n if (schema.items.type) {\n if (schema.items.type.length === 0) {\n schema.items.type = \"any\";\n } else if (schema.items.type.length === 1) {\n schema.items.type = schema.items.type[0];\n }\n }\n }\n if (!options.ignoreDefaults && schema.default === void 0 && (\"properties\" in schema || schema.type === \"object\" || schema.type === \"any\")) {\n const propsWithDefaults = Object.entries(schema.properties || {}).filter(([, prop]) => \"default\" in prop).map(([key, value]) => [key, value.default]);\n schema.default = Object.fromEntries(propsWithDefaults);\n }\n}\n\nexport { applyDefaults as a, resolveSchema as r };\n"],"x_google_ignoreList":[0],"mappings":";;;AAEA,eAAe,cAAc,KAAK,UAAU,UAAU,EAAE,EAAE;AAOxD,QANe,MAAM,eAAe,KAAK,IAAI;EAC3C,MAAM;EACN;EACA,cAAc,EAAE;EAChB,gBAAgB,CAAC,CAAC,QAAQ;EAC3B,CAAC;;AAGJ,eAAe,eAAe,OAAO,IAAI,KAAK;AAC5C,KAAI,MAAM,IAAI,aACZ,QAAO,IAAI,aAAa;CAE1B,MAAM,WAAW,MAAM,GAAG,QAAQ,OAAO,IAAI;AAC7C,KAAI,CAAC,SAAS,MAAM,EAAE;EACpB,MAAM,YAAY,MAAM,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG;EACtD,MAAM,UAAU;GACd,MAAM,QAAQ,MAAM;GACpB,IAAI;GACJ,SAAS,IAAI,iBAAiB,KAAK,IAAI;GACxC;AACD,kBAAgB,SAAS,EAAE,gBAAgB,IAAI,gBAAgB,CAAC;AAChE,MAAI,aAAa,MAAM;AACvB,MAAI,IAAI,YAAY,SAAS,IAAI,UAAU,GAAG,KAAK,KAAK,EACtD,UAAS,IAAI,UAAU,IAAI,QAAQ,QAAQ;AAE7C,SAAO;;CAET,MAAM,OAAO,EAAE,GAAG,OAAO;CACzB,MAAM,SAAS,IAAI,aAAa,MAAM;EACpC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S,OAAO,OAAO,QAAQ,KAAK,MAAM,QAAQ,EAAE,CAAC,CAAC,CAAC,EAC9D;AACD,MAAI,OAAO,MAAM,MACf;OAAI,OAAO,MAAM,KAAK,WAAW,EAC/B,QAAO,MAAM,OAAO;YACX,OAAO,MAAM,KAAK,WAAW,EACtC,QAAO,MAAM,OAAO,OAAO,MAAM,KAAK;;;AAI5C,KAAI,CAAC,QAAQ,kBAAkB,OAAO,YAAY,KAAK,MAAM,gBAAgB,UAAU,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ;EACzI,MAAM,oBAAoB,OAAO,QAAQ,OAAO,cAAc,EAAE,CAAC,CAAC,QAAQ,GAAG,UAAU,aAAa,KAAK,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,MAAM,QAAQ,CAAC;AACrJ,SAAO,UAAU,OAAO,YAAY,kBAAkB"}
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.cjs
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
const require_index = require('../../../../../scule@1.3.0/node_modules/scule/dist/index.cjs');
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs
|
|
4
|
-
function getType(val) {
|
|
5
|
-
const type = typeof val;
|
|
6
|
-
if (type === "undefined" || val === null) return;
|
|
7
|
-
if (Array.isArray(val)) return "array";
|
|
8
|
-
return type;
|
|
9
|
-
}
|
|
10
|
-
function isObject(val) {
|
|
11
|
-
return val !== null && !Array.isArray(val) && typeof val === "object";
|
|
12
|
-
}
|
|
13
|
-
function nonEmpty(arr) {
|
|
14
|
-
return arr.filter(Boolean);
|
|
15
|
-
}
|
|
16
|
-
function unique(arr) {
|
|
17
|
-
return [...new Set(arr)];
|
|
18
|
-
}
|
|
19
|
-
function joinPath(a, b = "", sep = ".") {
|
|
20
|
-
return a ? a + sep + b : b;
|
|
21
|
-
}
|
|
22
|
-
function setValue(obj, path, val) {
|
|
23
|
-
const keys = path.split(".");
|
|
24
|
-
const _key = keys.pop();
|
|
25
|
-
for (const key of keys) {
|
|
26
|
-
if (!obj || typeof obj !== "object") return;
|
|
27
|
-
if (!(key in obj)) obj[key] = {};
|
|
28
|
-
obj = obj[key];
|
|
29
|
-
}
|
|
30
|
-
if (_key) {
|
|
31
|
-
if (!obj || typeof obj !== "object") return;
|
|
32
|
-
obj[_key] = val;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function getValue(obj, path) {
|
|
36
|
-
for (const key of path.split(".")) {
|
|
37
|
-
if (!obj || typeof obj !== "object" || !(key in obj)) return;
|
|
38
|
-
obj = obj[key];
|
|
39
|
-
}
|
|
40
|
-
return obj;
|
|
41
|
-
}
|
|
42
|
-
function mergedTypes(...types) {
|
|
43
|
-
types = types.filter(Boolean);
|
|
44
|
-
if (types.length === 0) return {};
|
|
45
|
-
if (types.length === 1) return types[0];
|
|
46
|
-
const tsTypes = normalizeTypes(types.flatMap((t) => t.tsType).filter(Boolean));
|
|
47
|
-
return {
|
|
48
|
-
type: normalizeTypes(types.flatMap((t) => t.type).filter(Boolean)),
|
|
49
|
-
tsType: Array.isArray(tsTypes) ? tsTypes.join(" | ") : tsTypes,
|
|
50
|
-
items: mergedTypes(...types.flatMap((t) => t.items).filter(Boolean))
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function normalizeTypes(val) {
|
|
54
|
-
const arr = unique(val.filter(Boolean));
|
|
55
|
-
if (arr.length === 0 || arr.includes("any")) return;
|
|
56
|
-
return arr.length > 1 ? arr : arr[0];
|
|
57
|
-
}
|
|
58
|
-
function cachedFn(fn) {
|
|
59
|
-
let val;
|
|
60
|
-
let resolved = false;
|
|
61
|
-
const cachedFn2 = () => {
|
|
62
|
-
if (!resolved) {
|
|
63
|
-
val = fn();
|
|
64
|
-
resolved = true;
|
|
65
|
-
}
|
|
66
|
-
return val;
|
|
67
|
-
};
|
|
68
|
-
return cachedFn2;
|
|
69
|
-
}
|
|
70
|
-
const jsTypes = /* @__PURE__ */ new Set([
|
|
71
|
-
"string",
|
|
72
|
-
"number",
|
|
73
|
-
"bigint",
|
|
74
|
-
"boolean",
|
|
75
|
-
"symbol",
|
|
76
|
-
"function",
|
|
77
|
-
"object",
|
|
78
|
-
"any",
|
|
79
|
-
"array"
|
|
80
|
-
]);
|
|
81
|
-
function isJSType(val) {
|
|
82
|
-
return jsTypes.has(val);
|
|
83
|
-
}
|
|
84
|
-
const FRIENDLY_TYPE_RE = /(typeof )?import\(["'](?<importName>[^"']+)["']\)(\[["']|\.)(?<firstType>[^\s"']+)(["']])?/g;
|
|
85
|
-
function getTypeDescriptor(type) {
|
|
86
|
-
if (!type) return {};
|
|
87
|
-
let markdownType = type;
|
|
88
|
-
for (const match of type.matchAll(FRIENDLY_TYPE_RE) || []) {
|
|
89
|
-
const { importName, firstType } = match.groups || {};
|
|
90
|
-
if (importName && firstType) markdownType = markdownType.replace(match[0], require_index.pascalCase(importName) + require_index.pascalCase(firstType));
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
...isJSType(type) ? { type } : {},
|
|
94
|
-
tsType: type,
|
|
95
|
-
...markdownType === type ? {} : { markdownType }
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
exports.cachedFn = cachedFn;
|
|
101
|
-
exports.getType = getType;
|
|
102
|
-
exports.getTypeDescriptor = getTypeDescriptor;
|
|
103
|
-
exports.getValue = getValue;
|
|
104
|
-
exports.isObject = isObject;
|
|
105
|
-
exports.joinPath = joinPath;
|
|
106
|
-
exports.mergedTypes = mergedTypes;
|
|
107
|
-
exports.nonEmpty = nonEmpty;
|
|
108
|
-
exports.normalizeTypes = normalizeTypes;
|
|
109
|
-
exports.setValue = setValue;
|
|
110
|
-
exports.unique = unique;
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { pascalCase } from "../../../../../scule@1.3.0/node_modules/scule/dist/index.mjs";
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs
|
|
4
|
-
function getType(val) {
|
|
5
|
-
const type = typeof val;
|
|
6
|
-
if (type === "undefined" || val === null) return;
|
|
7
|
-
if (Array.isArray(val)) return "array";
|
|
8
|
-
return type;
|
|
9
|
-
}
|
|
10
|
-
function isObject(val) {
|
|
11
|
-
return val !== null && !Array.isArray(val) && typeof val === "object";
|
|
12
|
-
}
|
|
13
|
-
function nonEmpty(arr) {
|
|
14
|
-
return arr.filter(Boolean);
|
|
15
|
-
}
|
|
16
|
-
function unique(arr) {
|
|
17
|
-
return [...new Set(arr)];
|
|
18
|
-
}
|
|
19
|
-
function joinPath(a, b = "", sep = ".") {
|
|
20
|
-
return a ? a + sep + b : b;
|
|
21
|
-
}
|
|
22
|
-
function setValue(obj, path, val) {
|
|
23
|
-
const keys = path.split(".");
|
|
24
|
-
const _key = keys.pop();
|
|
25
|
-
for (const key of keys) {
|
|
26
|
-
if (!obj || typeof obj !== "object") return;
|
|
27
|
-
if (!(key in obj)) obj[key] = {};
|
|
28
|
-
obj = obj[key];
|
|
29
|
-
}
|
|
30
|
-
if (_key) {
|
|
31
|
-
if (!obj || typeof obj !== "object") return;
|
|
32
|
-
obj[_key] = val;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function getValue(obj, path) {
|
|
36
|
-
for (const key of path.split(".")) {
|
|
37
|
-
if (!obj || typeof obj !== "object" || !(key in obj)) return;
|
|
38
|
-
obj = obj[key];
|
|
39
|
-
}
|
|
40
|
-
return obj;
|
|
41
|
-
}
|
|
42
|
-
function mergedTypes(...types) {
|
|
43
|
-
types = types.filter(Boolean);
|
|
44
|
-
if (types.length === 0) return {};
|
|
45
|
-
if (types.length === 1) return types[0];
|
|
46
|
-
const tsTypes = normalizeTypes(types.flatMap((t) => t.tsType).filter(Boolean));
|
|
47
|
-
return {
|
|
48
|
-
type: normalizeTypes(types.flatMap((t) => t.type).filter(Boolean)),
|
|
49
|
-
tsType: Array.isArray(tsTypes) ? tsTypes.join(" | ") : tsTypes,
|
|
50
|
-
items: mergedTypes(...types.flatMap((t) => t.items).filter(Boolean))
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function normalizeTypes(val) {
|
|
54
|
-
const arr = unique(val.filter(Boolean));
|
|
55
|
-
if (arr.length === 0 || arr.includes("any")) return;
|
|
56
|
-
return arr.length > 1 ? arr : arr[0];
|
|
57
|
-
}
|
|
58
|
-
function cachedFn(fn) {
|
|
59
|
-
let val;
|
|
60
|
-
let resolved = false;
|
|
61
|
-
const cachedFn2 = () => {
|
|
62
|
-
if (!resolved) {
|
|
63
|
-
val = fn();
|
|
64
|
-
resolved = true;
|
|
65
|
-
}
|
|
66
|
-
return val;
|
|
67
|
-
};
|
|
68
|
-
return cachedFn2;
|
|
69
|
-
}
|
|
70
|
-
const jsTypes = /* @__PURE__ */ new Set([
|
|
71
|
-
"string",
|
|
72
|
-
"number",
|
|
73
|
-
"bigint",
|
|
74
|
-
"boolean",
|
|
75
|
-
"symbol",
|
|
76
|
-
"function",
|
|
77
|
-
"object",
|
|
78
|
-
"any",
|
|
79
|
-
"array"
|
|
80
|
-
]);
|
|
81
|
-
function isJSType(val) {
|
|
82
|
-
return jsTypes.has(val);
|
|
83
|
-
}
|
|
84
|
-
const FRIENDLY_TYPE_RE = /(typeof )?import\(["'](?<importName>[^"']+)["']\)(\[["']|\.)(?<firstType>[^\s"']+)(["']])?/g;
|
|
85
|
-
function getTypeDescriptor(type) {
|
|
86
|
-
if (!type) return {};
|
|
87
|
-
let markdownType = type;
|
|
88
|
-
for (const match of type.matchAll(FRIENDLY_TYPE_RE) || []) {
|
|
89
|
-
const { importName, firstType } = match.groups || {};
|
|
90
|
-
if (importName && firstType) markdownType = markdownType.replace(match[0], pascalCase(importName) + pascalCase(firstType));
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
...isJSType(type) ? { type } : {},
|
|
94
|
-
tsType: type,
|
|
95
|
-
...markdownType === type ? {} : { markdownType }
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
export { cachedFn, getType, getTypeDescriptor, getValue, isObject, joinPath, mergedTypes, nonEmpty, normalizeTypes, setValue, unique };
|
|
101
|
-
//# sourceMappingURL=untyped.Br_uXjZG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"untyped.Br_uXjZG.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs"],"sourcesContent":["import { pascalCase } from 'scule';\n\nfunction defineUntypedSchema(options) {\n return options;\n}\nfunction getType(val) {\n const type = typeof val;\n if (type === \"undefined\" || val === null) {\n return void 0;\n }\n if (Array.isArray(val)) {\n return \"array\";\n }\n return type;\n}\nfunction isObject(val) {\n return val !== null && !Array.isArray(val) && typeof val === \"object\";\n}\nfunction nonEmpty(arr) {\n return arr.filter(Boolean);\n}\nfunction unique(arr) {\n return [...new Set(arr)];\n}\nfunction joinPath(a, b = \"\", sep = \".\") {\n return a ? a + sep + b : b;\n}\nfunction setValue(obj, path, val) {\n const keys = path.split(\".\");\n const _key = keys.pop();\n for (const key of keys) {\n if (!obj || typeof obj !== \"object\") {\n return;\n }\n if (!(key in obj)) {\n obj[key] = {};\n }\n obj = obj[key];\n }\n if (_key) {\n if (!obj || typeof obj !== \"object\") {\n return;\n }\n obj[_key] = val;\n }\n}\nfunction getValue(obj, path) {\n for (const key of path.split(\".\")) {\n if (!obj || typeof obj !== \"object\" || !(key in obj)) {\n return;\n }\n obj = obj[key];\n }\n return obj;\n}\nfunction mergedTypes(...types) {\n types = types.filter(Boolean);\n if (types.length === 0) {\n return {};\n }\n if (types.length === 1) {\n return types[0];\n }\n const tsTypes = normalizeTypes(\n types.flatMap((t) => t.tsType).filter(Boolean)\n );\n return {\n type: normalizeTypes(\n types.flatMap((t) => t.type).filter(Boolean)\n ),\n tsType: Array.isArray(tsTypes) ? tsTypes.join(\" | \") : tsTypes,\n items: mergedTypes(\n ...types.flatMap((t) => t.items).filter(Boolean)\n )\n };\n}\nfunction normalizeTypes(val) {\n const arr = unique(val.filter(Boolean));\n if (arr.length === 0 || arr.includes(\"any\")) {\n return;\n }\n return arr.length > 1 ? arr : arr[0];\n}\nfunction cachedFn(fn) {\n let val;\n let resolved = false;\n const cachedFn2 = () => {\n if (!resolved) {\n val = fn();\n resolved = true;\n }\n return val;\n };\n return cachedFn2;\n}\nconst jsTypes = /* @__PURE__ */ new Set([\n \"string\",\n \"number\",\n \"bigint\",\n \"boolean\",\n \"symbol\",\n \"function\",\n \"object\",\n \"any\",\n \"array\"\n]);\nfunction isJSType(val) {\n return jsTypes.has(val);\n}\nconst FRIENDLY_TYPE_RE = /(typeof )?import\\([\"'](?<importName>[^\"']+)[\"']\\)(\\[[\"']|\\.)(?<firstType>[^\\s\"']+)([\"']])?/g;\nfunction getTypeDescriptor(type) {\n if (!type) {\n return {};\n }\n let markdownType = type;\n for (const match of type.matchAll(FRIENDLY_TYPE_RE) || []) {\n const { importName, firstType } = match.groups || {};\n if (importName && firstType) {\n markdownType = markdownType.replace(\n match[0],\n pascalCase(importName) + pascalCase(firstType)\n );\n }\n }\n return {\n ...isJSType(type) ? { type } : {},\n tsType: type,\n ...markdownType === type ? {} : { markdownType }\n };\n}\n\nexport { getValue as a, nonEmpty as b, getTypeDescriptor as c, defineUntypedSchema as d, cachedFn as e, getType as g, isObject as i, joinPath as j, mergedTypes as m, normalizeTypes as n, setValue as s, unique as u };\n"],"x_google_ignoreList":[0],"mappings":";;;AAKA,SAAS,QAAQ,KAAK;CACpB,MAAM,OAAO,OAAO;AACpB,KAAI,SAAS,eAAe,QAAQ,KAClC;AAEF,KA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