@powerlines/plugin-nodejs 0.1.384 → 0.1.386

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 +1,29 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
1
+ //#region \0rolldown/runtime.js
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
+
29
+ exports.__toESM = __toESM;
@@ -1,68 +1,180 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@alloy-js/core`),r=require(`@alloy-js/typescript`),i=require(`@powerlines/plugin-alloy/core/components/spacing`),a=require(`@powerlines/plugin-alloy/core/contexts/context`),o=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`),s=require(`@powerlines/plugin-env/components/env-builtin`),c=require(`@stryke/string-format/kebab-case`),l=require(`@stryke/string-format/title-case`),u=require(`defu`);u=e.__toESM(u);function d(e){let[{children:d},f]=(0,n.splitProps)(e,[`children`]),p=(0,a.usePowerlines)();return(0,t.createComponent)(s.EnvBuiltin,(0,t.mergeProps)({defaultConfig:n.code`process.env`},f,{get imports(){return(0,u.default)({"node:os":`os`,"node:path":[`basename`,`join`]},f.imports??{})},get children(){return[(0,t.createComponent)(r.VarDeclaration,{export:!0,const:!0,name:`isWindows`,doc:`An indicator specifying whether the current operating system is MacOS (darwin kernel).`,initializer:n.code`/^win/i.test(process.platform); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(r.VarDeclaration,{export:!0,const:!0,name:`isLinux`,doc:`An indicator specifying whether the current operating system is Linux.`,initializer:n.code`/^linux/i.test(process.platform); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(r.VarDeclaration,{export:!0,const:!0,name:`isMacOS`,doc:`An indicator specifying whether the current operating system is MacOS (darwin kernel).`,initializer:n.code`/^darwin/i.test(process.platform); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(r.VarDeclaration,{const:!0,name:`homedir`,initializer:n.code`os.homedir(); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(r.VarDeclaration,{const:!0,name:`tmpdir`,initializer:n.code`os.tmpdir(); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.TSDoc,{heading:`The environment path types for storing things like data, config, logs, and cache in the current runtime environment.`,get children(){return(0,t.createComponent)(o.TSDocRemarks,{children:`These environment path types are accessed in the {@link EnvPaths} type. `})}}),(0,t.createComponent)(r.TypeDeclaration,{export:!0,name:`EnvPathType`,children:n.code`"data" | "config" | "cache" | "log" | "temp"; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.TSDoc,{heading:`The environment paths for storing things like data, config, logs, and cache in the current runtime environment.`}),(0,t.createComponent)(r.TypeDeclaration,{export:!0,name:`EnvPaths`,children:n.code`Record<EnvPathType, string>; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.TSDoc,{heading:`The resolved application directories based on the current operating system and environment variables.`,get children(){return(0,t.createComponent)(o.TSDocRemarks,{children: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):
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
+ let _alloy_js_core = require("@alloy-js/core");
5
+ let _alloy_js_typescript = require("@alloy-js/typescript");
6
+ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
7
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
8
+ let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
9
+ let _powerlines_plugin_env_components_env_builtin = require("@powerlines/plugin-env/components/env-builtin");
10
+ let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
11
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
12
+ let defu = require("defu");
13
+ defu = require_runtime.__toESM(defu);
14
+
15
+ //#region src/components/env-builtin.tsx
16
+ /**
17
+ * Generates the NodeJs environment configuration module for the Powerlines project.
18
+ */
19
+ function NodeJsEnvBuiltin(props) {
20
+ const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
21
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
22
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_env_components_env_builtin.EnvBuiltin, (0, _alloy_js_core_jsx_runtime.mergeProps)({ defaultConfig: _alloy_js_core.code`process.env` }, rest, {
23
+ get imports() {
24
+ return (0, defu.default)({
25
+ "node:os": "os",
26
+ "node:path": ["basename", "join"]
27
+ }, rest.imports ?? {});
28
+ },
29
+ get children() {
30
+ return [
31
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
32
+ "export": true,
33
+ "const": true,
34
+ name: "isWindows",
35
+ doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
36
+ initializer: _alloy_js_core.code`/^win/i.test(process.platform); `
37
+ }),
38
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
39
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
40
+ "export": true,
41
+ "const": true,
42
+ name: "isLinux",
43
+ doc: "An indicator specifying whether the current operating system is Linux.",
44
+ initializer: _alloy_js_core.code`/^linux/i.test(process.platform); `
45
+ }),
46
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
47
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
48
+ "export": true,
49
+ "const": true,
50
+ name: "isMacOS",
51
+ doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
52
+ initializer: _alloy_js_core.code`/^darwin/i.test(process.platform); `
53
+ }),
54
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
55
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
56
+ "const": true,
57
+ name: "homedir",
58
+ initializer: _alloy_js_core.code`os.homedir(); `
59
+ }),
60
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
61
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
62
+ "const": true,
63
+ name: "tmpdir",
64
+ initializer: _alloy_js_core.code`os.tmpdir(); `
65
+ }),
66
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
67
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
68
+ heading: "The environment path types for storing things like data, config, logs, and cache in the current runtime environment.",
69
+ get children() {
70
+ 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. ` });
71
+ }
72
+ }),
73
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
74
+ "export": true,
75
+ name: "EnvPathType",
76
+ children: _alloy_js_core.code`"data" | "config" | "cache" | "log" | "temp"; `
77
+ }),
78
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
79
+ (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." }),
80
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
81
+ "export": true,
82
+ name: "EnvPaths",
83
+ children: _alloy_js_core.code`Record<EnvPathType, string>; `
84
+ }),
85
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
86
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
87
+ heading: "The resolved application directories based on the current operating system and environment variables.",
88
+ get children() {
89
+ 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):
2
90
  - **Linux**: directories are generally created in \`~/.config/<name>\` (this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/))
3
91
  - **Windows**: directories are generally created in \`%AppData%/<name>\`
4
92
  - **MacOS**: directories are generally created in \`~/Library/Application Support/<name>\`
5
- `})}}),(0,t.createComponent)(r.VarDeclaration,{export:!0,const:!0,name:`paths`,get initializer(){return n.code`isMacOS
93
+ ` });
94
+ }
95
+ }),
96
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
97
+ "export": true,
98
+ "const": true,
99
+ name: "paths",
100
+ get initializer() {
101
+ return _alloy_js_core.code`isMacOS
6
102
  ? {
7
103
  data: env.DATA_DIR
8
- ? join(String(env.DATA_DIR), "${(0,l.titleCase)(p.config.name)}")
9
- : join(homedir, "Library", "Application Support", "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}"),
104
+ ? join(String(env.DATA_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
105
+ : 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)}"),
10
106
  config: env.CONFIG_DIR
11
- ? join(String(env.CONFIG_DIR), "${(0,l.titleCase)(p.config.name)}")
12
- : join(homedir, "Library", "Preferences", "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}"),
107
+ ? join(String(env.CONFIG_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
108
+ : join(homedir, "Library", "Preferences", "${(0, _stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}"),
13
109
  cache: env.CACHE_DIR
14
- ? join(String(env.CACHE_DIR), "${(0,l.titleCase)(p.config.name)}")
15
- : join(homedir, "Library", "Caches", "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}"),
110
+ ? join(String(env.CACHE_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
111
+ : join(homedir, "Library", "Caches", "${(0, _stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}"),
16
112
  log: env.LOG_DIR
17
- ? join(String(env.LOG_DIR), "${(0,l.titleCase)(p.config.name)}")
18
- : join(homedir, "Library", "Logs", "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}"),
113
+ ? join(String(env.LOG_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
114
+ : join(homedir, "Library", "Logs", "${(0, _stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}"),
19
115
  temp: env.TEMP_DIR
20
- ? join(String(env.TEMP_DIR), "${(0,l.titleCase)(p.config.name)}")
21
- : join(tmpdir, "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}")
116
+ ? join(String(env.TEMP_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
117
+ : join(tmpdir, "${(0, _stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
22
118
  }
23
119
  : isWindows
24
120
  ? {
25
121
  data: env.DATA_DIR
26
- ? join(String(env.DATA_DIR), "${(0,l.titleCase)(p.config.name)}")
27
- : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}", "Data"),
122
+ ? join(String(env.DATA_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
123
+ : 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"),
28
124
  config: env.CONFIG_DIR
29
- ? join(env.CONFIG_DIR!, "${(0,l.titleCase)(p.config.name)}")
30
- : join(env.APPDATA || join(homedir, "AppData", "Roaming"), "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}", "Config"),
125
+ ? join(env.CONFIG_DIR!, "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
126
+ : 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"),
31
127
  cache: env.CACHE_DIR
32
- ? join(String(env.CACHE_DIR), "${(0,l.titleCase)(p.config.name)}")
33
- : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "Cache", "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}"),
128
+ ? join(String(env.CACHE_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
129
+ : 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)}"),
34
130
  log: env.LOG_DIR
35
- ? join(String(env.LOG_DIR), "${(0,l.titleCase)(p.config.name)}")
36
- : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}", "Log"),
131
+ ? join(String(env.LOG_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
132
+ : 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"),
37
133
  temp: env.TEMP_DIR
38
- ? join(String(env.TEMP_DIR), "${(0,l.titleCase)(p.config.name)}")
39
- : join(tmpdir, "${(0,l.titleCase)(p.config.organization)}", "${(0,l.titleCase)(p.config.name)}")
134
+ ? join(String(env.TEMP_DIR), "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
135
+ : join(tmpdir, "${(0, _stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, _stryke_string_format_title_case.titleCase)(context.config.name)}")
40
136
  }
41
137
  :
42
138
  {
43
139
  data: env.DATA_DIR
44
- ? join(String(env.DATA_DIR), "${(0,c.kebabCase)(p.config.name)}")
140
+ ? join(String(env.DATA_DIR), "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
45
141
  : join(
46
142
  env.XDG_DATA_HOME || join(homedir, ".local", "share"),
47
- "${(0,c.kebabCase)(p.config.organization)}",
48
- "${(0,c.kebabCase)(p.config.name)}"
143
+ "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.organization)}",
144
+ "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}"
49
145
  ),
50
146
  config: env.CONFIG_DIR
51
- ? join(String(env.CONFIG_DIR), "${(0,c.kebabCase)(p.config.name)}")
147
+ ? join(String(env.CONFIG_DIR), "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
52
148
  : join(
53
149
  env.XDG_CONFIG_HOME || join(homedir, ".config"),
54
- "${(0,c.kebabCase)(p.config.organization)}",
55
- "${(0,c.kebabCase)(p.config.name)}"
150
+ "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.organization)}",
151
+ "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}"
56
152
  ),
57
153
  cache: env.CACHE_DIR
58
- ? join(String(env.CACHE_DIR), "${(0,c.kebabCase)(p.config.name)}")
59
- : join(env.XDG_CACHE_HOME || join(homedir, ".cache"), "${(0,c.kebabCase)(p.config.organization)}", "${(0,c.kebabCase)(p.config.name)}"),
154
+ ? join(String(env.CACHE_DIR), "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
155
+ : 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)}"),
60
156
  log: env.LOG_DIR
61
- ? join(String(env.LOG_DIR), "${(0,c.kebabCase)(p.config.name)}")
62
- : join(env.XDG_STATE_HOME || join(homedir, ".local", "state"), "${(0,c.kebabCase)(p.config.organization)}", "${(0,c.kebabCase)(p.config.name)}"),
157
+ ? join(String(env.LOG_DIR), "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
158
+ : 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)}"),
63
159
  temp: env.TEMP_DIR
64
- ? join(String(env.TEMP_DIR), "${(0,c.kebabCase)(p.config.name)}")
160
+ ? join(String(env.TEMP_DIR), "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
65
161
  : (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR
66
- ? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, "${(0,c.kebabCase)(p.config.organization)}", "${(0,c.kebabCase)(p.config.name)}")
67
- : join(tmpdir, basename(homedir), "${(0,c.kebabCase)(p.config.organization)}", "${(0,c.kebabCase)(p.config.name)}"))
68
- } as EnvPaths; `}}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(n.Show,{get when(){return!!d},children:d})]}}))}exports.NodeJsEnvBuiltin=d;
162
+ ? 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)}")
163
+ : join(tmpdir, basename(homedir), "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.organization)}", "${(0, _stryke_string_format_kebab_case.kebabCase)(context.config.name)}"))
164
+ } as EnvPaths; `;
165
+ }
166
+ }),
167
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
168
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
169
+ get when() {
170
+ return Boolean(children);
171
+ },
172
+ children
173
+ })
174
+ ];
175
+ }
176
+ }));
177
+ }
178
+
179
+ //#endregion
180
+ exports.NodeJsEnvBuiltin = NodeJsEnvBuiltin;
@@ -1,69 +1,178 @@
1
- import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{Show as n,code as r,splitProps as i}from"@alloy-js/core";import{TypeDeclaration as a,VarDeclaration as o}from"@alloy-js/typescript";import{Spacing as s}from"@powerlines/plugin-alloy/core/components/spacing";import{usePowerlines as c}from"@powerlines/plugin-alloy/core/contexts/context";import{TSDoc as l,TSDocRemarks as u}from"@powerlines/plugin-alloy/typescript/components/tsdoc";import{EnvBuiltin as d}from"@powerlines/plugin-env/components/env-builtin";import{kebabCase as f}from"@stryke/string-format/kebab-case";import{titleCase as p}from"@stryke/string-format/title-case";import m from"defu";function h(h){let[{children:g},_]=i(h,[`children`]),v=c();return e(d,t({defaultConfig:r`process.env`},_,{get imports(){return m({"node:os":`os`,"node:path":[`basename`,`join`]},_.imports??{})},get children(){return[e(o,{export:!0,const:!0,name:`isWindows`,doc:`An indicator specifying whether the current operating system is MacOS (darwin kernel).`,initializer:r`/^win/i.test(process.platform); `}),e(s,{}),e(o,{export:!0,const:!0,name:`isLinux`,doc:`An indicator specifying whether the current operating system is Linux.`,initializer:r`/^linux/i.test(process.platform); `}),e(s,{}),e(o,{export:!0,const:!0,name:`isMacOS`,doc:`An indicator specifying whether the current operating system is MacOS (darwin kernel).`,initializer:r`/^darwin/i.test(process.platform); `}),e(s,{}),e(o,{const:!0,name:`homedir`,initializer:r`os.homedir(); `}),e(s,{}),e(o,{const:!0,name:`tmpdir`,initializer:r`os.tmpdir(); `}),e(s,{}),e(l,{heading:`The environment path types for storing things like data, config, logs, and cache in the current runtime environment.`,get children(){return e(u,{children:`These environment path types are accessed in the {@link EnvPaths} type. `})}}),e(a,{export:!0,name:`EnvPathType`,children:r`"data" | "config" | "cache" | "log" | "temp"; `}),e(s,{}),e(l,{heading:`The environment paths for storing things like data, config, logs, and cache in the current runtime environment.`}),e(a,{export:!0,name:`EnvPaths`,children:r`Record<EnvPathType, string>; `}),e(s,{}),e(l,{heading:`The resolved application directories based on the current operating system and environment variables.`,get children(){return e(u,{children:r`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):
1
+ import { createComponent, 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 { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
5
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
+ import { TSDoc, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
7
+ import { EnvBuiltin } from "@powerlines/plugin-env/components/env-builtin";
8
+ import { kebabCase } from "@stryke/string-format/kebab-case";
9
+ import { titleCase } from "@stryke/string-format/title-case";
10
+ import defu from "defu";
11
+
12
+ //#region src/components/env-builtin.tsx
13
+ /**
14
+ * Generates the NodeJs environment configuration module for the Powerlines project.
15
+ */
16
+ function NodeJsEnvBuiltin(props) {
17
+ const [{ children }, rest] = splitProps(props, ["children"]);
18
+ const context = usePowerlines();
19
+ return createComponent(EnvBuiltin, mergeProps({ defaultConfig: code`process.env` }, rest, {
20
+ get imports() {
21
+ return defu({
22
+ "node:os": "os",
23
+ "node:path": ["basename", "join"]
24
+ }, rest.imports ?? {});
25
+ },
26
+ get children() {
27
+ return [
28
+ createComponent(VarDeclaration, {
29
+ "export": true,
30
+ "const": true,
31
+ name: "isWindows",
32
+ doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
33
+ initializer: code`/^win/i.test(process.platform); `
34
+ }),
35
+ createComponent(Spacing, {}),
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
+ createComponent(Spacing, {}),
44
+ createComponent(VarDeclaration, {
45
+ "export": true,
46
+ "const": true,
47
+ name: "isMacOS",
48
+ doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
49
+ initializer: code`/^darwin/i.test(process.platform); `
50
+ }),
51
+ createComponent(Spacing, {}),
52
+ createComponent(VarDeclaration, {
53
+ "const": true,
54
+ name: "homedir",
55
+ initializer: code`os.homedir(); `
56
+ }),
57
+ createComponent(Spacing, {}),
58
+ createComponent(VarDeclaration, {
59
+ "const": true,
60
+ name: "tmpdir",
61
+ initializer: code`os.tmpdir(); `
62
+ }),
63
+ createComponent(Spacing, {}),
64
+ createComponent(TSDoc, {
65
+ heading: "The environment path types for storing things like data, config, logs, and cache in the current runtime environment.",
66
+ get children() {
67
+ return createComponent(TSDocRemarks, { children: `These environment path types are accessed in the {@link EnvPaths} type. ` });
68
+ }
69
+ }),
70
+ createComponent(TypeDeclaration, {
71
+ "export": true,
72
+ name: "EnvPathType",
73
+ children: code`"data" | "config" | "cache" | "log" | "temp"; `
74
+ }),
75
+ createComponent(Spacing, {}),
76
+ createComponent(TSDoc, { heading: "The environment paths for storing things like data, config, logs, and cache in the current runtime environment." }),
77
+ createComponent(TypeDeclaration, {
78
+ "export": true,
79
+ name: "EnvPaths",
80
+ children: code`Record<EnvPathType, string>; `
81
+ }),
82
+ createComponent(Spacing, {}),
83
+ createComponent(TSDoc, {
84
+ heading: "The resolved application directories based on the current operating system and environment variables.",
85
+ get children() {
86
+ 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):
2
87
  - **Linux**: directories are generally created in \`~/.config/<name>\` (this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/))
3
88
  - **Windows**: directories are generally created in \`%AppData%/<name>\`
4
89
  - **MacOS**: directories are generally created in \`~/Library/Application Support/<name>\`
5
- `})}}),e(o,{export:!0,const:!0,name:`paths`,get initializer(){return r`isMacOS
90
+ ` });
91
+ }
92
+ }),
93
+ createComponent(VarDeclaration, {
94
+ "export": true,
95
+ "const": true,
96
+ name: "paths",
97
+ get initializer() {
98
+ return code`isMacOS
6
99
  ? {
7
100
  data: env.DATA_DIR
8
- ? join(String(env.DATA_DIR), "${p(v.config.name)}")
9
- : join(homedir, "Library", "Application Support", "${p(v.config.organization)}", "${p(v.config.name)}"),
101
+ ? join(String(env.DATA_DIR), "${titleCase(context.config.name)}")
102
+ : join(homedir, "Library", "Application Support", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
10
103
  config: env.CONFIG_DIR
11
- ? join(String(env.CONFIG_DIR), "${p(v.config.name)}")
12
- : join(homedir, "Library", "Preferences", "${p(v.config.organization)}", "${p(v.config.name)}"),
104
+ ? join(String(env.CONFIG_DIR), "${titleCase(context.config.name)}")
105
+ : join(homedir, "Library", "Preferences", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
13
106
  cache: env.CACHE_DIR
14
- ? join(String(env.CACHE_DIR), "${p(v.config.name)}")
15
- : join(homedir, "Library", "Caches", "${p(v.config.organization)}", "${p(v.config.name)}"),
107
+ ? join(String(env.CACHE_DIR), "${titleCase(context.config.name)}")
108
+ : join(homedir, "Library", "Caches", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
16
109
  log: env.LOG_DIR
17
- ? join(String(env.LOG_DIR), "${p(v.config.name)}")
18
- : join(homedir, "Library", "Logs", "${p(v.config.organization)}", "${p(v.config.name)}"),
110
+ ? join(String(env.LOG_DIR), "${titleCase(context.config.name)}")
111
+ : join(homedir, "Library", "Logs", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
19
112
  temp: env.TEMP_DIR
20
- ? join(String(env.TEMP_DIR), "${p(v.config.name)}")
21
- : join(tmpdir, "${p(v.config.organization)}", "${p(v.config.name)}")
113
+ ? join(String(env.TEMP_DIR), "${titleCase(context.config.name)}")
114
+ : join(tmpdir, "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}")
22
115
  }
23
116
  : isWindows
24
117
  ? {
25
118
  data: env.DATA_DIR
26
- ? join(String(env.DATA_DIR), "${p(v.config.name)}")
27
- : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${p(v.config.organization)}", "${p(v.config.name)}", "Data"),
119
+ ? join(String(env.DATA_DIR), "${titleCase(context.config.name)}")
120
+ : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Data"),
28
121
  config: env.CONFIG_DIR
29
- ? join(env.CONFIG_DIR!, "${p(v.config.name)}")
30
- : join(env.APPDATA || join(homedir, "AppData", "Roaming"), "${p(v.config.organization)}", "${p(v.config.name)}", "Config"),
122
+ ? join(env.CONFIG_DIR!, "${titleCase(context.config.name)}")
123
+ : join(env.APPDATA || join(homedir, "AppData", "Roaming"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Config"),
31
124
  cache: env.CACHE_DIR
32
- ? join(String(env.CACHE_DIR), "${p(v.config.name)}")
33
- : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "Cache", "${p(v.config.organization)}", "${p(v.config.name)}"),
125
+ ? join(String(env.CACHE_DIR), "${titleCase(context.config.name)}")
126
+ : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "Cache", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
34
127
  log: env.LOG_DIR
35
- ? join(String(env.LOG_DIR), "${p(v.config.name)}")
36
- : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${p(v.config.organization)}", "${p(v.config.name)}", "Log"),
128
+ ? join(String(env.LOG_DIR), "${titleCase(context.config.name)}")
129
+ : join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Log"),
37
130
  temp: env.TEMP_DIR
38
- ? join(String(env.TEMP_DIR), "${p(v.config.name)}")
39
- : join(tmpdir, "${p(v.config.organization)}", "${p(v.config.name)}")
131
+ ? join(String(env.TEMP_DIR), "${titleCase(context.config.name)}")
132
+ : join(tmpdir, "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}")
40
133
  }
41
134
  :
42
135
  {
43
136
  data: env.DATA_DIR
44
- ? join(String(env.DATA_DIR), "${f(v.config.name)}")
137
+ ? join(String(env.DATA_DIR), "${kebabCase(context.config.name)}")
45
138
  : join(
46
139
  env.XDG_DATA_HOME || join(homedir, ".local", "share"),
47
- "${f(v.config.organization)}",
48
- "${f(v.config.name)}"
140
+ "${kebabCase(context.config.organization)}",
141
+ "${kebabCase(context.config.name)}"
49
142
  ),
50
143
  config: env.CONFIG_DIR
51
- ? join(String(env.CONFIG_DIR), "${f(v.config.name)}")
144
+ ? join(String(env.CONFIG_DIR), "${kebabCase(context.config.name)}")
52
145
  : join(
53
146
  env.XDG_CONFIG_HOME || join(homedir, ".config"),
54
- "${f(v.config.organization)}",
55
- "${f(v.config.name)}"
147
+ "${kebabCase(context.config.organization)}",
148
+ "${kebabCase(context.config.name)}"
56
149
  ),
57
150
  cache: env.CACHE_DIR
58
- ? join(String(env.CACHE_DIR), "${f(v.config.name)}")
59
- : join(env.XDG_CACHE_HOME || join(homedir, ".cache"), "${f(v.config.organization)}", "${f(v.config.name)}"),
151
+ ? join(String(env.CACHE_DIR), "${kebabCase(context.config.name)}")
152
+ : join(env.XDG_CACHE_HOME || join(homedir, ".cache"), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"),
60
153
  log: env.LOG_DIR
61
- ? join(String(env.LOG_DIR), "${f(v.config.name)}")
62
- : join(env.XDG_STATE_HOME || join(homedir, ".local", "state"), "${f(v.config.organization)}", "${f(v.config.name)}"),
154
+ ? join(String(env.LOG_DIR), "${kebabCase(context.config.name)}")
155
+ : join(env.XDG_STATE_HOME || join(homedir, ".local", "state"), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"),
63
156
  temp: env.TEMP_DIR
64
- ? join(String(env.TEMP_DIR), "${f(v.config.name)}")
157
+ ? join(String(env.TEMP_DIR), "${kebabCase(context.config.name)}")
65
158
  : (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR
66
- ? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, "${f(v.config.organization)}", "${f(v.config.name)}")
67
- : join(tmpdir, basename(homedir), "${f(v.config.organization)}", "${f(v.config.name)}"))
68
- } as EnvPaths; `}}),e(s,{}),e(n,{get when(){return!!g},children:g})]}}))}export{h as NodeJsEnvBuiltin};
159
+ ? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}")
160
+ : join(tmpdir, basename(homedir), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"))
161
+ } as EnvPaths; `;
162
+ }
163
+ }),
164
+ createComponent(Spacing, {}),
165
+ createComponent(Show, {
166
+ get when() {
167
+ return Boolean(children);
168
+ },
169
+ children
170
+ })
171
+ ];
172
+ }
173
+ }));
174
+ }
175
+
176
+ //#endregion
177
+ export { NodeJsEnvBuiltin };
69
178
  //# sourceMappingURL=env-builtin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.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 { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\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-builtin\";\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 defaultConfig={code`process.env`}\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 <Spacing />\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 <Spacing />\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 <Spacing />\n <VarDeclaration const name=\"homedir\" initializer={code`os.homedir(); `} />\n <Spacing />\n <VarDeclaration const name=\"tmpdir\" initializer={code`os.tmpdir(); `} />\n <Spacing />\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 <Spacing />\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 <Spacing />\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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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 <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </EnvBuiltin>\n );\n}\n"],"mappings":"0qBAiC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,EAAS,EAAA,OAAA,aAAA,CAAA,MAAA,EAAA,EAAA,OAAA,KAAA,CAAA;;;;;gDAK7B,EAAA,EAAA,OAAA,KAAA,CAAA;;;uBAGS,EAAI,EAAc,OAAO,aAAU,CAAA;uBACxC,EAAe,EAAA,OAAA,KAAA,CAAA;;;kDAGU,EAAiB,EAAQ,OAAO,KAAA,CAAA;;;uBAGrD,EAAQ,EAAA,OAAA,aAAA,CAAA;uBACT,EAAI,EAAA,OAAA,KAAA,CAAA;;;iDAGQ,EAAA,EAAA,OAAA,KAAA,CAAA;yEACb,EAAA,EAAA,OAAA,aAAA,CAAA,MAAA,EAAA,EAAA,OAAA,KAAA,CAAA;;+CAE2B,EAAU,EAAQ,OAAO,KAAK,CAAC;kFACG,EAAU,EAAQ,OAAO,aAAc,CAAC,MAAK,EAAS,EAAA,OAAA,KAAA,CAAA;;gDAE5G,EAAA,EAAA,OAAA,KAAA,CAAA;;4EAE8C,EAAO,EAAA,OAAA,aAAA,CAAA,MAAA,EAAA,EAAA,OAAA,KAAA,CAAA;yDAC5B,EAAO,EAAgB,OAAI,aAAU,CAAO,MAAC,EAAc,EAAA,OAAA,KAAA,CAAA;4BAGxG,CAAC,CAAE,EAAE,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACJ,IAAI,MAAO,CACT,MAAO,EAAM,GAEL,WACX,CAAC,CAAC,EAEN,CAAC,CAAC"}
1
+ {"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.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 { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\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-builtin\";\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 defaultConfig={code`process.env`}\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 <Spacing />\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 <Spacing />\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 <Spacing />\n <VarDeclaration const name=\"homedir\" initializer={code`os.homedir(); `} />\n <Spacing />\n <VarDeclaration const name=\"tmpdir\" initializer={code`os.tmpdir(); `} />\n <Spacing />\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 <Spacing />\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 <Spacing />\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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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 <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </EnvBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAS,iBAAsB,OAAS;UAEtC,YACC,QAAU,WAAW,OAAA,CAAA,WAAY,CAAA;CAClC,MAAA,UAAA,eAAA;AACF,QAAO,gBAAS,YAAuB,WAAC,EACtC,eAAiB,IAAI;EAErB,IAAM,UAAU;;IAEV,WAAC;IACJ,aAAA,CAAA,YAAA,OAAA;IACC,EAAA,KAAA,WAAmB,EAAC,CAAA;;EAEtB,IAAE,WAAa;AACb,UAAE;IAAA,gBAAA,gBAAA;KACA,UAAU;KACV,SAAQ;KACR,MAAC;KACD,KAAK;KACL,aAAA,IAAA;KACD,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,UAAA;KACA,SAA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CAE2B,UAAU,QAAQ,OAAO,KAAK,CAAC;kFACG,UAAU,QAAQ,OAAO,aAAc,CAAC,MAAK,UAAS,QAAA,OAAA,KAAA,CAAA;;gDAE5G,UAAA,QAAA,OAAA,KAAA,CAAA;;4EAE8C,UAAO,QAAA,OAAA,aAAA,CAAA,MAAA,UAAA,QAAA,OAAA,KAAA,CAAA;yDAC5B,UAAO,QAAgB,OAAI,aAAU,CAAO,MAAC,UAAc,QAAA,OAAA,KAAA,CAAA;;;KAGxG,CAAC;IAAE,gBAAE,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KACJ,IAAI,OAAO;AACT,aAAO,QAAM,SAAW;;KAEhB;KACX,CAAC;IAAC;;EAEN,CAAC,CAAC"}
@@ -1 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./env-builtin.cjs`);exports.NodeJsEnvBuiltin=e.NodeJsEnvBuiltin;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_components_env_builtin = require('./env-builtin.cjs');
3
+
4
+ exports.NodeJsEnvBuiltin = require_components_env_builtin.NodeJsEnvBuiltin;
@@ -1 +1,3 @@
1
- import{NodeJsEnvBuiltin as e}from"./env-builtin.mjs";export{e as NodeJsEnvBuiltin};
1
+ import { NodeJsEnvBuiltin } from "./env-builtin.mjs";
2
+
3
+ export { NodeJsEnvBuiltin };
package/dist/index.cjs CHANGED
@@ -1 +1,45 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./components/env-builtin.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@powerlines/plugin-alloy/render`),i=require(`@powerlines/plugin-babel`);i=e.__toESM(i);let a=require(`@powerlines/plugin-env`);a=e.__toESM(a);let o=require(`@powerlines/plugin-env/helpers/persistence`),s=require(`powerlines/typescript`);const c=(e={})=>[(0,i.default)(e.babel),(0,a.default)(e.env),{name:`nodejs`,configResolved(){this.devDependencies[`@types/node`]=`^22.14.6`,this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.types??=[],(0,s.isMatchFound)(`node`,this.tsconfig.tsconfigJson.compilerOptions.types)||this.tsconfig.tsconfigJson.compilerOptions.types.push(`node`)},async prepare(){let e=this,i=await(0,o.readEnvTypeReflection)(this,`env`);return(0,r.render)(this,(0,n.createComponent)(t.NodeJsEnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig},reflection:i}))}}];exports.default=c,exports.plugin=c;
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_components_env_builtin = require('./components/env-builtin.cjs');
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
6
+ let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
7
+ _powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
8
+ let _powerlines_plugin_env = require("@powerlines/plugin-env");
9
+ _powerlines_plugin_env = require_runtime.__toESM(_powerlines_plugin_env);
10
+ let _powerlines_plugin_env_helpers_persistence = require("@powerlines/plugin-env/helpers/persistence");
11
+ let powerlines_typescript = require("powerlines/typescript");
12
+
13
+ //#region src/index.tsx
14
+ /**
15
+ * A package containing a Powerlines plugin for building a NodeJs application.
16
+ */
17
+ const plugin = (options = {}) => {
18
+ return [
19
+ (0, _powerlines_plugin_babel.default)(options.babel),
20
+ (0, _powerlines_plugin_env.default)(options.env),
21
+ {
22
+ name: "nodejs",
23
+ configResolved() {
24
+ this.devDependencies["@types/node"] = "^22.14.6";
25
+ this.tsconfig.tsconfigJson.compilerOptions ??= {};
26
+ this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
27
+ if (!(0, powerlines_typescript.isMatchFound)("node", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("node");
28
+ },
29
+ async prepare() {
30
+ const _self$ = this;
31
+ const result = await (0, _powerlines_plugin_env_helpers_persistence.readEnvTypeReflection)(this, "env");
32
+ return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_env_builtin.NodeJsEnvBuiltin, {
33
+ get defaultConfig() {
34
+ return _self$.config.env.defaultConfig;
35
+ },
36
+ reflection: result
37
+ }));
38
+ }
39
+ }
40
+ ];
41
+ };
42
+
43
+ //#endregion
44
+ exports.default = plugin;
45
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1,2 +1,41 @@
1
- import{NodeJsEnvBuiltin as e}from"./components/env-builtin.mjs";import{createComponent as t}from"@alloy-js/core/jsx-runtime";import{render as n}from"@powerlines/plugin-alloy/render";import r from"@powerlines/plugin-babel";import i from"@powerlines/plugin-env";import{readEnvTypeReflection as a}from"@powerlines/plugin-env/helpers/persistence";import{isMatchFound as o}from"powerlines/typescript";const s=(s={})=>[r(s.babel),i(s.env),{name:`nodejs`,configResolved(){this.devDependencies[`@types/node`]=`^22.14.6`,this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.types??=[],o(`node`,this.tsconfig.tsconfigJson.compilerOptions.types)||this.tsconfig.tsconfigJson.compilerOptions.types.push(`node`)},async prepare(){let r=this,i=await a(this,`env`);return n(this,t(e,{get defaultConfig(){return r.config.env.defaultConfig},reflection:i}))}}];export{s as default,s as plugin};
1
+ import { NodeJsEnvBuiltin } from "./components/env-builtin.mjs";
2
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
3
+ import { render } from "@powerlines/plugin-alloy/render";
4
+ import babel from "@powerlines/plugin-babel";
5
+ import env from "@powerlines/plugin-env";
6
+ import { readEnvTypeReflection } from "@powerlines/plugin-env/helpers/persistence";
7
+ import { isMatchFound } from "powerlines/typescript";
8
+
9
+ //#region src/index.tsx
10
+ /**
11
+ * A package containing a Powerlines plugin for building a NodeJs application.
12
+ */
13
+ const plugin = (options = {}) => {
14
+ return [
15
+ babel(options.babel),
16
+ env(options.env),
17
+ {
18
+ name: "nodejs",
19
+ configResolved() {
20
+ this.devDependencies["@types/node"] = "^22.14.6";
21
+ this.tsconfig.tsconfigJson.compilerOptions ??= {};
22
+ this.tsconfig.tsconfigJson.compilerOptions.types ??= [];
23
+ if (!isMatchFound("node", this.tsconfig.tsconfigJson.compilerOptions.types)) this.tsconfig.tsconfigJson.compilerOptions.types.push("node");
24
+ },
25
+ async prepare() {
26
+ const _self$ = this;
27
+ const result = await readEnvTypeReflection(this, "env");
28
+ return render(this, createComponent(NodeJsEnvBuiltin, {
29
+ get defaultConfig() {
30
+ return _self$.config.env.defaultConfig;
31
+ },
32
+ reflection: result
33
+ }));
34
+ }
35
+ }
36
+ ];
37
+ };
38
+
39
+ //#endregion
40
+ export { plugin as default, plugin };
2
41
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport babel from \"@powerlines/plugin-babel\";\nimport env from \"@powerlines/plugin-env\";\nimport { readEnvTypeReflection } from \"@powerlines/plugin-env/helpers/persistence\";\nimport { Plugin } from \"powerlines\";\nimport { isMatchFound } from \"powerlines/typescript\";\nimport { NodeJsEnvBuiltin } from \"./components/env-builtin\";\nimport { NodeJsPluginContext, NodeJsPluginOptions } from \"./types/plugin\";\n\ndeclare module \"powerlines\" {\n interface Config {\n nodejs?: NodeJsPluginOptions;\n }\n}\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): Plugin<TContext>[] => {\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 const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <NodeJsEnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"4YA8BA,MAAE,GAAA,EAAA,EAAA,GACF,CAAA,EAAA,EAAA,MAAA,CAAA,EAAA,EAAA,IAAA,CAAA,eAEE,gBAAA,CACG,KAAA,gBAAqB,eAAkB,WAC1C,KAAA,SAAA,aAAA,kBAAA,EAAA,CACI,KAAC,SAAa,aAAE,gBAAA,QAAA,EAAA,CACX,EAAQ,OAAA,KAAA,SAAsB,aAAA,gBAAA,MAAA,EACxC,KAAA,SAAA,aAAA,gBAAA,MAAA,KAAA,OAAA,EAGC,MAAO,SAAA,CACL,IAAM,EAAQ,KACV,EAAY,MAAA,EAAA,KAAA,MAAA,CAChB,OAAA,EAAA,KAAA,EAAA,EAAA,CACE,IAAM,eAAQ,CACd,OAAA,EAAiB,OAAA,IAAA,4BAGhB,CAAC,CAAA,EAEL,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport babel from \"@powerlines/plugin-babel\";\nimport env from \"@powerlines/plugin-env\";\nimport { readEnvTypeReflection } from \"@powerlines/plugin-env/helpers/persistence\";\nimport { Plugin } from \"powerlines\";\nimport { isMatchFound } from \"powerlines/typescript\";\nimport { NodeJsEnvBuiltin } from \"./components/env-builtin\";\nimport { NodeJsPluginContext, NodeJsPluginOptions } from \"./types/plugin\";\n\ndeclare module \"powerlines\" {\n interface Config {\n nodejs?: NodeJsPluginOptions;\n }\n}\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): Plugin<TContext>[] => {\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 const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <NodeJsEnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AA8BA,MAAE,UAAA,UAAA,EAAA,KAAA;AACF,QAAA;EAAA,MAAA,QAAA,MAAA;EAAA,IAAA,QAAA,IAAA;EAAA;;GAEE,iBAAA;AACG,SAAA,gBAAqB,iBAAkB;AAC1C,SAAA,SAAA,aAAA,oBAAA,EAAA;AACI,SAAC,SAAa,aAAE,gBAAA,UAAA,EAAA;AACpB,QAAQ,CAAC,aAAQ,QAAA,KAAA,SAAsB,aAAA,gBAAA,MAAA,CACxC,MAAA,SAAA,aAAA,gBAAA,MAAA,KAAA,OAAA;;GAGC,MAAO,UAAA;IACL,MAAM,SAAQ;IACd,MAAI,SAAY,MAAA,sBAAA,MAAA,MAAA;AAChB,WAAA,OAAA,MAAA,gBAAA,kBAAA;KACE,IAAM,gBAAQ;AACd,aAAA,OAAiB,OAAA,IAAA;;;KAGhB,CAAC,CAAA;;GAEL;EAAC"}
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-nodejs",
3
- "version": "0.1.384",
3
+ "version": "0.1.386",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for building a Node.js application.",
6
6
  "repository": {
@@ -119,17 +119,17 @@
119
119
  "dependencies": {
120
120
  "@alloy-js/core": "0.23.0-dev.8",
121
121
  "@alloy-js/typescript": "0.23.0-dev.4",
122
- "@powerlines/plugin-alloy": "^0.26.76",
123
- "@powerlines/plugin-babel": "^0.12.450",
124
- "@powerlines/plugin-env": "^0.16.183",
125
- "@powerlines/plugin-plugin": "^0.12.408",
122
+ "@powerlines/plugin-alloy": "^0.26.78",
123
+ "@powerlines/plugin-babel": "^0.12.452",
124
+ "@powerlines/plugin-env": "^0.16.185",
125
+ "@powerlines/plugin-plugin": "^0.12.410",
126
126
  "@storm-software/config-tools": "^1.190.1",
127
127
  "@stryke/string-format": "^0.17.13",
128
128
  "defu": "^6.1.7",
129
- "powerlines": "^0.46.4"
129
+ "powerlines": "^0.46.6"
130
130
  },
131
131
  "devDependencies": { "@types/node": "^25.6.0" },
132
132
  "publishConfig": { "access": "public" },
133
133
  "types": "./dist/index.d.cts",
134
- "gitHead": "2e5eff0d36cb4a1a54242017a16c5af5d9ce2cc3"
134
+ "gitHead": "610c4c943933458c5f433b9002d8c187625b2d3f"
135
135
  }