@powerlines/plugin-alloy 0.26.26 → 0.26.27
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 +16 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +15 -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/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/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 +6 -6
|
@@ -4,9 +4,9 @@ const require_core_contexts_context = require('../../core/contexts/context.cjs')
|
|
|
4
4
|
const require_core_components_source_file = require('../../core/components/source-file.cjs');
|
|
5
5
|
const require_core_components_single_line_comment = require('../../core/components/single-line-comment.cjs');
|
|
6
6
|
const require_core_helpers_code = require('../../core/helpers/code.cjs');
|
|
7
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
8
|
let _alloy_js_core = require("@alloy-js/core");
|
|
8
9
|
let _stryke_path_append = require("@stryke/path/append");
|
|
9
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
10
10
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
11
11
|
let powerlines_utils = require("powerlines/utils");
|
|
12
12
|
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
@@ -42,25 +42,32 @@ function TypescriptFile(props) {
|
|
|
42
42
|
if (pkg) if ((0, _stryke_type_checks_is_boolean.isBoolean)(props.export)) pkg.scope.addExport(modulePath, scope);
|
|
43
43
|
else pkg.scope.addExport(props.export, scope);
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.SourceFileContext.Provider, {
|
|
46
46
|
value: { scope },
|
|
47
|
-
children
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
get children() {
|
|
48
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Scope, {
|
|
49
|
+
value: scope,
|
|
50
|
+
get children() {
|
|
51
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_source_file.SourceFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
52
|
+
path: modulePath,
|
|
53
|
+
get header() {
|
|
54
|
+
return header ?? (0, _alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeader, {
|
|
55
|
+
hashbang,
|
|
56
|
+
get children() {
|
|
57
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeaderImports, {
|
|
58
|
+
imports,
|
|
59
|
+
builtinImports,
|
|
60
|
+
scope
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
66
|
+
children
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
64
71
|
});
|
|
65
72
|
}
|
|
66
73
|
/**
|
|
@@ -72,40 +79,68 @@ function TypescriptFile(props) {
|
|
|
72
79
|
function TypescriptFileHeader(props) {
|
|
73
80
|
const { header, hashbang, disableEslint = true, disableBiome = true, children } = props;
|
|
74
81
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
when
|
|
78
|
-
|
|
82
|
+
return [
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
84
|
+
get when() {
|
|
85
|
+
return Boolean(hashbang);
|
|
86
|
+
},
|
|
87
|
+
get children() {
|
|
88
|
+
return [(0, _alloy_js_core_jsx_runtime.memo)(() => hashbang === true ? require_core_helpers_code.code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
89
|
+
}
|
|
79
90
|
}),
|
|
80
|
-
|
|
81
|
-
when
|
|
82
|
-
|
|
91
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
92
|
+
get when() {
|
|
93
|
+
return Boolean(header);
|
|
94
|
+
},
|
|
95
|
+
get children() {
|
|
96
|
+
return [header, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
97
|
+
}
|
|
83
98
|
}),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
when
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
100
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return Boolean(disableEslint);
|
|
103
|
+
},
|
|
104
|
+
get children() {
|
|
105
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
106
|
+
variant: "slash-star",
|
|
107
|
+
children: "eslint-disable"
|
|
108
|
+
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
109
|
+
}
|
|
91
110
|
}),
|
|
92
|
-
|
|
93
|
-
when
|
|
94
|
-
|
|
111
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
112
|
+
get when() {
|
|
113
|
+
return Boolean(disableBiome);
|
|
114
|
+
},
|
|
115
|
+
get children() {
|
|
116
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
117
|
+
}
|
|
95
118
|
}),
|
|
96
|
-
|
|
97
|
-
when
|
|
98
|
-
|
|
119
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
120
|
+
get when() {
|
|
121
|
+
return Boolean(disableEslint) || Boolean(disableBiome);
|
|
122
|
+
},
|
|
123
|
+
get children() {
|
|
124
|
+
return (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
125
|
+
}
|
|
99
126
|
}),
|
|
100
|
-
|
|
101
|
-
when
|
|
102
|
-
|
|
127
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
128
|
+
get when() {
|
|
129
|
+
return Boolean(children);
|
|
130
|
+
},
|
|
131
|
+
get children() {
|
|
132
|
+
return [children, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
133
|
+
}
|
|
103
134
|
}),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
135
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, { get children() {
|
|
136
|
+
return `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`;
|
|
137
|
+
} }),
|
|
138
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
139
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, { get children() {
|
|
140
|
+
return (0, powerlines_utils.getFileHeaderWarning)(context);
|
|
141
|
+
} }),
|
|
142
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
143
|
+
];
|
|
109
144
|
}
|
|
110
145
|
/**
|
|
111
146
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -124,33 +159,59 @@ function TypescriptFileHeaderImports(props) {
|
|
|
124
159
|
const builtinImports = (0, _alloy_js_core.computed)(() => {
|
|
125
160
|
return Object.fromEntries(Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [module, Array.isArray(importItem) ? (0, _stryke_helpers_get_unique.getUniqueBy)(importItem, (i) => (0, _stryke_type_checks_is_string.isString)(i) ? i : i.alias || i.name) : importItem]));
|
|
126
161
|
});
|
|
127
|
-
return
|
|
128
|
-
when
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
163
|
+
get when() {
|
|
164
|
+
return scope.importedModules.size > 0 || !!imports.value && Object.keys(imports.value).length > 0 || !!builtinImports.value && Object.keys(builtinImports.value).length > 0;
|
|
165
|
+
},
|
|
166
|
+
get children() {
|
|
167
|
+
return [
|
|
168
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
169
|
+
get when() {
|
|
170
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!!!imports.value)() && Object.keys(imports.value).length > 0;
|
|
171
|
+
},
|
|
172
|
+
get children() {
|
|
173
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
174
|
+
get each() {
|
|
175
|
+
return Object.entries(imports.value ?? {});
|
|
176
|
+
},
|
|
177
|
+
hardline: true,
|
|
178
|
+
get ender() {
|
|
179
|
+
return (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
180
|
+
},
|
|
181
|
+
children: ([module, importItem]) => require_core_helpers_code.code`import ${importItem === null ? "" : (0, _stryke_type_checks_is_string.isString)(importItem) ? importItem : `${importItem.filter((i) => !(0, _stryke_type_checks_is_string.isString)(i) && i.default).map((i) => `${i.type ? "type " : ""}${i.alias ? i.alias : i.name}`).join(", ") + (importItem.filter((i) => !(0, _stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && importItem.filter((i) => (0, _stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => (0, _stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${importItem.filter((i) => (0, _stryke_type_checks_is_string.isString)(i) || !i.default).map((i) => (0, _stryke_type_checks_is_string.isString)(i) ? i : `${i.type ? "type " : ""}${i.alias ? `${i.name} as ${i.alias}` : i.name}`).join(", ")} }` : "")}`} from "${module}";`
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}),
|
|
185
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
186
|
+
get when() {
|
|
187
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!builtinImports.value)() && Object.keys(builtinImports.value).length > 0;
|
|
188
|
+
},
|
|
189
|
+
get children() {
|
|
190
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
191
|
+
get each() {
|
|
192
|
+
return Object.entries(builtinImports.value ?? {});
|
|
193
|
+
},
|
|
194
|
+
hardline: true,
|
|
195
|
+
get ender() {
|
|
196
|
+
return (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
197
|
+
},
|
|
198
|
+
children: ([module, importItem]) => require_core_helpers_code.code`import ${importItem === null ? "" : (0, _stryke_type_checks_is_string.isString)(importItem) ? importItem : `${importItem.filter((i) => !(0, _stryke_type_checks_is_string.isString)(i) && i.default).map((i) => `${i.type ? "type " : ""}${i.alias ? i.alias : i.name}`).join(", ") + (importItem.filter((i) => !(0, _stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && importItem.filter((i) => (0, _stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => (0, _stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${importItem.filter((i) => (0, _stryke_type_checks_is_string.isString)(i) || !i.default).map((i) => (0, _stryke_type_checks_is_string.isString)(i) ? i : `${i.type ? "type " : ""}${i.alias ? `${i.name} as ${i.alias}` : i.name}`).join(", ")} }` : "")}`} from "${module.includes(":") ? module : `${context?.config?.framework || "powerlines"}:${module}`}";`
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}),
|
|
202
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
203
|
+
get when() {
|
|
204
|
+
return scope.importedModules.size > 0;
|
|
205
|
+
},
|
|
206
|
+
get children() {
|
|
207
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ImportStatements, { get records() {
|
|
208
|
+
return scope.importedModules;
|
|
209
|
+
} });
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
213
|
+
];
|
|
214
|
+
}
|
|
154
215
|
});
|
|
155
216
|
}
|
|
156
217
|
|
|
@@ -2,9 +2,9 @@ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
|
2
2
|
import { SourceFile } from "../../core/components/source-file.mjs";
|
|
3
3
|
import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
|
|
4
4
|
import { code as code$1 } from "../../core/helpers/code.mjs";
|
|
5
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
6
|
import { For, Scope, Show, SourceDirectoryContext, computed, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
6
7
|
import { appendPath } from "@stryke/path/append";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
8
8
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
9
9
|
import { getFileHeaderWarning } from "powerlines/utils";
|
|
10
10
|
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
@@ -40,25 +40,32 @@ function TypescriptFile(props) {
|
|
|
40
40
|
if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
|
|
41
41
|
else pkg.scope.addExport(props.export, scope);
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return createComponent(SourceFileContext$1.Provider, {
|
|
44
44
|
value: { scope },
|
|
45
|
-
children
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
get children() {
|
|
46
|
+
return createComponent(Scope, {
|
|
47
|
+
value: scope,
|
|
48
|
+
get children() {
|
|
49
|
+
return createComponent(SourceFile, mergeProps(rest, {
|
|
50
|
+
path: modulePath,
|
|
51
|
+
get header() {
|
|
52
|
+
return header ?? createComponent(TypescriptFileHeader, {
|
|
53
|
+
hashbang,
|
|
54
|
+
get children() {
|
|
55
|
+
return createComponent(TypescriptFileHeaderImports, {
|
|
56
|
+
imports,
|
|
57
|
+
builtinImports,
|
|
58
|
+
scope
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
64
|
+
children
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
71
|
/**
|
|
@@ -70,40 +77,68 @@ function TypescriptFile(props) {
|
|
|
70
77
|
function TypescriptFileHeader(props) {
|
|
71
78
|
const { header, hashbang, disableEslint = true, disableBiome = true, children } = props;
|
|
72
79
|
const context = usePowerlinesSafe();
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
when
|
|
76
|
-
|
|
80
|
+
return [
|
|
81
|
+
createComponent(Show, {
|
|
82
|
+
get when() {
|
|
83
|
+
return Boolean(hashbang);
|
|
84
|
+
},
|
|
85
|
+
get children() {
|
|
86
|
+
return [memo(() => hashbang === true ? code$1`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), createIntrinsic("hbr", {})];
|
|
87
|
+
}
|
|
77
88
|
}),
|
|
78
|
-
|
|
79
|
-
when
|
|
80
|
-
|
|
89
|
+
createComponent(Show, {
|
|
90
|
+
get when() {
|
|
91
|
+
return Boolean(header);
|
|
92
|
+
},
|
|
93
|
+
get children() {
|
|
94
|
+
return [header, createIntrinsic("hbr", {})];
|
|
95
|
+
}
|
|
81
96
|
}),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
when
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
createIntrinsic("hbr", {}),
|
|
98
|
+
createComponent(Show, {
|
|
99
|
+
get when() {
|
|
100
|
+
return Boolean(disableEslint);
|
|
101
|
+
},
|
|
102
|
+
get children() {
|
|
103
|
+
return [createComponent(SingleLineComment, {
|
|
104
|
+
variant: "slash-star",
|
|
105
|
+
children: "eslint-disable"
|
|
106
|
+
}), createIntrinsic("hbr", {})];
|
|
107
|
+
}
|
|
89
108
|
}),
|
|
90
|
-
|
|
91
|
-
when
|
|
92
|
-
|
|
109
|
+
createComponent(Show, {
|
|
110
|
+
get when() {
|
|
111
|
+
return Boolean(disableBiome);
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
|
|
115
|
+
}
|
|
93
116
|
}),
|
|
94
|
-
|
|
95
|
-
when
|
|
96
|
-
|
|
117
|
+
createComponent(Show, {
|
|
118
|
+
get when() {
|
|
119
|
+
return Boolean(disableEslint) || Boolean(disableBiome);
|
|
120
|
+
},
|
|
121
|
+
get children() {
|
|
122
|
+
return createIntrinsic("hbr", {});
|
|
123
|
+
}
|
|
97
124
|
}),
|
|
98
|
-
|
|
99
|
-
when
|
|
100
|
-
|
|
125
|
+
createComponent(Show, {
|
|
126
|
+
get when() {
|
|
127
|
+
return Boolean(children);
|
|
128
|
+
},
|
|
129
|
+
get children() {
|
|
130
|
+
return [children, createIntrinsic("hbr", {})];
|
|
131
|
+
}
|
|
101
132
|
}),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
133
|
+
createComponent(SingleLineComment, { get children() {
|
|
134
|
+
return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
|
|
135
|
+
} }),
|
|
136
|
+
createIntrinsic("hbr", {}),
|
|
137
|
+
createComponent(SingleLineComment, { get children() {
|
|
138
|
+
return getFileHeaderWarning(context);
|
|
139
|
+
} }),
|
|
140
|
+
createIntrinsic("hbr", {})
|
|
141
|
+
];
|
|
107
142
|
}
|
|
108
143
|
/**
|
|
109
144
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -122,33 +157,59 @@ function TypescriptFileHeaderImports(props) {
|
|
|
122
157
|
const builtinImports = computed(() => {
|
|
123
158
|
return Object.fromEntries(Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [module, Array.isArray(importItem) ? getUniqueBy(importItem, (i) => isString(i) ? i : i.alias || i.name) : importItem]));
|
|
124
159
|
});
|
|
125
|
-
return
|
|
126
|
-
when
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
160
|
+
return createComponent(Show, {
|
|
161
|
+
get when() {
|
|
162
|
+
return scope.importedModules.size > 0 || !!imports.value && Object.keys(imports.value).length > 0 || !!builtinImports.value && Object.keys(builtinImports.value).length > 0;
|
|
163
|
+
},
|
|
164
|
+
get children() {
|
|
165
|
+
return [
|
|
166
|
+
createComponent(Show, {
|
|
167
|
+
get when() {
|
|
168
|
+
return memo(() => !!!!imports.value)() && Object.keys(imports.value).length > 0;
|
|
169
|
+
},
|
|
170
|
+
get children() {
|
|
171
|
+
return createComponent(For, {
|
|
172
|
+
get each() {
|
|
173
|
+
return Object.entries(imports.value ?? {});
|
|
174
|
+
},
|
|
175
|
+
hardline: true,
|
|
176
|
+
get ender() {
|
|
177
|
+
return createIntrinsic("hbr", {});
|
|
178
|
+
},
|
|
179
|
+
children: ([module, importItem]) => code$1`import ${importItem === null ? "" : isString(importItem) ? importItem : `${importItem.filter((i) => !isString(i) && i.default).map((i) => `${i.type ? "type " : ""}${i.alias ? i.alias : i.name}`).join(", ") + (importItem.filter((i) => !isString(i) && i.default).length > 0 && importItem.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${importItem.filter((i) => isString(i) || !i.default).map((i) => isString(i) ? i : `${i.type ? "type " : ""}${i.alias ? `${i.name} as ${i.alias}` : i.name}`).join(", ")} }` : "")}`} from "${module}";`
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
createComponent(Show, {
|
|
184
|
+
get when() {
|
|
185
|
+
return memo(() => !!builtinImports.value)() && Object.keys(builtinImports.value).length > 0;
|
|
186
|
+
},
|
|
187
|
+
get children() {
|
|
188
|
+
return createComponent(For, {
|
|
189
|
+
get each() {
|
|
190
|
+
return Object.entries(builtinImports.value ?? {});
|
|
191
|
+
},
|
|
192
|
+
hardline: true,
|
|
193
|
+
get ender() {
|
|
194
|
+
return createIntrinsic("hbr", {});
|
|
195
|
+
},
|
|
196
|
+
children: ([module, importItem]) => code$1`import ${importItem === null ? "" : isString(importItem) ? importItem : `${importItem.filter((i) => !isString(i) && i.default).map((i) => `${i.type ? "type " : ""}${i.alias ? i.alias : i.name}`).join(", ") + (importItem.filter((i) => !isString(i) && i.default).length > 0 && importItem.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${importItem.filter((i) => isString(i) || !i.default).map((i) => isString(i) ? i : `${i.type ? "type " : ""}${i.alias ? `${i.name} as ${i.alias}` : i.name}`).join(", ")} }` : "")}`} from "${module.includes(":") ? module : `${context?.config?.framework || "powerlines"}:${module}`}";`
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}),
|
|
200
|
+
createComponent(Show, {
|
|
201
|
+
get when() {
|
|
202
|
+
return scope.importedModules.size > 0;
|
|
203
|
+
},
|
|
204
|
+
get children() {
|
|
205
|
+
return createComponent(ImportStatements, { get records() {
|
|
206
|
+
return scope.importedModules;
|
|
207
|
+
} });
|
|
208
|
+
}
|
|
209
|
+
}),
|
|
210
|
+
createIntrinsic("hbr", {})
|
|
211
|
+
];
|
|
212
|
+
}
|
|
152
213
|
});
|
|
153
214
|
}
|
|
154
215
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-file.mjs","names":["SourceFileContext"],"sources":["../../../src/typescript/components/typescript-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 type { Children } from \"@alloy-js/core\";\nimport {\n computed,\n For,\n Scope,\n Show,\n SourceDirectoryContext,\n splitProps,\n useContext,\n useScope\n} from \"@alloy-js/core\";\nimport {\n getSourceDirectoryData,\n ImportStatements,\n PackageContext,\n SourceFileContext,\n TSModuleScope,\n useSourceFile\n} from \"@alloy-js/typescript\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { code } from \"../../core/helpers/code\";\nimport {\n ComponentProps,\n SourceFileHeaderProps,\n TypescriptFileImportItem,\n TypescriptFileImports\n} from \"../../types/components\";\n\nexport type TypescriptFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n hashbang?: Children | true;\n header?: Children;\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n export?: boolean | string;\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 TypescriptFile(props: TypescriptFileProps) {\n const [\n { children, path, imports, builtinImports, tsx, header, hashbang },\n rest\n ] = splitProps(props, [\n \"children\",\n \"path\",\n \"imports\",\n \"builtinImports\",\n \"tsx\",\n \"header\",\n \"hashbang\"\n ]);\n\n const directoryContext = useContext(SourceDirectoryContext)!;\n const sdData = getSourceDirectoryData(directoryContext);\n\n const modulePath = appendPath(path, directoryContext.path);\n const scope = new TSModuleScope(modulePath, useScope());\n sdData.modules.add(scope);\n\n const pkg = useContext(PackageContext);\n if (pkg) {\n pkg.scope.addModule(scope);\n }\n\n if (props.export) {\n if (pkg) {\n if (isBoolean(props.export)) {\n pkg.scope.addExport(modulePath, scope);\n } else {\n pkg.scope.addExport(props.export, scope);\n }\n }\n }\n\n return (\n <SourceFileContext.Provider\n value={{\n scope\n }}>\n <Scope value={scope}>\n <SourceFile\n {...rest}\n path={modulePath}\n header={\n header ?? (\n <TypescriptFileHeader hashbang={hashbang}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n scope={scope}\n />\n </TypescriptFileHeader>\n )\n }\n filetype={tsx ? \"tsx\" : \"typescript\"}>\n {children}\n </SourceFile>\n </Scope>\n </SourceFileContext.Provider>\n );\n}\n\nexport interface TypescriptFileHeaderProps extends SourceFileHeaderProps {\n header?: Children;\n hashbang?: Children | true;\n}\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function TypescriptFileHeader(props: TypescriptFileHeaderProps) {\n const {\n header,\n hashbang,\n disableEslint = true,\n disableBiome = true,\n children\n } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(hashbang)}>\n {hashbang === true\n ? code`#!/usr/bin/env ${\n context?.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node`\n : hashbang}\n <hbr />\n </Show>\n <Show when={Boolean(header)}>\n {header}\n <hbr />\n </Show>\n <hbr />\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"slash-star\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment>{\"biome-ignore lint: disable\"}</SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableEslint) || Boolean(disableBiome)}>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n {children}\n <hbr />\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment>{getFileHeaderWarning(context!)}</SingleLineComment>\n <hbr />\n </>\n );\n}\n\nexport interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n scope?: TSModuleScope;\n}\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function TypescriptFileHeaderImports(\n props: TypescriptFileHeaderImportsProps\n) {\n const { imports: importProps, builtinImports: builtinImportsProps } = props;\n\n const context = usePowerlinesSafe();\n const sourceFile = useSourceFile();\n\n const scope = props.scope ?? sourceFile.scope;\n\n const imports = computed(() => {\n return Object.fromEntries(\n Object.entries(importProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n const builtinImports = computed(() => {\n return Object.fromEntries(\n Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n\n return (\n <Show\n when={\n scope.importedModules.size > 0 ||\n (!!imports.value && Object.keys(imports.value).length > 0) ||\n (!!builtinImports.value && Object.keys(builtinImports.value).length > 0)\n }>\n <Show when={!!imports.value && Object.keys(imports.value).length > 0}>\n <For\n each={Object.entries(imports.value ?? {})}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(\n i =>\n `${i.type ? \"type \" : \"\"}${\n i.alias ? i.alias : i.name\n }`\n )\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : `${i.type ? \"type \" : \"\"}${\n i.alias ? `${i.name} as ${i.alias}` : i.name\n }`\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${module}\";`\n }\n </For>\n </Show>\n <Show\n when={\n builtinImports.value && Object.keys(builtinImports.value).length > 0\n }>\n <For\n each={Object.entries(\n (builtinImports.value ?? {}) as Record<\n string,\n null | Array<TypescriptFileImportItem | string>\n >\n )}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(\n i =>\n `${i.type ? \"type \" : \"\"}${\n i.alias ? i.alias : i.name\n }`\n )\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : `${i.type ? \"type \" : \"\"}${\n i.alias ? `${i.name} as ${i.alias}` : i.name\n }`\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${\n module.includes(\":\")\n ? module\n : `${context?.config?.framework || \"powerlines\"}:${module}`\n }\";`\n }\n </For>\n </Show>\n <Show when={scope.importedModules.size > 0}>\n <ImportStatements records={scope.importedModules} />\n </Show>\n <hbr />\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,eAAe,OAA4B;CACzD,MAAM,CACJ,EAAE,UAAU,MAAM,SAAS,gBAAgB,KAAK,QAAQ,YACxD,QACE,WAAW,OAAO;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,mBAAmB,WAAW,uBAAuB;CAC3D,MAAM,SAAS,uBAAuB,iBAAiB;CAEvD,MAAM,aAAa,WAAW,MAAM,iBAAiB,KAAK;CAC1D,MAAM,QAAQ,IAAI,cAAc,YAAY,UAAU,CAAC;AACvD,QAAO,QAAQ,IAAI,MAAM;CAEzB,MAAM,MAAM,WAAW,eAAe;AACtC,KAAI,IACF,KAAI,MAAM,UAAU,MAAM;AAG5B,KAAI,MAAM,QACR;MAAI,IACF,KAAI,UAAU,MAAM,OAAO,CACzB,KAAI,MAAM,UAAU,YAAY,MAAM;MAEtC,KAAI,MAAM,UAAU,MAAM,QAAQ,MAAM;;AAK9C,QACE,oBAACA,oBAAkB,UAAnB;EACE,OAAO,EACL,OACD;YACD,oBAAC,OAAD;GAAO,OAAO;aACZ,oBAAC,YAAD;IACE,GAAI;IACJ,MAAM;IACN,QACE,UACE,oBAAC,sBAAD;KAAgC;eAC9B,oBAAC,6BAAD;MACW;MACO;MACT;MACP;KACmB;IAG3B,UAAU,MAAM,QAAQ;IACvB;IACU;GACP;EACmB;;;;;;;;A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,GAAG,SACtD;KAEC;IACD;GACP,oBAAC,MAAD;IAAM,MAAM,MAAM,gBAAgB,OAAO;cACvC,oBAAC,kBAAD,EAAkB,SAAS,MAAM,iBAAmB;IAC/C;GACP,oBAAC,OAAD,EAAO;GACF"}
|
|
1
|
+
{"version":3,"file":"typescript-file.mjs","names":[],"sources":["../../../src/typescript/components/typescript-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 type { Children } from \"@alloy-js/core\";\nimport {\n computed,\n For,\n Scope,\n Show,\n SourceDirectoryContext,\n splitProps,\n useContext,\n useScope\n} from \"@alloy-js/core\";\nimport {\n getSourceDirectoryData,\n ImportStatements,\n PackageContext,\n SourceFileContext,\n TSModuleScope,\n useSourceFile\n} from \"@alloy-js/typescript\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { code } from \"../../core/helpers/code\";\nimport {\n ComponentProps,\n SourceFileHeaderProps,\n TypescriptFileImportItem,\n TypescriptFileImports\n} from \"../../types/components\";\n\nexport type TypescriptFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n hashbang?: Children | true;\n header?: Children;\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n export?: boolean | string;\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 TypescriptFile(props: TypescriptFileProps) {\n const [\n { children, path, imports, builtinImports, tsx, header, hashbang },\n rest\n ] = splitProps(props, [\n \"children\",\n \"path\",\n \"imports\",\n \"builtinImports\",\n \"tsx\",\n \"header\",\n \"hashbang\"\n ]);\n\n const directoryContext = useContext(SourceDirectoryContext)!;\n const sdData = getSourceDirectoryData(directoryContext);\n\n const modulePath = appendPath(path, directoryContext.path);\n const scope = new TSModuleScope(modulePath, useScope());\n sdData.modules.add(scope);\n\n const pkg = useContext(PackageContext);\n if (pkg) {\n pkg.scope.addModule(scope);\n }\n\n if (props.export) {\n if (pkg) {\n if (isBoolean(props.export)) {\n pkg.scope.addExport(modulePath, scope);\n } else {\n pkg.scope.addExport(props.export, scope);\n }\n }\n }\n\n return (\n <SourceFileContext.Provider\n value={{\n scope\n }}>\n <Scope value={scope}>\n <SourceFile\n {...rest}\n path={modulePath}\n header={\n header ?? (\n <TypescriptFileHeader hashbang={hashbang}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n scope={scope}\n />\n </TypescriptFileHeader>\n )\n }\n filetype={tsx ? \"tsx\" : \"typescript\"}>\n {children}\n </SourceFile>\n </Scope>\n </SourceFileContext.Provider>\n );\n}\n\nexport interface TypescriptFileHeaderProps extends SourceFileHeaderProps {\n header?: Children;\n hashbang?: Children | true;\n}\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function TypescriptFileHeader(props: TypescriptFileHeaderProps) {\n const {\n header,\n hashbang,\n disableEslint = true,\n disableBiome = true,\n children\n } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(hashbang)}>\n {hashbang === true\n ? code`#!/usr/bin/env ${\n context?.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node`\n : hashbang}\n <hbr />\n </Show>\n <Show when={Boolean(header)}>\n {header}\n <hbr />\n </Show>\n <hbr />\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"slash-star\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment>{\"biome-ignore lint: disable\"}</SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableEslint) || Boolean(disableBiome)}>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n {children}\n <hbr />\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment>{getFileHeaderWarning(context!)}</SingleLineComment>\n <hbr />\n </>\n );\n}\n\nexport interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n scope?: TSModuleScope;\n}\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function TypescriptFileHeaderImports(\n props: TypescriptFileHeaderImportsProps\n) {\n const { imports: importProps, builtinImports: builtinImportsProps } = props;\n\n const context = usePowerlinesSafe();\n const sourceFile = useSourceFile();\n\n const scope = props.scope ?? sourceFile.scope;\n\n const imports = computed(() => {\n return Object.fromEntries(\n Object.entries(importProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n const builtinImports = computed(() => {\n return Object.fromEntries(\n Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n\n return (\n <Show\n when={\n scope.importedModules.size > 0 ||\n (!!imports.value && Object.keys(imports.value).length > 0) ||\n (!!builtinImports.value && Object.keys(builtinImports.value).length > 0)\n }>\n <Show when={!!imports.value && Object.keys(imports.value).length > 0}>\n <For\n each={Object.entries(imports.value ?? {})}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(\n i =>\n `${i.type ? \"type \" : \"\"}${\n i.alias ? i.alias : i.name\n }`\n )\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : `${i.type ? \"type \" : \"\"}${\n i.alias ? `${i.name} as ${i.alias}` : i.name\n }`\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${module}\";`\n }\n </For>\n </Show>\n <Show\n when={\n builtinImports.value && Object.keys(builtinImports.value).length > 0\n }>\n <For\n each={Object.entries(\n (builtinImports.value ?? {}) as Record<\n string,\n null | Array<TypescriptFileImportItem | string>\n >\n )}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(\n i =>\n `${i.type ? \"type \" : \"\"}${\n i.alias ? i.alias : i.name\n }`\n )\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : `${i.type ? \"type \" : \"\"}${\n i.alias ? `${i.name} as ${i.alias}` : i.name\n }`\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${\n module.includes(\":\")\n ? module\n : `${context?.config?.framework || \"powerlines\"}:${module}`\n }\";`\n }\n </For>\n </Show>\n <Show when={scope.importedModules.size > 0}>\n <ImportStatements records={scope.importedModules} />\n </Show>\n <hbr />\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,eAAoB,OAAO;CACpC,MAAQ,CAAC,EACT,UACA,MACA,SACA,gBACA,KACA,QACA,YACA,QAAO,WAAA,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;CACL,MAAA,mBAAc,WAAA,uBAAA;CACd,MAAA,SAAA,uBAAqB,iBAAA;CACrB,MAAA,aAAA,WAAwB,MAAA,iBAAA,KAAA;CACxB,MAAA,QAAA,IAAA,cAAA,YAAA,UAAA,CAAA;AACA,QAAO,QAAK,IAAM,MAAA;;AAEpB,KAAM,IACJ,KAAA,MAAA,UAAiB,MAAA;AAEjB,KAAE,MAAQ,QACR;MAAA,IACA,KAAA,UAAgB,MAAC,OAAA,CACjB,KAAQ,MAAC,UAAU,YAAM,MAAA;MAE1B,KAAA,MAAA,UAAA,MAAA,QAAA,MAAA;;AAIF,QAAA,gBAAA,oBAAA,UAAA;EACG,OAAM,EACN,OACF;EACF,IAAO,WAAS;AACd,UAAM,gBAAA,OAAA;IACF,OAAS;IACX,IAAA,WAAA;AACE,YAAW,gBAAO,YAAA,WAAA,MAAA;MACnB,MAAS;MACJ,IAAA,SAAA;AACG,cAAA,UAAA,gBAAA,sBAAA;QACO;QACX,IAAA,WAAA;AACG,gBAAA,gBAAA,6BAAA;UACC;UACT;;UAEI,CAAA;;;;MAIA,UAAY,MAAA,QAAc;MACb;;;IAGf,CAAA;;EAEJ,CAA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A,EAAA,QAAA,CAAA,KAAA,MAAA,GAAA,EAAA,OAAA,UAAA,KAAA,EAAA,QAAA,EAAA,QAAA,EAAA,OAAA,CAAA,KAAA,KAAA,IAAA,WAAA,QAAA,MAAA,CAAA,SAAA,EAAA,IAAA,EAAA,QAAA,CAAA,SAAA,KAAA,WAAA,QAAA,MAAA,SAAA,EAAA,IAAA,CAAA,EAAA,QAAA,CAAA,SAAA,IAAA,OAAA,OAAA,WAAA,QAAA,MAAA,SAAA,EAAA,IAAA,CAAA,EAAA,QAAA,CAAA,SAAA,IAAA,KAAA,WAAA,QAAA,MAAA,SAAA,EAAA,IAAA,CAAA,EAAA,QAAA,CAAA,KAAA,MAAA,SAAA,EAAA,GAAA,IAAA,GAAA,EAAA,OAAA,UAAA,KAAA,EAAA,QAAA,GAAA,EAAA,KAAA,MAAA,EAAA,UAAA,EAAA,OAAA,CAAA,KAAA,KAAA,CAAA,MAAA,MAAA,SAAA,OAAA,SAAA,IAAA,GAAA,SAAA,GAAA,SAAA,QAAA,aAAA,aAAA,GAAA,SAAA;OACtB,CAAA;;KAEJ,CAAC;IAAA,gBAAM,MAAA;KACN,IAAA,OAAM;AACJ,aAAE,MAAW,gBAAgB,OAAG;;KAEnC,IAAA,WAAA;AACF,aAAA,gBAAA,kBAAA,EACD,IAAA,UAAA;AACI,cAAA,MAAiB;SAEnB,CAAM;;KAEL,CAAC;IAAA,gBAAc,OAAU,EAAA,CAAA;IAAA;;EAE7B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
4
3
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
6
|
|
|
7
7
|
//#region src/typescript/contexts/lexical-scope.tsx
|
|
@@ -14,9 +14,11 @@ function LexicalScope(props) {
|
|
|
14
14
|
if (!(props.value instanceof _alloy_js_typescript.TSLexicalScope)) throw new TypeError("LexicalScope value must be a TSLexicalScope instance");
|
|
15
15
|
scope = props.value;
|
|
16
16
|
} else scope = (0, _alloy_js_typescript.createLexicalScope)(props.name ?? "Lexical scope", props);
|
|
17
|
-
return
|
|
17
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Scope, {
|
|
18
18
|
value: scope,
|
|
19
|
-
children
|
|
19
|
+
get children() {
|
|
20
|
+
return props.children;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
|