@powerlines/engine 0.43.28 → 0.43.30
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 +18 -8
- package/dist/_internal/worker.mjs +18 -8
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +1 -1
- package/dist/{base-context-BgAxrobW.cjs → base-context-B9AROf66.cjs} +11 -2
- package/dist/{base-context-D9PKchy4.mjs → base-context-D8a2XGIK.mjs} +12 -3
- package/dist/base-context-D8a2XGIK.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +4 -0
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +4 -0
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-B7_Cc9N2.mjs → engine-context-DsA9XGVb.mjs} +2 -2
- package/dist/{engine-context-B7_Cc9N2.mjs.map → engine-context-DsA9XGVb.mjs.map} +1 -1
- package/dist/{engine-context-B5zOInDj.cjs → engine-context-qCVw66U_.cjs} +1 -1
- package/dist/{execution-context-BmRT3Anb.mjs → execution-context-CBJxP2B2.mjs} +10 -8
- package/dist/execution-context-CBJxP2B2.mjs.map +1 -0
- package/dist/{execution-context-R45_zd18.cjs → execution-context-CprxWvYn.cjs} +9 -7
- package/dist/index.cjs +22 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +22 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -16
- package/dist/base-context-D9PKchy4.mjs.map +0 -1
- package/dist/execution-context-BmRT3Anb.mjs.map +0 -1
|
@@ -72,6 +72,7 @@ let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
|
72
72
|
let _stryke_hash = require("@stryke/hash");
|
|
73
73
|
let _stryke_hash_node = require("@stryke/hash/node");
|
|
74
74
|
let _stryke_http_fetch = require("@stryke/http/fetch");
|
|
75
|
+
let _stryke_path_is_equal = require("@stryke/path/is-equal");
|
|
75
76
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
76
77
|
let _stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
|
|
77
78
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
@@ -2163,6 +2164,10 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2163
2164
|
*/
|
|
2164
2165
|
options;
|
|
2165
2166
|
/**
|
|
2167
|
+
* The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
|
|
2168
|
+
*/
|
|
2169
|
+
inputOptions = {};
|
|
2170
|
+
/**
|
|
2166
2171
|
* The parsed configuration file for the project
|
|
2167
2172
|
*/
|
|
2168
2173
|
configFile;
|
|
@@ -2315,13 +2320,14 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2315
2320
|
* @param options - The configuration options to initialize the context with
|
|
2316
2321
|
*/
|
|
2317
2322
|
async init(options = {}) {
|
|
2323
|
+
this.inputOptions = options;
|
|
2318
2324
|
if (!this.powerlinesPath) {
|
|
2319
2325
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
2320
2326
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
2321
2327
|
this.powerlinesPath = powerlinesPath;
|
|
2322
2328
|
}
|
|
2323
2329
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
2324
|
-
const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && (options.root || this.options.root
|
|
2330
|
+
const root = (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 : ".";
|
|
2325
2331
|
this.options = (0, defu.default)({
|
|
2326
2332
|
root,
|
|
2327
2333
|
cwd,
|
|
@@ -2329,7 +2335,10 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2329
2335
|
framework: options.framework,
|
|
2330
2336
|
organization: options.organization,
|
|
2331
2337
|
configFile: options.configFile
|
|
2332
|
-
}, this.options ?? {}
|
|
2338
|
+
}, this.options ?? {}, {
|
|
2339
|
+
mode: "production",
|
|
2340
|
+
framework: "powerlines"
|
|
2341
|
+
});
|
|
2333
2342
|
this.resolver = createResolver({
|
|
2334
2343
|
workspaceRoot: cwd,
|
|
2335
2344
|
root,
|
|
@@ -3040,6 +3049,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3040
3049
|
copyTo(context) {
|
|
3041
3050
|
for (const [key, value] of Object.entries(this)) if (!SKIP_CLONING_PROPS.includes(key)) if ((0, _stryke_type_checks_is_object.isObject)(value) || Array.isArray(value)) context[key] = (0, _stryke_helpers_deep_clone.deepClone)(value);
|
|
3042
3051
|
else context[key] = value;
|
|
3052
|
+
context.inputOptions = (0, _stryke_helpers_deep_clone.deepClone)(this.inputOptions);
|
|
3043
3053
|
context.dependencies = (0, _stryke_helpers_deep_clone.deepClone)(this.dependencies);
|
|
3044
3054
|
context.devDependencies = (0, _stryke_helpers_deep_clone.deepClone)(this.devDependencies);
|
|
3045
3055
|
context.persistedMeta = this.persistedMeta ? (0, _stryke_helpers_deep_clone.deepClone)(this.persistedMeta) : void 0;
|
|
@@ -3062,14 +3072,14 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3062
3072
|
async init(options = {}) {
|
|
3063
3073
|
await super.init(options);
|
|
3064
3074
|
this.options.configIndex = options.configIndex ?? this.options.configIndex ?? 0;
|
|
3065
|
-
const projectJsonPath = (0, _stryke_path_join.joinPaths)(this.options.root, "project.json");
|
|
3075
|
+
const projectJsonPath = (0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root, "project.json");
|
|
3066
3076
|
if ((0, _stryke_fs_exists.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs_json.readJsonFile)(projectJsonPath);
|
|
3067
|
-
const packageJsonPath = (0, _stryke_path_join.joinPaths)(this.options.root, "package.json");
|
|
3077
|
+
const packageJsonPath = (0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root, "package.json");
|
|
3068
3078
|
if ((0, _stryke_fs_exists.existsSync)(packageJsonPath)) {
|
|
3069
3079
|
this.packageJson = await (0, _stryke_fs_json.readJsonFile)(packageJsonPath);
|
|
3070
3080
|
this.options.organization ??= (0, _stryke_type_checks_is_set_object.isSetObject)(this.packageJson?.author) ? (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author?.name) : (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author);
|
|
3071
3081
|
}
|
|
3072
|
-
this.#checksum = await this.generateChecksum(this.options.root);
|
|
3082
|
+
this.#checksum = await this.generateChecksum((0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root));
|
|
3073
3083
|
const userConfig = this.configFile.config ? Array.isArray(this.configFile.config) && this.configFile.config.length > this.options.configIndex ? this.configFile.config[this.options.configIndex] : this.configFile.config : {};
|
|
3074
3084
|
this.resolvedConfig = {
|
|
3075
3085
|
...this.options,
|
|
@@ -3081,11 +3091,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3081
3091
|
* Initialize the context with the provided configuration options
|
|
3082
3092
|
*/
|
|
3083
3093
|
async innerSetup() {
|
|
3084
|
-
if (!this.
|
|
3094
|
+
if (!this.inputOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
3085
3095
|
this.options.mode = "production";
|
|
3086
3096
|
this.config.mode = "production";
|
|
3087
3097
|
}
|
|
3088
|
-
if (!this.
|
|
3098
|
+
if (!this.inputOptions.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.pluginConfig?.framework) {
|
|
3089
3099
|
this.options.framework = "powerlines";
|
|
3090
3100
|
this.config.framework = "powerlines";
|
|
3091
3101
|
}
|
|
@@ -3137,7 +3147,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3137
3147
|
if (this.config.output.copy && this.config.output.copy.path && this.config.output.copy.assets && Array.isArray(this.config.output.copy.assets)) this.config.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(this.config.output.copy.assets.map((asset) => {
|
|
3138
3148
|
return {
|
|
3139
3149
|
glob: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) ? asset.glob : asset,
|
|
3140
|
-
input: (0, _stryke_type_checks_is_string.isString)(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.options.cwd : (0, _stryke_path_is_parent_path.isParentPath)(asset.input, this.config.cwd) || asset.input
|
|
3150
|
+
input: (0, _stryke_type_checks_is_string.isString)(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.options.cwd : (0, _stryke_path_is_parent_path.isParentPath)(asset.input, this.config.cwd) || (0, _stryke_path_is_equal.isEqual)(asset.input, this.config.cwd) ? asset.input : (0, _stryke_path_append.appendPath)(asset.input, this.config.cwd),
|
|
3141
3151
|
output: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.output ? (0, _stryke_path_is_parent_path.isParentPath)(asset.output, this.config.cwd) ? asset.output : (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(this.config.output.copy.path, (0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(asset.output, (0, _stryke_path_replace.replacePath)(this.config.output.copy.path, this.config.cwd)), this.config.output.copy.path)), this.config.cwd) : (0, _stryke_path_append.appendPath)(this.config.output.copy.path, this.config.cwd),
|
|
3142
3152
|
ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
|
|
3143
3153
|
};
|
|
@@ -41,6 +41,7 @@ import { relativeToWorkspaceRoot } from "@stryke/fs/get-workspace-root";
|
|
|
41
41
|
import { murmurhash } from "@stryke/hash";
|
|
42
42
|
import { hashDirectory } from "@stryke/hash/node";
|
|
43
43
|
import { fetchRequest } from "@stryke/http/fetch";
|
|
44
|
+
import { isEqual } from "@stryke/path/is-equal";
|
|
44
45
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
45
46
|
import { isNull } from "@stryke/type-checks/is-null";
|
|
46
47
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
@@ -2130,6 +2131,10 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2130
2131
|
*/
|
|
2131
2132
|
options;
|
|
2132
2133
|
/**
|
|
2134
|
+
* The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
|
|
2135
|
+
*/
|
|
2136
|
+
inputOptions = {};
|
|
2137
|
+
/**
|
|
2133
2138
|
* The parsed configuration file for the project
|
|
2134
2139
|
*/
|
|
2135
2140
|
configFile;
|
|
@@ -2282,13 +2287,14 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2282
2287
|
* @param options - The configuration options to initialize the context with
|
|
2283
2288
|
*/
|
|
2284
2289
|
async init(options = {}) {
|
|
2290
|
+
this.inputOptions = options;
|
|
2285
2291
|
if (!this.powerlinesPath) {
|
|
2286
2292
|
const powerlinesPath = await resolvePackage("powerlines");
|
|
2287
2293
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
2288
2294
|
this.powerlinesPath = powerlinesPath;
|
|
2289
2295
|
}
|
|
2290
2296
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
2291
|
-
const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && (options.root || this.options.root
|
|
2297
|
+
const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !isEqual(options.root || this.options.root, cwd) ? options.root || this.options.root : ".";
|
|
2292
2298
|
this.options = defu({
|
|
2293
2299
|
root,
|
|
2294
2300
|
cwd,
|
|
@@ -2296,7 +2302,10 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2296
2302
|
framework: options.framework,
|
|
2297
2303
|
organization: options.organization,
|
|
2298
2304
|
configFile: options.configFile
|
|
2299
|
-
}, this.options ?? {}
|
|
2305
|
+
}, this.options ?? {}, {
|
|
2306
|
+
mode: "production",
|
|
2307
|
+
framework: "powerlines"
|
|
2308
|
+
});
|
|
2300
2309
|
this.resolver = createResolver({
|
|
2301
2310
|
workspaceRoot: cwd,
|
|
2302
2311
|
root,
|
|
@@ -3007,6 +3016,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3007
3016
|
copyTo(context) {
|
|
3008
3017
|
for (const [key, value] of Object.entries(this)) if (!SKIP_CLONING_PROPS.includes(key)) if (isObject(value) || Array.isArray(value)) context[key] = deepClone(value);
|
|
3009
3018
|
else context[key] = value;
|
|
3019
|
+
context.inputOptions = deepClone(this.inputOptions);
|
|
3010
3020
|
context.dependencies = deepClone(this.dependencies);
|
|
3011
3021
|
context.devDependencies = deepClone(this.devDependencies);
|
|
3012
3022
|
context.persistedMeta = this.persistedMeta ? deepClone(this.persistedMeta) : void 0;
|
|
@@ -3029,14 +3039,14 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3029
3039
|
async init(options = {}) {
|
|
3030
3040
|
await super.init(options);
|
|
3031
3041
|
this.options.configIndex = options.configIndex ?? this.options.configIndex ?? 0;
|
|
3032
|
-
const projectJsonPath = joinPaths$1(this.options.root, "project.json");
|
|
3042
|
+
const projectJsonPath = joinPaths$1(this.options.cwd, this.options.root, "project.json");
|
|
3033
3043
|
if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
|
|
3034
|
-
const packageJsonPath = joinPaths$1(this.options.root, "package.json");
|
|
3044
|
+
const packageJsonPath = joinPaths$1(this.options.cwd, this.options.root, "package.json");
|
|
3035
3045
|
if (existsSync(packageJsonPath)) {
|
|
3036
3046
|
this.packageJson = await readJsonFile(packageJsonPath);
|
|
3037
3047
|
this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
|
|
3038
3048
|
}
|
|
3039
|
-
this.#checksum = await this.generateChecksum(this.options.root);
|
|
3049
|
+
this.#checksum = await this.generateChecksum(joinPaths$1(this.options.cwd, this.options.root));
|
|
3040
3050
|
const userConfig = this.configFile.config ? Array.isArray(this.configFile.config) && this.configFile.config.length > this.options.configIndex ? this.configFile.config[this.options.configIndex] : this.configFile.config : {};
|
|
3041
3051
|
this.resolvedConfig = {
|
|
3042
3052
|
...this.options,
|
|
@@ -3048,11 +3058,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3048
3058
|
* Initialize the context with the provided configuration options
|
|
3049
3059
|
*/
|
|
3050
3060
|
async innerSetup() {
|
|
3051
|
-
if (!this.
|
|
3061
|
+
if (!this.inputOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
3052
3062
|
this.options.mode = "production";
|
|
3053
3063
|
this.config.mode = "production";
|
|
3054
3064
|
}
|
|
3055
|
-
if (!this.
|
|
3065
|
+
if (!this.inputOptions.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.pluginConfig?.framework) {
|
|
3056
3066
|
this.options.framework = "powerlines";
|
|
3057
3067
|
this.config.framework = "powerlines";
|
|
3058
3068
|
}
|
|
@@ -3104,7 +3114,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3104
3114
|
if (this.config.output.copy && this.config.output.copy.path && this.config.output.copy.assets && Array.isArray(this.config.output.copy.assets)) this.config.output.copy.assets = getUniqueBy(this.config.output.copy.assets.map((asset) => {
|
|
3105
3115
|
return {
|
|
3106
3116
|
glob: isSetObject(asset) ? asset.glob : asset,
|
|
3107
|
-
input: isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.options.cwd : isParentPath(asset.input, this.config.cwd) || asset.input
|
|
3117
|
+
input: isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.options.cwd : isParentPath(asset.input, this.config.cwd) || isEqual(asset.input, this.config.cwd) ? asset.input : appendPath(asset.input, this.config.cwd),
|
|
3108
3118
|
output: isSetObject(asset) && asset.output ? isParentPath(asset.output, this.config.cwd) ? asset.output : appendPath(joinPaths$1(this.config.output.copy.path, replacePath(replacePath(asset.output, replacePath(this.config.output.copy.path, this.config.cwd)), this.config.output.copy.path)), this.config.cwd) : appendPath(this.config.output.copy.path, this.config.cwd),
|
|
3109
3119
|
ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
|
|
3110
3120
|
};
|