@powerlines/plugin-alloy 0.16.3 → 0.17.0
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/{chunk-BwyOHTjC.cjs → _virtual/rolldown_runtime.cjs} +1 -19
- package/dist/core/components/index.cjs +6 -8
- package/dist/core/components/index.d.cts +3 -6
- package/dist/core/components/index.d.mts +3 -6
- package/dist/core/components/index.mjs +3 -5
- package/dist/core/components/output.cjs +44 -3
- package/dist/core/components/output.d.cts +22 -2
- package/dist/core/components/output.d.mts +22 -2
- package/dist/core/components/output.mjs +42 -2
- package/dist/core/components/single-line-comment.cjs +21 -2
- package/dist/core/components/single-line-comment.d.cts +21 -3
- package/dist/core/components/single-line-comment.d.mts +21 -3
- package/dist/core/components/single-line-comment.mjs +19 -1
- package/dist/core/components/source-file.cjs +63 -2
- package/dist/core/components/source-file.d.cts +31 -3
- package/dist/core/components/source-file.d.mts +31 -3
- package/dist/core/components/source-file.mjs +60 -1
- package/dist/core/contexts/context.cjs +59 -5
- package/dist/core/contexts/context.d.cts +71 -3
- package/dist/core/contexts/context.d.mts +71 -3
- package/dist/core/contexts/context.mjs +53 -2
- package/dist/core/contexts/index.cjs +16 -15
- package/dist/core/contexts/index.d.cts +3 -6
- package/dist/core/contexts/index.d.mts +3 -6
- package/dist/core/contexts/index.mjs +3 -4
- package/dist/core/contexts/reflection.cjs +67 -9
- package/dist/core/contexts/reflection.d.cts +50 -3
- package/dist/core/contexts/reflection.d.mts +50 -3
- package/dist/core/contexts/reflection.mjs +58 -1
- package/dist/core/index.cjs +24 -22
- package/dist/core/index.d.cts +6 -10
- package/dist/core/index.d.mts +8 -10
- package/dist/core/index.mjs +8 -8
- package/dist/{utilities-CiKb35hs.cjs → deepkit/src/utilities.cjs} +5 -25
- package/dist/{utilities-C6eipB1q.mjs → deepkit/src/utilities.mjs} +1 -1
- package/dist/helpers/capnp.cjs +274 -19
- package/dist/helpers/capnp.d.cts +85 -2
- package/dist/helpers/capnp.d.mts +85 -2
- package/dist/helpers/capnp.mjs +255 -2
- package/dist/helpers/create-builtin.cjs +18 -2
- package/dist/helpers/create-builtin.d.cts +14 -1
- package/dist/helpers/create-builtin.d.mts +14 -1
- package/dist/helpers/create-builtin.mjs +16 -1
- package/dist/helpers/index.cjs +23 -24
- package/dist/helpers/index.d.cts +4 -5
- package/dist/helpers/index.d.mts +4 -5
- package/dist/helpers/index.mjs +4 -5
- package/dist/helpers/refkey.cjs +15 -2
- package/dist/helpers/refkey.d.cts +12 -1
- package/dist/helpers/refkey.d.mts +12 -1
- package/dist/helpers/refkey.mjs +13 -1
- package/dist/helpers/typescript.cjs +45 -3
- package/dist/helpers/typescript.d.cts +22 -1
- package/dist/helpers/typescript.d.mts +22 -1
- package/dist/helpers/typescript.mjs +43 -2
- package/dist/index.cjs +35 -149
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +33 -176
- package/dist/markdown/components/index.cjs +7 -12
- package/dist/markdown/components/index.d.cts +2 -7
- package/dist/markdown/components/index.d.mts +2 -7
- package/dist/markdown/components/index.mjs +2 -7
- package/dist/markdown/components/markdown-file.cjs +115 -6
- package/dist/markdown/components/markdown-file.d.cts +22 -4
- package/dist/markdown/components/markdown-file.d.mts +22 -4
- package/dist/markdown/components/markdown-file.mjs +112 -4
- package/dist/markdown/components/markdown-table.cjs +100 -5
- package/dist/markdown/components/markdown-table.d.cts +26 -4
- package/dist/markdown/components/markdown-table.d.mts +26 -4
- package/dist/markdown/components/markdown-table.mjs +96 -2
- package/dist/markdown/contexts/index.cjs +5 -6
- package/dist/markdown/contexts/index.d.cts +1 -2
- package/dist/markdown/contexts/index.d.mts +1 -2
- package/dist/markdown/contexts/index.mjs +1 -2
- package/dist/markdown/contexts/markdown-table.cjs +36 -5
- package/dist/markdown/contexts/markdown-table.d.cts +36 -1
- package/dist/markdown/contexts/markdown-table.d.mts +36 -1
- package/dist/markdown/contexts/markdown-table.mjs +31 -1
- package/dist/markdown/index.cjs +14 -17
- package/dist/markdown/index.d.cts +3 -8
- package/dist/markdown/index.d.mts +5 -8
- package/dist/markdown/index.mjs +5 -8
- package/dist/powerlines/src/lib/utilities/file-header.cjs +13 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +12 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +145 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +8 -0
- package/dist/powerlines/src/types/config.d.cts +369 -0
- package/dist/powerlines/src/types/config.d.mts +369 -0
- package/dist/powerlines/src/types/context.d.cts +379 -0
- package/dist/powerlines/src/types/context.d.mts +379 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/resolved.d.cts +81 -0
- package/dist/powerlines/src/types/resolved.d.mts +81 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/components.cjs +0 -1
- package/dist/types/components.d.cts +141 -2
- package/dist/types/components.d.mts +141 -2
- package/dist/types/components.mjs +0 -2
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.mts +2 -3
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +40 -2
- package/dist/types/plugin.d.mts +40 -2
- package/dist/types/plugin.mjs +0 -2
- package/dist/typescript/components/builtin-file.cjs +46 -8
- package/dist/typescript/components/builtin-file.d.cts +33 -6
- package/dist/typescript/components/builtin-file.d.mts +33 -6
- package/dist/typescript/components/builtin-file.mjs +44 -7
- package/dist/typescript/components/dynamic-import-statement.cjs +24 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts +31 -1
- package/dist/typescript/components/dynamic-import-statement.d.mts +31 -1
- package/dist/typescript/components/dynamic-import-statement.mjs +22 -1
- package/dist/typescript/components/entry-file.cjs +38 -6
- package/dist/typescript/components/entry-file.d.cts +26 -5
- package/dist/typescript/components/entry-file.d.mts +26 -5
- package/dist/typescript/components/entry-file.mjs +35 -5
- package/dist/typescript/components/index.cjs +43 -49
- package/dist/typescript/components/index.d.cts +9 -13
- package/dist/typescript/components/index.d.mts +9 -13
- package/dist/typescript/components/index.mjs +9 -15
- package/dist/typescript/components/record-expression.cjs +11 -2
- package/dist/typescript/components/record-expression.d.cts +11 -1
- package/dist/typescript/components/record-expression.d.mts +11 -1
- package/dist/typescript/components/record-expression.mjs +9 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +172 -8
- package/dist/typescript/components/tsdoc-reflection.d.cts +17 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts +17 -4
- package/dist/typescript/components/tsdoc-reflection.mjs +168 -5
- package/dist/typescript/components/tsdoc.cjs +475 -23
- package/dist/typescript/components/tsdoc.d.cts +151 -3
- package/dist/typescript/components/tsdoc.d.mts +151 -3
- package/dist/typescript/components/tsdoc.mjs +454 -3
- package/dist/typescript/components/typescript-file.cjs +192 -7
- package/dist/typescript/components/typescript-file.d.cts +46 -4
- package/dist/typescript/components/typescript-file.d.mts +46 -4
- package/dist/typescript/components/typescript-file.mjs +188 -4
- package/dist/typescript/components/typescript-interface.cjs +67 -8
- package/dist/typescript/components/typescript-interface.d.cts +23 -3
- package/dist/typescript/components/typescript-interface.d.mts +23 -3
- package/dist/typescript/components/typescript-interface.mjs +64 -6
- package/dist/typescript/components/typescript-object.cjs +124 -8
- package/dist/typescript/components/typescript-object.d.cts +24 -3
- package/dist/typescript/components/typescript-object.d.mts +24 -3
- package/dist/typescript/components/typescript-object.mjs +121 -6
- package/dist/typescript/index.cjs +44 -49
- package/dist/typescript/index.d.cts +9 -13
- package/dist/typescript/index.d.mts +10 -13
- package/dist/typescript/index.mjs +10 -15
- package/package.json +7 -39
- package/dist/builtin-file-CXkreb3b.mjs +0 -43
- package/dist/builtin-file-D0xcKRt6.cjs +0 -49
- package/dist/builtin-file-DHf88iJr.d.cts +0 -34
- package/dist/builtin-file-_SxRqRQx.d.mts +0 -34
- package/dist/capnp-6EjloHj4.mjs +0 -265
- package/dist/capnp-BNtIXnmu.d.cts +0 -86
- package/dist/capnp-DOzEf2mj.cjs +0 -362
- package/dist/capnp-DfS3IWxI.d.mts +0 -86
- package/dist/components-5TS7e4GS.d.cts +0 -141
- package/dist/components-CH68f_ve.mjs +0 -1
- package/dist/components-CO0xjM8H.mjs +0 -1
- package/dist/components-CnI3Y57d.mjs +0 -1
- package/dist/components-Cvpo9IEL.cjs +0 -0
- package/dist/components-D22-W7dz.d.mts +0 -141
- package/dist/components-DTkri-mp.cjs +0 -0
- package/dist/components-Gg416Czx.cjs +0 -0
- package/dist/components-ZbItRNLr.cjs +0 -0
- package/dist/components-vTvc6Xgc.mjs +0 -1
- package/dist/context-C22Kb0w6.d.cts +0 -32
- package/dist/context-CZ9XczQG.d.mts +0 -1694
- package/dist/context-Cv5u9A3S.d.mts +0 -32
- package/dist/context-DM-inhWw.d.cts +0 -1694
- package/dist/context-DkLnFNZm.cjs +0 -60
- package/dist/context-eP3fitqj.mjs +0 -36
- package/dist/contexts-BtxvYUPj.cjs +0 -0
- package/dist/contexts-Dy4nfIoL.mjs +0 -1
- package/dist/contexts-DzdhIC7G.cjs +0 -0
- package/dist/contexts-Q1YIygoz.mjs +0 -1
- package/dist/create-builtin-CtBhQRxS.d.mts +0 -15
- package/dist/create-builtin-DgYGwEYD.cjs +0 -24
- package/dist/create-builtin-Dug1rcMQ.mjs +0 -18
- package/dist/create-builtin-SArMbh0-.d.cts +0 -15
- package/dist/dynamic-import-statement-BFl4j9Ex.cjs +0 -30
- package/dist/dynamic-import-statement-CujvBcbe.d.cts +0 -32
- package/dist/dynamic-import-statement-DYl1f5Mj.mjs +0 -24
- package/dist/dynamic-import-statement-OFNMp6Xd.d.mts +0 -32
- package/dist/entry-file-CTYBU7Lg.mjs +0 -37
- package/dist/entry-file-CZYmxB2e.d.mts +0 -27
- package/dist/entry-file-Da8pzMTX.d.cts +0 -27
- package/dist/entry-file-l3ZhaFTI.cjs +0 -44
- package/dist/index-Blaks7l8.d.cts +0 -1
- package/dist/index-CuheJfs-.d.mts +0 -1
- package/dist/index-CwSIy_W-.d.cts +0 -1
- package/dist/index-D7UbuJwP.d.mts +0 -1
- package/dist/index-D9XihFV1.d.mts +0 -1
- package/dist/index-DdxxIAKU.d.cts +0 -1
- package/dist/index-DrK1_jKY.d.mts +0 -1
- package/dist/index-DrZ2Dh-H.d.cts +0 -1
- package/dist/index-DztUdPP_.d.mts +0 -1
- package/dist/index-lQ_hGQ08.d.cts +0 -1
- package/dist/markdown-file-61YKY0C0.d.mts +0 -23
- package/dist/markdown-file-CTMTrgdr.mjs +0 -116
- package/dist/markdown-file-D0e3EeGW.d.cts +0 -23
- package/dist/markdown-file-GXj9nWQs.cjs +0 -128
- package/dist/markdown-table-AO9Jtw-o.mjs +0 -98
- package/dist/markdown-table-Biapn9k9.cjs +0 -57
- package/dist/markdown-table-CBUGIBTr.d.cts +0 -27
- package/dist/markdown-table-DFnnh_px.d.cts +0 -37
- package/dist/markdown-table-DKL6g91k.d.mts +0 -37
- package/dist/markdown-table-DSFbP8hX.d.mts +0 -27
- package/dist/markdown-table-DaYAMMk6.mjs +0 -33
- package/dist/markdown-table-d1cy0JP3.cjs +0 -116
- package/dist/output-BoOd5-G9.d.cts +0 -18
- package/dist/output-CiQCsyui.cjs +0 -45
- package/dist/output-eQ8RcTrP.mjs +0 -39
- package/dist/output-mCw8qLtU.d.mts +0 -18
- package/dist/plugin-85Hf9k78.mjs +0 -1
- package/dist/plugin-BxLnzK0D.d.cts +0 -39
- package/dist/plugin-CofWgH_d.cjs +0 -0
- package/dist/plugin-Dk-K1xNv.d.mts +0 -39
- package/dist/record-expression-B0NGcmBj.mjs +0 -11
- package/dist/record-expression-P1BTu_7B.d.mts +0 -12
- package/dist/record-expression-j-3eBufn.cjs +0 -17
- package/dist/record-expression-rZuoLQWG.d.cts +0 -12
- package/dist/refkey-BRtVxqGW.d.mts +0 -13
- package/dist/refkey-BUzulmmj.cjs +0 -21
- package/dist/refkey-CSq-Ftvf.mjs +0 -15
- package/dist/refkey-DpAkQ3Cu.d.cts +0 -13
- package/dist/reflection-CIofVJSc.d.cts +0 -51
- package/dist/reflection-CKhynTvI.cjs +0 -108
- package/dist/reflection-DLJTBNiW.d.mts +0 -51
- package/dist/reflection-srixNcX2.mjs +0 -60
- package/dist/single-line-comment-C9Fz5mkM.mjs +0 -21
- package/dist/single-line-comment-DGlX2Mb7.d.mts +0 -22
- package/dist/single-line-comment-_ZglDv1k.cjs +0 -27
- package/dist/single-line-comment-t4FhTWmJ.d.cts +0 -22
- package/dist/source-file-CRG4ToG6.d.cts +0 -31
- package/dist/source-file-DKnFKRGJ.cjs +0 -63
- package/dist/source-file-Db1Wu_yq.mjs +0 -56
- package/dist/source-file-oZxetI1X.d.mts +0 -31
- package/dist/tsdoc-BpykLfnB.cjs +0 -576
- package/dist/tsdoc-CWCdJ1Uj.mjs +0 -456
- package/dist/tsdoc-DFHvkBKn.d.cts +0 -152
- package/dist/tsdoc-DklASt6a.d.mts +0 -152
- package/dist/tsdoc-reflection-BIWxEkBI.mjs +0 -170
- package/dist/tsdoc-reflection-CJuCDgWj.d.mts +0 -18
- package/dist/tsdoc-reflection-Dr_Nf1ht.cjs +0 -188
- package/dist/tsdoc-reflection-qTgLAT6Y.d.cts +0 -18
- package/dist/typescript-BIiCTw8m.d.mts +0 -23
- package/dist/typescript-NNuOlVjo.mjs +0 -45
- package/dist/typescript-VTSR_IQG.cjs +0 -51
- package/dist/typescript-YczHz9BQ.d.cts +0 -23
- package/dist/typescript-file-DLbLtnFd.cjs +0 -208
- package/dist/typescript-file-DmPqmvin.d.mts +0 -47
- package/dist/typescript-file-Y4c2pL0x.d.cts +0 -47
- package/dist/typescript-file-hcvsHaDV.mjs +0 -190
- package/dist/typescript-interface-BM02EN5E.mjs +0 -66
- package/dist/typescript-interface-D9D9lURN.d.mts +0 -24
- package/dist/typescript-interface-DVLxwsNZ.d.cts +0 -24
- package/dist/typescript-interface-cuXGu4c4.cjs +0 -78
- package/dist/typescript-object-Bk0AnSSQ.mjs +0 -123
- package/dist/typescript-object-Bsfy6ZF0.cjs +0 -135
- package/dist/typescript-object-Bw4Ik8qK.d.mts +0 -25
- package/dist/typescript-object-CtW28g7f.d.cts +0 -25
- package/dist/vendor/chunk-554SZY2F.cjs +0 -12556
- package/dist/vendor/chunk-J2T6KGQO.js +0 -12397
- package/dist/vendor/index.cjs +0 -635
- package/dist/vendor/index.d.cts +0 -2
- package/dist/vendor/index.d.ts +0 -2
- package/dist/vendor/index.js +0 -23
- package/dist/vendor/jsx-runtime.cjs +0 -35
- package/dist/vendor/jsx-runtime.d.cts +0 -1
- package/dist/vendor/jsx-runtime.d.ts +0 -1
- package/dist/vendor/jsx-runtime.js +0 -5
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//#region src/helpers/typescript.d.ts
|
|
2
|
-
interface GenerateTypeScriptInterfaceOptions<T> {
|
|
3
|
-
overrideName?: string;
|
|
4
|
-
overrideExtends?: string | false;
|
|
5
|
-
defaultValues?: Partial<T>;
|
|
6
|
-
}
|
|
7
|
-
interface GenerateTypeScriptObjectOptions<T> {
|
|
8
|
-
overrideName?: string;
|
|
9
|
-
overrideExtends?: string | false;
|
|
10
|
-
defaultValues?: Partial<T>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Generates a TypeScript object for the given reflection class.
|
|
14
|
-
*
|
|
15
|
-
* @param reflection - The reflection class to generate the object for.
|
|
16
|
-
* @param options - Options for generating the object.
|
|
17
|
-
* @returns A string containing the TypeScript object definition.
|
|
18
|
-
*/
|
|
19
|
-
declare function generateTypeScriptObject<T extends Record<string, any>>(reflection: ReflectionClass<T>, options?: GenerateTypeScriptObjectOptions<T>): string;
|
|
20
|
-
declare type __ΩGenerateTypeScriptInterfaceOptions = any[];
|
|
21
|
-
declare type __ΩGenerateTypeScriptObjectOptions = any[];
|
|
22
|
-
//#endregion
|
|
23
|
-
export { generateTypeScriptObject as a, __ΩGenerateTypeScriptObjectOptions as i, GenerateTypeScriptObjectOptions as n, __ΩGenerateTypeScriptInterfaceOptions as r, GenerateTypeScriptInterfaceOptions as t };
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-BwyOHTjC.cjs');
|
|
2
|
-
const require_context = require('./context-DkLnFNZm.cjs');
|
|
3
|
-
const require_single_line_comment = require('./single-line-comment-_ZglDv1k.cjs');
|
|
4
|
-
const require_source_file = require('./source-file-DKnFKRGJ.cjs');
|
|
5
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
-
let __powerlines_plugin_alloy_vendor = require("@powerlines/plugin-alloy/vendor");
|
|
7
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
8
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
|
-
let __stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
|
|
12
|
-
|
|
13
|
-
//#region src/typescript/components/typescript-file.tsx
|
|
14
|
-
/**
|
|
15
|
-
* A base component representing a Powerlines generated Typescript source file.
|
|
16
|
-
*
|
|
17
|
-
* @param props - The properties for the source file.
|
|
18
|
-
* @returns The rendered source file component.
|
|
19
|
-
*/
|
|
20
|
-
function TypescriptFile(props) {
|
|
21
|
-
const [{ children, path, imports, tsx, header, hashbang }, rest] = (0, __powerlines_plugin_alloy_vendor.splitProps)(props, [
|
|
22
|
-
"children",
|
|
23
|
-
"path",
|
|
24
|
-
"imports",
|
|
25
|
-
"tsx",
|
|
26
|
-
"header",
|
|
27
|
-
"hashbang"
|
|
28
|
-
]);
|
|
29
|
-
const directoryContext = (0, __powerlines_plugin_alloy_vendor.useContext)(__powerlines_plugin_alloy_vendor.SourceDirectoryContext);
|
|
30
|
-
const sdData = (0, __alloy_js_typescript.getSourceDirectoryData)(directoryContext);
|
|
31
|
-
const modulePath = (0, __stryke_path_append.appendPath)(path, directoryContext.path);
|
|
32
|
-
const scope = new __alloy_js_typescript.TSModuleScope(modulePath, (0, __powerlines_plugin_alloy_vendor.useScope)());
|
|
33
|
-
sdData.modules.add(scope);
|
|
34
|
-
const pkg = (0, __powerlines_plugin_alloy_vendor.useContext)(__alloy_js_typescript.PackageContext);
|
|
35
|
-
if (pkg) pkg.scope.addModule(scope);
|
|
36
|
-
if (props.export) {
|
|
37
|
-
if (pkg) if ((0, __stryke_type_checks_is_boolean.isBoolean)(props.export)) pkg.scope.addExport(modulePath, scope);
|
|
38
|
-
else pkg.scope.addExport(props.export, scope);
|
|
39
|
-
}
|
|
40
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.SourceFileContext.Provider, {
|
|
41
|
-
value: { scope },
|
|
42
|
-
get children() {
|
|
43
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Scope, {
|
|
44
|
-
value: scope,
|
|
45
|
-
get children() {
|
|
46
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_source_file.SourceFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
47
|
-
path: modulePath,
|
|
48
|
-
get header() {
|
|
49
|
-
return header ?? (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeader, {
|
|
50
|
-
hashbang,
|
|
51
|
-
get children() {
|
|
52
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeaderImports, {
|
|
53
|
-
imports,
|
|
54
|
-
scope
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
filetype: tsx ? "tsx" : "typescript",
|
|
60
|
-
children
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
69
|
-
*
|
|
70
|
-
* @param props - The properties for the source file header.
|
|
71
|
-
* @returns The rendered source file header.
|
|
72
|
-
*/
|
|
73
|
-
function TypescriptFileHeader(props) {
|
|
74
|
-
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
75
|
-
const context = require_context.usePowerlines();
|
|
76
|
-
return [
|
|
77
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
78
|
-
get when() {
|
|
79
|
-
return Boolean(hashbang);
|
|
80
|
-
},
|
|
81
|
-
get children() {
|
|
82
|
-
return [(0, __alloy_js_core_jsx_runtime.memo)(() => hashbang === true ? __powerlines_plugin_alloy_vendor.code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
83
|
-
}
|
|
84
|
-
}),
|
|
85
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
86
|
-
get when() {
|
|
87
|
-
return Boolean(header);
|
|
88
|
-
},
|
|
89
|
-
get children() {
|
|
90
|
-
return [header, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
91
|
-
}
|
|
92
|
-
}),
|
|
93
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
94
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
95
|
-
get when() {
|
|
96
|
-
return Boolean(disableEslint);
|
|
97
|
-
},
|
|
98
|
-
get children() {
|
|
99
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, {
|
|
100
|
-
variant: "slash-star",
|
|
101
|
-
children: "eslint-disable"
|
|
102
|
-
}), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
103
|
-
}
|
|
104
|
-
}),
|
|
105
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
106
|
-
get when() {
|
|
107
|
-
return Boolean(disablePrettier);
|
|
108
|
-
},
|
|
109
|
-
get children() {
|
|
110
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, {
|
|
111
|
-
variant: "slash-star",
|
|
112
|
-
children: "prettier-ignore"
|
|
113
|
-
}), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
117
|
-
get when() {
|
|
118
|
-
return Boolean(disableBiome);
|
|
119
|
-
},
|
|
120
|
-
get children() {
|
|
121
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
122
|
-
}
|
|
123
|
-
}),
|
|
124
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
125
|
-
get when() {
|
|
126
|
-
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
127
|
-
},
|
|
128
|
-
get children() {
|
|
129
|
-
return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
130
|
-
}
|
|
131
|
-
}),
|
|
132
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
133
|
-
get when() {
|
|
134
|
-
return Boolean(children);
|
|
135
|
-
},
|
|
136
|
-
get children() {
|
|
137
|
-
return [children, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
138
|
-
}
|
|
139
|
-
}),
|
|
140
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, { get children() {
|
|
141
|
-
return __powerlines_plugin_alloy_vendor.code`Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config.framework) || "Powerlines"}`;
|
|
142
|
-
} }),
|
|
143
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
144
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, { children: __powerlines_plugin_alloy_vendor.code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
145
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
150
|
-
*
|
|
151
|
-
* @param props - The properties for the source file header.
|
|
152
|
-
* @returns The rendered source file header.
|
|
153
|
-
*/
|
|
154
|
-
function TypescriptFileHeaderImports(props) {
|
|
155
|
-
const { imports } = props;
|
|
156
|
-
const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
|
|
157
|
-
const scope = props.scope ?? sourceFile.scope;
|
|
158
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
159
|
-
get when() {
|
|
160
|
-
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
161
|
-
},
|
|
162
|
-
get children() {
|
|
163
|
-
return [
|
|
164
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
165
|
-
get when() {
|
|
166
|
-
return !!imports && Object.keys(imports).length > 0;
|
|
167
|
-
},
|
|
168
|
-
get children() {
|
|
169
|
-
return Object.entries(imports ?? {}).map(([module$1, imported]) => {
|
|
170
|
-
return __powerlines_plugin_alloy_vendor.code`import ${imported === null ? "" : imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${imported.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module$1}";`;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}),
|
|
174
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
175
|
-
get when() {
|
|
176
|
-
return scope.importedModules.size > 0;
|
|
177
|
-
},
|
|
178
|
-
get children() {
|
|
179
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ImportStatements, { get records() {
|
|
180
|
-
return scope.importedModules;
|
|
181
|
-
} });
|
|
182
|
-
}
|
|
183
|
-
}),
|
|
184
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
//#endregion
|
|
191
|
-
Object.defineProperty(exports, 'TypescriptFile', {
|
|
192
|
-
enumerable: true,
|
|
193
|
-
get: function () {
|
|
194
|
-
return TypescriptFile;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
Object.defineProperty(exports, 'TypescriptFileHeader', {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
get: function () {
|
|
200
|
-
return TypescriptFileHeader;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
Object.defineProperty(exports, 'TypescriptFileHeaderImports', {
|
|
204
|
-
enumerable: true,
|
|
205
|
-
get: function () {
|
|
206
|
-
return TypescriptFileHeaderImports;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { h as TypescriptFileImports, n as ComponentProps, p as SourceFileHeaderProps } from "./components-D22-W7dz.mjs";
|
|
2
|
-
import { n as SourceFileProps$1 } from "./source-file-oZxetI1X.mjs";
|
|
3
|
-
import { Children } from "@powerlines/plugin-alloy/vendor";
|
|
4
|
-
import { TSModuleScope } from "@alloy-js/typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/typescript-file.d.ts
|
|
7
|
-
type TypescriptFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
|
|
8
|
-
hashbang?: Children | true;
|
|
9
|
-
header?: Children;
|
|
10
|
-
imports?: TypescriptFileImports;
|
|
11
|
-
export?: boolean | string;
|
|
12
|
-
tsx?: boolean;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* A base component representing a Powerlines generated Typescript source file.
|
|
16
|
-
*
|
|
17
|
-
* @param props - The properties for the source file.
|
|
18
|
-
* @returns The rendered source file component.
|
|
19
|
-
*/
|
|
20
|
-
declare function TypescriptFile(props: TypescriptFileProps): Children;
|
|
21
|
-
interface TypescriptFileHeaderProps extends SourceFileHeaderProps {
|
|
22
|
-
header?: Children;
|
|
23
|
-
hashbang?: Children | true;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
27
|
-
*
|
|
28
|
-
* @param props - The properties for the source file header.
|
|
29
|
-
* @returns The rendered source file header.
|
|
30
|
-
*/
|
|
31
|
-
declare function TypescriptFileHeader(props: TypescriptFileHeaderProps): Children;
|
|
32
|
-
interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {
|
|
33
|
-
imports?: TypescriptFileImports;
|
|
34
|
-
scope?: TSModuleScope;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
38
|
-
*
|
|
39
|
-
* @param props - The properties for the source file header.
|
|
40
|
-
* @returns The rendered source file header.
|
|
41
|
-
*/
|
|
42
|
-
declare function TypescriptFileHeaderImports(props: TypescriptFileHeaderImportsProps): Children;
|
|
43
|
-
declare type __ΩTypescriptFileProps = any[];
|
|
44
|
-
declare type __ΩTypescriptFileHeaderProps = any[];
|
|
45
|
-
declare type __ΩTypescriptFileHeaderImportsProps = any[];
|
|
46
|
-
//#endregion
|
|
47
|
-
export { TypescriptFileHeaderProps as a, __ΩTypescriptFileHeaderProps as c, TypescriptFileHeaderImportsProps as i, __ΩTypescriptFileProps as l, TypescriptFileHeader as n, TypescriptFileProps as o, TypescriptFileHeaderImports as r, __ΩTypescriptFileHeaderImportsProps as s, TypescriptFile as t };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { h as TypescriptFileImports, n as ComponentProps, p as SourceFileHeaderProps } from "./components-5TS7e4GS.cjs";
|
|
2
|
-
import { n as SourceFileProps$1 } from "./source-file-CRG4ToG6.cjs";
|
|
3
|
-
import { Children } from "@powerlines/plugin-alloy/vendor";
|
|
4
|
-
import { TSModuleScope } from "@alloy-js/typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/typescript-file.d.ts
|
|
7
|
-
type TypescriptFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
|
|
8
|
-
hashbang?: Children | true;
|
|
9
|
-
header?: Children;
|
|
10
|
-
imports?: TypescriptFileImports;
|
|
11
|
-
export?: boolean | string;
|
|
12
|
-
tsx?: boolean;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* A base component representing a Powerlines generated Typescript source file.
|
|
16
|
-
*
|
|
17
|
-
* @param props - The properties for the source file.
|
|
18
|
-
* @returns The rendered source file component.
|
|
19
|
-
*/
|
|
20
|
-
declare function TypescriptFile(props: TypescriptFileProps): Children;
|
|
21
|
-
interface TypescriptFileHeaderProps extends SourceFileHeaderProps {
|
|
22
|
-
header?: Children;
|
|
23
|
-
hashbang?: Children | true;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
27
|
-
*
|
|
28
|
-
* @param props - The properties for the source file header.
|
|
29
|
-
* @returns The rendered source file header.
|
|
30
|
-
*/
|
|
31
|
-
declare function TypescriptFileHeader(props: TypescriptFileHeaderProps): Children;
|
|
32
|
-
interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {
|
|
33
|
-
imports?: TypescriptFileImports;
|
|
34
|
-
scope?: TSModuleScope;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
38
|
-
*
|
|
39
|
-
* @param props - The properties for the source file header.
|
|
40
|
-
* @returns The rendered source file header.
|
|
41
|
-
*/
|
|
42
|
-
declare function TypescriptFileHeaderImports(props: TypescriptFileHeaderImportsProps): Children;
|
|
43
|
-
declare type __ΩTypescriptFileProps = any[];
|
|
44
|
-
declare type __ΩTypescriptFileHeaderProps = any[];
|
|
45
|
-
declare type __ΩTypescriptFileHeaderImportsProps = any[];
|
|
46
|
-
//#endregion
|
|
47
|
-
export { TypescriptFileHeaderProps as a, __ΩTypescriptFileHeaderProps as c, TypescriptFileHeaderImportsProps as i, __ΩTypescriptFileProps as l, TypescriptFileHeader as n, TypescriptFileProps as o, TypescriptFileHeaderImports as r, __ΩTypescriptFileHeaderImportsProps as s, TypescriptFile as t };
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { n as usePowerlines } from "./context-eP3fitqj.mjs";
|
|
2
|
-
import { t as SingleLineComment } from "./single-line-comment-C9Fz5mkM.mjs";
|
|
3
|
-
import { t as SourceFile } from "./source-file-Db1Wu_yq.mjs";
|
|
4
|
-
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
-
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@powerlines/plugin-alloy/vendor";
|
|
6
|
-
import { appendPath } from "@stryke/path/append";
|
|
7
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
8
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
9
|
-
import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
|
|
10
|
-
import { isBoolean } from "@stryke/type-checks/is-boolean";
|
|
11
|
-
|
|
12
|
-
//#region src/typescript/components/typescript-file.tsx
|
|
13
|
-
/**
|
|
14
|
-
* A base component representing a Powerlines generated Typescript source file.
|
|
15
|
-
*
|
|
16
|
-
* @param props - The properties for the source file.
|
|
17
|
-
* @returns The rendered source file component.
|
|
18
|
-
*/
|
|
19
|
-
function TypescriptFile(props) {
|
|
20
|
-
const [{ children, path, imports, tsx, header, hashbang }, rest] = splitProps(props, [
|
|
21
|
-
"children",
|
|
22
|
-
"path",
|
|
23
|
-
"imports",
|
|
24
|
-
"tsx",
|
|
25
|
-
"header",
|
|
26
|
-
"hashbang"
|
|
27
|
-
]);
|
|
28
|
-
const directoryContext = useContext(SourceDirectoryContext);
|
|
29
|
-
const sdData = getSourceDirectoryData(directoryContext);
|
|
30
|
-
const modulePath = appendPath(path, directoryContext.path);
|
|
31
|
-
const scope = new TSModuleScope(modulePath, useScope());
|
|
32
|
-
sdData.modules.add(scope);
|
|
33
|
-
const pkg = useContext(PackageContext);
|
|
34
|
-
if (pkg) pkg.scope.addModule(scope);
|
|
35
|
-
if (props.export) {
|
|
36
|
-
if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
|
|
37
|
-
else pkg.scope.addExport(props.export, scope);
|
|
38
|
-
}
|
|
39
|
-
return createComponent(SourceFileContext$1.Provider, {
|
|
40
|
-
value: { scope },
|
|
41
|
-
get children() {
|
|
42
|
-
return createComponent(Scope, {
|
|
43
|
-
value: scope,
|
|
44
|
-
get children() {
|
|
45
|
-
return createComponent(SourceFile, mergeProps(rest, {
|
|
46
|
-
path: modulePath,
|
|
47
|
-
get header() {
|
|
48
|
-
return header ?? createComponent(TypescriptFileHeader, {
|
|
49
|
-
hashbang,
|
|
50
|
-
get children() {
|
|
51
|
-
return createComponent(TypescriptFileHeaderImports, {
|
|
52
|
-
imports,
|
|
53
|
-
scope
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
filetype: tsx ? "tsx" : "typescript",
|
|
59
|
-
children
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
68
|
-
*
|
|
69
|
-
* @param props - The properties for the source file header.
|
|
70
|
-
* @returns The rendered source file header.
|
|
71
|
-
*/
|
|
72
|
-
function TypescriptFileHeader(props) {
|
|
73
|
-
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
74
|
-
const context = usePowerlines();
|
|
75
|
-
return [
|
|
76
|
-
createComponent(Show, {
|
|
77
|
-
get when() {
|
|
78
|
-
return Boolean(hashbang);
|
|
79
|
-
},
|
|
80
|
-
get children() {
|
|
81
|
-
return [memo(() => hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), createIntrinsic("hbr", {})];
|
|
82
|
-
}
|
|
83
|
-
}),
|
|
84
|
-
createComponent(Show, {
|
|
85
|
-
get when() {
|
|
86
|
-
return Boolean(header);
|
|
87
|
-
},
|
|
88
|
-
get children() {
|
|
89
|
-
return [header, createIntrinsic("hbr", {})];
|
|
90
|
-
}
|
|
91
|
-
}),
|
|
92
|
-
createIntrinsic("hbr", {}),
|
|
93
|
-
createComponent(Show, {
|
|
94
|
-
get when() {
|
|
95
|
-
return Boolean(disableEslint);
|
|
96
|
-
},
|
|
97
|
-
get children() {
|
|
98
|
-
return [createComponent(SingleLineComment, {
|
|
99
|
-
variant: "slash-star",
|
|
100
|
-
children: "eslint-disable"
|
|
101
|
-
}), createIntrinsic("hbr", {})];
|
|
102
|
-
}
|
|
103
|
-
}),
|
|
104
|
-
createComponent(Show, {
|
|
105
|
-
get when() {
|
|
106
|
-
return Boolean(disablePrettier);
|
|
107
|
-
},
|
|
108
|
-
get children() {
|
|
109
|
-
return [createComponent(SingleLineComment, {
|
|
110
|
-
variant: "slash-star",
|
|
111
|
-
children: "prettier-ignore"
|
|
112
|
-
}), createIntrinsic("hbr", {})];
|
|
113
|
-
}
|
|
114
|
-
}),
|
|
115
|
-
createComponent(Show, {
|
|
116
|
-
get when() {
|
|
117
|
-
return Boolean(disableBiome);
|
|
118
|
-
},
|
|
119
|
-
get children() {
|
|
120
|
-
return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
|
|
121
|
-
}
|
|
122
|
-
}),
|
|
123
|
-
createComponent(Show, {
|
|
124
|
-
get when() {
|
|
125
|
-
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
126
|
-
},
|
|
127
|
-
get children() {
|
|
128
|
-
return createIntrinsic("hbr", {});
|
|
129
|
-
}
|
|
130
|
-
}),
|
|
131
|
-
createComponent(Show, {
|
|
132
|
-
get when() {
|
|
133
|
-
return Boolean(children);
|
|
134
|
-
},
|
|
135
|
-
get children() {
|
|
136
|
-
return [children, createIntrinsic("hbr", {})];
|
|
137
|
-
}
|
|
138
|
-
}),
|
|
139
|
-
createComponent(SingleLineComment, { get children() {
|
|
140
|
-
return code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}`;
|
|
141
|
-
} }),
|
|
142
|
-
createIntrinsic("hbr", {}),
|
|
143
|
-
createComponent(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
144
|
-
createIntrinsic("hbr", {})
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
149
|
-
*
|
|
150
|
-
* @param props - The properties for the source file header.
|
|
151
|
-
* @returns The rendered source file header.
|
|
152
|
-
*/
|
|
153
|
-
function TypescriptFileHeaderImports(props) {
|
|
154
|
-
const { imports } = props;
|
|
155
|
-
const sourceFile = useSourceFile();
|
|
156
|
-
const scope = props.scope ?? sourceFile.scope;
|
|
157
|
-
return createComponent(Show, {
|
|
158
|
-
get when() {
|
|
159
|
-
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
160
|
-
},
|
|
161
|
-
get children() {
|
|
162
|
-
return [
|
|
163
|
-
createComponent(Show, {
|
|
164
|
-
get when() {
|
|
165
|
-
return !!imports && Object.keys(imports).length > 0;
|
|
166
|
-
},
|
|
167
|
-
get children() {
|
|
168
|
-
return Object.entries(imports ?? {}).map(([module, imported]) => {
|
|
169
|
-
return code`import ${imported === null ? "" : imported.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !isString(i) && i.default).length > 0 && imported.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${imported.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module}";`;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}),
|
|
173
|
-
createComponent(Show, {
|
|
174
|
-
get when() {
|
|
175
|
-
return scope.importedModules.size > 0;
|
|
176
|
-
},
|
|
177
|
-
get children() {
|
|
178
|
-
return createComponent(ImportStatements, { get records() {
|
|
179
|
-
return scope.importedModules;
|
|
180
|
-
} });
|
|
181
|
-
}
|
|
182
|
-
}),
|
|
183
|
-
createIntrinsic("hbr", {})
|
|
184
|
-
];
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
//#endregion
|
|
190
|
-
export { TypescriptFileHeader as n, TypescriptFileHeaderImports as r, TypescriptFile as t };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { i as ReflectionPropertyContext, t as ReflectionClassContext } from "./reflection-srixNcX2.mjs";
|
|
2
|
-
import { r as TSDocReflectionProperty, t as TSDocReflectionClass } from "./tsdoc-reflection-BIWxEkBI.mjs";
|
|
3
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { For, computed, splitProps } from "@powerlines/plugin-alloy/vendor";
|
|
5
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
7
|
-
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
8
|
-
|
|
9
|
-
//#region src/typescript/components/typescript-interface.tsx
|
|
10
|
-
/**
|
|
11
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
12
|
-
*/
|
|
13
|
-
function TypeScriptInterface(props) {
|
|
14
|
-
const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
|
|
15
|
-
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
|
|
16
|
-
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);
|
|
17
|
-
return createComponent(ReflectionClassContext.Provider, {
|
|
18
|
-
value: { reflection },
|
|
19
|
-
get children() {
|
|
20
|
-
return [createComponent(TSDocReflectionClass, {}), createComponent(InterfaceDeclaration, mergeProps({
|
|
21
|
-
"export": true,
|
|
22
|
-
get name() {
|
|
23
|
-
return interfaceName.value;
|
|
24
|
-
}
|
|
25
|
-
}, rest, { get children() {
|
|
26
|
-
return createComponent(For, {
|
|
27
|
-
each: properties,
|
|
28
|
-
doubleHardline: true,
|
|
29
|
-
semicolon: true,
|
|
30
|
-
children: (prop) => createComponent(TypescriptInterfaceProperty, { property: prop })
|
|
31
|
-
});
|
|
32
|
-
} }))];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
38
|
-
*/
|
|
39
|
-
function TypescriptInterfaceProperty(props) {
|
|
40
|
-
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
41
|
-
return createComponent(ReflectionPropertyContext.Provider, {
|
|
42
|
-
value: property,
|
|
43
|
-
get children() {
|
|
44
|
-
return [createComponent(TSDocReflectionProperty, {}), createComponent(InterfaceMember, mergeProps({
|
|
45
|
-
get name() {
|
|
46
|
-
return property.getNameAsString();
|
|
47
|
-
},
|
|
48
|
-
get readonly() {
|
|
49
|
-
return property.isReadonly();
|
|
50
|
-
},
|
|
51
|
-
get optional() {
|
|
52
|
-
return property.isOptional();
|
|
53
|
-
},
|
|
54
|
-
get nullish() {
|
|
55
|
-
return property.isNullable();
|
|
56
|
-
},
|
|
57
|
-
get type() {
|
|
58
|
-
return stringifyType(property.getType());
|
|
59
|
-
}
|
|
60
|
-
}, rest))];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//#endregion
|
|
66
|
-
export { TypescriptInterfaceProperty as n, TypeScriptInterface as t };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { n as ComponentProps } from "./components-D22-W7dz.mjs";
|
|
2
|
-
import * as _alloy_js_core13 from "@alloy-js/core";
|
|
3
|
-
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
4
|
-
|
|
5
|
-
//#region src/typescript/components/typescript-interface.d.ts
|
|
6
|
-
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
7
|
-
reflection: ReflectionClass<T>;
|
|
8
|
-
defaultValue?: Partial<T>;
|
|
9
|
-
}
|
|
10
|
-
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
11
|
-
property: ReflectionProperty;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
15
|
-
*/
|
|
16
|
-
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core13.Children;
|
|
17
|
-
/**
|
|
18
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
19
|
-
*/
|
|
20
|
-
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core13.Children;
|
|
21
|
-
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
22
|
-
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
23
|
-
//#endregion
|
|
24
|
-
export { __ΩTypeScriptInterfaceProps as a, TypescriptInterfacePropertyProps as i, TypeScriptInterfaceProps as n, __ΩTypescriptInterfacePropertyProps as o, TypescriptInterfaceProperty as r, TypeScriptInterface as t };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { n as ComponentProps } from "./components-5TS7e4GS.cjs";
|
|
2
|
-
import * as _alloy_js_core15 from "@alloy-js/core";
|
|
3
|
-
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
4
|
-
|
|
5
|
-
//#region src/typescript/components/typescript-interface.d.ts
|
|
6
|
-
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
7
|
-
reflection: ReflectionClass<T>;
|
|
8
|
-
defaultValue?: Partial<T>;
|
|
9
|
-
}
|
|
10
|
-
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
11
|
-
property: ReflectionProperty;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
15
|
-
*/
|
|
16
|
-
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core15.Children;
|
|
17
|
-
/**
|
|
18
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
19
|
-
*/
|
|
20
|
-
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core15.Children;
|
|
21
|
-
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
22
|
-
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
23
|
-
//#endregion
|
|
24
|
-
export { __ΩTypeScriptInterfaceProps as a, TypescriptInterfacePropertyProps as i, TypeScriptInterfaceProps as n, __ΩTypescriptInterfacePropertyProps as o, TypescriptInterfaceProperty as r, TypeScriptInterface as t };
|