powerlines 0.42.37 → 0.42.39

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.
@@ -1,9 +1,9 @@
1
1
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
2
- const require_ts_morph = require('./ts-morph-Cf4wz3E0.cjs');
2
+ const require_ts_morph = require('./ts-morph-BvE8TMhv.cjs');
3
3
  const require_utils = require('./utils.cjs');
4
4
  const require_plugin_utils = require('./plugin-utils.cjs');
5
- const require_api_context = require('./api-context-BurprRit.cjs');
6
- const require_tsconfig = require('./tsconfig-ChmbpAO7.cjs');
5
+ const require_api_context = require('./api-context-g8U0DTyF.cjs');
6
+ const require_tsconfig = require('./tsconfig-BjkktvB9.cjs');
7
7
  let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
8
8
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
9
9
  let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
@@ -31,11 +31,11 @@ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-obje
31
31
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
32
32
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
33
33
  let chalk = require("chalk");
34
- chalk = require_chunk.__toESM(chalk);
34
+ chalk = require_chunk.__toESM(chalk, 1);
35
35
  let defu = require("defu");
36
- defu = require_chunk.__toESM(defu);
36
+ defu = require_chunk.__toESM(defu, 1);
37
37
  let handlebars = require("handlebars");
38
- handlebars = require_chunk.__toESM(handlebars);
38
+ handlebars = require_chunk.__toESM(handlebars, 1);
39
39
  let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
40
40
  let ts_morph = require("ts-morph");
41
41
  let _stryke_string_format_package = require("@stryke/string-format/package");
@@ -45,7 +45,7 @@ let _stryke_json_storm_json = require("@stryke/json/storm-json");
45
45
 
46
46
  //#region package.json
47
47
  var name = "powerlines";
48
- var version = "0.42.37";
48
+ var version = "0.42.39";
49
49
 
50
50
  //#endregion
51
51
  //#region src/_internal/helpers/generate-types.ts
@@ -58,96 +58,135 @@ var version = "0.42.37";
58
58
  function formatTypes(code = "") {
59
59
  return code.replaceAll("#private;", "").replace(/__Ω/g, "");
60
60
  }
61
- async function writeModuleDeclarations(context, filePath, id, code, fileToModuleMap) {
62
- const mappings = /* @__PURE__ */ new Map();
63
- const ambient = [];
64
- const sourceFile = new ts_morph.Project({ useInMemoryFileSystem: true }).createSourceFile("module.d.ts", code);
65
- for (const ref of sourceFile.getTypeReferenceDirectives()) ambient.push({
66
- id: ref.getFileName(),
67
- external: true
61
+ async function extractModuleDeclarations(ctx, filePath, name, text) {
62
+ const imports = [];
63
+ const exports = [];
64
+ const comment = text.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${ctx.context.config.framework}:${name}(?s:.)*?\\*\\/\\s+`))?.find((comment) => (0, _stryke_type_checks_is_set_string.isSetString)(comment?.trim()));
65
+ const sourceFile = new ts_morph.Project({ useInMemoryFileSystem: true }).createSourceFile("module.d.ts", text);
66
+ for (const ref of sourceFile.getTypeReferenceDirectives()) if (ref.getFileName() && !ctx.context.builtins.some((builtin) => ref.getFileName().endsWith(builtin))) imports.push({
67
+ name: ref.getFileName(),
68
+ ambient: true
68
69
  });
69
- const importLines = [];
70
- const reExportLines = [];
71
- const declarationLines = [];
72
- for (const statement of sourceFile.getStatements()) {
73
- if (ts_morph.Node.isImportDeclaration(statement)) {
74
- const moduleSpec = statement.getModuleSpecifierValue();
75
- const defaultImport = statement.getDefaultImport();
76
- const namedImports = statement.getNamedImports();
77
- const namespaceImport = statement.getNamespaceImport();
78
- if (!defaultImport && namedImports.length === 0 && !namespaceImport) {
79
- ambient.push({
80
- id: moduleSpec,
81
- external: !context.fs.isResolvableId(moduleSpec, filePath)
70
+ for (const statement of sourceFile.getStatements()) if (ts_morph.Node.isImportDeclaration(statement)) {
71
+ const moduleSpec = statement.getModuleSpecifierValue();
72
+ if (statement.getNamespaceImport()) imports.push({
73
+ name: moduleSpec,
74
+ specifiers: [{ name: statement.getNamespaceImport().getText() }],
75
+ all: true
76
+ });
77
+ else if (statement.getNamedImports().length > 0 || statement.getDefaultImport()) {
78
+ const specifiers = [];
79
+ if (statement.getDefaultImport()) specifiers.push({
80
+ name: statement.getDefaultImport().getText(),
81
+ default: true,
82
+ type: statement.isTypeOnly()
83
+ });
84
+ statement.getNamedImports().forEach((named) => {
85
+ specifiers.push({
86
+ name: named.getName(),
87
+ alias: named.getAliasNode()?.getText(),
88
+ type: statement.isTypeOnly()
82
89
  });
83
- continue;
84
- }
90
+ });
91
+ imports.push({
92
+ name: moduleSpec,
93
+ specifiers
94
+ });
95
+ }
96
+ } else if (ts_morph.Node.isExportDeclaration(statement)) {
97
+ const moduleSpec = statement.getModuleSpecifierValue();
98
+ if (moduleSpec) {
85
99
  let resolvedSpec = moduleSpec;
86
- if (context.fs.isResolvableId(moduleSpec, filePath)) {
87
- const resolved = await context.resolve(moduleSpec, filePath);
88
- if (resolved) {
89
- const mapped = fileToModuleMap.get(resolved.id);
90
- if (mapped) resolvedSpec = mapped;
91
- else context.trace(`Could not resolve relative import '${moduleSpec}' from '${filePath}' to a builtin module. Keeping as-is.`);
92
- }
93
- }
94
- if (namespaceImport) importLines.push(`\timport * as ${namespaceImport.getText()} from '${resolvedSpec}';`);
100
+ if (!ctx.context.builtins.includes(moduleSpec)) if (ctx.emitted.has(moduleSpec)) resolvedSpec = ctx.emitted.get(moduleSpec);
95
101
  else {
96
- const specifiers = [];
97
- if (defaultImport) specifiers.push(`default as ${defaultImport.getText()}`);
98
- for (const named of namedImports) {
99
- const alias = named.getAliasNode()?.getText();
100
- specifiers.push(alias ? `${named.getName()} as ${alias}` : named.getName());
101
- }
102
- if (specifiers.length > 0) {
103
- const typeOnly = statement.isTypeOnly() ? " type" : "";
104
- importLines.push(`\timport${typeOnly} { ${specifiers.join(", ")} } from '${resolvedSpec}';`);
105
- }
102
+ const resolvedModule = await ctx.context.resolve(moduleSpec, filePath);
103
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(resolvedModule?.id)) resolvedSpec = resolvedModule.id;
106
104
  }
107
- continue;
108
- }
109
- if (ts_morph.Node.isExportDeclaration(statement)) {
110
- const moduleSpec = statement.getModuleSpecifierValue();
111
- if (moduleSpec) {
112
- let resolvedSpec = moduleSpec;
113
- if (context.fs.isResolvableId(moduleSpec, filePath)) {
114
- const resolved = await context.resolve(moduleSpec, filePath);
115
- if (resolved) {
116
- const mapped = fileToModuleMap.get(resolved.id);
117
- if (mapped) resolvedSpec = mapped;
118
- else context.trace(`Could not resolve relative import '${moduleSpec}' from '${filePath}' to a builtin module. Keeping as-is.`);
119
- }
120
- }
121
- const namedExports = statement.getNamedExports();
122
- if (namedExports.length > 0) {
123
- const specifiers = namedExports.map((named) => {
124
- const alias = named.getAliasNode()?.getText();
125
- return alias ? `${named.getName()} as ${alias}` : named.getName();
126
- });
127
- const typeOnly = statement.isTypeOnly() ? " type" : "";
128
- reExportLines.push(`\texport${typeOnly} { ${specifiers.join(", ")} } from '${resolvedSpec}';`);
129
- } else reExportLines.push(`\texport * from '${resolvedSpec}';`);
130
- } else declarationLines.push(`\t${statement.getText()}`);
131
- continue;
132
- }
133
- if (ts_morph.Node.isExportAssignment(statement)) {
134
- declarationLines.push(`\t${statement.getText()}`);
135
- continue;
105
+ const namedExports = statement.getNamedExports();
106
+ if (namedExports.length > 0) exports.push({
107
+ name: resolvedSpec,
108
+ text: statement.getText(),
109
+ fullText: statement.getFullText(),
110
+ specifiers: namedExports.map((named) => ({
111
+ name: named.getName(),
112
+ alias: named.getAliasNode()?.getText(),
113
+ type: statement.isTypeOnly()
114
+ })),
115
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n").trim()
116
+ });
117
+ else exports.push({
118
+ name: resolvedSpec,
119
+ text: statement.getText(),
120
+ fullText: statement.getFullText(),
121
+ all: true,
122
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n").trim()
123
+ });
124
+ } else {
125
+ const specifiers = statement.getNamedExports().map((named) => ({
126
+ name: named.getName(),
127
+ alias: named.getAliasNode()?.getText(),
128
+ type: statement.isTypeOnly()
129
+ }));
130
+ if (specifiers.length > 0) exports.push({
131
+ text: statement.getText(),
132
+ fullText: statement.getFullText(),
133
+ specifiers,
134
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
135
+ });
136
136
  }
137
- const text = statement.getText();
138
- if (text.includes("//# sourceMappingURL=")) continue;
139
- declarationLines.push(formatTypes(text.replace(/^(export\s+)?declare\s+/, "$1")).split("\n").map((line) => `\t${line}`).join("\n"));
140
- }
141
- const moduleComment = code.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${context.config.framework}:${id}(?s:.)*?\\*\\/\\s+`))?.find((comment) => (0, _stryke_type_checks_is_set_string.isSetString)(comment?.trim()));
142
- let content = `${moduleComment ? `${moduleComment.trim()}\n` : ""}declare module "${context.config.framework}:${id}" {`;
143
- for (const line of importLines) content += `\n${line}`;
144
- for (const line of reExportLines) content += `\n${line}`;
145
- for (const line of declarationLines) content += `\n${line}`;
146
- content += "\n}";
137
+ } else if (ts_morph.Node.isExportAssignment(statement)) exports.push({
138
+ text: statement.getText(),
139
+ fullText: statement.getFullText(),
140
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
141
+ });
142
+ else if (ts_morph.Node.isFunctionDeclaration(statement) && statement.isExported() && statement.getNameNode()) exports.push({
143
+ text: statement.getText(),
144
+ fullText: statement.getFullText(),
145
+ specifiers: [{ name: statement.getNameNode().getText() }],
146
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
147
+ });
148
+ else if (ts_morph.Node.isVariableStatement(statement) && statement.isExported()) exports.push({
149
+ text: statement.getText(),
150
+ fullText: statement.getFullText(),
151
+ specifiers: statement.getDeclarationList().getDeclarations().filter((decl) => decl.getNameNode() && ts_morph.Node.isIdentifier(decl.getNameNode())).map((decl) => ({ name: decl.getNameNode().getText() })),
152
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
153
+ });
154
+ else if (ts_morph.Node.isClassDeclaration(statement) && statement.isExported()) {
155
+ const nameNode = statement.getNameNode();
156
+ exports.push({
157
+ text: statement.getText(),
158
+ fullText: statement.getFullText(),
159
+ specifiers: nameNode ? [{ name: nameNode.getText() }] : void 0,
160
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
161
+ });
162
+ } else if (ts_morph.Node.isInterfaceDeclaration(statement) && statement.isExported()) {
163
+ const nameNode = statement.getNameNode();
164
+ exports.push({
165
+ text: statement.getText(),
166
+ fullText: statement.getFullText(),
167
+ specifiers: nameNode ? [{ name: nameNode.getText() }] : void 0,
168
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
169
+ });
170
+ } else if (ts_morph.Node.isTypeAliasDeclaration(statement) && statement.isExported()) {
171
+ const nameNode = statement.getNameNode();
172
+ exports.push({
173
+ text: statement.getText(),
174
+ fullText: statement.getFullText(),
175
+ specifiers: nameNode ? [{ name: nameNode.getText() }] : void 0,
176
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
177
+ });
178
+ } else if (ctx.context.config.output.sourceMap || !statement.getFullText().includes("//# sourceMappingURL=")) exports.push({
179
+ text: statement.getText(),
180
+ fullText: statement.getFullText(),
181
+ comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
182
+ });
147
183
  return {
148
- content,
149
- mappings,
150
- ambient
184
+ name,
185
+ text,
186
+ sourceFile,
187
+ comment,
188
+ imports,
189
+ exports
151
190
  };
152
191
  }
153
192
  /**
@@ -194,68 +233,77 @@ async function emitBuiltinTypes(context, files) {
194
233
  directives: []
195
234
  };
196
235
  }
197
- const fileToModuleMap = /* @__PURE__ */ new Map();
198
- const emittedBuiltinFiles = [];
199
- for (const emittedFile of emittedFiles) {
236
+ const ctx = {
237
+ context,
238
+ modules: [],
239
+ emitted: /* @__PURE__ */ new Map()
240
+ };
241
+ await Promise.all(emittedFiles.map(async (emittedFile) => {
200
242
  const filePath = (0, _stryke_path_append.appendPath)(emittedFile.filePath, context.workspaceConfig.workspaceRoot);
201
243
  if (!filePath.endsWith(".map") && (0, _stryke_path_file_path_fns.findFileName)(filePath) !== "tsconfig.tsbuildinfo" && (0, _stryke_path_is_parent_path.isParentPath)(filePath, context.builtinsPath)) {
202
- const moduleId = (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(filePath, context.builtinsPath), (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)), "", { fullExtension: true });
203
- if (context.builtins.includes(moduleId)) {
204
- fileToModuleMap.set(filePath, moduleId);
205
- emittedBuiltinFiles.push({
206
- filePath,
207
- text: emittedFile.text
208
- });
244
+ const moduleName = (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(filePath, context.builtinsPath), (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)), "", { fullExtension: true });
245
+ if (context.builtins.includes(moduleName)) {
246
+ ctx.emitted.set(filePath, moduleName);
247
+ ctx.modules.push(await extractModuleDeclarations(ctx, filePath, moduleName, emittedFile.text));
209
248
  }
210
249
  }
211
- }
212
- const builtins = await context.getBuiltins();
213
- const emittedContentMap = /* @__PURE__ */ new Map();
214
- for (const emittedFile of emittedFiles) {
215
- const filePath = (0, _stryke_path_append.appendPath)(emittedFile.filePath, context.workspaceConfig.workspaceRoot);
216
- if (!filePath.endsWith(".map") && (0, _stryke_path_file_path_fns.findFileName)(filePath) !== "tsconfig.tsbuildinfo") emittedContentMap.set(filePath, emittedFile.text);
217
- }
218
- let code = "";
219
- const directives = [];
220
- const ambientModules = /* @__PURE__ */ new Set();
221
- let isFirst = true;
222
- for (const entry of emittedBuiltinFiles) {
223
- context.trace(`Processing emitted type declaration file: ${entry.filePath}`);
224
- const moduleId = fileToModuleMap.get(entry.filePath);
225
- const moduleDecl = await writeModuleDeclarations(context, entry.filePath, moduleId, entry.text, fileToModuleMap);
226
- if (!isFirst) code += "\n\n";
227
- isFirst = false;
228
- code += moduleDecl.content;
229
- for (const dep of moduleDecl.ambient) if (dep.external) {
230
- const directive = dep.id;
231
- if (!directives.includes(directive)) directives.push(directive);
232
- } else if (builtins.some((builtin) => builtin.id === dep.id)) ambientModules.add(builtins.find((builtin) => builtin.id === dep.id).path);
233
- else if (builtins.some((builtin) => (0, _stryke_path_replace.replaceExtension)(builtin.path) === (0, _stryke_path_replace.replaceExtension)(dep.id))) ambientModules.add(dep.id);
234
- else {
235
- const resolved = await context.resolve(dep.id, entry.filePath);
236
- if (resolved) {
237
- for (const name of [
238
- resolved.id,
239
- `${resolved.id}.d.ts`,
240
- `${resolved.id}.d.mts`,
241
- `${resolved.id}.d.cts`,
242
- (0, _stryke_path_replace.replaceExtension)(resolved.id, ".d.ts"),
243
- (0, _stryke_path_replace.replaceExtension)(resolved.id, ".d.mts"),
244
- (0, _stryke_path_replace.replaceExtension)(resolved.id, ".d.cts"),
245
- `${resolved.id}/index.d.ts`
246
- ]) if (emittedContentMap.has(name)) {
247
- ambientModules.add(name);
250
+ }));
251
+ const commonDeclarations = [];
252
+ for (const mod of ctx.modules) for (const importRef of mod.imports.filter((importRef) => context.builtins.some((builtin) => importRef.name.endsWith(`:${builtin}`)))) {
253
+ const moduleRef = ctx.modules.find((moduleRef) => importRef.name.endsWith(`:${moduleRef.name}`));
254
+ if (moduleRef) {
255
+ let declaration;
256
+ for (const decl of moduleRef.exports.filter((decl) => (0, _stryke_type_checks_is_set_object.isSetObject)(decl))) {
257
+ const specifiers = decl.specifiers?.filter((specifier) => importRef.specifiers?.some((s) => (specifier.alias ? specifier.alias : specifier.name) === (s.alias ? s.alias : s.name)));
258
+ if (specifiers && specifiers.length > 0) {
259
+ importRef.specifiers = importRef.specifiers?.filter((s) => !specifiers.some((specifier) => (specifier.alias ? specifier.alias : specifier.name) === (s.alias ? s.alias : s.name)));
260
+ if (importRef.specifiers && importRef.specifiers.length === 0 && !importRef.all && !importRef.ambient) mod.imports = mod.imports.filter((imp) => imp.name !== importRef.name);
261
+ declaration = decl;
248
262
  break;
249
263
  }
250
264
  }
265
+ if (declaration) {
266
+ for (const decl of moduleRef.exports.filter((decl) => (0, _stryke_type_checks_is_set_object.isSetObject)(decl) && !decl.specifiers?.some((s) => declaration?.specifiers?.some((specifier) => (specifier.alias ? specifier.alias : specifier.name) === (s.alias ? s.alias : s.name))))) {
267
+ const exportModuleRef = decl;
268
+ if ((exportModuleRef.specifiers?.some((s) => s.alias || s.name) || exportModuleRef.name) && new RegExp(`(^|\\s|\\n|\\r\\n|\\(|\\)|<|>|{|}|\\[|\\]|\\!|\\?|\\.|,|\\*|&|:)(${exportModuleRef.specifiers?.map((s) => `${s.alias ? `${s.alias}|` : ""}${s.name}`).join("|") || exportModuleRef.name})($|\\s|\\n|\\r\\n|\\(|\\)|<|>|{|}|\\[|\\]|\\!|\\?|\\.|,|\\*|&|:|;)`).test(declaration.text)) commonDeclarations.push(exportModuleRef);
269
+ }
270
+ commonDeclarations.push(declaration);
271
+ }
251
272
  }
252
273
  }
253
- for (const ambientFile of ambientModules) {
254
- const dts = emittedContentMap.get(ambientFile);
255
- if (dts) {
256
- const cleaned = dts.replace(/\/\/# sourceMappingURL=.*$/m, "").trim();
257
- if (cleaned) code += `\n\n${formatTypes(cleaned)}`;
274
+ let code = "";
275
+ const directives = [];
276
+ for (const commonDeclaration of commonDeclarations) {
277
+ code += formatTypes(`${commonDeclaration.comment?.trim() ? commonDeclaration.comment.trim() : ""}${commonDeclaration.comment?.trim() ? "\n" : ""}${formatTypes(commonDeclaration.text.replace(/\s*export\s*/, "").replace(/\s*declare\s*interface\s*/, "interface ").replace(/\s*declare\s*type\s*/, "type "))}`);
278
+ code += "\n\n";
279
+ }
280
+ for (const mod of ctx.modules) {
281
+ code += mod.comment ? `${mod.comment.trim()}\n` : "";
282
+ code += `declare module "${context.config.framework}:${mod.name}" { \n`;
283
+ for (const importRef of mod.imports) if (importRef.ambient) code += directives.push(importRef.name);
284
+ else if (importRef.all) code += `\timport * as ${(0, _stryke_path_file_path_fns.findFileName)(importRef.name)} from "${importRef.name}";\n`;
285
+ else if (importRef.specifiers) {
286
+ const typeOnly = importRef.specifiers.every((s) => s.type) ? " type" : "";
287
+ const specifiers = importRef.specifiers.map((s) => s.alias ? `${s.name} as ${s.alias}` : s.name).join(", ");
288
+ code += `\timport${typeOnly} { ${specifiers} } from "${importRef.name}";\n`;
258
289
  }
290
+ if (mod.imports.length > 0) code += "\n";
291
+ for (const exportRef of mod.exports.filter((e) => (0, _stryke_type_checks_is_string.isString)(e) || !e.specifiers || !commonDeclarations.some((commonDecl) => commonDecl.specifiers && commonDecl.specifiers.some((specifier) => e.specifiers?.some((s) => (s.alias ? s.alias : s.name) === (specifier.alias ? specifier.alias : specifier.name)))))) if ((0, _stryke_type_checks_is_set_string.isSetString)(exportRef)) code += `${exportRef}\n`;
292
+ else if (exportRef.name) {
293
+ if (exportRef.all) code += `${exportRef.comment?.trim() ? exportRef.comment.trim() : ""}${exportRef.comment?.trim() ? "\n" : ""}export * from "${exportRef.name}";\n`;
294
+ else if (exportRef.specifiers) {
295
+ if (exportRef.comment?.trim()) code += `${exportRef.comment.trim()}\n`;
296
+ code += `\texport${exportRef.specifiers.every((s) => s.type) ? " type" : ""} { ${exportRef.specifiers.map((s) => s.alias ? `${s.name} as ${s.alias}` : s.name).join(", ")} } from "${exportRef.name}";\n`;
297
+ }
298
+ } else code += `${exportRef.comment?.trim() ? exportRef.comment.trim() : ""}${exportRef.comment?.trim() ? "\n" : ""}${formatTypes(exportRef.text.replace(/\s*export\s*declare\s*/, "export ").replace(/\s*declare\s*/, " "))}\n`;
299
+ mod.exports.filter((e) => !(0, _stryke_type_checks_is_string.isString)(e) && e.specifiers && commonDeclarations.some((commonDeclaration) => commonDeclaration.specifiers && commonDeclaration.specifiers.some((specifier) => e.specifiers?.some((s) => (s.alias ? s.alias : s.name) === (specifier.alias ? specifier.alias : specifier.name))))).forEach((e, i, arr) => {
300
+ if (i === 0) code += "\nexport { ";
301
+ else code += ", ";
302
+ code += `${e?.specifiers?.filter((s) => commonDeclarations.some((commonDeclaration) => commonDeclaration.specifiers && commonDeclaration.specifiers.some((specifier) => (s.alias ? s.alias : s.name) === (specifier.alias ? specifier.alias : specifier.name)))).map((s) => s.alias ? `${s.name} as ${s.alias}` : s.name).join(", ") || ""}`;
303
+ if (i === arr.length - 1) code += ` };\n`;
304
+ });
305
+ code += "}";
306
+ code += "\n\n";
259
307
  }
260
308
  code = await (0, require_utils.utils_exports.format)(context, context.typesPath, code);
261
309
  context.debug(`A TypeScript declaration file (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new Blob((0, _stryke_convert_to_array.toArray)(code)).size)}) emitted for the built-in modules types.`);
@@ -1876,7 +1876,7 @@ var PowerlinesContext = class PowerlinesContext {
1876
1876
  */
1877
1877
  get alias() {
1878
1878
  return this.builtins.reduce((ret, id) => {
1879
- const moduleId = `${this.config?.framework || "powerlines"}:${id.replace(/^.*?:/, "")}`;
1879
+ const moduleId = `${this.config?.framework || "powerlines"}:${id.replace(/^.*:/, "")}`;
1880
1880
  if (!ret[moduleId]) {
1881
1881
  const path = this.fs.paths[id];
1882
1882
  if (path) ret[moduleId] = path;
@@ -2981,4 +2981,4 @@ var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext
2981
2981
 
2982
2982
  //#endregion
2983
2983
  export { FileId as a, FileStorage as c, writeMetaFile as d, callHook as f, PowerlinesContext as i, FileSystem as l, PowerlinesEnvironmentContext as n, FileMetadata as o, mergeConfigs as p, createPluginContext as r, FileMetadata_KeyValuePair as s, PowerlinesAPIContext as t, _capnpFileId as u };
2984
- //# sourceMappingURL=api-context-CEJ3s11k.mjs.map
2984
+ //# sourceMappingURL=api-context-DuZIIJsm.mjs.map