@powerlines/plugin-webpack 0.5.130 → 0.5.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/index.cjs +3 -2
- package/dist/helpers/index.d.cts +3 -1
- package/dist/helpers/index.d.mts +3 -1
- package/dist/helpers/index.mjs +2 -1
- package/dist/helpers/unplugin.cjs +2 -11
- package/dist/helpers/unplugin.d.cts +2 -6
- package/dist/helpers/unplugin.d.mts +2 -6
- package/dist/helpers/unplugin.mjs +1 -9
- package/dist/helpers-B15z10jN.mjs +1 -0
- package/dist/helpers-LF26RHol.cjs +0 -0
- package/dist/index-9iG2qHLe.d.mts +1 -0
- package/dist/index-D4ELpJXS.d.cts +1 -0
- package/dist/index-D6CnpA_r.d.cts +1 -0
- package/dist/index-DL0uimUT.d.mts +1 -0
- package/dist/index.cjs +50 -8
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +46 -3
- package/dist/plugin-C5bG6Zu0.d.mts +1772 -0
- package/dist/plugin-Cl1J-dKa.d.cts +1769 -0
- package/dist/plugin-ifZVa20V.mjs +1 -0
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -12
- package/dist/types/plugin.d.mts +1 -12
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-U3zd8PTP.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-Bo9KoKSB.d.cts +7 -0
- package/dist/unplugin-Ct4wZxE5.d.mts +7 -0
- package/dist/unplugin-GJmHohOE.mjs +4617 -0
- package/dist/unplugin-bKYETUU8.cjs +4661 -0
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/powerlines/schemas/fs.cjs +0 -226
- package/dist/powerlines/schemas/fs.mjs +0 -224
- package/dist/powerlines/src/api.cjs +0 -580
- package/dist/powerlines/src/api.mjs +0 -578
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
- package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
- package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
- package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -63
- package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -61
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
- package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
- package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
- package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
- package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
- package/dist/powerlines/src/lib/build/webpack.cjs +0 -47
- package/dist/powerlines/src/lib/build/webpack.mjs +0 -45
- package/dist/powerlines/src/lib/config-file.cjs +0 -79
- package/dist/powerlines/src/lib/config-file.mjs +0 -76
- package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
- package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
- package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
- package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
- package/dist/powerlines/src/lib/entry.cjs +0 -69
- package/dist/powerlines/src/lib/entry.mjs +0 -67
- package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
- package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
- package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
- package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
- package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
- package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
- package/dist/powerlines/src/lib/logger.cjs +0 -58
- package/dist/powerlines/src/lib/logger.mjs +0 -55
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
- package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
- package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
- package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
- package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
- package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
- package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
- package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -148
- package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
- package/dist/powerlines/src/types/babel.d.mts +0 -4
- package/dist/powerlines/src/types/build.cjs +0 -15
- package/dist/powerlines/src/types/build.d.cts +0 -149
- package/dist/powerlines/src/types/build.d.mts +0 -149
- package/dist/powerlines/src/types/build.mjs +0 -14
- 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.d.cts +0 -370
- package/dist/powerlines/src/types/config.d.mts +0 -372
- package/dist/powerlines/src/types/context.d.cts +0 -403
- package/dist/powerlines/src/types/context.d.mts +0 -405
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.mts +0 -2
- package/dist/powerlines/src/types/plugin.cjs +0 -32
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/plugin.mjs +0 -31
- package/dist/powerlines/src/types/resolved.d.cts +0 -82
- package/dist/powerlines/src/types/resolved.d.mts +0 -83
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { GLOBAL_ENVIRONMENT, createDefaultEnvironment, createEnvironment } from "../../internal/helpers/environment.mjs";
|
|
2
|
-
import { loadWorkspaceConfig } from "../config-file.mjs";
|
|
3
|
-
import { PowerlinesContext } from "./context.mjs";
|
|
4
|
-
import { PowerlinesEnvironmentContext } from "./environment-context.mjs";
|
|
5
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
6
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
7
|
-
import { resolvePackage } from "@stryke/fs/resolve";
|
|
8
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
|
|
11
|
-
//#region ../powerlines/src/lib/contexts/api-context.ts
|
|
12
|
-
var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext {
|
|
13
|
-
#environments = {};
|
|
14
|
-
#plugins = [];
|
|
15
|
-
#log;
|
|
16
|
-
/**
|
|
17
|
-
* Create a new Storm context from the workspace root and user config.
|
|
18
|
-
*
|
|
19
|
-
* @param workspaceRoot - The root directory of the workspace.
|
|
20
|
-
* @param config - The user configuration options.
|
|
21
|
-
* @returns A promise that resolves to the new context.
|
|
22
|
-
*/
|
|
23
|
-
static async from(workspaceRoot, config) {
|
|
24
|
-
const context = new PowerlinesAPIContext(await loadWorkspaceConfig(workspaceRoot, config.root));
|
|
25
|
-
await context.withUserConfig(config);
|
|
26
|
-
const powerlinesPath = await resolvePackage("powerlines");
|
|
27
|
-
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
28
|
-
context.powerlinesPath = powerlinesPath;
|
|
29
|
-
return context;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Internal context fields and methods
|
|
33
|
-
*
|
|
34
|
-
* @danger
|
|
35
|
-
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
36
|
-
*
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
get $$internal() {
|
|
40
|
-
return super.$$internal;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Internal context fields and methods
|
|
44
|
-
*
|
|
45
|
-
* @danger
|
|
46
|
-
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
47
|
-
*
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
set $$internal(value) {
|
|
51
|
-
super.$$internal = value;
|
|
52
|
-
for (const environment of Object.values(this.environments)) environment.$$internal = super.$$internal;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* A record of all environments by name
|
|
56
|
-
*/
|
|
57
|
-
get environments() {
|
|
58
|
-
return this.#environments;
|
|
59
|
-
}
|
|
60
|
-
get log() {
|
|
61
|
-
if (!this.#log) this.#log = this.createLog();
|
|
62
|
-
return this.#log;
|
|
63
|
-
}
|
|
64
|
-
get plugins() {
|
|
65
|
-
return this.#plugins;
|
|
66
|
-
}
|
|
67
|
-
constructor(workspaceConfig) {
|
|
68
|
-
super(workspaceConfig);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Initialize the context with the provided configuration options
|
|
72
|
-
*
|
|
73
|
-
* @param config - The partial user configuration to use for initialization.
|
|
74
|
-
*/
|
|
75
|
-
async init(config = {}) {
|
|
76
|
-
await super.init(config);
|
|
77
|
-
await Promise.all(toArray(this.config.userConfig.environments && Object.keys(this.config.userConfig.environments).length > 0 ? Object.keys(this.config.userConfig.environments).map((name) => createEnvironment(name, this.config.userConfig)) : createDefaultEnvironment(this.config.userConfig)).map(async (env) => {
|
|
78
|
-
this.#environments[env.name] = await this.in(env);
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A function to copy the context and update the fields for a specific environment
|
|
83
|
-
*
|
|
84
|
-
* @param environment - The environment configuration to use.
|
|
85
|
-
* @returns A new context instance with the updated environment.
|
|
86
|
-
*/
|
|
87
|
-
async in(environment) {
|
|
88
|
-
let context;
|
|
89
|
-
if (this.environments[environment.name]) context = this.environments[environment.name];
|
|
90
|
-
else context = await PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig, this.config);
|
|
91
|
-
if (isSetObject(this.config.inlineConfig)) await context.withInlineConfig(this.config.inlineConfig);
|
|
92
|
-
context.environment = environment;
|
|
93
|
-
context.plugins = [];
|
|
94
|
-
for (const plugin of this.plugins) await context.addPlugin(plugin);
|
|
95
|
-
return context;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Update the context using a new user configuration options
|
|
99
|
-
*
|
|
100
|
-
* @param userConfig - The new user configuration options.
|
|
101
|
-
*/
|
|
102
|
-
async withUserConfig(userConfig, options = { isHighPriority: true }) {
|
|
103
|
-
await super.withUserConfig(userConfig, options);
|
|
104
|
-
await Promise.all(Object.keys(this.#environments).map(async (name) => {
|
|
105
|
-
await this.#environments[name].withUserConfig(userConfig, options);
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Update the context using a new inline configuration options
|
|
110
|
-
*
|
|
111
|
-
* @param inlineConfig - The new inline configuration options.
|
|
112
|
-
*/
|
|
113
|
-
async withInlineConfig(inlineConfig, options = { isHighPriority: true }) {
|
|
114
|
-
await super.withInlineConfig(inlineConfig, options);
|
|
115
|
-
await Promise.all(Object.keys(this.#environments).map(async (name) => {
|
|
116
|
-
await this.#environments[name].withInlineConfig(inlineConfig, options);
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Add a plugin to the API context and all environments
|
|
121
|
-
*
|
|
122
|
-
* @param plugin - The plugin to add.
|
|
123
|
-
*/
|
|
124
|
-
async addPlugin(plugin) {
|
|
125
|
-
this.plugins.push(plugin);
|
|
126
|
-
await Promise.all(Object.keys(this.environments).map(async (name) => {
|
|
127
|
-
await this.environments[name].addPlugin(plugin);
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get an environment by name, or the default environment if no name is provided
|
|
132
|
-
*
|
|
133
|
-
* @param name - The name of the environment to retrieve.
|
|
134
|
-
* @returns The requested environment context.
|
|
135
|
-
*/
|
|
136
|
-
async getEnvironment(name) {
|
|
137
|
-
let environment;
|
|
138
|
-
if (name) environment = this.environments[name];
|
|
139
|
-
if (Object.keys(this.environments).length === 1) {
|
|
140
|
-
environment = this.environments[Object.keys(this.environments)[0]];
|
|
141
|
-
this.log(LogLevelLabel.DEBUG, `Applying the only configured environment: ${chalk.bold.cyanBright(environment?.environment.name)}`);
|
|
142
|
-
}
|
|
143
|
-
if (!environment) {
|
|
144
|
-
if (name) throw new Error(`Environment "${name}" not found.`);
|
|
145
|
-
environment = await this.in(createDefaultEnvironment(this.config.userConfig));
|
|
146
|
-
this.log(LogLevelLabel.WARN, `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(environment?.environment.name)}`);
|
|
147
|
-
}
|
|
148
|
-
return environment;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* A safe version of `getEnvironment` that returns `undefined` if the environment is not found
|
|
152
|
-
*
|
|
153
|
-
* @param name - The name of the environment to retrieve.
|
|
154
|
-
* @returns The requested environment context or `undefined` if not found.
|
|
155
|
-
*/
|
|
156
|
-
async getEnvironmentSafe(name) {
|
|
157
|
-
try {
|
|
158
|
-
return await this.getEnvironment(name);
|
|
159
|
-
} catch {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* A function to merge all configured environments into a single context.
|
|
165
|
-
*
|
|
166
|
-
* @remarks
|
|
167
|
-
* If only one environment is configured, that environment will be returned directly.
|
|
168
|
-
*
|
|
169
|
-
* @returns A promise that resolves to a merged/global environment context.
|
|
170
|
-
*/
|
|
171
|
-
async toEnvironment() {
|
|
172
|
-
let environment;
|
|
173
|
-
if (Object.keys(this.environments).length > 1) {
|
|
174
|
-
environment = await this.in(createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig));
|
|
175
|
-
this.log(LogLevelLabel.DEBUG, `Combined all ${Object.keys(this.environments).length} environments into a single global context.`);
|
|
176
|
-
} else environment = await this.getEnvironment();
|
|
177
|
-
return environment;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
export { PowerlinesAPIContext };
|