@powerlines/plugin-nodejs 0.1.135 → 0.1.137
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/components/env.cjs +2 -185
- package/dist/components/env.d.cts +1 -9
- package/dist/components/env.d.mts +1 -9
- package/dist/components/env.mjs +1 -182
- package/dist/components/index.cjs +3 -2
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.mts +2 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components-BWLXb7a2.cjs +0 -0
- package/dist/components-kh0CpIG2.mjs +1 -0
- package/dist/env--9rS0L72.cjs +223 -0
- package/dist/env-BbWlIivm.d.mts +11 -0
- package/dist/env-BbWlIivm.d.mts.map +1 -0
- package/dist/env-CNIW9dZh.mjs +185 -0
- package/dist/env-CNIW9dZh.mjs.map +1 -0
- package/dist/env-i5491Gd4.d.cts +11 -0
- package/dist/env-i5491Gd4.d.cts.map +1 -0
- package/dist/index-9iG2qHLe.d.mts +1 -0
- package/dist/index-D-CYNcT9.d.mts +1 -0
- package/dist/index-D4ELpJXS.d.cts +1 -0
- package/dist/index-DLoAMD9J.d.cts +1 -0
- package/dist/index.cjs +8 -7
- package/dist/index.d.cts +6 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-DIMmxDo0.d.cts +24 -0
- package/dist/plugin-DIMmxDo0.d.cts.map +1 -0
- package/dist/plugin-ifZVa20V.mjs +1 -0
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/plugin-w7U9e4U2.d.mts +24 -0
- package/dist/plugin-w7U9e4U2.d.mts.map +1 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -22
- package/dist/types/plugin.d.mts +1 -22
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-U3zd8PTP.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/package.json +7 -7
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
29
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
30
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
31
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
32
|
+
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
33
|
+
let __powerlines_plugin_env_components_env = require("@powerlines/plugin-env/components/env");
|
|
34
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
35
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
36
|
+
let defu = require("defu");
|
|
37
|
+
defu = __toESM(defu);
|
|
38
|
+
|
|
39
|
+
//#region src/components/env.tsx
|
|
40
|
+
/**
|
|
41
|
+
* Generates the NodeJs environment configuration module for the Powerlines project.
|
|
42
|
+
*/
|
|
43
|
+
function NodeJsEnvBuiltin(props) {
|
|
44
|
+
const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
|
|
45
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
46
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_env_components_env.EnvBuiltin, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
47
|
+
get imports() {
|
|
48
|
+
return (0, defu.default)({
|
|
49
|
+
"node:os": "os",
|
|
50
|
+
"node:path": ["basename", "join"]
|
|
51
|
+
}, rest.imports ?? {});
|
|
52
|
+
},
|
|
53
|
+
get children() {
|
|
54
|
+
return [
|
|
55
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
56
|
+
"export": true,
|
|
57
|
+
"const": true,
|
|
58
|
+
name: "isWindows",
|
|
59
|
+
doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
|
|
60
|
+
initializer: __alloy_js_core.code`/^win/i.test(process.platform); `
|
|
61
|
+
}),
|
|
62
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
63
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
64
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
65
|
+
"export": true,
|
|
66
|
+
"const": true,
|
|
67
|
+
name: "isLinux",
|
|
68
|
+
doc: "An indicator specifying whether the current operating system is Linux.",
|
|
69
|
+
initializer: __alloy_js_core.code`/^linux/i.test(process.platform); `
|
|
70
|
+
}),
|
|
71
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
72
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
73
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
74
|
+
"export": true,
|
|
75
|
+
"const": true,
|
|
76
|
+
name: "isMacOS",
|
|
77
|
+
doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
|
|
78
|
+
initializer: __alloy_js_core.code`/^darwin/i.test(process.platform); `
|
|
79
|
+
}),
|
|
80
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
81
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
82
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
83
|
+
"const": true,
|
|
84
|
+
name: "homedir",
|
|
85
|
+
initializer: __alloy_js_core.code`os.homedir(); `
|
|
86
|
+
}),
|
|
87
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
88
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
89
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
90
|
+
"const": true,
|
|
91
|
+
name: "tmpdir",
|
|
92
|
+
initializer: __alloy_js_core.code`os.tmpdir(); `
|
|
93
|
+
}),
|
|
94
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
95
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
96
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
97
|
+
heading: "The environment path types for storing things like data, config, logs, and cache in the current runtime environment.",
|
|
98
|
+
get children() {
|
|
99
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `These environment path types are accessed in the {@link EnvPaths} type. ` });
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeDeclaration, {
|
|
103
|
+
"export": true,
|
|
104
|
+
name: "EnvPathType",
|
|
105
|
+
children: __alloy_js_core.code`"data" | "config" | "cache" | "log" | "temp"; `
|
|
106
|
+
}),
|
|
107
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
108
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
109
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The environment paths for storing things like data, config, logs, and cache in the current runtime environment." }),
|
|
110
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeDeclaration, {
|
|
111
|
+
"export": true,
|
|
112
|
+
name: "EnvPaths",
|
|
113
|
+
children: __alloy_js_core.code`Record<EnvPathType, string>; `
|
|
114
|
+
}),
|
|
115
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
116
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
117
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
118
|
+
heading: "The resolved application directories based on the current operating system and environment variables.",
|
|
119
|
+
get children() {
|
|
120
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`If the \`DATA_DIR\`, \`CONFIG_DIR\`, \`CACHE_DIR\`, \`LOG_DIR\`, or \`TEMP_DIR\` environment variables are set, they will be treated as overrides and used by default. If the environment variables are not set, the paths are determined based on the specific conventions for each operating system (with additional overrides available through operating system specific environment variables):
|
|
121
|
+
- **Linux**: directories are generally created in \`~/.config/<name>\` (this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/))
|
|
122
|
+
- **Windows**: directories are generally created in \`%AppData%/<name>\`
|
|
123
|
+
- **MacOS**: directories are generally created in \`~/Library/Application Support/<name>\`
|
|
124
|
+
` });
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
128
|
+
"export": true,
|
|
129
|
+
"const": true,
|
|
130
|
+
name: "paths",
|
|
131
|
+
get initializer() {
|
|
132
|
+
return __alloy_js_core.code`isMacOS
|
|
133
|
+
? {
|
|
134
|
+
data: String(env.DATA_DIR)
|
|
135
|
+
? join(String(env.DATA_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
136
|
+
: join(homedir, "Library", "Application Support", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
137
|
+
config: String(env.CONFIG_DIR)
|
|
138
|
+
? join(String(env.CONFIG_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
139
|
+
: join(homedir, "Library", "Preferences", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
140
|
+
cache: String(env.CACHE_DIR)
|
|
141
|
+
? join(String(env.CACHE_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
142
|
+
: join(homedir, "Library", "Caches", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
143
|
+
log: String(env.LOG_DIR)
|
|
144
|
+
? join(String(env.LOG_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
145
|
+
: join(homedir, "Library", "Logs", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
146
|
+
temp: String(env.TEMP_DIR)
|
|
147
|
+
? join(String(env.TEMP_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
148
|
+
: join(tmpdir, "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
149
|
+
}
|
|
150
|
+
: isWindows
|
|
151
|
+
? {
|
|
152
|
+
data: String(env.DATA_DIR)
|
|
153
|
+
? join(String(env.DATA_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
154
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}", "Data"),
|
|
155
|
+
config: String(env.CONFIG_DIR)
|
|
156
|
+
? join(env.CONFIG_DIR!, "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
157
|
+
: join(env.APPDATA || join(homedir, "AppData", "Roaming"), "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}", "Config"),
|
|
158
|
+
cache: String(env.CACHE_DIR)
|
|
159
|
+
? join(String(env.CACHE_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
160
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "Cache", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
161
|
+
log: String(env.LOG_DIR)
|
|
162
|
+
? join(String(env.LOG_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
163
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}", "Log"),
|
|
164
|
+
temp: String(env.TEMP_DIR)
|
|
165
|
+
? join(String(env.TEMP_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
166
|
+
: join(tmpdir, "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
167
|
+
}
|
|
168
|
+
:
|
|
169
|
+
{
|
|
170
|
+
data: String(env.DATA_DIR)
|
|
171
|
+
? join(String(env.DATA_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
172
|
+
: join(
|
|
173
|
+
env.XDG_DATA_HOME || join(homedir, ".local", "share"),
|
|
174
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}",
|
|
175
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"
|
|
176
|
+
),
|
|
177
|
+
config: String(env.CONFIG_DIR)
|
|
178
|
+
? join(String(env.CONFIG_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
179
|
+
: join(
|
|
180
|
+
env.XDG_CONFIG_HOME || join(homedir, ".config"),
|
|
181
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}",
|
|
182
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"
|
|
183
|
+
),
|
|
184
|
+
cache: String(env.CACHE_DIR)
|
|
185
|
+
? join(String(env.CACHE_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
186
|
+
: join(env.XDG_CACHE_HOME || join(homedir, ".cache"), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}", "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"),
|
|
187
|
+
log: String(env.LOG_DIR)
|
|
188
|
+
? join(String(env.LOG_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
189
|
+
: join(env.XDG_STATE_HOME || join(homedir, ".local", "state"), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}", "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"),
|
|
190
|
+
temp: String(env.TEMP_DIR)
|
|
191
|
+
? join(String(env.TEMP_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
192
|
+
: (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR
|
|
193
|
+
? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}", "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
194
|
+
: join(tmpdir, basename(homedir), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}", "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"))
|
|
195
|
+
} as EnvPaths; `;
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
199
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
200
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
201
|
+
get when() {
|
|
202
|
+
return Boolean(children);
|
|
203
|
+
},
|
|
204
|
+
children
|
|
205
|
+
})
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
Object.defineProperty(exports, 'NodeJsEnvBuiltin', {
|
|
213
|
+
enumerable: true,
|
|
214
|
+
get: function () {
|
|
215
|
+
return NodeJsEnvBuiltin;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
Object.defineProperty(exports, '__toESM', {
|
|
219
|
+
enumerable: true,
|
|
220
|
+
get: function () {
|
|
221
|
+
return __toESM;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EnvBuiltinProps } from "@powerlines/plugin-env/components/env";
|
|
3
|
+
|
|
4
|
+
//#region src/components/env.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generates the NodeJs environment configuration module for the Powerlines project.
|
|
7
|
+
*/
|
|
8
|
+
declare function NodeJsEnvBuiltin(props: EnvBuiltinProps): _alloy_js_core0.Children;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { NodeJsEnvBuiltin as t };
|
|
11
|
+
//# sourceMappingURL=env-BbWlIivm.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-BbWlIivm.d.mts","names":[],"sources":["../src/components/env.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCgB,iBAAA,gBAAA,CAAwB,KAAA,EAAA,eAAe,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
|
+
import { TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
|
|
4
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
+
import { TSDoc, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
6
|
+
import { EnvBuiltin } from "@powerlines/plugin-env/components/env";
|
|
7
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
8
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
9
|
+
import defu from "defu";
|
|
10
|
+
|
|
11
|
+
//#region src/components/env.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Generates the NodeJs environment configuration module for the Powerlines project.
|
|
14
|
+
*/
|
|
15
|
+
function NodeJsEnvBuiltin(props) {
|
|
16
|
+
const [{ children }, rest] = splitProps(props, ["children"]);
|
|
17
|
+
const context = usePowerlines();
|
|
18
|
+
return createComponent(EnvBuiltin, mergeProps(rest, {
|
|
19
|
+
get imports() {
|
|
20
|
+
return defu({
|
|
21
|
+
"node:os": "os",
|
|
22
|
+
"node:path": ["basename", "join"]
|
|
23
|
+
}, rest.imports ?? {});
|
|
24
|
+
},
|
|
25
|
+
get children() {
|
|
26
|
+
return [
|
|
27
|
+
createComponent(VarDeclaration, {
|
|
28
|
+
"export": true,
|
|
29
|
+
"const": true,
|
|
30
|
+
name: "isWindows",
|
|
31
|
+
doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
|
|
32
|
+
initializer: code`/^win/i.test(process.platform); `
|
|
33
|
+
}),
|
|
34
|
+
createIntrinsic("hbr", {}),
|
|
35
|
+
createIntrinsic("hbr", {}),
|
|
36
|
+
createComponent(VarDeclaration, {
|
|
37
|
+
"export": true,
|
|
38
|
+
"const": true,
|
|
39
|
+
name: "isLinux",
|
|
40
|
+
doc: "An indicator specifying whether the current operating system is Linux.",
|
|
41
|
+
initializer: code`/^linux/i.test(process.platform); `
|
|
42
|
+
}),
|
|
43
|
+
createIntrinsic("hbr", {}),
|
|
44
|
+
createIntrinsic("hbr", {}),
|
|
45
|
+
createComponent(VarDeclaration, {
|
|
46
|
+
"export": true,
|
|
47
|
+
"const": true,
|
|
48
|
+
name: "isMacOS",
|
|
49
|
+
doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
|
|
50
|
+
initializer: code`/^darwin/i.test(process.platform); `
|
|
51
|
+
}),
|
|
52
|
+
createIntrinsic("hbr", {}),
|
|
53
|
+
createIntrinsic("hbr", {}),
|
|
54
|
+
createComponent(VarDeclaration, {
|
|
55
|
+
"const": true,
|
|
56
|
+
name: "homedir",
|
|
57
|
+
initializer: code`os.homedir(); `
|
|
58
|
+
}),
|
|
59
|
+
createIntrinsic("hbr", {}),
|
|
60
|
+
createIntrinsic("hbr", {}),
|
|
61
|
+
createComponent(VarDeclaration, {
|
|
62
|
+
"const": true,
|
|
63
|
+
name: "tmpdir",
|
|
64
|
+
initializer: code`os.tmpdir(); `
|
|
65
|
+
}),
|
|
66
|
+
createIntrinsic("hbr", {}),
|
|
67
|
+
createIntrinsic("hbr", {}),
|
|
68
|
+
createComponent(TSDoc, {
|
|
69
|
+
heading: "The environment path types for storing things like data, config, logs, and cache in the current runtime environment.",
|
|
70
|
+
get children() {
|
|
71
|
+
return createComponent(TSDocRemarks, { children: `These environment path types are accessed in the {@link EnvPaths} type. ` });
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
createComponent(TypeDeclaration, {
|
|
75
|
+
"export": true,
|
|
76
|
+
name: "EnvPathType",
|
|
77
|
+
children: code`"data" | "config" | "cache" | "log" | "temp"; `
|
|
78
|
+
}),
|
|
79
|
+
createIntrinsic("hbr", {}),
|
|
80
|
+
createIntrinsic("hbr", {}),
|
|
81
|
+
createComponent(TSDoc, { heading: "The environment paths for storing things like data, config, logs, and cache in the current runtime environment." }),
|
|
82
|
+
createComponent(TypeDeclaration, {
|
|
83
|
+
"export": true,
|
|
84
|
+
name: "EnvPaths",
|
|
85
|
+
children: code`Record<EnvPathType, string>; `
|
|
86
|
+
}),
|
|
87
|
+
createIntrinsic("hbr", {}),
|
|
88
|
+
createIntrinsic("hbr", {}),
|
|
89
|
+
createComponent(TSDoc, {
|
|
90
|
+
heading: "The resolved application directories based on the current operating system and environment variables.",
|
|
91
|
+
get children() {
|
|
92
|
+
return createComponent(TSDocRemarks, { children: code`If the \`DATA_DIR\`, \`CONFIG_DIR\`, \`CACHE_DIR\`, \`LOG_DIR\`, or \`TEMP_DIR\` environment variables are set, they will be treated as overrides and used by default. If the environment variables are not set, the paths are determined based on the specific conventions for each operating system (with additional overrides available through operating system specific environment variables):
|
|
93
|
+
- **Linux**: directories are generally created in \`~/.config/<name>\` (this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/))
|
|
94
|
+
- **Windows**: directories are generally created in \`%AppData%/<name>\`
|
|
95
|
+
- **MacOS**: directories are generally created in \`~/Library/Application Support/<name>\`
|
|
96
|
+
` });
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
createComponent(VarDeclaration, {
|
|
100
|
+
"export": true,
|
|
101
|
+
"const": true,
|
|
102
|
+
name: "paths",
|
|
103
|
+
get initializer() {
|
|
104
|
+
return code`isMacOS
|
|
105
|
+
? {
|
|
106
|
+
data: String(env.DATA_DIR)
|
|
107
|
+
? join(String(env.DATA_DIR), "${titleCase(context.config.name)}")
|
|
108
|
+
: join(homedir, "Library", "Application Support", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
109
|
+
config: String(env.CONFIG_DIR)
|
|
110
|
+
? join(String(env.CONFIG_DIR), "${titleCase(context.config.name)}")
|
|
111
|
+
: join(homedir, "Library", "Preferences", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
112
|
+
cache: String(env.CACHE_DIR)
|
|
113
|
+
? join(String(env.CACHE_DIR), "${titleCase(context.config.name)}")
|
|
114
|
+
: join(homedir, "Library", "Caches", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
115
|
+
log: String(env.LOG_DIR)
|
|
116
|
+
? join(String(env.LOG_DIR), "${titleCase(context.config.name)}")
|
|
117
|
+
: join(homedir, "Library", "Logs", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
118
|
+
temp: String(env.TEMP_DIR)
|
|
119
|
+
? join(String(env.TEMP_DIR), "${titleCase(context.config.name)}")
|
|
120
|
+
: join(tmpdir, "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}")
|
|
121
|
+
}
|
|
122
|
+
: isWindows
|
|
123
|
+
? {
|
|
124
|
+
data: String(env.DATA_DIR)
|
|
125
|
+
? join(String(env.DATA_DIR), "${titleCase(context.config.name)}")
|
|
126
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Data"),
|
|
127
|
+
config: String(env.CONFIG_DIR)
|
|
128
|
+
? join(env.CONFIG_DIR!, "${titleCase(context.config.name)}")
|
|
129
|
+
: join(env.APPDATA || join(homedir, "AppData", "Roaming"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Config"),
|
|
130
|
+
cache: String(env.CACHE_DIR)
|
|
131
|
+
? join(String(env.CACHE_DIR), "${titleCase(context.config.name)}")
|
|
132
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "Cache", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
133
|
+
log: String(env.LOG_DIR)
|
|
134
|
+
? join(String(env.LOG_DIR), "${titleCase(context.config.name)}")
|
|
135
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Log"),
|
|
136
|
+
temp: String(env.TEMP_DIR)
|
|
137
|
+
? join(String(env.TEMP_DIR), "${titleCase(context.config.name)}")
|
|
138
|
+
: join(tmpdir, "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}")
|
|
139
|
+
}
|
|
140
|
+
:
|
|
141
|
+
{
|
|
142
|
+
data: String(env.DATA_DIR)
|
|
143
|
+
? join(String(env.DATA_DIR), "${kebabCase(context.config.name)}")
|
|
144
|
+
: join(
|
|
145
|
+
env.XDG_DATA_HOME || join(homedir, ".local", "share"),
|
|
146
|
+
"${kebabCase(context.config.organization)}",
|
|
147
|
+
"${kebabCase(context.config.name)}"
|
|
148
|
+
),
|
|
149
|
+
config: String(env.CONFIG_DIR)
|
|
150
|
+
? join(String(env.CONFIG_DIR), "${kebabCase(context.config.name)}")
|
|
151
|
+
: join(
|
|
152
|
+
env.XDG_CONFIG_HOME || join(homedir, ".config"),
|
|
153
|
+
"${kebabCase(context.config.organization)}",
|
|
154
|
+
"${kebabCase(context.config.name)}"
|
|
155
|
+
),
|
|
156
|
+
cache: String(env.CACHE_DIR)
|
|
157
|
+
? join(String(env.CACHE_DIR), "${kebabCase(context.config.name)}")
|
|
158
|
+
: join(env.XDG_CACHE_HOME || join(homedir, ".cache"), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"),
|
|
159
|
+
log: String(env.LOG_DIR)
|
|
160
|
+
? join(String(env.LOG_DIR), "${kebabCase(context.config.name)}")
|
|
161
|
+
: join(env.XDG_STATE_HOME || join(homedir, ".local", "state"), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"),
|
|
162
|
+
temp: String(env.TEMP_DIR)
|
|
163
|
+
? join(String(env.TEMP_DIR), "${kebabCase(context.config.name)}")
|
|
164
|
+
: (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR
|
|
165
|
+
? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}")
|
|
166
|
+
: join(tmpdir, basename(homedir), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"))
|
|
167
|
+
} as EnvPaths; `;
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
170
|
+
createIntrinsic("hbr", {}),
|
|
171
|
+
createIntrinsic("hbr", {}),
|
|
172
|
+
createComponent(Show, {
|
|
173
|
+
get when() {
|
|
174
|
+
return Boolean(children);
|
|
175
|
+
},
|
|
176
|
+
children
|
|
177
|
+
})
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
//#endregion
|
|
184
|
+
export { NodeJsEnvBuiltin as t };
|
|
185
|
+
//# sourceMappingURL=env-CNIW9dZh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-CNIW9dZh.mjs","names":["code","Show","splitProps","TypeDeclaration","VarDeclaration","usePowerlines","TSDoc","TSDocRemarks","EnvBuiltin","kebabCase","titleCase","defu","NodeJsEnvBuiltin","props","children","rest","context","_$createComponent","_$mergeProps","imports","name","doc","initializer","_$createIntrinsic","heading","config","organization","when","Boolean"],"sources":["../src/components/env.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 { code, Show, splitProps } from \"@alloy-js/core\";\nimport { TypeDeclaration, VarDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n EnvBuiltin,\n EnvBuiltinProps\n} from \"@powerlines/plugin-env/components/env\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { NodeJsPluginContext } from \"../types\";\n\n/**\n * Generates the NodeJs environment configuration module for the Powerlines project.\n */\nexport function NodeJsEnvBuiltin(props: EnvBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n const context = usePowerlines<NodeJsPluginContext>();\n\n return (\n <EnvBuiltin\n {...rest}\n imports={defu(\n {\n \"node:os\": \"os\",\n \"node:path\": [\"basename\", \"join\"]\n },\n rest.imports ?? {}\n )}>\n <VarDeclaration\n export\n const\n name=\"isWindows\"\n doc=\"An indicator specifying whether the current operating system is MacOS (darwin kernel).\"\n initializer={code`/^win/i.test(process.platform); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isLinux\"\n doc=\"An indicator specifying whether the current operating system is Linux.\"\n initializer={code`/^linux/i.test(process.platform); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isMacOS\"\n doc=\"An indicator specifying whether the current operating system is MacOS (darwin kernel).\"\n initializer={code`/^darwin/i.test(process.platform); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration const name=\"homedir\" initializer={code`os.homedir(); `} />\n <hbr />\n <hbr />\n <VarDeclaration const name=\"tmpdir\" initializer={code`os.tmpdir(); `} />\n <hbr />\n <hbr />\n <TSDoc heading=\"The environment path types for storing things like data, config, logs, and cache in the current runtime environment.\">\n <TSDocRemarks>\n {`These environment path types are accessed in the {@link EnvPaths} type. `}\n </TSDocRemarks>\n </TSDoc>\n <TypeDeclaration export name=\"EnvPathType\">\n {code`\"data\" | \"config\" | \"cache\" | \"log\" | \"temp\"; `}\n </TypeDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"The environment paths for storing things like data, config, logs, and cache in the current runtime environment.\" />\n <TypeDeclaration export name=\"EnvPaths\">\n {code`Record<EnvPathType, string>; `}\n </TypeDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"The resolved application directories based on the current operating system and environment variables.\">\n <TSDocRemarks>\n {code`If the \\`DATA_DIR\\`, \\`CONFIG_DIR\\`, \\`CACHE_DIR\\`, \\`LOG_DIR\\`, or \\`TEMP_DIR\\` environment variables are set, they will be treated as overrides and used by default. If the environment variables are not set, the paths are determined based on the specific conventions for each operating system (with additional overrides available through operating system specific environment variables):\n - **Linux**: directories are generally created in \\`~/.config/<name>\\` (this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/))\n - **Windows**: directories are generally created in \\`%AppData%/<name>\\`\n - **MacOS**: directories are generally created in \\`~/Library/Application Support/<name>\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"paths\"\n initializer={code`isMacOS\n ? {\n data: String(env.DATA_DIR)\n ? join(String(env.DATA_DIR), \"${titleCase(\n context.config.name\n )}\")\n : join(homedir, \"Library\", \"Application Support\", \"${titleCase(\n context.config.organization\n )}\", \"${titleCase(context.config.name)}\"),\n config: String(env.CONFIG_DIR)\n ? join(String(env.CONFIG_DIR), \"${titleCase(\n context.config.name\n )}\")\n : join(homedir, \"Library\", \"Preferences\", \"${titleCase(\n context.config.organization\n )}\", \"${titleCase(context.config.name)}\"),\n cache: String(env.CACHE_DIR)\n ? join(String(env.CACHE_DIR), \"${titleCase(\n context.config.name\n )}\")\n : join(homedir, \"Library\", \"Caches\", \"${titleCase(\n context.config.organization\n )}\", \"${titleCase(context.config.name)}\"),\n log: String(env.LOG_DIR)\n ? join(String(env.LOG_DIR), \"${titleCase(context.config.name)}\")\n : join(homedir, \"Library\", \"Logs\", \"${titleCase(\n context.config.organization\n )}\", \"${titleCase(context.config.name)}\"),\n temp: String(env.TEMP_DIR)\n ? join(String(env.TEMP_DIR), \"${titleCase(\n context.config.name\n )}\")\n : join(tmpdir, \"${titleCase(\n context.config.organization\n )}\", \"${titleCase(context.config.name)}\")\n }\n : isWindows\n ? {\n data: String(env.DATA_DIR)\n ? join(String(env.DATA_DIR), \"${titleCase(context.config.name)}\")\n : join(env.LOCALAPPDATA || join(homedir, \"AppData\", \"Local\"), \"${titleCase(context.config.organization)}\", \"${titleCase(\n context.config.name\n )}\", \"Data\"),\n config: String(env.CONFIG_DIR)\n ? join(env.CONFIG_DIR!, \"${titleCase(context.config.name)}\")\n : join(env.APPDATA || join(homedir, \"AppData\", \"Roaming\"), \"${titleCase(context.config.organization)}\", \"${titleCase(\n context.config.name\n )}\", \"Config\"),\n cache: String(env.CACHE_DIR)\n ? join(String(env.CACHE_DIR), \"${titleCase(context.config.name)}\")\n : join(env.LOCALAPPDATA || join(homedir, \"AppData\", \"Local\"), \"Cache\", \"${titleCase(context.config.organization)}\", \"${titleCase(\n context.config.name\n )}\"),\n log: String(env.LOG_DIR)\n ? join(String(env.LOG_DIR), \"${titleCase(context.config.name)}\")\n : join(env.LOCALAPPDATA || join(homedir, \"AppData\", \"Local\"), \"${titleCase(context.config.organization)}\", \"${titleCase(\n context.config.name\n )}\", \"Log\"),\n temp: String(env.TEMP_DIR)\n ? join(String(env.TEMP_DIR), \"${titleCase(context.config.name)}\")\n : join(tmpdir, \"${titleCase(context.config.organization)}\", \"${titleCase(context.config.name)}\")\n }\n :\n {\n data: String(env.DATA_DIR)\n ? join(String(env.DATA_DIR), \"${kebabCase(context.config.name)}\")\n : join(\n env.XDG_DATA_HOME || join(homedir, \".local\", \"share\"),\n \"${kebabCase(context.config.organization)}\",\n \"${kebabCase(context.config.name)}\"\n ),\n config: String(env.CONFIG_DIR)\n ? join(String(env.CONFIG_DIR), \"${kebabCase(context.config.name)}\")\n : join(\n env.XDG_CONFIG_HOME || join(homedir, \".config\"),\n \"${kebabCase(context.config.organization)}\",\n \"${kebabCase(context.config.name)}\"\n ),\n cache: String(env.CACHE_DIR)\n ? join(String(env.CACHE_DIR), \"${kebabCase(context.config.name)}\")\n : join(env.XDG_CACHE_HOME || join(homedir, \".cache\"), \"${kebabCase(context.config.organization)}\", \"${kebabCase(\n context.config.name\n )}\"),\n log: String(env.LOG_DIR)\n ? join(String(env.LOG_DIR), \"${kebabCase(context.config.name)}\")\n : join(env.XDG_STATE_HOME || join(homedir, \".local\", \"state\"), \"${kebabCase(context.config.organization)}\", \"${kebabCase(\n context.config.name\n )}\"),\n temp: String(env.TEMP_DIR)\n ? join(String(env.TEMP_DIR), \"${kebabCase(context.config.name)}\")\n : (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR\n ? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, \"${kebabCase(context.config.organization)}\", \"${kebabCase(\n context.config.name\n )}\")\n : join(tmpdir, basename(homedir), \"${kebabCase(context.config.organization)}\", \"${kebabCase(context.config.name)}\"))\n } as EnvPaths; `}\n />\n <hbr />\n <hbr />\n <Show when={Boolean(children)}>{children}</Show>\n </EnvBuiltin>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EnvBuiltinProps } from "@powerlines/plugin-env/components/env";
|
|
3
|
+
|
|
4
|
+
//#region src/components/env.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generates the NodeJs environment configuration module for the Powerlines project.
|
|
7
|
+
*/
|
|
8
|
+
declare function NodeJsEnvBuiltin(props: EnvBuiltinProps): _alloy_js_core0.Children;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { NodeJsEnvBuiltin as t };
|
|
11
|
+
//# sourceMappingURL=env-i5491Gd4.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-i5491Gd4.d.cts","names":[],"sources":["../src/components/env.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCgB,iBAAA,gBAAA,CAAwB,KAAA,EAAA,eAAe,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
require('./
|
|
2
|
+
const require_env = require('./env--9rS0L72.cjs');
|
|
3
|
+
require('./components-BWLXb7a2.cjs');
|
|
4
|
+
require('./plugin-pBKbb5K9.cjs');
|
|
5
|
+
require('./types-o3zWarRp.cjs');
|
|
5
6
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
7
|
let __powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
7
|
-
__powerlines_plugin_babel =
|
|
8
|
+
__powerlines_plugin_babel = require_env.__toESM(__powerlines_plugin_babel);
|
|
8
9
|
let __powerlines_plugin_env = require("@powerlines/plugin-env");
|
|
9
|
-
__powerlines_plugin_env =
|
|
10
|
+
__powerlines_plugin_env = require_env.__toESM(__powerlines_plugin_env);
|
|
10
11
|
let powerlines_lib_typescript_tsconfig = require("powerlines/lib/typescript/tsconfig");
|
|
11
12
|
|
|
12
13
|
//#region src/index.tsx
|
|
@@ -27,7 +28,7 @@ const plugin = (options = {}) => {
|
|
|
27
28
|
},
|
|
28
29
|
async prepare() {
|
|
29
30
|
const _self$ = this;
|
|
30
|
-
return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
31
|
+
return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(require_env.NodeJsEnvBuiltin, { get defaultConfig() {
|
|
31
32
|
return _self$.config.env.defaultConfig;
|
|
32
33
|
} }));
|
|
33
34
|
}
|
|
@@ -37,6 +38,6 @@ const plugin = (options = {}) => {
|
|
|
37
38
|
var src_default = plugin;
|
|
38
39
|
|
|
39
40
|
//#endregion
|
|
40
|
-
exports.NodeJsEnvBuiltin =
|
|
41
|
+
exports.NodeJsEnvBuiltin = require_env.NodeJsEnvBuiltin;
|
|
41
42
|
exports.default = src_default;
|
|
42
43
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NodeJsEnvBuiltin } from "./
|
|
2
|
-
import "./
|
|
3
|
-
import { NodeJsPluginContext,
|
|
4
|
-
import "./
|
|
1
|
+
import { t as NodeJsEnvBuiltin } from "./env-i5491Gd4.cjs";
|
|
2
|
+
import "./index-DLoAMD9J.cjs";
|
|
3
|
+
import { a as __ΩNodeJsPluginContext, c as __ΩNodeJsPluginUserConfig, i as NodeJsPluginUserConfig, n as NodeJsPluginOptions, o as __ΩNodeJsPluginOptions, r as NodeJsPluginResolvedConfig, s as __ΩNodeJsPluginResolvedConfig, t as NodeJsPluginContext } from "./plugin-DIMmxDo0.cjs";
|
|
4
|
+
import "./index-D4ELpJXS.cjs";
|
|
5
5
|
import { Plugin } from "powerlines/types/plugin";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -10,4 +10,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
10
10
|
*/
|
|
11
11
|
declare const plugin: <TContext extends NodeJsPluginContext = NodeJsPluginContext>(options?: NodeJsPluginOptions) => Plugin<TContext>[];
|
|
12
12
|
//#endregion
|
|
13
|
-
export { NodeJsEnvBuiltin, NodeJsPluginContext, NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig, __ΩNodeJsPluginContext, __ΩNodeJsPluginOptions, __ΩNodeJsPluginResolvedConfig, __ΩNodeJsPluginUserConfig, plugin as default, plugin };
|
|
13
|
+
export { NodeJsEnvBuiltin, NodeJsPluginContext, NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig, __ΩNodeJsPluginContext, __ΩNodeJsPluginOptions, __ΩNodeJsPluginResolvedConfig, __ΩNodeJsPluginUserConfig, plugin as default, plugin };
|
|
14
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;AA+Ba,cAAA,MA+BZ,EAAA,CAAA,iBA9BkB,mBA8BlB,GA9BwC,mBA8BxC,CAAA,CAAA,OAAA,CAAA,EA5BU,mBA4BV,EAAA,GADM,MACN,CADa,QACb,CAAA,EAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NodeJsEnvBuiltin } from "./
|
|
2
|
-
import "./
|
|
3
|
-
import { NodeJsPluginContext,
|
|
4
|
-
import "./
|
|
1
|
+
import { t as NodeJsEnvBuiltin } from "./env-BbWlIivm.mjs";
|
|
2
|
+
import "./index-D-CYNcT9.mjs";
|
|
3
|
+
import { a as __ΩNodeJsPluginContext, c as __ΩNodeJsPluginUserConfig, i as NodeJsPluginUserConfig, n as NodeJsPluginOptions, o as __ΩNodeJsPluginOptions, r as NodeJsPluginResolvedConfig, s as __ΩNodeJsPluginResolvedConfig, t as NodeJsPluginContext } from "./plugin-w7U9e4U2.mjs";
|
|
4
|
+
import "./index-9iG2qHLe.mjs";
|
|
5
5
|
import { Plugin } from "powerlines/types/plugin";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -10,4 +10,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
10
10
|
*/
|
|
11
11
|
declare const plugin: <TContext extends NodeJsPluginContext = NodeJsPluginContext>(options?: NodeJsPluginOptions) => Plugin<TContext>[];
|
|
12
12
|
//#endregion
|
|
13
|
-
export { NodeJsEnvBuiltin, NodeJsPluginContext, NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig, __ΩNodeJsPluginContext, __ΩNodeJsPluginOptions, __ΩNodeJsPluginResolvedConfig, __ΩNodeJsPluginUserConfig, plugin as default, plugin };
|
|
13
|
+
export { NodeJsEnvBuiltin, NodeJsPluginContext, NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig, __ΩNodeJsPluginContext, __ΩNodeJsPluginOptions, __ΩNodeJsPluginResolvedConfig, __ΩNodeJsPluginUserConfig, plugin as default, plugin };
|
|
14
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;AA+Ba,cAAA,MA+BZ,EAAA,CAAA,iBA9BkB,mBA8BlB,GA9BwC,mBA8BxC,CAAA,CAAA,OAAA,CAAA,EA5BU,mBA4BV,EAAA,GADM,MACN,CADa,QACb,CAAA,EAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { NodeJsEnvBuiltin } from "./
|
|
2
|
-
import "./components
|
|
1
|
+
import { t as NodeJsEnvBuiltin } from "./env-CNIW9dZh.mjs";
|
|
2
|
+
import "./components-kh0CpIG2.mjs";
|
|
3
|
+
import "./plugin-ifZVa20V.mjs";
|
|
4
|
+
import "./types-U3zd8PTP.mjs";
|
|
3
5
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
6
|
import babel from "@powerlines/plugin-babel";
|
|
5
7
|
import env from "@powerlines/plugin-env";
|
|
@@ -33,4 +35,5 @@ const plugin = (options = {}) => {
|
|
|
33
35
|
var src_default = plugin;
|
|
34
36
|
|
|
35
37
|
//#endregion
|
|
36
|
-
export { NodeJsEnvBuiltin, src_default as default, plugin };
|
|
38
|
+
export { NodeJsEnvBuiltin, src_default as default, plugin };
|
|
39
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["babel","env","isMatchFound","NodeJsEnvBuiltin","plugin","options","name","configResolved","devDependencies","tsconfig","tsconfigJson","compilerOptions","types","push","prepare","_self$","render","_$createComponent","defaultConfig","config"],"sources":["../src/index.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 babel from \"@powerlines/plugin-babel\";\nimport env from \"@powerlines/plugin-env\";\nimport { isMatchFound } from \"powerlines/lib/typescript/tsconfig\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { NodeJsEnvBuiltin } from \"./components/env\";\nimport { NodeJsPluginContext, NodeJsPluginOptions } from \"./types/plugin\";\n\nexport * from \"./components\";\nexport * from \"./types\";\n\n/**\n * A package containing a Powerlines plugin for building a NodeJs application.\n */\nexport const plugin = <\n TContext extends NodeJsPluginContext = NodeJsPluginContext\n>(\n options: NodeJsPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n env(options.env),\n {\n name: \"nodejs\",\n configResolved() {\n this.devDependencies[\"@types/node\"] = \"^22.14.6\";\n\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n this.tsconfig.tsconfigJson.compilerOptions.types ??= [];\n if (\n !isMatchFound(\n \"node\",\n this.tsconfig.tsconfigJson.compilerOptions.types\n )\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.types.push(\"node\");\n }\n },\n async prepare() {\n return this.render(\n <NodeJsEnvBuiltin defaultConfig={this.config.env.defaultConfig} />\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAAaI,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;EACLL,MAAMK,QAAQL,MAAM;EACpBC,IAAII,QAAQJ,IAAI;EAChB;GACEK,MAAM;GACNC,iBAAiB;AACf,SAAKC,gBAAgB,iBAAiB;AAEtC,SAAKC,SAASC,aAAaC,oBAAoB,EAAE;AACjD,SAAKF,SAASC,aAAaC,gBAAgBC,UAAU,EAAE;AACvD,QACE,CAACV,aACC,QACA,KAAKO,SAASC,aAAaC,gBAAgBC,MAC5C,CAED,MAAKH,SAASC,aAAaC,gBAAgBC,MAAMC,KAAK,OAAO;;GAGjE,MAAMC,UAAU;IAAA,MAAAC,SAAA;AACd,WAAO,KAAKC,OAAMC,gBACfd,kBAAgB,EAAA,IAACe,gBAAa;AAAA,YAAEH,OAAKI,OAAOlB,IAAIiB;OAAa,CAChE,CAAC;;GAEJ;EACF;;AAGH,kBAAed"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BabelPluginOptions } from "@powerlines/plugin-babel/types/plugin";
|
|
2
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env/types/plugin";
|
|
3
|
+
|
|
4
|
+
//#region src/types/plugin.d.ts
|
|
5
|
+
interface NodeJsPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Options to pass to the [Babel plugin](https://npmjs.com/package/\@powerlines/plugin-babel).
|
|
8
|
+
*/
|
|
9
|
+
babel?: Partial<BabelPluginOptions>;
|
|
10
|
+
/**
|
|
11
|
+
* Options to pass to the [Env plugin](https://npmjs.com/package/\@powerlines/plugin-env).
|
|
12
|
+
*/
|
|
13
|
+
env?: Partial<Omit<EnvPluginOptions, "babel">>;
|
|
14
|
+
}
|
|
15
|
+
type NodeJsPluginUserConfig = EnvPluginUserConfig;
|
|
16
|
+
type NodeJsPluginResolvedConfig = EnvPluginResolvedConfig;
|
|
17
|
+
type NodeJsPluginContext<TResolvedConfig extends NodeJsPluginResolvedConfig = NodeJsPluginResolvedConfig> = EnvPluginContext<TResolvedConfig>;
|
|
18
|
+
declare type __ΩNodeJsPluginOptions = any[];
|
|
19
|
+
declare type __ΩNodeJsPluginUserConfig = any[];
|
|
20
|
+
declare type __ΩNodeJsPluginResolvedConfig = any[];
|
|
21
|
+
declare type __ΩNodeJsPluginContext = any[];
|
|
22
|
+
//#endregion
|
|
23
|
+
export { __ΩNodeJsPluginContext as a, __ΩNodeJsPluginUserConfig as c, NodeJsPluginUserConfig as i, NodeJsPluginOptions as n, __ΩNodeJsPluginOptions as o, NodeJsPluginResolvedConfig as r, __ΩNodeJsPluginResolvedConfig as s, NodeJsPluginContext as t };
|
|
24
|
+
//# sourceMappingURL=plugin-DIMmxDo0.d.cts.map
|