@powerlines/plugin-env 0.15.134 → 0.15.136
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/helpers/reflect.cjs +0 -13
- package/dist/helpers/reflect.mjs +0 -13
- package/dist/index.cjs +2 -3
- package/dist/index.mjs +2 -2
- package/dist/plugin-alloy/src/core/components/output.cjs +33 -0
- package/dist/plugin-alloy/src/core/components/output.mjs +32 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +116 -0
- package/dist/plugin-alloy/src/core/contexts/context.mjs +116 -0
- package/dist/plugin-alloy/src/index.cjs +98 -0
- package/dist/plugin-alloy/src/index.mjs +96 -0
- package/dist/plugin-alloy/src/internal/unctx.cjs +9 -0
- package/dist/plugin-alloy/src/internal/unctx.mjs +8 -0
- package/package.json +9 -9
package/dist/helpers/reflect.cjs
CHANGED
|
@@ -55,17 +55,8 @@ const __ΩCreateEnvReflectionOptions = [
|
|
|
55
55
|
"PPn!n\"J4#8P\"7$4%8Mw&y"
|
|
56
56
|
];
|
|
57
57
|
var BaseEnv = class {
|
|
58
|
-
APP_NAME;
|
|
59
|
-
APP_VERSION;
|
|
60
|
-
BUILD_ID;
|
|
61
|
-
BUILD_TIMESTAMP;
|
|
62
|
-
BUILD_CHECKSUM;
|
|
63
|
-
RELEASE_ID;
|
|
64
|
-
RELEASE_TAG;
|
|
65
|
-
ORGANIZATION;
|
|
66
58
|
PLATFORM = "neutral";
|
|
67
59
|
MODE = "production";
|
|
68
|
-
ENVIRONMENT;
|
|
69
60
|
DEBUG = false;
|
|
70
61
|
TEST = false;
|
|
71
62
|
MINIMAL = false;
|
|
@@ -74,9 +65,6 @@ var BaseEnv = class {
|
|
|
74
65
|
FORCE_HYPERLINK = false;
|
|
75
66
|
STACKTRACE = false;
|
|
76
67
|
INCLUDE_ERROR_DATA = false;
|
|
77
|
-
ERROR_URL;
|
|
78
|
-
DEFAULT_TIMEZONE;
|
|
79
|
-
DEFAULT_LOCALE;
|
|
80
68
|
CI = false;
|
|
81
69
|
static __type = [
|
|
82
70
|
"APP_NAME",
|
|
@@ -147,7 +135,6 @@ var BaseEnv = class {
|
|
|
147
135
|
];
|
|
148
136
|
};
|
|
149
137
|
var BaseSecrets = class {
|
|
150
|
-
ENCRYPTION_KEY;
|
|
151
138
|
static __type = [
|
|
152
139
|
"ENCRYPTION_KEY",
|
|
153
140
|
() => require_types_runtime.__ΩSecretsInterface,
|
package/dist/helpers/reflect.mjs
CHANGED
|
@@ -54,17 +54,8 @@ const __ΩCreateEnvReflectionOptions = [
|
|
|
54
54
|
"PPn!n\"J4#8P\"7$4%8Mw&y"
|
|
55
55
|
];
|
|
56
56
|
var BaseEnv = class {
|
|
57
|
-
APP_NAME;
|
|
58
|
-
APP_VERSION;
|
|
59
|
-
BUILD_ID;
|
|
60
|
-
BUILD_TIMESTAMP;
|
|
61
|
-
BUILD_CHECKSUM;
|
|
62
|
-
RELEASE_ID;
|
|
63
|
-
RELEASE_TAG;
|
|
64
|
-
ORGANIZATION;
|
|
65
57
|
PLATFORM = "neutral";
|
|
66
58
|
MODE = "production";
|
|
67
|
-
ENVIRONMENT;
|
|
68
59
|
DEBUG = false;
|
|
69
60
|
TEST = false;
|
|
70
61
|
MINIMAL = false;
|
|
@@ -73,9 +64,6 @@ var BaseEnv = class {
|
|
|
73
64
|
FORCE_HYPERLINK = false;
|
|
74
65
|
STACKTRACE = false;
|
|
75
66
|
INCLUDE_ERROR_DATA = false;
|
|
76
|
-
ERROR_URL;
|
|
77
|
-
DEFAULT_TIMEZONE;
|
|
78
|
-
DEFAULT_LOCALE;
|
|
79
67
|
CI = false;
|
|
80
68
|
static __type = [
|
|
81
69
|
"APP_NAME",
|
|
@@ -146,7 +134,6 @@ var BaseEnv = class {
|
|
|
146
134
|
];
|
|
147
135
|
};
|
|
148
136
|
var BaseSecrets = class {
|
|
149
|
-
ENCRYPTION_KEY;
|
|
150
137
|
static __type = [
|
|
151
138
|
"ENCRYPTION_KEY",
|
|
152
139
|
() => __ΩSecretsInterface,
|
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ const require_components_env = require('./components/env.cjs');
|
|
|
17
17
|
require('./components/index.cjs');
|
|
18
18
|
const require_babel_plugin = require('./babel/plugin.cjs');
|
|
19
19
|
require('./babel/index.cjs');
|
|
20
|
+
const require_index = require('./plugin-alloy/src/index.cjs');
|
|
20
21
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
21
22
|
let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
22
23
|
let __stryke_env_types = require("@stryke/env/types");
|
|
@@ -24,8 +25,6 @@ let defu = require("defu");
|
|
|
24
25
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
25
26
|
let __stryke_path_join = require("@stryke/path/join");
|
|
26
27
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
27
|
-
let __powerlines_plugin_alloy = require("@powerlines/plugin-alloy");
|
|
28
|
-
__powerlines_plugin_alloy = require_rolldown_runtime.__toESM(__powerlines_plugin_alloy);
|
|
29
28
|
let __powerlines_plugin_automd = require("@powerlines/plugin-automd");
|
|
30
29
|
__powerlines_plugin_automd = require_rolldown_runtime.__toESM(__powerlines_plugin_automd);
|
|
31
30
|
let __powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
@@ -41,7 +40,7 @@ let __stryke_string_format_constant_case = require("@stryke/string-format/consta
|
|
|
41
40
|
*/
|
|
42
41
|
const plugin = (options = {}) => {
|
|
43
42
|
return [
|
|
44
|
-
|
|
43
|
+
require_index.default(options.alloy),
|
|
45
44
|
(0, __powerlines_plugin_babel.default)(options.babel),
|
|
46
45
|
{
|
|
47
46
|
name: "env",
|
package/dist/index.mjs
CHANGED
|
@@ -15,13 +15,13 @@ import { EnvBuiltin, EnvTypeDefinition } from "./components/env.mjs";
|
|
|
15
15
|
import "./components/index.mjs";
|
|
16
16
|
import { envBabelPlugin } from "./babel/plugin.mjs";
|
|
17
17
|
import "./babel/index.mjs";
|
|
18
|
+
import src_default$1 from "./plugin-alloy/src/index.mjs";
|
|
18
19
|
import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
19
20
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
20
21
|
import { ENV_PREFIXES } from "@stryke/env/types";
|
|
21
22
|
import defu from "defu";
|
|
22
23
|
import { joinPaths } from "@stryke/path/join";
|
|
23
24
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
24
|
-
import alloy from "@powerlines/plugin-alloy";
|
|
25
25
|
import automd from "@powerlines/plugin-automd";
|
|
26
26
|
import babel from "@powerlines/plugin-babel";
|
|
27
27
|
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
@@ -35,7 +35,7 @@ import { constantCase } from "@stryke/string-format/constant-case";
|
|
|
35
35
|
*/
|
|
36
36
|
const plugin = (options = {}) => {
|
|
37
37
|
return [
|
|
38
|
-
|
|
38
|
+
src_default$1(options.alloy),
|
|
39
39
|
babel(options.babel),
|
|
40
40
|
{
|
|
41
41
|
name: "env",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
3
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
5
|
+
|
|
6
|
+
//#region ../plugin-alloy/src/core/components/output.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
9
|
+
*/
|
|
10
|
+
function Output(props) {
|
|
11
|
+
const [{ children, context, basePath }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
12
|
+
"children",
|
|
13
|
+
"context",
|
|
14
|
+
"basePath"
|
|
15
|
+
]);
|
|
16
|
+
const basePathRef = (0, __alloy_js_core.computed)(() => basePath ? (0, __stryke_path_replace.replacePath)(basePath, context.workspaceConfig.workspaceRoot) : context.workspaceConfig.workspaceRoot);
|
|
17
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Output, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
18
|
+
get basePath() {
|
|
19
|
+
return basePathRef.value;
|
|
20
|
+
},
|
|
21
|
+
get children() {
|
|
22
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
23
|
+
get when() {
|
|
24
|
+
return Boolean(context);
|
|
25
|
+
},
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.Output = Output;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Output, Show, computed, splitProps } from "@alloy-js/core";
|
|
2
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { replacePath } from "@stryke/path/replace";
|
|
4
|
+
|
|
5
|
+
//#region ../plugin-alloy/src/core/components/output.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
8
|
+
*/
|
|
9
|
+
function Output$1(props) {
|
|
10
|
+
const [{ children, context, basePath }, rest] = splitProps(props, [
|
|
11
|
+
"children",
|
|
12
|
+
"context",
|
|
13
|
+
"basePath"
|
|
14
|
+
]);
|
|
15
|
+
const basePathRef = computed(() => basePath ? replacePath(basePath, context.workspaceConfig.workspaceRoot) : context.workspaceConfig.workspaceRoot);
|
|
16
|
+
return createComponent(Output, mergeProps(rest, {
|
|
17
|
+
get basePath() {
|
|
18
|
+
return basePathRef.value;
|
|
19
|
+
},
|
|
20
|
+
get children() {
|
|
21
|
+
return createComponent(Show, {
|
|
22
|
+
get when() {
|
|
23
|
+
return Boolean(context);
|
|
24
|
+
},
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Output$1 as Output };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const require_unctx = require('../../internal/unctx.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-alloy/src/core/contexts/context.ts
|
|
4
|
+
const __ΩRecord = [
|
|
5
|
+
"K",
|
|
6
|
+
"T",
|
|
7
|
+
"Record",
|
|
8
|
+
"l'e#\"Rb!b\"Pde\"!N#!w#y"
|
|
9
|
+
];
|
|
10
|
+
const __ΩMetaItem = [
|
|
11
|
+
"builtin",
|
|
12
|
+
"entry",
|
|
13
|
+
"kind",
|
|
14
|
+
"The kind of metadata item.",
|
|
15
|
+
"skipFormat",
|
|
16
|
+
"Whether to skip formatting for this output.",
|
|
17
|
+
"StoragePreset",
|
|
18
|
+
"storage",
|
|
19
|
+
"The storage preset or adapter name for the output files.",
|
|
20
|
+
"MetaItem",
|
|
21
|
+
"PP.!.\"&J4#8?$)4%8?&P\"w'&J4(8?)&\"LMw*y"
|
|
22
|
+
];
|
|
23
|
+
const __ΩPowerlinesContextInterface = [
|
|
24
|
+
"PluginContext",
|
|
25
|
+
"TContext",
|
|
26
|
+
() => __ΩRecord,
|
|
27
|
+
() => __ΩMetaItem,
|
|
28
|
+
"TMeta",
|
|
29
|
+
"value",
|
|
30
|
+
"The current Powerlines context.",
|
|
31
|
+
"meta",
|
|
32
|
+
"The current render metadata.",
|
|
33
|
+
"PowerlinesContextInterface",
|
|
34
|
+
"\"w!c\"&n$o##c%Pe\"!4&?'e\"\"4(?)Mw*y"
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Hook to access the Powerlines Context.
|
|
38
|
+
*
|
|
39
|
+
* @returns The Context.
|
|
40
|
+
*/
|
|
41
|
+
function usePowerlinesContext() {
|
|
42
|
+
return require_unctx.unctx.tryUse();
|
|
43
|
+
}
|
|
44
|
+
usePowerlinesContext.__type = [
|
|
45
|
+
() => __ΩPowerlinesContextInterface,
|
|
46
|
+
"usePowerlinesContext",
|
|
47
|
+
"Hook to access the Powerlines Context.",
|
|
48
|
+
"PP\"\"o!#,J/\"?#"
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
52
|
+
*
|
|
53
|
+
* @returns The Powerlines context or null if not set.
|
|
54
|
+
*/
|
|
55
|
+
function usePowerlinesSafe() {
|
|
56
|
+
return (usePowerlinesContext.Ω = [["PluginContext", "\"w!"]], usePowerlinesContext())?.value ?? null;
|
|
57
|
+
}
|
|
58
|
+
usePowerlinesSafe.__type = [
|
|
59
|
+
"usePowerlinesSafe",
|
|
60
|
+
"Hook to safely access the {@link PluginContext | Powerlines context}.",
|
|
61
|
+
"PP\",J/!?\""
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
65
|
+
*
|
|
66
|
+
* @returns The Powerlines context.
|
|
67
|
+
*/
|
|
68
|
+
function usePowerlines() {
|
|
69
|
+
const powerlines = (usePowerlinesSafe.Ω = [["PluginContext", "\"w!"]], usePowerlinesSafe());
|
|
70
|
+
if (!powerlines) throw new Error("Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
71
|
+
return powerlines;
|
|
72
|
+
}
|
|
73
|
+
usePowerlines.__type = [
|
|
74
|
+
"usePowerlines",
|
|
75
|
+
"Hook to access the {@link PluginContext | Powerlines context}.",
|
|
76
|
+
"P\"/!?\""
|
|
77
|
+
];
|
|
78
|
+
/**
|
|
79
|
+
* Hook to safely access the render context's metadata.
|
|
80
|
+
*
|
|
81
|
+
* @returns The Powerlines context or null if not set.
|
|
82
|
+
*/
|
|
83
|
+
function useMetaSafe() {
|
|
84
|
+
return (usePowerlinesContext.Ω = [["PluginContext", "\"w!"], [
|
|
85
|
+
() => __ΩRecord,
|
|
86
|
+
() => __ΩMetaItem,
|
|
87
|
+
"&n\"o!#"
|
|
88
|
+
]], usePowerlinesContext())?.meta ?? null;
|
|
89
|
+
}
|
|
90
|
+
useMetaSafe.__type = [
|
|
91
|
+
"useMetaSafe",
|
|
92
|
+
"Hook to safely access the render context's metadata.",
|
|
93
|
+
"PP\",J/!?\""
|
|
94
|
+
];
|
|
95
|
+
/**
|
|
96
|
+
* Hook to access the render context's metadata.
|
|
97
|
+
*
|
|
98
|
+
* @returns The Powerlines context.
|
|
99
|
+
*/
|
|
100
|
+
function useMeta() {
|
|
101
|
+
const meta = (useMetaSafe.Ω = [[
|
|
102
|
+
() => __ΩRecord,
|
|
103
|
+
() => __ΩMetaItem,
|
|
104
|
+
"&n\"o!#"
|
|
105
|
+
]], useMetaSafe());
|
|
106
|
+
if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
107
|
+
return meta;
|
|
108
|
+
}
|
|
109
|
+
useMeta.__type = [
|
|
110
|
+
"useMeta",
|
|
111
|
+
"Hook to access the render context's metadata.",
|
|
112
|
+
"P\"/!?\""
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
exports.__ΩPowerlinesContextInterface = __ΩPowerlinesContextInterface;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { unctx } from "../../internal/unctx.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-alloy/src/core/contexts/context.ts
|
|
4
|
+
const __ΩRecord = [
|
|
5
|
+
"K",
|
|
6
|
+
"T",
|
|
7
|
+
"Record",
|
|
8
|
+
"l'e#\"Rb!b\"Pde\"!N#!w#y"
|
|
9
|
+
];
|
|
10
|
+
const __ΩMetaItem = [
|
|
11
|
+
"builtin",
|
|
12
|
+
"entry",
|
|
13
|
+
"kind",
|
|
14
|
+
"The kind of metadata item.",
|
|
15
|
+
"skipFormat",
|
|
16
|
+
"Whether to skip formatting for this output.",
|
|
17
|
+
"StoragePreset",
|
|
18
|
+
"storage",
|
|
19
|
+
"The storage preset or adapter name for the output files.",
|
|
20
|
+
"MetaItem",
|
|
21
|
+
"PP.!.\"&J4#8?$)4%8?&P\"w'&J4(8?)&\"LMw*y"
|
|
22
|
+
];
|
|
23
|
+
const __ΩPowerlinesContextInterface = [
|
|
24
|
+
"PluginContext",
|
|
25
|
+
"TContext",
|
|
26
|
+
() => __ΩRecord,
|
|
27
|
+
() => __ΩMetaItem,
|
|
28
|
+
"TMeta",
|
|
29
|
+
"value",
|
|
30
|
+
"The current Powerlines context.",
|
|
31
|
+
"meta",
|
|
32
|
+
"The current render metadata.",
|
|
33
|
+
"PowerlinesContextInterface",
|
|
34
|
+
"\"w!c\"&n$o##c%Pe\"!4&?'e\"\"4(?)Mw*y"
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Hook to access the Powerlines Context.
|
|
38
|
+
*
|
|
39
|
+
* @returns The Context.
|
|
40
|
+
*/
|
|
41
|
+
function usePowerlinesContext() {
|
|
42
|
+
return unctx.tryUse();
|
|
43
|
+
}
|
|
44
|
+
usePowerlinesContext.__type = [
|
|
45
|
+
() => __ΩPowerlinesContextInterface,
|
|
46
|
+
"usePowerlinesContext",
|
|
47
|
+
"Hook to access the Powerlines Context.",
|
|
48
|
+
"PP\"\"o!#,J/\"?#"
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
52
|
+
*
|
|
53
|
+
* @returns The Powerlines context or null if not set.
|
|
54
|
+
*/
|
|
55
|
+
function usePowerlinesSafe() {
|
|
56
|
+
return (usePowerlinesContext.Ω = [["PluginContext", "\"w!"]], usePowerlinesContext())?.value ?? null;
|
|
57
|
+
}
|
|
58
|
+
usePowerlinesSafe.__type = [
|
|
59
|
+
"usePowerlinesSafe",
|
|
60
|
+
"Hook to safely access the {@link PluginContext | Powerlines context}.",
|
|
61
|
+
"PP\",J/!?\""
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
65
|
+
*
|
|
66
|
+
* @returns The Powerlines context.
|
|
67
|
+
*/
|
|
68
|
+
function usePowerlines() {
|
|
69
|
+
const powerlines = (usePowerlinesSafe.Ω = [["PluginContext", "\"w!"]], usePowerlinesSafe());
|
|
70
|
+
if (!powerlines) throw new Error("Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
71
|
+
return powerlines;
|
|
72
|
+
}
|
|
73
|
+
usePowerlines.__type = [
|
|
74
|
+
"usePowerlines",
|
|
75
|
+
"Hook to access the {@link PluginContext | Powerlines context}.",
|
|
76
|
+
"P\"/!?\""
|
|
77
|
+
];
|
|
78
|
+
/**
|
|
79
|
+
* Hook to safely access the render context's metadata.
|
|
80
|
+
*
|
|
81
|
+
* @returns The Powerlines context or null if not set.
|
|
82
|
+
*/
|
|
83
|
+
function useMetaSafe() {
|
|
84
|
+
return (usePowerlinesContext.Ω = [["PluginContext", "\"w!"], [
|
|
85
|
+
() => __ΩRecord,
|
|
86
|
+
() => __ΩMetaItem,
|
|
87
|
+
"&n\"o!#"
|
|
88
|
+
]], usePowerlinesContext())?.meta ?? null;
|
|
89
|
+
}
|
|
90
|
+
useMetaSafe.__type = [
|
|
91
|
+
"useMetaSafe",
|
|
92
|
+
"Hook to safely access the render context's metadata.",
|
|
93
|
+
"PP\",J/!?\""
|
|
94
|
+
];
|
|
95
|
+
/**
|
|
96
|
+
* Hook to access the render context's metadata.
|
|
97
|
+
*
|
|
98
|
+
* @returns The Powerlines context.
|
|
99
|
+
*/
|
|
100
|
+
function useMeta() {
|
|
101
|
+
const meta = (useMetaSafe.Ω = [[
|
|
102
|
+
() => __ΩRecord,
|
|
103
|
+
() => __ΩMetaItem,
|
|
104
|
+
"&n\"o!#"
|
|
105
|
+
]], useMetaSafe());
|
|
106
|
+
if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
107
|
+
return meta;
|
|
108
|
+
}
|
|
109
|
+
useMeta.__type = [
|
|
110
|
+
"useMeta",
|
|
111
|
+
"Hook to access the render context's metadata.",
|
|
112
|
+
"P\"/!?\""
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
export { __ΩPowerlinesContextInterface };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_output = require('./core/components/output.cjs');
|
|
3
|
+
const require_unctx = require('./internal/unctx.cjs');
|
|
4
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
|
|
7
|
+
__alloy_js_rollup_plugin = require_rolldown_runtime.__toESM(__alloy_js_rollup_plugin);
|
|
8
|
+
let __stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
9
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
10
|
+
|
|
11
|
+
//#region ../plugin-alloy/src/index.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Alloy-js plugin for Powerlines.
|
|
14
|
+
*
|
|
15
|
+
* @param options - The Alloy-js plugin user configuration options.
|
|
16
|
+
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
17
|
+
*/
|
|
18
|
+
const plugin = (options = {}) => {
|
|
19
|
+
return [{
|
|
20
|
+
name: "alloy:config",
|
|
21
|
+
config() {
|
|
22
|
+
this.debug("Updating configuration options to support Alloy-js builds.");
|
|
23
|
+
return {
|
|
24
|
+
alloy: {
|
|
25
|
+
typescript: true,
|
|
26
|
+
...options
|
|
27
|
+
},
|
|
28
|
+
build: {
|
|
29
|
+
inputOptions: { transform: { jsx: "preserve" } },
|
|
30
|
+
plugins: [(0, __alloy_js_rollup_plugin.default)()],
|
|
31
|
+
external: [/^@alloy-js\//],
|
|
32
|
+
noExternal: ["@powerlines/plugin-alloy"]
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
async configResolved() {
|
|
37
|
+
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
38
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
39
|
+
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
40
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
41
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
42
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
name: "alloy:attach-render",
|
|
47
|
+
configResolved: {
|
|
48
|
+
order: "pre",
|
|
49
|
+
async handler() {
|
|
50
|
+
this.debug("Attaching the `render` method to the context object.");
|
|
51
|
+
this.render = async (children) => {
|
|
52
|
+
const meta = {};
|
|
53
|
+
await require_unctx.unctx.callAsync({
|
|
54
|
+
value: this,
|
|
55
|
+
meta
|
|
56
|
+
}, async () => {
|
|
57
|
+
const _self$ = this;
|
|
58
|
+
await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(require_output.Output, {
|
|
59
|
+
context: _self$,
|
|
60
|
+
meta,
|
|
61
|
+
get basePath() {
|
|
62
|
+
return _self$.workspaceConfig.workspaceRoot;
|
|
63
|
+
},
|
|
64
|
+
children
|
|
65
|
+
})), {
|
|
66
|
+
visitDirectory: (directory) => {
|
|
67
|
+
if (this.fs.existsSync(directory.path)) return;
|
|
68
|
+
this.fs.mkdirSync(directory.path);
|
|
69
|
+
},
|
|
70
|
+
visitFile: (file) => {
|
|
71
|
+
if ("contents" in file) {
|
|
72
|
+
const metadata = meta[file.path] ?? {};
|
|
73
|
+
if (metadata.kind === "builtin") {
|
|
74
|
+
if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
|
|
75
|
+
this.emitBuiltinSync(file.contents, metadata.id, {
|
|
76
|
+
skipFormat: metadata.skipFormat,
|
|
77
|
+
storage: metadata.storage,
|
|
78
|
+
extension: (0, __stryke_path_file_path_fns.findFileExtension)(file.path)
|
|
79
|
+
});
|
|
80
|
+
} else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
|
|
81
|
+
skipFormat: metadata.skipFormat,
|
|
82
|
+
storage: metadata.storage,
|
|
83
|
+
...metadata.typeDefinition ?? {}
|
|
84
|
+
});
|
|
85
|
+
else this.emitSync(file.contents, file.path, metadata);
|
|
86
|
+
} else this.fs.copySync(file.sourcePath, file.path);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}];
|
|
94
|
+
};
|
|
95
|
+
var src_default = plugin;
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
exports.default = src_default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Output as Output$1 } from "./core/components/output.mjs";
|
|
2
|
+
import { unctx } from "./internal/unctx.mjs";
|
|
3
|
+
import { renderAsync, traverseOutput } from "@alloy-js/core";
|
|
4
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import rollupPlugin from "@alloy-js/rollup-plugin";
|
|
6
|
+
import { StormJSON } from "@stryke/json/storm-json";
|
|
7
|
+
import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
8
|
+
|
|
9
|
+
//#region ../plugin-alloy/src/index.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Alloy-js plugin for Powerlines.
|
|
12
|
+
*
|
|
13
|
+
* @param options - The Alloy-js plugin user configuration options.
|
|
14
|
+
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
15
|
+
*/
|
|
16
|
+
const plugin = (options = {}) => {
|
|
17
|
+
return [{
|
|
18
|
+
name: "alloy:config",
|
|
19
|
+
config() {
|
|
20
|
+
this.debug("Updating configuration options to support Alloy-js builds.");
|
|
21
|
+
return {
|
|
22
|
+
alloy: {
|
|
23
|
+
typescript: true,
|
|
24
|
+
...options
|
|
25
|
+
},
|
|
26
|
+
build: {
|
|
27
|
+
inputOptions: { transform: { jsx: "preserve" } },
|
|
28
|
+
plugins: [rollupPlugin()],
|
|
29
|
+
external: [/^@alloy-js\//],
|
|
30
|
+
noExternal: ["@powerlines/plugin-alloy"]
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
async configResolved() {
|
|
35
|
+
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
36
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
37
|
+
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
38
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
39
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
40
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
name: "alloy:attach-render",
|
|
45
|
+
configResolved: {
|
|
46
|
+
order: "pre",
|
|
47
|
+
async handler() {
|
|
48
|
+
this.debug("Attaching the `render` method to the context object.");
|
|
49
|
+
this.render = async (children) => {
|
|
50
|
+
const meta = {};
|
|
51
|
+
await unctx.callAsync({
|
|
52
|
+
value: this,
|
|
53
|
+
meta
|
|
54
|
+
}, async () => {
|
|
55
|
+
const _self$ = this;
|
|
56
|
+
await traverseOutput(await renderAsync(createComponent(Output$1, {
|
|
57
|
+
context: _self$,
|
|
58
|
+
meta,
|
|
59
|
+
get basePath() {
|
|
60
|
+
return _self$.workspaceConfig.workspaceRoot;
|
|
61
|
+
},
|
|
62
|
+
children
|
|
63
|
+
})), {
|
|
64
|
+
visitDirectory: (directory) => {
|
|
65
|
+
if (this.fs.existsSync(directory.path)) return;
|
|
66
|
+
this.fs.mkdirSync(directory.path);
|
|
67
|
+
},
|
|
68
|
+
visitFile: (file) => {
|
|
69
|
+
if ("contents" in file) {
|
|
70
|
+
const metadata = meta[file.path] ?? {};
|
|
71
|
+
if (metadata.kind === "builtin") {
|
|
72
|
+
if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
|
|
73
|
+
this.emitBuiltinSync(file.contents, metadata.id, {
|
|
74
|
+
skipFormat: metadata.skipFormat,
|
|
75
|
+
storage: metadata.storage,
|
|
76
|
+
extension: findFileExtension(file.path)
|
|
77
|
+
});
|
|
78
|
+
} else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
|
|
79
|
+
skipFormat: metadata.skipFormat,
|
|
80
|
+
storage: metadata.storage,
|
|
81
|
+
...metadata.typeDefinition ?? {}
|
|
82
|
+
});
|
|
83
|
+
else this.emitSync(file.contents, file.path, metadata);
|
|
84
|
+
} else this.fs.copySync(file.sourcePath, file.path);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}];
|
|
92
|
+
};
|
|
93
|
+
var src_default = plugin;
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { src_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_context = require('../core/contexts/context.cjs');
|
|
3
|
+
let unctx = require("unctx");
|
|
4
|
+
|
|
5
|
+
//#region ../plugin-alloy/src/internal/unctx.ts
|
|
6
|
+
const unctx$1 = (unctx.createContext.Ω = [[() => require_context.__ΩPowerlinesContextInterface, "\"\"o!#"]], (0, unctx.createContext)());
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.unctx = unctx$1;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { __ΩPowerlinesContextInterface } from "../core/contexts/context.mjs";
|
|
2
|
+
import { createContext } from "unctx";
|
|
3
|
+
|
|
4
|
+
//#region ../plugin-alloy/src/internal/unctx.ts
|
|
5
|
+
const unctx = (createContext.Ω = [[() => __ΩPowerlinesContextInterface, "\"\"o!#"]], createContext());
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { unctx };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.136",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
|
|
6
6
|
"repository": {
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
"@alloy-js/typescript": "^0.22.0",
|
|
131
131
|
"@babel/core": "^7.28.6",
|
|
132
132
|
"@babel/types": "^7.28.6",
|
|
133
|
-
"@powerlines/plugin-alloy": "^0.19.
|
|
134
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
135
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
136
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
133
|
+
"@powerlines/plugin-alloy": "^0.19.8",
|
|
134
|
+
"@powerlines/plugin-automd": "^0.1.233",
|
|
135
|
+
"@powerlines/plugin-babel": "^0.12.242",
|
|
136
|
+
"@powerlines/plugin-plugin": "^0.12.184",
|
|
137
137
|
"@storm-software/config-tools": "^1.189.0",
|
|
138
138
|
"@stryke/capnp": "^0.12.63",
|
|
139
139
|
"@stryke/env": "^0.20.55",
|
|
@@ -143,15 +143,15 @@
|
|
|
143
143
|
"@stryke/type-checks": "^0.5.22",
|
|
144
144
|
"@stryke/types": "^0.10.36",
|
|
145
145
|
"automd": "^0.4.2",
|
|
146
|
-
"powerlines": "^0.
|
|
146
|
+
"powerlines": "^0.38.0"
|
|
147
147
|
},
|
|
148
148
|
"devDependencies": {
|
|
149
|
-
"@powerlines/deepkit": "^0.6.
|
|
150
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
149
|
+
"@powerlines/deepkit": "^0.6.13",
|
|
150
|
+
"@powerlines/plugin-deepkit": "^0.11.112",
|
|
151
151
|
"@types/node": "^24.10.9",
|
|
152
152
|
"vite": "8.0.0-beta.2"
|
|
153
153
|
},
|
|
154
154
|
"publishConfig": { "access": "public" },
|
|
155
155
|
"types": "./dist/index.d.cts",
|
|
156
|
-
"gitHead": "
|
|
156
|
+
"gitHead": "8a8bee34b0195608f4e45380ea3bcf33b9da18d7"
|
|
157
157
|
}
|