@powerlines/plugin-env 0.15.2 → 0.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/docs.cjs +3 -70
- package/dist/components/docs.d.cts +1 -8
- package/dist/components/docs.d.mts +1 -8
- package/dist/components/docs.mjs +2 -68
- package/dist/components/env.cjs +4 -574
- package/dist/components/env.d.cts +2 -19
- package/dist/components/env.d.mts +3 -19
- package/dist/components/env.mjs +2 -570
- package/dist/components/index.cjs +7 -5
- package/dist/components/index.d.cts +4 -2
- package/dist/components/index.d.mts +5 -2
- package/dist/components/index.mjs +4 -2
- package/dist/{plugin-alloy/src/types/components.d.cts → components-8W0Zgj0y.d.mts} +2 -1
- package/dist/components-C9bYrQVK.cjs +0 -0
- package/dist/components-CNIQFfeK.mjs +1 -0
- package/dist/create-reflection-resource-BNYxBgW2.mjs +9846 -0
- package/dist/create-reflection-resource-BWYhmX7O.cjs +10085 -0
- package/dist/docs-5r844zC1.d.mts +9 -0
- package/dist/docs-B66b9li3.mjs +219 -0
- package/dist/docs-_MmTNBQX.d.cts +9 -0
- package/dist/docs-hBlKCRWK.cjs +224 -0
- package/dist/env-BPodCdD1.d.cts +116 -0
- package/dist/env-IQvgnabX.mjs +1578 -0
- package/dist/env-cO4BUDn1.cjs +1596 -0
- package/dist/env-zhzvpUI5.d.mts +98 -0
- package/dist/index-BXxhKmeA.d.mts +1 -0
- package/dist/index-Cc7fCJU9.d.mts +1 -0
- package/dist/index-CqdNToYT.d.cts +1 -0
- package/dist/index-DWPDThxu.d.cts +1 -0
- package/dist/index.cjs +702 -77
- package/dist/index.d.cts +185 -12
- package/dist/index.d.mts +190 -17
- package/dist/index.mjs +648 -28
- package/dist/{deepkit/schemas/reflection.d.mts → plugin-BaInAuAh.d.mts} +326 -59
- package/dist/{deepkit/schemas/reflection.d.cts → plugin-BwuEBScL.d.cts} +268 -1
- package/dist/plugin-D3B5E_Hg.mjs +1 -0
- package/dist/plugin-D5qyQPqC.cjs +0 -0
- package/dist/resolved-BZG2cwRG.d.cts +1789 -0
- package/dist/resolved-V5COsfDu.d.mts +1791 -0
- package/dist/runtime-Bisl_1Ja.cjs +0 -0
- package/dist/runtime-Q8Ni8SeN.d.cts +794 -0
- package/dist/runtime-azNoeKr-.mjs +1 -0
- package/dist/runtime-qZ0Z2kEd.d.mts +794 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +4 -2
- package/dist/types/index.d.mts +5 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +3 -156
- package/dist/types/plugin.d.mts +4 -158
- package/dist/types/plugin.mjs +2 -0
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts +2 -793
- package/dist/types/runtime.d.mts +2 -793
- package/dist/types/runtime.mjs +2 -0
- package/dist/types-DwElXV6q.mjs +1 -0
- package/dist/types-MYBaygjr.cjs +0 -0
- package/package.json +7 -7
- package/dist/_virtual/rolldown_runtime.cjs +0 -37
- package/dist/_virtual/rolldown_runtime.mjs +0 -29
- package/dist/babel/index.cjs +0 -1
- package/dist/babel/index.d.mts +0 -1
- package/dist/babel/index.mjs +0 -3
- package/dist/babel/plugin.cjs +0 -121
- package/dist/babel/plugin.d.cts +0 -7
- package/dist/babel/plugin.d.mts +0 -9
- package/dist/babel/plugin.mjs +0 -119
- package/dist/deepkit/schemas/reflection.cjs +0 -3940
- package/dist/deepkit/schemas/reflection.mjs +0 -3938
- package/dist/deepkit/schemas/reflection2.cjs +0 -4112
- package/dist/deepkit/schemas/reflection2.mjs +0 -4110
- package/dist/deepkit/src/capnp.cjs +0 -913
- package/dist/deepkit/src/capnp.mjs +0 -911
- package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
- package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
- package/dist/deepkit/src/reflect-type.cjs +0 -22
- package/dist/deepkit/src/reflect-type.mjs +0 -20
- package/dist/deepkit/src/resolve-reflections.cjs +0 -16
- package/dist/deepkit/src/resolve-reflections.mjs +0 -15
- package/dist/deepkit/src/transformer.cjs +0 -52
- package/dist/deepkit/src/transformer.mjs +0 -49
- package/dist/deepkit/src/transpile.cjs +0 -29
- package/dist/deepkit/src/transpile.mjs +0 -27
- package/dist/deepkit/src/types.d.cts +0 -10
- package/dist/deepkit/src/types.d.mts +0 -10
- package/dist/deepkit/src/utilities.cjs +0 -66
- package/dist/deepkit/src/utilities.mjs +0 -65
- package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
- package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
- package/dist/deepkit/src/vendor/type.cjs +0 -20
- package/dist/deepkit/src/vendor/type.d.cts +0 -7
- package/dist/deepkit/src/vendor/type.d.mts +0 -7
- package/dist/deepkit/src/vendor/type.mjs +0 -11
- package/dist/helpers/automd-generator.cjs +0 -22
- package/dist/helpers/automd-generator.mjs +0 -21
- package/dist/helpers/create-reflection-resource.cjs +0 -55
- package/dist/helpers/create-reflection-resource.d.cts +0 -15
- package/dist/helpers/create-reflection-resource.d.mts +0 -15
- package/dist/helpers/create-reflection-resource.mjs +0 -54
- package/dist/helpers/index.cjs +0 -6
- package/dist/helpers/index.d.mts +0 -6
- package/dist/helpers/index.mjs +0 -8
- package/dist/helpers/load.cjs +0 -83
- package/dist/helpers/load.d.cts +0 -35
- package/dist/helpers/load.d.mts +0 -36
- package/dist/helpers/load.mjs +0 -80
- package/dist/helpers/persistence.cjs +0 -214
- package/dist/helpers/persistence.d.cts +0 -84
- package/dist/helpers/persistence.d.mts +0 -84
- package/dist/helpers/persistence.mjs +0 -202
- package/dist/helpers/reflect.cjs +0 -111
- package/dist/helpers/reflect.d.cts +0 -46
- package/dist/helpers/reflect.d.mts +0 -46
- package/dist/helpers/reflect.mjs +0 -103
- package/dist/helpers/source-file-env.cjs +0 -28
- package/dist/helpers/source-file-env.d.cts +0 -8
- package/dist/helpers/source-file-env.d.mts +0 -8
- package/dist/helpers/source-file-env.mjs +0 -26
- package/dist/helpers/template-helpers.cjs +0 -42
- package/dist/helpers/template-helpers.d.cts +0 -15
- package/dist/helpers/template-helpers.d.mts +0 -15
- package/dist/helpers/template-helpers.mjs +0 -41
- package/dist/plugin-alloy/src/core/components/output.cjs +0 -45
- package/dist/plugin-alloy/src/core/components/output.mjs +0 -44
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
- package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
- package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
- package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
- package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
- package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
- package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
- package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
- package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
- package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
- package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
- package/dist/plugin-alloy/src/index.cjs +0 -93
- package/dist/plugin-alloy/src/index.mjs +0 -91
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
- package/dist/plugin-alloy/src/types/components.d.mts +0 -25
- package/dist/plugin-alloy/src/types/index.d.mts +0 -2
- package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
- package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -57
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -25
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -56
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -126
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -124
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -442
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -27
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -28
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -433
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -194
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -14
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -15
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -191
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -68
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -11
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -12
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -67
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
- package/dist/plugin-automd/src/index.cjs +0 -101
- package/dist/plugin-automd/src/index.mjs +0 -98
- package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
- package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
- package/dist/plugin-automd/src/types/toc.d.cts +0 -33
- package/dist/plugin-automd/src/types/toc.d.mts +0 -33
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
- package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
- package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
- package/dist/plugin-babel/src/helpers/index.cjs +0 -5
- package/dist/plugin-babel/src/helpers/index.mjs +0 -7
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
- package/dist/plugin-babel/src/helpers/options.cjs +0 -50
- package/dist/plugin-babel/src/helpers/options.mjs +0 -47
- package/dist/plugin-babel/src/index.cjs +0 -91
- package/dist/plugin-babel/src/index.mjs +0 -89
- package/dist/plugin-babel/src/types/index.d.mts +0 -1
- package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
- package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
- package/dist/powerlines/schemas/fs.d.mts +0 -1
- package/dist/powerlines/src/api.d.mts +0 -7
- package/dist/powerlines/src/index.d.mts +0 -12
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -5
- package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
- package/dist/powerlines/src/lib/entry.cjs +0 -12
- package/dist/powerlines/src/lib/entry.mjs +0 -14
- package/dist/powerlines/src/lib/logger.cjs +0 -41
- package/dist/powerlines/src/lib/logger.mjs +0 -39
- package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
- package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
- package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
- package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
- package/dist/powerlines/src/types/api.d.mts +0 -5
- package/dist/powerlines/src/types/babel.d.cts +0 -23
- package/dist/powerlines/src/types/babel.d.mts +0 -23
- package/dist/powerlines/src/types/build.d.cts +0 -145
- package/dist/powerlines/src/types/build.d.mts +0 -147
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/config.d.cts +0 -380
- package/dist/powerlines/src/types/config.d.mts +0 -381
- package/dist/powerlines/src/types/context.d.cts +0 -414
- package/dist/powerlines/src/types/context.d.mts +0 -416
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.mts +0 -2
- package/dist/powerlines/src/types/index.d.mts +0 -12
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/resolved.d.cts +0 -82
- package/dist/powerlines/src/types/resolved.d.mts +0 -83
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
- package/dist/powerlines/src/types/unplugin.d.mts +0 -7
package/dist/helpers/reflect.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { type_exports } from "../deepkit/src/vendor/type.mjs";
|
|
2
|
-
import { reflectType } from "../deepkit/src/reflect-type.mjs";
|
|
3
|
-
import { getEnvDefaultTypeDefinition, getSecretsDefaultTypeDefinition, readEnvTypeReflection, readSecretsReflection } from "./persistence.mjs";
|
|
4
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
5
|
-
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
6
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
7
|
-
|
|
8
|
-
//#region src/helpers/reflect.ts
|
|
9
|
-
function mergeEnvReflections(context, reflections) {
|
|
10
|
-
return createEnvReflection(context, { type: (0, type_exports.merge)(reflections.map((reflection) => reflection.type)) });
|
|
11
|
-
}
|
|
12
|
-
function mergeSecretsReflections(context, reflections) {
|
|
13
|
-
return createSecretsReflection(context, { type: (0, type_exports.merge)(reflections.map((reflection) => reflection.type)) });
|
|
14
|
-
}
|
|
15
|
-
var BaseEnv = class {
|
|
16
|
-
PLATFORM = "neutral";
|
|
17
|
-
MODE = "production";
|
|
18
|
-
DEBUG = false;
|
|
19
|
-
TEST = false;
|
|
20
|
-
MINIMAL = false;
|
|
21
|
-
NO_COLOR = false;
|
|
22
|
-
FORCE_COLOR = false;
|
|
23
|
-
FORCE_HYPERLINK = false;
|
|
24
|
-
STACKTRACE = false;
|
|
25
|
-
INCLUDE_ERROR_DATA = false;
|
|
26
|
-
CI = false;
|
|
27
|
-
};
|
|
28
|
-
var BaseSecrets = class {};
|
|
29
|
-
function createEnvReflection(context, options = {}) {
|
|
30
|
-
const parent = options.superReflection ?? new type_exports.ReflectionClass({
|
|
31
|
-
kind: type_exports.ReflectionKind.class,
|
|
32
|
-
description: `The base environment configuration definition for the ${titleCase(context.config.name)} project.`,
|
|
33
|
-
classType: BaseEnv,
|
|
34
|
-
types: [],
|
|
35
|
-
implements: [{
|
|
36
|
-
kind: type_exports.ReflectionKind.objectLiteral,
|
|
37
|
-
typeName: "EnvInterface",
|
|
38
|
-
description: `The environment configuration interface definition for the ${titleCase(context.config.name)} project.`,
|
|
39
|
-
types: []
|
|
40
|
-
}]
|
|
41
|
-
});
|
|
42
|
-
parent.name = "Env";
|
|
43
|
-
const result = new type_exports.ReflectionClass(options.type ?? {
|
|
44
|
-
kind: type_exports.ReflectionKind.objectLiteral,
|
|
45
|
-
typeName: "Env",
|
|
46
|
-
description: `A schema describing the list of available environment variables that can be used by the ${context.config.name ? `${titleCase(context.config.name)} application` : "application"}.`,
|
|
47
|
-
types: []
|
|
48
|
-
}, parent);
|
|
49
|
-
result.name = "Env";
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
function createSecretsReflection(context, options = {}) {
|
|
53
|
-
const parent = options.superReflection ?? new type_exports.ReflectionClass({
|
|
54
|
-
kind: type_exports.ReflectionKind.class,
|
|
55
|
-
description: `The base secrets configuration definition for the ${titleCase(context.config.name)} project.`,
|
|
56
|
-
classType: BaseSecrets,
|
|
57
|
-
types: [],
|
|
58
|
-
implements: [{
|
|
59
|
-
kind: type_exports.ReflectionKind.objectLiteral,
|
|
60
|
-
typeName: "SecretsInterface",
|
|
61
|
-
description: `The secrets configuration interface definition for the ${titleCase(context.config.name)} project.`,
|
|
62
|
-
types: []
|
|
63
|
-
}]
|
|
64
|
-
});
|
|
65
|
-
parent.name = "Secrets";
|
|
66
|
-
const result = new type_exports.ReflectionClass(options.type ?? {
|
|
67
|
-
kind: type_exports.ReflectionKind.objectLiteral,
|
|
68
|
-
typeName: "Secrets",
|
|
69
|
-
description: `A schema describing the list of available environment secrets that can be used by the ${context.config.name ? `${titleCase(context.config.name)} application` : "application"}.`,
|
|
70
|
-
types: []
|
|
71
|
-
}, parent);
|
|
72
|
-
result.name = "Secrets";
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
async function reflectEnv(context, file, name) {
|
|
76
|
-
let config;
|
|
77
|
-
if (file) config = (0, type_exports.resolveClassType)(await reflectType(context, {
|
|
78
|
-
file: !isParentPath(file, context.workspaceConfig.workspaceRoot) ? joinPaths(context.workspaceConfig.workspaceRoot, file) : file,
|
|
79
|
-
name
|
|
80
|
-
}, { skipNodeModulesBundle: true }));
|
|
81
|
-
const defaultConfigType = await reflectType(context, await getEnvDefaultTypeDefinition(context));
|
|
82
|
-
return mergeEnvReflections(context, [
|
|
83
|
-
await readEnvTypeReflection(context, "env"),
|
|
84
|
-
config,
|
|
85
|
-
(0, type_exports.resolveClassType)(defaultConfigType)
|
|
86
|
-
].filter(Boolean));
|
|
87
|
-
}
|
|
88
|
-
async function reflectSecrets(context, file, name) {
|
|
89
|
-
let config;
|
|
90
|
-
if (file) config = (0, type_exports.resolveClassType)(await reflectType(context, {
|
|
91
|
-
file: !isParentPath(file, context.workspaceConfig.workspaceRoot) ? joinPaths(context.workspaceConfig.workspaceRoot, file) : file,
|
|
92
|
-
name
|
|
93
|
-
}, { skipNodeModulesBundle: true }));
|
|
94
|
-
const defaultSecretsType = await reflectType(context, await getSecretsDefaultTypeDefinition(context));
|
|
95
|
-
return mergeSecretsReflections(context, [
|
|
96
|
-
await readSecretsReflection(context),
|
|
97
|
-
config,
|
|
98
|
-
(0, type_exports.resolveClassType)(defaultSecretsType)
|
|
99
|
-
].filter(Boolean));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
export { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
3
|
-
let __stryke_env_types = require("@stryke/env/types");
|
|
4
|
-
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/source-file-env.ts
|
|
7
|
-
function removeEnvPrefix(env) {
|
|
8
|
-
if ((0, __stryke_type_checks_is_string.isString)(env)) {
|
|
9
|
-
let name = __stryke_env_types.ENV_PREFIXES.reduce((ret, prefix) => {
|
|
10
|
-
if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
|
|
11
|
-
return ret;
|
|
12
|
-
}, env.toUpperCase());
|
|
13
|
-
while (name.startsWith("_")) name = name.slice(1);
|
|
14
|
-
return name;
|
|
15
|
-
}
|
|
16
|
-
return Object.keys(env).reduce((ret, key) => {
|
|
17
|
-
const name = removeEnvPrefix(key);
|
|
18
|
-
if (name) ret[name] = env[key];
|
|
19
|
-
return ret;
|
|
20
|
-
}, {});
|
|
21
|
-
}
|
|
22
|
-
function formatEnvField(key) {
|
|
23
|
-
return (0, __stryke_string_format_camel_case.camelCase)(removeEnvPrefix(key));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
exports.formatEnvField = formatEnvField;
|
|
28
|
-
exports.removeEnvPrefix = removeEnvPrefix;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DotenvParseOutput } from "@stryke/env/types";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/source-file-env.d.ts
|
|
4
|
-
type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
|
|
5
|
-
declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
|
|
6
|
-
declare function formatEnvField(key: string): string;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { formatEnvField, removeEnvPrefix };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DotenvParseOutput } from "@stryke/env/types";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/source-file-env.d.ts
|
|
4
|
-
type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
|
|
5
|
-
declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
|
|
6
|
-
declare function formatEnvField(key: string): string;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { formatEnvField, removeEnvPrefix };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
2
|
-
import { ENV_PREFIXES } from "@stryke/env/types";
|
|
3
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/source-file-env.ts
|
|
6
|
-
function removeEnvPrefix(env) {
|
|
7
|
-
if (isString(env)) {
|
|
8
|
-
let name = ENV_PREFIXES.reduce((ret, prefix) => {
|
|
9
|
-
if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
|
|
10
|
-
return ret;
|
|
11
|
-
}, env.toUpperCase());
|
|
12
|
-
while (name.startsWith("_")) name = name.slice(1);
|
|
13
|
-
return name;
|
|
14
|
-
}
|
|
15
|
-
return Object.keys(env).reduce((ret, key) => {
|
|
16
|
-
const name = removeEnvPrefix(key);
|
|
17
|
-
if (name) ret[name] = env[key];
|
|
18
|
-
return ret;
|
|
19
|
-
}, {});
|
|
20
|
-
}
|
|
21
|
-
function formatEnvField(key) {
|
|
22
|
-
return camelCase(removeEnvPrefix(key));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { formatEnvField, removeEnvPrefix };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_persistence = require('./persistence.cjs');
|
|
3
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/template-helpers.ts
|
|
6
|
-
/**
|
|
7
|
-
* Creates the reflection data used when generating runtime template files.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context for the configuration plugin.
|
|
10
|
-
* @param name - The name of the configuration template.
|
|
11
|
-
* @returns The reflection for the specified configuration template.
|
|
12
|
-
*/
|
|
13
|
-
async function createTemplateReflection(context, name) {
|
|
14
|
-
const reflection = await require_persistence.readEnvTypeReflection(context, name);
|
|
15
|
-
reflection.getProperties().forEach((prop) => {
|
|
16
|
-
prop.getAlias().filter(Boolean).forEach((alias) => {
|
|
17
|
-
reflection.addProperty({
|
|
18
|
-
name: alias,
|
|
19
|
-
optional: prop.isOptional() ? true : void 0,
|
|
20
|
-
readonly: prop.isReadonly() ? true : void 0,
|
|
21
|
-
description: prop.getDescription(),
|
|
22
|
-
visibility: prop.getVisibility(),
|
|
23
|
-
type: prop.getType(),
|
|
24
|
-
default: prop.getDefaultValue(),
|
|
25
|
-
tags: {
|
|
26
|
-
hidden: prop.isHidden(),
|
|
27
|
-
ignore: prop.isIgnored(),
|
|
28
|
-
internal: prop.isInternal(),
|
|
29
|
-
alias: prop.getAlias().filter((a) => a !== alias).concat(prop.name),
|
|
30
|
-
title: prop.getTitle() || (0, __stryke_string_format_title_case.titleCase)(prop.name),
|
|
31
|
-
readonly: prop.isReadonly(),
|
|
32
|
-
permission: prop.getPermission(),
|
|
33
|
-
domain: prop.getDomain()
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
return reflection;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
42
|
-
exports.createTemplateReflection = createTemplateReflection;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type_d_exports } from "../deepkit/src/vendor/type.cjs";
|
|
2
|
-
import { EnvPluginContext, EnvType } from "../types/plugin.cjs";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/template-helpers.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Creates the reflection data used when generating runtime template files.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context for the configuration plugin.
|
|
10
|
-
* @param name - The name of the configuration template.
|
|
11
|
-
* @returns The reflection for the specified configuration template.
|
|
12
|
-
*/
|
|
13
|
-
declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<type_d_exports.ReflectionClass<any>>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { createTemplateReflection };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type_d_exports } from "../deepkit/src/vendor/type.mjs";
|
|
2
|
-
import { EnvPluginContext, EnvType } from "../types/plugin.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/template-helpers.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Creates the reflection data used when generating runtime template files.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context for the configuration plugin.
|
|
10
|
-
* @param name - The name of the configuration template.
|
|
11
|
-
* @returns The reflection for the specified configuration template.
|
|
12
|
-
*/
|
|
13
|
-
declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<type_d_exports.ReflectionClass<any>>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { createTemplateReflection };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { readEnvTypeReflection } from "./persistence.mjs";
|
|
2
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/template-helpers.ts
|
|
5
|
-
/**
|
|
6
|
-
* Creates the reflection data used when generating runtime template files.
|
|
7
|
-
*
|
|
8
|
-
* @param context - The context for the configuration plugin.
|
|
9
|
-
* @param name - The name of the configuration template.
|
|
10
|
-
* @returns The reflection for the specified configuration template.
|
|
11
|
-
*/
|
|
12
|
-
async function createTemplateReflection(context, name) {
|
|
13
|
-
const reflection = await readEnvTypeReflection(context, name);
|
|
14
|
-
reflection.getProperties().forEach((prop) => {
|
|
15
|
-
prop.getAlias().filter(Boolean).forEach((alias) => {
|
|
16
|
-
reflection.addProperty({
|
|
17
|
-
name: alias,
|
|
18
|
-
optional: prop.isOptional() ? true : void 0,
|
|
19
|
-
readonly: prop.isReadonly() ? true : void 0,
|
|
20
|
-
description: prop.getDescription(),
|
|
21
|
-
visibility: prop.getVisibility(),
|
|
22
|
-
type: prop.getType(),
|
|
23
|
-
default: prop.getDefaultValue(),
|
|
24
|
-
tags: {
|
|
25
|
-
hidden: prop.isHidden(),
|
|
26
|
-
ignore: prop.isIgnored(),
|
|
27
|
-
internal: prop.isInternal(),
|
|
28
|
-
alias: prop.getAlias().filter((a) => a !== alias).concat(prop.name),
|
|
29
|
-
title: prop.getTitle() || titleCase(prop.name),
|
|
30
|
-
readonly: prop.isReadonly(),
|
|
31
|
-
permission: prop.getPermission(),
|
|
32
|
-
domain: prop.getDomain()
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
return reflection;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { createTemplateReflection };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_context = require('../contexts/context.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 __stryke_path_replace = require("@stryke/path/replace");
|
|
6
|
-
|
|
7
|
-
//#region ../plugin-alloy/src/core/components/output.tsx
|
|
8
|
-
/**
|
|
9
|
-
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
10
|
-
*/
|
|
11
|
-
function Output(props) {
|
|
12
|
-
const [{ children, context, meta, basePath }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
13
|
-
"children",
|
|
14
|
-
"context",
|
|
15
|
-
"meta",
|
|
16
|
-
"basePath"
|
|
17
|
-
]);
|
|
18
|
-
const contextRef = (0, __alloy_js_core.ref)(context);
|
|
19
|
-
const metaRef = (0, __alloy_js_core.ref)(meta ?? {});
|
|
20
|
-
const basePathRef = (0, __alloy_js_core.computed)(() => basePath ? (0, __stryke_path_replace.replacePath)(basePath, contextRef.value.workspaceConfig.workspaceRoot) : contextRef.value.workspaceConfig.workspaceRoot);
|
|
21
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Output, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
22
|
-
get basePath() {
|
|
23
|
-
return basePathRef.value;
|
|
24
|
-
},
|
|
25
|
-
get children() {
|
|
26
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_context.PowerlinesContext.Provider, {
|
|
27
|
-
value: {
|
|
28
|
-
ref: contextRef,
|
|
29
|
-
meta: metaRef
|
|
30
|
-
},
|
|
31
|
-
get children() {
|
|
32
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
33
|
-
get when() {
|
|
34
|
-
return Boolean(contextRef.value);
|
|
35
|
-
},
|
|
36
|
-
children
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.Output = Output;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { PowerlinesContext } from "../contexts/context.mjs";
|
|
2
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Output, Show, computed, ref, splitProps } from "@alloy-js/core";
|
|
4
|
-
import { replacePath } from "@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$1(props) {
|
|
11
|
-
const [{ children, context, meta, basePath }, rest] = splitProps(props, [
|
|
12
|
-
"children",
|
|
13
|
-
"context",
|
|
14
|
-
"meta",
|
|
15
|
-
"basePath"
|
|
16
|
-
]);
|
|
17
|
-
const contextRef = ref(context);
|
|
18
|
-
const metaRef = ref(meta ?? {});
|
|
19
|
-
const basePathRef = computed(() => basePath ? replacePath(basePath, contextRef.value.workspaceConfig.workspaceRoot) : contextRef.value.workspaceConfig.workspaceRoot);
|
|
20
|
-
return createComponent(Output, mergeProps(rest, {
|
|
21
|
-
get basePath() {
|
|
22
|
-
return basePathRef.value;
|
|
23
|
-
},
|
|
24
|
-
get children() {
|
|
25
|
-
return createComponent(PowerlinesContext.Provider, {
|
|
26
|
-
value: {
|
|
27
|
-
ref: contextRef,
|
|
28
|
-
meta: metaRef
|
|
29
|
-
},
|
|
30
|
-
get children() {
|
|
31
|
-
return createComponent(Show, {
|
|
32
|
-
get when() {
|
|
33
|
-
return Boolean(contextRef.value);
|
|
34
|
-
},
|
|
35
|
-
children
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { Output$1 as Output };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-alloy/src/core/components/single-line-comment.tsx
|
|
6
|
-
/**
|
|
7
|
-
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
8
|
-
* are broken into multiple lines
|
|
9
|
-
*/
|
|
10
|
-
function SingleLineComment(props) {
|
|
11
|
-
const { variant = "double-slash", children } = props;
|
|
12
|
-
const commentStart = variant === "slash-star" ? "/* " : variant === "slash-star-star" ? "/** " : variant === "triple-slash" ? "/// " : variant === "markdown" ? "<!-- " : "// ";
|
|
13
|
-
return [commentStart, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
|
|
14
|
-
string: commentStart,
|
|
15
|
-
get children() {
|
|
16
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Prose, { children }), variant === "slash-star" || variant === "slash-star-star" ? " */ " : variant === "markdown" ? " -->" : ""];
|
|
17
|
-
}
|
|
18
|
-
})];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
exports.SingleLineComment = SingleLineComment;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Prose } from "@alloy-js/core";
|
|
3
|
-
|
|
4
|
-
//#region ../plugin-alloy/src/core/components/single-line-comment.tsx
|
|
5
|
-
/**
|
|
6
|
-
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
7
|
-
* are broken into multiple lines
|
|
8
|
-
*/
|
|
9
|
-
function SingleLineComment(props) {
|
|
10
|
-
const { variant = "double-slash", children } = props;
|
|
11
|
-
const commentStart = variant === "slash-star" ? "/* " : variant === "slash-star-star" ? "/** " : variant === "triple-slash" ? "/// " : variant === "markdown" ? "<!-- " : "// ";
|
|
12
|
-
return [commentStart, createIntrinsic("align", {
|
|
13
|
-
string: commentStart,
|
|
14
|
-
get children() {
|
|
15
|
-
return [createComponent(Prose, { children }), variant === "slash-star" || variant === "slash-star-star" ? " */ " : variant === "markdown" ? " -->" : ""];
|
|
16
|
-
}
|
|
17
|
-
})];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { SingleLineComment };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_context = require('../contexts/context.cjs');
|
|
3
|
-
require('../contexts/index.cjs');
|
|
4
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
7
|
-
let defu = require("defu");
|
|
8
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
9
|
-
|
|
10
|
-
//#region ../plugin-alloy/src/core/components/source-file.tsx
|
|
11
|
-
/**
|
|
12
|
-
* A base component representing a Powerlines generated source file.
|
|
13
|
-
*
|
|
14
|
-
* @param props - The properties for the source file.
|
|
15
|
-
* @returns The rendered source file component.
|
|
16
|
-
*/
|
|
17
|
-
function SourceFile(props) {
|
|
18
|
-
const [{ children, meta, path, header, storage, filetype, reference }] = (0, __alloy_js_core.splitProps)(props, [
|
|
19
|
-
"children",
|
|
20
|
-
"meta",
|
|
21
|
-
"path",
|
|
22
|
-
"header",
|
|
23
|
-
"storage",
|
|
24
|
-
"filetype",
|
|
25
|
-
"reference"
|
|
26
|
-
]);
|
|
27
|
-
const metadata = require_context.useMeta();
|
|
28
|
-
const parentDirectory = (0, __alloy_js_core.useContext)(__alloy_js_core.SourceDirectoryContext);
|
|
29
|
-
const sourceFile = {
|
|
30
|
-
path: (0, __stryke_path_append.appendPath)(path, parentDirectory.path),
|
|
31
|
-
filetype,
|
|
32
|
-
reference
|
|
33
|
-
};
|
|
34
|
-
parentDirectory?.addContent(sourceFile);
|
|
35
|
-
const printOptions = (0, __alloy_js_core.useFormatOptions)({
|
|
36
|
-
printWidth: props.printWidth,
|
|
37
|
-
tabWidth: props.tabWidth,
|
|
38
|
-
useTabs: props.useTabs,
|
|
39
|
-
insertFinalNewLine: props.insertFinalNewLine
|
|
40
|
-
});
|
|
41
|
-
const nodeContext = (0, __alloy_js_core.getContext)();
|
|
42
|
-
nodeContext.meta = (0, defu.default)({
|
|
43
|
-
sourceFile,
|
|
44
|
-
printOptions
|
|
45
|
-
}, meta ?? {});
|
|
46
|
-
metadata[sourceFile.path] = {
|
|
47
|
-
storage,
|
|
48
|
-
...meta ?? {}
|
|
49
|
-
};
|
|
50
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.SourceFileContext.Provider, {
|
|
51
|
-
value: sourceFile,
|
|
52
|
-
get children() {
|
|
53
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
54
|
-
when: header !== void 0,
|
|
55
|
-
get children() {
|
|
56
|
-
return [header, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
57
|
-
}
|
|
58
|
-
}), children];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//#endregion
|
|
64
|
-
exports.SourceFile = SourceFile;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StoragePreset } from "../../../../powerlines/src/types/fs.cjs";
|
|
2
|
-
import { ComponentProps } from "../../types/components.cjs";
|
|
3
|
-
import { SourceFileProps } from "@alloy-js/core";
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-alloy/src/core/components/source-file.d.ts
|
|
6
|
-
type SourceFileProps$1 = SourceFileProps & ComponentProps & {
|
|
7
|
-
/**
|
|
8
|
-
* The storage preset for the output files.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* If not specified, the output mode will be determined by the provided `output.mode` value.
|
|
12
|
-
*/
|
|
13
|
-
storage?: StoragePreset;
|
|
14
|
-
/**
|
|
15
|
-
* The metadata associated with the source file.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* The values stored in the metadata will be available in the rendering context.
|
|
19
|
-
*/
|
|
20
|
-
meta?: Record<string, any>;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { SourceFileProps$1 as SourceFileProps };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StoragePreset } from "../../../../powerlines/src/types/fs.mjs";
|
|
2
|
-
import { ComponentProps } from "../../types/components.mjs";
|
|
3
|
-
import { SourceFileProps } from "@alloy-js/core";
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-alloy/src/core/components/source-file.d.ts
|
|
6
|
-
type SourceFileProps$1 = SourceFileProps & ComponentProps & {
|
|
7
|
-
/**
|
|
8
|
-
* The storage preset for the output files.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* If not specified, the output mode will be determined by the provided `output.mode` value.
|
|
12
|
-
*/
|
|
13
|
-
storage?: StoragePreset;
|
|
14
|
-
/**
|
|
15
|
-
* The metadata associated with the source file.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* The values stored in the metadata will be available in the rendering context.
|
|
19
|
-
*/
|
|
20
|
-
meta?: Record<string, any>;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { SourceFileProps$1 as SourceFileProps };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { useMeta } from "../contexts/context.mjs";
|
|
2
|
-
import "../contexts/index.mjs";
|
|
3
|
-
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { Show, SourceDirectoryContext, SourceFileContext, getContext, splitProps, useContext, useFormatOptions } from "@alloy-js/core";
|
|
5
|
-
import { appendPath } from "@stryke/path/append";
|
|
6
|
-
import defu from "defu";
|
|
7
|
-
|
|
8
|
-
//#region ../plugin-alloy/src/core/components/source-file.tsx
|
|
9
|
-
/**
|
|
10
|
-
* A base component representing a Powerlines generated source file.
|
|
11
|
-
*
|
|
12
|
-
* @param props - The properties for the source file.
|
|
13
|
-
* @returns The rendered source file component.
|
|
14
|
-
*/
|
|
15
|
-
function SourceFile(props) {
|
|
16
|
-
const [{ children, meta, path, header, storage, filetype, reference }] = splitProps(props, [
|
|
17
|
-
"children",
|
|
18
|
-
"meta",
|
|
19
|
-
"path",
|
|
20
|
-
"header",
|
|
21
|
-
"storage",
|
|
22
|
-
"filetype",
|
|
23
|
-
"reference"
|
|
24
|
-
]);
|
|
25
|
-
const metadata = useMeta();
|
|
26
|
-
const parentDirectory = useContext(SourceDirectoryContext);
|
|
27
|
-
const sourceFile = {
|
|
28
|
-
path: appendPath(path, parentDirectory.path),
|
|
29
|
-
filetype,
|
|
30
|
-
reference
|
|
31
|
-
};
|
|
32
|
-
parentDirectory?.addContent(sourceFile);
|
|
33
|
-
const printOptions = useFormatOptions({
|
|
34
|
-
printWidth: props.printWidth,
|
|
35
|
-
tabWidth: props.tabWidth,
|
|
36
|
-
useTabs: props.useTabs,
|
|
37
|
-
insertFinalNewLine: props.insertFinalNewLine
|
|
38
|
-
});
|
|
39
|
-
const nodeContext = getContext();
|
|
40
|
-
nodeContext.meta = defu({
|
|
41
|
-
sourceFile,
|
|
42
|
-
printOptions
|
|
43
|
-
}, meta ?? {});
|
|
44
|
-
metadata[sourceFile.path] = {
|
|
45
|
-
storage,
|
|
46
|
-
...meta ?? {}
|
|
47
|
-
};
|
|
48
|
-
return createComponent(SourceFileContext.Provider, {
|
|
49
|
-
value: sourceFile,
|
|
50
|
-
get children() {
|
|
51
|
-
return [createComponent(Show, {
|
|
52
|
-
when: header !== void 0,
|
|
53
|
-
get children() {
|
|
54
|
-
return [header, createIntrinsic("hbr", {})];
|
|
55
|
-
}
|
|
56
|
-
}), children];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
//#endregion
|
|
62
|
-
export { SourceFile };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
3
|
-
|
|
4
|
-
//#region ../plugin-alloy/src/core/contexts/context.ts
|
|
5
|
-
/**
|
|
6
|
-
* The Powerlines context used in template rendering.
|
|
7
|
-
*/
|
|
8
|
-
const PowerlinesContext = (0, __alloy_js_core.createNamedContext)("powerlines");
|
|
9
|
-
/**
|
|
10
|
-
* Hook to access the Powerlines Context.
|
|
11
|
-
*
|
|
12
|
-
* @returns The Context.
|
|
13
|
-
*/
|
|
14
|
-
function usePowerlinesContext() {
|
|
15
|
-
return (0, __alloy_js_core.useContext)(PowerlinesContext);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
19
|
-
*
|
|
20
|
-
* @returns The Powerlines context or undefined if not set.
|
|
21
|
-
*/
|
|
22
|
-
function usePowerlinesSafe() {
|
|
23
|
-
return usePowerlinesContext()?.ref?.value;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
27
|
-
*
|
|
28
|
-
* @returns The Powerlines context.
|
|
29
|
-
*/
|
|
30
|
-
function usePowerlines() {
|
|
31
|
-
const powerlines = usePowerlinesSafe();
|
|
32
|
-
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`.");
|
|
33
|
-
return powerlines;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Hook to safely access the render context's metadata.
|
|
37
|
-
*
|
|
38
|
-
* @returns The Powerlines context or undefined if not set.
|
|
39
|
-
*/
|
|
40
|
-
function useMetaSafe() {
|
|
41
|
-
return usePowerlinesContext()?.meta?.value;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Hook to access the render context's metadata.
|
|
45
|
-
*
|
|
46
|
-
* @returns The Powerlines context.
|
|
47
|
-
*/
|
|
48
|
-
function useMeta() {
|
|
49
|
-
const meta = useMetaSafe();
|
|
50
|
-
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`.");
|
|
51
|
-
return meta;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
exports.PowerlinesContext = PowerlinesContext;
|
|
56
|
-
exports.useMeta = useMeta;
|
|
57
|
-
exports.useMetaSafe = useMetaSafe;
|
|
58
|
-
exports.usePowerlines = usePowerlines;
|
|
59
|
-
exports.usePowerlinesContext = usePowerlinesContext;
|
|
60
|
-
exports.usePowerlinesSafe = usePowerlinesSafe;
|