@powerlines/plugin-env 0.15.4 → 0.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/babel/index.cjs +1 -0
- package/dist/babel/index.d.cts +1 -0
- package/dist/babel/index.d.mts +1 -0
- package/dist/babel/index.mjs +3 -0
- package/dist/babel/plugin.cjs +200 -0
- package/dist/babel/plugin.d.cts +8 -0
- package/dist/babel/plugin.d.mts +9 -0
- package/dist/babel/plugin.mjs +198 -0
- package/dist/components/docs.cjs +70 -3
- package/dist/components/docs.d.cts +8 -1
- package/dist/components/docs.d.mts +8 -1
- package/dist/components/docs.mjs +68 -2
- package/dist/components/env.cjs +574 -4
- package/dist/components/env.d.cts +19 -2
- package/dist/components/env.d.mts +19 -3
- package/dist/components/env.mjs +570 -2
- package/dist/components/index.cjs +5 -7
- package/dist/components/index.d.cts +2 -4
- package/dist/components/index.d.mts +2 -5
- package/dist/components/index.mjs +2 -4
- package/dist/deepkit/schemas/reflection.cjs +5368 -0
- package/dist/{plugin-BwuEBScL.d.cts → deepkit/schemas/reflection.d.cts} +1 -268
- package/dist/{plugin-BaInAuAh.d.mts → deepkit/schemas/reflection.d.mts} +59 -326
- package/dist/deepkit/schemas/reflection.mjs +5365 -0
- package/dist/deepkit/schemas/reflection2.cjs +4112 -0
- package/dist/deepkit/schemas/reflection2.mjs +4110 -0
- package/dist/deepkit/src/capnp.cjs +1692 -0
- package/dist/deepkit/src/capnp.mjs +1690 -0
- package/dist/deepkit/src/esbuild-plugin.cjs +99 -0
- package/dist/deepkit/src/esbuild-plugin.mjs +98 -0
- package/dist/deepkit/src/reflect-type.cjs +40 -0
- package/dist/deepkit/src/reflect-type.mjs +38 -0
- package/dist/deepkit/src/resolve-reflections.cjs +23 -0
- package/dist/deepkit/src/resolve-reflections.mjs +22 -0
- package/dist/deepkit/src/transformer.cjs +92 -0
- package/dist/deepkit/src/transformer.mjs +89 -0
- package/dist/deepkit/src/transpile.cjs +39 -0
- package/dist/deepkit/src/transpile.mjs +37 -0
- package/dist/deepkit/src/types.cjs +22 -0
- package/dist/deepkit/src/types.d.cts +10 -0
- package/dist/deepkit/src/types.d.mts +10 -0
- package/dist/deepkit/src/types.mjs +21 -0
- package/dist/deepkit/src/utilities.cjs +182 -0
- package/dist/deepkit/src/utilities.mjs +181 -0
- package/dist/helpers/automd-generator.cjs +32 -0
- package/dist/helpers/automd-generator.mjs +31 -0
- package/dist/helpers/create-reflection-resource.cjs +98 -0
- package/dist/helpers/create-reflection-resource.d.cts +15 -0
- package/dist/helpers/create-reflection-resource.d.mts +15 -0
- package/dist/helpers/create-reflection-resource.mjs +97 -0
- package/dist/helpers/index.cjs +6 -0
- package/dist/helpers/index.d.cts +6 -0
- package/dist/helpers/index.d.mts +6 -0
- package/dist/helpers/index.mjs +8 -0
- package/dist/helpers/load.cjs +134 -0
- package/dist/helpers/load.d.cts +35 -0
- package/dist/helpers/load.d.mts +36 -0
- package/dist/helpers/load.mjs +131 -0
- package/dist/helpers/persistence.cjs +320 -0
- package/dist/helpers/persistence.d.cts +84 -0
- package/dist/helpers/persistence.d.mts +84 -0
- package/dist/helpers/persistence.mjs +308 -0
- package/dist/helpers/reflect.cjs +263 -0
- package/dist/helpers/reflect.d.cts +46 -0
- package/dist/helpers/reflect.d.mts +46 -0
- package/dist/helpers/reflect.mjs +254 -0
- package/dist/helpers/source-file-env.cjs +58 -0
- package/dist/helpers/source-file-env.d.cts +8 -0
- package/dist/helpers/source-file-env.d.mts +8 -0
- package/dist/helpers/source-file-env.mjs +56 -0
- package/dist/helpers/template-helpers.cjs +70 -0
- package/dist/helpers/template-helpers.d.cts +15 -0
- package/dist/helpers/template-helpers.d.mts +15 -0
- package/dist/helpers/template-helpers.mjs +69 -0
- package/dist/index.cjs +82 -696
- package/dist/index.d.cts +16 -185
- package/dist/index.d.mts +17 -190
- package/dist/index.mjs +31 -648
- package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
- package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
- package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +136 -0
- package/dist/plugin-alloy/src/core/contexts/context.mjs +128 -0
- package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
- package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +110 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +101 -0
- package/dist/plugin-alloy/src/helpers/refkey.cjs +23 -0
- package/dist/plugin-alloy/src/helpers/refkey.mjs +22 -0
- package/dist/plugin-alloy/src/index.cjs +93 -0
- package/dist/plugin-alloy/src/index.mjs +91 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +72 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +71 -0
- package/dist/plugin-alloy/src/types/components.cjs +22 -0
- package/dist/plugin-alloy/src/types/components.d.cts +22 -0
- package/dist/{components-8W0Zgj0y.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
- package/dist/plugin-alloy/src/types/components.mjs +21 -0
- package/dist/plugin-alloy/src/types/index.d.mts +2 -0
- package/dist/plugin-alloy/src/types/plugin.cjs +55 -0
- package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
- package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
- package/dist/plugin-alloy/src/types/plugin.mjs +52 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +11 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +12 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
- package/dist/plugin-automd/src/index.cjs +127 -0
- package/dist/plugin-automd/src/index.mjs +124 -0
- package/dist/plugin-automd/src/types/plugin.cjs +47 -0
- package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
- package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
- package/dist/plugin-automd/src/types/plugin.mjs +47 -0
- package/dist/plugin-automd/src/types/toc.cjs +26 -0
- package/dist/plugin-automd/src/types/toc.d.cts +33 -0
- package/dist/plugin-automd/src/types/toc.d.mts +33 -0
- package/dist/plugin-automd/src/types/toc.mjs +25 -0
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +74 -0
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +70 -0
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +71 -0
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +69 -0
- package/dist/plugin-babel/src/helpers/filters.cjs +158 -0
- package/dist/plugin-babel/src/helpers/filters.mjs +154 -0
- package/dist/plugin-babel/src/helpers/index.cjs +5 -0
- package/dist/plugin-babel/src/helpers/index.mjs +7 -0
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +200 -0
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +192 -0
- package/dist/plugin-babel/src/helpers/options.cjs +74 -0
- package/dist/plugin-babel/src/helpers/options.mjs +71 -0
- package/dist/plugin-babel/src/index.cjs +134 -0
- package/dist/plugin-babel/src/index.mjs +132 -0
- package/dist/plugin-babel/src/types/index.d.mts +1 -0
- package/dist/plugin-babel/src/types/plugin.cjs +42 -0
- package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
- package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
- package/dist/plugin-babel/src/types/plugin.mjs +39 -0
- package/dist/powerlines/schemas/fs.d.mts +1 -0
- package/dist/powerlines/src/api.d.mts +7 -0
- package/dist/powerlines/src/index.d.mts +12 -0
- package/dist/powerlines/src/internal/helpers/hooks.cjs +119 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
- package/dist/powerlines/src/internal/helpers/hooks.mjs +118 -0
- package/dist/powerlines/src/lib/build/esbuild.cjs +161 -0
- package/dist/powerlines/src/lib/build/esbuild.mjs +159 -0
- package/dist/powerlines/src/lib/entry.cjs +203 -0
- package/dist/powerlines/src/lib/entry.mjs +201 -0
- package/dist/powerlines/src/lib/logger.cjs +108 -0
- package/dist/powerlines/src/lib/logger.mjs +106 -0
- package/dist/powerlines/src/lib/utilities/bundle.cjs +67 -0
- package/dist/powerlines/src/lib/utilities/bundle.mjs +66 -0
- package/dist/powerlines/src/lib/utilities/resolve.cjs +49 -0
- package/dist/powerlines/src/lib/utilities/resolve.mjs +48 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +46 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +45 -0
- package/dist/powerlines/src/types/api.cjs +1 -0
- package/dist/powerlines/src/types/api.d.mts +5 -0
- package/dist/powerlines/src/types/api.mjs +3 -0
- package/dist/powerlines/src/types/babel.cjs +156 -0
- package/dist/powerlines/src/types/babel.d.cts +23 -0
- package/dist/powerlines/src/types/babel.d.mts +23 -0
- package/dist/powerlines/src/types/babel.mjs +147 -0
- package/dist/powerlines/src/types/build.cjs +105 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +147 -0
- package/dist/powerlines/src/types/build.mjs +101 -0
- package/dist/powerlines/src/types/commands.cjs +16 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/commands.mjs +15 -0
- package/dist/powerlines/src/types/config.cjs +306 -0
- package/dist/powerlines/src/types/config.d.cts +387 -0
- package/dist/powerlines/src/types/config.d.mts +388 -0
- package/dist/powerlines/src/types/config.mjs +293 -0
- package/dist/powerlines/src/types/context.cjs +324 -0
- package/dist/powerlines/src/types/context.d.cts +414 -0
- package/dist/powerlines/src/types/context.d.mts +416 -0
- package/dist/powerlines/src/types/context.mjs +311 -0
- package/dist/powerlines/src/types/fs.cjs +78 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/fs.mjs +75 -0
- package/dist/powerlines/src/types/hooks.cjs +52 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/hooks.mjs +48 -0
- package/dist/powerlines/src/types/index.cjs +11 -0
- package/dist/powerlines/src/types/index.d.mts +12 -0
- package/dist/powerlines/src/types/index.mjs +13 -0
- package/dist/powerlines/src/types/plugin.cjs +249 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/plugin.mjs +240 -0
- package/dist/powerlines/src/types/resolved.cjs +153 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +83 -0
- package/dist/powerlines/src/types/resolved.mjs +148 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/powerlines/src/types/unplugin.cjs +1 -0
- package/dist/powerlines/src/types/unplugin.d.mts +7 -0
- package/dist/powerlines/src/types/unplugin.mjs +3 -0
- package/dist/types/index.cjs +10 -3
- package/dist/types/index.d.cts +2 -4
- package/dist/types/index.d.mts +2 -5
- package/dist/types/index.mjs +3 -4
- package/dist/types/plugin.cjs +133 -1
- package/dist/types/plugin.d.cts +156 -3
- package/dist/types/plugin.d.mts +158 -4
- package/dist/types/plugin.mjs +128 -2
- package/dist/types/runtime.cjs +242 -1
- package/dist/types/runtime.d.cts +793 -2
- package/dist/types/runtime.d.mts +793 -2
- package/dist/types/runtime.mjs +240 -2
- package/package.json +13 -9
- package/dist/components-C9bYrQVK.cjs +0 -0
- package/dist/components-CNIQFfeK.mjs +0 -1
- package/dist/create-reflection-resource-BNYxBgW2.mjs +0 -9846
- package/dist/create-reflection-resource-BWYhmX7O.cjs +0 -10085
- package/dist/docs-5r844zC1.d.mts +0 -9
- package/dist/docs-B66b9li3.mjs +0 -219
- package/dist/docs-_MmTNBQX.d.cts +0 -9
- package/dist/docs-hBlKCRWK.cjs +0 -224
- package/dist/env-BPodCdD1.d.cts +0 -116
- package/dist/env-IQvgnabX.mjs +0 -1578
- package/dist/env-cO4BUDn1.cjs +0 -1596
- package/dist/env-zhzvpUI5.d.mts +0 -98
- package/dist/index-BXxhKmeA.d.mts +0 -1
- package/dist/index-Cc7fCJU9.d.mts +0 -1
- package/dist/index-CqdNToYT.d.cts +0 -1
- package/dist/index-DWPDThxu.d.cts +0 -1
- package/dist/plugin-D3B5E_Hg.mjs +0 -1
- package/dist/plugin-D5qyQPqC.cjs +0 -0
- package/dist/resolved-BZG2cwRG.d.cts +0 -1789
- package/dist/resolved-V5COsfDu.d.mts +0 -1791
- package/dist/runtime-Bisl_1Ja.cjs +0 -0
- package/dist/runtime-Q8Ni8SeN.d.cts +0 -794
- package/dist/runtime-azNoeKr-.mjs +0 -1
- package/dist/runtime-qZ0Z2kEd.d.mts +0 -794
- package/dist/types-DwElXV6q.mjs +0 -1
- package/dist/types-MYBaygjr.cjs +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { __ΩResolvedEntryTypeDefinition } from "../types/resolved.mjs";
|
|
2
|
+
import { replacePathTokens } from "../plugin-utils/paths.mjs";
|
|
3
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
4
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
5
|
+
import { isFile } from "@stryke/fs/is-file";
|
|
6
|
+
import { listFiles, listFilesSync } from "@stryke/fs/list-files";
|
|
7
|
+
import { appendPath } from "@stryke/path/append";
|
|
8
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
9
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
10
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
11
|
+
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
12
|
+
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
13
|
+
import { murmurhash } from "@stryke/hash/murmurhash";
|
|
14
|
+
|
|
15
|
+
//#region ../powerlines/src/lib/entry.ts
|
|
16
|
+
function __assignType(fn, args) {
|
|
17
|
+
fn.__type = args;
|
|
18
|
+
return fn;
|
|
19
|
+
}
|
|
20
|
+
function resolveEntryInputFile(context, typeDefinition) {
|
|
21
|
+
return replacePath(typeDefinition.file, joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
|
|
22
|
+
}
|
|
23
|
+
resolveEntryInputFile.__type = [
|
|
24
|
+
"Context",
|
|
25
|
+
"context",
|
|
26
|
+
"typeDefinition",
|
|
27
|
+
"resolveEntryInputFile",
|
|
28
|
+
"P\"w!2\"!2#&/$"
|
|
29
|
+
];
|
|
30
|
+
function resolveEntryInput(context, typeDefinition) {
|
|
31
|
+
return {
|
|
32
|
+
file: resolveEntryInputFile(context, typeDefinition),
|
|
33
|
+
name: typeDefinition.name
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
resolveEntryInput.__type = [
|
|
37
|
+
"Context",
|
|
38
|
+
"context",
|
|
39
|
+
"typeDefinition",
|
|
40
|
+
"resolveEntryInput",
|
|
41
|
+
"P\"w!2\"!2#!/$"
|
|
42
|
+
];
|
|
43
|
+
function resolveEntryOutput(context, typeDefinition) {
|
|
44
|
+
return replaceExtension(replacePath(replacePath(replacePath(replacePath(replacePath(typeDefinition.file, joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replacePath(context.config.sourceRoot, context.config.projectRoot)));
|
|
45
|
+
}
|
|
46
|
+
resolveEntryOutput.__type = [
|
|
47
|
+
"Context",
|
|
48
|
+
"context",
|
|
49
|
+
"typeDefinition",
|
|
50
|
+
"resolveEntryOutput",
|
|
51
|
+
"P\"w!2\"!2#&/$"
|
|
52
|
+
];
|
|
53
|
+
function resolveEntry(context, typeDefinition) {
|
|
54
|
+
const input = resolveEntryInput(context, typeDefinition);
|
|
55
|
+
return {
|
|
56
|
+
...input,
|
|
57
|
+
input,
|
|
58
|
+
output: resolveEntryOutput(context, typeDefinition)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
resolveEntry.__type = [
|
|
62
|
+
"Context",
|
|
63
|
+
"context",
|
|
64
|
+
"typeDefinition",
|
|
65
|
+
() => __ΩResolvedEntryTypeDefinition,
|
|
66
|
+
"resolveEntry",
|
|
67
|
+
"P\"w!2\"!2#n$/%"
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
71
|
+
*
|
|
72
|
+
* @param context - The current context
|
|
73
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
74
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
75
|
+
*/
|
|
76
|
+
async function resolveEntries(context, typeDefinitions) {
|
|
77
|
+
return (await Promise.all(typeDefinitions.map(__assignType(async (typeDefinition) => {
|
|
78
|
+
const parsed = parseTypeDefinition(typeDefinition);
|
|
79
|
+
const filePath = appendPath(parsed.file, context.config.projectRoot);
|
|
80
|
+
if (isFile(filePath)) return resolveEntry(context, {
|
|
81
|
+
file: replacePath(filePath, context.config.projectRoot),
|
|
82
|
+
name: parsed.name
|
|
83
|
+
});
|
|
84
|
+
return (await listFiles(appendPath(parsed.file, context.config.projectRoot))).map(__assignType((file) => resolveEntry(context, {
|
|
85
|
+
file,
|
|
86
|
+
name: parsed.name
|
|
87
|
+
}), [
|
|
88
|
+
"file",
|
|
89
|
+
"",
|
|
90
|
+
"P\"2!\"/\""
|
|
91
|
+
]));
|
|
92
|
+
}, [
|
|
93
|
+
"typeDefinition",
|
|
94
|
+
"",
|
|
95
|
+
"P\"2!\"/\""
|
|
96
|
+
])))).flat().filter(Boolean);
|
|
97
|
+
}
|
|
98
|
+
resolveEntries.__type = [
|
|
99
|
+
"Context",
|
|
100
|
+
"context",
|
|
101
|
+
"typeDefinitions",
|
|
102
|
+
() => __ΩResolvedEntryTypeDefinition,
|
|
103
|
+
"resolveEntries",
|
|
104
|
+
"Resolves multiple type definitions into their corresponding resolved entry type definitions.",
|
|
105
|
+
"P\"w!2\"!F2#n$F`/%?&"
|
|
106
|
+
];
|
|
107
|
+
/**
|
|
108
|
+
* Resolves multiple type definitions into their corresponding resolved entry type definitions.
|
|
109
|
+
*
|
|
110
|
+
* @param context - The current context
|
|
111
|
+
* @param typeDefinitions - The type definitions to resolve.
|
|
112
|
+
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
113
|
+
*/
|
|
114
|
+
function resolveEntriesSync(context, typeDefinitions) {
|
|
115
|
+
return typeDefinitions.map(__assignType((entry) => isString(entry) ? replacePathTokens(context, entry) : replacePathTokens(context, entry.file), [
|
|
116
|
+
"entry",
|
|
117
|
+
"",
|
|
118
|
+
"P\"2!\"/\""
|
|
119
|
+
])).map(__assignType((typeDefinition) => {
|
|
120
|
+
const parsed = parseTypeDefinition(typeDefinition);
|
|
121
|
+
const filePath = appendPath(parsed.file, context.config.projectRoot);
|
|
122
|
+
if (isFile(filePath)) return resolveEntry(context, {
|
|
123
|
+
file: replacePath(filePath, context.config.projectRoot),
|
|
124
|
+
name: parsed.name
|
|
125
|
+
});
|
|
126
|
+
return listFilesSync(filePath).map(__assignType((file) => resolveEntry(context, {
|
|
127
|
+
file,
|
|
128
|
+
name: parsed.name
|
|
129
|
+
}), [
|
|
130
|
+
"file",
|
|
131
|
+
"",
|
|
132
|
+
"P\"2!\"/\""
|
|
133
|
+
]));
|
|
134
|
+
}, [
|
|
135
|
+
"typeDefinition",
|
|
136
|
+
"",
|
|
137
|
+
"P\"2!\"/\""
|
|
138
|
+
])).flat().filter(Boolean);
|
|
139
|
+
}
|
|
140
|
+
resolveEntriesSync.__type = [
|
|
141
|
+
"Context",
|
|
142
|
+
"context",
|
|
143
|
+
"typeDefinitions",
|
|
144
|
+
() => __ΩResolvedEntryTypeDefinition,
|
|
145
|
+
"resolveEntriesSync",
|
|
146
|
+
"Resolves multiple type definitions into their corresponding resolved entry type definitions.",
|
|
147
|
+
"P\"w!2\"!F2#n$F/%?&"
|
|
148
|
+
];
|
|
149
|
+
/** Resolve a virtual entry point by generating a unique file path in the artifacts directory.
|
|
150
|
+
*
|
|
151
|
+
* @param context - The current context
|
|
152
|
+
* @param typeDefinition - The type definition to resolve.
|
|
153
|
+
* @returns The resolved entry type definition with a unique virtual file path.
|
|
154
|
+
*/
|
|
155
|
+
function resolveVirtualEntry(context, typeDefinition) {
|
|
156
|
+
const resolved = resolveEntry(context, parseTypeDefinition(typeDefinition));
|
|
157
|
+
const file = joinPaths(context.artifactsPath, `entry-${murmurhash({
|
|
158
|
+
file: resolved.file,
|
|
159
|
+
name: resolved.name
|
|
160
|
+
}, { maxLength: 24 }).replaceAll("-", "0").replaceAll("_", "1")}.ts`);
|
|
161
|
+
return {
|
|
162
|
+
file,
|
|
163
|
+
name: resolved.name,
|
|
164
|
+
input: {
|
|
165
|
+
file,
|
|
166
|
+
name: resolved.name
|
|
167
|
+
},
|
|
168
|
+
output: file
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
resolveVirtualEntry.__type = [
|
|
172
|
+
"Context",
|
|
173
|
+
"context",
|
|
174
|
+
"typeDefinition",
|
|
175
|
+
() => __ΩResolvedEntryTypeDefinition,
|
|
176
|
+
"resolveVirtualEntry",
|
|
177
|
+
"P\"w!2\"!2#n$/%"
|
|
178
|
+
];
|
|
179
|
+
/**
|
|
180
|
+
* Get unique entries from the provided list.
|
|
181
|
+
*
|
|
182
|
+
* @param entries - The entries to process.
|
|
183
|
+
* @returns An array of unique entries (by file path or content hash).
|
|
184
|
+
*/
|
|
185
|
+
function getUniqueEntries(entries = []) {
|
|
186
|
+
return getUniqueBy(toArray(entries), __assignType((item) => isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 }), [
|
|
187
|
+
"item",
|
|
188
|
+
"",
|
|
189
|
+
"P!2!\"/\""
|
|
190
|
+
]));
|
|
191
|
+
}
|
|
192
|
+
getUniqueEntries.__type = [
|
|
193
|
+
"entries",
|
|
194
|
+
() => [],
|
|
195
|
+
"getUniqueEntries",
|
|
196
|
+
"Get unique entries from the provided list.",
|
|
197
|
+
"PP!!FJ2!>\"!F/#?$"
|
|
198
|
+
];
|
|
199
|
+
|
|
200
|
+
//#endregion
|
|
201
|
+
export { resolveEntryInputFile, resolveEntryOutput };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
3
|
+
let chalk = require("chalk");
|
|
4
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
5
|
+
let __storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
6
|
+
let __storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
|
|
7
|
+
let __stryke_helpers_noop = require("@stryke/helpers/noop");
|
|
8
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
9
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
|
+
|
|
11
|
+
//#region ../powerlines/src/lib/logger.ts
|
|
12
|
+
function __assignType(fn, args) {
|
|
13
|
+
fn.__type = args;
|
|
14
|
+
return fn;
|
|
15
|
+
}
|
|
16
|
+
const __ΩCreateLogOptions = [
|
|
17
|
+
"name",
|
|
18
|
+
"LogLevelLabel",
|
|
19
|
+
"logLevel",
|
|
20
|
+
"LogFn",
|
|
21
|
+
"customLogger",
|
|
22
|
+
"WorkspaceConfig",
|
|
23
|
+
"colors",
|
|
24
|
+
"colors",
|
|
25
|
+
"CreateLogOptions",
|
|
26
|
+
"P&4!8P\"w\",J4#8\"w$4%8\"w&.'f4(8Mw)y"
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Create a logging function with a specific name and options.
|
|
30
|
+
*
|
|
31
|
+
* @param name - The name of the logging function.
|
|
32
|
+
* @param options - The options to configure the logging function.
|
|
33
|
+
* @returns A logging function.
|
|
34
|
+
*/
|
|
35
|
+
const createLog = __assignType((name, options = {}) => {
|
|
36
|
+
const logLevel = options.logLevel === null ? __storm_software_config_tools_types.LogLevelLabel.SILENT : options.logLevel || __storm_software_config_tools_types.LogLevelLabel.INFO;
|
|
37
|
+
if (logLevel === __storm_software_config_tools_types.LogLevelLabel.SILENT) return __stryke_helpers_noop.noop;
|
|
38
|
+
if (options.customLogger) return options.customLogger;
|
|
39
|
+
return __assignType((type, ...args) => (0, __storm_software_config_tools_logger.getLogFn)((0, __storm_software_config_tools_logger.getLogLevel)(type), {
|
|
40
|
+
...options,
|
|
41
|
+
logLevel
|
|
42
|
+
})(`${chalk.default.bold.hex((0, __storm_software_config_tools_utilities_colors.getColor)("brand", options))(`${name ? (0, __stryke_string_format_kebab_case.kebabCase)(name) : ""}${options.name ? `${name ? chalk.default.gray(" > ") : ""}${(0, __stryke_string_format_kebab_case.kebabCase)(options.name)}` : ""}${chalk.default.gray(" > ")}`)}${args.join(" ")} `.trim()), [
|
|
43
|
+
"LogLevelLabel",
|
|
44
|
+
"type",
|
|
45
|
+
"args",
|
|
46
|
+
"",
|
|
47
|
+
"P\"w!2\"&@2#\"/$"
|
|
48
|
+
]);
|
|
49
|
+
}, [
|
|
50
|
+
"name",
|
|
51
|
+
() => __ΩCreateLogOptions,
|
|
52
|
+
"options",
|
|
53
|
+
() => ({}),
|
|
54
|
+
"LogFn",
|
|
55
|
+
"",
|
|
56
|
+
"PP&,J2!n\"2#>$\"w%/&"
|
|
57
|
+
]);
|
|
58
|
+
const BADGE_COLORS = [
|
|
59
|
+
"#00A0DD",
|
|
60
|
+
"#6FCE4E",
|
|
61
|
+
"#FBBF24",
|
|
62
|
+
"#F43F5E",
|
|
63
|
+
"#3B82F6",
|
|
64
|
+
"#A855F7",
|
|
65
|
+
"#469592",
|
|
66
|
+
"#288EDF",
|
|
67
|
+
"#D8B4FE",
|
|
68
|
+
"#10B981",
|
|
69
|
+
"#EF4444",
|
|
70
|
+
"#F0EC56",
|
|
71
|
+
"#F472B6",
|
|
72
|
+
"#22D3EE",
|
|
73
|
+
"#EAB308",
|
|
74
|
+
"#84CC16",
|
|
75
|
+
"#F87171",
|
|
76
|
+
"#0EA5E9",
|
|
77
|
+
"#D946EF",
|
|
78
|
+
"#FACC15",
|
|
79
|
+
"#34D399",
|
|
80
|
+
"#8B5CF6"
|
|
81
|
+
];
|
|
82
|
+
const extendLog = __assignType((logFn, name) => {
|
|
83
|
+
return __assignType((type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map(__assignType((char) => char.charCodeAt(0), [
|
|
84
|
+
"char",
|
|
85
|
+
"",
|
|
86
|
+
"P\"2!\"/\""
|
|
87
|
+
])).reduce(__assignType((ret, charCode) => ret + charCode, [
|
|
88
|
+
"ret",
|
|
89
|
+
"charCode",
|
|
90
|
+
"",
|
|
91
|
+
"P\"2!\"2\"\"/#"
|
|
92
|
+
]), 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `), [
|
|
93
|
+
"LogLevelLabel",
|
|
94
|
+
"type",
|
|
95
|
+
"args",
|
|
96
|
+
"",
|
|
97
|
+
"P\"w!2\"&@2#\"/$"
|
|
98
|
+
]);
|
|
99
|
+
}, [
|
|
100
|
+
"LogFn",
|
|
101
|
+
"logFn",
|
|
102
|
+
"name",
|
|
103
|
+
"",
|
|
104
|
+
"P\"w!2\"&2#\"w!/$"
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
exports.extendLog = extendLog;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { getLogFn, getLogLevel } from "@storm-software/config-tools/logger";
|
|
4
|
+
import { getColor } from "@storm-software/config-tools/utilities/colors";
|
|
5
|
+
import { noop } from "@stryke/helpers/noop";
|
|
6
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
|
|
9
|
+
//#region ../powerlines/src/lib/logger.ts
|
|
10
|
+
function __assignType(fn, args) {
|
|
11
|
+
fn.__type = args;
|
|
12
|
+
return fn;
|
|
13
|
+
}
|
|
14
|
+
const __ΩCreateLogOptions = [
|
|
15
|
+
"name",
|
|
16
|
+
"LogLevelLabel",
|
|
17
|
+
"logLevel",
|
|
18
|
+
"LogFn",
|
|
19
|
+
"customLogger",
|
|
20
|
+
"WorkspaceConfig",
|
|
21
|
+
"colors",
|
|
22
|
+
"colors",
|
|
23
|
+
"CreateLogOptions",
|
|
24
|
+
"P&4!8P\"w\",J4#8\"w$4%8\"w&.'f4(8Mw)y"
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Create a logging function with a specific name and options.
|
|
28
|
+
*
|
|
29
|
+
* @param name - The name of the logging function.
|
|
30
|
+
* @param options - The options to configure the logging function.
|
|
31
|
+
* @returns A logging function.
|
|
32
|
+
*/
|
|
33
|
+
const createLog = __assignType((name, options = {}) => {
|
|
34
|
+
const logLevel = options.logLevel === null ? LogLevelLabel.SILENT : options.logLevel || LogLevelLabel.INFO;
|
|
35
|
+
if (logLevel === LogLevelLabel.SILENT) return noop;
|
|
36
|
+
if (options.customLogger) return options.customLogger;
|
|
37
|
+
return __assignType((type, ...args) => getLogFn(getLogLevel(type), {
|
|
38
|
+
...options,
|
|
39
|
+
logLevel
|
|
40
|
+
})(`${chalk.bold.hex(getColor("brand", options))(`${name ? kebabCase(name) : ""}${options.name ? `${name ? chalk.gray(" > ") : ""}${kebabCase(options.name)}` : ""}${chalk.gray(" > ")}`)}${args.join(" ")} `.trim()), [
|
|
41
|
+
"LogLevelLabel",
|
|
42
|
+
"type",
|
|
43
|
+
"args",
|
|
44
|
+
"",
|
|
45
|
+
"P\"w!2\"&@2#\"/$"
|
|
46
|
+
]);
|
|
47
|
+
}, [
|
|
48
|
+
"name",
|
|
49
|
+
() => __ΩCreateLogOptions,
|
|
50
|
+
"options",
|
|
51
|
+
() => ({}),
|
|
52
|
+
"LogFn",
|
|
53
|
+
"",
|
|
54
|
+
"PP&,J2!n\"2#>$\"w%/&"
|
|
55
|
+
]);
|
|
56
|
+
const BADGE_COLORS = [
|
|
57
|
+
"#00A0DD",
|
|
58
|
+
"#6FCE4E",
|
|
59
|
+
"#FBBF24",
|
|
60
|
+
"#F43F5E",
|
|
61
|
+
"#3B82F6",
|
|
62
|
+
"#A855F7",
|
|
63
|
+
"#469592",
|
|
64
|
+
"#288EDF",
|
|
65
|
+
"#D8B4FE",
|
|
66
|
+
"#10B981",
|
|
67
|
+
"#EF4444",
|
|
68
|
+
"#F0EC56",
|
|
69
|
+
"#F472B6",
|
|
70
|
+
"#22D3EE",
|
|
71
|
+
"#EAB308",
|
|
72
|
+
"#84CC16",
|
|
73
|
+
"#F87171",
|
|
74
|
+
"#0EA5E9",
|
|
75
|
+
"#D946EF",
|
|
76
|
+
"#FACC15",
|
|
77
|
+
"#34D399",
|
|
78
|
+
"#8B5CF6"
|
|
79
|
+
];
|
|
80
|
+
const extendLog = __assignType((logFn, name) => {
|
|
81
|
+
return __assignType((type, ...args) => logFn(type, ` ${chalk.inverse.hex(BADGE_COLORS[name.split("").map(__assignType((char) => char.charCodeAt(0), [
|
|
82
|
+
"char",
|
|
83
|
+
"",
|
|
84
|
+
"P\"2!\"/\""
|
|
85
|
+
])).reduce(__assignType((ret, charCode) => ret + charCode, [
|
|
86
|
+
"ret",
|
|
87
|
+
"charCode",
|
|
88
|
+
"",
|
|
89
|
+
"P\"2!\"2\"\"/#"
|
|
90
|
+
]), 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `), [
|
|
91
|
+
"LogLevelLabel",
|
|
92
|
+
"type",
|
|
93
|
+
"args",
|
|
94
|
+
"",
|
|
95
|
+
"P\"w!2\"&@2#\"/$"
|
|
96
|
+
]);
|
|
97
|
+
}, [
|
|
98
|
+
"LogFn",
|
|
99
|
+
"logFn",
|
|
100
|
+
"name",
|
|
101
|
+
"",
|
|
102
|
+
"P\"w!2\"&2#\"w!/$"
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { extendLog };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_context = require('../../types/context.cjs');
|
|
3
|
+
const require_build = require('../../types/build.cjs');
|
|
4
|
+
const require_esbuild = require('../build/esbuild.cjs');
|
|
5
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
|
+
let esbuild = require("esbuild");
|
|
7
|
+
|
|
8
|
+
//#region ../powerlines/src/lib/utilities/bundle.ts
|
|
9
|
+
const __ΩPartial = [
|
|
10
|
+
"T",
|
|
11
|
+
"Partial",
|
|
12
|
+
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
13
|
+
];
|
|
14
|
+
function __assignType(fn, args) {
|
|
15
|
+
fn.__type = args;
|
|
16
|
+
return fn;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bundle a type definition to a module.
|
|
20
|
+
*
|
|
21
|
+
* @param context - The context object containing the environment paths.
|
|
22
|
+
* @param file - The file path to bundle.
|
|
23
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
24
|
+
* @returns A promise that resolves to the bundled module.
|
|
25
|
+
*/
|
|
26
|
+
async function bundle(context, file, overrides = {}) {
|
|
27
|
+
const path = await context.fs.resolve(file);
|
|
28
|
+
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
29
|
+
const result = await (0, esbuild.build)({
|
|
30
|
+
...require_esbuild.extractESBuildConfig(context),
|
|
31
|
+
entryPoints: [path],
|
|
32
|
+
write: false,
|
|
33
|
+
sourcemap: false,
|
|
34
|
+
splitting: false,
|
|
35
|
+
treeShaking: false,
|
|
36
|
+
bundle: true,
|
|
37
|
+
...overrides
|
|
38
|
+
});
|
|
39
|
+
if (result.errors.length > 0) throw new Error(`Failed to transpile ${file}: ${result.errors.map(__assignType((error) => error.text, [
|
|
40
|
+
"error",
|
|
41
|
+
"",
|
|
42
|
+
"P\"2!\"/\""
|
|
43
|
+
])).join(", ")}`);
|
|
44
|
+
if (result.warnings.length > 0) context.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `Warnings while transpiling ${file}: ${result.warnings.map(__assignType((warning) => warning.text, [
|
|
45
|
+
"warning",
|
|
46
|
+
"",
|
|
47
|
+
"P\"2!\"/\""
|
|
48
|
+
])).join(", ")}`);
|
|
49
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
50
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
51
|
+
}
|
|
52
|
+
bundle.__type = [
|
|
53
|
+
() => require_context.__ΩContext,
|
|
54
|
+
"context",
|
|
55
|
+
"file",
|
|
56
|
+
() => __ΩPartial,
|
|
57
|
+
() => require_build.__ΩESBuildResolvedBuildConfig,
|
|
58
|
+
"overrides",
|
|
59
|
+
() => ({}),
|
|
60
|
+
"OutputFile",
|
|
61
|
+
"bundle",
|
|
62
|
+
"Bundle a type definition to a module.",
|
|
63
|
+
"Pn!2\"&2#n%o$\"2&>'\"w(`/)?*"
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.bundle = bundle;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { __ΩContext } from "../../types/context.mjs";
|
|
2
|
+
import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
|
|
3
|
+
import { extractESBuildConfig } from "../build/esbuild.mjs";
|
|
4
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
|
+
import { build } from "esbuild";
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/lib/utilities/bundle.ts
|
|
8
|
+
const __ΩPartial = [
|
|
9
|
+
"T",
|
|
10
|
+
"Partial",
|
|
11
|
+
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
12
|
+
];
|
|
13
|
+
function __assignType(fn, args) {
|
|
14
|
+
fn.__type = args;
|
|
15
|
+
return fn;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bundle a type definition to a module.
|
|
19
|
+
*
|
|
20
|
+
* @param context - The context object containing the environment paths.
|
|
21
|
+
* @param file - The file path to bundle.
|
|
22
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
23
|
+
* @returns A promise that resolves to the bundled module.
|
|
24
|
+
*/
|
|
25
|
+
async function bundle(context, file, overrides = {}) {
|
|
26
|
+
const path = await context.fs.resolve(file);
|
|
27
|
+
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
28
|
+
const result = await build({
|
|
29
|
+
...extractESBuildConfig(context),
|
|
30
|
+
entryPoints: [path],
|
|
31
|
+
write: false,
|
|
32
|
+
sourcemap: false,
|
|
33
|
+
splitting: false,
|
|
34
|
+
treeShaking: false,
|
|
35
|
+
bundle: true,
|
|
36
|
+
...overrides
|
|
37
|
+
});
|
|
38
|
+
if (result.errors.length > 0) throw new Error(`Failed to transpile ${file}: ${result.errors.map(__assignType((error) => error.text, [
|
|
39
|
+
"error",
|
|
40
|
+
"",
|
|
41
|
+
"P\"2!\"/\""
|
|
42
|
+
])).join(", ")}`);
|
|
43
|
+
if (result.warnings.length > 0) context.log(LogLevelLabel.WARN, `Warnings while transpiling ${file}: ${result.warnings.map(__assignType((warning) => warning.text, [
|
|
44
|
+
"warning",
|
|
45
|
+
"",
|
|
46
|
+
"P\"2!\"/\""
|
|
47
|
+
])).join(", ")}`);
|
|
48
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
49
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
50
|
+
}
|
|
51
|
+
bundle.__type = [
|
|
52
|
+
() => __ΩContext,
|
|
53
|
+
"context",
|
|
54
|
+
"file",
|
|
55
|
+
() => __ΩPartial,
|
|
56
|
+
() => __ΩESBuildResolvedBuildConfig,
|
|
57
|
+
"overrides",
|
|
58
|
+
() => ({}),
|
|
59
|
+
"OutputFile",
|
|
60
|
+
"bundle",
|
|
61
|
+
"Bundle a type definition to a module.",
|
|
62
|
+
"Pn!2\"&2#n%o$\"2&>'\"w(`/)?*"
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { bundle };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_context = require('../../types/context.cjs');
|
|
3
|
+
const require_build = require('../../types/build.cjs');
|
|
4
|
+
const require_bundle = require('./bundle.cjs');
|
|
5
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
|
+
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
7
|
+
|
|
8
|
+
//#region ../powerlines/src/lib/utilities/resolve.ts
|
|
9
|
+
const __ΩPartial = [
|
|
10
|
+
"T",
|
|
11
|
+
"Partial",
|
|
12
|
+
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Compiles a type definition to a module.
|
|
16
|
+
*
|
|
17
|
+
* @param context - The context object containing the environment paths.
|
|
18
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
19
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
20
|
+
* @returns A promise that resolves to the compiled module.
|
|
21
|
+
*/
|
|
22
|
+
async function resolve(context, type, overrides = {}) {
|
|
23
|
+
let typeDefinition;
|
|
24
|
+
if ((0, __stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(type);
|
|
25
|
+
else typeDefinition = type;
|
|
26
|
+
const result = await require_bundle.bundle(context, typeDefinition.file, overrides);
|
|
27
|
+
const resolved = await context.resolver.evalModule(result.text, {
|
|
28
|
+
filename: result.path,
|
|
29
|
+
forceTranspile: true
|
|
30
|
+
});
|
|
31
|
+
let exportName = typeDefinition.name;
|
|
32
|
+
if (!exportName) exportName = "default";
|
|
33
|
+
return resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
34
|
+
}
|
|
35
|
+
resolve.__type = [
|
|
36
|
+
() => require_context.__ΩContext,
|
|
37
|
+
"context",
|
|
38
|
+
"type",
|
|
39
|
+
() => __ΩPartial,
|
|
40
|
+
() => require_build.__ΩESBuildResolvedBuildConfig,
|
|
41
|
+
"overrides",
|
|
42
|
+
() => ({}),
|
|
43
|
+
"resolve",
|
|
44
|
+
"Compiles a type definition to a module.",
|
|
45
|
+
"Pn!2\"!2#n%o$\"2&>'\"`/(?)"
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.resolve = resolve;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __ΩContext } from "../../types/context.mjs";
|
|
2
|
+
import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
|
|
3
|
+
import { bundle } from "./bundle.mjs";
|
|
4
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
5
|
+
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/lib/utilities/resolve.ts
|
|
8
|
+
const __ΩPartial = [
|
|
9
|
+
"T",
|
|
10
|
+
"Partial",
|
|
11
|
+
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Compiles a type definition to a module.
|
|
15
|
+
*
|
|
16
|
+
* @param context - The context object containing the environment paths.
|
|
17
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
18
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
19
|
+
* @returns A promise that resolves to the compiled module.
|
|
20
|
+
*/
|
|
21
|
+
async function resolve(context, type, overrides = {}) {
|
|
22
|
+
let typeDefinition;
|
|
23
|
+
if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
|
|
24
|
+
else typeDefinition = type;
|
|
25
|
+
const result = await bundle(context, typeDefinition.file, overrides);
|
|
26
|
+
const resolved = await context.resolver.evalModule(result.text, {
|
|
27
|
+
filename: result.path,
|
|
28
|
+
forceTranspile: true
|
|
29
|
+
});
|
|
30
|
+
let exportName = typeDefinition.name;
|
|
31
|
+
if (!exportName) exportName = "default";
|
|
32
|
+
return resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
33
|
+
}
|
|
34
|
+
resolve.__type = [
|
|
35
|
+
() => __ΩContext,
|
|
36
|
+
"context",
|
|
37
|
+
"type",
|
|
38
|
+
() => __ΩPartial,
|
|
39
|
+
() => __ΩESBuildResolvedBuildConfig,
|
|
40
|
+
"overrides",
|
|
41
|
+
() => ({}),
|
|
42
|
+
"resolve",
|
|
43
|
+
"Compiles a type definition to a module.",
|
|
44
|
+
"Pn!2\"!2#n%o$\"2&>'\"`/(?)"
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { resolve };
|