@powerlines/plugin-nodejs 0.1.3 → 0.1.4
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/plugin-alloy/src/types/components.d.cts +3 -4
- package/dist/plugin-alloy/src/types/components.d.mts +3 -4
- package/dist/plugin-alloy/src/types/index.d.cts +1 -1
- package/dist/plugin-alloy/src/types/index.d.mts +1 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +14 -2
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +15 -3
- package/dist/powerlines/src/types/build.d.mts +2 -0
- package/dist/powerlines/src/types/resolved.d.mts +1 -0
- package/package.json +4 -4
|
@@ -15,9 +15,8 @@ interface TypescriptFileImportItem {
|
|
|
15
15
|
alias?: string;
|
|
16
16
|
type?: boolean;
|
|
17
17
|
}
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
$builtins?: TypescriptFileImportList;
|
|
18
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>> & {
|
|
19
|
+
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
21
20
|
};
|
|
22
21
|
//#endregion
|
|
23
|
-
export { ComponentProps, TypescriptFileImportItem,
|
|
22
|
+
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
@@ -16,9 +16,8 @@ interface TypescriptFileImportItem {
|
|
|
16
16
|
alias?: string;
|
|
17
17
|
type?: boolean;
|
|
18
18
|
}
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
$builtins?: TypescriptFileImportList;
|
|
19
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>> & {
|
|
20
|
+
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
22
21
|
};
|
|
23
22
|
//#endregion
|
|
24
|
-
export { ComponentProps, TypescriptFileImportItem,
|
|
23
|
+
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentProps, TypescriptFileImportItem,
|
|
1
|
+
import { ComponentProps, TypescriptFileImportItem, TypescriptFileImports } from "./components.cjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.cjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentProps, TypescriptFileImportItem,
|
|
1
|
+
import { ComponentProps, TypescriptFileImportItem, TypescriptFileImports } from "./components.mjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.mjs";
|
|
@@ -167,8 +167,20 @@ function TypescriptFileHeaderImports(props) {
|
|
|
167
167
|
return !!imports && Object.keys(imports).length > 0;
|
|
168
168
|
},
|
|
169
169
|
get children() {
|
|
170
|
-
return
|
|
171
|
-
|
|
170
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
171
|
+
get each() {
|
|
172
|
+
return Object.entries(imports ?? {});
|
|
173
|
+
},
|
|
174
|
+
children: ([module$1, imported]) => {
|
|
175
|
+
if (module$1 === "$builtins") return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
176
|
+
get each() {
|
|
177
|
+
return Object.entries(imported ?? {});
|
|
178
|
+
},
|
|
179
|
+
children: ([builtinModule, builtinImports]) => __alloy_js_core.code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
180
|
+
});
|
|
181
|
+
const normalImports = imported;
|
|
182
|
+
return __alloy_js_core.code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module$1}";`;
|
|
183
|
+
}
|
|
172
184
|
});
|
|
173
185
|
}
|
|
174
186
|
}),
|
|
@@ -4,7 +4,7 @@ import { SourceFile } from "../../core/components/source-file.mjs";
|
|
|
4
4
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
6
6
|
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
-
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
7
|
+
import { For, Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
8
8
|
import { appendPath } from "@stryke/path/append";
|
|
9
9
|
import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
|
|
10
10
|
import { isBoolean } from "@stryke/type-checks/is-boolean";
|
|
@@ -166,8 +166,20 @@ function TypescriptFileHeaderImports(props) {
|
|
|
166
166
|
return !!imports && Object.keys(imports).length > 0;
|
|
167
167
|
},
|
|
168
168
|
get children() {
|
|
169
|
-
return
|
|
170
|
-
|
|
169
|
+
return createComponent(For, {
|
|
170
|
+
get each() {
|
|
171
|
+
return Object.entries(imports ?? {});
|
|
172
|
+
},
|
|
173
|
+
children: ([module, imported]) => {
|
|
174
|
+
if (module === "$builtins") return createComponent(For, {
|
|
175
|
+
get each() {
|
|
176
|
+
return Object.entries(imported ?? {});
|
|
177
|
+
},
|
|
178
|
+
children: ([builtinModule, builtinImports]) => code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !isString(i) && i.default).length > 0 && builtinImports.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
179
|
+
});
|
|
180
|
+
const normalImports = imported;
|
|
181
|
+
return code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !isString(i) && i.default).length > 0 && normalImports.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module}";`;
|
|
182
|
+
}
|
|
171
183
|
});
|
|
172
184
|
}
|
|
173
185
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-nodejs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for building a Node.js application.",
|
|
6
6
|
"repository": {
|
|
@@ -135,9 +135,9 @@
|
|
|
135
135
|
"@alloy-js/json": "^0.22.0",
|
|
136
136
|
"@alloy-js/markdown": "^0.22.0",
|
|
137
137
|
"@alloy-js/typescript": "^0.22.0",
|
|
138
|
-
"@powerlines/plugin-alloy": "^0.18.
|
|
138
|
+
"@powerlines/plugin-alloy": "^0.18.7",
|
|
139
139
|
"@powerlines/plugin-babel": "^0.12.134",
|
|
140
|
-
"@powerlines/plugin-env": "^0.15.
|
|
140
|
+
"@powerlines/plugin-env": "^0.15.9",
|
|
141
141
|
"@storm-software/config-tools": "^1.188.75",
|
|
142
142
|
"@stryke/string-format": "^0.12.30",
|
|
143
143
|
"defu": "^6.1.4",
|
|
@@ -145,5 +145,5 @@
|
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": { "@babel/core": "^7.28.5", "@types/node": "^24.10.4" },
|
|
147
147
|
"publishConfig": { "access": "public" },
|
|
148
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "8c096ca8c2383603e770532ec0f828761d525947"
|
|
149
149
|
}
|