@powerlines/plugin-date 0.12.151 → 0.12.152
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/components/date-fns.cjs +3 -2
- package/dist/components/date-fns.mjs +1 -1
- package/dist/components/dayjs.cjs +3 -2
- package/dist/components/dayjs.mjs +1 -1
- package/dist/components/luxon.cjs +3 -2
- package/dist/components/luxon.mjs +1 -1
- package/dist/components/moment.cjs +3 -2
- package/dist/components/moment.mjs +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.cjs +43 -0
- package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs +42 -0
- package/dist/packages/plugin-alloy/src/types/components.d.mts +2 -0
- package/dist/{plugin-env → packages/plugin-env}/src/types/plugin.d.mts +1 -1
- package/dist/{powerlines → packages/powerlines}/src/types/build.d.mts +6 -6
- package/dist/{powerlines → packages/powerlines}/src/types/config.d.mts +1 -2
- package/dist/{powerlines → packages/powerlines}/src/types/tsconfig.d.mts +1 -1
- package/dist/types/plugin.d.mts +1 -1
- package/package.json +5 -5
- package/dist/deepkit/schemas/reflection.cjs +0 -3998
- package/dist/deepkit/schemas/reflection.mjs +0 -3996
- package/dist/deepkit/schemas/reflection2.cjs +0 -4112
- package/dist/deepkit/schemas/reflection2.mjs +0 -4110
- package/dist/deepkit/src/capnp.cjs +0 -913
- package/dist/deepkit/src/capnp.mjs +0 -911
- package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
- package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
- package/dist/deepkit/src/reflect-type.cjs +0 -22
- package/dist/deepkit/src/reflect-type.mjs +0 -20
- package/dist/deepkit/src/resolve-reflections.cjs +0 -16
- package/dist/deepkit/src/resolve-reflections.mjs +0 -15
- package/dist/deepkit/src/transformer.cjs +0 -52
- package/dist/deepkit/src/transformer.mjs +0 -49
- package/dist/deepkit/src/transpile.cjs +0 -29
- package/dist/deepkit/src/transpile.mjs +0 -27
- package/dist/deepkit/src/utilities.cjs +0 -66
- package/dist/deepkit/src/utilities.mjs +0 -65
- package/dist/plugin-alloy/src/core/components/output.cjs +0 -38
- package/dist/plugin-alloy/src/core/components/output.mjs +0 -37
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
- package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
- package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
- package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
- package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
- package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
- package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
- package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
- package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
- package/dist/plugin-alloy/src/index.cjs +0 -103
- package/dist/plugin-alloy/src/index.mjs +0 -101
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -7
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -9
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -5
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -7
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -17
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
- package/dist/plugin-alloy/src/types/components.d.mts +0 -3
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -47
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -46
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -75
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -73
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -359
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -350
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -153
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -150
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -53
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -52
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
- package/dist/plugin-automd/src/index.cjs +0 -101
- package/dist/plugin-automd/src/index.mjs +0 -98
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
- package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
- package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
- package/dist/plugin-babel/src/helpers/index.cjs +0 -5
- package/dist/plugin-babel/src/helpers/index.mjs +0 -7
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
- package/dist/plugin-babel/src/helpers/options.cjs +0 -50
- package/dist/plugin-babel/src/helpers/options.mjs +0 -47
- package/dist/plugin-babel/src/index.cjs +0 -91
- package/dist/plugin-babel/src/index.mjs +0 -89
- package/dist/plugin-env/src/babel/index.cjs +0 -1
- package/dist/plugin-env/src/babel/index.mjs +0 -3
- package/dist/plugin-env/src/babel/plugin.cjs +0 -121
- package/dist/plugin-env/src/babel/plugin.mjs +0 -119
- package/dist/plugin-env/src/components/docs.cjs +0 -9
- package/dist/plugin-env/src/components/docs.mjs +0 -11
- package/dist/plugin-env/src/components/env.cjs +0 -487
- package/dist/plugin-env/src/components/env.mjs +0 -484
- package/dist/plugin-env/src/components/index.cjs +0 -2
- package/dist/plugin-env/src/components/index.mjs +0 -4
- package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
- package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
- package/dist/plugin-env/src/helpers/index.cjs +0 -6
- package/dist/plugin-env/src/helpers/index.mjs +0 -8
- package/dist/plugin-env/src/helpers/load.cjs +0 -83
- package/dist/plugin-env/src/helpers/load.mjs +0 -80
- package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
- package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
- package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
- package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
- package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
- package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
- package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
- package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
- package/dist/plugin-env/src/index.cjs +0 -172
- package/dist/plugin-env/src/index.mjs +0 -170
- package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
- package/dist/powerlines/src/lib/entry.cjs +0 -12
- package/dist/powerlines/src/lib/entry.mjs +0 -14
- package/dist/powerlines/src/lib/logger.cjs +0 -41
- package/dist/powerlines/src/lib/logger.mjs +0 -39
- package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
- package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
- package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
- package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
- /package/dist/{deepkit → packages/deepkit}/schemas/reflection.d.mts +0 -0
- /package/dist/{deepkit → packages/deepkit}/src/types.d.mts +0 -0
- /package/dist/{plugin-alloy → packages/plugin-alloy}/src/types/index.d.mts +0 -0
- /package/dist/{plugin-alloy → packages/plugin-alloy}/src/types/plugin.d.mts +0 -0
- /package/dist/{plugin-automd → packages/plugin-automd}/src/types/plugin.d.mts +0 -0
- /package/dist/{plugin-automd → packages/plugin-automd}/src/types/toc.d.mts +0 -0
- /package/dist/{plugin-babel → packages/plugin-babel}/src/types/index.d.mts +0 -0
- /package/dist/{plugin-babel → packages/plugin-babel}/src/types/plugin.d.mts +0 -0
- /package/dist/{plugin-env → packages/plugin-env}/src/types/runtime.d.mts +0 -0
- /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/commands.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/unplugin.d.mts +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_reflection = require('../../core/contexts/reflection.cjs');
|
|
3
|
-
const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
4
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
5
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
9
|
-
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
10
|
-
|
|
11
|
-
//#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
|
|
12
|
-
/**
|
|
13
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
14
|
-
*/
|
|
15
|
-
function TypeScriptInterface(props) {
|
|
16
|
-
const [{ name, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["name", "reflection"]);
|
|
17
|
-
const interfaceName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_pascal_case.pascalCase)(((0, __stryke_type_checks_is_string.isString)(name) ? name : name.toString()) || reflection.getName()));
|
|
18
|
-
const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
|
|
19
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
|
|
20
|
-
value: { reflection },
|
|
21
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.InterfaceDeclaration, {
|
|
22
|
-
export: true,
|
|
23
|
-
name: interfaceName.value,
|
|
24
|
-
...rest,
|
|
25
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
|
|
26
|
-
each: properties,
|
|
27
|
-
doubleHardline: true,
|
|
28
|
-
semicolon: true,
|
|
29
|
-
children: (prop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptInterfaceProperty, { property: prop })
|
|
30
|
-
})
|
|
31
|
-
})]
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
36
|
-
*/
|
|
37
|
-
function TypescriptInterfaceProperty(props) {
|
|
38
|
-
const [{ property }, rest] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
39
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
40
|
-
value: property,
|
|
41
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.InterfaceMember, {
|
|
42
|
-
name: property.getNameAsString(),
|
|
43
|
-
readonly: property.isReadonly(),
|
|
44
|
-
optional: property.isOptional(),
|
|
45
|
-
nullish: property.isNullable(),
|
|
46
|
-
type: (0, __powerlines_deepkit_vendor_type.stringifyType)(property.getType()),
|
|
47
|
-
...rest
|
|
48
|
-
})]
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
exports.TypeScriptInterface = TypeScriptInterface;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
2
|
-
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
3
|
-
import { stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
4
|
-
import { For, computed, splitProps } from "@alloy-js/core";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
-
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
8
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
9
|
-
|
|
10
|
-
//#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
|
|
11
|
-
/**
|
|
12
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
13
|
-
*/
|
|
14
|
-
function TypeScriptInterface(props) {
|
|
15
|
-
const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
|
|
16
|
-
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
|
|
17
|
-
const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
|
|
18
|
-
return /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
|
|
19
|
-
value: { reflection },
|
|
20
|
-
children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsx(InterfaceDeclaration, {
|
|
21
|
-
export: true,
|
|
22
|
-
name: interfaceName.value,
|
|
23
|
-
...rest,
|
|
24
|
-
children: /* @__PURE__ */ jsx(For, {
|
|
25
|
-
each: properties,
|
|
26
|
-
doubleHardline: true,
|
|
27
|
-
semicolon: true,
|
|
28
|
-
children: (prop) => /* @__PURE__ */ jsx(TypescriptInterfaceProperty, { property: prop })
|
|
29
|
-
})
|
|
30
|
-
})]
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
35
|
-
*/
|
|
36
|
-
function TypescriptInterfaceProperty(props) {
|
|
37
|
-
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
38
|
-
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
39
|
-
value: property,
|
|
40
|
-
children: [/* @__PURE__ */ jsx(TSDocReflectionProperty, {}), /* @__PURE__ */ jsx(InterfaceMember, {
|
|
41
|
-
name: property.getNameAsString(),
|
|
42
|
-
readonly: property.isReadonly(),
|
|
43
|
-
optional: property.isOptional(),
|
|
44
|
-
nullish: property.isNullable(),
|
|
45
|
-
type: stringifyType(property.getType()),
|
|
46
|
-
...rest
|
|
47
|
-
})]
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
//#endregion
|
|
52
|
-
export { TypeScriptInterface };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_utilities = require('../../../../deepkit/src/utilities.cjs');
|
|
3
|
-
const require_reflection = require('../../core/contexts/reflection.cjs');
|
|
4
|
-
const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
5
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
|
-
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
9
|
-
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
10
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
|
-
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
12
|
-
|
|
13
|
-
//#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
|
|
14
|
-
/**
|
|
15
|
-
* Generates a TypeScript object for the given reflection class.
|
|
16
|
-
*/
|
|
17
|
-
function TypescriptObject(props) {
|
|
18
|
-
if (!props.reflection?.value) return null;
|
|
19
|
-
const objectName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_camel_case.camelCase)(((0, __stryke_type_checks_is_string.isString)(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
|
|
20
|
-
const objectType = (0, __alloy_js_core.computed)(() => props.type || (0, __stryke_string_format_pascal_case.pascalCase)(props.reflection.value.getName()));
|
|
21
|
-
const properties = (0, __alloy_js_core.computed)(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
|
|
22
|
-
if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
|
|
23
|
-
return ret;
|
|
24
|
-
}, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
|
|
25
|
-
const TypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
|
|
26
|
-
const ValueTypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
|
|
27
|
-
const sym = (0, __alloy_js_typescript.createValueSymbol)(props.name, {
|
|
28
|
-
refkeys: props.refkey,
|
|
29
|
-
default: props.default,
|
|
30
|
-
export: props.export,
|
|
31
|
-
metadata: props.metadata,
|
|
32
|
-
tsFlags: props.nullish ? __alloy_js_typescript.TSSymbolFlags.Nullish : __alloy_js_typescript.TSSymbolFlags.None,
|
|
33
|
-
type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
|
|
34
|
-
namePolicy: (0, __alloy_js_typescript.useTSNamePolicy)().for("variable")
|
|
35
|
-
});
|
|
36
|
-
if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
|
|
37
|
-
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
38
|
-
const type = props.type ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_typescript.TypeRefContext, { children: [": ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypeSymbolSlot, { children: props.type })] }) : void 0;
|
|
39
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
40
|
-
when: !!props.reflection.value,
|
|
41
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
|
|
42
|
-
value: {
|
|
43
|
-
reflection: props.reflection.value,
|
|
44
|
-
override: {
|
|
45
|
-
name: objectName.value,
|
|
46
|
-
type: objectType.value,
|
|
47
|
-
defaultValue: props.defaultValue?.value
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
51
|
-
when: !!objectName.value && !!objectType.value,
|
|
52
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Declaration, {
|
|
53
|
-
symbol: sym,
|
|
54
|
-
children: [
|
|
55
|
-
props.export ? "export " : "",
|
|
56
|
-
props.default ? "default " : "",
|
|
57
|
-
keyword,
|
|
58
|
-
" ",
|
|
59
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Name, {}),
|
|
60
|
-
type,
|
|
61
|
-
" =",
|
|
62
|
-
" ",
|
|
63
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ObjectExpression, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
|
|
64
|
-
each: properties.value ?? [],
|
|
65
|
-
comma: true,
|
|
66
|
-
doubleHardline: true,
|
|
67
|
-
children: (prop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptObjectProperty, { property: prop })
|
|
68
|
-
}) }) })
|
|
69
|
-
]
|
|
70
|
-
})]
|
|
71
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
|
|
72
|
-
})
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Generates a TypeScript object property for the given reflection class.
|
|
77
|
-
*/
|
|
78
|
-
function TypescriptObjectProperty(props) {
|
|
79
|
-
const [{ property }] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
80
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
81
|
-
value: property,
|
|
82
|
-
children: [
|
|
83
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}),
|
|
84
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ObjectProperty, {
|
|
85
|
-
name: property.getNameAsString(),
|
|
86
|
-
value: require_utilities.stringifyDefaultValue(property)
|
|
87
|
-
}),
|
|
88
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
|
|
89
|
-
]
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
exports.TypescriptObject = TypescriptObject;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { stringifyDefaultValue } from "../../../../deepkit/src/utilities.mjs";
|
|
2
|
-
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
3
|
-
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
4
|
-
import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
-
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
8
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
9
|
-
import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
10
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
11
|
-
|
|
12
|
-
//#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
|
|
13
|
-
/**
|
|
14
|
-
* Generates a TypeScript object for the given reflection class.
|
|
15
|
-
*/
|
|
16
|
-
function TypescriptObject(props) {
|
|
17
|
-
if (!props.reflection?.value) return null;
|
|
18
|
-
const objectName = computed(() => camelCase((isString(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
|
|
19
|
-
const objectType = computed(() => props.type || pascalCase(props.reflection.value.getName()));
|
|
20
|
-
const properties = computed(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !isUndefined(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
|
|
21
|
-
if (isUndefined(ret) && !isUndefined(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
|
|
22
|
-
return ret;
|
|
23
|
-
}, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
|
|
24
|
-
const TypeSymbolSlot = createSymbolSlot();
|
|
25
|
-
const ValueTypeSymbolSlot = createSymbolSlot();
|
|
26
|
-
const sym = createValueSymbol(props.name, {
|
|
27
|
-
refkeys: props.refkey,
|
|
28
|
-
default: props.default,
|
|
29
|
-
export: props.export,
|
|
30
|
-
metadata: props.metadata,
|
|
31
|
-
tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,
|
|
32
|
-
type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
|
|
33
|
-
namePolicy: useTSNamePolicy().for("variable")
|
|
34
|
-
});
|
|
35
|
-
if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
|
|
36
|
-
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
37
|
-
const type = props.type ? /* @__PURE__ */ jsxs(TypeRefContext, { children: [": ", /* @__PURE__ */ jsx(TypeSymbolSlot, { children: props.type })] }) : void 0;
|
|
38
|
-
return /* @__PURE__ */ jsx(Show, {
|
|
39
|
-
when: !!props.reflection.value,
|
|
40
|
-
children: /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
|
|
41
|
-
value: {
|
|
42
|
-
reflection: props.reflection.value,
|
|
43
|
-
override: {
|
|
44
|
-
name: objectName.value,
|
|
45
|
-
type: objectType.value,
|
|
46
|
-
defaultValue: props.defaultValue?.value
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
children: [/* @__PURE__ */ jsxs(Show, {
|
|
50
|
-
when: !!objectName.value && !!objectType.value,
|
|
51
|
-
children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsxs(Declaration, {
|
|
52
|
-
symbol: sym,
|
|
53
|
-
children: [
|
|
54
|
-
props.export ? "export " : "",
|
|
55
|
-
props.default ? "default " : "",
|
|
56
|
-
keyword,
|
|
57
|
-
" ",
|
|
58
|
-
/* @__PURE__ */ jsx(Name, {}),
|
|
59
|
-
type,
|
|
60
|
-
" =",
|
|
61
|
-
" ",
|
|
62
|
-
/* @__PURE__ */ jsx(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ jsx(ObjectExpression, { children: /* @__PURE__ */ jsx(For, {
|
|
63
|
-
each: properties.value ?? [],
|
|
64
|
-
comma: true,
|
|
65
|
-
doubleHardline: true,
|
|
66
|
-
children: (prop) => /* @__PURE__ */ jsx(TypescriptObjectProperty, { property: prop })
|
|
67
|
-
}) }) })
|
|
68
|
-
]
|
|
69
|
-
})]
|
|
70
|
-
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
71
|
-
})
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Generates a TypeScript object property for the given reflection class.
|
|
76
|
-
*/
|
|
77
|
-
function TypescriptObjectProperty(props) {
|
|
78
|
-
const [{ property }] = splitProps(props, ["property"]);
|
|
79
|
-
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
80
|
-
value: property,
|
|
81
|
-
children: [
|
|
82
|
-
/* @__PURE__ */ jsx(TSDocReflectionProperty, {}),
|
|
83
|
-
/* @__PURE__ */ jsx(ObjectProperty, {
|
|
84
|
-
name: property.getNameAsString(),
|
|
85
|
-
value: stringifyDefaultValue(property)
|
|
86
|
-
}),
|
|
87
|
-
/* @__PURE__ */ jsx("hbr", {})
|
|
88
|
-
]
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
//#endregion
|
|
93
|
-
export { TypescriptObject };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
3
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
4
|
-
let __stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
5
|
-
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
6
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
7
|
-
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
8
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
9
|
-
let automd = require("automd");
|
|
10
|
-
let c12 = require("c12");
|
|
11
|
-
let defu = require("defu");
|
|
12
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
13
|
-
let markdown_toc = require("markdown-toc");
|
|
14
|
-
markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
|
|
15
|
-
|
|
16
|
-
//#region ../plugin-automd/src/index.ts
|
|
17
|
-
/**
|
|
18
|
-
* AutoMD Plugin
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
22
|
-
*
|
|
23
|
-
* @see https://automd.unjs.io/
|
|
24
|
-
*
|
|
25
|
-
* @param options - The plugin options.
|
|
26
|
-
* @returns A Powerlines plugin instance.
|
|
27
|
-
*/
|
|
28
|
-
const plugin = (options = {}) => {
|
|
29
|
-
return {
|
|
30
|
-
name: "automd",
|
|
31
|
-
async config() {
|
|
32
|
-
const config = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
|
|
33
|
-
if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, __stryke_convert_to_array.toArray)(config.prefix ?? []);
|
|
34
|
-
if (!config.prefix.includes("automd")) config.prefix.push("automd");
|
|
35
|
-
if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
|
|
36
|
-
return { automd: (0, defu.default)(config ?? {}, {
|
|
37
|
-
configFile: options.configFile,
|
|
38
|
-
allowIssues: true,
|
|
39
|
-
dir: this.config.projectRoot,
|
|
40
|
-
watch: false,
|
|
41
|
-
input: "README.md",
|
|
42
|
-
toc: {
|
|
43
|
-
maxDepth: 6,
|
|
44
|
-
bullets: "-"
|
|
45
|
-
}
|
|
46
|
-
}) };
|
|
47
|
-
},
|
|
48
|
-
async configResolved() {
|
|
49
|
-
if (this.config.framework && !(0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = (0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).concat(this.config.framework);
|
|
50
|
-
if (this.config.automd.configFile) {
|
|
51
|
-
const { config } = await (0, c12.loadConfig)({
|
|
52
|
-
cwd: this.config.automd.dir,
|
|
53
|
-
configFile: this.config.automd.configFile,
|
|
54
|
-
defaults: {
|
|
55
|
-
ignore: [
|
|
56
|
-
"**/node_modules",
|
|
57
|
-
"**/dist",
|
|
58
|
-
"**/.*"
|
|
59
|
-
],
|
|
60
|
-
dir: this.config.automd.dir
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
|
|
64
|
-
...config,
|
|
65
|
-
prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
|
|
69
|
-
if (input.includes("*")) return (0, __stryke_fs_list_files.listFiles)((0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
|
|
70
|
-
return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
|
|
71
|
-
}))).flat();
|
|
72
|
-
if (this.config.automd.output && !(0, __stryke_path_is_type.isAbsolutePath)(this.config.automd.output)) this.config.automd.output = (0, __stryke_path_append.appendPath)(this.config.automd.output, this.config.projectRoot);
|
|
73
|
-
this.config.automd.generators ??= {};
|
|
74
|
-
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
75
|
-
name: "toc",
|
|
76
|
-
generate: (ctx) => {
|
|
77
|
-
const opts = this.config.automd.toc ?? {};
|
|
78
|
-
return { contents: (0, markdown_toc.default)(ctx.block.md, {
|
|
79
|
-
...opts,
|
|
80
|
-
maxdepth: opts.maxDepth,
|
|
81
|
-
first1: opts.firstH1
|
|
82
|
-
}).content };
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
async docs() {
|
|
87
|
-
await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
|
|
88
|
-
const contents = await this.fs.read(input);
|
|
89
|
-
if (contents) {
|
|
90
|
-
const result = await (0, automd.transform)(contents, this.config.automd);
|
|
91
|
-
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
92
|
-
if (result.hasChanged) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.automd.output ? (0, __stryke_fs_is_file.isDirectory)(this.config.automd.output) ? (0, __stryke_path_replace.replacePath)(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
|
|
93
|
-
}
|
|
94
|
-
}));
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
var src_default = plugin;
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
exports.default = src_default;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { replacePath } from "@stryke/path/replace";
|
|
2
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
3
|
-
import { isDirectory } from "@stryke/fs/is-file";
|
|
4
|
-
import { listFiles } from "@stryke/fs/list-files";
|
|
5
|
-
import { appendPath } from "@stryke/path/append";
|
|
6
|
-
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
7
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
8
|
-
import { loadConfig, resolveConfig, transform } from "automd";
|
|
9
|
-
import { loadConfig as loadConfig$1 } from "c12";
|
|
10
|
-
import defu from "defu";
|
|
11
|
-
import toc from "markdown-toc";
|
|
12
|
-
|
|
13
|
-
//#region ../plugin-automd/src/index.ts
|
|
14
|
-
/**
|
|
15
|
-
* AutoMD Plugin
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
19
|
-
*
|
|
20
|
-
* @see https://automd.unjs.io/
|
|
21
|
-
*
|
|
22
|
-
* @param options - The plugin options.
|
|
23
|
-
* @returns A Powerlines plugin instance.
|
|
24
|
-
*/
|
|
25
|
-
const plugin = (options = {}) => {
|
|
26
|
-
return {
|
|
27
|
-
name: "automd",
|
|
28
|
-
async config() {
|
|
29
|
-
const config = await loadConfig(joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
|
|
30
|
-
if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = toArray(config.prefix ?? []);
|
|
31
|
-
if (!config.prefix.includes("automd")) config.prefix.push("automd");
|
|
32
|
-
if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
|
|
33
|
-
return { automd: defu(config ?? {}, {
|
|
34
|
-
configFile: options.configFile,
|
|
35
|
-
allowIssues: true,
|
|
36
|
-
dir: this.config.projectRoot,
|
|
37
|
-
watch: false,
|
|
38
|
-
input: "README.md",
|
|
39
|
-
toc: {
|
|
40
|
-
maxDepth: 6,
|
|
41
|
-
bullets: "-"
|
|
42
|
-
}
|
|
43
|
-
}) };
|
|
44
|
-
},
|
|
45
|
-
async configResolved() {
|
|
46
|
-
if (this.config.framework && !toArray(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = toArray(this.config.automd.prefix).concat(this.config.framework);
|
|
47
|
-
if (this.config.automd.configFile) {
|
|
48
|
-
const { config } = await loadConfig$1({
|
|
49
|
-
cwd: this.config.automd.dir,
|
|
50
|
-
configFile: this.config.automd.configFile,
|
|
51
|
-
defaults: {
|
|
52
|
-
ignore: [
|
|
53
|
-
"**/node_modules",
|
|
54
|
-
"**/dist",
|
|
55
|
-
"**/.*"
|
|
56
|
-
],
|
|
57
|
-
dir: this.config.automd.dir
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
this.config.automd = resolveConfig(defu(this.config.automd, {
|
|
61
|
-
...config,
|
|
62
|
-
prefix: toArray(config.prefix ?? [])
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
this.config.automd.input = (await Promise.all(toArray(this.config.automd.input).map(async (input) => {
|
|
66
|
-
if (input.includes("*")) return listFiles(isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
|
|
67
|
-
return isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot);
|
|
68
|
-
}))).flat();
|
|
69
|
-
if (this.config.automd.output && !isAbsolutePath(this.config.automd.output)) this.config.automd.output = appendPath(this.config.automd.output, this.config.projectRoot);
|
|
70
|
-
this.config.automd.generators ??= {};
|
|
71
|
-
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
72
|
-
name: "toc",
|
|
73
|
-
generate: (ctx) => {
|
|
74
|
-
const opts = this.config.automd.toc ?? {};
|
|
75
|
-
return { contents: toc(ctx.block.md, {
|
|
76
|
-
...opts,
|
|
77
|
-
maxdepth: opts.maxDepth,
|
|
78
|
-
first1: opts.firstH1
|
|
79
|
-
}).content };
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
async docs() {
|
|
84
|
-
await Promise.all(toArray(this.config.automd.input).map(async (input) => {
|
|
85
|
-
const contents = await this.fs.read(input);
|
|
86
|
-
if (contents) {
|
|
87
|
-
const result = await transform(contents, this.config.automd);
|
|
88
|
-
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
89
|
-
if (result.hasChanged) await this.fs.write(appendPath(this.config.automd.output ? isDirectory(this.config.automd.output) ? replacePath(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
var src_default = plugin;
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
export { src_default as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __babel_generator = require("@babel/generator");
|
|
3
|
-
__babel_generator = require_rolldown_runtime.__toESM(__babel_generator);
|
|
4
|
-
require("@babel/parser");
|
|
5
|
-
|
|
6
|
-
//#region ../plugin-babel/src/helpers/ast-utils.ts
|
|
7
|
-
let generate = __babel_generator.default;
|
|
8
|
-
if ("default" in generate) generate = generate.default;
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_logger = require('../../../powerlines/src/lib/logger.cjs');
|
|
3
|
-
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
4
|
-
let chalk = require("chalk");
|
|
5
|
-
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
6
|
-
let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
|
|
7
|
-
|
|
8
|
-
//#region ../plugin-babel/src/helpers/create-plugin.ts
|
|
9
|
-
/**
|
|
10
|
-
* Create a Babel plugin using the provided builder function.
|
|
11
|
-
*
|
|
12
|
-
* @param name - The name of the plugin.
|
|
13
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
14
|
-
* @returns A Babel plugin declaration.
|
|
15
|
-
*/
|
|
16
|
-
function createBabelPlugin(name, builder) {
|
|
17
|
-
const plugin = (context) => {
|
|
18
|
-
return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
|
|
19
|
-
api.cache.using(() => context.meta.checksum);
|
|
20
|
-
api.assertVersion("^7.0.0-0");
|
|
21
|
-
const log = require_logger.extendLog(context.log, name);
|
|
22
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
23
|
-
const result = builder({
|
|
24
|
-
log,
|
|
25
|
-
name,
|
|
26
|
-
api,
|
|
27
|
-
options,
|
|
28
|
-
context,
|
|
29
|
-
dirname
|
|
30
|
-
});
|
|
31
|
-
result.name = name;
|
|
32
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
33
|
-
return result;
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
plugin.$$name = name;
|
|
37
|
-
return plugin;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
exports.createBabelPlugin = createBabelPlugin;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { extendLog } from "../../../powerlines/src/lib/logger.mjs";
|
|
2
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
import { declare } from "@babel/helper-plugin-utils";
|
|
5
|
-
|
|
6
|
-
//#region ../plugin-babel/src/helpers/create-plugin.ts
|
|
7
|
-
/**
|
|
8
|
-
* Create a Babel plugin using the provided builder function.
|
|
9
|
-
*
|
|
10
|
-
* @param name - The name of the plugin.
|
|
11
|
-
* @param builder - The builder function that defines the plugin behavior.
|
|
12
|
-
* @returns A Babel plugin declaration.
|
|
13
|
-
*/
|
|
14
|
-
function createBabelPlugin(name, builder) {
|
|
15
|
-
const plugin = (context) => {
|
|
16
|
-
return declare((api, options, dirname) => {
|
|
17
|
-
api.cache.using(() => context.meta.checksum);
|
|
18
|
-
api.assertVersion("^7.0.0-0");
|
|
19
|
-
const log = extendLog(context.log, name);
|
|
20
|
-
log(LogLevelLabel.TRACE, `Initializing the ${chalk.bold.cyanBright(name)} Babel plugin`);
|
|
21
|
-
const result = builder({
|
|
22
|
-
log,
|
|
23
|
-
name,
|
|
24
|
-
api,
|
|
25
|
-
options,
|
|
26
|
-
context,
|
|
27
|
-
dirname
|
|
28
|
-
});
|
|
29
|
-
result.name = name;
|
|
30
|
-
log(LogLevelLabel.TRACE, `Completed initialization of the ${chalk.bold.cyanBright(name)} Babel plugin`);
|
|
31
|
-
return result;
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
plugin.$$name = name;
|
|
35
|
-
return plugin;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { createBabelPlugin };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
3
|
-
require("@stryke/type-checks/is-object");
|
|
4
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
-
|
|
6
|
-
//#region ../plugin-babel/src/helpers/filters.ts
|
|
7
|
-
function getPluginName(plugin) {
|
|
8
|
-
return (0, __stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
12
|
-
*
|
|
13
|
-
* @param plugins - The list of existing Babel plugins.
|
|
14
|
-
* @param plugin - The Babel plugin to check for duplicates.
|
|
15
|
-
* @returns True if the plugin is a duplicate, false otherwise.
|
|
16
|
-
*/
|
|
17
|
-
function isDuplicatePlugin(plugins, plugin) {
|
|
18
|
-
return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
exports.getPluginName = getPluginName;
|
|
23
|
-
exports.isDuplicatePlugin = isDuplicatePlugin;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { isFunction } from "@stryke/type-checks/is-function";
|
|
2
|
-
import "@stryke/type-checks/is-object";
|
|
3
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-babel/src/helpers/filters.ts
|
|
6
|
-
function getPluginName(plugin) {
|
|
7
|
-
return isSetString(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
11
|
-
*
|
|
12
|
-
* @param plugins - The list of existing Babel plugins.
|
|
13
|
-
* @param plugin - The Babel plugin to check for duplicates.
|
|
14
|
-
* @returns True if the plugin is a duplicate, false otherwise.
|
|
15
|
-
*/
|
|
16
|
-
function isDuplicatePlugin(plugins, plugin) {
|
|
17
|
-
return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { getPluginName, isDuplicatePlugin };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { getPluginName, isDuplicatePlugin } from "./filters.mjs";
|
|
2
|
-
import { resolveBabelPlugin, resolvePluginFunction } from "./options.mjs";
|
|
3
|
-
import "./ast-utils.mjs";
|
|
4
|
-
import { createBabelPlugin } from "./create-plugin.mjs";
|
|
5
|
-
import { addImport, addImportsToProgram } from "./module-helpers.mjs";
|
|
6
|
-
|
|
7
|
-
export { };
|