@powerlines/engine 0.0.2
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/LICENSE +201 -0
- package/README.md +303 -0
- package/dist/_internal/worker.cjs +4824 -0
- package/dist/_internal/worker.d.cts +38 -0
- package/dist/_internal/worker.d.cts.map +1 -0
- package/dist/_internal/worker.d.mts +38 -0
- package/dist/_internal/worker.d.mts.map +1 -0
- package/dist/_internal/worker.mjs +4785 -0
- package/dist/_internal/worker.mjs.map +1 -0
- package/dist/api.cjs +1265 -0
- package/dist/api.d.cts +265 -0
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.mts +265 -0
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +1261 -0
- package/dist/api.mjs.map +1 -0
- package/dist/base-context-BUnL_9z8.mjs +241 -0
- package/dist/base-context-BUnL_9z8.mjs.map +1 -0
- package/dist/base-context-CFvO2N9I.cjs +248 -0
- package/dist/chunk-C0xms8kb.cjs +34 -0
- package/dist/context/index.cjs +11 -0
- package/dist/context/index.d.cts +658 -0
- package/dist/context/index.d.cts.map +1 -0
- package/dist/context/index.d.mts +658 -0
- package/dist/context/index.d.mts.map +1 -0
- package/dist/context/index.mjs +5 -0
- package/dist/engine-context-BuD9AGfd.mjs +41 -0
- package/dist/engine-context-BuD9AGfd.mjs.map +1 -0
- package/dist/engine-context-NO6enYev.cjs +45 -0
- package/dist/execution-context-BxANz9k2.cjs +2600 -0
- package/dist/execution-context-CNhvjS52.mjs +2556 -0
- package/dist/execution-context-CNhvjS52.mjs.map +1 -0
- package/dist/fs-D1nIP45P.mjs +226 -0
- package/dist/fs-D1nIP45P.mjs.map +1 -0
- package/dist/fs-XogSgMqT.cjs +262 -0
- package/dist/index.cjs +569 -0
- package/dist/index.d.cts +126 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +126 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +568 -0
- package/dist/index.mjs.map +1 -0
- package/dist/schemas.cjs +9 -0
- package/dist/schemas.d.cts +127 -0
- package/dist/schemas.d.cts.map +1 -0
- package/dist/schemas.d.mts +127 -0
- package/dist/schemas.d.mts.map +1 -0
- package/dist/schemas.mjs +3 -0
- package/dist/storage/index.cjs +9 -0
- package/dist/storage/index.d.cts +419 -0
- package/dist/storage/index.d.cts.map +1 -0
- package/dist/storage/index.d.mts +419 -0
- package/dist/storage/index.d.mts.map +1 -0
- package/dist/storage/index.mjs +3 -0
- package/dist/ts-morph-BaLPVAdB.cjs +114 -0
- package/dist/ts-morph-D0CaA37w.mjs +102 -0
- package/dist/ts-morph-D0CaA37w.mjs.map +1 -0
- package/dist/tsconfig-Cstsoprg.mjs +155 -0
- package/dist/tsconfig-Cstsoprg.mjs.map +1 -0
- package/dist/tsconfig-DeyWQC2N.cjs +198 -0
- package/dist/typescript/index.cjs +13 -0
- package/dist/typescript/index.d.cts +106 -0
- package/dist/typescript/index.d.cts.map +1 -0
- package/dist/typescript/index.d.mts +106 -0
- package/dist/typescript/index.d.mts.map +1 -0
- package/dist/typescript/index.mjs +4 -0
- package/dist/virtual-BNdKVkRw.cjs +548 -0
- package/dist/virtual-gIlTc3Lj.mjs +513 -0
- package/dist/virtual-gIlTc3Lj.mjs.map +1 -0
- package/package.json +183 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
+
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
3
|
+
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
4
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
5
|
+
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
6
|
+
let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
|
|
7
|
+
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
8
|
+
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
9
|
+
let _stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
|
|
10
|
+
let chalk = require("chalk");
|
|
11
|
+
chalk = require_chunk.__toESM(chalk, 1);
|
|
12
|
+
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
13
|
+
let defu = require("defu");
|
|
14
|
+
defu = require_chunk.__toESM(defu, 1);
|
|
15
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
16
|
+
let jiti = require("jiti");
|
|
17
|
+
|
|
18
|
+
//#region src/_internal/helpers/resolver.ts
|
|
19
|
+
/**
|
|
20
|
+
* Create a Jiti resolver for the given workspace and project root.
|
|
21
|
+
*
|
|
22
|
+
* @param options - The options for creating the resolver.
|
|
23
|
+
* @returns A Jiti instance configured for the specified workspace and project root.
|
|
24
|
+
*/
|
|
25
|
+
function resolveOptions(options) {
|
|
26
|
+
return (0, defu.default)(options, {
|
|
27
|
+
interopDefault: true,
|
|
28
|
+
fsCache: options.mode !== "development" ? (0, _stryke_path_join_paths.joinPaths)(options.cacheDir, "jiti") : false,
|
|
29
|
+
moduleCache: options.mode !== "development"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a Jiti resolver for the given workspace and project root.
|
|
34
|
+
*
|
|
35
|
+
* @param options - The options for creating the resolver.
|
|
36
|
+
* @returns A Jiti instance configured for the specified workspace and project root.
|
|
37
|
+
*/
|
|
38
|
+
function createResolver(options) {
|
|
39
|
+
const baseResolver = (0, jiti.createJiti)((0, _stryke_path_join_paths.joinPaths)(options.workspaceRoot, options.root), resolveOptions(options));
|
|
40
|
+
baseResolver.plugin = (0, jiti.createJiti)((0, _stryke_path_join_paths.joinPaths)(options.workspaceRoot, options.root), resolveOptions(options));
|
|
41
|
+
return baseResolver;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/context/base-context.ts
|
|
46
|
+
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
47
|
+
#timestamp = Date.now();
|
|
48
|
+
#logLevel = "info";
|
|
49
|
+
/**
|
|
50
|
+
* The path to the Powerlines package
|
|
51
|
+
*/
|
|
52
|
+
powerlinesPath;
|
|
53
|
+
/**
|
|
54
|
+
* The module resolver for the project
|
|
55
|
+
*/
|
|
56
|
+
resolver;
|
|
57
|
+
/**
|
|
58
|
+
* The options provided to the Powerlines process
|
|
59
|
+
*/
|
|
60
|
+
options;
|
|
61
|
+
/**
|
|
62
|
+
* The parsed configuration file for the project
|
|
63
|
+
*/
|
|
64
|
+
configFile;
|
|
65
|
+
/**
|
|
66
|
+
* A timestamp representing when the context was initialized
|
|
67
|
+
*/
|
|
68
|
+
get timestamp() {
|
|
69
|
+
return new Date(this.#timestamp);
|
|
70
|
+
}
|
|
71
|
+
get logLevel() {
|
|
72
|
+
return this.#logLevel || "info";
|
|
73
|
+
}
|
|
74
|
+
set logLevel(level) {
|
|
75
|
+
this.#logLevel = level;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The logger function
|
|
79
|
+
*/
|
|
80
|
+
get log() {
|
|
81
|
+
const level = this.logLevel || "info";
|
|
82
|
+
if (!this.logger || this.logger.level !== level) this.logger = {
|
|
83
|
+
log: this.createLog(),
|
|
84
|
+
level
|
|
85
|
+
};
|
|
86
|
+
return this.logger.log;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The environment paths for the project
|
|
90
|
+
*/
|
|
91
|
+
get envPaths() {
|
|
92
|
+
return (0, _stryke_env_get_env_paths.getEnvPaths)({
|
|
93
|
+
orgId: this.options.organization,
|
|
94
|
+
appId: this.options.framework || "powerlines",
|
|
95
|
+
workspaceRoot: this.options.cwd || process.cwd() || "."
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
|
|
103
|
+
*
|
|
104
|
+
* @returns A promise that resolves to the cloned context.
|
|
105
|
+
*/
|
|
106
|
+
async clone() {
|
|
107
|
+
const clone = new PowerlinesBaseContext();
|
|
108
|
+
await clone.init(this.options);
|
|
109
|
+
return clone;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A logging function for fatal messages
|
|
113
|
+
*
|
|
114
|
+
* @param message - The message to log.
|
|
115
|
+
*/
|
|
116
|
+
fatal(message) {
|
|
117
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.FATAL, (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A logging function for error messages
|
|
121
|
+
*
|
|
122
|
+
* @param message - The message to log.
|
|
123
|
+
*/
|
|
124
|
+
error(message) {
|
|
125
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.ERROR, (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A logging function for warning messages
|
|
129
|
+
*
|
|
130
|
+
* @param message - The message to log.
|
|
131
|
+
*/
|
|
132
|
+
warn(message) {
|
|
133
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.WARN, (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A logging function for informational messages
|
|
137
|
+
*
|
|
138
|
+
* @param message - The message to log.
|
|
139
|
+
*/
|
|
140
|
+
info(message) {
|
|
141
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.INFO, (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A logging function for debug messages
|
|
145
|
+
*
|
|
146
|
+
* @param message - The message to log.
|
|
147
|
+
*/
|
|
148
|
+
debug(message) {
|
|
149
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A logging function for trace messages
|
|
153
|
+
*
|
|
154
|
+
* @param message - The message to log.
|
|
155
|
+
*/
|
|
156
|
+
trace(message) {
|
|
157
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.TRACE, (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A function to create a timer for measuring the duration of asynchronous operations
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const stopTimer = context.timer("Your Async Operation");
|
|
165
|
+
* await performAsyncOperation();
|
|
166
|
+
* stopTimer(); // "Your Async Operation completed in 123.45 milliseconds"
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @param name - The name of the timer.
|
|
170
|
+
* @returns A function that, when called, stops the timer and logs the duration.
|
|
171
|
+
*/
|
|
172
|
+
timer(name) {
|
|
173
|
+
const startDate = Date.now();
|
|
174
|
+
const startDuration = performance.now();
|
|
175
|
+
return () => {
|
|
176
|
+
const duration = performance.now() - startDuration;
|
|
177
|
+
this.log(_storm_software_config_tools_types.LogLevelLabel.PERFORMANCE, `${chalk.default.bold.cyanBright(name)} completed in ${chalk.default.bold.cyanBright(duration < 1e3 ? `${duration.toFixed(2)} milliseconds` : (0, date_fns_formatDistanceToNowStrict.formatDistanceToNowStrict)(startDate))}`);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Create a new logger instance
|
|
182
|
+
*
|
|
183
|
+
* @param name - The name to use for the logger instance
|
|
184
|
+
* @returns A logger function
|
|
185
|
+
*/
|
|
186
|
+
createLog(name = null) {
|
|
187
|
+
return (0, _powerlines_core_lib_logger.createLog)(name, {
|
|
188
|
+
...this.options,
|
|
189
|
+
logLevel: (0, _stryke_type_checks_is_null.isNull)(this.logLevel) ? "silent" : this.logLevel
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Extend the current logger instance with a new name
|
|
194
|
+
*
|
|
195
|
+
* @param name - The name to use for the extended logger instance
|
|
196
|
+
* @returns A logger function
|
|
197
|
+
*/
|
|
198
|
+
extendLog(name) {
|
|
199
|
+
return (0, _powerlines_core_lib_logger.extendLog)(this.log, name);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A logger function specific to this context
|
|
203
|
+
*/
|
|
204
|
+
logger;
|
|
205
|
+
/**
|
|
206
|
+
* Initialize the context with the provided configuration options
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
|
|
210
|
+
*
|
|
211
|
+
* @param options - The configuration options to initialize the context with
|
|
212
|
+
*/
|
|
213
|
+
async init(options = {}) {
|
|
214
|
+
if (!this.powerlinesPath) {
|
|
215
|
+
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
216
|
+
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
217
|
+
this.powerlinesPath = powerlinesPath;
|
|
218
|
+
}
|
|
219
|
+
this.options = (0, defu.default)({
|
|
220
|
+
root: options.root,
|
|
221
|
+
cwd: options.cwd,
|
|
222
|
+
mode: options.mode,
|
|
223
|
+
framework: options.framework,
|
|
224
|
+
organization: options.organization,
|
|
225
|
+
configFile: options.configFile
|
|
226
|
+
}, this.options ?? {}, {
|
|
227
|
+
cwd: process.cwd() || ".",
|
|
228
|
+
mode: "production",
|
|
229
|
+
framework: "powerlines"
|
|
230
|
+
});
|
|
231
|
+
this.resolver = createResolver({
|
|
232
|
+
workspaceRoot: this.options.cwd,
|
|
233
|
+
root: this.options.root,
|
|
234
|
+
cacheDir: this.envPaths.cache,
|
|
235
|
+
mode: this.options.mode,
|
|
236
|
+
logLevel: this.logLevel
|
|
237
|
+
});
|
|
238
|
+
this.configFile = await (0, _powerlines_core_lib_config.loadUserConfigFile)(this.options, this.resolver);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
//#endregion
|
|
243
|
+
Object.defineProperty(exports, 'PowerlinesBaseContext', {
|
|
244
|
+
enumerable: true,
|
|
245
|
+
get: function () {
|
|
246
|
+
return PowerlinesBaseContext;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, '__toESM', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return __toESM;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_base_context = require('../base-context-CFvO2N9I.cjs');
|
|
3
|
+
const require_engine_context = require('../engine-context-NO6enYev.cjs');
|
|
4
|
+
const require_execution_context = require('../execution-context-BxANz9k2.cjs');
|
|
5
|
+
|
|
6
|
+
exports.PowerlinesBaseContext = require_base_context.PowerlinesBaseContext;
|
|
7
|
+
exports.PowerlinesContext = require_execution_context.PowerlinesContext;
|
|
8
|
+
exports.PowerlinesEngineContext = require_engine_context.PowerlinesEngineContext;
|
|
9
|
+
exports.PowerlinesEnvironmentContext = require_execution_context.PowerlinesEnvironmentContext;
|
|
10
|
+
exports.PowerlinesExecutionContext = require_execution_context.PowerlinesExecutionContext;
|
|
11
|
+
exports.createPluginContext = require_execution_context.createPluginContext;
|