@powerlines/plugin-nodejs 0.1.0 → 0.1.1
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/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/components/env.cjs +188 -2
- package/dist/components/env.d.cts +9 -2
- package/dist/components/env.d.mts +9 -2
- package/dist/components/env.mjs +185 -1
- package/dist/components/index.cjs +2 -3
- package/dist/components/index.d.cts +1 -3
- package/dist/components/index.d.mts +1 -3
- package/dist/components/index.mjs +1 -2
- package/dist/deepkit/schemas/reflection.cjs +3940 -0
- package/dist/{plugin-D7kBf19k.d.cts → deepkit/schemas/reflection.d.cts} +1 -1078
- package/dist/{plugin-JL1BtFku.d.mts → deepkit/schemas/reflection.d.mts} +59 -1136
- package/dist/deepkit/schemas/reflection.mjs +3938 -0
- package/dist/deepkit/schemas/reflection2.cjs +4112 -0
- package/dist/deepkit/schemas/reflection2.mjs +4110 -0
- package/dist/deepkit/src/capnp.cjs +913 -0
- package/dist/deepkit/src/capnp.mjs +911 -0
- package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
- package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
- package/dist/deepkit/src/reflect-type.cjs +22 -0
- package/dist/deepkit/src/reflect-type.mjs +20 -0
- package/dist/deepkit/src/resolve-reflections.cjs +16 -0
- package/dist/deepkit/src/resolve-reflections.mjs +15 -0
- package/dist/deepkit/src/transformer.cjs +52 -0
- package/dist/deepkit/src/transformer.mjs +49 -0
- package/dist/deepkit/src/transpile.cjs +29 -0
- package/dist/deepkit/src/transpile.mjs +27 -0
- package/dist/deepkit/src/types.d.cts +10 -0
- package/dist/deepkit/src/types.d.mts +10 -0
- package/dist/deepkit/src/utilities.cjs +66 -0
- package/dist/deepkit/src/utilities.mjs +65 -0
- package/dist/index.cjs +14 -813
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +11 -803
- package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
- package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
- package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +60 -0
- package/dist/plugin-alloy/src/core/contexts/context.mjs +54 -0
- package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
- package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
- package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
- package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
- package/dist/plugin-alloy/src/index.cjs +93 -0
- package/dist/plugin-alloy/src/index.mjs +91 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +7 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +9 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +5 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +7 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +17 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
- package/dist/plugin-alloy/src/types/components.d.cts +22 -0
- package/dist/plugin-alloy/src/types/components.d.mts +24 -0
- package/dist/plugin-alloy/src/types/index.d.mts +2 -0
- package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
- package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +1 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +4 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
- package/dist/plugin-automd/src/index.cjs +101 -0
- package/dist/plugin-automd/src/index.mjs +98 -0
- package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
- package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
- package/dist/plugin-automd/src/types/toc.d.cts +33 -0
- package/dist/plugin-automd/src/types/toc.d.mts +33 -0
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
- package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
- package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
- package/dist/plugin-babel/src/helpers/index.cjs +5 -0
- package/dist/plugin-babel/src/helpers/index.mjs +7 -0
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
- package/dist/plugin-babel/src/helpers/options.cjs +50 -0
- package/dist/plugin-babel/src/helpers/options.mjs +47 -0
- package/dist/plugin-babel/src/index.cjs +91 -0
- package/dist/plugin-babel/src/index.mjs +89 -0
- package/dist/plugin-babel/src/types/index.d.mts +1 -0
- package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
- package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
- package/dist/plugin-env/src/babel/index.cjs +1 -0
- package/dist/plugin-env/src/babel/index.mjs +3 -0
- package/dist/plugin-env/src/babel/plugin.cjs +121 -0
- package/dist/plugin-env/src/babel/plugin.mjs +119 -0
- package/dist/plugin-env/src/components/docs.cjs +9 -0
- package/dist/plugin-env/src/components/docs.mjs +11 -0
- package/dist/plugin-env/src/components/env.cjs +575 -0
- package/dist/plugin-env/src/components/env.d.cts +11 -0
- package/dist/plugin-env/src/components/env.d.mts +11 -0
- package/dist/plugin-env/src/components/env.mjs +572 -0
- package/dist/plugin-env/src/components/index.cjs +2 -0
- package/dist/plugin-env/src/components/index.mjs +4 -0
- package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
- package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
- package/dist/plugin-env/src/helpers/index.cjs +6 -0
- package/dist/plugin-env/src/helpers/index.mjs +8 -0
- package/dist/plugin-env/src/helpers/load.cjs +83 -0
- package/dist/plugin-env/src/helpers/load.mjs +80 -0
- package/dist/plugin-env/src/helpers/persistence.cjs +199 -0
- package/dist/plugin-env/src/helpers/persistence.mjs +188 -0
- package/dist/plugin-env/src/helpers/reflect.cjs +111 -0
- package/dist/plugin-env/src/helpers/reflect.mjs +103 -0
- package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
- package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
- package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
- package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
- package/dist/plugin-env/src/index.cjs +175 -0
- package/dist/plugin-env/src/index.mjs +173 -0
- package/dist/plugin-env/src/types/plugin.d.cts +151 -0
- package/dist/plugin-env/src/types/plugin.d.mts +153 -0
- package/dist/plugin-env/src/types/runtime.d.cts +792 -0
- package/dist/plugin-env/src/types/runtime.d.mts +792 -0
- package/dist/powerlines/src/lib/build/esbuild.cjs +102 -0
- package/dist/powerlines/src/lib/build/esbuild.mjs +100 -0
- package/dist/powerlines/src/lib/entry.cjs +12 -0
- package/dist/powerlines/src/lib/entry.mjs +14 -0
- package/dist/powerlines/src/lib/logger.cjs +41 -0
- package/dist/powerlines/src/lib/logger.mjs +39 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +38 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +35 -0
- package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -0
- package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -0
- package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -0
- package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
- package/dist/powerlines/src/types/babel.d.cts +22 -0
- package/dist/powerlines/src/types/babel.d.mts +22 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +145 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/config.d.cts +387 -0
- package/dist/powerlines/src/types/config.d.mts +388 -0
- package/dist/powerlines/src/types/context.d.cts +414 -0
- package/dist/powerlines/src/types/context.d.mts +416 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +82 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +1 -3
- package/dist/types/index.d.mts +1 -3
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +22 -2
- package/dist/types/plugin.d.mts +22 -2
- package/dist/types/plugin.mjs +0 -2
- package/package.json +6 -6
- package/dist/components-BWLXb7a2.cjs +0 -0
- package/dist/components-CXZYcH4q.d.mts +0 -1816
- package/dist/components-kh0CpIG2.mjs +0 -1
- package/dist/env-CAhIy_H3.cjs +0 -11713
- package/dist/env-CUyFiniR.d.cts +0 -107
- package/dist/env-IF4XhMjG.mjs +0 -11570
- package/dist/env-sRb-Y8mJ.d.mts +0 -89
- package/dist/index-CUbWeWHc.d.mts +0 -1
- package/dist/index-D6CnpA_r.d.cts +0 -1
- package/dist/index-DL0uimUT.d.mts +0 -1
- package/dist/index-DWPDThxu.d.cts +0 -1
- package/dist/plugin-ifZVa20V.mjs +0 -1
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/resolved-zsx09G03.d.cts +0 -1795
- package/dist/types-U3zd8PTP.mjs +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/components/env.cjs
CHANGED
|
@@ -1,3 +1,189 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_context = require('../plugin-alloy/src/core/contexts/context.cjs');
|
|
3
|
+
const require_tsdoc = require('../plugin-alloy/src/typescript/components/tsdoc.cjs');
|
|
4
|
+
const require_env = require('../plugin-env/src/components/env.cjs');
|
|
5
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let defu = require("defu");
|
|
7
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
8
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
9
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
11
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
2
12
|
|
|
3
|
-
|
|
13
|
+
//#region src/components/env.tsx
|
|
14
|
+
/**
|
|
15
|
+
* Generates the NodeJs environment configuration module for the Powerlines project.
|
|
16
|
+
*/
|
|
17
|
+
function NodeJsEnvBuiltin(props) {
|
|
18
|
+
const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
|
|
19
|
+
const context = require_context.usePowerlines();
|
|
20
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_env.EnvBuiltin, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
21
|
+
get imports() {
|
|
22
|
+
return (0, defu.default)({
|
|
23
|
+
"node:os": ["homedir", "tmpdir"],
|
|
24
|
+
"node:path": ["basename", "join"]
|
|
25
|
+
}, rest.imports ?? {});
|
|
26
|
+
},
|
|
27
|
+
get children() {
|
|
28
|
+
return [
|
|
29
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
30
|
+
"export": true,
|
|
31
|
+
"const": true,
|
|
32
|
+
name: "isWindows",
|
|
33
|
+
doc: "An indicator specifying whether the current operating system is MacOS (darwin kernel).",
|
|
34
|
+
initializer: __alloy_js_core.code`/^win/i.test(process.platform); `
|
|
35
|
+
}),
|
|
36
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
37
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
38
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
39
|
+
"export": true,
|
|
40
|
+
"const": true,
|
|
41
|
+
name: "isLinux",
|
|
42
|
+
doc: "An indicator specifying whether the current operating system is Linux.",
|
|
43
|
+
initializer: __alloy_js_core.code`/^linux/i.test(process.platform); `
|
|
44
|
+
}),
|
|
45
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
46
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
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.createIntrinsic)("hbr", {}),
|
|
55
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
56
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
57
|
+
"const": true,
|
|
58
|
+
name: "homedir",
|
|
59
|
+
initializer: __alloy_js_core.code`homedir(); `
|
|
60
|
+
}),
|
|
61
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
62
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
63
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
64
|
+
"const": true,
|
|
65
|
+
name: "tmpdir",
|
|
66
|
+
initializer: __alloy_js_core.code`tmpdir(); `
|
|
67
|
+
}),
|
|
68
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
69
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
70
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
|
|
71
|
+
heading: "The environment path types for storing things like data, config, logs, and cache in the current runtime environment.",
|
|
72
|
+
get children() {
|
|
73
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `These environment path types are accessed in the {@link EnvPaths} type. ` });
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeDeclaration, {
|
|
77
|
+
"export": true,
|
|
78
|
+
name: "EnvPathType",
|
|
79
|
+
children: __alloy_js_core.code`"data" | "config" | "cache" | "log" | "temp"; `
|
|
80
|
+
}),
|
|
81
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
82
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
83
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, { heading: "The environment paths for storing things like data, config, logs, and cache in the current runtime environment." }),
|
|
84
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeDeclaration, {
|
|
85
|
+
"export": true,
|
|
86
|
+
name: "EnvPaths",
|
|
87
|
+
children: __alloy_js_core.code`Record<EnvPathType, string>; `
|
|
88
|
+
}),
|
|
89
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
90
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
91
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
|
|
92
|
+
heading: "The resolved application directories based on the current operating system and environment variables.",
|
|
93
|
+
get children() {
|
|
94
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `These paths are determined based on the conventions for each operating system, with overrides available through specific environment variables:
|
|
95
|
+
- On macOS, directories are generally created in \`~/Library/Application Support/<name>\`.
|
|
96
|
+
- On Windows, directories are generally created in \`%AppData%/<name>\`.
|
|
97
|
+
- On Linux, directories are generally created in \`~/.config/<name>\` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).
|
|
98
|
+
|
|
99
|
+
If the \`DATA_DIR\`, \`CONFIG_DIR\`, \`CACHE_DIR\`, \`LOG_DIR\`, or \`TEMP_DIR\` environment variables are set, they will be used instead of the default paths.
|
|
100
|
+
` });
|
|
101
|
+
}
|
|
102
|
+
}),
|
|
103
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
104
|
+
"export": true,
|
|
105
|
+
"const": true,
|
|
106
|
+
name: "paths",
|
|
107
|
+
type: "EnvPaths",
|
|
108
|
+
get initializer() {
|
|
109
|
+
return __alloy_js_core.code`isMacOS
|
|
110
|
+
? {
|
|
111
|
+
data: String(env.DATA_DIR)
|
|
112
|
+
? join(String(env.DATA_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
113
|
+
: 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)}"),
|
|
114
|
+
config: String(env.CONFIG_DIR)
|
|
115
|
+
? join(String(env.CONFIG_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
116
|
+
: join(homedir, "Library", "Preferences", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
117
|
+
cache: String(env.CACHE_DIR)
|
|
118
|
+
? join(String(env.CACHE_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
119
|
+
: join(homedir, "Library", "Caches", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
120
|
+
log: String(env.LOG_DIR)
|
|
121
|
+
? join(String(env.LOG_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
122
|
+
: join(homedir, "Library", "Logs", "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}"),
|
|
123
|
+
temp: String(env.TEMP_DIR)
|
|
124
|
+
? join(String(env.TEMP_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
125
|
+
: join(tmpdir, "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
126
|
+
}
|
|
127
|
+
: isWindows
|
|
128
|
+
? {
|
|
129
|
+
data: String(env.DATA_DIR)
|
|
130
|
+
? join(String(env.DATA_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
131
|
+
: 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"),
|
|
132
|
+
config: String(env.CONFIG_DIR)
|
|
133
|
+
? join(env.CONFIG_DIR!, "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
134
|
+
: 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"),
|
|
135
|
+
cache: String(env.CACHE_DIR)
|
|
136
|
+
? join(String(env.CACHE_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
137
|
+
: 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)}"),
|
|
138
|
+
log: String(env.LOG_DIR)
|
|
139
|
+
? join(String(env.LOG_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
140
|
+
: 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"),
|
|
141
|
+
temp: String(env.TEMP_DIR)
|
|
142
|
+
? join(String(env.TEMP_DIR), "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
143
|
+
: join(tmpdir, "${(0, __stryke_string_format_title_case.titleCase)(context.config.organization)}", "${(0, __stryke_string_format_title_case.titleCase)(context.config.name)}")
|
|
144
|
+
}
|
|
145
|
+
:
|
|
146
|
+
{
|
|
147
|
+
data: String(env.DATA_DIR)
|
|
148
|
+
? join(String(env.DATA_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
149
|
+
: join(
|
|
150
|
+
env.XDG_DATA_HOME || join(homedir, ".local", "share"),
|
|
151
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}",
|
|
152
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"
|
|
153
|
+
),
|
|
154
|
+
config: String(env.CONFIG_DIR)
|
|
155
|
+
? join(String(env.CONFIG_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
156
|
+
: join(
|
|
157
|
+
env.XDG_CONFIG_HOME || join(homedir, ".config"),
|
|
158
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}",
|
|
159
|
+
"${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"
|
|
160
|
+
),
|
|
161
|
+
cache: String(env.CACHE_DIR)
|
|
162
|
+
? join(String(env.CACHE_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
163
|
+
: 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)}"),
|
|
164
|
+
log: String(env.LOG_DIR)
|
|
165
|
+
? join(String(env.LOG_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
166
|
+
: 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)}"),
|
|
167
|
+
temp: String(env.TEMP_DIR)
|
|
168
|
+
? join(String(env.TEMP_DIR), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}")
|
|
169
|
+
: (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR
|
|
170
|
+
? 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)}")
|
|
171
|
+
: join(tmpdir, basename(homedir), "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.organization)}", "${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}"))
|
|
172
|
+
} as StormEnvPaths; `;
|
|
173
|
+
}
|
|
174
|
+
}),
|
|
175
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
176
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
177
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
178
|
+
get when() {
|
|
179
|
+
return Boolean(children);
|
|
180
|
+
},
|
|
181
|
+
children
|
|
182
|
+
})
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
exports.NodeJsEnvBuiltin = NodeJsEnvBuiltin;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import
|
|
1
|
+
import { EnvBuiltinProps } from "../plugin-env/src/components/env.cjs";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
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
|
|
3
10
|
export { NodeJsEnvBuiltin };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import "../components
|
|
2
|
-
import
|
|
1
|
+
import { EnvBuiltinProps } from "../plugin-env/src/components/env.mjs";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
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
|
|
3
10
|
export { NodeJsEnvBuiltin };
|
package/dist/components/env.mjs
CHANGED
|
@@ -1,3 +1,187 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePowerlines } from "../plugin-alloy/src/core/contexts/context.mjs";
|
|
2
|
+
import { TSDoc, TSDocRemarks } from "../plugin-alloy/src/typescript/components/tsdoc.mjs";
|
|
3
|
+
import { EnvBuiltin } from "../plugin-env/src/components/env.mjs";
|
|
4
|
+
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import defu from "defu";
|
|
6
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
9
|
+
import { TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
|
|
2
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": ["homedir", "tmpdir"],
|
|
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`homedir(); `
|
|
58
|
+
}),
|
|
59
|
+
createIntrinsic("hbr", {}),
|
|
60
|
+
createIntrinsic("hbr", {}),
|
|
61
|
+
createComponent(VarDeclaration, {
|
|
62
|
+
"const": true,
|
|
63
|
+
name: "tmpdir",
|
|
64
|
+
initializer: code`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: `These paths are determined based on the conventions for each operating system, with overrides available through specific environment variables:
|
|
93
|
+
- On macOS, directories are generally created in \`~/Library/Application Support/<name>\`.
|
|
94
|
+
- On Windows, directories are generally created in \`%AppData%/<name>\`.
|
|
95
|
+
- On Linux, directories are generally created in \`~/.config/<name>\` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).
|
|
96
|
+
|
|
97
|
+
If the \`DATA_DIR\`, \`CONFIG_DIR\`, \`CACHE_DIR\`, \`LOG_DIR\`, or \`TEMP_DIR\` environment variables are set, they will be used instead of the default paths.
|
|
98
|
+
` });
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
createComponent(VarDeclaration, {
|
|
102
|
+
"export": true,
|
|
103
|
+
"const": true,
|
|
104
|
+
name: "paths",
|
|
105
|
+
type: "EnvPaths",
|
|
106
|
+
get initializer() {
|
|
107
|
+
return code`isMacOS
|
|
108
|
+
? {
|
|
109
|
+
data: String(env.DATA_DIR)
|
|
110
|
+
? join(String(env.DATA_DIR), "${titleCase(context.config.name)}")
|
|
111
|
+
: join(homedir, "Library", "Application Support", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
112
|
+
config: String(env.CONFIG_DIR)
|
|
113
|
+
? join(String(env.CONFIG_DIR), "${titleCase(context.config.name)}")
|
|
114
|
+
: join(homedir, "Library", "Preferences", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
115
|
+
cache: String(env.CACHE_DIR)
|
|
116
|
+
? join(String(env.CACHE_DIR), "${titleCase(context.config.name)}")
|
|
117
|
+
: join(homedir, "Library", "Caches", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
118
|
+
log: String(env.LOG_DIR)
|
|
119
|
+
? join(String(env.LOG_DIR), "${titleCase(context.config.name)}")
|
|
120
|
+
: join(homedir, "Library", "Logs", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
121
|
+
temp: String(env.TEMP_DIR)
|
|
122
|
+
? join(String(env.TEMP_DIR), "${titleCase(context.config.name)}")
|
|
123
|
+
: join(tmpdir, "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}")
|
|
124
|
+
}
|
|
125
|
+
: isWindows
|
|
126
|
+
? {
|
|
127
|
+
data: String(env.DATA_DIR)
|
|
128
|
+
? join(String(env.DATA_DIR), "${titleCase(context.config.name)}")
|
|
129
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Data"),
|
|
130
|
+
config: String(env.CONFIG_DIR)
|
|
131
|
+
? join(env.CONFIG_DIR!, "${titleCase(context.config.name)}")
|
|
132
|
+
: join(env.APPDATA || join(homedir, "AppData", "Roaming"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Config"),
|
|
133
|
+
cache: String(env.CACHE_DIR)
|
|
134
|
+
? join(String(env.CACHE_DIR), "${titleCase(context.config.name)}")
|
|
135
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "Cache", "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}"),
|
|
136
|
+
log: String(env.LOG_DIR)
|
|
137
|
+
? join(String(env.LOG_DIR), "${titleCase(context.config.name)}")
|
|
138
|
+
: join(env.LOCALAPPDATA || join(homedir, "AppData", "Local"), "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}", "Log"),
|
|
139
|
+
temp: String(env.TEMP_DIR)
|
|
140
|
+
? join(String(env.TEMP_DIR), "${titleCase(context.config.name)}")
|
|
141
|
+
: join(tmpdir, "${titleCase(context.config.organization)}", "${titleCase(context.config.name)}")
|
|
142
|
+
}
|
|
143
|
+
:
|
|
144
|
+
{
|
|
145
|
+
data: String(env.DATA_DIR)
|
|
146
|
+
? join(String(env.DATA_DIR), "${kebabCase(context.config.name)}")
|
|
147
|
+
: join(
|
|
148
|
+
env.XDG_DATA_HOME || join(homedir, ".local", "share"),
|
|
149
|
+
"${kebabCase(context.config.organization)}",
|
|
150
|
+
"${kebabCase(context.config.name)}"
|
|
151
|
+
),
|
|
152
|
+
config: String(env.CONFIG_DIR)
|
|
153
|
+
? join(String(env.CONFIG_DIR), "${kebabCase(context.config.name)}")
|
|
154
|
+
: join(
|
|
155
|
+
env.XDG_CONFIG_HOME || join(homedir, ".config"),
|
|
156
|
+
"${kebabCase(context.config.organization)}",
|
|
157
|
+
"${kebabCase(context.config.name)}"
|
|
158
|
+
),
|
|
159
|
+
cache: String(env.CACHE_DIR)
|
|
160
|
+
? join(String(env.CACHE_DIR), "${kebabCase(context.config.name)}")
|
|
161
|
+
: join(env.XDG_CACHE_HOME || join(homedir, ".cache"), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"),
|
|
162
|
+
log: String(env.LOG_DIR)
|
|
163
|
+
? join(String(env.LOG_DIR), "${kebabCase(context.config.name)}")
|
|
164
|
+
: join(env.XDG_STATE_HOME || join(homedir, ".local", "state"), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"),
|
|
165
|
+
temp: String(env.TEMP_DIR)
|
|
166
|
+
? join(String(env.TEMP_DIR), "${kebabCase(context.config.name)}")
|
|
167
|
+
: (env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR
|
|
168
|
+
? join((env.DEVENV_RUNTIME || env.XDG_RUNTIME_DIR)!, "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}")
|
|
169
|
+
: join(tmpdir, basename(homedir), "${kebabCase(context.config.organization)}", "${kebabCase(context.config.name)}"))
|
|
170
|
+
} as StormEnvPaths; `;
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
createIntrinsic("hbr", {}),
|
|
174
|
+
createIntrinsic("hbr", {}),
|
|
175
|
+
createComponent(Show, {
|
|
176
|
+
get when() {
|
|
177
|
+
return Boolean(children);
|
|
178
|
+
},
|
|
179
|
+
children
|
|
180
|
+
})
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
3
187
|
export { NodeJsEnvBuiltin };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
require('../components-BWLXb7a2.cjs');
|
|
1
|
+
const require_components_env = require('./env.cjs');
|
|
3
2
|
|
|
4
|
-
exports.NodeJsEnvBuiltin =
|
|
3
|
+
exports.NodeJsEnvBuiltin = require_components_env.NodeJsEnvBuiltin;
|