@powerlines/plugin-automd 0.1.128 → 0.1.129
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/_virtual/rolldown_runtime.cjs +2 -0
- package/dist/_virtual/rolldown_runtime.mjs +32 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +7 -7
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +78 -0
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +77 -0
- package/dist/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/dist/acorn.cjs +5032 -0
- package/dist/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/dist/acorn.mjs +5031 -0
- package/dist/node_modules/.pnpm/automd@0.4.2_patch_hash_0fe864a2d6fa1461e144747e5f0fbc0a5fb51435ec6b3217ffb18ff2d7058778_magicast@0.5.1/node_modules/automd/dist/shared/automd.CjwUz8DJ.cjs +593 -0
- package/dist/node_modules/.pnpm/automd@0.4.2_patch_hash_0fe864a2d6fa1461e144747e5f0fbc0a5fb51435ec6b3217ffb18ff2d7058778_magicast@0.5.1/node_modules/automd/dist/shared/automd.CjwUz8DJ.mjs +590 -0
- package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DA7CpUDY.cjs +23 -0
- package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DA7CpUDY.mjs +22 -0
- package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DnMsyigM.cjs +405 -0
- package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs +404 -0
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.cjs +46 -0
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +45 -0
- package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.cjs +204 -0
- package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs +202 -0
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.cjs +1013 -0
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +1007 -0
- package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.cjs +128 -0
- package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs +123 -0
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.cjs +41464 -0
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.mjs +41461 -0
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.cjs +4387 -0
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.mjs +4384 -0
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.cjs +26 -0
- package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs +26 -0
- package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.cjs +370 -0
- package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs +367 -0
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +939 -0
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +939 -0
- package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.cjs +67 -0
- package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.mjs +64 -0
- package/dist/node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.cjs +1292 -0
- package/dist/node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs +1284 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +179 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +179 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs +20 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +18 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.cjs +3975 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +3961 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.cjs +16 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +14 -0
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.cjs +36 -0
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs +33 -0
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.cjs +227 -0
- package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs +225 -0
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +139 -0
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +133 -0
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs +77 -0
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +76 -0
- package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.cjs +72 -0
- package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs +69 -0
- package/dist/node_modules/.pnpm/ufo@1.6.2/node_modules/ufo/dist/index.cjs +178 -0
- package/dist/node_modules/.pnpm/ufo@1.6.2/node_modules/ufo/dist/index.mjs +175 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.cjs +12337 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs +12337 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.cjs +19 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs +18 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.cjs +71 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs +71 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.cjs +110 -0
- package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs +100 -0
- package/dist/types/plugin.d.mts +3 -3
- package/package.json +4 -5
- /package/dist/{powerlines → packages/powerlines}/src/internal/helpers/hooks.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/api.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/babel.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/build.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/commands.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/config.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/context.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/fs.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/hooks.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/plugin.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/resolved.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/tsconfig.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/unplugin.d.mts +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 } 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(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 };
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.cjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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 };
|
package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.cjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
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 };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UserConfig } from "../powerlines/src/types/config.mjs";
|
|
2
|
-
import { ResolvedConfig } from "../powerlines/src/types/resolved.mjs";
|
|
3
|
-
import { PluginContext } from "../powerlines/src/types/context.mjs";
|
|
1
|
+
import { UserConfig } from "../packages/powerlines/src/types/config.mjs";
|
|
2
|
+
import { ResolvedConfig } from "../packages/powerlines/src/types/resolved.mjs";
|
|
3
|
+
import { PluginContext } from "../packages/powerlines/src/types/context.mjs";
|
|
4
4
|
import { TOCOptions } from "./toc.mjs";
|
|
5
5
|
import { Config } from "automd";
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-automd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.129",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to maintain a project's markdown files using AutoMD generators.",
|
|
6
6
|
"repository": {
|
|
@@ -125,14 +125,13 @@
|
|
|
125
125
|
"c12": "^3.3.3",
|
|
126
126
|
"defu": "^6.1.4",
|
|
127
127
|
"markdown-toc": "^1.2.0",
|
|
128
|
-
"powerlines": "^0.37.
|
|
128
|
+
"powerlines": "^0.37.3"
|
|
129
129
|
},
|
|
130
130
|
"devDependencies": {
|
|
131
|
-
"@powerlines/
|
|
132
|
-
"@powerlines/plugin-plugin": "^0.12.80",
|
|
131
|
+
"@powerlines/plugin-plugin": "^0.12.81",
|
|
133
132
|
"@types/node": "^24.10.4",
|
|
134
133
|
"automd": "^0.4.2"
|
|
135
134
|
},
|
|
136
135
|
"publishConfig": { "access": "public" },
|
|
137
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "ae9a5afaa497538477b63988242f433b60974623"
|
|
138
137
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|