@powerlines/engine 0.46.6 → 0.47.0
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/api.cjs +18 -18
- package/dist/api.d.mts +1 -1
- package/dist/api.mjs +16 -16
- package/dist/{base-context-CbFlRUd-.cjs → base-context-DLemGRbd.cjs} +12 -12
- package/dist/{base-context-Ce9PuQ9z.mjs → base-context-DUha4Lz-.mjs} +17 -17
- package/dist/{base-context-Ce9PuQ9z.mjs.map → base-context-DUha4Lz-.mjs.map} +1 -1
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-CEbC9dHR.mjs → engine-context-BfFiKN53.mjs} +3 -3
- package/dist/{engine-context-CEbC9dHR.mjs.map → engine-context-BfFiKN53.mjs.map} +1 -1
- package/dist/{engine-context-D-rpz-J2.cjs → engine-context-D0y88i_J.cjs} +2 -2
- package/dist/{execution-context-DUtt6PWE.mjs → execution-context-CE5H90Um.mjs} +51 -50
- package/dist/execution-context-CE5H90Um.mjs.map +1 -0
- package/dist/{execution-context-9aXwcpL6.cjs → execution-context-CnyaM3Ul.cjs} +33 -32
- package/dist/{execution-context-Da_wozne.d.mts → execution-context-YrjFeD9k.d.mts} +1 -1
- package/dist/{execution-context-Da_wozne.d.mts.map → execution-context-YrjFeD9k.d.mts.map} +1 -1
- package/dist/{fs-D1nIP45P.mjs → fs-Dcle8lUp.mjs} +1 -1
- package/dist/{fs-D1nIP45P.mjs.map → fs-Dcle8lUp.mjs.map} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +5 -5
- package/dist/rpc/client.cjs +74 -0
- package/dist/rpc/client.d.cts +31 -0
- package/dist/rpc/client.d.cts.map +1 -0
- package/dist/rpc/client.d.mts +31 -0
- package/dist/rpc/client.d.mts.map +1 -0
- package/dist/rpc/client.mjs +71 -0
- package/dist/rpc/client.mjs.map +1 -0
- package/dist/rpc/serialization.cjs +82 -0
- package/dist/rpc/serialization.d.cts +46 -0
- package/dist/rpc/serialization.d.cts.map +1 -0
- package/dist/rpc/serialization.d.mts +46 -0
- package/dist/rpc/serialization.d.mts.map +1 -0
- package/dist/rpc/serialization.mjs +76 -0
- package/dist/rpc/serialization.mjs.map +1 -0
- package/dist/rpc/server.cjs +69 -0
- package/dist/rpc/server.d.cts +29 -0
- package/dist/rpc/server.d.cts.map +1 -0
- package/dist/rpc/server.d.mts +29 -0
- package/dist/rpc/server.d.mts.map +1 -0
- package/dist/rpc/server.mjs +66 -0
- package/dist/rpc/server.mjs.map +1 -0
- package/dist/rpc/types.cjs +0 -0
- package/dist/rpc/types.d.cts +70 -0
- package/dist/rpc/types.d.cts.map +1 -0
- package/dist/rpc/types.d.mts +70 -0
- package/dist/rpc/types.d.mts.map +1 -0
- package/dist/rpc/types.mjs +1 -0
- package/dist/schemas.cjs +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/storage/base.cjs +216 -0
- package/dist/storage/base.d.cts +199 -0
- package/dist/storage/base.d.cts.map +1 -0
- package/dist/storage/base.d.mts +199 -0
- package/dist/storage/base.d.mts.map +1 -0
- package/dist/storage/base.mjs +215 -0
- package/dist/storage/base.mjs.map +1 -0
- package/dist/storage/file-system.cjs +180 -0
- package/dist/storage/file-system.d.cts +127 -0
- package/dist/storage/file-system.d.cts.map +1 -0
- package/dist/storage/file-system.d.mts +127 -0
- package/dist/storage/file-system.d.mts.map +1 -0
- package/dist/storage/file-system.mjs +179 -0
- package/dist/storage/file-system.mjs.map +1 -0
- package/dist/storage/helpers.cjs +37 -0
- package/dist/storage/helpers.d.cts +25 -0
- package/dist/storage/helpers.d.cts.map +1 -0
- package/dist/storage/helpers.d.mts +25 -0
- package/dist/storage/helpers.d.mts.map +1 -0
- package/dist/storage/helpers.mjs +34 -0
- package/dist/storage/helpers.mjs.map +1 -0
- package/dist/storage/index.cjs +10 -7
- package/dist/storage/index.d.cts +5 -419
- package/dist/storage/index.d.mts +5 -419
- package/dist/storage/index.mjs +4 -1
- package/dist/storage/virtual.cjs +98 -0
- package/dist/storage/virtual.d.cts +80 -0
- package/dist/storage/virtual.d.cts.map +1 -0
- package/dist/storage/virtual.d.mts +80 -0
- package/dist/storage/virtual.d.mts.map +1 -0
- package/dist/storage/virtual.mjs +97 -0
- package/dist/storage/virtual.mjs.map +1 -0
- package/dist/{ts-morph-D0CaA37w.mjs → ts-morph-C6YBNc46.mjs} +1 -1
- package/dist/{ts-morph-D0CaA37w.mjs.map → ts-morph-C6YBNc46.mjs.map} +1 -1
- package/dist/{tsconfig-BUDqmOaT.cjs → tsconfig-DeKMGasE.cjs} +2 -2
- package/dist/{tsconfig-MeFEs21S.mjs → tsconfig-HzJsMUrr.mjs} +3 -3
- package/dist/{tsconfig-MeFEs21S.mjs.map → tsconfig-HzJsMUrr.mjs.map} +1 -1
- package/dist/typescript/index.cjs +2 -2
- package/dist/typescript/index.mjs +2 -2
- package/package.json +5 -4
- package/dist/execution-context-DUtt6PWE.mjs.map +0 -1
- package/dist/storage/index.d.cts.map +0 -1
- package/dist/storage/index.d.mts.map +0 -1
- package/dist/virtual-CYGZHTDd.mjs +0 -513
- package/dist/virtual-CYGZHTDd.mjs.map +0 -1
- package/dist/virtual-Ct3ZqPeN.cjs +0 -548
- /package/dist/{fs-XogSgMqT.cjs → fs-CeEdzPKE.cjs} +0 -0
- /package/dist/{ts-morph-BaLPVAdB.cjs → ts-morph-BbM83PT9.cjs} +0 -0
package/dist/api.cjs
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
3
|
-
const require_execution_context = require('./execution-context-
|
|
4
|
-
const require_tsconfig = require('./tsconfig-
|
|
5
|
-
const require_ts_morph = require('./ts-morph-
|
|
6
|
-
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
7
|
-
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
8
|
-
let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
9
|
-
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
10
|
-
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
11
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
3
|
+
const require_execution_context = require('./execution-context-CnyaM3Ul.cjs');
|
|
4
|
+
const require_tsconfig = require('./tsconfig-DeKMGasE.cjs');
|
|
5
|
+
const require_ts_morph = require('./ts-morph-BbM83PT9.cjs');
|
|
12
6
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
13
|
-
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
14
|
-
let _powerlines_core_plugin_utils_logging = require("@powerlines/core/plugin-utils/logging");
|
|
15
|
-
let _stryke_path_append = require("@stryke/path/append");
|
|
16
|
-
let _stryke_path_replace = require("@stryke/path/replace");
|
|
17
|
-
let chalk = require("chalk");
|
|
18
|
-
chalk = require_chunk.__toESM(chalk, 1);
|
|
19
|
-
let defu = require("defu");
|
|
20
|
-
defu = require_chunk.__toESM(defu, 1);
|
|
21
|
-
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
22
7
|
let _powerlines_core_lib_utilities_file_header = require("@powerlines/core/lib/utilities/file-header");
|
|
23
8
|
let _powerlines_core_lib_utilities_format = require("@powerlines/core/lib/utilities/format");
|
|
9
|
+
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
10
|
+
let _powerlines_core_plugin_utils_logging = require("@powerlines/core/plugin-utils/logging");
|
|
24
11
|
let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
|
|
12
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
25
13
|
let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
|
|
26
14
|
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
27
15
|
let _stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
28
16
|
let _stryke_fs_install = require("@stryke/fs/install");
|
|
29
17
|
let _stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
30
18
|
let _stryke_fs_package_fns = require("@stryke/fs/package-fns");
|
|
19
|
+
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
31
20
|
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
32
21
|
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
22
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
33
23
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
34
24
|
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
25
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
26
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
35
27
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
36
28
|
let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
|
|
37
29
|
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
38
30
|
let _stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
|
|
39
31
|
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
40
32
|
let _stryke_type_checks_is_promise = require("@stryke/type-checks/is-promise");
|
|
33
|
+
let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
34
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
35
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
36
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
37
|
+
let chalk = require("chalk");
|
|
38
|
+
chalk = require_chunk.__toESM(chalk, 1);
|
|
39
|
+
let defu = require("defu");
|
|
40
|
+
defu = require_chunk.__toESM(defu, 1);
|
|
41
41
|
let handlebars = require("handlebars");
|
|
42
42
|
handlebars = require_chunk.__toESM(handlebars, 1);
|
|
43
43
|
let _stryke_fs_json = require("@stryke/fs/json");
|
package/dist/api.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PowerlinesExecutionContext } from "./execution-context-
|
|
1
|
+
import { t as PowerlinesExecutionContext } from "./execution-context-YrjFeD9k.mjs";
|
|
2
2
|
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
3
3
|
import { API, BuildInlineConfig, CallHookOptions, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentContext, Execution, ExecutionOptions, InferHookParameters, LintInlineConfig, NewInlineConfig, PluginConfig, PluginContext, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
4
4
|
import { PartialKeys } from "@stryke/types/base";
|
package/dist/api.mjs
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-
|
|
2
|
-
import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-
|
|
3
|
-
import { n as createProgram } from "./ts-morph-
|
|
4
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
5
|
-
import { resolvePackage } from "@stryke/fs/resolve";
|
|
6
|
-
import { isSet } from "@stryke/type-checks/is-set";
|
|
7
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
8
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
9
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
1
|
+
import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-CE5H90Um.mjs";
|
|
2
|
+
import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-HzJsMUrr.mjs";
|
|
3
|
+
import { n as createProgram } from "./ts-morph-C6YBNc46.mjs";
|
|
10
4
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
11
|
-
import { findInvalidPluginConfig, formatConfig, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple } from "@powerlines/core/plugin-utils";
|
|
12
|
-
import { colorText } from "@powerlines/core/plugin-utils/logging";
|
|
13
|
-
import { appendPath } from "@stryke/path/append";
|
|
14
|
-
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
15
|
-
import chalk from "chalk";
|
|
16
|
-
import defu from "defu";
|
|
17
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
18
5
|
import { getTypescriptFileHeader } from "@powerlines/core/lib/utilities/file-header";
|
|
19
6
|
import { format, formatFolder } from "@powerlines/core/lib/utilities/format";
|
|
7
|
+
import { findInvalidPluginConfig, formatConfig, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple } from "@powerlines/core/plugin-utils";
|
|
8
|
+
import { colorText } from "@powerlines/core/plugin-utils/logging";
|
|
20
9
|
import { formatLogMessage } from "@storm-software/config-tools/logger/console";
|
|
10
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
21
11
|
import { copyFiles } from "@stryke/fs/copy-file";
|
|
22
12
|
import { existsSync } from "@stryke/fs/exists";
|
|
23
13
|
import { createDirectory, removeDirectory } from "@stryke/fs/helpers";
|
|
24
14
|
import { install } from "@stryke/fs/install";
|
|
25
15
|
import { listFiles } from "@stryke/fs/list-files";
|
|
26
16
|
import { doesPackageMatch, getPackageListing, isPackageExists, isPackageListed } from "@stryke/fs/package-fns";
|
|
17
|
+
import { resolvePackage } from "@stryke/fs/resolve";
|
|
27
18
|
import { getUnique } from "@stryke/helpers/get-unique";
|
|
28
19
|
import { omit } from "@stryke/helpers/omit";
|
|
20
|
+
import { appendPath } from "@stryke/path/append";
|
|
29
21
|
import { findFileName, findFilePath, relativePath } from "@stryke/path/file-path-fns";
|
|
30
22
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
23
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
24
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
31
25
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
32
26
|
import { isError } from "@stryke/type-checks/is-error";
|
|
33
27
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
34
28
|
import { isNumber } from "@stryke/type-checks/is-number";
|
|
35
29
|
import { isObject } from "@stryke/type-checks/is-object";
|
|
36
30
|
import { isPromiseLike } from "@stryke/type-checks/is-promise";
|
|
31
|
+
import { isSet } from "@stryke/type-checks/is-set";
|
|
32
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
33
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
34
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
35
|
+
import chalk from "chalk";
|
|
36
|
+
import defu from "defu";
|
|
37
37
|
import Handlebars from "handlebars";
|
|
38
38
|
import { readJsonFile } from "@stryke/fs/json";
|
|
39
39
|
import { prettyBytes } from "@stryke/string-format/pretty-bytes";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
3
|
-
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
-
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
6
2
|
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
7
3
|
let _powerlines_core_plugin_utils_logging = require("@powerlines/core/plugin-utils/logging");
|
|
8
|
-
let
|
|
9
|
-
let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
|
|
10
|
-
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
11
|
-
let _stryke_fs = require("@stryke/fs");
|
|
12
|
-
let _stryke_path = require("@stryke/path");
|
|
4
|
+
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
13
5
|
let _stryke_path_append = require("@stryke/path/append");
|
|
6
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
14
7
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
15
|
-
let
|
|
8
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
9
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
16
10
|
let chalk = require("chalk");
|
|
17
11
|
chalk = require_chunk.__toESM(chalk, 1);
|
|
18
|
-
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
19
12
|
let defu = require("defu");
|
|
20
13
|
defu = require_chunk.__toESM(defu, 1);
|
|
14
|
+
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
21
15
|
let node_fs = require("node:fs");
|
|
22
|
-
let
|
|
16
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
17
|
+
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
18
|
+
let _storm_software_config_tools_get_config = require("@storm-software/config-tools/get-config");
|
|
19
|
+
let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
|
|
20
|
+
let _stryke_fs = require("@stryke/fs");
|
|
21
|
+
let _stryke_path = require("@stryke/path");
|
|
22
|
+
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
23
23
|
let jiti = require("jiti");
|
|
24
24
|
|
|
25
25
|
//#region src/_internal/helpers/resolver.ts
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import { resolveLogLevel } from "@powerlines/core/plugin-utils";
|
|
2
|
+
import { createLogger as createLogger$1, extendLogger } from "@powerlines/core/plugin-utils/logging";
|
|
1
3
|
import { resolvePackage } from "@stryke/fs/resolve";
|
|
4
|
+
import { appendPath } from "@stryke/path/append";
|
|
5
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
+
import { replacePath } from "@stryke/path/replace";
|
|
2
7
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
8
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import defu from "defu";
|
|
11
|
+
import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
12
|
+
import { existsSync } from "node:fs";
|
|
13
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
4
14
|
import { loadUserConfigFile } from "@powerlines/core/lib/config";
|
|
5
|
-
import { resolveLogLevel } from "@powerlines/core/plugin-utils";
|
|
6
|
-
import { createLogger as createLogger$1, extendLogger } from "@powerlines/core/plugin-utils/logging";
|
|
7
15
|
import { tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
|
|
8
16
|
import { isDevelopment, isProduction, isTest } from "@stryke/env/environment-checks";
|
|
9
|
-
import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
10
17
|
import { isFile, readJsonFile } from "@stryke/fs";
|
|
11
|
-
import { findFilePath, joinPaths, relativePath } from "@stryke/path";
|
|
12
|
-
import { appendPath } from "@stryke/path/append";
|
|
13
|
-
import { replacePath } from "@stryke/path/replace";
|
|
14
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
15
|
-
import chalk from "chalk";
|
|
18
|
+
import { findFilePath, joinPaths as joinPaths$1, relativePath } from "@stryke/path";
|
|
16
19
|
import { formatDistanceToNowStrict } from "date-fns/formatDistanceToNowStrict";
|
|
17
|
-
import defu from "defu";
|
|
18
|
-
import { existsSync } from "node:fs";
|
|
19
|
-
import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
|
|
20
20
|
import { createJiti } from "jiti";
|
|
21
21
|
|
|
22
22
|
//#region src/_internal/helpers/resolver.ts
|
|
@@ -29,7 +29,7 @@ import { createJiti } from "jiti";
|
|
|
29
29
|
function resolveOptions(options) {
|
|
30
30
|
return defu(options, {
|
|
31
31
|
interopDefault: true,
|
|
32
|
-
fsCache: options.mode !== "development" ? joinPaths
|
|
32
|
+
fsCache: options.mode !== "development" ? joinPaths(options.cacheDir, "jiti") : false,
|
|
33
33
|
moduleCache: options.mode !== "development"
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -40,8 +40,8 @@ function resolveOptions(options) {
|
|
|
40
40
|
* @returns A Jiti instance configured for the specified workspace and project root.
|
|
41
41
|
*/
|
|
42
42
|
function createResolver(options) {
|
|
43
|
-
const baseResolver = createJiti(joinPaths
|
|
44
|
-
baseResolver.plugin = createJiti(joinPaths
|
|
43
|
+
const baseResolver = createJiti(joinPaths(options.workspaceRoot, options.root), resolveOptions(options));
|
|
44
|
+
baseResolver.plugin = createJiti(joinPaths(options.workspaceRoot, options.root), resolveOptions(options));
|
|
45
45
|
return baseResolver;
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -281,9 +281,9 @@ var PowerlinesBaseContext = class {
|
|
|
281
281
|
*/
|
|
282
282
|
async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
|
|
283
283
|
if (cwd || root) {
|
|
284
|
-
const projectJsonPath = joinPaths(appendPath(root || ".", cwd || "."), "project.json");
|
|
284
|
+
const projectJsonPath = joinPaths$1(appendPath(root || ".", cwd || "."), "project.json");
|
|
285
285
|
if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
|
|
286
|
-
const packageJsonPath = joinPaths(appendPath(root || ".", cwd || "."), "package.json");
|
|
286
|
+
const packageJsonPath = joinPaths$1(appendPath(root || ".", cwd || "."), "package.json");
|
|
287
287
|
if (existsSync(packageJsonPath)) {
|
|
288
288
|
this.packageJson = await readJsonFile(packageJsonPath);
|
|
289
289
|
this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
|
|
@@ -312,4 +312,4 @@ var PowerlinesBaseContext = class {
|
|
|
312
312
|
|
|
313
313
|
//#endregion
|
|
314
314
|
export { PowerlinesBaseContext as t };
|
|
315
|
-
//# sourceMappingURL=base-context-
|
|
315
|
+
//# sourceMappingURL=base-context-DUha4Lz-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-context-Ce9PuQ9z.mjs","names":["joinPaths","#timestamp","createLogger"],"sources":["../src/_internal/helpers/resolver.ts","../src/context/base-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ResolvedConfig, Resolver } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { JitiOptions, createJiti } from \"jiti\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Partial<Pick<ResolvedConfig, \"mode\" | \"skipCache\">> & {\n workspaceRoot: string;\n root: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n );\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BaseContext,\n EngineOptions,\n LogFn,\n Logger,\n LoggerOptions,\n LogLevelResolvedConfig,\n LogMessage,\n Mode,\n ParsedUserConfig,\n Resolver,\n UserConfig,\n WorkspaceConfig\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport {\n createLogger,\n extendLogger\n} from \"@powerlines/core/plugin-utils/logging\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { isFile, readJsonFile } from \"@stryke/fs\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFilePath, joinPaths, relativePath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { existsSync } from \"node:fs\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.\n */\n public options!: RequiredKeys<\n EngineOptions,\n \"mode\" | \"cwd\" | \"root\" | \"framework\"\n >;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.\n */\n public get logger(): Logger {\n return this.createLogger({});\n }\n\n /**\n * A timestamp representing when the context was initialized\n */\n public get timestamp(): number {\n return this.#timestamp;\n }\n\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.options.logLevel, this.options.mode);\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: this.options.organization,\n appId: this.options.framework || \"powerlines\",\n workspaceRoot: this.options.cwd\n });\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | LogMessage) {\n this.logger.warn(message);\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | LogMessage) {\n this.logger.info(message);\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | LogMessage) {\n this.logger.debug(message);\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | LogMessage) {\n this.logger.trace(message);\n }\n\n /**\n * A function to create a timer for measuring the duration of asynchronous operations\n *\n * @example\n * ```ts\n * const stopTimer = context.timer(\"Your Async Operation\");\n * await performAsyncOperation();\n * stopTimer(); // \"Your Async Operation completed in 123.45 milliseconds\"\n * ```\n *\n * @param name - The name of the timer.\n * @returns A function that, when called, stops the timer and logs the duration.\n */\n public timer(name: string): () => void {\n const startDate = Date.now();\n const startDuration = performance.now();\n\n return () => {\n const duration = performance.now() - startDuration;\n this.logger.info({\n meta: {\n category: \"performance\"\n },\n message: `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(\n duration < 1000\n ? `${duration.toFixed(2)} milliseconds`\n : formatDistanceToNowStrict(startDate)\n )}`\n });\n };\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public createLogger(options: LoggerOptions, logFn?: LogFn): Logger {\n return createLogger(\n this.options.name || this.options.root || \"powerlines\",\n { ...this.configFile.config, ...this.options, ...options },\n logFn\n );\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public extendLogger(options: LoggerOptions): Logger {\n return extendLogger(this.logger, options);\n }\n\n /**\n * 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\n */\n protected initialOptions: EngineOptions = {};\n\n /**\n * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n protected initialConfig: DeepPartial<UserConfig> = {};\n\n /**\n * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method 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 as the original context.\n *\n * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.\n * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.\n *\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\n protected async getWorkspaceConfig(): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(\n false,\n this.options || this.initialOptions\n ? {\n cwd:\n this.options?.root || this.initialOptions?.root\n ? appendPath(\n this.options?.root || this.initialOptions?.root || \".\",\n this.options?.cwd || this.initialOptions?.cwd\n )\n : undefined,\n workspaceRoot: this.options?.cwd || this.initialOptions?.cwd\n }\n : undefined\n );\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * 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.\n */\n protected async init() {\n if (!this.powerlinesPath) {\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n this.powerlinesPath = powerlinesPath;\n }\n\n this.options = defu(this.initialOptions, this.initialConfig, {\n cwd: process.cwd(),\n mode: await this.getDefaultMode(),\n logLevel: await this.getDefaultLogLevel(),\n framework: \"powerlines\"\n }) as RequiredKeys<EngineOptions, \"mode\" | \"cwd\" | \"root\" | \"framework\">;\n\n if (!this.options.root) {\n if (this.options.configFile) {\n const configFile = appendPath(\n this.options.configFile,\n this.options.cwd\n );\n if (!existsSync(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n this.options.root = relativePath(\n this.options.cwd,\n findFilePath(configFile)\n );\n } else {\n this.options.root = \".\";\n }\n } else {\n this.options.root = replacePath(this.options.root, this.options.cwd);\n }\n\n this.resolver = createResolver({\n workspaceRoot: this.options.cwd,\n root: this.options.root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode\n });\n\n await this.resolvePackageConfigs();\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n if (this.configFile.config) {\n if (isSetString(this.configFile.configFile)) {\n this.options.configFile ??= replacePath(\n this.configFile.configFile,\n this.options.cwd\n );\n }\n\n if (!this.options.name) {\n if (\n isSetObject(this.configFile.config) &&\n isSetString((this.configFile.config as UserConfig).name)\n ) {\n this.options.name = (this.configFile.config as UserConfig).name;\n } else if (Array.isArray(this.configFile.config)) {\n for (const config of this.configFile.config) {\n if (\n isSetObject(config) &&\n isSetString((config as UserConfig).name)\n ) {\n this.options.name = (config as UserConfig).name;\n break;\n }\n }\n }\n }\n\n if (!this.options.name) {\n this.options.name = this.projectJson?.name || this.packageJson?.name;\n }\n }\n }\n\n /**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n this.options.organization ??= isSetObject(this.packageJson?.author)\n ? kebabCase(this.packageJson?.author?.name)\n : kebabCase(this.packageJson?.author);\n }\n }\n }\n\n /**\n * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to \"production\".\n *\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\n protected async getDefaultMode(): Promise<Mode> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n }\n\n /**\n * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to \"info\" for development mode and \"warn\" for production mode.\n *\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\n protected async getDefaultLogLevel(): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACbA,YAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AAED,QAAO;;;;;ACLT,IAAa,wBAAb,MAA0D;CACxD,aAAqB,KAAK,KAAK;;;;CAK/B,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAQP,AAAO;;;;CAKP,AAAO,cAA+C;;;;CAKtD,AAAO;;;;CAKP,IAAW,SAAiB;AAC1B,SAAO,KAAK,aAAa,EAAE,CAAC;;;;;CAM9B,IAAW,YAAoB;AAC7B,SAAO,MAAKC;;CAGd,IAAW,WAAmC;AAC5C,SAAO,gBAAgB,KAAK,QAAQ,UAAU,KAAK,QAAQ,KAAK;;;;;CAMlE,IAAW,WAAqB;AAC9B,SAAO,YAAY;GACjB,OAAO,KAAK,QAAQ;GACpB,OAAO,KAAK,QAAQ,aAAa;GACjC,eAAe,KAAK,QAAQ;GAC7B,CAA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B,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
|
|
1
|
+
{"version":3,"file":"base-context-DUha4Lz-.mjs","names":["#timestamp","createLogger","joinPaths"],"sources":["../src/_internal/helpers/resolver.ts","../src/context/base-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ResolvedConfig, Resolver } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { JitiOptions, createJiti } from \"jiti\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Partial<Pick<ResolvedConfig, \"mode\" | \"skipCache\">> & {\n workspaceRoot: string;\n root: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n );\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BaseContext,\n EngineOptions,\n LogFn,\n Logger,\n LoggerOptions,\n LogLevelResolvedConfig,\n LogMessage,\n Mode,\n ParsedUserConfig,\n Resolver,\n UserConfig,\n WorkspaceConfig\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport {\n createLogger,\n extendLogger\n} from \"@powerlines/core/plugin-utils/logging\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { isFile, readJsonFile } from \"@stryke/fs\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFilePath, joinPaths, relativePath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { existsSync } from \"node:fs\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.\n */\n public options!: RequiredKeys<\n EngineOptions,\n \"mode\" | \"cwd\" | \"root\" | \"framework\"\n >;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.\n */\n public get logger(): Logger {\n return this.createLogger({});\n }\n\n /**\n * A timestamp representing when the context was initialized\n */\n public get timestamp(): number {\n return this.#timestamp;\n }\n\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.options.logLevel, this.options.mode);\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: this.options.organization,\n appId: this.options.framework || \"powerlines\",\n workspaceRoot: this.options.cwd\n });\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | LogMessage) {\n this.logger.warn(message);\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | LogMessage) {\n this.logger.info(message);\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | LogMessage) {\n this.logger.debug(message);\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | LogMessage) {\n this.logger.trace(message);\n }\n\n /**\n * A function to create a timer for measuring the duration of asynchronous operations\n *\n * @example\n * ```ts\n * const stopTimer = context.timer(\"Your Async Operation\");\n * await performAsyncOperation();\n * stopTimer(); // \"Your Async Operation completed in 123.45 milliseconds\"\n * ```\n *\n * @param name - The name of the timer.\n * @returns A function that, when called, stops the timer and logs the duration.\n */\n public timer(name: string): () => void {\n const startDate = Date.now();\n const startDuration = performance.now();\n\n return () => {\n const duration = performance.now() - startDuration;\n this.logger.info({\n meta: {\n category: \"performance\"\n },\n message: `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(\n duration < 1000\n ? `${duration.toFixed(2)} milliseconds`\n : formatDistanceToNowStrict(startDate)\n )}`\n });\n };\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public createLogger(options: LoggerOptions, logFn?: LogFn): Logger {\n return createLogger(\n this.options.name || this.options.root || \"powerlines\",\n { ...this.configFile.config, ...this.options, ...options },\n logFn\n );\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public extendLogger(options: LoggerOptions): Logger {\n return extendLogger(this.logger, options);\n }\n\n /**\n * 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\n */\n protected initialOptions: EngineOptions = {};\n\n /**\n * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n protected initialConfig: DeepPartial<UserConfig> = {};\n\n /**\n * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method 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 as the original context.\n *\n * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.\n * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.\n *\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\n protected async getWorkspaceConfig(): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(\n false,\n this.options || this.initialOptions\n ? {\n cwd:\n this.options?.root || this.initialOptions?.root\n ? appendPath(\n this.options?.root || this.initialOptions?.root || \".\",\n this.options?.cwd || this.initialOptions?.cwd\n )\n : undefined,\n workspaceRoot: this.options?.cwd || this.initialOptions?.cwd\n }\n : undefined\n );\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * 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.\n */\n protected async init() {\n if (!this.powerlinesPath) {\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n this.powerlinesPath = powerlinesPath;\n }\n\n this.options = defu(this.initialOptions, this.initialConfig, {\n cwd: process.cwd(),\n mode: await this.getDefaultMode(),\n logLevel: await this.getDefaultLogLevel(),\n framework: \"powerlines\"\n }) as RequiredKeys<EngineOptions, \"mode\" | \"cwd\" | \"root\" | \"framework\">;\n\n if (!this.options.root) {\n if (this.options.configFile) {\n const configFile = appendPath(\n this.options.configFile,\n this.options.cwd\n );\n if (!existsSync(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n this.options.root = relativePath(\n this.options.cwd,\n findFilePath(configFile)\n );\n } else {\n this.options.root = \".\";\n }\n } else {\n this.options.root = replacePath(this.options.root, this.options.cwd);\n }\n\n this.resolver = createResolver({\n workspaceRoot: this.options.cwd,\n root: this.options.root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode\n });\n\n await this.resolvePackageConfigs();\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n if (this.configFile.config) {\n if (isSetString(this.configFile.configFile)) {\n this.options.configFile ??= replacePath(\n this.configFile.configFile,\n this.options.cwd\n );\n }\n\n if (!this.options.name) {\n if (\n isSetObject(this.configFile.config) &&\n isSetString((this.configFile.config as UserConfig).name)\n ) {\n this.options.name = (this.configFile.config as UserConfig).name;\n } else if (Array.isArray(this.configFile.config)) {\n for (const config of this.configFile.config) {\n if (\n isSetObject(config) &&\n isSetString((config as UserConfig).name)\n ) {\n this.options.name = (config as UserConfig).name;\n break;\n }\n }\n }\n }\n\n if (!this.options.name) {\n this.options.name = this.projectJson?.name || this.packageJson?.name;\n }\n }\n }\n\n /**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n this.options.organization ??= isSetObject(this.packageJson?.author)\n ? kebabCase(this.packageJson?.author?.name)\n : kebabCase(this.packageJson?.author);\n }\n }\n }\n\n /**\n * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to \"production\".\n *\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\n protected async getDefaultMode(): Promise<Mode> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n }\n\n /**\n * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to \"info\" for development mode and \"warn\" for production mode.\n *\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\n protected async getDefaultLogLevel(): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACb,UAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnB,UAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpB,UAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AAED,QAAO;;;;;ACLT,IAAa,wBAAb,MAA0D;CACxD,aAAqB,KAAK,KAAK;;;;CAK/B,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAQP,AAAO;;;;CAKP,AAAO,cAA+C;;;;CAKtD,AAAO;;;;CAKP,IAAW,SAAiB;AAC1B,SAAO,KAAK,aAAa,EAAE,CAAC;;;;;CAM9B,IAAW,YAAoB;AAC7B,SAAO,MAAKA;;CAGd,IAAW,WAAm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,KAAK,aAAa,OAAO;;;;;;;;;CAU7C,MAAgB,iBAAgC;EAC9C,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,eACH,eACA,gBACE,gBACA,SACE,SACA,iBAAiB,QAAQ;;;;;;;CAQnC,MAAgB,qBAAsD;EACpE,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
|
package/dist/context/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_execution_context = require('../execution-context-CnyaM3Ul.cjs');
|
|
3
|
+
const require_base_context = require('../base-context-DLemGRbd.cjs');
|
|
4
|
+
const require_engine_context = require('../engine-context-D0y88i_J.cjs');
|
|
5
5
|
|
|
6
6
|
exports.PowerlinesBaseContext = require_base_context.PowerlinesBaseContext;
|
|
7
7
|
exports.PowerlinesContext = require_execution_context.PowerlinesContext;
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PowerlinesContext, r as PowerlinesBaseContext, t as PowerlinesExecutionContext } from "../execution-context-
|
|
1
|
+
import { n as PowerlinesContext, r as PowerlinesBaseContext, t as PowerlinesExecutionContext } from "../execution-context-YrjFeD9k.mjs";
|
|
2
2
|
import { EngineContext, EngineOptions, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionOptions, ExecutionState, HooksList, InferOverridableConfig, LogFn, LogLevelResolvedConfig, Logger, LoggerOptions, Plugin, PluginContext, ResolvedConfig, SelectHookResult, SelectHooksOptions, UserConfig } from "@powerlines/core";
|
|
3
3
|
import { DeepPartial, RequiredKeys } from "@stryke/types/base";
|
|
4
4
|
import { Unstable_ContextInternal, Unstable_EnvironmentContext, Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
1
|
+
import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-CE5H90Um.mjs";
|
|
2
|
+
import { t as PowerlinesBaseContext } from "../base-context-DUha4Lz-.mjs";
|
|
3
|
+
import { t as PowerlinesEngineContext } from "../engine-context-BfFiKN53.mjs";
|
|
4
4
|
|
|
5
5
|
export { PowerlinesBaseContext, PowerlinesContext, PowerlinesEngineContext, PowerlinesEnvironmentContext, PowerlinesExecutionContext, createPluginContext };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "./base-context-
|
|
2
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
1
|
+
import { t as PowerlinesBaseContext } from "./base-context-DUha4Lz-.mjs";
|
|
3
2
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
3
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
4
4
|
|
|
5
5
|
//#region src/context/engine-context.ts
|
|
6
6
|
var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBaseContext {
|
|
@@ -83,4 +83,4 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
|
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
85
|
export { PowerlinesEngineContext as t };
|
|
86
|
-
//# sourceMappingURL=engine-context-
|
|
86
|
+
//# sourceMappingURL=engine-context-BfFiKN53.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context-
|
|
1
|
+
{"version":3,"file":"engine-context-BfFiKN53.mjs","names":["#executions"],"sources":["../src/context/engine-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n EngineContext,\n EngineOptions,\n ExecutionState,\n LogLevelResolvedConfig,\n UserConfig\n} from \"@powerlines/core\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nexport class PowerlinesEngineContext\n extends PowerlinesBaseContext\n implements EngineContext\n{\n #executions: ExecutionState[] = [];\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async fromInitialConfig(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ): Promise<PowerlinesEngineContext> {\n const context = new PowerlinesEngineContext(options, initialConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n public override readonly initialOptions: EngineOptions;\n\n /**\n * The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n public override readonly initialConfig: DeepPartial<UserConfig>;\n\n /**\n * The options provided to the Powerlines process\n */\n public override options: RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n } = {} as RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n };\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n super(options, initialConfig);\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * 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.\n */\n protected override async init() {\n await super.init();\n\n if (!this.configFile?.config) {\n this.fatal(\n \"No configuration file found. Please ensure you have a valid configuration file in your project.\"\n );\n throw new Error(\"No configuration file found\");\n }\n\n this.#executions = await Promise.all(\n toArray(this.configFile.config).map(async (_, executionIndex) => {\n const executionId = uuid();\n\n return {\n executionId,\n options: {\n cwd: this.options.cwd,\n root: this.options.root,\n configFile: this.options.configFile,\n ...this.initialOptions,\n executionId,\n executionIndex\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n }\n\n /**\n * A list of all command executions that will be run during the lifecycle of the engine\n *\n * @returns An array of {@link ExecutionState} representing each execution context for the engine.\n */\n public get executions(): ExecutionState[] {\n return this.#executions;\n }\n}\n"],"mappings":";;;;;AA8BA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAgC,EAAE;;;;;;;CAQlC,aAAoB,kBAClB,SACA,gBAAyC,EAAE,EACT;EAClC,MAAM,UAAU,IAAI,wBAAwB,SAAS,cAAc;AACnE,QAAM,QAAQ,MAAM;AAEpB,SAAO;;;;;CAMT,AAAyB;;;;CAKzB,AAAyB;;;;CAKzB,AAAgB,UAQZ,EAAE;;;;;;;CAgBN,AAAU,YACR,SACA,gBAAyC,EAAE,EAC3C;AACA,QAAM,SAAS,cAAc;AAC7B,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;;;;;;;;CASvB,MAAyB,OAAO;AAC9B,QAAM,MAAM,MAAM;AAElB,MAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,QAAK,MACH,kGACD;AACD,SAAM,IAAI,MAAM,8BAA8B;;AAGhD,QAAKA,aAAc,MAAM,QAAQ,IAC/B,QAAQ,KAAK,WAAW,OAAO,CAAC,IAAI,OAAO,GAAG,mBAAmB;GAC/D,MAAM,cAAc,MAAM;AAE1B,UAAO;IACL;IACA,SAAS;KACP,KAAK,KAAK,QAAQ;KAClB,MAAM,KAAK,QAAQ;KACnB,YAAY,KAAK,QAAQ;KACzB,GAAG,KAAK;KACR;KACA;KACD;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;;;;;;;CAQH,IAAW,aAA+B;AACxC,SAAO,MAAKA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
const require_base_context = require('./base-context-
|
|
3
|
-
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
2
|
+
const require_base_context = require('./base-context-DLemGRbd.cjs');
|
|
4
3
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
4
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
5
5
|
|
|
6
6
|
//#region src/context/engine-context.ts
|
|
7
7
|
var PowerlinesEngineContext = class PowerlinesEngineContext extends require_base_context.PowerlinesBaseContext {
|