@powerlines/engine 0.44.1 → 0.44.3
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/_internal/worker.cjs +34 -5
- package/dist/_internal/worker.mjs +35 -6
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +4 -4
- package/dist/api.mjs +4 -4
- package/dist/{base-context-DkGTyGX0.cjs → base-context-CAA1druQ.cjs} +34 -1
- package/dist/{base-context-Dv5OTHxZ.mjs → base-context-fOM4ZWUo.mjs} +39 -6
- package/dist/base-context-fOM4ZWUo.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-CytME-Ht.mjs → engine-context-BWGxMU_n.mjs} +2 -2
- package/dist/{engine-context-CytME-Ht.mjs.map → engine-context-BWGxMU_n.mjs.map} +1 -1
- package/dist/{engine-context-CDSR7PHF.cjs → engine-context-CUPubmrM.cjs} +1 -1
- package/dist/{execution-context-B-CVP76S.cjs → execution-context-BoJhCK0d.cjs} +9 -9
- package/dist/{execution-context-F7RyGqff.mjs → execution-context-CFJst4Fz.mjs} +10 -10
- package/dist/{execution-context-F7RyGqff.mjs.map → execution-context-CFJst4Fz.mjs.map} +1 -1
- package/dist/index.cjs +107 -41
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +107 -41
- package/dist/index.mjs.map +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.mjs +1 -1
- package/dist/{tsconfig-Cstsoprg.mjs → tsconfig-CI6bla4E.mjs} +2 -2
- package/dist/{tsconfig-Cstsoprg.mjs.map → tsconfig-CI6bla4E.mjs.map} +1 -1
- package/dist/{tsconfig-DeyWQC2N.cjs → tsconfig-QMSxSwBD.cjs} +1 -1
- package/dist/typescript/index.cjs +1 -1
- package/dist/typescript/index.mjs +1 -1
- package/dist/{virtual-CUgOdyIa.mjs → virtual-CYGZHTDd.mjs} +5 -5
- package/dist/virtual-CYGZHTDd.mjs.map +1 -0
- package/dist/{virtual-1hYa9zCy.cjs → virtual-Ct3ZqPeN.cjs} +2 -2
- package/package.json +3 -3
- package/dist/base-context-Dv5OTHxZ.mjs.map +0 -1
- package/dist/virtual-CUgOdyIa.mjs.map +0 -1
|
@@ -103,7 +103,9 @@ let typescript = require("typescript");
|
|
|
103
103
|
typescript = __toESM(typescript, 1);
|
|
104
104
|
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
105
105
|
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
106
|
+
let _stryke_fs = require("@stryke/fs");
|
|
106
107
|
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
108
|
+
let _stryke_path = require("@stryke/path");
|
|
107
109
|
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
108
110
|
let jiti = require("jiti");
|
|
109
111
|
let _stryke_helpers_get_field = require("@stryke/helpers/get-field");
|
|
@@ -2193,6 +2195,7 @@ function createResolver(options) {
|
|
|
2193
2195
|
//#region src/context/base-context.ts
|
|
2194
2196
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
2195
2197
|
#timestamp = Date.now();
|
|
2198
|
+
#name = "powerlines";
|
|
2196
2199
|
/**
|
|
2197
2200
|
* The path to the Powerlines package
|
|
2198
2201
|
*/
|
|
@@ -2333,7 +2336,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2333
2336
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2334
2337
|
*/
|
|
2335
2338
|
createLogger(options, callback) {
|
|
2336
|
-
return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.
|
|
2339
|
+
return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.root, options, callback);
|
|
2337
2340
|
}
|
|
2338
2341
|
/**
|
|
2339
2342
|
* Extend the base logger with additional configuration options
|
|
@@ -2362,6 +2365,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2362
2365
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
2363
2366
|
const root = (0, _stryke_path_replace.replacePath)((options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !(0, _stryke_path_is_equal.isEqual)(options.root || this.options.root, cwd) ? options.root || this.options.root : ".", cwd);
|
|
2364
2367
|
this.options = (0, defu.default)({
|
|
2368
|
+
name: options.name,
|
|
2365
2369
|
root,
|
|
2366
2370
|
cwd,
|
|
2367
2371
|
mode: options.mode,
|
|
@@ -2381,6 +2385,31 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2381
2385
|
logLevel: this.logLevel
|
|
2382
2386
|
});
|
|
2383
2387
|
this.configFile = await (0, _powerlines_core_lib_config.loadUserConfigFile)(this.options, this.resolver);
|
|
2388
|
+
if (!this.options.name) {
|
|
2389
|
+
if (this.configFile.config) {
|
|
2390
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.configFile.config) && (0, _stryke_type_checks_is_set_string.isSetString)(this.configFile.config.name)) this.options.name = this.configFile.config.name;
|
|
2391
|
+
else if (Array.isArray(this.configFile.config)) {
|
|
2392
|
+
for (const config of this.configFile.config) if ((0, _stryke_type_checks_is_set_object.isSetObject)(config) && (0, _stryke_type_checks_is_set_string.isSetString)(config.name)) {
|
|
2393
|
+
this.options.name = config.name;
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
if (!this.options.name) {
|
|
2399
|
+
const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "package.json");
|
|
2400
|
+
if ((0, node_fs.existsSync)(packageJsonPath)) {
|
|
2401
|
+
const packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
|
|
2402
|
+
this.options.name = packageJson.name;
|
|
2403
|
+
}
|
|
2404
|
+
if (!this.options.name) {
|
|
2405
|
+
const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "project.json");
|
|
2406
|
+
if ((0, node_fs.existsSync)(projectJsonPath)) {
|
|
2407
|
+
const projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
|
|
2408
|
+
this.options.name = projectJson.name;
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2384
2413
|
}
|
|
2385
2414
|
};
|
|
2386
2415
|
|
|
@@ -3132,7 +3161,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3132
3161
|
*/
|
|
3133
3162
|
async innerSetup() {
|
|
3134
3163
|
const logger = this.extendLogger({ category: "config" });
|
|
3135
|
-
logger.
|
|
3164
|
+
logger.trace(`Pre-setup Powerlines configuration object: \n${JSON.stringify({
|
|
3136
3165
|
...(0, _stryke_helpers_omit.omit)(this.config, ["plugins"]),
|
|
3137
3166
|
userConfig: this.config.userConfig ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : {},
|
|
3138
3167
|
inlineConfig: this.config.inlineConfig ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : {},
|
|
@@ -3164,8 +3193,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3164
3193
|
else this.config.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
3165
3194
|
if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
3166
3195
|
else if (this.config.tsconfig) this.config.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.tsconfig), this.config.cwd);
|
|
3167
|
-
this.
|
|
3168
|
-
path: (0, _stryke_path_join.joinPaths)(this.config.root, "dist"),
|
|
3196
|
+
this.config.output = (0, defu.default)(this.config.output ?? {}, {
|
|
3169
3197
|
copy: { assets: [
|
|
3170
3198
|
{ glob: "LICENSE" },
|
|
3171
3199
|
{
|
|
@@ -3182,6 +3210,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3182
3210
|
});
|
|
3183
3211
|
this.config.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
3184
3212
|
if (this.config.output.path) this.config.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.path), this.config.cwd);
|
|
3213
|
+
else this.config.output.path = (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(this.config.root, "dist"), this.config.cwd);
|
|
3185
3214
|
if (this.config.output.copy !== false) {
|
|
3186
3215
|
this.config.output.copy ??= {};
|
|
3187
3216
|
if (!this.config.root.replace(/^\.\/?/, "")) this.config.output.copy.path = this.config.output.copy.path ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.copy.path), this.config.cwd) : this.config.output.path;
|
|
@@ -3209,7 +3238,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3209
3238
|
}));
|
|
3210
3239
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.output?.storage) && this.config.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.output?.storage) && Object.values(this.config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
|
|
3211
3240
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3212
|
-
logger.debug(`
|
|
3241
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig)) logger.debug(`Resolved Powerlines configuration object: \n${JSON.stringify({
|
|
3213
3242
|
...(0, _stryke_helpers_omit.omit)(this.config, ["plugins"]),
|
|
3214
3243
|
userConfig: this.config.userConfig ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : {},
|
|
3215
3244
|
inlineConfig: this.config.inlineConfig ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : {},
|
|
@@ -64,13 +64,15 @@ import { fileURLToPath } from "node:url";
|
|
|
64
64
|
import { isDirectory, isFile } from "@stryke/fs/is-file";
|
|
65
65
|
import { readFile, readFileSync } from "@stryke/fs/read-file";
|
|
66
66
|
import { writeFile, writeFileSync } from "@stryke/fs/write-file";
|
|
67
|
-
import { unlinkSync } from "node:fs";
|
|
67
|
+
import { existsSync as existsSync$1, unlinkSync } from "node:fs";
|
|
68
68
|
import { unlink } from "node:fs/promises";
|
|
69
69
|
import { resolve as resolve$1 } from "node:path";
|
|
70
70
|
import ts from "typescript";
|
|
71
71
|
import { loadUserConfigFile } from "@powerlines/core/lib/config";
|
|
72
72
|
import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
73
|
+
import { readJsonFile as readJsonFile$1 } from "@stryke/fs";
|
|
73
74
|
import { StormJSON } from "@stryke/json/storm-json";
|
|
75
|
+
import { joinPaths as joinPaths$2 } from "@stryke/path";
|
|
74
76
|
import { formatDistanceToNowStrict } from "date-fns/formatDistanceToNowStrict";
|
|
75
77
|
import { createJiti } from "jiti";
|
|
76
78
|
import { getField } from "@stryke/helpers/get-field";
|
|
@@ -2160,6 +2162,7 @@ function createResolver(options) {
|
|
|
2160
2162
|
//#region src/context/base-context.ts
|
|
2161
2163
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
2162
2164
|
#timestamp = Date.now();
|
|
2165
|
+
#name = "powerlines";
|
|
2163
2166
|
/**
|
|
2164
2167
|
* The path to the Powerlines package
|
|
2165
2168
|
*/
|
|
@@ -2300,7 +2303,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2300
2303
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2301
2304
|
*/
|
|
2302
2305
|
createLogger(options, callback) {
|
|
2303
|
-
return createLogger$1(this.options.name || this.options.
|
|
2306
|
+
return createLogger$1(this.options.name || this.options.root, options, callback);
|
|
2304
2307
|
}
|
|
2305
2308
|
/**
|
|
2306
2309
|
* Extend the base logger with additional configuration options
|
|
@@ -2329,6 +2332,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2329
2332
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
2330
2333
|
const root = replacePath((options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !isEqual(options.root || this.options.root, cwd) ? options.root || this.options.root : ".", cwd);
|
|
2331
2334
|
this.options = defu({
|
|
2335
|
+
name: options.name,
|
|
2332
2336
|
root,
|
|
2333
2337
|
cwd,
|
|
2334
2338
|
mode: options.mode,
|
|
@@ -2348,6 +2352,31 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2348
2352
|
logLevel: this.logLevel
|
|
2349
2353
|
});
|
|
2350
2354
|
this.configFile = await loadUserConfigFile(this.options, this.resolver);
|
|
2355
|
+
if (!this.options.name) {
|
|
2356
|
+
if (this.configFile.config) {
|
|
2357
|
+
if (isSetObject(this.configFile.config) && isSetString(this.configFile.config.name)) this.options.name = this.configFile.config.name;
|
|
2358
|
+
else if (Array.isArray(this.configFile.config)) {
|
|
2359
|
+
for (const config of this.configFile.config) if (isSetObject(config) && isSetString(config.name)) {
|
|
2360
|
+
this.options.name = config.name;
|
|
2361
|
+
break;
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
if (!this.options.name) {
|
|
2366
|
+
const packageJsonPath = joinPaths$2(appendPath(this.options.root, this.options.cwd), "package.json");
|
|
2367
|
+
if (existsSync$1(packageJsonPath)) {
|
|
2368
|
+
const packageJson = await readJsonFile$1(packageJsonPath);
|
|
2369
|
+
this.options.name = packageJson.name;
|
|
2370
|
+
}
|
|
2371
|
+
if (!this.options.name) {
|
|
2372
|
+
const projectJsonPath = joinPaths$2(appendPath(this.options.root, this.options.cwd), "project.json");
|
|
2373
|
+
if (existsSync$1(projectJsonPath)) {
|
|
2374
|
+
const projectJson = await readJsonFile$1(projectJsonPath);
|
|
2375
|
+
this.options.name = projectJson.name;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2351
2380
|
}
|
|
2352
2381
|
};
|
|
2353
2382
|
|
|
@@ -3099,7 +3128,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3099
3128
|
*/
|
|
3100
3129
|
async innerSetup() {
|
|
3101
3130
|
const logger = this.extendLogger({ category: "config" });
|
|
3102
|
-
logger.
|
|
3131
|
+
logger.trace(`Pre-setup Powerlines configuration object: \n${JSON.stringify({
|
|
3103
3132
|
...omit(this.config, ["plugins"]),
|
|
3104
3133
|
userConfig: this.config.userConfig ? omit(this.config.userConfig, ["plugins"]) : {},
|
|
3105
3134
|
inlineConfig: this.config.inlineConfig ? omit(this.config.inlineConfig, ["plugins"]) : {},
|
|
@@ -3131,8 +3160,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3131
3160
|
else this.config.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
3132
3161
|
if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
3133
3162
|
else if (this.config.tsconfig) this.config.tsconfig = replacePath(replacePathTokens(this, this.config.tsconfig), this.config.cwd);
|
|
3134
|
-
this.
|
|
3135
|
-
path: joinPaths$1(this.config.root, "dist"),
|
|
3163
|
+
this.config.output = defu(this.config.output ?? {}, {
|
|
3136
3164
|
copy: { assets: [
|
|
3137
3165
|
{ glob: "LICENSE" },
|
|
3138
3166
|
{
|
|
@@ -3149,6 +3177,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3149
3177
|
});
|
|
3150
3178
|
this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
3151
3179
|
if (this.config.output.path) this.config.output.path = appendPath(replacePathTokens(this, this.config.output.path), this.config.cwd);
|
|
3180
|
+
else this.config.output.path = appendPath(joinPaths$1(this.config.root, "dist"), this.config.cwd);
|
|
3152
3181
|
if (this.config.output.copy !== false) {
|
|
3153
3182
|
this.config.output.copy ??= {};
|
|
3154
3183
|
if (!this.config.root.replace(/^\.\/?/, "")) this.config.output.copy.path = this.config.output.copy.path ? appendPath(replacePathTokens(this, this.config.output.copy.path), this.config.cwd) : this.config.output.path;
|
|
@@ -3176,7 +3205,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3176
3205
|
}));
|
|
3177
3206
|
if (isSetString(this.config.output?.storage) && this.config.output.storage === "virtual" || isSetObject(this.config.output?.storage) && Object.values(this.config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
|
|
3178
3207
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3179
|
-
logger.debug(`
|
|
3208
|
+
if (isSetObject(this.config.userConfig) && isSetObject(this.config.inlineConfig) && isSetObject(this.config.pluginConfig)) logger.debug(`Resolved Powerlines configuration object: \n${JSON.stringify({
|
|
3180
3209
|
...omit(this.config, ["plugins"]),
|
|
3181
3210
|
userConfig: this.config.userConfig ? omit(this.config.userConfig, ["plugins"]) : {},
|
|
3182
3211
|
inlineConfig: this.config.inlineConfig ? omit(this.config.inlineConfig, ["plugins"]) : {},
|