@powerlines/plugin-alloy 0.15.1 → 0.15.3
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/builtin-file-BDc5-4_L.mjs +43 -0
- package/dist/{builtin-file-CIBzJ6jy.d.mts → builtin-file-BxePApb0.d.mts} +4 -4
- package/dist/{builtin-file-DLVCgiye.cjs → builtin-file-Cey2cJy9.cjs} +20 -14
- package/dist/{builtin-file-C-AX3Zai.d.cts → builtin-file-Cq1ooVDk.d.cts} +3 -3
- package/dist/{capnp-CbBwObRD.d.mts → capnp-DkidugOV.d.mts} +1 -1
- package/dist/{components-IB9A7YaB.d.mts → components-ixU_ICbr.d.mts} +5 -5
- package/dist/{context-D-UHaRnr.d.mts → context-BApo1nhP.d.mts} +1 -1
- package/dist/{context-0Spyyas6.d.mts → context-DXy7MPku.d.mts} +0 -2
- package/dist/core/components/index.cjs +3 -3
- package/dist/core/components/index.d.cts +2 -2
- package/dist/core/components/index.d.mts +5 -5
- package/dist/core/components/index.mjs +3 -3
- package/dist/core/components/output.cjs +1 -1
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/output.mjs +1 -1
- package/dist/core/components/single-line-comment.cjs +1 -1
- package/dist/core/components/single-line-comment.d.cts +1 -1
- package/dist/core/components/single-line-comment.d.mts +3 -3
- package/dist/core/components/single-line-comment.mjs +1 -1
- package/dist/core/components/source-file.cjs +1 -1
- package/dist/core/components/source-file.d.cts +1 -1
- package/dist/core/components/source-file.d.mts +3 -3
- package/dist/core/components/source-file.mjs +1 -1
- package/dist/core/contexts/context.d.mts +2 -2
- package/dist/core/contexts/index.d.mts +4 -4
- package/dist/core/contexts/reflection.d.mts +3 -3
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.mts +7 -7
- package/dist/core/index.mjs +3 -3
- package/dist/{dynamic-import-statement-DoTHSt57.mjs → dynamic-import-statement-CWK5I_yt.mjs} +2 -6
- package/dist/{dynamic-import-statement-DO0ewx0l.d.cts → dynamic-import-statement-D6f1SnIf.d.mts} +2 -2
- package/dist/{dynamic-import-statement-JVLyMPXr.cjs → dynamic-import-statement-DVGp5Cvq.cjs} +2 -6
- package/dist/{dynamic-import-statement-tQyMvDe7.d.mts → dynamic-import-statement-Dk3bSR8x.d.cts} +2 -2
- package/dist/{entry-file-BEHDg4dR.d.cts → entry-file-B5YXZbGV.d.cts} +3 -3
- package/dist/{entry-file-BA75rAwb.cjs → entry-file-DijEelFv.cjs} +10 -7
- package/dist/{entry-file-Bw1mgMP3.mjs → entry-file-DtjJPVZY.mjs} +10 -7
- package/dist/{entry-file-BgTZY0YN.d.mts → entry-file-HWtqk30Z.d.mts} +4 -4
- package/dist/helpers/capnp.d.mts +2 -2
- package/dist/helpers/index.d.mts +2 -2
- package/dist/index.cjs +67 -230
- package/dist/index.d.cts +11 -11
- package/dist/index.d.mts +19 -19
- package/dist/index.mjs +66 -224
- package/dist/markdown/components/index.cjs +4 -4
- package/dist/markdown/components/index.d.cts +3 -3
- package/dist/markdown/components/index.d.mts +5 -5
- package/dist/markdown/components/index.mjs +4 -4
- package/dist/markdown/components/markdown-file.cjs +3 -3
- package/dist/markdown/components/markdown-file.d.cts +2 -2
- package/dist/markdown/components/markdown-file.d.mts +4 -4
- package/dist/markdown/components/markdown-file.mjs +3 -3
- package/dist/markdown/components/markdown-table.cjs +1 -1
- package/dist/markdown/components/markdown-table.d.cts +1 -1
- package/dist/markdown/components/markdown-table.d.mts +3 -3
- package/dist/markdown/components/markdown-table.mjs +1 -1
- package/dist/markdown/index.cjs +4 -4
- package/dist/markdown/index.d.cts +3 -3
- package/dist/markdown/index.d.mts +5 -5
- package/dist/markdown/index.mjs +4 -4
- package/dist/markdown-file-BVSRcpXO.cjs +128 -0
- package/dist/{markdown-file-BhMk-_1z.d.mts → markdown-file-CKkjaqpP.d.mts} +5 -5
- package/dist/markdown-file-Clh5iU1_.mjs +116 -0
- package/dist/{markdown-file-BjhcGybj.d.cts → markdown-file-EKqcnqeE.d.cts} +4 -4
- package/dist/{markdown-table-DhDqQVt_.d.cts → markdown-table-83GdY7ag.d.mts} +6 -6
- package/dist/{markdown-table-DFaNSBRn.cjs → markdown-table-B40X-Kp1.cjs} +49 -28
- package/dist/{markdown-table-DxL06EFD.d.mts → markdown-table-BIRzgtYb.d.cts} +2 -2
- package/dist/{markdown-table-BUxH6aRh.mjs → markdown-table-D-YnljE7.mjs} +49 -28
- package/dist/{output-CnofBsl0.cjs → output-BlHZS50Y.cjs} +19 -12
- package/dist/{output-DEdXZ94G.mjs → output-CNnPjQlW.mjs} +19 -12
- package/dist/{output-Cos2Dz1j.d.mts → output-Di6Elv89.d.mts} +3 -3
- package/dist/{plugin-DmLCIqx0.d.mts → plugin-LknisCLa.d.mts} +3 -3
- package/dist/{reflection-BiWgd3An.d.mts → reflection-DLJST1Z7.d.mts} +1 -1
- package/dist/{single-line-comment-DRU3a4Qy.d.mts → single-line-comment-BhEed2Bl.d.cts} +3 -3
- package/dist/{single-line-comment-C5CtHQhi.mjs → single-line-comment-Biwa95Py.mjs} +6 -4
- package/dist/{single-line-comment-CuFhTxLD.d.cts → single-line-comment-CH3Apcm8.d.mts} +1 -1
- package/dist/{single-line-comment-BMPq6OR0.cjs → single-line-comment-DvU69OGj.cjs} +6 -4
- package/dist/{source-file-dpP3BrmV.d.mts → source-file-BNEo0iAE.d.mts} +4 -4
- package/dist/{source-file-DK_PJbR-.d.cts → source-file-BOgnPw2P.d.cts} +2 -2
- package/dist/{source-file-DTd1KgD5.cjs → source-file-DK_nFwAK.cjs} +10 -6
- package/dist/{source-file-CCYwl5pI.mjs → source-file-Dna2E0ro.mjs} +10 -6
- package/dist/tsdoc-B0TNs3dK.cjs +576 -0
- package/dist/{tsdoc-DzCqaUAX.d.mts → tsdoc-QH5nHvck.d.mts} +1 -1
- package/dist/tsdoc-XXdq_9iS.mjs +456 -0
- package/dist/tsdoc-reflection-BizVi_gn.cjs +188 -0
- package/dist/{tsdoc-reflection-BOvlOXzR.d.cts → tsdoc-reflection-DllAx-qb.d.cts} +4 -4
- package/dist/{tsdoc-reflection-BbLwFCUm.d.mts → tsdoc-reflection-DtWdO7Hk.d.mts} +5 -5
- package/dist/tsdoc-reflection-IWtPMJjw.mjs +170 -0
- package/dist/types/components.d.mts +2 -2
- package/dist/types/index.d.mts +3 -3
- package/dist/types/plugin.d.mts +2 -2
- package/dist/typescript/components/builtin-file.cjs +5 -5
- package/dist/typescript/components/builtin-file.d.cts +3 -3
- package/dist/typescript/components/builtin-file.d.mts +6 -6
- package/dist/typescript/components/builtin-file.mjs +5 -5
- package/dist/typescript/components/dynamic-import-statement.cjs +1 -1
- package/dist/typescript/components/dynamic-import-statement.d.cts +1 -1
- package/dist/typescript/components/dynamic-import-statement.d.mts +1 -1
- package/dist/typescript/components/dynamic-import-statement.mjs +1 -1
- package/dist/typescript/components/entry-file.cjs +4 -4
- package/dist/typescript/components/entry-file.d.cts +3 -3
- package/dist/typescript/components/entry-file.d.mts +5 -5
- package/dist/typescript/components/entry-file.mjs +4 -4
- package/dist/typescript/components/index.cjs +10 -10
- package/dist/typescript/components/index.d.cts +8 -8
- package/dist/typescript/components/index.d.mts +11 -11
- package/dist/typescript/components/index.mjs +10 -10
- package/dist/typescript/components/tsdoc-reflection.cjs +2 -2
- package/dist/typescript/components/tsdoc-reflection.d.cts +1 -1
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
- package/dist/typescript/components/tsdoc-reflection.mjs +2 -2
- package/dist/typescript/components/tsdoc.cjs +1 -1
- package/dist/typescript/components/tsdoc.d.mts +3 -3
- package/dist/typescript/components/tsdoc.mjs +1 -1
- package/dist/typescript/components/typescript-file.cjs +3 -3
- package/dist/typescript/components/typescript-file.d.cts +2 -2
- package/dist/typescript/components/typescript-file.d.mts +4 -4
- package/dist/typescript/components/typescript-file.mjs +3 -3
- package/dist/typescript/components/typescript-interface.cjs +3 -3
- package/dist/typescript/components/typescript-interface.d.cts +1 -1
- package/dist/typescript/components/typescript-interface.d.mts +3 -3
- package/dist/typescript/components/typescript-interface.mjs +3 -3
- package/dist/typescript/components/typescript-object.cjs +3 -3
- package/dist/typescript/components/typescript-object.d.cts +1 -1
- package/dist/typescript/components/typescript-object.d.mts +3 -3
- package/dist/typescript/components/typescript-object.mjs +3 -3
- package/dist/typescript/index.cjs +10 -10
- package/dist/typescript/index.d.cts +8 -8
- package/dist/typescript/index.d.mts +11 -11
- package/dist/typescript/index.mjs +10 -10
- package/dist/{typescript-file-BjpHsTUl.d.cts → typescript-file-BDXTfhtE.d.cts} +1 -1
- package/dist/{typescript-file-CxHfiE2u.d.mts → typescript-file-BljeGTrz.d.mts} +2 -2
- package/dist/typescript-file-CLL-ELi0.mjs +190 -0
- package/dist/typescript-file-HsAUWnQY.cjs +208 -0
- package/dist/{typescript-interface-D8u8bgxN.d.mts → typescript-interface-CTt8ULTa.d.mts} +4 -4
- package/dist/{typescript-interface-Codd49Sl.cjs → typescript-interface-DwHJ9in_.cjs} +38 -23
- package/dist/{typescript-interface-AydoCmGY.mjs → typescript-interface-FVDsEsu0.mjs} +38 -23
- package/dist/{typescript-interface-CVB4juPk.d.cts → typescript-interface-raVgIJpX.d.cts} +3 -3
- package/dist/{typescript-object-DOrJkpcM.cjs → typescript-object-D8MHeFId.cjs} +75 -45
- package/dist/{typescript-object-qZFhyXJU.d.mts → typescript-object-Db0fqsDb.d.cts} +2 -2
- package/dist/{typescript-object-C-BmpHfk.mjs → typescript-object-Ju07nQg9.mjs} +75 -45
- package/dist/{typescript-object-BPZlvCrZ.d.cts → typescript-object-USS-Xx2b.d.mts} +5 -5
- package/package.json +12 -20
- package/dist/builtin-file-CkwxD4el.mjs +0 -37
- package/dist/markdown-file-BFbbzD59.mjs +0 -90
- package/dist/markdown-file-CzGNj_Ex.cjs +0 -102
- package/dist/tsdoc-BFPYF-Fh.cjs +0 -487
- package/dist/tsdoc-BmyOQBxT.mjs +0 -367
- package/dist/tsdoc-reflection-3hSdGY1e.mjs +0 -97
- package/dist/tsdoc-reflection-BQN8iUG1.cjs +0 -115
- package/dist/typescript-file-6Y81yLyB.cjs +0 -157
- package/dist/typescript-file-y6oF016h.mjs +0 -139
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_context = require('./context-BIduC1bB.cjs');
|
|
3
|
-
const require_single_line_comment = require('./single-line-comment-BMPq6OR0.cjs');
|
|
4
|
-
const require_source_file = require('./source-file-DTd1KgD5.cjs');
|
|
5
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
9
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
10
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
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, __alloy_js_core.splitProps)(props, [
|
|
22
|
-
"children",
|
|
23
|
-
"path",
|
|
24
|
-
"imports",
|
|
25
|
-
"tsx",
|
|
26
|
-
"header",
|
|
27
|
-
"hashbang"
|
|
28
|
-
]);
|
|
29
|
-
const directoryContext = (0, __alloy_js_core.useContext)(__alloy_js_core.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, __alloy_js_core.useScope)());
|
|
33
|
-
sdData.modules.add(scope);
|
|
34
|
-
const pkg = (0, __alloy_js_core.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 /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_typescript.SourceFileContext.Provider, {
|
|
41
|
-
value: { scope },
|
|
42
|
-
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Scope, {
|
|
43
|
-
value: scope,
|
|
44
|
-
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_source_file.SourceFile, {
|
|
45
|
-
...rest,
|
|
46
|
-
path: modulePath,
|
|
47
|
-
header: header ?? /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(TypescriptFileHeader, {
|
|
48
|
-
hashbang,
|
|
49
|
-
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(TypescriptFileHeaderImports, {
|
|
50
|
-
imports,
|
|
51
|
-
scope
|
|
52
|
-
})
|
|
53
|
-
}),
|
|
54
|
-
filetype: tsx ? "tsx" : "typescript",
|
|
55
|
-
children
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
62
|
-
*
|
|
63
|
-
* @param props - The properties for the source file header.
|
|
64
|
-
* @returns The rendered source file header.
|
|
65
|
-
*/
|
|
66
|
-
function TypescriptFileHeader(props) {
|
|
67
|
-
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
68
|
-
const context = require_context.usePowerlines();
|
|
69
|
-
return /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core_jsx_runtime.Fragment, { children: [
|
|
70
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
71
|
-
when: Boolean(hashbang),
|
|
72
|
-
children: [hashbang === true ? __alloy_js_core.code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
75
|
-
when: Boolean(header),
|
|
76
|
-
children: [header, /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
77
|
-
}),
|
|
78
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
79
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
80
|
-
when: Boolean(disableEslint),
|
|
81
|
-
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, {
|
|
82
|
-
variant: "slash-star",
|
|
83
|
-
children: "eslint-disable"
|
|
84
|
-
}), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
85
|
-
}),
|
|
86
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
87
|
-
when: Boolean(disablePrettier),
|
|
88
|
-
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, {
|
|
89
|
-
variant: "slash-star",
|
|
90
|
-
children: "prettier-ignore"
|
|
91
|
-
}), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
92
|
-
}),
|
|
93
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
94
|
-
when: Boolean(disableBiome),
|
|
95
|
-
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
96
|
-
}),
|
|
97
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
98
|
-
when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
|
|
99
|
-
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
100
|
-
}),
|
|
101
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
102
|
-
when: Boolean(children),
|
|
103
|
-
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})] })
|
|
104
|
-
}),
|
|
105
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: __alloy_js_core.code`Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config.framework) || "Powerlines"}` }),
|
|
106
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
107
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: __alloy_js_core.code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
108
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
109
|
-
] });
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
113
|
-
*
|
|
114
|
-
* @param props - The properties for the source file header.
|
|
115
|
-
* @returns The rendered source file header.
|
|
116
|
-
*/
|
|
117
|
-
function TypescriptFileHeaderImports(props) {
|
|
118
|
-
const { imports } = props;
|
|
119
|
-
const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
|
|
120
|
-
const scope = props.scope ?? sourceFile.scope;
|
|
121
|
-
return /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
122
|
-
when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0,
|
|
123
|
-
children: [
|
|
124
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
125
|
-
when: !!imports && Object.keys(imports).length > 0,
|
|
126
|
-
children: Object.entries(imports ?? {}).map(([module$1, imported]) => {
|
|
127
|
-
return __alloy_js_core.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}";`;
|
|
128
|
-
})
|
|
129
|
-
}),
|
|
130
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
131
|
-
when: scope.importedModules.size > 0,
|
|
132
|
-
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_typescript.ImportStatements, { records: scope.importedModules })
|
|
133
|
-
}),
|
|
134
|
-
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
135
|
-
]
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
//#endregion
|
|
140
|
-
Object.defineProperty(exports, 'TypescriptFile', {
|
|
141
|
-
enumerable: true,
|
|
142
|
-
get: function () {
|
|
143
|
-
return TypescriptFile;
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
Object.defineProperty(exports, 'TypescriptFileHeader', {
|
|
147
|
-
enumerable: true,
|
|
148
|
-
get: function () {
|
|
149
|
-
return TypescriptFileHeader;
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
Object.defineProperty(exports, 'TypescriptFileHeaderImports', {
|
|
153
|
-
enumerable: true,
|
|
154
|
-
get: function () {
|
|
155
|
-
return TypescriptFileHeaderImports;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { n as usePowerlines } from "./context-Cx38_mgI.mjs";
|
|
2
|
-
import { t as SingleLineComment } from "./single-line-comment-C5CtHQhi.mjs";
|
|
3
|
-
import { t as SourceFile } from "./source-file-CCYwl5pI.mjs";
|
|
4
|
-
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
5
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
7
|
-
import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
|
|
8
|
-
import { appendPath } from "@stryke/path/append";
|
|
9
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
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 /* @__PURE__ */ jsx(SourceFileContext$1.Provider, {
|
|
40
|
-
value: { scope },
|
|
41
|
-
children: /* @__PURE__ */ jsx(Scope, {
|
|
42
|
-
value: scope,
|
|
43
|
-
children: /* @__PURE__ */ jsx(SourceFile, {
|
|
44
|
-
...rest,
|
|
45
|
-
path: modulePath,
|
|
46
|
-
header: header ?? /* @__PURE__ */ jsx(TypescriptFileHeader, {
|
|
47
|
-
hashbang,
|
|
48
|
-
children: /* @__PURE__ */ jsx(TypescriptFileHeaderImports, {
|
|
49
|
-
imports,
|
|
50
|
-
scope
|
|
51
|
-
})
|
|
52
|
-
}),
|
|
53
|
-
filetype: tsx ? "tsx" : "typescript",
|
|
54
|
-
children
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
61
|
-
*
|
|
62
|
-
* @param props - The properties for the source file header.
|
|
63
|
-
* @returns The rendered source file header.
|
|
64
|
-
*/
|
|
65
|
-
function TypescriptFileHeader(props) {
|
|
66
|
-
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
67
|
-
const context = usePowerlines();
|
|
68
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
-
/* @__PURE__ */ jsxs(Show, {
|
|
70
|
-
when: Boolean(hashbang),
|
|
71
|
-
children: [hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ jsx("hbr", {})]
|
|
72
|
-
}),
|
|
73
|
-
/* @__PURE__ */ jsxs(Show, {
|
|
74
|
-
when: Boolean(header),
|
|
75
|
-
children: [header, /* @__PURE__ */ jsx("hbr", {})]
|
|
76
|
-
}),
|
|
77
|
-
/* @__PURE__ */ jsx("hbr", {}),
|
|
78
|
-
/* @__PURE__ */ jsxs(Show, {
|
|
79
|
-
when: Boolean(disableEslint),
|
|
80
|
-
children: [/* @__PURE__ */ jsx(SingleLineComment, {
|
|
81
|
-
variant: "slash-star",
|
|
82
|
-
children: "eslint-disable"
|
|
83
|
-
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
84
|
-
}),
|
|
85
|
-
/* @__PURE__ */ jsxs(Show, {
|
|
86
|
-
when: Boolean(disablePrettier),
|
|
87
|
-
children: [/* @__PURE__ */ jsx(SingleLineComment, {
|
|
88
|
-
variant: "slash-star",
|
|
89
|
-
children: "prettier-ignore"
|
|
90
|
-
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
91
|
-
}),
|
|
92
|
-
/* @__PURE__ */ jsxs(Show, {
|
|
93
|
-
when: Boolean(disableBiome),
|
|
94
|
-
children: [/* @__PURE__ */ jsx(SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ jsx("hbr", {})]
|
|
95
|
-
}),
|
|
96
|
-
/* @__PURE__ */ jsx(Show, {
|
|
97
|
-
when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
|
|
98
|
-
children: /* @__PURE__ */ jsx("hbr", {})
|
|
99
|
-
}),
|
|
100
|
-
/* @__PURE__ */ jsx(Show, {
|
|
101
|
-
when: Boolean(children),
|
|
102
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
|
|
103
|
-
}),
|
|
104
|
-
/* @__PURE__ */ jsx(SingleLineComment, { children: code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}` }),
|
|
105
|
-
/* @__PURE__ */ jsx("hbr", {}),
|
|
106
|
-
/* @__PURE__ */ jsx(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
107
|
-
/* @__PURE__ */ jsx("hbr", {})
|
|
108
|
-
] });
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Renders the header for a Powerlines Typescript source file.
|
|
112
|
-
*
|
|
113
|
-
* @param props - The properties for the source file header.
|
|
114
|
-
* @returns The rendered source file header.
|
|
115
|
-
*/
|
|
116
|
-
function TypescriptFileHeaderImports(props) {
|
|
117
|
-
const { imports } = props;
|
|
118
|
-
const sourceFile = useSourceFile();
|
|
119
|
-
const scope = props.scope ?? sourceFile.scope;
|
|
120
|
-
return /* @__PURE__ */ jsxs(Show, {
|
|
121
|
-
when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0,
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ jsx(Show, {
|
|
124
|
-
when: !!imports && Object.keys(imports).length > 0,
|
|
125
|
-
children: Object.entries(imports ?? {}).map(([module, imported]) => {
|
|
126
|
-
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}";`;
|
|
127
|
-
})
|
|
128
|
-
}),
|
|
129
|
-
/* @__PURE__ */ jsx(Show, {
|
|
130
|
-
when: scope.importedModules.size > 0,
|
|
131
|
-
children: /* @__PURE__ */ jsx(ImportStatements, { records: scope.importedModules })
|
|
132
|
-
}),
|
|
133
|
-
/* @__PURE__ */ jsx("hbr", {})
|
|
134
|
-
]
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
//#endregion
|
|
139
|
-
export { TypescriptFileHeader as n, TypescriptFileHeaderImports as r, TypescriptFile as t };
|