@powerlines/plugin-alloy 0.26.19 → 0.26.21
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 +9 -14
- package/dist/core/components/infrastructure-file.mjs +9 -14
- package/dist/core/components/infrastructure-file.mjs.map +1 -1
- package/dist/core/components/output.cjs +10 -17
- package/dist/core/components/output.mjs +10 -17
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +4 -6
- package/dist/core/components/single-line-comment.mjs +4 -6
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +6 -10
- package/dist/core/components/source-file.mjs +6 -10
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +4 -6
- package/dist/core/components/spacing.mjs +4 -6
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/hcl/components/block-declaration.cjs +8 -12
- package/dist/hcl/components/block-declaration.mjs +8 -12
- package/dist/hcl/components/block-declaration.mjs.map +1 -1
- package/dist/hcl/components/hcl-file.cjs +21 -35
- package/dist/hcl/components/hcl-file.mjs +22 -36
- 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.cjs +1 -1
- package/dist/helpers/capnp.mjs +1 -1
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/index.cjs +7 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -11
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +7 -9
- package/dist/markdown/components/front-matter.mjs +7 -9
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +44 -76
- package/dist/markdown/components/markdown-file.mjs +44 -76
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +28 -49
- package/dist/markdown/components/markdown-table.mjs +28 -49
- 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/typescript/components/builtin-file.cjs +20 -30
- package/dist/typescript/components/builtin-file.mjs +20 -30
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +100 -165
- package/dist/typescript/components/class-declaration.mjs +100 -165
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +6 -2
- package/dist/typescript/components/dynamic-import-statement.mjs +6 -2
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +8 -11
- package/dist/typescript/components/entry-file.mjs +8 -11
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +74 -127
- package/dist/typescript/components/interface-declaration.mjs +74 -127
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +50 -84
- package/dist/typescript/components/object-declaration.mjs +50 -84
- 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 +108 -241
- package/dist/typescript/components/tsdoc-reflection.mjs +108 -241
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +168 -265
- package/dist/typescript/components/tsdoc.mjs +168 -265
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +15 -20
- package/dist/typescript/components/type-declaration.mjs +15 -20
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +29 -55
- package/dist/typescript/components/type-parameters.mjs +29 -55
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +74 -135
- package/dist/typescript/components/typescript-file.mjs +74 -135
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +3 -5
- package/dist/typescript/contexts/lexical-scope.mjs +3 -5
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +3 -5
- package/dist/typescript/contexts/member-scope.mjs +3 -5
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +47 -92
- package/dist/yaml/components/yaml-file.mjs +47 -92
- 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");
|
|
8
7
|
let _alloy_js_core = require("@alloy-js/core");
|
|
9
8
|
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,32 +42,25 @@ 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 (0, _alloy_js_core_jsx_runtime.
|
|
45
|
+
return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.SourceFileContext.Provider, {
|
|
46
46
|
value: { scope },
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
filetype: tsx ? "tsx" : "typescript",
|
|
66
|
-
children
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
47
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Scope, {
|
|
48
|
+
value: scope,
|
|
49
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_source_file.SourceFile, {
|
|
50
|
+
...rest,
|
|
51
|
+
path: modulePath,
|
|
52
|
+
header: header ?? /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(TypescriptFileHeader, {
|
|
53
|
+
hashbang,
|
|
54
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(TypescriptFileHeaderImports, {
|
|
55
|
+
imports,
|
|
56
|
+
builtinImports,
|
|
57
|
+
scope
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
61
|
+
children
|
|
62
|
+
})
|
|
63
|
+
})
|
|
71
64
|
});
|
|
72
65
|
}
|
|
73
66
|
/**
|
|
@@ -79,68 +72,40 @@ function TypescriptFile(props) {
|
|
|
79
72
|
function TypescriptFileHeader(props) {
|
|
80
73
|
const { header, hashbang, disableEslint = true, disableBiome = true, children } = props;
|
|
81
74
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
82
|
-
return [
|
|
83
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
}
|
|
75
|
+
return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
77
|
+
when: Boolean(hashbang),
|
|
78
|
+
children: [hashbang === true ? require_core_helpers_code.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", {})]
|
|
90
79
|
}),
|
|
91
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
get children() {
|
|
96
|
-
return [header, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
97
|
-
}
|
|
80
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
81
|
+
when: Boolean(header),
|
|
82
|
+
children: [header, /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
98
83
|
}),
|
|
99
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
100
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
variant: "slash-star",
|
|
107
|
-
children: "eslint-disable"
|
|
108
|
-
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
109
|
-
}
|
|
84
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
85
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
86
|
+
when: Boolean(disableEslint),
|
|
87
|
+
children: [/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, {
|
|
88
|
+
variant: "slash-star",
|
|
89
|
+
children: "eslint-disable"
|
|
90
|
+
}), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
110
91
|
}),
|
|
111
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
}
|
|
92
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
93
|
+
when: Boolean(disableBiome),
|
|
94
|
+
children: [/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
118
95
|
}),
|
|
119
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
get children() {
|
|
124
|
-
return (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
125
|
-
}
|
|
96
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
97
|
+
when: Boolean(disableEslint) || Boolean(disableBiome),
|
|
98
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
126
99
|
}),
|
|
127
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
get children() {
|
|
132
|
-
return [children, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
133
|
-
}
|
|
100
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
101
|
+
when: Boolean(children),
|
|
102
|
+
children: [children, /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
134
103
|
}),
|
|
135
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
139
|
-
|
|
140
|
-
return (0, powerlines_utils.getFileHeaderWarning)(context);
|
|
141
|
-
} }),
|
|
142
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
143
|
-
];
|
|
104
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, { children: `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}` }),
|
|
105
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
106
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, { children: (0, powerlines_utils.getFileHeaderWarning)(context) }),
|
|
107
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
108
|
+
] });
|
|
144
109
|
}
|
|
145
110
|
/**
|
|
146
111
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -159,59 +124,33 @@ function TypescriptFileHeaderImports(props) {
|
|
|
159
124
|
const builtinImports = (0, _alloy_js_core.computed)(() => {
|
|
160
125
|
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]));
|
|
161
126
|
});
|
|
162
|
-
return (0, _alloy_js_core_jsx_runtime.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
}
|
|
127
|
+
return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
128
|
+
when: scope.importedModules.size > 0 || !!imports.value && Object.keys(imports.value).length > 0 || !!builtinImports.value && Object.keys(builtinImports.value).length > 0,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
131
|
+
when: !!imports.value && Object.keys(imports.value).length > 0,
|
|
132
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
133
|
+
each: Object.entries(imports.value ?? {}),
|
|
134
|
+
hardline: true,
|
|
135
|
+
ender: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
136
|
+
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}";`
|
|
137
|
+
})
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
140
|
+
when: builtinImports.value && Object.keys(builtinImports.value).length > 0,
|
|
141
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
142
|
+
each: Object.entries(builtinImports.value ?? {}),
|
|
143
|
+
hardline: true,
|
|
144
|
+
ender: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
145
|
+
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}`}";`
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
149
|
+
when: scope.importedModules.size > 0,
|
|
150
|
+
children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ImportStatements, { records: scope.importedModules })
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
153
|
+
]
|
|
215
154
|
});
|
|
216
155
|
}
|
|
217
156
|
|
|
@@ -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";
|
|
6
5
|
import { For, Scope, Show, SourceDirectoryContext, computed, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
7
6
|
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,32 +40,25 @@ 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 /* @__PURE__ */ jsx(SourceFileContext$1.Provider, {
|
|
44
44
|
value: { scope },
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
filetype: tsx ? "tsx" : "typescript",
|
|
64
|
-
children
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
45
|
+
children: /* @__PURE__ */ jsx(Scope, {
|
|
46
|
+
value: scope,
|
|
47
|
+
children: /* @__PURE__ */ jsx(SourceFile, {
|
|
48
|
+
...rest,
|
|
49
|
+
path: modulePath,
|
|
50
|
+
header: header ?? /* @__PURE__ */ jsx(TypescriptFileHeader, {
|
|
51
|
+
hashbang,
|
|
52
|
+
children: /* @__PURE__ */ jsx(TypescriptFileHeaderImports, {
|
|
53
|
+
imports,
|
|
54
|
+
builtinImports,
|
|
55
|
+
scope
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
59
|
+
children
|
|
60
|
+
})
|
|
61
|
+
})
|
|
69
62
|
});
|
|
70
63
|
}
|
|
71
64
|
/**
|
|
@@ -77,68 +70,40 @@ function TypescriptFile(props) {
|
|
|
77
70
|
function TypescriptFileHeader(props) {
|
|
78
71
|
const { header, hashbang, disableEslint = true, disableBiome = true, children } = props;
|
|
79
72
|
const context = usePowerlinesSafe();
|
|
80
|
-
return [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
}
|
|
73
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
75
|
+
when: Boolean(hashbang),
|
|
76
|
+
children: [hashbang === true ? code$1`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ jsx("hbr", {})]
|
|
88
77
|
}),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
get children() {
|
|
94
|
-
return [header, createIntrinsic("hbr", {})];
|
|
95
|
-
}
|
|
78
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
79
|
+
when: Boolean(header),
|
|
80
|
+
children: [header, /* @__PURE__ */ jsx("hbr", {})]
|
|
96
81
|
}),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
variant: "slash-star",
|
|
105
|
-
children: "eslint-disable"
|
|
106
|
-
}), createIntrinsic("hbr", {})];
|
|
107
|
-
}
|
|
82
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
83
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
84
|
+
when: Boolean(disableEslint),
|
|
85
|
+
children: [/* @__PURE__ */ jsx(SingleLineComment, {
|
|
86
|
+
variant: "slash-star",
|
|
87
|
+
children: "eslint-disable"
|
|
88
|
+
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
108
89
|
}),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
get children() {
|
|
114
|
-
return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
|
|
115
|
-
}
|
|
90
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
91
|
+
when: Boolean(disableBiome),
|
|
92
|
+
children: [/* @__PURE__ */ jsx(SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ jsx("hbr", {})]
|
|
116
93
|
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
get children() {
|
|
122
|
-
return createIntrinsic("hbr", {});
|
|
123
|
-
}
|
|
94
|
+
/* @__PURE__ */ jsx(Show, {
|
|
95
|
+
when: Boolean(disableEslint) || Boolean(disableBiome),
|
|
96
|
+
children: /* @__PURE__ */ jsx("hbr", {})
|
|
124
97
|
}),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
get children() {
|
|
130
|
-
return [children, createIntrinsic("hbr", {})];
|
|
131
|
-
}
|
|
98
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
99
|
+
when: Boolean(children),
|
|
100
|
+
children: [children, /* @__PURE__ */ jsx("hbr", {})]
|
|
132
101
|
}),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return getFileHeaderWarning(context);
|
|
139
|
-
} }),
|
|
140
|
-
createIntrinsic("hbr", {})
|
|
141
|
-
];
|
|
102
|
+
/* @__PURE__ */ jsx(SingleLineComment, { children: `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}` }),
|
|
103
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
104
|
+
/* @__PURE__ */ jsx(SingleLineComment, { children: getFileHeaderWarning(context) }),
|
|
105
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
106
|
+
] });
|
|
142
107
|
}
|
|
143
108
|
/**
|
|
144
109
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -157,59 +122,33 @@ function TypescriptFileHeaderImports(props) {
|
|
|
157
122
|
const builtinImports = computed(() => {
|
|
158
123
|
return Object.fromEntries(Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [module, Array.isArray(importItem) ? getUniqueBy(importItem, (i) => isString(i) ? i : i.alias || i.name) : importItem]));
|
|
159
124
|
});
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
}
|
|
125
|
+
return /* @__PURE__ */ jsxs(Show, {
|
|
126
|
+
when: scope.importedModules.size > 0 || !!imports.value && Object.keys(imports.value).length > 0 || !!builtinImports.value && Object.keys(builtinImports.value).length > 0,
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx(Show, {
|
|
129
|
+
when: !!imports.value && Object.keys(imports.value).length > 0,
|
|
130
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
131
|
+
each: Object.entries(imports.value ?? {}),
|
|
132
|
+
hardline: true,
|
|
133
|
+
ender: /* @__PURE__ */ jsx("hbr", {}),
|
|
134
|
+
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}";`
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsx(Show, {
|
|
138
|
+
when: builtinImports.value && Object.keys(builtinImports.value).length > 0,
|
|
139
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
140
|
+
each: Object.entries(builtinImports.value ?? {}),
|
|
141
|
+
hardline: true,
|
|
142
|
+
ender: /* @__PURE__ */ jsx("hbr", {}),
|
|
143
|
+
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}`}";`
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ jsx(Show, {
|
|
147
|
+
when: scope.importedModules.size > 0,
|
|
148
|
+
children: /* @__PURE__ */ jsx(ImportStatements, { records: scope.importedModules })
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
151
|
+
]
|
|
213
152
|
});
|
|
214
153
|
}
|
|
215
154
|
|
|
@@ -1 +1 @@
|
|
|
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":";;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,eAAA,OAAA;CACd,MAAA,CAAA,EACA,UACA,MACA,yBAEF,KACE,QACE,YACA,QAAS,WAAQ,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;CACnB,MAAE,mBAAU,WAAqB,uBAAA;CACjC,MAAE,SAAA,uBAAiB,iBAAqB;CACxC,MAAE,aAAiB,WAAQ,MAAA,iBAAA,KAAA;CAC3B,MAAM,QAAE,IAAO,cAAA,YAAA,UAAA,CAAA;AACf,QAAC,QAAA,IAAA,MAAA;;AAED,KAAA,IACE,KAAC,MAAK,UAAU,MAAA;AAElB,KAAE,MAAM,QACN;MAAA,IACF,KAAA,UAAA,M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,"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;;;;;;;;AAejC,SAAgB,qBAAqB,OAAkC;CACrE,MAAM,EACJ,QACA,UACA,gBAAgB,MAChB,eAAe,MACf,aACE;CAEJ,MAAM,UAAU,mBAAmB;AAEnC,QACE;EACE,qBAAC,MAAD;GAAM,MAAM,QAAQ,SAAS;aAA7B,CACG,aAAa,OACV,MAAI,kBACF,SAAS,O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exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
6
|
|
|
7
7
|
//#region src/typescript/contexts/lexical-scope.tsx
|
|
@@ -14,11 +14,9 @@ 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 (0, _alloy_js_core_jsx_runtime.
|
|
17
|
+
return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Scope, {
|
|
18
18
|
value: scope,
|
|
19
|
-
|
|
20
|
-
return props.children;
|
|
21
|
-
}
|
|
19
|
+
children: props.children
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
22
|
|