@powerlines/plugin-nodejs 0.1.117 → 0.1.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/env.cjs +14 -14
- package/dist/components/env.d.cts +1 -1
- package/dist/components/env.d.mts +1 -1
- package/dist/components/env.mjs +6 -6
- package/dist/index.cjs +8 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +5 -5
- package/dist/types/plugin.d.cts +2 -2
- package/dist/types/plugin.d.mts +2 -2
- package/package.json +6 -6
- package/dist/deepkit/schemas/reflection.cjs +0 -3998
- package/dist/deepkit/schemas/reflection.d.cts +0 -1560
- package/dist/deepkit/schemas/reflection.d.mts +0 -1560
- package/dist/deepkit/schemas/reflection.mjs +0 -3996
- 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 -67
- package/dist/deepkit/src/utilities.mjs +0 -66
- package/dist/plugin-alloy/src/core/components/output.cjs +0 -43
- package/dist/plugin-alloy/src/core/components/output.mjs +0 -42
- 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 -49
- package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -44
- 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 -105
- package/dist/plugin-alloy/src/index.mjs +0 -103
- 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.cts +0 -20
- package/dist/plugin-alloy/src/types/components.d.mts +0 -21
- package/dist/plugin-alloy/src/types/index.d.cts +0 -2
- package/dist/plugin-alloy/src/types/index.d.mts +0 -2
- package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
- package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -62
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -26
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -61
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -131
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -129
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -451
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -37
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -37
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -442
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -216
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -16
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -16
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -213
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -72
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -4
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -4
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -71
- 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 -49
- package/dist/plugin-babel/src/helpers/options.mjs +0 -46
- package/dist/plugin-babel/src/index.cjs +0 -85
- package/dist/plugin-babel/src/index.mjs +0 -83
- 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/plugin-env/src/babel/index.cjs +0 -1
- package/dist/plugin-env/src/babel/index.mjs +0 -3
- package/dist/plugin-env/src/babel/plugin.cjs +0 -70
- package/dist/plugin-env/src/babel/plugin.mjs +0 -69
- package/dist/plugin-env/src/components/docs.cjs +0 -70
- package/dist/plugin-env/src/components/docs.mjs +0 -69
- package/dist/plugin-env/src/components/env.cjs +0 -589
- package/dist/plugin-env/src/components/env.d.cts +0 -11
- package/dist/plugin-env/src/components/env.d.mts +0 -11
- package/dist/plugin-env/src/components/env.mjs +0 -586
- package/dist/plugin-env/src/components/index.cjs +0 -2
- package/dist/plugin-env/src/components/index.mjs +0 -4
- package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
- package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
- package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
- package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
- package/dist/plugin-env/src/helpers/index.cjs +0 -6
- package/dist/plugin-env/src/helpers/index.mjs +0 -8
- package/dist/plugin-env/src/helpers/load.cjs +0 -84
- package/dist/plugin-env/src/helpers/load.mjs +0 -81
- package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
- package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
- package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
- package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
- package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
- package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
- package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
- package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
- package/dist/plugin-env/src/index.cjs +0 -177
- package/dist/plugin-env/src/index.mjs +0 -175
- package/dist/plugin-env/src/types/plugin.d.cts +0 -149
- package/dist/plugin-env/src/types/plugin.d.mts +0 -150
- package/dist/plugin-env/src/types/runtime.d.cts +0 -789
- package/dist/plugin-env/src/types/runtime.d.mts +0 -789
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
- package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
- package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
- package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
- package/dist/powerlines/src/lib/entry.cjs +0 -11
- package/dist/powerlines/src/lib/entry.mjs +0 -13
- package/dist/powerlines/src/lib/logger.cjs +0 -41
- package/dist/powerlines/src/lib/logger.mjs +0 -39
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -38
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -35
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
- package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
- package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
- package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
- package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
- package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
- package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
- 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.cts +0 -104
- package/dist/powerlines/src/types/api.d.mts +0 -104
- package/dist/powerlines/src/types/babel.d.cts +0 -22
- package/dist/powerlines/src/types/babel.d.mts +0 -22
- package/dist/powerlines/src/types/build.cjs +0 -21
- package/dist/powerlines/src/types/build.d.cts +0 -185
- package/dist/powerlines/src/types/build.d.mts +0 -185
- package/dist/powerlines/src/types/build.mjs +0 -21
- 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 -435
- package/dist/powerlines/src/types/config.d.mts +0 -436
- package/dist/powerlines/src/types/context.d.cts +0 -514
- package/dist/powerlines/src/types/context.d.mts +0 -514
- 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.cts +0 -32
- package/dist/powerlines/src/types/hooks.d.mts +0 -32
- package/dist/powerlines/src/types/plugin.d.cts +0 -205
- package/dist/powerlines/src/types/plugin.d.mts +0 -205
- package/dist/powerlines/src/types/resolved.d.cts +0 -94
- package/dist/powerlines/src/types/resolved.d.mts +0 -94
- 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.cts +0 -22
- package/dist/powerlines/src/types/unplugin.d.mts +0 -23
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { getPluginName } from "./filters.mjs";
|
|
2
|
-
import { isFunction } from "@stryke/type-checks/is-function";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-babel/src/helpers/options.ts
|
|
6
|
-
function resolvePluginFunction(context, plugin) {
|
|
7
|
-
try {
|
|
8
|
-
return Array.isArray(plugin) && plugin.length > 0 && plugin[0] ? isFunction(plugin[0]) ? plugin[0](context) : plugin[0] : isFunction(plugin) ? plugin(context) : plugin;
|
|
9
|
-
} catch {
|
|
10
|
-
return plugin[0];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
15
|
-
*
|
|
16
|
-
* @param context - The context for the transformation.
|
|
17
|
-
* @param code - The code to be transformed.
|
|
18
|
-
* @param id - The ID of the source file.
|
|
19
|
-
* @param plugin - The Babel plugin to resolve.
|
|
20
|
-
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
21
|
-
*/
|
|
22
|
-
function resolveBabelPlugin(context, code, id, plugin) {
|
|
23
|
-
if (Array.isArray(plugin) && plugin.length > 0 && plugin[0]) {
|
|
24
|
-
if (plugin.length > 2 && plugin[2] && isFunction(plugin[2]) && !plugin[2](code, id)) {
|
|
25
|
-
context.trace(`Skipping filtered Babel plugin ${chalk.bold.cyanBright(getPluginName(plugin) || "unnamed")} for ${id}`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
return plugin.length > 2 ? [
|
|
29
|
-
resolvePluginFunction(context, plugin),
|
|
30
|
-
plugin[1],
|
|
31
|
-
plugin[2]
|
|
32
|
-
] : [
|
|
33
|
-
resolvePluginFunction(context, plugin),
|
|
34
|
-
plugin[1],
|
|
35
|
-
null
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
return [
|
|
39
|
-
resolvePluginFunction(context, plugin),
|
|
40
|
-
{},
|
|
41
|
-
null
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { resolveBabelPlugin, resolvePluginFunction };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_filters = require('./helpers/filters.cjs');
|
|
3
|
-
const require_options = require('./helpers/options.cjs');
|
|
4
|
-
const require_create_plugin = require('./helpers/create-plugin.cjs');
|
|
5
|
-
const require_module_helpers = require('./helpers/module-helpers.cjs');
|
|
6
|
-
require('./helpers/index.cjs');
|
|
7
|
-
let __babel_core = require("@babel/core");
|
|
8
|
-
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
9
|
-
let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
10
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
11
|
-
let defu = require("defu");
|
|
12
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
13
|
-
|
|
14
|
-
//#region ../plugin-babel/src/index.ts
|
|
15
|
-
/**
|
|
16
|
-
* Babel plugin for Powerlines.
|
|
17
|
-
*
|
|
18
|
-
* @param options - The Babel plugin user configuration options.
|
|
19
|
-
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
20
|
-
*/
|
|
21
|
-
const plugin = (options = {}) => {
|
|
22
|
-
return {
|
|
23
|
-
name: "babel",
|
|
24
|
-
config() {
|
|
25
|
-
if (!(0, __stryke_type_checks_is_set_object.isSetObject)(options)) return;
|
|
26
|
-
return { transform: { babel: options } };
|
|
27
|
-
},
|
|
28
|
-
configResolved: {
|
|
29
|
-
order: "pre",
|
|
30
|
-
handler() {
|
|
31
|
-
this.config.transform.babel = (0, defu.default)(this.config.transform.babel ?? {}, {
|
|
32
|
-
plugins: [],
|
|
33
|
-
presets: []
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
async transform(code, id) {
|
|
38
|
-
if ((0, __stryke_path_is_parent_path.isParentPath)(id, this.powerlinesPath) || code.includes("/* @powerlines-ignore */") || code.includes("/* @powerlines-disable */")) {
|
|
39
|
-
this.trace(`Skipping Babel transformation for: ${id}`);
|
|
40
|
-
return {
|
|
41
|
-
code,
|
|
42
|
-
id
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const plugins = this.config.transform.babel.plugins.map((plugin$1) => require_options.resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !require_filters.isDuplicatePlugin(arr, plugin$1));
|
|
46
|
-
const presets = this.config.transform.babel.presets.map((preset) => require_options.resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !require_filters.isDuplicatePlugin(arr, preset));
|
|
47
|
-
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
|
|
48
|
-
code,
|
|
49
|
-
id
|
|
50
|
-
};
|
|
51
|
-
if (/^(?:m|c)?tsx?$/.test((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id, { fullExtension: true })) && !require_filters.isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !require_filters.isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === "tsx" }]);
|
|
52
|
-
this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
|
|
53
|
-
const result = await (0, __babel_core.transformAsync)(code, {
|
|
54
|
-
highlightCode: true,
|
|
55
|
-
code: true,
|
|
56
|
-
ast: false,
|
|
57
|
-
cloneInputAst: false,
|
|
58
|
-
comments: true,
|
|
59
|
-
sourceType: "module",
|
|
60
|
-
configFile: false,
|
|
61
|
-
babelrc: false,
|
|
62
|
-
envName: this.config.mode,
|
|
63
|
-
caller: { name: this.config.framework },
|
|
64
|
-
...this.config.transform.babel ?? {},
|
|
65
|
-
filename: id,
|
|
66
|
-
plugins: plugins.map((plugin$1) => {
|
|
67
|
-
return Array.isArray(plugin$1) && plugin$1.length >= 2 ? [plugin$1[0], (0, defu.default)(plugin$1.length > 1 && plugin$1[1] ? plugin$1[1] : {}, { options })] : plugin$1;
|
|
68
|
-
}).filter(Boolean),
|
|
69
|
-
presets: presets.map((preset) => {
|
|
70
|
-
return Array.isArray(preset) && preset.length >= 2 ? [preset[0], (0, defu.default)(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
|
|
71
|
-
}).filter(Boolean)
|
|
72
|
-
});
|
|
73
|
-
if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
74
|
-
this.trace(`Completed babel transformations for file: ${id}`);
|
|
75
|
-
return {
|
|
76
|
-
code: result.code,
|
|
77
|
-
id
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
var src_default = plugin;
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
exports.default = src_default;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { getPluginName, isDuplicatePlugin } from "./helpers/filters.mjs";
|
|
2
|
-
import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.mjs";
|
|
3
|
-
import { createBabelPlugin } from "./helpers/create-plugin.mjs";
|
|
4
|
-
import { addImport, addImportsToProgram } from "./helpers/module-helpers.mjs";
|
|
5
|
-
import "./helpers/index.mjs";
|
|
6
|
-
import { transformAsync } from "@babel/core";
|
|
7
|
-
import { findFileExtension, findFileExtensionSafe } from "@stryke/path/file-path-fns";
|
|
8
|
-
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
9
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
10
|
-
import defu from "defu";
|
|
11
|
-
|
|
12
|
-
//#region ../plugin-babel/src/index.ts
|
|
13
|
-
/**
|
|
14
|
-
* Babel plugin for Powerlines.
|
|
15
|
-
*
|
|
16
|
-
* @param options - The Babel plugin user configuration options.
|
|
17
|
-
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
18
|
-
*/
|
|
19
|
-
const plugin = (options = {}) => {
|
|
20
|
-
return {
|
|
21
|
-
name: "babel",
|
|
22
|
-
config() {
|
|
23
|
-
if (!isSetObject(options)) return;
|
|
24
|
-
return { transform: { babel: options } };
|
|
25
|
-
},
|
|
26
|
-
configResolved: {
|
|
27
|
-
order: "pre",
|
|
28
|
-
handler() {
|
|
29
|
-
this.config.transform.babel = defu(this.config.transform.babel ?? {}, {
|
|
30
|
-
plugins: [],
|
|
31
|
-
presets: []
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
async transform(code, id) {
|
|
36
|
-
if (isParentPath(id, this.powerlinesPath) || code.includes("/* @powerlines-ignore */") || code.includes("/* @powerlines-disable */")) {
|
|
37
|
-
this.trace(`Skipping Babel transformation for: ${id}`);
|
|
38
|
-
return {
|
|
39
|
-
code,
|
|
40
|
-
id
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const plugins = this.config.transform.babel.plugins.map((plugin$1) => resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !isDuplicatePlugin(arr, plugin$1));
|
|
44
|
-
const presets = this.config.transform.babel.presets.map((preset) => resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset));
|
|
45
|
-
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
|
|
46
|
-
code,
|
|
47
|
-
id
|
|
48
|
-
};
|
|
49
|
-
if (/^(?:m|c)?tsx?$/.test(findFileExtensionSafe(id, { fullExtension: true })) && !isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: findFileExtension(id) === "tsx" }]);
|
|
50
|
-
this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
|
|
51
|
-
const result = await transformAsync(code, {
|
|
52
|
-
highlightCode: true,
|
|
53
|
-
code: true,
|
|
54
|
-
ast: false,
|
|
55
|
-
cloneInputAst: false,
|
|
56
|
-
comments: true,
|
|
57
|
-
sourceType: "module",
|
|
58
|
-
configFile: false,
|
|
59
|
-
babelrc: false,
|
|
60
|
-
envName: this.config.mode,
|
|
61
|
-
caller: { name: this.config.framework },
|
|
62
|
-
...this.config.transform.babel ?? {},
|
|
63
|
-
filename: id,
|
|
64
|
-
plugins: plugins.map((plugin$1) => {
|
|
65
|
-
return Array.isArray(plugin$1) && plugin$1.length >= 2 ? [plugin$1[0], defu(plugin$1.length > 1 && plugin$1[1] ? plugin$1[1] : {}, { options })] : plugin$1;
|
|
66
|
-
}).filter(Boolean),
|
|
67
|
-
presets: presets.map((preset) => {
|
|
68
|
-
return Array.isArray(preset) && preset.length >= 2 ? [preset[0], defu(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
|
|
69
|
-
}).filter(Boolean)
|
|
70
|
-
});
|
|
71
|
-
if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
72
|
-
this.trace(`Completed babel transformations for file: ${id}`);
|
|
73
|
-
return {
|
|
74
|
-
code: result.code,
|
|
75
|
-
id
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
var src_default = plugin;
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
export { src_default as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "./plugin.mjs";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PluginContext } from "../../../powerlines/src/types/context.cjs";
|
|
2
|
-
import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.cjs";
|
|
3
|
-
import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-babel/src/types/plugin.d.ts
|
|
6
|
-
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
7
|
-
type BabelPluginUserConfig = UserConfig;
|
|
8
|
-
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
9
|
-
transform: {
|
|
10
|
-
babel: BabelResolvedConfig;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PluginContext } from "../../../powerlines/src/types/context.mjs";
|
|
2
|
-
import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.mjs";
|
|
3
|
-
import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
|
|
4
|
-
|
|
5
|
-
//#region ../plugin-babel/src/types/plugin.d.ts
|
|
6
|
-
type BabelPluginOptions = Partial<BabelUserConfig>;
|
|
7
|
-
type BabelPluginUserConfig = UserConfig;
|
|
8
|
-
interface BabelPluginResolvedConfig extends ResolvedConfig {
|
|
9
|
-
transform: {
|
|
10
|
-
babel: BabelResolvedConfig;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const require_plugin = require('./plugin.cjs');
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_create_plugin = require('../../../plugin-babel/src/helpers/create-plugin.cjs');
|
|
3
|
-
const require_module_helpers = require('../../../plugin-babel/src/helpers/module-helpers.cjs');
|
|
4
|
-
const require_utilities = require('../../../deepkit/src/utilities.cjs');
|
|
5
|
-
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
|
-
|
|
7
|
-
//#region ../plugin-env/src/babel/plugin.ts
|
|
8
|
-
const envBabelPlugin = require_create_plugin.createBabelPlugin("env", ({ log, context }) => {
|
|
9
|
-
function extractEnv(node, pass, isInjectable = false) {
|
|
10
|
-
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
|
|
11
|
-
if (node.name) {
|
|
12
|
-
const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
|
|
13
|
-
let name = node.name;
|
|
14
|
-
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
15
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
16
|
-
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
|
|
17
|
-
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
|
|
18
|
-
if (!envProperty || envProperty.isIgnored()) return;
|
|
19
|
-
if (!context.env.used.env.hasProperty(name)) {
|
|
20
|
-
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
|
|
21
|
-
context.env.used.env.addProperty(envProperty.property);
|
|
22
|
-
}
|
|
23
|
-
if (context.config.env.inject && isInjectable) {
|
|
24
|
-
let value = context.env.parsed?.[name];
|
|
25
|
-
if (value === void 0) {
|
|
26
|
-
const prefix$1 = context.config.env.prefix.find((pre) => {
|
|
27
|
-
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
28
|
-
});
|
|
29
|
-
if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
|
|
30
|
-
}
|
|
31
|
-
value ??= envProperty.getDefaultValue();
|
|
32
|
-
if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
|
|
33
|
-
return require_utilities.stringifyDefaultValue(envProperty, value);
|
|
34
|
-
}
|
|
35
|
-
} else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
|
|
36
|
-
|
|
37
|
-
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return { visitor: { MemberExpression(path, pass) {
|
|
41
|
-
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
42
|
-
const identifier = path.get("property")?.node;
|
|
43
|
-
if (!identifier.name) return;
|
|
44
|
-
extractEnv(identifier, pass, false);
|
|
45
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
46
|
-
require_module_helpers.addImport(path, {
|
|
47
|
-
module: `${context.config.framework || "powerlines"}:env`,
|
|
48
|
-
name: "env",
|
|
49
|
-
imported: "env"
|
|
50
|
-
});
|
|
51
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
|
|
52
|
-
const identifier = path.get("property")?.node;
|
|
53
|
-
if (!identifier.name) return;
|
|
54
|
-
extractEnv(identifier, pass, false);
|
|
55
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
56
|
-
require_module_helpers.addImport(path, {
|
|
57
|
-
module: `${context.config.framework || "powerlines"}:env`,
|
|
58
|
-
name: "env",
|
|
59
|
-
imported: "env"
|
|
60
|
-
});
|
|
61
|
-
} else if (path.get("object")?.isIdentifier({ name: "env" }) && path.get("property")?.isIdentifier()) {
|
|
62
|
-
const identifier = path.get("property")?.node;
|
|
63
|
-
if (!identifier.name) return;
|
|
64
|
-
extractEnv(identifier, pass, false);
|
|
65
|
-
}
|
|
66
|
-
} } };
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
//#endregion
|
|
70
|
-
exports.envBabelPlugin = envBabelPlugin;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createBabelPlugin } from "../../../plugin-babel/src/helpers/create-plugin.mjs";
|
|
2
|
-
import { addImport } from "../../../plugin-babel/src/helpers/module-helpers.mjs";
|
|
3
|
-
import { stringifyDefaultValue } from "../../../deepkit/src/utilities.mjs";
|
|
4
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
|
-
|
|
6
|
-
//#region ../plugin-env/src/babel/plugin.ts
|
|
7
|
-
const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
|
|
8
|
-
function extractEnv(node, pass, isInjectable = false) {
|
|
9
|
-
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
|
|
10
|
-
if (node.name) {
|
|
11
|
-
const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
|
|
12
|
-
let name = node.name;
|
|
13
|
-
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
14
|
-
log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
15
|
-
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
|
|
16
|
-
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
|
|
17
|
-
if (!envProperty || envProperty.isIgnored()) return;
|
|
18
|
-
if (!context.env.used.env.hasProperty(name)) {
|
|
19
|
-
log(LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
|
|
20
|
-
context.env.used.env.addProperty(envProperty.property);
|
|
21
|
-
}
|
|
22
|
-
if (context.config.env.inject && isInjectable) {
|
|
23
|
-
let value = context.env.parsed?.[name];
|
|
24
|
-
if (value === void 0) {
|
|
25
|
-
const prefix$1 = context.config.env.prefix.find((pre) => {
|
|
26
|
-
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
27
|
-
});
|
|
28
|
-
if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
|
|
29
|
-
}
|
|
30
|
-
value ??= envProperty.getDefaultValue();
|
|
31
|
-
if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
|
|
32
|
-
return stringifyDefaultValue(envProperty, value);
|
|
33
|
-
}
|
|
34
|
-
} else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
|
|
35
|
-
|
|
36
|
-
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return { visitor: { MemberExpression(path, pass) {
|
|
40
|
-
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
41
|
-
const identifier = path.get("property")?.node;
|
|
42
|
-
if (!identifier.name) return;
|
|
43
|
-
extractEnv(identifier, pass, false);
|
|
44
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
45
|
-
addImport(path, {
|
|
46
|
-
module: `${context.config.framework || "powerlines"}:env`,
|
|
47
|
-
name: "env",
|
|
48
|
-
imported: "env"
|
|
49
|
-
});
|
|
50
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
|
|
51
|
-
const identifier = path.get("property")?.node;
|
|
52
|
-
if (!identifier.name) return;
|
|
53
|
-
extractEnv(identifier, pass, false);
|
|
54
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
55
|
-
addImport(path, {
|
|
56
|
-
module: `${context.config.framework || "powerlines"}:env`,
|
|
57
|
-
name: "env",
|
|
58
|
-
imported: "env"
|
|
59
|
-
});
|
|
60
|
-
} else if (path.get("object")?.isIdentifier({ name: "env" }) && path.get("property")?.isIdentifier()) {
|
|
61
|
-
const identifier = path.get("property")?.node;
|
|
62
|
-
if (!identifier.name) return;
|
|
63
|
-
extractEnv(identifier, pass, false);
|
|
64
|
-
}
|
|
65
|
-
} } };
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
export { envBabelPlugin };
|
|
@@ -1,70 +0,0 @@
|
|
|
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_markdown_file = require('../../../plugin-alloy/src/markdown/components/markdown-file.cjs');
|
|
4
|
-
const require_markdown_table = require('../../../plugin-alloy/src/markdown/components/markdown-table.cjs');
|
|
5
|
-
const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
|
|
6
|
-
const require_docs_helper = require('../helpers/docs-helper.cjs');
|
|
7
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
9
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
10
|
-
let __stryke_path_join = require("@stryke/path/join");
|
|
11
|
-
let __alloy_js_markdown = require("@alloy-js/markdown");
|
|
12
|
-
|
|
13
|
-
//#region ../plugin-env/src/components/docs.tsx
|
|
14
|
-
/**
|
|
15
|
-
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
16
|
-
*/
|
|
17
|
-
function EnvDocsFile(props) {
|
|
18
|
-
const { levelOffset = 0, ...rest } = props;
|
|
19
|
-
const context = require_context.usePowerlinesSafe();
|
|
20
|
-
if (!context) return null;
|
|
21
|
-
const reflection = require_create_reflection_resource.createReflectionResource(context);
|
|
22
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_markdown_file.MarkdownFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get path() {
|
|
23
|
-
return (0, __stryke_path_join.joinPaths)(require_docs_helper.getDocsOutputPath(context), "env.md");
|
|
24
|
-
} }, rest, { get children() {
|
|
25
|
-
return [
|
|
26
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
|
|
27
|
-
level: 1 + levelOffset,
|
|
28
|
-
children: "Environment Configuration"
|
|
29
|
-
}),
|
|
30
|
-
__alloy_js_core.code`Below is a list of environment variables used by the`,
|
|
31
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
32
|
-
get when() {
|
|
33
|
-
return !!context?.packageJson.name;
|
|
34
|
-
},
|
|
35
|
-
get children() {
|
|
36
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Link, {
|
|
37
|
-
get href() {
|
|
38
|
-
return `https://www.npmjs.com/package/${context?.packageJson.name}`;
|
|
39
|
-
},
|
|
40
|
-
get title() {
|
|
41
|
-
return context.packageJson.name;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
__alloy_js_core.code`package. These values can be updated in the \`.env\` file in the root of the project.`,
|
|
47
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
48
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
|
|
49
|
-
level: 2 + levelOffset,
|
|
50
|
-
children: "Environment Variables"
|
|
51
|
-
}),
|
|
52
|
-
__alloy_js_core.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,
|
|
53
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
54
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(require_markdown_table.MarkdownTable, { get data() {
|
|
55
|
-
return reflection.data?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
|
|
56
|
-
return {
|
|
57
|
-
name: reflectionProperty.getNameAsString().trim(),
|
|
58
|
-
description: (reflectionProperty.getDescription() ?? "").trim(),
|
|
59
|
-
type: (0, __powerlines_deepkit_vendor_type.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
|
|
60
|
-
defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
|
|
61
|
-
required: reflectionProperty.isValueRequired() ? "" : "✔"
|
|
62
|
-
};
|
|
63
|
-
}) ?? [];
|
|
64
|
-
} })
|
|
65
|
-
];
|
|
66
|
-
} }));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//#endregion
|
|
70
|
-
exports.EnvDocsFile = EnvDocsFile;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { usePowerlinesSafe } from "../../../plugin-alloy/src/core/contexts/context.mjs";
|
|
2
|
-
import { MarkdownFile } from "../../../plugin-alloy/src/markdown/components/markdown-file.mjs";
|
|
3
|
-
import { MarkdownTable } from "../../../plugin-alloy/src/markdown/components/markdown-table.mjs";
|
|
4
|
-
import { createReflectionResource } from "../helpers/create-reflection-resource.mjs";
|
|
5
|
-
import { getDocsOutputPath } from "../helpers/docs-helper.mjs";
|
|
6
|
-
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
7
|
-
import { stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
8
|
-
import { Show, code } from "@alloy-js/core";
|
|
9
|
-
import { joinPaths } from "@stryke/path/join";
|
|
10
|
-
import { Heading, Link } from "@alloy-js/markdown";
|
|
11
|
-
|
|
12
|
-
//#region ../plugin-env/src/components/docs.tsx
|
|
13
|
-
/**
|
|
14
|
-
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
15
|
-
*/
|
|
16
|
-
function EnvDocsFile(props) {
|
|
17
|
-
const { levelOffset = 0, ...rest } = props;
|
|
18
|
-
const context = usePowerlinesSafe();
|
|
19
|
-
if (!context) return null;
|
|
20
|
-
const reflection = createReflectionResource(context);
|
|
21
|
-
return createComponent(MarkdownFile, mergeProps({ get path() {
|
|
22
|
-
return joinPaths(getDocsOutputPath(context), "env.md");
|
|
23
|
-
} }, rest, { get children() {
|
|
24
|
-
return [
|
|
25
|
-
createComponent(Heading, {
|
|
26
|
-
level: 1 + levelOffset,
|
|
27
|
-
children: "Environment Configuration"
|
|
28
|
-
}),
|
|
29
|
-
code`Below is a list of environment variables used by the`,
|
|
30
|
-
createComponent(Show, {
|
|
31
|
-
get when() {
|
|
32
|
-
return !!context?.packageJson.name;
|
|
33
|
-
},
|
|
34
|
-
get children() {
|
|
35
|
-
return createComponent(Link, {
|
|
36
|
-
get href() {
|
|
37
|
-
return `https://www.npmjs.com/package/${context?.packageJson.name}`;
|
|
38
|
-
},
|
|
39
|
-
get title() {
|
|
40
|
-
return context.packageJson.name;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}),
|
|
45
|
-
code`package. These values can be updated in the \`.env\` file in the root of the project.`,
|
|
46
|
-
createIntrinsic("hbr", {}),
|
|
47
|
-
createComponent(Heading, {
|
|
48
|
-
level: 2 + levelOffset,
|
|
49
|
-
children: "Environment Variables"
|
|
50
|
-
}),
|
|
51
|
-
code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,
|
|
52
|
-
createIntrinsic("hbr", {}),
|
|
53
|
-
createComponent(MarkdownTable, { get data() {
|
|
54
|
-
return reflection.data?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
|
|
55
|
-
return {
|
|
56
|
-
name: reflectionProperty.getNameAsString().trim(),
|
|
57
|
-
description: (reflectionProperty.getDescription() ?? "").trim(),
|
|
58
|
-
type: stringifyType(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
|
|
59
|
-
defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
|
|
60
|
-
required: reflectionProperty.isValueRequired() ? "" : "✔"
|
|
61
|
-
};
|
|
62
|
-
}) ?? [];
|
|
63
|
-
} })
|
|
64
|
-
];
|
|
65
|
-
} }));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
export { EnvDocsFile };
|