@powerlines/plugin-alloy 0.26.26 → 0.26.28
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/core/components/infrastructure-file.cjs +13 -8
- package/dist/core/components/infrastructure-file.mjs +13 -8
- package/dist/core/components/infrastructure-file.mjs.map +1 -1
- package/dist/core/components/output.cjs +17 -10
- package/dist/core/components/output.mjs +17 -10
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +6 -4
- package/dist/core/components/single-line-comment.mjs +6 -4
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +10 -6
- package/dist/core/components/source-file.mjs +10 -6
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +6 -4
- package/dist/core/components/spacing.mjs +6 -4
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/core/contexts/context.mjs.map +1 -1
- package/dist/core/contexts/meta.mjs.map +1 -1
- package/dist/core/contexts/reflection.mjs.map +1 -1
- package/dist/core/helpers/code.mjs.map +1 -1
- package/dist/hcl/components/block-declaration.cjs +12 -8
- package/dist/hcl/components/block-declaration.mjs +12 -8
- package/dist/hcl/components/block-declaration.mjs.map +1 -1
- package/dist/hcl/components/hcl-file.cjs +35 -21
- package/dist/hcl/components/hcl-file.mjs +36 -22
- package/dist/hcl/components/hcl-file.mjs.map +1 -1
- package/dist/hcl/components/packer-file.cjs +8 -8
- package/dist/hcl/components/packer-file.mjs +8 -8
- package/dist/hcl/components/packer-file.mjs.map +1 -1
- package/dist/hcl/components/terraform-file.cjs +8 -8
- package/dist/hcl/components/terraform-file.mjs +8 -8
- package/dist/hcl/components/terraform-file.mjs.map +1 -1
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/helpers/create-builtin.mjs.map +1 -1
- package/dist/helpers/refkey.mjs.map +1 -1
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/index.cjs +15 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +14 -8
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +9 -7
- package/dist/markdown/components/front-matter.mjs +9 -7
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/heading.cjs +24 -0
- package/dist/markdown/components/heading.d.cts +19 -0
- package/dist/markdown/components/heading.d.cts.map +1 -0
- package/dist/markdown/components/heading.d.mts +19 -0
- package/dist/markdown/components/heading.d.mts.map +1 -0
- package/dist/markdown/components/heading.mjs +23 -0
- package/dist/markdown/components/heading.mjs.map +1 -0
- package/dist/markdown/components/index.cjs +2 -0
- package/dist/markdown/components/index.d.cts +2 -1
- package/dist/markdown/components/index.d.mts +2 -1
- package/dist/markdown/components/index.mjs +2 -1
- package/dist/markdown/components/markdown-file.cjs +76 -44
- package/dist/markdown/components/markdown-file.mjs +76 -44
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +49 -28
- package/dist/markdown/components/markdown-table.mjs +49 -28
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/markdown/index.cjs +2 -0
- package/dist/markdown/index.d.cts +2 -1
- package/dist/markdown/index.d.mts +2 -1
- package/dist/markdown/index.mjs +2 -1
- package/dist/render.cjs +3 -3
- package/dist/render.mjs +4 -4
- package/dist/render.mjs.map +1 -1
- package/dist/types/components.cjs +9 -0
- package/dist/types/components.mjs +10 -1
- package/dist/types/components.mjs.map +1 -0
- package/dist/typescript/components/builtin-file.cjs +30 -20
- package/dist/typescript/components/builtin-file.mjs +30 -20
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +180 -100
- package/dist/typescript/components/class-declaration.mjs +180 -100
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +10 -7
- package/dist/typescript/components/entry-file.mjs +10 -7
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +127 -74
- package/dist/typescript/components/interface-declaration.mjs +127 -74
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +84 -50
- package/dist/typescript/components/object-declaration.mjs +84 -50
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +3 -3
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +241 -108
- package/dist/typescript/components/tsdoc-reflection.mjs +241 -108
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +265 -168
- package/dist/typescript/components/tsdoc.mjs +265 -168
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +20 -15
- package/dist/typescript/components/type-declaration.mjs +20 -15
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +56 -29
- package/dist/typescript/components/type-parameters.mjs +56 -29
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +135 -74
- package/dist/typescript/components/typescript-file.mjs +135 -74
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
- package/dist/typescript/helpers/utilities.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +92 -47
- package/dist/yaml/components/yaml-file.mjs +92 -47
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +21 -6
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/types/components.ts
|
|
2
|
+
/**
|
|
3
|
+
* A type that represents the props of a component that can have children.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A type that requires the `children` prop in a component.
|
|
7
|
+
*/
|
|
8
|
+
//#endregion
|
|
9
|
+
export { };
|
|
10
|
+
//# sourceMappingURL=components.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.mjs","names":[],"sources":["../../src/types/components.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children, Context } from \"@alloy-js/core\";\nimport type { SourceFileContext } from \"@alloy-js/typescript\";\nimport { ResolvedEntryTypeDefinition, StoragePreset } from \"powerlines\";\n\nexport interface CopyOutputFile {\n kind: \"file\";\n path: string;\n sourcePath: string;\n\n /**\n * The format of the output files\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided \\`output.mode\\` value.\n */\n preset?: StoragePreset;\n}\n\nexport interface WriteOutputFile {\n kind: \"file\" | \"entry\" | \"builtin\";\n path: string;\n contents: string;\n filetype: string;\n\n /**\n * The format of the output files\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided \\`output.mode\\` value.\n */\n preset?: StoragePreset;\n}\n\nexport type OutputFile =\n | (WriteOutputFile & { kind: \"file\" })\n | (WriteOutputFile & {\n kind: \"entry\";\n typeDefinition?: ResolvedEntryTypeDefinition;\n })\n | (WriteOutputFile & { kind: \"builtin\"; id: string })\n | CopyOutputFile;\n\nexport interface OutputDirectory {\n kind: \"directory\";\n path: string;\n contents: (OutputDirectory | OutputFile)[];\n}\n\nexport interface RenderEntryContext {\n typeDefinition: ResolvedEntryTypeDefinition;\n}\n\nexport interface RenderBuiltinContext {\n id: string;\n}\n\nexport interface RenderOutputContext {\n mode?: StoragePreset;\n}\n\nexport interface CopyFileOutputContext {\n path?: string;\n sourcePath?: string;\n}\n\nexport interface RenderContext extends Context {\n meta?: {\n copyFile?: CopyFileOutputContext;\n\n /**\n * The current context for the built-in module.\n */\n builtin?: RenderBuiltinContext;\n\n /**\n * The current context for the application entrypoint file being rendered.\n */\n entry?: RenderEntryContext;\n\n /**\n * The current context for output rendering.\n */\n output?: RenderOutputContext;\n } & Record<string, any>;\n}\n\n/**\n * A type that represents the props of a component that can have children.\n */\nexport interface ComponentProps {\n children?: Children;\n}\n\n/**\n * A type that requires the `children` prop in a component.\n */\nexport type ComponentPropsWithChildren = Omit<ComponentProps, \"children\"> &\n Required<Pick<ComponentProps, \"children\">>;\n\nexport interface BuiltinSourceFileContext extends SourceFileContext {\n /**\n * The runtime module identifier.\n */\n id: string;\n}\n\nexport interface ReflectionOverrideInterface<T> {\n name?: string | Children;\n type?: string | Children;\n extends?: string | false;\n defaultValue?: Partial<T>;\n}\n\nexport interface TypescriptFileImportItem {\n name: string;\n default?: boolean;\n alias?: string;\n type?: boolean;\n}\n\nexport type TypescriptFileImports = Record<\n string,\n null | string | Array<TypescriptFileImportItem | string>\n>;\n\nexport interface SourceFileHeaderProps extends ComponentProps {\n /**\n * If true, disables the ESLint directive at the top of the file.\n *\n * @defaultValue true\n */\n disableEslint?: boolean;\n\n /**\n * If true, disables the Biome directive at the top of the file.\n *\n * @defaultValue true\n */\n disableBiome?: boolean;\n\n /**\n * If true, disables the Prettier directive at the top of the file.\n *\n * @defaultValue false\n */\n disablePrettier?: boolean;\n}\n"],"mappings":""}
|
|
@@ -3,10 +3,10 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
const require_core_contexts_context = require('../../core/contexts/context.cjs');
|
|
4
4
|
const require_typescript_components_tsdoc = require('./tsdoc.cjs');
|
|
5
5
|
const require_typescript_components_typescript_file = require('./typescript-file.cjs');
|
|
6
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
7
6
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
8
|
-
let _stryke_path_replace = require("@stryke/path/replace");
|
|
9
7
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
10
10
|
let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
11
11
|
|
|
12
12
|
//#region src/typescript/components/builtin-file.tsx
|
|
@@ -27,26 +27,36 @@ function BuiltinFile(props) {
|
|
|
27
27
|
]);
|
|
28
28
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
29
29
|
const path = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replacePath)(`${!(0, _stryke_type_checks_is_set.isSet)(tsx) ? id : (0, _stryke_path_replace.replaceExtension)(id)}${(0, _stryke_path_file_path_fns.hasFileExtension)(id) && !(0, _stryke_type_checks_is_set.isSet)(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
30
|
-
return
|
|
31
|
-
header
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
31
|
+
get header() {
|
|
32
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeader, {
|
|
33
|
+
get header() {
|
|
34
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocModule, {
|
|
35
|
+
name: id,
|
|
36
|
+
children: description
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
get children() {
|
|
40
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeaderImports, {
|
|
41
|
+
imports,
|
|
42
|
+
builtinImports
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
get meta() {
|
|
48
|
+
return {
|
|
49
|
+
kind: "builtin",
|
|
50
|
+
extension: tsx ? "tsx" : "ts",
|
|
51
|
+
id: (0, _stryke_path_replace.replaceExtension)(id)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}, rest, {
|
|
55
|
+
get path() {
|
|
56
|
+
return path.value;
|
|
45
57
|
},
|
|
46
|
-
...rest,
|
|
47
|
-
path: path.value,
|
|
48
58
|
children
|
|
49
|
-
});
|
|
59
|
+
}));
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
2
|
import { TSDocModule } from "./tsdoc.mjs";
|
|
3
3
|
import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "./typescript-file.mjs";
|
|
4
|
-
import { computed, splitProps } from "@alloy-js/core";
|
|
5
4
|
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
5
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
6
|
+
import { computed, splitProps } from "@alloy-js/core";
|
|
6
7
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
7
|
-
import { jsx } from "@alloy-js/core/jsx-runtime";
|
|
8
8
|
import { isSet } from "@stryke/type-checks/is-set";
|
|
9
9
|
|
|
10
10
|
//#region src/typescript/components/builtin-file.tsx
|
|
@@ -25,26 +25,36 @@ function BuiltinFile(props) {
|
|
|
25
25
|
]);
|
|
26
26
|
const context = usePowerlinesSafe();
|
|
27
27
|
const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
28
|
-
return
|
|
29
|
-
header
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
return createComponent(TypescriptFile, mergeProps({
|
|
29
|
+
get header() {
|
|
30
|
+
return createComponent(TypescriptFileHeader, {
|
|
31
|
+
get header() {
|
|
32
|
+
return createComponent(TSDocModule, {
|
|
33
|
+
name: id,
|
|
34
|
+
children: description
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return createComponent(TypescriptFileHeaderImports, {
|
|
39
|
+
imports,
|
|
40
|
+
builtinImports
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
get meta() {
|
|
46
|
+
return {
|
|
47
|
+
kind: "builtin",
|
|
48
|
+
extension: tsx ? "tsx" : "ts",
|
|
49
|
+
id: replaceExtension(id)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, rest, {
|
|
53
|
+
get path() {
|
|
54
|
+
return path.value;
|
|
43
55
|
},
|
|
44
|
-
...rest,
|
|
45
|
-
path: path.value,
|
|
46
56
|
children
|
|
47
|
-
});
|
|
57
|
+
}));
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAY,YAAgB,OAAO;CACjC,MAAK,CAAA,EACH,UACA,SACA,gBACA,IACA,aACA,OACA,QAAI,WAAM,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;;CAEZ,MAAI,OAAA,eAAA,YAAA,GAAA,CAAA,MAAA,IAAA,GAAA,KAAA,iBAAA,GAAA,GAAA,iBAAA,GAAA,IAAA,CAAA,MAAA,IAAA,GAAA,KAAA,MAAA,SAAA,SAAA,SAAA,aAAA,CAAA;AACJ,QAAK,gBAAoB,gBAAY,WAAM;EACzC,IAAE,SAAA;AACF,UAAA,gBAAoB,sBAAA;;AAElB,YAAA,gBAAA,aAAA;MACC,MAAW;MACb,UAAA;MACG,CAAA;;IAEA,IAAE,WAAO;AACd,YAAA,gBAAA,6BAAA;;MAED;MACQ,CAAA;;IAEN,CAAA;;EAEF,IAAA,OAAA;AACI,UAAC;IACC,MAAG;IACP,WAAW,MAAO,QAAA;IACf,IAAA,iBAAS,GAAA;IACT;;EAEJ,EAAE,MAAK;EACN,IAAG,OAAA;AACD,UAAI,KAAA;;;EAGR,CAAA,CAAA"}
|
|
@@ -8,12 +8,15 @@ const require_typescript_helpers_get_call_signature_props = require('../helpers/
|
|
|
8
8
|
require('../helpers/index.cjs');
|
|
9
9
|
const require_typescript_components_property_name = require('./property-name.cjs');
|
|
10
10
|
const require_typescript_components_type_parameters = require('./type-parameters.cjs');
|
|
11
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
12
11
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
12
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
13
13
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
14
|
|
|
15
15
|
//#region src/typescript/components/class-declaration.tsx
|
|
16
16
|
/**
|
|
17
|
+
* Props for the ClassDeclaration component, which represents a TypeScript class declaration
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
17
20
|
* Create a TypeScript class declaration.
|
|
18
21
|
*
|
|
19
22
|
* @example
|
|
@@ -44,18 +47,20 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
44
47
|
* ```
|
|
45
48
|
*/
|
|
46
49
|
function ClassDeclaration(props) {
|
|
47
|
-
const extendsPart = props.extends &&
|
|
48
|
-
const implementsPart = props.implements && props.implements.length > 0 &&
|
|
50
|
+
const extendsPart = props.extends && [" extends ", (0, _alloy_js_core_jsx_runtime.memo)(() => props.extends)];
|
|
51
|
+
const implementsPart = props.implements && props.implements.length > 0 && [
|
|
49
52
|
" ",
|
|
50
53
|
"implements",
|
|
51
54
|
" ",
|
|
52
|
-
|
|
53
|
-
each
|
|
55
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
56
|
+
get each() {
|
|
57
|
+
return props.implements;
|
|
58
|
+
},
|
|
54
59
|
comma: true,
|
|
55
60
|
space: true,
|
|
56
61
|
children: (implement) => implement
|
|
57
62
|
})
|
|
58
|
-
]
|
|
63
|
+
];
|
|
59
64
|
const sym = (0, _alloy_js_typescript.createTypeAndValueSymbol)(props.name, {
|
|
60
65
|
refkeys: props.refkey,
|
|
61
66
|
export: props.export,
|
|
@@ -64,31 +69,52 @@ function ClassDeclaration(props) {
|
|
|
64
69
|
hasInstanceMembers: true,
|
|
65
70
|
namePolicy: (0, _alloy_js_typescript.useTSNamePolicy)().for("class")
|
|
66
71
|
});
|
|
67
|
-
return
|
|
68
|
-
when
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
73
|
+
get when() {
|
|
74
|
+
return Boolean(props.doc);
|
|
75
|
+
},
|
|
76
|
+
get children() {
|
|
77
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
78
|
+
return props.doc;
|
|
79
|
+
} });
|
|
80
|
+
}
|
|
81
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.Declaration, {
|
|
71
82
|
symbol: sym,
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
get ["export"]() {
|
|
84
|
+
return props.export;
|
|
85
|
+
},
|
|
86
|
+
get ["default"]() {
|
|
87
|
+
return props.default;
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_member_scope.MemberScope, {
|
|
91
|
+
ownerSymbol: sym,
|
|
92
|
+
get children() {
|
|
93
|
+
return [
|
|
94
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.abstract && _alloy_js_core.code`abstract `),
|
|
95
|
+
" class ",
|
|
96
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Name, {}),
|
|
97
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => (0, _alloy_js_core_jsx_runtime.memo)(() => !!props.typeParameters)() && (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_type_parameters.TypeParameters, { get parameters() {
|
|
98
|
+
return props.typeParameters;
|
|
99
|
+
} })),
|
|
100
|
+
extendsPart,
|
|
101
|
+
implementsPart,
|
|
102
|
+
" ",
|
|
103
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Block, { get children() {
|
|
104
|
+
return props.children;
|
|
105
|
+
} })
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
})];
|
|
88
111
|
}
|
|
89
112
|
ClassDeclaration.TypeParameters = require_typescript_components_type_parameters.TypeParameters;
|
|
90
113
|
/**
|
|
91
114
|
* Generates a TypeScript class member declaration for the given reflection class.
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* Generates a TypeScript class member declaration for the given reflection class.
|
|
92
118
|
*
|
|
93
119
|
* @param props - The properties of the class member, including its name, visibility, and other modifiers.
|
|
94
120
|
* @returns A JSX element representing the class member declaration, which can be used within a ClassDeclaration component.
|
|
@@ -101,23 +127,34 @@ function ClassMember(props) {
|
|
|
101
127
|
tsFlags,
|
|
102
128
|
namePolicy: (0, _alloy_js_typescript.useTSNamePolicy)().for("class-member-data")
|
|
103
129
|
});
|
|
104
|
-
return
|
|
105
|
-
when
|
|
106
|
-
|
|
107
|
-
|
|
130
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
131
|
+
get when() {
|
|
132
|
+
return Boolean(props.doc);
|
|
133
|
+
},
|
|
134
|
+
get children() {
|
|
135
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
136
|
+
return props.doc;
|
|
137
|
+
} });
|
|
138
|
+
}
|
|
139
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.MemberDeclaration, {
|
|
108
140
|
symbol: sym,
|
|
109
|
-
children
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
get children() {
|
|
142
|
+
return [
|
|
143
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.public && "public "),
|
|
144
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.private && "private "),
|
|
145
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.protected && "protected "),
|
|
146
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.abstract && "abstract "),
|
|
147
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.override && "override "),
|
|
148
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.static && "static "),
|
|
149
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.children)
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
})];
|
|
119
153
|
}
|
|
120
154
|
/**
|
|
155
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
156
|
+
*/
|
|
157
|
+
/**
|
|
121
158
|
* Generates a TypeScript class field declaration for the given reflection class.
|
|
122
159
|
*
|
|
123
160
|
* @param props - The properties of the class field, including its name, type, optionality, and other modifiers.
|
|
@@ -125,48 +162,66 @@ function ClassMember(props) {
|
|
|
125
162
|
*/
|
|
126
163
|
function ClassField(props) {
|
|
127
164
|
const optionality = props.optional ? "?" : "";
|
|
128
|
-
const typeSection = props.type &&
|
|
165
|
+
const typeSection = props.type && [
|
|
129
166
|
optionality,
|
|
130
167
|
": ",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
nullish,
|
|
138
|
-
children
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
168
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeRefContext, { get children() {
|
|
169
|
+
return props.type;
|
|
170
|
+
} })
|
|
171
|
+
];
|
|
172
|
+
const initializerSection = props.children && [" = ", (0, _alloy_js_core_jsx_runtime.memo)(() => props.children)];
|
|
173
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, _alloy_js_core_jsx_runtime.mergeProps)(props, {
|
|
174
|
+
nullish: props.nullish ?? props.optional,
|
|
175
|
+
get children() {
|
|
176
|
+
return [
|
|
177
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, {
|
|
178
|
+
get ["private"]() {
|
|
179
|
+
return props.isPrivateMember;
|
|
180
|
+
},
|
|
181
|
+
get name() {
|
|
182
|
+
return props.isPrivateMember ? props.name : void 0;
|
|
183
|
+
}
|
|
184
|
+
}),
|
|
185
|
+
typeSection,
|
|
186
|
+
initializerSection
|
|
187
|
+
];
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
147
190
|
}
|
|
148
191
|
/**
|
|
192
|
+
* Props for a class field, which is a specific type of class member that represents a property of the class.
|
|
193
|
+
*/
|
|
194
|
+
/**
|
|
149
195
|
* Generates a TypeScript class property setter declaration for the given reflection class.
|
|
150
196
|
*
|
|
151
197
|
* @param props - The properties of the class property, including its name, type, and other modifiers.
|
|
152
198
|
* @returns A JSX element representing the class property setter declaration, which can be used within a ClassDeclaration component.
|
|
153
199
|
*/
|
|
154
200
|
function ClassPropertySet(props) {
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
children: [
|
|
201
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, _alloy_js_core_jsx_runtime.mergeProps)(props, { get children() {
|
|
202
|
+
return [
|
|
158
203
|
"set ",
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
204
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, { get name() {
|
|
205
|
+
return props.name;
|
|
206
|
+
} }),
|
|
207
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_lexical_scope.LexicalScope, { get children() {
|
|
208
|
+
return [
|
|
209
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.CallSignature, { get parameters() {
|
|
210
|
+
return [{
|
|
211
|
+
name: "value",
|
|
212
|
+
type: (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeRefContext, { get children() {
|
|
213
|
+
return props.type;
|
|
214
|
+
} })
|
|
215
|
+
}];
|
|
216
|
+
} }),
|
|
217
|
+
" ",
|
|
218
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Block, { get children() {
|
|
219
|
+
return props.children;
|
|
220
|
+
} })
|
|
221
|
+
];
|
|
222
|
+
} })
|
|
223
|
+
];
|
|
224
|
+
} }))];
|
|
170
225
|
}
|
|
171
226
|
/**
|
|
172
227
|
* Generates a TypeScript class property getter declaration for the given reflection class.
|
|
@@ -175,20 +230,32 @@ function ClassPropertySet(props) {
|
|
|
175
230
|
* @returns A JSX element representing the class property getter declaration, which can be used within a ClassDeclaration component.
|
|
176
231
|
*/
|
|
177
232
|
function ClassPropertyGet(props) {
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
children: [
|
|
233
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, _alloy_js_core_jsx_runtime.mergeProps)(props, { get children() {
|
|
234
|
+
return [
|
|
181
235
|
"get ",
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
236
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, { get name() {
|
|
237
|
+
return props.name;
|
|
238
|
+
} }),
|
|
239
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_lexical_scope.LexicalScope, { get children() {
|
|
240
|
+
return [
|
|
241
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.CallSignature, { get returnType() {
|
|
242
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeRefContext, { get children() {
|
|
243
|
+
return props.type;
|
|
244
|
+
} });
|
|
245
|
+
} }),
|
|
246
|
+
" ",
|
|
247
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Block, { get children() {
|
|
248
|
+
return props.children;
|
|
249
|
+
} })
|
|
250
|
+
];
|
|
251
|
+
} })
|
|
252
|
+
];
|
|
253
|
+
} }));
|
|
190
254
|
}
|
|
191
255
|
/**
|
|
256
|
+
* Props for a class method, which is a specific type of class member that represents a function defined within the class.
|
|
257
|
+
*/
|
|
258
|
+
/**
|
|
192
259
|
* Generates a TypeScript class method declaration for the given reflection class.
|
|
193
260
|
*
|
|
194
261
|
* @param props - The properties of the class method, including its name, visibility, and other modifiers.
|
|
@@ -197,24 +264,37 @@ function ClassPropertyGet(props) {
|
|
|
197
264
|
function ClassMethod(props) {
|
|
198
265
|
const callProps = require_typescript_helpers_get_call_signature_props.getCallSignatureProps(props);
|
|
199
266
|
const [_, rest] = (0, _alloy_js_core.splitProps)(props, ["doc"]);
|
|
200
|
-
return
|
|
201
|
-
when
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
267
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
268
|
+
get when() {
|
|
269
|
+
return Boolean(props.doc);
|
|
270
|
+
},
|
|
271
|
+
get children() {
|
|
272
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, {
|
|
273
|
+
get heading() {
|
|
274
|
+
return props.doc;
|
|
275
|
+
},
|
|
276
|
+
get children() {
|
|
277
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!Array.isArray(rest.parameters))() && (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocParams, { get parameters() {
|
|
278
|
+
return rest.parameters;
|
|
279
|
+
} });
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(ClassMember, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, { get children() {
|
|
284
|
+
return [
|
|
285
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.async && "async "),
|
|
286
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, {}),
|
|
287
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_contexts_lexical_scope.LexicalScope, { get children() {
|
|
288
|
+
return [
|
|
289
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.CallSignature, callProps),
|
|
290
|
+
" ",
|
|
291
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Block, { get children() {
|
|
292
|
+
return props.children;
|
|
293
|
+
} })
|
|
294
|
+
];
|
|
295
|
+
} })
|
|
296
|
+
];
|
|
297
|
+
} }))];
|
|
218
298
|
}
|
|
219
299
|
|
|
220
300
|
//#endregion
|