@powerlines/plugin-env 0.15.122 → 0.15.124
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/babel/plugin.cjs +11 -11
- package/dist/babel/plugin.d.cts +2 -2
- package/dist/babel/plugin.d.mts +2 -3
- package/dist/babel/plugin.mjs +5 -5
- package/dist/components/docs.cjs +6 -6
- package/dist/components/docs.d.cts +1 -1
- package/dist/components/docs.d.mts +1 -1
- package/dist/components/docs.mjs +3 -3
- package/dist/components/env.cjs +40 -40
- package/dist/components/env.d.cts +2 -2
- package/dist/components/env.d.mts +2 -2
- package/dist/components/env.mjs +11 -11
- package/dist/helpers/automd-generator.cjs +2 -2
- package/dist/helpers/automd-generator.d.cts +1 -1
- package/dist/helpers/automd-generator.d.mts +1 -1
- package/dist/helpers/automd-generator.mjs +1 -1
- package/dist/helpers/load.cjs +7 -7
- package/dist/helpers/load.mjs +8 -8
- package/dist/helpers/persistence.cjs +23 -23
- package/dist/helpers/persistence.d.cts +1 -1
- package/dist/helpers/persistence.d.mts +1 -1
- package/dist/helpers/persistence.mjs +5 -5
- package/dist/helpers/reflect.cjs +5 -5
- package/dist/helpers/reflect.mjs +1 -1
- package/dist/helpers/source-file-env.cjs +1 -1
- package/dist/helpers/source-file-env.mjs +1 -1
- package/dist/index.cjs +13 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +12 -12
- package/dist/types/plugin.cjs +19 -18
- package/dist/types/plugin.d.cts +5 -6
- package/dist/types/plugin.d.mts +4 -6
- package/dist/types/plugin.mjs +4 -4
- package/package.json +7 -7
- package/dist/deepkit/schemas/reflection.cjs +0 -5426
- 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 -5423
- package/dist/deepkit/schemas/reflection2.cjs +0 -4112
- package/dist/deepkit/schemas/reflection2.mjs +0 -4110
- package/dist/deepkit/src/capnp.cjs +0 -1692
- package/dist/deepkit/src/capnp.mjs +0 -1690
- package/dist/deepkit/src/esbuild-plugin.cjs +0 -99
- package/dist/deepkit/src/esbuild-plugin.mjs +0 -98
- package/dist/deepkit/src/reflect-type.cjs +0 -40
- package/dist/deepkit/src/reflect-type.mjs +0 -38
- package/dist/deepkit/src/resolve-reflections.cjs +0 -23
- package/dist/deepkit/src/resolve-reflections.mjs +0 -22
- package/dist/deepkit/src/transformer.cjs +0 -92
- package/dist/deepkit/src/transformer.mjs +0 -89
- package/dist/deepkit/src/transpile.cjs +0 -39
- package/dist/deepkit/src/transpile.mjs +0 -37
- package/dist/deepkit/src/types.cjs +0 -22
- package/dist/deepkit/src/types.d.cts +0 -10
- package/dist/deepkit/src/types.d.mts +0 -10
- package/dist/deepkit/src/types.mjs +0 -21
- package/dist/deepkit/src/utilities.cjs +0 -184
- package/dist/deepkit/src/utilities.mjs +0 -183
- 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 -134
- package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -126
- 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 -110
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -101
- package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -23
- package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -22
- 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.d.cts +0 -8
- package/dist/plugin-alloy/src/markdown/components/markdown-file.d.mts +0 -8
- 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 -72
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -71
- package/dist/plugin-alloy/src/types/components.cjs +0 -22
- 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/components.mjs +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.cjs +0 -53
- 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/types/plugin.mjs +0 -50
- 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 -12
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -12
- 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 -127
- package/dist/plugin-automd/src/index.mjs +0 -124
- package/dist/plugin-automd/src/types/plugin.cjs +0 -47
- 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/plugin.mjs +0 -47
- package/dist/plugin-automd/src/types/toc.cjs +0 -26
- 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-automd/src/types/toc.mjs +0 -25
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -74
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -70
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -71
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -69
- package/dist/plugin-babel/src/helpers/filters.cjs +0 -158
- package/dist/plugin-babel/src/helpers/filters.mjs +0 -154
- 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 -200
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -192
- package/dist/plugin-babel/src/helpers/options.cjs +0 -73
- package/dist/plugin-babel/src/helpers/options.mjs +0 -70
- package/dist/plugin-babel/src/index.cjs +0 -125
- package/dist/plugin-babel/src/index.mjs +0 -123
- package/dist/plugin-babel/src/types/index.d.mts +0 -1
- package/dist/plugin-babel/src/types/plugin.cjs +0 -42
- 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-babel/src/types/plugin.mjs +0 -39
- package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -136
- 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/internal/helpers/hooks.mjs +0 -134
- package/dist/powerlines/src/lib/build/esbuild.cjs +0 -142
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -140
- 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 -195
- package/dist/powerlines/src/lib/entry.mjs +0 -194
- package/dist/powerlines/src/lib/logger.cjs +0 -108
- package/dist/powerlines/src/lib/logger.mjs +0 -106
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -41
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -40
- package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -98
- package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -97
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -139
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -138
- package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -74
- package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -72
- package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -69
- package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -68
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -68
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -66
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -46
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -45
- package/dist/powerlines/src/types/api.cjs +0 -62
- 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/api.mjs +0 -62
- package/dist/powerlines/src/types/babel.cjs +0 -156
- 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/babel.mjs +0 -147
- package/dist/powerlines/src/types/build.cjs +0 -127
- 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 -121
- package/dist/powerlines/src/types/commands.cjs +0 -16
- 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/commands.mjs +0 -15
- package/dist/powerlines/src/types/config.cjs +0 -420
- 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/config.mjs +0 -397
- package/dist/powerlines/src/types/context.cjs +0 -388
- 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/context.mjs +0 -371
- package/dist/powerlines/src/types/fs.cjs +0 -78
- 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/fs.mjs +0 -75
- package/dist/powerlines/src/types/hooks.cjs +0 -71
- 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/hooks.mjs +0 -68
- package/dist/powerlines/src/types/index.cjs +0 -11
- package/dist/powerlines/src/types/index.d.mts +0 -12
- package/dist/powerlines/src/types/index.mjs +0 -13
- package/dist/powerlines/src/types/plugin.cjs +0 -184
- 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/plugin.mjs +0 -178
- package/dist/powerlines/src/types/resolved.cjs +0 -149
- 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/resolved.mjs +0 -144
- 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.cjs +0 -64
- package/dist/powerlines/src/types/unplugin.d.cts +0 -22
- package/dist/powerlines/src/types/unplugin.d.mts +0 -23
- package/dist/powerlines/src/types/unplugin.mjs +0 -62
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { __ΩPluginContext } from "../../types/context.mjs";
|
|
2
|
-
import { __ΩUnpluginFactory } from "../../types/unplugin.mjs";
|
|
3
|
-
import { extendLog } from "../logger.mjs";
|
|
4
|
-
import { getString } from "../utilities/source-file.mjs";
|
|
5
|
-
import { combineContexts } from "./helpers.mjs";
|
|
6
|
-
import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
7
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
-
import { setParseImpl } from "unplugin";
|
|
9
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
10
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
11
|
-
|
|
12
|
-
//#region ../powerlines/src/lib/unplugin/plugin.ts
|
|
13
|
-
/**
|
|
14
|
-
* Creates a Powerlines unplugin instance.
|
|
15
|
-
*
|
|
16
|
-
* @param context - The plugin context.
|
|
17
|
-
* @returns The unplugin instance.
|
|
18
|
-
*/
|
|
19
|
-
function createUnpluginResolver(context, name = "unplugin") {
|
|
20
|
-
const ctx = context;
|
|
21
|
-
setParseImpl(ctx.parse);
|
|
22
|
-
return () => {
|
|
23
|
-
const log = extendLog(ctx.log, name);
|
|
24
|
-
log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
|
|
25
|
-
try {
|
|
26
|
-
const { resolveId, load } = (createUnpluginModuleResolutionFunctions.Ω = [[() => __ΩPluginContext, "n!"]], createUnpluginModuleResolutionFunctions(context));
|
|
27
|
-
return {
|
|
28
|
-
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
|
|
29
|
-
api: ctx.$$internal.api,
|
|
30
|
-
resolveId: {
|
|
31
|
-
filter: { id: { include: [/.*/] } },
|
|
32
|
-
handler: resolveId
|
|
33
|
-
},
|
|
34
|
-
load: {
|
|
35
|
-
filter: { id: { include: [/.*/] } },
|
|
36
|
-
handler: load
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
} catch (error) {
|
|
40
|
-
log(LogLevelLabel.FATAL, error?.message);
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
createUnpluginResolver.__type = [
|
|
46
|
-
"context",
|
|
47
|
-
"name",
|
|
48
|
-
() => __ΩUnpluginFactory,
|
|
49
|
-
"createUnpluginResolver",
|
|
50
|
-
"Creates a Powerlines unplugin instance.",
|
|
51
|
-
"P\"2!\"2\"\"o#\"/$?%"
|
|
52
|
-
];
|
|
53
|
-
/**
|
|
54
|
-
* Creates a Powerlines unplugin instance.
|
|
55
|
-
*
|
|
56
|
-
* @param context - The plugin context.
|
|
57
|
-
* @returns The unplugin instance.
|
|
58
|
-
*/
|
|
59
|
-
function createUnplugin(context, name = "unplugin") {
|
|
60
|
-
const ctx = context;
|
|
61
|
-
setParseImpl(ctx.parse);
|
|
62
|
-
return () => {
|
|
63
|
-
const log = extendLog(ctx.log, name);
|
|
64
|
-
log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
|
|
65
|
-
try {
|
|
66
|
-
const { resolveId, load } = (createUnpluginModuleResolutionFunctions.Ω = [[() => __ΩPluginContext, "n!"]], createUnpluginModuleResolutionFunctions(context));
|
|
67
|
-
async function buildStart() {
|
|
68
|
-
log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
69
|
-
await ctx.$$internal.callHook("buildStart", { sequential: true });
|
|
70
|
-
}
|
|
71
|
-
buildStart.__type = [
|
|
72
|
-
"this",
|
|
73
|
-
"buildStart",
|
|
74
|
-
"P!2!\"/\""
|
|
75
|
-
];
|
|
76
|
-
async function transform(code, id) {
|
|
77
|
-
let transformed = code;
|
|
78
|
-
for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
|
|
79
|
-
const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), id]);
|
|
80
|
-
if (result) transformed = result;
|
|
81
|
-
}
|
|
82
|
-
return transformed;
|
|
83
|
-
}
|
|
84
|
-
transform.__type = [
|
|
85
|
-
"this",
|
|
86
|
-
"code",
|
|
87
|
-
"id",
|
|
88
|
-
"transform",
|
|
89
|
-
"PP!!K2!&2\"&2#P!,-J`/$"
|
|
90
|
-
];
|
|
91
|
-
async function buildEnd() {
|
|
92
|
-
log(LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
|
|
93
|
-
return ctx.$$internal.callHook("buildEnd", { sequential: true });
|
|
94
|
-
}
|
|
95
|
-
buildEnd.__type = [
|
|
96
|
-
"this",
|
|
97
|
-
"buildEnd",
|
|
98
|
-
"P!2!$`/\""
|
|
99
|
-
];
|
|
100
|
-
async function writeBundle() {
|
|
101
|
-
log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
|
|
102
|
-
return ctx.$$internal.callHook("writeBundle", { sequential: true });
|
|
103
|
-
}
|
|
104
|
-
writeBundle.__type = ["writeBundle", "P$`/!"];
|
|
105
|
-
return {
|
|
106
|
-
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
|
|
107
|
-
api: ctx.$$internal.api,
|
|
108
|
-
resolveId: {
|
|
109
|
-
filter: { id: { include: [/.*/] } },
|
|
110
|
-
handler: resolveId
|
|
111
|
-
},
|
|
112
|
-
load: {
|
|
113
|
-
filter: { id: { include: [/.*/] } },
|
|
114
|
-
handler: load
|
|
115
|
-
},
|
|
116
|
-
transform,
|
|
117
|
-
buildStart,
|
|
118
|
-
buildEnd,
|
|
119
|
-
writeBundle,
|
|
120
|
-
vite: { sharedDuringBuild: true }
|
|
121
|
-
};
|
|
122
|
-
} catch (error) {
|
|
123
|
-
log(LogLevelLabel.FATAL, error?.message);
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
createUnplugin.__type = [
|
|
129
|
-
"context",
|
|
130
|
-
"name",
|
|
131
|
-
() => __ΩUnpluginFactory,
|
|
132
|
-
"createUnplugin",
|
|
133
|
-
"Creates a Powerlines unplugin instance.",
|
|
134
|
-
"P\"2!\"2\"\"o#\"/$?%"
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
export { createUnpluginResolver };
|
|
@@ -1,74 +0,0 @@
|
|
|
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
|
-
const require_plugin = require('../unplugin/plugin.cjs');
|
|
6
|
-
let defu = require("defu");
|
|
7
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
8
|
-
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
9
|
-
let esbuild = require("esbuild");
|
|
10
|
-
let unplugin = require("unplugin");
|
|
11
|
-
|
|
12
|
-
//#region ../powerlines/src/lib/utilities/bundle.ts
|
|
13
|
-
const __ΩPartial = [
|
|
14
|
-
"T",
|
|
15
|
-
"Partial",
|
|
16
|
-
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
17
|
-
];
|
|
18
|
-
function __assignType(fn, args) {
|
|
19
|
-
fn.__type = args;
|
|
20
|
-
return fn;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Bundle a type definition to a module.
|
|
24
|
-
*
|
|
25
|
-
* @param context - The context object containing the environment paths.
|
|
26
|
-
* @param file - The file path to bundle.
|
|
27
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
28
|
-
* @returns A promise that resolves to the bundled module.
|
|
29
|
-
*/
|
|
30
|
-
async function bundle(context, file, overrides = {}) {
|
|
31
|
-
const path = await context.fs.resolve(file);
|
|
32
|
-
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
33
|
-
const result = await (0, esbuild.build)((0, defu.default)({
|
|
34
|
-
...require_esbuild.extractESBuildConfig(context),
|
|
35
|
-
entryPoints: [path],
|
|
36
|
-
write: false,
|
|
37
|
-
sourcemap: false,
|
|
38
|
-
splitting: false,
|
|
39
|
-
treeShaking: false,
|
|
40
|
-
bundle: true,
|
|
41
|
-
packages: "bundle",
|
|
42
|
-
platform: "node",
|
|
43
|
-
logLevel: "silent",
|
|
44
|
-
...overrides
|
|
45
|
-
}, { plugins: [(0, unplugin.createEsbuildPlugin)(require_plugin.createUnpluginResolver(context, `${(0, __stryke_path_file_path_fns.findFileName)(file)} Bundler`))({})] }));
|
|
46
|
-
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map(__assignType((error) => error.text, [
|
|
47
|
-
"error",
|
|
48
|
-
"",
|
|
49
|
-
"P\"2!\"/\""
|
|
50
|
-
])).join(", ")}`);
|
|
51
|
-
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map(__assignType((warning) => warning.text, [
|
|
52
|
-
"warning",
|
|
53
|
-
"",
|
|
54
|
-
"P\"2!\"/\""
|
|
55
|
-
])).join(", ")}`);
|
|
56
|
-
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.`);
|
|
57
|
-
return result.outputFiles.filter(Boolean)[0];
|
|
58
|
-
}
|
|
59
|
-
bundle.__type = [
|
|
60
|
-
() => require_context.__ΩPluginContext,
|
|
61
|
-
"context",
|
|
62
|
-
"file",
|
|
63
|
-
() => __ΩPartial,
|
|
64
|
-
() => require_build.__ΩESBuildResolvedBuildConfig,
|
|
65
|
-
"overrides",
|
|
66
|
-
() => ({}),
|
|
67
|
-
"OutputFile",
|
|
68
|
-
"bundle",
|
|
69
|
-
"Bundle a type definition to a module.",
|
|
70
|
-
"Pn!2\"&2#n%o$\"2&>'\"w(`/)?*"
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
exports.bundle = bundle;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { __ΩPluginContext } from "../../types/context.mjs";
|
|
2
|
-
import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
|
|
3
|
-
import { extractESBuildConfig } from "../build/esbuild.mjs";
|
|
4
|
-
import { createUnpluginResolver } from "../unplugin/plugin.mjs";
|
|
5
|
-
import defu$1 from "defu";
|
|
6
|
-
import { findFileName } from "@stryke/path/file-path-fns";
|
|
7
|
-
import { build } from "esbuild";
|
|
8
|
-
import { createEsbuildPlugin } from "unplugin";
|
|
9
|
-
|
|
10
|
-
//#region ../powerlines/src/lib/utilities/bundle.ts
|
|
11
|
-
const __ΩPartial = [
|
|
12
|
-
"T",
|
|
13
|
-
"Partial",
|
|
14
|
-
"l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
|
|
15
|
-
];
|
|
16
|
-
function __assignType(fn, args) {
|
|
17
|
-
fn.__type = args;
|
|
18
|
-
return fn;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Bundle a type definition to a module.
|
|
22
|
-
*
|
|
23
|
-
* @param context - The context object containing the environment paths.
|
|
24
|
-
* @param file - The file path to bundle.
|
|
25
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
26
|
-
* @returns A promise that resolves to the bundled module.
|
|
27
|
-
*/
|
|
28
|
-
async function bundle(context, file, overrides = {}) {
|
|
29
|
-
const path = await context.fs.resolve(file);
|
|
30
|
-
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
31
|
-
const result = await build(defu$1({
|
|
32
|
-
...extractESBuildConfig(context),
|
|
33
|
-
entryPoints: [path],
|
|
34
|
-
write: false,
|
|
35
|
-
sourcemap: false,
|
|
36
|
-
splitting: false,
|
|
37
|
-
treeShaking: false,
|
|
38
|
-
bundle: true,
|
|
39
|
-
packages: "bundle",
|
|
40
|
-
platform: "node",
|
|
41
|
-
logLevel: "silent",
|
|
42
|
-
...overrides
|
|
43
|
-
}, { plugins: [createEsbuildPlugin(createUnpluginResolver(context, `${findFileName(file)} Bundler`))({})] }));
|
|
44
|
-
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map(__assignType((error) => error.text, [
|
|
45
|
-
"error",
|
|
46
|
-
"",
|
|
47
|
-
"P\"2!\"/\""
|
|
48
|
-
])).join(", ")}`);
|
|
49
|
-
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map(__assignType((warning) => warning.text, [
|
|
50
|
-
"warning",
|
|
51
|
-
"",
|
|
52
|
-
"P\"2!\"/\""
|
|
53
|
-
])).join(", ")}`);
|
|
54
|
-
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.`);
|
|
55
|
-
return result.outputFiles.filter(Boolean)[0];
|
|
56
|
-
}
|
|
57
|
-
bundle.__type = [
|
|
58
|
-
() => __ΩPluginContext,
|
|
59
|
-
"context",
|
|
60
|
-
"file",
|
|
61
|
-
() => __ΩPartial,
|
|
62
|
-
() => __ΩESBuildResolvedBuildConfig,
|
|
63
|
-
"overrides",
|
|
64
|
-
() => ({}),
|
|
65
|
-
"OutputFile",
|
|
66
|
-
"bundle",
|
|
67
|
-
"Bundle a type definition to a module.",
|
|
68
|
-
"Pn!2\"&2#n%o$\"2&>'\"w(`/)?*"
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { bundle };
|
|
@@ -1,69 +0,0 @@
|
|
|
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_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
6
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
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
|
-
let resolved;
|
|
28
|
-
try {
|
|
29
|
-
resolved = await context.resolver.evalModule(result.text, {
|
|
30
|
-
filename: result.path,
|
|
31
|
-
forceTranspile: true
|
|
32
|
-
});
|
|
33
|
-
} catch (error) {
|
|
34
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(error.message) && (/* @__PURE__ */ new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`)).test(error.message)) {
|
|
35
|
-
const moduleName = error.message.match(/* @__PURE__ */ new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
|
|
36
|
-
throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
37
|
-
|
|
38
|
-
Bundle output for module:
|
|
39
|
-
${result.text}` : ""}`);
|
|
40
|
-
}
|
|
41
|
-
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
42
|
-
|
|
43
|
-
Bundle output for module:
|
|
44
|
-
${result.text}` : ""}`);
|
|
45
|
-
}
|
|
46
|
-
let exportName = typeDefinition.name;
|
|
47
|
-
if (!exportName) exportName = "default";
|
|
48
|
-
const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
49
|
-
if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}${context.config.logLevel === "debug" ? `
|
|
50
|
-
|
|
51
|
-
Bundle output for module:
|
|
52
|
-
${result.text}` : ""}`);
|
|
53
|
-
return resolvedExport;
|
|
54
|
-
}
|
|
55
|
-
resolve.__type = [
|
|
56
|
-
() => require_context.__ΩPluginContext,
|
|
57
|
-
"context",
|
|
58
|
-
"type",
|
|
59
|
-
() => __ΩPartial,
|
|
60
|
-
() => require_build.__ΩESBuildResolvedBuildConfig,
|
|
61
|
-
"overrides",
|
|
62
|
-
() => ({}),
|
|
63
|
-
"resolve",
|
|
64
|
-
"Compiles a type definition to a module.",
|
|
65
|
-
"Pn!2\"!2#n%o$\"2&>'\"`/(?)"
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
exports.resolve = resolve;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { __ΩPluginContext } from "../../types/context.mjs";
|
|
2
|
-
import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
|
|
3
|
-
import { bundle } from "./bundle.mjs";
|
|
4
|
-
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
5
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
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
|
-
let resolved;
|
|
27
|
-
try {
|
|
28
|
-
resolved = await context.resolver.evalModule(result.text, {
|
|
29
|
-
filename: result.path,
|
|
30
|
-
forceTranspile: true
|
|
31
|
-
});
|
|
32
|
-
} catch (error) {
|
|
33
|
-
if (isSetString(error.message) && (/* @__PURE__ */ new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`)).test(error.message)) {
|
|
34
|
-
const moduleName = error.message.match(/* @__PURE__ */ new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
|
|
35
|
-
throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
36
|
-
|
|
37
|
-
Bundle output for module:
|
|
38
|
-
${result.text}` : ""}`);
|
|
39
|
-
}
|
|
40
|
-
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
41
|
-
|
|
42
|
-
Bundle output for module:
|
|
43
|
-
${result.text}` : ""}`);
|
|
44
|
-
}
|
|
45
|
-
let exportName = typeDefinition.name;
|
|
46
|
-
if (!exportName) exportName = "default";
|
|
47
|
-
const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
48
|
-
if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}${context.config.logLevel === "debug" ? `
|
|
49
|
-
|
|
50
|
-
Bundle output for module:
|
|
51
|
-
${result.text}` : ""}`);
|
|
52
|
-
return resolvedExport;
|
|
53
|
-
}
|
|
54
|
-
resolve.__type = [
|
|
55
|
-
() => __ΩPluginContext,
|
|
56
|
-
"context",
|
|
57
|
-
"type",
|
|
58
|
-
() => __ΩPartial,
|
|
59
|
-
() => __ΩESBuildResolvedBuildConfig,
|
|
60
|
-
"overrides",
|
|
61
|
-
() => ({}),
|
|
62
|
-
"resolve",
|
|
63
|
-
"Compiles a type definition to a module.",
|
|
64
|
-
"Pn!2\"!2#n%o$\"2&>'\"`/(?)"
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
export { resolve };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_context = require('../../types/context.cjs');
|
|
3
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
4
|
-
let __stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
5
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
6
|
-
let magic_string = require("magic-string");
|
|
7
|
-
magic_string = require_rolldown_runtime.__toESM(magic_string);
|
|
8
|
-
|
|
9
|
-
//#region ../powerlines/src/lib/utilities/source-file.ts
|
|
10
|
-
/**
|
|
11
|
-
* Get the string from the source.
|
|
12
|
-
*
|
|
13
|
-
* @param code - The source string or magic string.
|
|
14
|
-
* @returns The source string.
|
|
15
|
-
*/
|
|
16
|
-
function getString(code) {
|
|
17
|
-
if (!code) return "";
|
|
18
|
-
if ((0, __stryke_type_checks_is_string.isString)(code)) return code;
|
|
19
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(code) && "code" in code) return code.code;
|
|
20
|
-
return code.toString();
|
|
21
|
-
}
|
|
22
|
-
getString.__type = [
|
|
23
|
-
"code",
|
|
24
|
-
"getString",
|
|
25
|
-
"Get the string from the source.",
|
|
26
|
-
"PP&!!J2!&/\"?#"
|
|
27
|
-
];
|
|
28
|
-
/**
|
|
29
|
-
* Get the magic string.
|
|
30
|
-
*
|
|
31
|
-
* @param code - The source string or magic string.
|
|
32
|
-
* @returns The magic string.
|
|
33
|
-
*/
|
|
34
|
-
function getMagicString(code) {
|
|
35
|
-
if ((0, __stryke_type_checks_is_string.isString)(code)) return new magic_string.default(code);
|
|
36
|
-
return code;
|
|
37
|
-
}
|
|
38
|
-
getMagicString.__type = [
|
|
39
|
-
"code",
|
|
40
|
-
"getMagicString",
|
|
41
|
-
"Get the magic string.",
|
|
42
|
-
"PP&!J2!!/\"?#"
|
|
43
|
-
];
|
|
44
|
-
/**
|
|
45
|
-
* Get the source file.
|
|
46
|
-
*
|
|
47
|
-
* @param code - The source code.
|
|
48
|
-
* @param id - The name of the file.
|
|
49
|
-
* @returns The source file.
|
|
50
|
-
*/
|
|
51
|
-
function getSourceFile(code, id) {
|
|
52
|
-
return {
|
|
53
|
-
id,
|
|
54
|
-
code: getMagicString(code ?? (0, __stryke_fs_read_file.readFileIfExistingSync)(id)),
|
|
55
|
-
env: []
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
getSourceFile.__type = [
|
|
59
|
-
"code",
|
|
60
|
-
"id",
|
|
61
|
-
() => require_context.__ΩSourceFile,
|
|
62
|
-
"getSourceFile",
|
|
63
|
-
"Get the source file.",
|
|
64
|
-
"PP&!J2!&2\"n#/$?%"
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
exports.getString = getString;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { __ΩSourceFile } from "../../types/context.mjs";
|
|
2
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
3
|
-
import { readFileIfExistingSync } from "@stryke/fs/read-file";
|
|
4
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
5
|
-
import MagicString from "magic-string";
|
|
6
|
-
|
|
7
|
-
//#region ../powerlines/src/lib/utilities/source-file.ts
|
|
8
|
-
/**
|
|
9
|
-
* Get the string from the source.
|
|
10
|
-
*
|
|
11
|
-
* @param code - The source string or magic string.
|
|
12
|
-
* @returns The source string.
|
|
13
|
-
*/
|
|
14
|
-
function getString(code) {
|
|
15
|
-
if (!code) return "";
|
|
16
|
-
if (isString(code)) return code;
|
|
17
|
-
if (isSetObject(code) && "code" in code) return code.code;
|
|
18
|
-
return code.toString();
|
|
19
|
-
}
|
|
20
|
-
getString.__type = [
|
|
21
|
-
"code",
|
|
22
|
-
"getString",
|
|
23
|
-
"Get the string from the source.",
|
|
24
|
-
"PP&!!J2!&/\"?#"
|
|
25
|
-
];
|
|
26
|
-
/**
|
|
27
|
-
* Get the magic string.
|
|
28
|
-
*
|
|
29
|
-
* @param code - The source string or magic string.
|
|
30
|
-
* @returns The magic string.
|
|
31
|
-
*/
|
|
32
|
-
function getMagicString(code) {
|
|
33
|
-
if (isString(code)) return new MagicString(code);
|
|
34
|
-
return code;
|
|
35
|
-
}
|
|
36
|
-
getMagicString.__type = [
|
|
37
|
-
"code",
|
|
38
|
-
"getMagicString",
|
|
39
|
-
"Get the magic string.",
|
|
40
|
-
"PP&!J2!!/\"?#"
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* Get the source file.
|
|
44
|
-
*
|
|
45
|
-
* @param code - The source code.
|
|
46
|
-
* @param id - The name of the file.
|
|
47
|
-
* @returns The source file.
|
|
48
|
-
*/
|
|
49
|
-
function getSourceFile(code, id) {
|
|
50
|
-
return {
|
|
51
|
-
id,
|
|
52
|
-
code: getMagicString(code ?? readFileIfExistingSync(id)),
|
|
53
|
-
env: []
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
getSourceFile.__type = [
|
|
57
|
-
"code",
|
|
58
|
-
"id",
|
|
59
|
-
() => __ΩSourceFile,
|
|
60
|
-
"getSourceFile",
|
|
61
|
-
"Get the source file.",
|
|
62
|
-
"PP&!J2!&2\"n#/$?%"
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
//#endregion
|
|
66
|
-
export { getString };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_context = require('../types/context.cjs');
|
|
3
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
4
|
-
|
|
5
|
-
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
6
|
-
/**
|
|
7
|
-
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* The following tokens are supported:
|
|
11
|
-
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
12
|
-
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
13
|
-
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
14
|
-
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
15
|
-
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
16
|
-
* - `{cachePath}` - The environment's directory for cached files.
|
|
17
|
-
* - `{dataPath}` - The environment's directory for data files.
|
|
18
|
-
* - `{logPath}` - The environment's directory for log files.
|
|
19
|
-
* - `{tempPath}` - The environment's directory for temporary files.
|
|
20
|
-
* - `{configPath}` - The environment's directory for configuration files.
|
|
21
|
-
* - `{outputPath}` - The configured output directory for the project.
|
|
22
|
-
* - `{buildPath}` - The configured distribution directory for the project.
|
|
23
|
-
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
24
|
-
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
25
|
-
* - `{entryPath}` - The configured directory for generated entry files.
|
|
26
|
-
*
|
|
27
|
-
* @param context - The context containing the values for the path tokens.
|
|
28
|
-
* @param path - The path string with tokens to replace.
|
|
29
|
-
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
30
|
-
*/
|
|
31
|
-
function replacePathTokens(context, path) {
|
|
32
|
-
if (!path) return path;
|
|
33
|
-
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
34
|
-
}
|
|
35
|
-
replacePathTokens.__type = [
|
|
36
|
-
() => require_context.__ΩUnresolvedContext,
|
|
37
|
-
"context",
|
|
38
|
-
"path",
|
|
39
|
-
true,
|
|
40
|
-
"replacePathTokens",
|
|
41
|
-
"Replaces tokens in the given path string with their corresponding values from the context.",
|
|
42
|
-
"l3-R&RPe#!.$qk#%QRPn!2\"&2#8Pd!p'/%?&"
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
exports.replacePathTokens = replacePathTokens;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { __ΩUnresolvedContext } from "../types/context.mjs";
|
|
2
|
-
import { replacePath } from "@stryke/path/replace";
|
|
3
|
-
|
|
4
|
-
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
5
|
-
/**
|
|
6
|
-
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* The following tokens are supported:
|
|
10
|
-
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
11
|
-
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
12
|
-
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
13
|
-
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
14
|
-
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
15
|
-
* - `{cachePath}` - The environment's directory for cached files.
|
|
16
|
-
* - `{dataPath}` - The environment's directory for data files.
|
|
17
|
-
* - `{logPath}` - The environment's directory for log files.
|
|
18
|
-
* - `{tempPath}` - The environment's directory for temporary files.
|
|
19
|
-
* - `{configPath}` - The environment's directory for configuration files.
|
|
20
|
-
* - `{outputPath}` - The configured output directory for the project.
|
|
21
|
-
* - `{buildPath}` - The configured distribution directory for the project.
|
|
22
|
-
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
23
|
-
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
24
|
-
* - `{entryPath}` - The configured directory for generated entry files.
|
|
25
|
-
*
|
|
26
|
-
* @param context - The context containing the values for the path tokens.
|
|
27
|
-
* @param path - The path string with tokens to replace.
|
|
28
|
-
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
29
|
-
*/
|
|
30
|
-
function replacePathTokens(context, path) {
|
|
31
|
-
if (!path) return path;
|
|
32
|
-
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
33
|
-
}
|
|
34
|
-
replacePathTokens.__type = [
|
|
35
|
-
() => __ΩUnresolvedContext,
|
|
36
|
-
"context",
|
|
37
|
-
"path",
|
|
38
|
-
true,
|
|
39
|
-
"replacePathTokens",
|
|
40
|
-
"Replaces tokens in the given path string with their corresponding values from the context.",
|
|
41
|
-
"l3-R&RPe#!.$qk#%QRPn!2\"&2#8Pd!p'/%?&"
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { replacePathTokens };
|