@powerlines/engine 0.15.20 → 0.15.21
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/build.mjs.map +1 -1
- package/dist/api/clean.mjs.map +1 -1
- package/dist/api/create.mjs.map +1 -1
- package/dist/api/deploy.mjs.map +1 -1
- package/dist/api/docs.mjs.map +1 -1
- package/dist/api/lint.mjs.map +1 -1
- package/dist/api/prepare.mjs.map +1 -1
- package/dist/api/test.mjs.map +1 -1
- package/dist/api/types.mjs.map +1 -1
- package/dist/api-B2dWvRMM.d.mts.map +1 -1
- package/dist/api-DgxYwNuZ.d.cts.map +1 -1
- package/dist/api.mjs.map +1 -1
- package/dist/config-C9AD-erz.d.mts.map +1 -1
- package/dist/config-D6xUniHh.d.cts.map +1 -1
- package/dist/context/engine-context.cjs +2 -0
- package/dist/context/engine-context.d.cts +1 -1
- package/dist/context/engine-context.d.mts +1 -1
- package/dist/context/engine-context.mjs +2 -0
- package/dist/context/engine-context.mjs.map +1 -1
- package/dist/context/index.d.cts +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context-S3XH2DWP.d.mts.map +1 -1
- package/dist/context-epL7NPvL.d.cts.map +1 -1
- package/dist/{engine-DELjWFmN.mjs → engine-Ct0OGdyp.mjs} +9 -2
- package/dist/engine-Ct0OGdyp.mjs.map +1 -0
- package/dist/{engine-context-zsn1PoRl.d.mts → engine-context-Cc93ql_I.d.mts} +2 -3
- package/dist/engine-context-Cc93ql_I.d.mts.map +1 -0
- package/dist/{engine-context-5-_EGiKp.d.cts → engine-context-lrWc13AH.d.cts} +2 -3
- package/dist/engine-context-lrWc13AH.d.cts.map +1 -0
- package/dist/{engine-DTKq6gFT.cjs → engine-ntih8wNh.cjs} +8 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.cts.map +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/engine.d.mts.map +1 -1
- package/dist/engine.mjs +1 -1
- package/dist/helpers/create-execution-host.mjs.map +1 -1
- package/dist/helpers/finalize.mjs.map +1 -1
- package/dist/helpers/rpc.mjs.map +1 -1
- package/dist/helpers/stream.d.cts.map +1 -1
- package/dist/helpers/stream.d.mts.map +1 -1
- package/dist/helpers/stream.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/engine-DELjWFmN.mjs.map +0 -1
- package/dist/engine-context-5-_EGiKp.d.cts.map +0 -1
- package/dist/engine-context-zsn1PoRl.d.mts.map +0 -1
package/dist/api/build.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","names":[],"sources":["../../src/api/build.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 {\n EnvironmentContext,\n ExecutionContext,\n formatFolder\n} from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { copyFiles } from \"@stryke/fs/copy-file\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport chalk from \"chalk\";\nimport { existsSync } from \"node:fs\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\nasync function handleBuild<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(\n context: ExecutionContext<TResolvedConfig, TSystemContext>,\n env: EnvironmentContext<TResolvedConfig, TSystemContext>\n) {\n await context.callHook(\"build\", {\n environment: env,\n order: \"pre\"\n });\n\n env.debug(\n \"Formatting the generated entry files before the build process starts.\"\n );\n await formatFolder(env, env.entryPath);\n\n await context.callHook(\"build\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.config.output.copy) {\n env.debug(\"Copying project's files from build output directory.\");\n\n const destinationPath = isParentPath(\n appendPath(env.config.output.path, env.config.cwd),\n appendPath(env.config.root, env.config.cwd)\n )\n ? joinPaths(\n env.config.output.copy.path,\n relativePath(\n appendPath(env.config.root, env.config.cwd),\n appendPath(env.config.output.path, env.config.cwd)\n )\n )\n : joinPaths(env.config.output.copy.path, \"dist\");\n const sourcePath = env.config.output.path;\n\n if (existsSync(sourcePath) && sourcePath !== destinationPath) {\n env.debug(\n `Copying files from project's build output directory (${\n env.config.output.path\n }) to the project's copy/publish directory (${destinationPath}).`\n );\n\n await copyFiles(sourcePath, destinationPath);\n } else {\n env.warn(\n `The source path for the copy operation ${\n !existsSync(sourcePath)\n ? \"does not exist\"\n : \"is the same as the destination path\"\n }. Source: ${sourcePath}, Destination: ${\n destinationPath\n }. Skipping copying of build output files.`\n );\n }\n\n if (\n env.config.output.copy.assets &&\n Array.isArray(env.config.output.copy.assets)\n ) {\n await Promise.all(\n env.config.output.copy.assets.map(async asset => {\n env.trace(\n `Copying asset(s): ${chalk.redBright(\n env.config.cwd === asset.input\n ? asset.glob\n : appendPath(\n asset.glob,\n replacePath(asset.input, env.config.cwd)\n )\n )} -> ${chalk.greenBright(\n appendPath(asset.glob, replacePath(asset.output, env.config.cwd))\n )} ${\n Array.isArray(asset.ignore) && asset.ignore.length > 0\n ? ` (ignoring: ${asset.ignore\n .map(i => chalk.yellowBright(i))\n .join(\", \")})`\n : \"\"\n }`\n );\n\n await env.fs.copy(asset, asset.output);\n })\n );\n }\n } else {\n env.debug(\n \"No copy configuration found for the project output. Skipping the copying of build output files.\"\n );\n }\n\n await context.callHook(\"build\", {\n environment: env,\n order: \"post\"\n });\n}\n\n/**\n * Build the project\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function build<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Building\");\n\n await context.generateChecksum();\n if (\n context.meta.checksum !== context.persistedMeta?.checksum ||\n context.config.skipCache\n ) {\n context.info(\n !context.persistedMeta?.checksum\n ? \"No previous build cache found. Preparing the project for the initial build.\"\n : context.meta.checksum !== context.persistedMeta.checksum\n ? \"The project has been modified since the last time `prepare` was ran. Re-preparing the project.\"\n : \"The project is configured to skip cache. Re-preparing the project.\"\n );\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n }\n\n if (context.config.singleBuild) {\n await handleBuild<TResolvedConfig, TSystemContext>(\n context,\n await context.toEnvironment()\n );\n } else {\n await executeEnvironments(context, async env => {\n await handleBuild<TResolvedConfig, TSystemContext>(context, env);\n });\n }\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;AAoCA,eAAe,YAIb,SACA,KACA;
|
|
1
|
+
{"version":3,"file":"build.mjs","names":[],"sources":["../../src/api/build.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 {\n EnvironmentContext,\n ExecutionContext,\n formatFolder\n} from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { copyFiles } from \"@stryke/fs/copy-file\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport chalk from \"chalk\";\nimport { existsSync } from \"node:fs\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\nasync function handleBuild<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(\n context: ExecutionContext<TResolvedConfig, TSystemContext>,\n env: EnvironmentContext<TResolvedConfig, TSystemContext>\n) {\n await context.callHook(\"build\", {\n environment: env,\n order: \"pre\"\n });\n\n env.debug(\n \"Formatting the generated entry files before the build process starts.\"\n );\n await formatFolder(env, env.entryPath);\n\n await context.callHook(\"build\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.config.output.copy) {\n env.debug(\"Copying project's files from build output directory.\");\n\n const destinationPath = isParentPath(\n appendPath(env.config.output.path, env.config.cwd),\n appendPath(env.config.root, env.config.cwd)\n )\n ? joinPaths(\n env.config.output.copy.path,\n relativePath(\n appendPath(env.config.root, env.config.cwd),\n appendPath(env.config.output.path, env.config.cwd)\n )\n )\n : joinPaths(env.config.output.copy.path, \"dist\");\n const sourcePath = env.config.output.path;\n\n if (existsSync(sourcePath) && sourcePath !== destinationPath) {\n env.debug(\n `Copying files from project's build output directory (${\n env.config.output.path\n }) to the project's copy/publish directory (${destinationPath}).`\n );\n\n await copyFiles(sourcePath, destinationPath);\n } else {\n env.warn(\n `The source path for the copy operation ${\n !existsSync(sourcePath)\n ? \"does not exist\"\n : \"is the same as the destination path\"\n }. Source: ${sourcePath}, Destination: ${\n destinationPath\n }. Skipping copying of build output files.`\n );\n }\n\n if (\n env.config.output.copy.assets &&\n Array.isArray(env.config.output.copy.assets)\n ) {\n await Promise.all(\n env.config.output.copy.assets.map(async asset => {\n env.trace(\n `Copying asset(s): ${chalk.redBright(\n env.config.cwd === asset.input\n ? asset.glob\n : appendPath(\n asset.glob,\n replacePath(asset.input, env.config.cwd)\n )\n )} -> ${chalk.greenBright(\n appendPath(asset.glob, replacePath(asset.output, env.config.cwd))\n )} ${\n Array.isArray(asset.ignore) && asset.ignore.length > 0\n ? ` (ignoring: ${asset.ignore\n .map(i => chalk.yellowBright(i))\n .join(\", \")})`\n : \"\"\n }`\n );\n\n await env.fs.copy(asset, asset.output);\n })\n );\n }\n } else {\n env.debug(\n \"No copy configuration found for the project output. Skipping the copying of build output files.\"\n );\n }\n\n await context.callHook(\"build\", {\n environment: env,\n order: \"post\"\n });\n}\n\n/**\n * Build the project\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function build<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Building\");\n\n await context.generateChecksum();\n if (\n context.meta.checksum !== context.persistedMeta?.checksum ||\n context.config.skipCache\n ) {\n context.info(\n !context.persistedMeta?.checksum\n ? \"No previous build cache found. Preparing the project for the initial build.\"\n : context.meta.checksum !== context.persistedMeta.checksum\n ? \"The project has been modified since the last time `prepare` was ran. Re-preparing the project.\"\n : \"The project is configured to skip cache. Re-preparing the project.\"\n );\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n }\n\n if (context.config.singleBuild) {\n await handleBuild<TResolvedConfig, TSystemContext>(\n context,\n await context.toEnvironment()\n );\n } else {\n await executeEnvironments(context, async env => {\n await handleBuild<TResolvedConfig, TSystemContext>(context, env);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ACN,EAAE,MAAM,MAAM,YACZ,WAAW,MAAM,MAAM,YAAY,MAAM,QAAQ,IAAI,OAAO,GAAG,CAAC,CAClE,EAAE,GACA,MAAM,QAAQ,MAAM,MAAM,KAAK,MAAM,OAAO,SAAS,IACjD,eAAe,MAAM,OAClB,KAAI,MAAK,MAAM,aAAa,CAAC,CAAC,EAC9B,KAAK,IAAI,EAAE,KACd,IAER;GAEA,MAAM,IAAI,GAAG,KAAK,OAAO,MAAM,MAAM;EACvC,CAAC,CACH;CAEJ,OACE,IAAI,MACF,iGACF;CAGF,MAAM,QAAQ,SAAS,SAAS;EAC9B,aAAa;EACb,OAAO;CACT,CAAC;AACH;;;;;;AAOA,eAAsB,MAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,UAAU;CAEtC,MAAM,QAAQ,iBAAiB;CAC/B,IACE,QAAQ,KAAK,aAAa,QAAQ,eAAe,YACjD,QAAQ,OAAO,WACf;EACA,QAAQ,KACN,CAAC,QAAQ,eAAe,WACpB,gFACA,QAAQ,KAAK,aAAa,QAAQ,cAAc,WAC9C,mGACA,oEACR;EAEA,MAAM,QAAyC,OAAO;CACxD;CAEA,IAAI,QAAQ,OAAO,aACjB,MAAM,YACJ,SACA,MAAM,QAAQ,cAAc,CAC9B;MAEA,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,YAA6C,SAAS,GAAG;CACjE,CAAC;CAGH,MAAM;AACR"}
|
package/dist/api/clean.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.mjs","names":[],"sources":["../../src/api/clean.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Clean any previously prepared artifacts\n *\n * @param context - The execution context for the clean process, which provides access to the project configuration, environment, and utility functions for performing the clean operation. The context is used to manage the state and behavior of the clean process, allowing for hooks to be called at different stages of the clean and for environment-specific configurations to be applied.\n */\nexport async function clean<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Cleaning\");\n\n await prepare<TResolvedConfig, TSystemContext>(context, true);\n await executeEnvironments(context, async env => {\n env.debug(\"Cleaning the project's dist and artifacts directories.\");\n\n await env.fs.remove(joinPaths(env.config.cwd, env.config.output.path));\n await env.fs.remove(\n joinPaths(\n env.config.cwd,\n env.config.root,\n env.config.output.artifactsPath\n )\n );\n\n await context.callHook(\"clean\", {\n environment: env,\n sequential: false\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;AA8BA,eAAsB,MAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"clean.mjs","names":[],"sources":["../../src/api/clean.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Clean any previously prepared artifacts\n *\n * @param context - The execution context for the clean process, which provides access to the project configuration, environment, and utility functions for performing the clean operation. The context is used to manage the state and behavior of the clean process, allowing for hooks to be called at different stages of the clean and for environment-specific configurations to be applied.\n */\nexport async function clean<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Cleaning\");\n\n await prepare<TResolvedConfig, TSystemContext>(context, true);\n await executeEnvironments(context, async env => {\n env.debug(\"Cleaning the project's dist and artifacts directories.\");\n\n await env.fs.remove(joinPaths(env.config.cwd, env.config.output.path));\n await env.fs.remove(\n joinPaths(\n env.config.cwd,\n env.config.root,\n env.config.output.artifactsPath\n )\n );\n\n await context.callHook(\"clean\", {\n environment: env,\n sequential: false\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;AA8BA,eAAsB,MAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,UAAU;CAEtC,MAAM,QAAyC,SAAS,IAAI;CAC5D,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,IAAI,MAAM,wDAAwD;EAElE,MAAM,IAAI,GAAG,OAAO,UAAU,IAAI,OAAO,KAAK,IAAI,OAAO,OAAO,IAAI,CAAC;EACrE,MAAM,IAAI,GAAG,OACX,UACE,IAAI,OAAO,KACX,IAAI,OAAO,MACX,IAAI,OAAO,OAAO,aACpB,CACF;EAEA,MAAM,QAAQ,SAAS,SAAS;GAC9B,aAAa;GACb,YAAY;EACd,CAAC;CACH,CAAC;CAED,MAAM;AACR"}
|
package/dist/api/create.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.mjs","names":[],"sources":["../../src/api/create.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport Handlebars from \"handlebars\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Create a new Powerlines project\n *\n * @param context - The execution context for the create process, which provides access to the project configuration, environment, and utility functions for performing the create operation. The context is used to manage the state and behavior of the create process, allowing for hooks to be called at different stages of the create and for environment-specific configurations to be applied.\n */\nexport async function create<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Create a New Project Generation\");\n\n await prepare<TResolvedConfig, TSystemContext>(context, true);\n await executeEnvironments(context, async env => {\n env.debug(\"Initializing the processing options for the project.\");\n\n await context.callHook(\"create\", {\n environment: env,\n order: \"pre\"\n });\n\n const files = await listFiles(\n joinPaths(env.powerlinesPath, \"files/common/**/*.hbs\")\n );\n for (const file of files) {\n env.trace(`Adding template file to project: ${file}`);\n\n const template = Handlebars.compile(file);\n await env.fs.write(\n joinPaths(env.config.root, file.replace(\".hbs\", \"\")),\n template(env)\n );\n }\n\n await context.callHook(\"create\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.config.projectType === \"application\") {\n const appFiles = await listFiles(\n joinPaths(env.powerlinesPath, \"files/application/**/*.hbs\")\n );\n for (const file of appFiles) {\n env.trace(`Adding application template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await env.fs.write(\n joinPaths(env.config.root, file.replace(\".hbs\", \"\")),\n template(env)\n );\n }\n } else {\n const libFiles = await listFiles(\n joinPaths(env.powerlinesPath, \"files/library/**/*.hbs\")\n );\n for (const file of libFiles) {\n env.trace(`Adding library template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await env.fs.write(\n joinPaths(env.config.root, file.replace(\".hbs\", \"\")),\n template(env)\n );\n }\n }\n\n await context.callHook(\"create\", {\n environment: env,\n order: \"post\"\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,OAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"create.mjs","names":[],"sources":["../../src/api/create.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport Handlebars from \"handlebars\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Create a new Powerlines project\n *\n * @param context - The execution context for the create process, which provides access to the project configuration, environment, and utility functions for performing the create operation. The context is used to manage the state and behavior of the create process, allowing for hooks to be called at different stages of the create and for environment-specific configurations to be applied.\n */\nexport async function create<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Create a New Project Generation\");\n\n await prepare<TResolvedConfig, TSystemContext>(context, true);\n await executeEnvironments(context, async env => {\n env.debug(\"Initializing the processing options for the project.\");\n\n await context.callHook(\"create\", {\n environment: env,\n order: \"pre\"\n });\n\n const files = await listFiles(\n joinPaths(env.powerlinesPath, \"files/common/**/*.hbs\")\n );\n for (const file of files) {\n env.trace(`Adding template file to project: ${file}`);\n\n const template = Handlebars.compile(file);\n await env.fs.write(\n joinPaths(env.config.root, file.replace(\".hbs\", \"\")),\n template(env)\n );\n }\n\n await context.callHook(\"create\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.config.projectType === \"application\") {\n const appFiles = await listFiles(\n joinPaths(env.powerlinesPath, \"files/application/**/*.hbs\")\n );\n for (const file of appFiles) {\n env.trace(`Adding application template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await env.fs.write(\n joinPaths(env.config.root, file.replace(\".hbs\", \"\")),\n template(env)\n );\n }\n } else {\n const libFiles = await listFiles(\n joinPaths(env.powerlinesPath, \"files/library/**/*.hbs\")\n );\n for (const file of libFiles) {\n env.trace(`Adding library template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await env.fs.write(\n joinPaths(env.config.root, file.replace(\".hbs\", \"\")),\n template(env)\n );\n }\n }\n\n await context.callHook(\"create\", {\n environment: env,\n order: \"post\"\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,OAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,iCAAiC;CAE7D,MAAM,QAAyC,SAAS,IAAI;CAC5D,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,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ources":["../../src/api/deploy.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Deploy the project's source files to the target environment.\n *\n * @remarks\n * This function serves as the main entry point for the deployment process, orchestrating the execution of deployment hooks across different environments defined in the project configuration. It ensures that all relevant deployment operations are performed in a structured manner, allowing for pre-deployment, main deployment, and post-deployment hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the deployment operation, providing insights into the performance of the deployment process.\n *\n * @param context - The execution context for the deploy process, which provides access to the project configuration, environment, and utility functions for performing the deploy operation. The context is used to manage the state and behavior of the deploy process, allowing for hooks to be called at different stages of the deploy and for environment-specific configurations to be applied.\n */\nexport async function deploy<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Deployment\");\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"deploy\", {\n environment: env\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,OAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"deploy.mjs","names":[],"sources":["../../src/api/deploy.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Deploy the project's source files to the target environment.\n *\n * @remarks\n * This function serves as the main entry point for the deployment process, orchestrating the execution of deployment hooks across different environments defined in the project configuration. It ensures that all relevant deployment operations are performed in a structured manner, allowing for pre-deployment, main deployment, and post-deployment hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the deployment operation, providing insights into the performance of the deployment process.\n *\n * @param context - The execution context for the deploy process, which provides access to the project configuration, environment, and utility functions for performing the deploy operation. The context is used to manage the state and behavior of the deploy process, allowing for hooks to be called at different stages of the deploy and for environment-specific configurations to be applied.\n */\nexport async function deploy<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Deployment\");\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"deploy\", {\n environment: env\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,OAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,YAAY;CAExC,MAAM,QAAyC,OAAO;CACtD,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,QAAQ,SAAS,UAAU,EAC/B,aAAa,IACf,CAAC;CACH,CAAC;CAED,MAAM;AACR"}
|
package/dist/api/docs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/api/docs.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Generate the project's documentation.\n *\n * @remarks\n * This function serves as the main entry point for the documentation generation process, orchestrating the execution of documentation hooks across different environments defined in the project configuration. It ensures that all relevant documentation operations are performed in a structured manner, allowing for pre-documentation, main documentation, and post-documentation hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the documentation operation, providing insights into the performance of the documentation process.\n *\n * @param context - The execution context for the documentation process, which provides access to the project configuration, environment, and utility functions for performing the documentation operation. The context is used to manage the state and behavior of the documentation process, allowing for hooks to be called at different stages of the documentation and for environment-specific configurations to be applied.\n */\nexport async function docs<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Documentation\");\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"docs\", {\n environment: env\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,KAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/api/docs.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Generate the project's documentation.\n *\n * @remarks\n * This function serves as the main entry point for the documentation generation process, orchestrating the execution of documentation hooks across different environments defined in the project configuration. It ensures that all relevant documentation operations are performed in a structured manner, allowing for pre-documentation, main documentation, and post-documentation hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the documentation operation, providing insights into the performance of the documentation process.\n *\n * @param context - The execution context for the documentation process, which provides access to the project configuration, environment, and utility functions for performing the documentation operation. The context is used to manage the state and behavior of the documentation process, allowing for hooks to be called at different stages of the documentation and for environment-specific configurations to be applied.\n */\nexport async function docs<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Documentation\");\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"docs\", {\n environment: env\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,KAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,eAAe;CAE3C,MAAM,QAAyC,OAAO;CACtD,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,QAAQ,SAAS,QAAQ,EAC7B,aAAa,IACf,CAAC;CACH,CAAC;CAED,MAAM;AACR"}
|
package/dist/api/lint.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.mjs","names":[],"sources":["../../src/api/lint.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Lint the project's source files and report any issues found.\n *\n * @remarks\n * This function serves as the main entry point for the linting process, orchestrating the execution of linting hooks across different environments defined in the project configuration. It ensures that all relevant linting operations are performed in a structured manner, allowing for pre-linting, main linting, and post-linting hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the linting operation, providing insights into the performance of the linting process.\n *\n * @param context - The execution context for the lint process, which provides access to the project configuration, environment, and utility functions for performing the lint operation. The context is used to manage the state and behavior of the lint process, allowing for hooks to be called at different stages of the lint and for environment-specific configurations to be applied.\n */\nexport async function lint<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Linting\");\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"lint\", {\n environment: env,\n sequential: false\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,KAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"lint.mjs","names":[],"sources":["../../src/api/lint.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Lint the project's source files and report any issues found.\n *\n * @remarks\n * This function serves as the main entry point for the linting process, orchestrating the execution of linting hooks across different environments defined in the project configuration. It ensures that all relevant linting operations are performed in a structured manner, allowing for pre-linting, main linting, and post-linting hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the linting operation, providing insights into the performance of the linting process.\n *\n * @param context - The execution context for the lint process, which provides access to the project configuration, environment, and utility functions for performing the lint operation. The context is used to manage the state and behavior of the lint process, allowing for hooks to be called at different stages of the lint and for environment-specific configurations to be applied.\n */\nexport async function lint<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Linting\");\n\n await prepare<TResolvedConfig, TSystemContext>(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"lint\", {\n environment: env,\n sequential: false\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,KAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,SAAS;CAErC,MAAM,QAAyC,OAAO;CACtD,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,QAAQ,SAAS,QAAQ;GAC7B,aAAa;GACb,YAAY;EACd,CAAC;CACH,CAAC;CAED,MAAM;AACR"}
|
package/dist/api/prepare.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.mjs","names":[],"sources":["../../src/api/prepare.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { handleTypes } from \"@powerlines/core/lib/generate-types\";\nimport { installDependencies } from \"@powerlines/core/lib/install-dependencies\";\nimport { writeMetaFile } from \"@powerlines/core/lib/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"@powerlines/core/lib/typescript/tsconfig\";\nimport { formatFolder } from \"@powerlines/core/lib/utilities/format\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\n\n/**\n * Prepare the project\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function prepare<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(\n context: ExecutionContext<TResolvedConfig, TSystemContext>,\n skipTypes = false\n) {\n const timer = context.timer(\"Preparation\");\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig, TSystemContext>(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n env.debug(\n `The configuration provided ${\n isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length\n } entry point(s), Powerlines has found ${\n env.entry.length\n } entry files(s) for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig, TSystemContext>(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n env.trace({\n meta: {\n category: \"config\"\n },\n message: `Powerlines configuration after configResolved hook: \\n${formatConfig(\n env.config\n )}`\n });\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"pre\"\n });\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"normal\"\n });\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"post\"\n });\n\n if (!skipTypes && env.config.output.types !== false) {\n await handleTypes(context, env);\n }\n\n context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(env, env.builtinsPath),\n formatFolder(env, env.entryPath)\n ]);\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,eAAsB,QAIpB,SACA,YAAY,OACZ;CACA,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"prepare.mjs","names":[],"sources":["../../src/api/prepare.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { handleTypes } from \"@powerlines/core/lib/generate-types\";\nimport { installDependencies } from \"@powerlines/core/lib/install-dependencies\";\nimport { writeMetaFile } from \"@powerlines/core/lib/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"@powerlines/core/lib/typescript/tsconfig\";\nimport { formatFolder } from \"@powerlines/core/lib/utilities/format\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\n\n/**\n * Prepare the project\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function prepare<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(\n context: ExecutionContext<TResolvedConfig, TSystemContext>,\n skipTypes = false\n) {\n const timer = context.timer(\"Preparation\");\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig, TSystemContext>(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n env.debug(\n `The configuration provided ${\n isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length\n } entry point(s), Powerlines has found ${\n env.entry.length\n } entry files(s) for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig, TSystemContext>(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n env.trace({\n meta: {\n category: \"config\"\n },\n message: `Powerlines configuration after configResolved hook: \\n${formatConfig(\n env.config\n )}`\n });\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"pre\"\n });\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"normal\"\n });\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"post\"\n });\n\n if (!skipTypes && env.config.output.types !== false) {\n await handleTypes(context, env);\n }\n\n context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(env, env.builtinsPath),\n formatFolder(env, env.entryPath)\n ]);\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,eAAsB,QAIpB,SACA,YAAY,OACZ;CACA,MAAM,QAAQ,QAAQ,MAAM,aAAa;CAEzC,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,IAAI,MACF,iEACF;EAEA,MAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;EACT,CAAC;EAED,MAAM,mBAAoD,GAAG;EAE7D,MAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;EACT,CAAC;EAED,IAAI,IAAI,MAAM,SAAS,GACrB,IAAI,MACF,8BACE,SAAS,IAAI,OAAO,KAAK,IACrB,OAAO,KAAK,IAAI,OAAO,KAAK,EAAE,SAC9B,QAAQ,IAAI,OAAO,KAAK,EAAE,OAC/B,wCACC,IAAI,MAAM,OACX,0BAA0B,IAAI,OAAO,MAAM,UAC1C,IAAI,MAAM,SAAS,KAAK,IAAI,MAAM,SAAS,KACvC,OAAO,IAAI,MACR,KACC,UACE,KAAK,MAAM,OACT,MAAM,SAAS,OAAO,MAAM,WAAW,IAE7C,EACC,KAAK,KAAK,MACb,IAER;OAEA,IAAI,KACF,qCACE,IAAI,OAAO,MACZ,6HACH;EAGF,MAAM,gBAAiD,GAAG;EAC1D,MAAM,oBAAoB,GAAG;EAE7B,MAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;EACT,CAAC;EAED,IAAI,MAAM;GACR,MAAM,EACJ,UAAU,SACZ;GACA,SAAS,yDAAyD,aAChE,IAAI,MACN;EACF,CAAC;EAED,IAAI,CAAC,IAAI,GAAG,WAAW,IAAI,SAAS,GAClC,MAAM,gBAAgB,IAAI,SAAS;EAGrC,IAAI,CAAC,IAAI,GAAG,WAAW,IAAI,QAAQ,GACjC,MAAM,gBAAgB,IAAI,QAAQ;EAGpC,MAAM,QAAQ,SAAS,WAAW;GAChC,aAAa;GACb,OAAO;EACT,CAAC;EACD,MAAM,QAAQ,SAAS,WAAW;GAChC,aAAa;GACb,OAAO;EACT,CAAC;EAED,MAAM,QAAQ,SAAS,WAAW;GAChC,aAAa;GACb,OAAO;EACT,CAAC;EAED,IAAI,CAAC,aAAa,IAAI,OAAO,OAAO,UAAU,OAC5C,MAAM,YAAY,SAAS,GAAG;EAGhC,QAAQ,MAAM,qDAAqD;EAEnE,MAAM,QAAQ,IAAI,CAChB,aAAa,KAAK,IAAI,YAAY,GAClC,aAAa,KAAK,IAAI,SAAS,CACjC,CAAC;EAED,MAAM,cAAc,GAAG;EACvB,IAAI,gBAAgB,IAAI;CAC1B,CAAC;CAED,MAAM;AACR"}
|
package/dist/api/test.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.mjs","names":[],"sources":["../../src/api/test.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Test the project's source files and report any issues found.\n *\n * @remarks\n * This function serves as the main entry point for the testing process, orchestrating the execution of testing hooks across different environments defined in the project configuration. It ensures that all relevant testing operations are performed in a structured manner, allowing for pre-testing, main testing, and post-testing hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the testing operation, providing insights into the performance of the testing process.\n *\n * @param context - The execution context for the test process, which provides access to the project configuration, environment, and utility functions for performing the test operation. The context is used to manage the state and behavior of the test process, allowing for hooks to be called at different stages of the test and for environment-specific configurations to be applied.\n */\nexport async function test<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Testing\");\n\n await prepare(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"test\", {\n environment: env,\n sequential: false\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,KAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"test.mjs","names":[],"sources":["../../src/api/test.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 { ExecutionContext } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Test the project's source files and report any issues found.\n *\n * @remarks\n * This function serves as the main entry point for the testing process, orchestrating the execution of testing hooks across different environments defined in the project configuration. It ensures that all relevant testing operations are performed in a structured manner, allowing for pre-testing, main testing, and post-testing hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the testing operation, providing insights into the performance of the testing process.\n *\n * @param context - The execution context for the test process, which provides access to the project configuration, environment, and utility functions for performing the test operation. The context is used to manage the state and behavior of the test process, allowing for hooks to be called at different stages of the test and for environment-specific configurations to be applied.\n */\nexport async function test<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Testing\");\n\n await prepare(context);\n await executeEnvironments(context, async env => {\n await context.callHook(\"test\", {\n environment: env,\n sequential: false\n });\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,KAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,SAAS;CAErC,MAAM,QAAQ,OAAO;CACrB,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,QAAQ,SAAS,QAAQ;GAC7B,aAAa;GACb,YAAY;EACd,CAAC;CACH,CAAC;CAED,MAAM;AACR"}
|
package/dist/api/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/api/types.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 { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { handleTypes } from \"@powerlines/core/lib/generate-types\";\nimport { installDependencies } from \"@powerlines/core/lib/install-dependencies\";\nimport { writeMetaFile } from \"@powerlines/core/lib/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"@powerlines/core/lib/typescript/tsconfig\";\nimport { format } from \"@powerlines/core/lib/utilities/format\";\nimport { ExecutionContext } from \"@powerlines/core/types/context\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Generate runtime types for the Powerlines project.\n *\n * @remarks\n * This function is responsible for generating TypeScript declaration files based on the project's configuration and environment. It executes hooks at various stages of the type generation process, allowing for customization and extension by plugins. The generated types are formatted and written to the appropriate location in the project's file system, ensuring that they are available for use by other parts of the Powerlines system and by end-users of the project.\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function types<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Type Generation\");\n context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig, TSystemContext>(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n env.debug(\n `The configuration provided ${\n isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length\n } entry point(s), Powerlines has found ${\n env.entry.length\n } entry files(s) for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig, TSystemContext>(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...env.config,\n userConfig: isSetObject(env.config.userConfig)\n ? omit(env.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(env.config.inlineConfig)\n ? env.config.inlineConfig\n : undefined,\n plugins: env.plugins.map(plugin => plugin.name)\n })}`\n );\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n if (\n env.config.skipCache === true ||\n env.persistedMeta?.checksum !== env.meta.checksum\n ) {\n env.debug(\n `Using previously prepared files as the meta checksum has not changed.`\n );\n } else {\n env.info(\n `Running \\`prepare\\` command as the meta checksum has changed since the last run.`\n );\n\n await prepare(context, true);\n }\n\n await handleTypes(context, env);\n\n context.debug(\"Formatting files generated during the types step.\");\n\n await format(env, env.typesPath, (await env.fs.read(env.typesPath)) ?? \"\");\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,eAAsB,MAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/api/types.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 { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { handleTypes } from \"@powerlines/core/lib/generate-types\";\nimport { installDependencies } from \"@powerlines/core/lib/install-dependencies\";\nimport { writeMetaFile } from \"@powerlines/core/lib/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"@powerlines/core/lib/typescript/tsconfig\";\nimport { format } from \"@powerlines/core/lib/utilities/format\";\nimport { ExecutionContext } from \"@powerlines/core/types/context\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Generate runtime types for the Powerlines project.\n *\n * @remarks\n * This function is responsible for generating TypeScript declaration files based on the project's configuration and environment. It executes hooks at various stages of the type generation process, allowing for customization and extension by plugins. The generated types are formatted and written to the appropriate location in the project's file system, ensuring that they are available for use by other parts of the Powerlines system and by end-users of the project.\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function types<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Type Generation\");\n context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig, TSystemContext>(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n env.debug(\n `The configuration provided ${\n isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length\n } entry point(s), Powerlines has found ${\n env.entry.length\n } entry files(s) for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig, TSystemContext>(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...env.config,\n userConfig: isSetObject(env.config.userConfig)\n ? omit(env.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(env.config.inlineConfig)\n ? env.config.inlineConfig\n : undefined,\n plugins: env.plugins.map(plugin => plugin.name)\n })}`\n );\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n if (\n env.config.skipCache === true ||\n env.persistedMeta?.checksum !== env.meta.checksum\n ) {\n env.debug(\n `Using previously prepared files as the meta checksum has not changed.`\n );\n } else {\n env.info(\n `Running \\`prepare\\` command as the meta checksum has changed since the last run.`\n );\n\n await prepare(context, true);\n }\n\n await handleTypes(context, env);\n\n context.debug(\"Formatting files generated during the types step.\");\n\n await format(env, env.typesPath, (await env.fs.read(env.typesPath)) ?? \"\");\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,eAAsB,MAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,iBAAiB;CAC7C,QAAQ,MACN,+DACF;CAEA,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,IAAI,MACF,iEACF;EAEA,MAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;EACT,CAAC;EAED,MAAM,mBAAoD,GAAG;EAE7D,MAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;EACT,CAAC;EAED,IAAI,IAAI,MAAM,SAAS,GACrB,IAAI,MACF,8BACE,SAAS,IAAI,OAAO,KAAK,IACrB,OAAO,KAAK,IAAI,OAAO,KAAK,EAAE,SAC9B,QAAQ,IAAI,OAAO,KAAK,EAAE,OAC/B,wCACC,IAAI,MAAM,OACX,0BAA0B,IAAI,OAAO,MAAM,UAC1C,IAAI,MAAM,SAAS,KAAK,IAAI,MAAM,SAAS,KACvC,OAAO,IAAI,MACR,KACC,UACE,KAAK,MAAM,OACT,MAAM,SAAS,OAAO,MAAM,WAAW,IAE7C,EACC,KAAK,KAAK,MACb,IAER;OAEA,IAAI,KACF,qCACE,IAAI,OAAO,MACZ,6HACH;EAGF,MAAM,gBAAiD,GAAG;EAC1D,MAAM,oBAAoB,GAAG;EAE7B,MAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;EACT,CAAC;EAED,QAAQ,MACN,mDAAmD,iBAAiB;GAClE,GAAG,IAAI;GACP,YAAY,YAAY,IAAI,OAAO,UAAU,IACzC,KAAK,IAAI,OAAO,YAAY,CAAC,SAAS,CAAC,IACvC;GACJ,cAAc,YAAY,IAAI,OAAO,YAAY,IAC7C,IAAI,OAAO,eACX;GACJ,SAAS,IAAI,QAAQ,KAAI,WAAU,OAAO,IAAI;EAChD,CAAC,GACH;EAEA,IAAI,CAAC,IAAI,GAAG,WAAW,IAAI,SAAS,GAClC,MAAM,gBAAgB,IAAI,SAAS;EAGrC,IAAI,CAAC,IAAI,GAAG,WAAW,IAAI,QAAQ,GACjC,MAAM,gBAAgB,IAAI,QAAQ;EAGpC,IACE,IAAI,OAAO,cAAc,QACzB,IAAI,eAAe,aAAa,IAAI,KAAK,UAEzC,IAAI,MACF,uEACF;OACK;GACL,IAAI,KACF,kFACF;GAEA,MAAM,QAAQ,SAAS,IAAI;EAC7B;EAEA,MAAM,YAAY,SAAS,GAAG;EAE9B,QAAQ,MAAM,mDAAmD;EAEjE,MAAM,OAAO,KAAK,IAAI,WAAY,MAAM,IAAI,GAAG,KAAK,IAAI,SAAS,KAAM,EAAE;EAEzE,MAAM,cAAc,GAAG;EACvB,IAAI,gBAAgB,IAAI;CAC1B,CAAC;CAED,MAAM;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-B2dWvRMM.d.mts","names":[],"sources":["../src/types/utils.ts","../src/types/api.ts"],"mappings":";;;;;;KAkBY,MAAA,gDAEc,aAAA,oBAElB,eAAA,eAA8B,MAAA,EAAQ,OAAA,KAAY,OAAA;EAExD,QAAA,QAAgB,OAAA;AAAA;;;;AANlB;;;;;UCuBiB,kBAAA;EDnByC;;;;;;;;EC4BxD,OAAA,GAAU,YAAA,EAAc,mBAAA,KAAwB,OAAA;ED5BZ
|
|
1
|
+
{"version":3,"file":"api-B2dWvRMM.d.mts","names":[],"sources":["../src/types/utils.ts","../src/types/api.ts"],"mappings":";;;;;;KAkBY,MAAA,gDAEc,aAAA,oBAElB,eAAA,eAA8B,MAAA,EAAQ,OAAA,KAAY,OAAA;EAExD,QAAA,QAAgB,OAAA;AAAA;;;;AANlB;;;;;UCuBiB,kBAAA;EDnByC;;;;;;;;EC4BxD,OAAA,GAAU,YAAA,EAAc,mBAAA,KAAwB,OA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AA,EAAwB,YAAA,GACzB,aAAA;AAAA,KAGU,uBAAA,GAA0B,aAAa,QAC1C,qBAAA;;;;UAMQ,MAAA,uBACO,aAAA,kBACd,kBAAA;EAd+D;;;EAkBvE,OAAA,EAAS,aAAA;EAhBI;AAAA;AAGf;EAkBE,IAAA,EAAM,aAAA,CAAc,aAAA;AAAA"}
|
package/dist/api.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","names":["executeTypes","executePrepare","executeCreate","executeClean","executeLint","executeTest","executeBuild","executeDocs","executeDeploy"],"sources":["../src/api.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 { build as executeBuild } from \"./api/build\";\nimport { clean as executeClean } from \"./api/clean\";\nimport { create as executeCreate } from \"./api/create\";\nimport { deploy as executeDeploy } from \"./api/deploy\";\nimport { docs as executeDocs } from \"./api/docs\";\nimport { lint as executeLint } from \"./api/lint\";\nimport { prepare as executePrepare } from \"./api/prepare\";\nimport { test as executeTest } from \"./api/test\";\nimport { types as executeTypes } from \"./api/types\";\nimport { createExecutionHost } from \"./helpers/create-execution-host\";\n\nconst executionHost = createExecutionHost({\n types: executeTypes,\n prepare: executePrepare,\n create: executeCreate,\n clean: executeClean,\n lint: executeLint,\n test: executeTest,\n build: executeBuild,\n docs: executeDocs,\n deploy: executeDeploy\n});\n\nexport const types = executionHost.types;\nexport const prepare = executionHost.prepare;\nexport const create = executionHost.create;\nexport const clean = executionHost.clean;\nexport const lint = executionHost.lint;\nexport const test = executionHost.test;\nexport const build = executionHost.build;\nexport const docs = executionHost.docs;\nexport const deploy = executionHost.deploy;\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,gBAAgB,oBAAoB;CACxC,OAAOA;CACP,SAASC;CACT,QAAQC;CACR,OAAOC;CACP,MAAMC;CACN,MAAMC;CACN,OAAOC;CACP,MAAMC;CACN,QAAQC;
|
|
1
|
+
{"version":3,"file":"api.mjs","names":["executeTypes","executePrepare","executeCreate","executeClean","executeLint","executeTest","executeBuild","executeDocs","executeDeploy"],"sources":["../src/api.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 { build as executeBuild } from \"./api/build\";\nimport { clean as executeClean } from \"./api/clean\";\nimport { create as executeCreate } from \"./api/create\";\nimport { deploy as executeDeploy } from \"./api/deploy\";\nimport { docs as executeDocs } from \"./api/docs\";\nimport { lint as executeLint } from \"./api/lint\";\nimport { prepare as executePrepare } from \"./api/prepare\";\nimport { test as executeTest } from \"./api/test\";\nimport { types as executeTypes } from \"./api/types\";\nimport { createExecutionHost } from \"./helpers/create-execution-host\";\n\nconst executionHost = createExecutionHost({\n types: executeTypes,\n prepare: executePrepare,\n create: executeCreate,\n clean: executeClean,\n lint: executeLint,\n test: executeTest,\n build: executeBuild,\n docs: executeDocs,\n deploy: executeDeploy\n});\n\nexport const types = executionHost.types;\nexport const prepare = executionHost.prepare;\nexport const create = executionHost.create;\nexport const clean = executionHost.clean;\nexport const lint = executionHost.lint;\nexport const test = executionHost.test;\nexport const build = executionHost.build;\nexport const docs = executionHost.docs;\nexport const deploy = executionHost.deploy;\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,gBAAgB,oBAAoB;CACxC,OAAOA;CACP,SAASC;CACT,QAAQC;CACR,OAAOC;CACP,MAAMC;CACN,MAAMC;CACN,OAAOC;CACP,MAAMC;CACN,QAAQC;AACV,CAAC;AAED,MAAa,QAAQ,cAAc;AACnC,MAAa,UAAU,cAAc;AACrC,MAAa,SAAS,cAAc;AACpC,MAAa,QAAQ,cAAc;AACnC,MAAa,OAAO,cAAc;AAClC,MAAa,OAAO,cAAc;AAClC,MAAa,QAAQ,cAAc;AACnC,MAAa,OAAO,cAAc;AAClC,MAAa,SAAS,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-C9AD-erz.d.mts","names":[],"sources":["../src/types/rpc.ts","../src/types/config.ts"],"mappings":";;;;;;;;;;UAkCiB,kBAAA;;AAAjB;;EAIE,SAAA;EAJiC;;;EAQjC,IAAA;EAQA;;;EAJA,SAAA;EAYW;AAGb;;EAXE,WAAA;EAWqE;;;EAPrE,WAAA;EAWS
|
|
1
|
+
{"version":3,"file":"config-C9AD-erz.d.mts","names":[],"sources":["../src/types/rpc.ts","../src/types/config.ts"],"mappings":";;;;;;;;;;UAkCiB,kBAAA;;AAAjB;;EAIE,SAAA;EAJiC;;;EAQjC,IAAA;EAQA;;;EAJA,SAAA;EAYW;AAGb;;EAXE,WAAA;EAWqE;;;EAPrE,WAAA;EAWS;;AAAQ;EAPjB,WAAA;AAAA;AAAA,UAGe,iBAAA,mBAAoC,kBAAkB;EAO5C;AAA6B;AACxD;EAJE,OAAA,EAAS,QAAA;AAAA;AAAA,KAGC,WAAA,IAAe,OAAA,UAAiB,YAAY;AAAA,KAC5C,YAAA,GAAe,MAAM,SAAS,WAAA;AAAA,KAE9B,gBAAA,IAAoB,OAA+B,EAAtB,iBAAiB;AAAA,KAC9C,iBAAA,GAAoB,MAAM,SAAS,gBAAA;AAAA,KA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"sources":["../src/types/rpc.ts","../src/types/config.ts"],"mappings":";;;;;;;;;;UAkCiB,kBAAA;;AAAjB;;EAIE,SAAA;EAJiC;;;EAQjC,IAAA;EAQA;;;EAJA,SAAA;EAYW;AAGb;;EAXE,WAAA;EAWqE;;;EAPrE,WAAA;EAWS
|
|
1
|
+
{"version":3,"file":"config-D6xUniHh.d.cts","names":[],"sources":["../src/types/rpc.ts","../src/types/config.ts"],"mappings":";;;;;;;;;;UAkCiB,kBAAA;;AAAjB;;EAIE,SAAA;EAJiC;;;EAQjC,IAAA;EAQA;;;EAJA,SAAA;EAYW;AAGb;;EAXE,WAAA;EAWqE;;;EAPrE,WAAA;EAWS;;AAAQ;EAPjB,WAAA;AAAA;AAAA,UAGe,iBAAA,mBAAoC,kBAAkB;EAO5C;AAA6B;AACxD;EAJE,OAAA,EAAS,QAAA;AAAA;AAAA,KAGC,WAAA,IAAe,OAAA,UAAiB,YAAY;AAAA,KAC5C,YAAA,GAAe,MAAM,SAAS,WAAA;AAAA,KAE9B,gBAAA,IAAoB,OAA+B,EAAtB,iBAAiB;AAAA,KAC9C,iBAAA,GAAoB,MAAM,SAAS,gBAAA;AAAA,KAEnC,kBAAA,IACV,OAAA,EAAS,iBAAA,UACN,OAAO;AAAA,KACA,mBAAA,GAAsB,MAAM,SAAS,kBAAA;AAAA,KAErC,kBAAA,mBAAqC,kBAAA,KAC/C,OAAA,EAAS,UAAA,CAAW,SAAA,oBACjB,UAAA,CAAW,QAAA,CAAS,SAAA;AAAA,KAEb,mBAAA,oBAAuC,mBAAA,qBAClC,UAAA,GAAa,kBAAA,CAAmB,UAAA,CAAW,IAAA;AAAA,KAGhD,eAAA,mBAAkC,WAAA,KAC5C,OAAA,EAAS,iBAAA,CAAkB,UAAA,CAAW,SAAA,UACnC,UAAA,CAAW,SAAA,UAAmB,OAAA,YAAmB,CAAA,GAAI,UAAA,CAAW,SAAA;AAAA,KAEzD,gBAAA,oBAAoC,YAAA,qBAC/B,UAAA,GAAa,eA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AAAA;;;;;;KCzLJ,aAAA,GAAgB,IAAA,CAC1B,WAAA,CAAY,kBAAA,0CAGZ,OAAA;EDNiC;;;ECU/B,IAAA;EDFF;;;ECOE,IAAA;EDSF;;AAAW;ECJT,IAAA;EDO8B;;;;;;ECC9B,YAAA,GAAe,YAAA;EDGA;AAAA;AAGnB;ECDI,SAAA,GAAY,gBAAA;AAAA;AAAA,UAGC,sBAAA,SAA+B,gBAAA;EDFQ;AACxD;;ECKE,OAAA;EDLyB;AAA0B;AAErD;ECQE,UAAA,EAAY,cAAA;;;ADRiD;ECa7D,SAAA,GAAY,OAAA,CAAQ,mBAAA;EDZO;;;ECiB3B,UAAA,GAAa,OAAA,CACX,YAAA,CAAa,kBAAA,EAAoB,kBAAA;EDhBzB;;;;;;ECyBV,YAAA,aAAyB,OAAA,CAAQ,eAAA;AAAA;AAAA,KAGvB,gBAAA,GAAmB,YAAY,CACzC,sBAAA;AAAA,KAIU,oBAAA,qBAAyC,UAAA,GAAa,UAAA,IAChE,cAAA,CAAe,WAAA,EAAa,sBAAA"}
|
|
@@ -13,6 +13,8 @@ valibot = require_chunk.__toESM(valibot, 1);
|
|
|
13
13
|
|
|
14
14
|
//#region src/context/engine-context.ts
|
|
15
15
|
var PowerlinesEngineContext = class PowerlinesEngineContext extends _powerlines_core_context_base_context.PowerlinesBaseContext {
|
|
16
|
+
options;
|
|
17
|
+
connection;
|
|
16
18
|
#executions = [];
|
|
17
19
|
#devtools;
|
|
18
20
|
#logLevel;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PowerlinesEngineContext } from "../engine-context-
|
|
1
|
+
import { t as PowerlinesEngineContext } from "../engine-context-lrWc13AH.cjs";
|
|
2
2
|
export { PowerlinesEngineContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PowerlinesEngineContext } from "../engine-context-
|
|
1
|
+
import { t as PowerlinesEngineContext } from "../engine-context-Cc93ql_I.mjs";
|
|
2
2
|
export { PowerlinesEngineContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context.mjs","names":["#devtools","#logLevel","#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 FrameworkOptions,\n InlineConfig,\n LogFn,\n LoggerOptions,\n LogLevelResolvedConfig\n} from \"@powerlines/core\";\nimport { PowerlinesBaseContext } from \"@powerlines/core/context/base-context\";\nimport {\n getDefaultLogLevel,\n loadParsedConfig,\n resolveRoot\n} from \"@powerlines/core/lib/config\";\nimport {\n createLogger,\n formatConfig,\n resolveLogLevel,\n withCustomLogger\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { createHostContext } from \"devframe/node\";\nimport {\n ConnectionMeta,\n DevToolsHost,\n DevToolsNodeContext\n} from \"devframe/types\";\nimport * as v from \"valibot\";\nimport { EngineOptions } from \"../types/config\";\nimport { EngineContext, EngineExecutionItem } from \"../types/context\";\n\nexport class PowerlinesEngineContext<TSystemContext = unknown>\n extends PowerlinesBaseContext<TSystemContext>\n implements EngineContext<TSystemContext>\n{\n #executions: EngineExecutionItem[] = [];\n\n #devtools!: DevToolsNodeContext;\n\n #logLevel!: LogLevelResolvedConfig;\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 from<TSystemContext = unknown>(\n options: EngineOptions,\n host: DevToolsHost,\n connection: ConnectionMeta\n ): Promise<PowerlinesEngineContext<TSystemContext>> {\n const context = new PowerlinesEngineContext<TSystemContext>(\n options,\n connection\n );\n\n context.#devtools = await createHostContext({\n cwd: context.cwd,\n mode: \"dev\",\n host\n });\n await options.setup?.(context.#devtools);\n\n context.#devtools.rpc.register({\n name: \"powerlines:log\",\n type: \"event\",\n args: [\n v.object({\n meta: v.object({\n category: v.string(),\n name: v.string(),\n command: v.string(),\n hook: v.string(),\n plugin: v.string(),\n source: v.string()\n }),\n message: v.string()\n })\n ],\n setup: _ => ({\n handler: payload => {\n switch (payload.meta.type) {\n case \"error\":\n context.error(payload);\n break;\n case \"warn\":\n context.warn(payload);\n break;\n case \"info\":\n context.info(payload);\n break;\n case \"debug\":\n context.debug(payload);\n break;\n case \"trace\":\n context.trace(payload);\n break;\n default:\n context.info(payload);\n break;\n }\n }\n })\n });\n\n context.#logLevel = options.logLevel\n ? resolveLogLevel(options.logLevel)\n : await getDefaultLogLevel(context.cwd);\n\n return context;\n }\n\n public override createLogger(options: LoggerOptions = {}, logFn?: LogFn) {\n let logger = createLogger(\n \"engine\",\n {\n logLevel: this.#logLevel,\n ...options\n },\n logFn\n );\n if (this.options.customLogger) {\n logger = withCustomLogger(logger, this.options.customLogger);\n }\n return logger;\n }\n\n public get executions(): EngineExecutionItem[] {\n return this.#executions;\n }\n\n public get devtools(): DevToolsNodeContext {\n return this.#devtools;\n }\n\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: kebabCase(this.orgId),\n appId: kebabCase(this.framework.name),\n workspaceRoot: this.cwd\n });\n }\n\n public get framework(): FrameworkOptions {\n return {\n name: \"powerlines\",\n orgId: \"storm-software\",\n ...this.options.framework\n };\n }\n\n public get orgId(): string {\n return this.framework.orgId;\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 connection - The connection metadata for the dev server.\n */\n protected constructor(\n public override options: EngineOptions,\n public connection: ConnectionMeta\n ) {\n super(options);\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 * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n */\n public async loadExecutions(\n method: string,\n inlineConfig: InlineConfig\n ): Promise<EngineExecutionItem[]> {\n const root = resolveRoot(\n this.cwd,\n inlineConfig.root,\n inlineConfig.configFile\n );\n\n const config = await loadParsedConfig(\n this.cwd,\n root,\n this.framework?.name,\n this.orgId,\n inlineConfig\n );\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const invocationId = uuid();\n const executions = await Promise.all(\n toArray(config.config).map(async (_, configIndex) => {\n const executionId = uuid();\n const options = {\n cwd: this.cwd,\n root,\n framework: this.framework,\n orgId: this.orgId,\n ...this.options,\n command: method,\n baseURL: this.#devtools.host.resolveOrigin(),\n connection: this.connection,\n configFile: config.configFile!,\n executionId,\n configIndex\n };\n\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${method} with the following execution parameters: \\n --- Options --- \\n${formatConfig(\n options\n )}\\n --- Inline Config --- \\n${formatConfig(inlineConfig)}`\n });\n\n return {\n invocationId,\n method,\n configFile: config,\n options,\n state: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n\n this.#executions = this.#executions.concat(executions);\n\n return executions;\n }\n\n /**\n * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.\n *\n * @param invocationId - The unique identifier for the invocation of the execution to be completed.\n * @param executionId - The unique identifier for the specific execution to be completed.\n */\n public completeExecution(invocationId: string, executionId: string) {\n this.#executions = this.#executions.filter(\n execution =>\n execution.options.executionId !== executionId ||\n execution.invocationId !== invocationId\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAmDA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAqC,EAAE;CAEvC;CAEA;;;;;;;CAQA,aAAoB,KAClB,SACA,MACA,YACkD;EAClD,MAAM,UAAU,IAAI,wBAClB,SACA,WACD;AAED,WAAQA,WAAY,MAAM,kBAAkB;GAC1C,KAAK,QAAQ;GACb,MAAM;GACN;GACD,CAAC;AACF,QAAM,QAAQ,QAAQ,SAAQA,SAAU;AAExC,WAAQA,SAAU,IAAI,SAAS;GAC7B,MAAM;GACN,MAAM;GACN,MAAM,CACJ,EAAE,OAAO;IACP,MAAM,EAAE,OAAO;KACb,UAAU,EAAE,QAAQ;KACpB,MAAM,EAAE,QAAQ;KAChB,SAAS,EAAE,QAAQ;KACnB,MAAM,EAAE,QAAQ;KAChB,QAAQ,EAAE,QAAQ;KAClB,QAAQ,EAAE,QAAQ;KACnB,CAAC;IACF,SAAS,EAAE,QAAQ;IACpB,CAAC,CACH;GACD,QAAO,OAAM,EACX,UAAS,YAAW;AAClB,YAAQ,QAAQ,KAAK,MAArB;KACE,KAAK;AACH,cAAQ,MAAM,QAAQ;AACtB;KACF,KAAK;AACH,cAAQ,KAAK,QAAQ;AACrB;KACF,KAAK;AACH,cAAQ,KAAK,QAAQ;AACrB;KACF,KAAK;AACH,cAAQ,MAAM,QAAQ;AACtB;KACF,KAAK;AACH,cAAQ,MAAM,QAAQ;AACtB;KACF;AACE,cAAQ,KAAK,QAAQ;AACrB;;MAGP;GACF,CAAC;AAEF,WAAQC,WAAY,QAAQ,WACxB,gBAAgB,QAAQ,SAAS,GACjC,MAAM,mBAAmB,QAAQ,IAAI;AAEzC,SAAO;;CAGT,AAAgB,aAAa,UAAyB,EAAE,EAAE,OAAe;EACvE,IAAI,SAAS,aACX,UACA;GACE,UAAU,MAAK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;AAEF,UAAO;IACL;IACA;IACA,YAAY;IACZ;IACA,OAAO;KACL,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;AAED,QAAKE,aAAc,MAAKA,WAAY,OAAO,WAAW;AAEtD,SAAO;;;;;;;;CAST,AAAO,kBAAkB,cAAsB,aAAqB;AAClE,QAAKA,aAAc,MAAKA,WAAY,QAClC,cACE,UAAU,QAAQ,gBAAgB,eAClC,UAAU,iBAAiB,aAC9B"}
|
|
1
|
+
{"version":3,"file":"engine-context.mjs","names":["#devtools","#logLevel","#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 FrameworkOptions,\n InlineConfig,\n LogFn,\n LoggerOptions,\n LogLevelResolvedConfig\n} from \"@powerlines/core\";\nimport { PowerlinesBaseContext } from \"@powerlines/core/context/base-context\";\nimport {\n getDefaultLogLevel,\n loadParsedConfig,\n resolveRoot\n} from \"@powerlines/core/lib/config\";\nimport {\n createLogger,\n formatConfig,\n resolveLogLevel,\n withCustomLogger\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { createHostContext } from \"devframe/node\";\nimport {\n ConnectionMeta,\n DevToolsHost,\n DevToolsNodeContext\n} from \"devframe/types\";\nimport * as v from \"valibot\";\nimport { EngineOptions } from \"../types/config\";\nimport { EngineContext, EngineExecutionItem } from \"../types/context\";\n\nexport class PowerlinesEngineContext<TSystemContext = unknown>\n extends PowerlinesBaseContext<TSystemContext>\n implements EngineContext<TSystemContext>\n{\n #executions: EngineExecutionItem[] = [];\n\n #devtools!: DevToolsNodeContext;\n\n #logLevel!: LogLevelResolvedConfig;\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 from<TSystemContext = unknown>(\n options: EngineOptions,\n host: DevToolsHost,\n connection: ConnectionMeta\n ): Promise<PowerlinesEngineContext<TSystemContext>> {\n const context = new PowerlinesEngineContext<TSystemContext>(\n options,\n connection\n );\n\n context.#devtools = await createHostContext({\n cwd: context.cwd,\n mode: \"dev\",\n host\n });\n await options.setup?.(context.#devtools);\n\n context.#devtools.rpc.register({\n name: \"powerlines:log\",\n type: \"event\",\n args: [\n v.object({\n meta: v.object({\n category: v.string(),\n name: v.string(),\n command: v.string(),\n hook: v.string(),\n plugin: v.string(),\n source: v.string()\n }),\n message: v.string()\n })\n ],\n setup: _ => ({\n handler: payload => {\n switch (payload.meta.type) {\n case \"error\":\n context.error(payload);\n break;\n case \"warn\":\n context.warn(payload);\n break;\n case \"info\":\n context.info(payload);\n break;\n case \"debug\":\n context.debug(payload);\n break;\n case \"trace\":\n context.trace(payload);\n break;\n default:\n context.info(payload);\n break;\n }\n }\n })\n });\n\n context.#logLevel = options.logLevel\n ? resolveLogLevel(options.logLevel)\n : await getDefaultLogLevel(context.cwd);\n\n return context;\n }\n\n public override createLogger(options: LoggerOptions = {}, logFn?: LogFn) {\n let logger = createLogger(\n \"engine\",\n {\n logLevel: this.#logLevel,\n ...options\n },\n logFn\n );\n if (this.options.customLogger) {\n logger = withCustomLogger(logger, this.options.customLogger);\n }\n return logger;\n }\n\n public get executions(): EngineExecutionItem[] {\n return this.#executions;\n }\n\n public get devtools(): DevToolsNodeContext {\n return this.#devtools;\n }\n\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: kebabCase(this.orgId),\n appId: kebabCase(this.framework.name),\n workspaceRoot: this.cwd\n });\n }\n\n public get framework(): FrameworkOptions {\n return {\n name: \"powerlines\",\n orgId: \"storm-software\",\n ...this.options.framework\n };\n }\n\n public get orgId(): string {\n return this.framework.orgId;\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 connection - The connection metadata for the dev server.\n */\n protected constructor(\n public override options: EngineOptions,\n public connection: ConnectionMeta\n ) {\n super(options);\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 * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n */\n public async loadExecutions(\n method: string,\n inlineConfig: InlineConfig\n ): Promise<EngineExecutionItem[]> {\n const root = resolveRoot(\n this.cwd,\n inlineConfig.root,\n inlineConfig.configFile\n );\n\n const config = await loadParsedConfig(\n this.cwd,\n root,\n this.framework?.name,\n this.orgId,\n inlineConfig\n );\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const invocationId = uuid();\n const executions = await Promise.all(\n toArray(config.config).map(async (_, configIndex) => {\n const executionId = uuid();\n const options = {\n cwd: this.cwd,\n root,\n framework: this.framework,\n orgId: this.orgId,\n ...this.options,\n command: method,\n baseURL: this.#devtools.host.resolveOrigin(),\n connection: this.connection,\n configFile: config.configFile!,\n executionId,\n configIndex\n };\n\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${method} with the following execution parameters: \\n --- Options --- \\n${formatConfig(\n options\n )}\\n --- Inline Config --- \\n${formatConfig(inlineConfig)}`\n });\n\n return {\n invocationId,\n method,\n configFile: config,\n options,\n state: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n\n this.#executions = this.#executions.concat(executions);\n\n return executions;\n }\n\n /**\n * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.\n *\n * @param invocationId - The unique identifier for the invocation of the execution to be completed.\n * @param executionId - The unique identifier for the specific execution to be completed.\n */\n public completeExecution(invocationId: string, executionId: string) {\n this.#executions = this.#executions.filter(\n execution =>\n execution.options.executionId !== executionId ||\n execution.invocationId !== invocationId\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAmDA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CAiIoB;CACT;CAjIT,cAAqC,CAAC;CAEtC;CAEA;;;;;;;CAQA,aAAoB,KAClB,SACA,MACA,YACkD;EAClD,MAAM,UAAU,IAAI,wBAClB,SACA,UACF;EAEA,QAAQA,YAAY,MAAM,kBAAkB;GAC1C,KAAK,QAAQ;GACb,MAAM;GACN;EACF,CAAC;EACD,MAAM,QAAQ,QAAQ,QAAQA,SAAS;EAEvC,QAAQA,UAAU,IAAI,SAAS;GAC7B,MAAM;GACN,MAAM;GACN,MAAM,CACJ,EAAE,OAAO;IACP,MAAM,EAAE,OAAO;KACb,UAAU,EAAE,OAAO;KACnB,MAAM,EAAE,OAAO;KACf,SAAS,EAAE,OAAO;KAClB,MAAM,EAAE,OAAO;KACf,QAAQ,EAAE,OAAO;KACjB,QAAQ,EAAE,OAAO;IACnB,CAAC;IACD,SAAS,EAAE,OAAO;GACpB,CAAC,CACH;GACA,QAAO,OAAM,EACX,UAAS,YAAW;IAClB,QAAQ,QAAQ,KAAK,MAArB;KACE,KAAK;MACH,QAAQ,MAAM,OAAO;MACrB;KACF,KAAK;MACH,QAAQ,KAAK,OAAO;MACpB;KACF,KAAK;MACH,QAAQ,KAAK,OAAO;MACpB;KACF,KAAK;MACH,QAAQ,MAAM,OAAO;MACrB;KACF,KAAK;M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KAAK,KAAK;IACV;IACA,WAAW,KAAK;IAChB,OAAO,KAAK;IACZ,GAAG,KAAK;IACR,SAAS;IACT,SAAS,KAAKA,UAAU,KAAK,cAAc;IAC3C,YAAY,KAAK;IACjB,YAAY,OAAO;IACnB;IACA;GACF;GAEA,KAAK,OAAO,MAAM;IAChB,MAAM,EAAE,UAAU,SAAS;IAC3B,SAAS,YAAY,OAAO,iEAAiE,aAC3F,OACF,EAAE,6BAA6B,aAAa,YAAY;GAC1D,CAAC;GAED,OAAO;IACL;IACA;IACA,YAAY;IACZ;IACA,OAAO;KACL,SAAS;KACT,MAAM;KACN,QAAQ;IACV;GACF;EACF,CAAC,CACH;EAEA,KAAKE,cAAc,KAAKA,YAAY,OAAO,UAAU;EAErD,OAAO;CACT;;;;;;;CAQA,AAAO,kBAAkB,cAAsB,aAAqB;EAClE,KAAKA,cAAc,KAAKA,YAAY,QAClC,cACE,UAAU,QAAQ,gBAAgB,eAClC,UAAU,iBAAiB,YAC/B;CACF;AACF"}
|
package/dist/context/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PowerlinesEngineContext } from "../engine-context-
|
|
1
|
+
import { t as PowerlinesEngineContext } from "../engine-context-lrWc13AH.cjs";
|
|
2
2
|
export { PowerlinesEngineContext };
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PowerlinesEngineContext } from "../engine-context-
|
|
1
|
+
import { t as PowerlinesEngineContext } from "../engine-context-Cc93ql_I.mjs";
|
|
2
2
|
export { PowerlinesEngineContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-S3XH2DWP.d.mts","names":[],"sources":["../src/types/context.ts"],"mappings":";;;;;;AA0BA;;KAAY,kBAAA
|
|
1
|
+
{"version":3,"file":"context-S3XH2DWP.d.mts","names":[],"sources":["../src/types/context.ts"],"mappings":";;;;;;AA0BA;;KAAY,kBAAA;;AAAkB;AAK9B;UAAiB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brk) return "inspect-brk";
|
|
64
64
|
}
|
|
65
65
|
var ExecutionHostWorker = class ExecutionHostWorker {
|
|
66
|
+
executionHostPath;
|
|
67
|
+
exposedMethods;
|
|
68
|
+
options;
|
|
66
69
|
#worker;
|
|
67
70
|
/**
|
|
68
71
|
* Creates a new instance of the ExecutionHostWorker class, which manages a worker process for executing tasks related to the Powerlines Engine. The worker is initialized with the specified options and can be used to run tasks in an isolated environment, with support for automatic restarts and activity monitoring.
|
|
@@ -77,7 +80,11 @@ var ExecutionHostWorker = class ExecutionHostWorker {
|
|
|
77
80
|
if (!resolvedPath) throw new Error(`Could not resolve the provided Execution Host path: \`${apiPath}\`.`);
|
|
78
81
|
let exposedMethods = toArray(options.apiMethods ?? []);
|
|
79
82
|
if (exposedMethods.length === 0) {
|
|
80
|
-
const jiti = createJiti(import.meta.url
|
|
83
|
+
const jiti = createJiti(import.meta.url, {
|
|
84
|
+
cache: false,
|
|
85
|
+
interopDefault: true,
|
|
86
|
+
tsconfigPaths: true
|
|
87
|
+
});
|
|
81
88
|
const mod = await jiti.import(jiti.esmResolve(resolvedPath));
|
|
82
89
|
if (isFunction(mod)) exposedMethods.push(...exposedMethods, "default");
|
|
83
90
|
else if (isSetObject(mod)) exposedMethods = Object.keys(mod).filter((name) => isFunction(mod[name]));
|
|
@@ -561,4 +568,4 @@ async function createEngine(options, apiPath = "@powerlines/engine/api", apiMeth
|
|
|
561
568
|
|
|
562
569
|
//#endregion
|
|
563
570
|
export { createContext as n, createEngine as r, PowerlinesEngine as t };
|
|
564
|
-
//# sourceMappingURL=engine-
|
|
571
|
+
//# sourceMappingURL=engine-Ct0OGdyp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-Ct0OGdyp.mjs","names":["#worker","#context","#host"],"sources":["../src/_internal/execution-host-worker.ts","../src/engine.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 { InlineConfig, Mode } from \"@powerlines/core\";\nimport { getDefaultMode } from \"@powerlines/core/lib/config\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolve } from \"@stryke/fs/resolve\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport { formatDuration } from \"date-fns/formatDuration\";\nimport { createJiti } from \"jiti\";\nimport { pipeline } from \"node:stream\";\nimport { parseArgs } from \"node:util\";\nimport {\n MessageChannel,\n StructuredSerializeOptions\n} from \"node:worker_threads\";\nimport Piscina from \"piscina\";\nimport { MessagePortDuplex } from \"../helpers/stream\";\nimport { ExecutionHost } from \"../types/api\";\nimport { EngineExecutionOptions } from \"../types/config\";\nimport { EngineContext } from \"../types/context\";\n\nconst RESTARTED = Symbol(\"powerlines-worker:restarted\");\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ninterface DebugAddress {\n host?: string;\n port: number;\n}\n\n/**\n * Formats the debug address into a string.\n */\nconst formatDebugAddress = ({ host, port }: DebugAddress): string => {\n return host ? `${host}:${port}` : `${port}`;\n};\n\nexport type NodeOptions = Record<string, string | boolean | undefined>;\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nconst getParsedDebugAddress = (\n address: string | boolean | undefined\n): DebugAddress => {\n if (!address || !isString(address)) {\n return { host: undefined, port: 9229 };\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(\":\")) {\n const [host, port] = address.split(\":\");\n if (!host || !port) {\n throw new Error(`Invalid debug address: ${address}`);\n }\n\n return { host, port: Number.parseInt(port, 10) };\n }\n\n return { host: undefined, port: Number.parseInt(address, 10) };\n};\n\ntype NodeInspectType = \"inspect\" | \"inspect-brk\" | undefined;\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nfunction getNodeDebugType(nodeOptions: NodeOptions): NodeInspectType {\n if (nodeOptions.inspect) {\n return \"inspect\";\n }\n if (nodeOptions[\"inspect-brk\"] || nodeOptions.inspect_brk) {\n return \"inspect-brk\";\n }\n\n return undefined;\n}\n\nexport interface ExecutionHostWorkerOptions<\n TExecutionAPI extends ReadonlyArray<string>\n> {\n // /**\n // * `-1` if not inspectable\n // */\n // debuggerPortOffset?: number;\n\n // /**\n // * Whether to enable source maps support in the worker, which can improve the quality of stack traces at the cost of increased memory usage and slower performance. Defaults to `false`.\n // */\n // enableSourceMaps?: boolean;\n\n /**\n * The maximum time in milliseconds a worker can run before being terminated.\n *\n * @defaultValue 900000 (15 minutes)\n */\n timeout?: number;\n\n /**\n * True if `--max-old-space-size` should not be forwarded to the worker.\n */\n isolatedMemory?: boolean;\n\n /**\n * The mode to run the worker in, which can affect how the worker is initialized and how it behaves. This is determined based on the resolved configuration of the engine, and can be used to optimize the worker for different environments (e.g., development, production, etc.).\n */\n mode?: Mode;\n\n /**\n * An optional root to resolve the execution host path from, which can be used to specify a custom root directory for the worker to use when resolving paths and loading configuration files. If this option is not provided, the worker will use the current working directory as the root directory by default.\n */\n root?: string;\n\n /**\n * The context of the {@link @powerlines/engine#Engine | Engine instance}, which can be used to access the engine's state and services within the worker.\n */\n context: EngineContext;\n\n /**\n * An array of method names that the worker exposes. These methods will be available on the Worker instance and can be called to execute tasks in the worker process.\n */\n apiMethods?: TExecutionAPI;\n}\n\nexport class ExecutionHostWorker<TExecutionAPI extends ReadonlyArray<string>> {\n #worker: Piscina | undefined;\n\n /**\n * Creates a new instance of the ExecutionHostWorker class, which manages a worker process for executing tasks related to the Powerlines Engine. The worker is initialized with the specified options and can be used to run tasks in an isolated environment, with support for automatic restarts and activity monitoring.\n *\n * @param apiPath - The path to the Execution Host file.\n * @param options - The options for configuring the worker, including the execution context, exposed methods, timeout, and mode.\n * @returns A promise that resolves to an instance of the ExecutionHostWorker class.\n */\n public static async from<TExecutionAPI extends ReadonlyArray<string>>(\n apiPath: string,\n options: ExecutionHostWorkerOptions<TExecutionAPI>\n ) {\n const mode = await getDefaultMode(options.context.cwd);\n\n const resolvedPath = await resolve(apiPath, {\n paths: [\n options.context.cwd,\n options.root ? appendPath(options.root, options.context.cwd) : undefined\n ].filter(Boolean) as string[]\n });\n if (!resolvedPath) {\n throw new Error(\n `Could not resolve the provided Execution Host path: \\`${apiPath}\\`.`\n );\n }\n\n let exposedMethods = toArray((options.apiMethods ?? []) as string[]);\n if (exposedMethods.length === 0) {\n const jiti = createJiti(import.meta.url, {\n cache: false,\n interopDefault: true,\n tsconfigPaths: true\n });\n const mod: Record<string, AnyFunction> = await jiti.import(\n jiti.esmResolve(resolvedPath)\n );\n if (isFunction(mod)) {\n exposedMethods.push(...exposedMethods, \"default\");\n } else if (isSetObject(mod)) {\n exposedMethods = Object.keys(mod).filter(name => isFunction(mod[name]));\n }\n }\n\n return new ExecutionHostWorker<TExecutionAPI>(\n resolvedPath,\n exposedMethods,\n {\n mode,\n ...options\n }\n ) as unknown as ExecutionHost<TExecutionAPI>;\n }\n\n /**\n * Create a new worker instance.\n *\n * @param executionHostPath - The path to the worker file.\n * @param exposedMethods - An array of method names that the worker exposes.\n * @param options - The options for the worker, including exposed methods, timeout, and hooks for activity and restart.\n */\n public constructor(\n protected executionHostPath: string,\n protected exposedMethods: string[],\n protected options: ExecutionHostWorkerOptions<TExecutionAPI>\n ) {\n const {\n timeout = 900_000,\n isolatedMemory = false,\n mode = \"production\",\n context\n } = this.options;\n\n const logger = context.extendLogger({ category: \"communication\" });\n\n let restartPromise: Promise<typeof RESTARTED>;\n let resolveRestartPromise: (arg: typeof RESTARTED) => void;\n let activeTasks = 0;\n\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n void this.finalize();\n });\n\n let nodeOptions = {} as {\n [longOption: string]: string | boolean | undefined;\n };\n\n const args: string[] = [...process.execArgv];\n if (process.env.NODE_OPTIONS) {\n let isInString = false;\n let willStartNewArg = true;\n\n const stringifiedNodeOptions = process.env.NODE_OPTIONS.split(\" \").filter(\n part =>\n ((part.startsWith('\"') && part.endsWith('\"')) ||\n (part.startsWith(\"'\") && part.endsWith(\"'\"))) &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString).length > 0 &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString)\n .every(p => p.startsWith(\"--\"))\n );\n args.push(\n ...stringifiedNodeOptions.map(part => part.replace(/^['\"]|['\"]$/g, \"\"))\n );\n\n const inputNodeModules = stringifiedNodeOptions.reduce((acc, part) => {\n return acc.replace(part, \"\").trim();\n }, process.env.NODE_OPTIONS);\n for (let i = 0; i < inputNodeModules.length; i++) {\n let char = inputNodeModules[i];\n if (char) {\n // Skip any escaped characters in strings.\n if (char === \"\\\\\" && isInString) {\n // Ensure we don't have an escape character at the end.\n if (inputNodeModules.length === i + 1) {\n throw new Error(\"Invalid escape character at the end.\");\n }\n\n // Skip the next character.\n char = inputNodeModules[++i];\n if (!char) {\n continue;\n }\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === \" \" && !isInString) {\n willStartNewArg = true;\n continue;\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString;\n continue;\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char);\n willStartNewArg = false;\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char;\n }\n }\n }\n\n if (isInString) {\n throw new Error(\"Unterminated string\");\n }\n }\n\n if (args.length > 0) {\n const { values, tokens } = parseArgs({\n args,\n strict: false,\n tokens: true\n });\n nodeOptions = values;\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (!token) continue;\n\n if (token.kind === \"option-terminator\") {\n break;\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === \"option\") {\n orphan = !isSet(token.value) ? token : null;\n continue;\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== \"positional\") {\n orphan = null;\n continue;\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue;\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in nodeOptions && isString(nodeOptions[orphan.name])) {\n nodeOptions[orphan.name] += ` ${token.value}`;\n } else {\n nodeOptions[orphan.name] = token.value;\n }\n }\n }\n\n const originalOptions = { ...nodeOptions };\n\n delete nodeOptions.inspect;\n delete nodeOptions[\"inspect-brk\"];\n delete nodeOptions.inspect_brk;\n\n if (mode === \"development\") {\n const nodeDebugType = getNodeDebugType(originalOptions);\n if (nodeDebugType) {\n const debuggerAddress = getParsedDebugAddress(\n originalOptions[nodeDebugType]\n );\n const address: DebugAddress = {\n host: debuggerAddress.host,\n // current process runs on `address.port`\n port: debuggerAddress.port === 0 ? 0 : debuggerAddress.port + 1 + 1\n };\n nodeOptions[nodeDebugType] = formatDebugAddress(address);\n }\n\n nodeOptions[\"enable-source-maps\"] = true;\n }\n\n if (isolatedMemory) {\n delete nodeOptions[\"max-old-space-size\"];\n delete nodeOptions.max_old_space_size;\n }\n\n const execArgv: string[] = [];\n const nodeOptionsParts: string[] = [];\n for (const [key, value] of Object.entries(nodeOptions)) {\n let formatted: string | null = null;\n if (value === true) {\n formatted = `--${key}`;\n } else if (value) {\n formatted = `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(\" \") && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`;\n }\n\n if (formatted === null) {\n continue;\n }\n\n if (\n [\n \"experimental-network-inspection\",\n \"experimental-storage-inspection\",\n \"experimental-worker-inspection\",\n \"experimental-inspector-network-resource\"\n ].includes(key)\n ) {\n execArgv.push(formatted);\n } else {\n nodeOptionsParts.push(formatted);\n }\n }\n\n const onHanging = () => {\n if (!this.#worker) {\n return;\n }\n\n const resolve = resolveRestartPromise;\n // eslint-disable-next-line ts/no-use-before-define\n createWorker();\n\n logger.warn(\n `Sending SIGTERM signal to worker due to timeout${\n timeout ? ` of ${formatDuration({ seconds: timeout / 1000 })}` : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void this.finalize().then(() => {\n resolve(RESTARTED);\n });\n };\n\n let hangingTimer: NodeJS.Timeout | false = false;\n\n const onActivity = () => {\n if (hangingTimer) {\n clearTimeout(hangingTimer);\n }\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);\n };\n\n const createWorker = () => {\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n NODE_ENV: mode,\n NODE_OPTIONS: nodeOptionsParts.join(\" \"),\n POWERLINES_EXECUTION_HOST_WORKER: \"true\"\n };\n\n if (env.FORCE_COLOR === undefined) {\n // Mirror the enablement heuristic from picocolors (see https://github.com/vercel/next.js/blob/6a40da0345939fe4f7b1ae519b296a86dd103432/packages/next/src/lib/picocolors.ts#L21-L24).\n // Picocolors snapshots `process.env`/`stdout.isTTY` at module load time, so when the worker\n // process bootstraps with piped stdio its own check would disable colors. Re-evaluating the\n // same conditions here lets us opt the worker into color output only when the parent would\n // have seen colors, while still respecting explicit opt-outs like NO_COLOR.\n const supportsColors =\n !env.NO_COLOR &&\n !env.CI &&\n env.TERM !== \"dumb\" &&\n (process.stdout.isTTY || process.stderr?.isTTY);\n\n if (supportsColors) {\n env.FORCE_COLOR = \"1\";\n }\n }\n\n this.#worker = new Piscina({\n filename: executionHostPath,\n execArgv,\n env\n });\n\n restartPromise = new Promise(resolve => {\n resolveRestartPromise = resolve;\n });\n\n this.#worker.on(\"exit\", (code, signal) => {\n logger.debug(\n `Worker process exited with code ${code} and signal ${signal}`\n );\n\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n const error = new Error(\n `Execution Host Worker exited unexpectedly with code ${\n code\n } and signal ${signal}`\n );\n logger.error(error);\n\n void this.finalize().then(() => {\n throw error;\n });\n }\n });\n\n this.#worker.on(\"error\", error => {\n logger.error({\n meta: { category: \"communication\" },\n message: `Worker process emitted an error: ${error.message}`,\n error\n });\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n this.#worker.on(\"message\", data => {\n onActivity();\n\n if (Array.isArray(data) && data.length > 1 && isNumber(data[0])) {\n if (data[0] === 0) {\n logger.trace(\n `Received message from worker: ${JSON.stringify(data.slice(1), null, 2)}`\n );\n } else {\n logger.debug(\n `Received error message from worker: ${JSON.stringify(\n data.slice(1),\n null,\n 2\n )}`\n );\n }\n }\n\n logger.trace(\n `Received message from worker: ${JSON.stringify(data, null, 2)}`\n );\n });\n };\n\n createWorker();\n\n for (const method of this.exposedMethods) {\n if (method.startsWith(\"_\")) {\n continue;\n }\n\n const callWorker = async (\n options: EngineExecutionOptions,\n inlineConfig: InlineConfig\n ) => {\n if (!this.#worker) {\n throw new Error(\"Execution Host Worker is not initialized\");\n }\n\n const { port1, port2 } = new MessageChannel();\n const promise = this.#worker.run(\n { options, inlineConfig, port: port2 },\n {\n name: method,\n transferList: [port2] as StructuredSerializeOptions\n }\n );\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n aborted = true;\n }\n };\n const duplex = new MessagePortDuplex(port1, { onActivityAbort });\n\n pipeline(\n duplex,\n process.stdout,\n (err: NodeJS.ErrnoException | null) => {\n if (err) {\n logger.debug(\n `Received exception message from worker: ${JSON.stringify(\n err,\n null,\n 2\n )}`\n );\n\n throw err;\n }\n }\n );\n\n await promise;\n };\n\n (this as any)[method] = timeout\n ? async (\n options: EngineExecutionOptions,\n inlineConfig: InlineConfig\n ) => {\n activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n onActivity();\n\n const result = await Promise.race([\n callWorker(options, inlineConfig),\n restartPromise\n ]);\n if (result !== RESTARTED) {\n return result;\n }\n\n logger.warn(\n `Execution Host Worker was restarted while calling method \"${\n method\n }\" (attempt ${attempts++}). Retrying the call...`\n );\n }\n } finally {\n activeTasks--;\n onActivity();\n }\n }\n : callWorker.bind(this);\n }\n }\n\n /**\n * Closes the worker process, terminating it if it's still running. This method should be called when the worker is no longer needed, to free up system resources and ensure a clean shutdown. If the worker has already been terminated, this method will have no effect.\n */\n public async finalize(): Promise<void> {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n await worker.close({\n force: true\n });\n this.#worker = undefined;\n }\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 BuildInlineConfig,\n CleanInlineConfig,\n CreateInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n InlineConfig,\n LintInlineConfig,\n PrepareInlineConfig,\n TestInlineConfig,\n TypesInlineConfig\n} from \"@powerlines/core\";\nimport { EXECUTION_API_METHODS } from \"@powerlines/core/constants\";\nimport { createH3DevToolsHost } from \"devframe/node\";\nimport { getPort } from \"get-port-please\";\nimport { createApp, fromNodeMiddleware } from \"h3\";\nimport { EventEmitter } from \"node:events\";\nimport sirv from \"sirv\";\nimport { ExecutionHostWorker } from \"./_internal/execution-host-worker\";\nimport { PowerlinesEngineContext } from \"./context/engine-context\";\nimport { Engine, ExecutionHost } from \"./types/api\";\nimport { EngineOptions } from \"./types/config\";\nimport { EngineContext } from \"./types/context\";\n\n/**\n * The Powerlines process' orchestration and coordination API.\n *\n * @public\n */\nexport class PowerlinesEngine<\n TExecutionAPI extends ReadonlyArray<string> = typeof EXECUTION_API_METHODS\n>\n implements Engine<TExecutionAPI>, AsyncDisposable\n{\n /**\n * The Powerlines context\n */\n #context: EngineContext;\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n #host: ExecutionHost<TExecutionAPI>;\n\n /**\n * The Powerlines context\n */\n public get context(): EngineContext {\n return this.#context;\n }\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n public get host(): ExecutionHost<TExecutionAPI> {\n return this.#host;\n }\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param context - The Powerlines context\n * @param host - The API host for the execution workers\n * @returns A new instance of the Powerlines Engine\n */\n public constructor(\n context: EngineContext,\n host: ExecutionHost<TExecutionAPI>\n ) {\n this.#context = context;\n this.#host = host;\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the create command\n * @returns A promise that resolves when the project has been created\n */\n public async create(inlineConfig: CreateInlineConfig) {\n const timer = this.context.timer(\"Create\");\n this.context.info(\"🆕 Creating a new project\");\n\n await this.execute(\"create\", inlineConfig);\n\n this.context.debug(\"✔ Create command completed successfully\");\n timer();\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(inlineConfig: TypesInlineConfig) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\"🏗️ Generating typescript declarations for the project\");\n\n await this.execute(\"types\", inlineConfig);\n\n this.context.debug(\"✔ Types generation has completed successfully\");\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(inlineConfig: PrepareInlineConfig) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\"🏗️ Preparing the project\");\n\n await this.execute(\"prepare\", inlineConfig);\n\n this.context.debug(\"✔ Preparation has completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(inlineConfig: CleanInlineConfig) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\"🧹 Cleaning the previous artifacts\");\n\n await this.execute(\"clean\", inlineConfig);\n\n this.context.debug(\"✔ Cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(inlineConfig: LintInlineConfig) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\"📝 Linting the project\");\n\n await this.execute(\"lint\", inlineConfig);\n\n this.context.debug(\"✔ Linting completed successfully\");\n timer();\n }\n\n /**\n * Test the project\n *\n * @remarks\n * This method will run the tests for the Powerlines project.\n *\n * @param inlineConfig - The inline configuration for the test command\n * @returns A promise that resolves when the test command has completed\n */\n public async test(inlineConfig: TestInlineConfig) {\n const timer = this.context.timer(\"Test\");\n this.context.info(\"🧪 Running tests for the project\");\n\n await this.execute(\"test\", inlineConfig);\n\n this.context.debug(\"✔ Testing completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(inlineConfig: BuildInlineConfig) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\"📦 Building the project\");\n\n await this.execute(\"build\", inlineConfig);\n\n this.context.debug(\"✔ Build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\"📓 Generating documentation for the project\");\n\n await this.execute(\"docs\", inlineConfig);\n\n this.context.debug(\"✔ Documentation generation completed successfully\");\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n * @returns A promise that resolves when the deploy command has completed\n */\n public async deploy(inlineConfig: DeployInlineConfig) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\"🚀 Deploying the project\");\n\n await this.execute(\"deploy\", inlineConfig);\n\n this.context.debug(\"✔ Deployment completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalize\");\n this.context.info(\"🏁 Finalization processes started\");\n\n await this.host.finalize();\n\n this.context.debug(\"✔ Finalization completed successfully\");\n timer();\n }\n\n /**\n * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.\n */\n public async [Symbol.asyncDispose]() {\n return this.finalize();\n }\n\n /**\n * Execute a Powerlines command based on the provided execution path and inline configuration, loading the necessary executions from the context and managing their lifecycle.\n *\n * @remarks\n * This method will load the executions for the specified command and inline configuration, then execute each one while managing their lifecycle, including handling their completion and any errors that may occur during execution.\n *\n * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n * @returns A promise that resolves when all executions for the specified command have completed\n */\n protected async execute(\n method: TExecutionAPI[number],\n inlineConfig: InlineConfig\n ) {\n await Promise.all(\n (await this.context.loadExecutions(method, inlineConfig)).map(\n async execution => {\n try {\n await this.host[method](execution.options, inlineConfig);\n } catch (error) {\n this.context.error(\n `Execution of method \"${method}\" failed for execution with invocation ID \"${\n execution.invocationId\n }\" and execution ID \"${execution.options.executionId}\": \\n\\n${\n error instanceof Error\n ? error.stack || error.message\n : String(error)\n }`\n );\n\n throw error;\n } finally {\n this.context.completeExecution(\n execution.invocationId,\n execution.options.executionId\n );\n }\n }\n )\n );\n }\n}\n\nexport async function createContext(options: EngineOptions) {\n const port =\n options.port ??\n (await getPort({\n host: options.host || \"localhost\",\n random: true\n }));\n\n const app = createApp();\n const host = createH3DevToolsHost({\n appName: options.framework?.name || \"powerlines\",\n origin: `http://${options.host || \"localhost\"}:${port}`,\n mount: (base, dir) => {\n app.use(base, fromNodeMiddleware(sirv(dir, { dev: true, single: true })));\n }\n });\n\n return PowerlinesEngineContext.from(options, host, {\n backend: \"websocket\",\n websocket: port\n });\n}\n\nexport async function createEngine<TExecutionAPI extends ReadonlyArray<string>>(\n options: EngineOptions,\n apiPath = \"@powerlines/engine/api\",\n apiMethods?: TExecutionAPI\n) {\n EventEmitter.setMaxListeners(Infinity);\n\n const context = await createContext(options);\n const host = await ExecutionHostWorker.from<TExecutionAPI>(apiPath, {\n root: options.root,\n context,\n apiMethods\n });\n\n return new PowerlinesEngine<TExecutionAP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QACb,MAAM,SAAS,MAAM,UACrB,OAAO,KAAK,GAEpB;IAEA,MAAM;GACR,UAAU;IACR,KAAK,QAAQ,kBACX,UAAU,cACV,UAAU,QAAQ,WACpB;GACF;EACF,CACF,CACF;CACF;AACF;AAEA,eAAsB,cAAc,SAAwB;CAC1D,MAAM,OACJ,QAAQ,QACP,MAAM,QAAQ;EACb,MAAM,QAAQ,QAAQ;EACtB,QAAQ;CACV,CAAC;CAEH,MAAM,MAAM,UAAU;CACtB,MAAM,OAAO,qBAAqB;EAChC,SAAS,QAAQ,WAAW,QAAQ;EACpC,QAAQ,UAAU,QAAQ,QAAQ,YAAY,GAAG;EACjD,QAAQ,MAAM,QAAQ;GACpB,IAAI,IAAI,MAAM,mBAAmB,KAAK,KAAK;IAAE,KAAK;IAAM,QAAQ;GAAK,CAAC,CAAC,CAAC;EAC1E;CACF,CAAC;CAED,OAAO,wBAAwB,KAAK,SAAS,MAAM;EACjD,SAAS;EACT,WAAW;CACb,CAAC;AACH;AAEA,eAAsB,aACpB,SACA,UAAU,0BACV,YACA;CACA,aAAa,gBAAgB,QAAQ;CAErC,MAAM,UAAU,MAAM,cAAc,OAAO;CAO3C,OAAO,IAAI,iBAAgC,SAAS,MANjC,oBAAoB,KAAoB,SAAS;EAClE,MAAM,QAAQ;EACd;EACA;CACF,CAAC,CAEuD;AAC1D"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { n as EngineOptions } from "./config-C9AD-erz.mjs";
|
|
2
2
|
import { n as EngineExecutionItem, t as EngineContext } from "./context-S3XH2DWP.mjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { FrameworkOptions, InlineConfig, LogFn, LoggerOptions } from "@powerlines/core";
|
|
5
4
|
import { PowerlinesBaseContext } from "@powerlines/core/context/base-context";
|
|
6
5
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
@@ -18,7 +17,7 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
|
|
|
18
17
|
* @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
|
|
19
18
|
*/
|
|
20
19
|
static from<TSystemContext = unknown>(options: EngineOptions, host: DevToolsHost, connection: ConnectionMeta): Promise<PowerlinesEngineContext<TSystemContext>>;
|
|
21
|
-
createLogger(options?: LoggerOptions, logFn?: LogFn):
|
|
20
|
+
createLogger(options?: LoggerOptions, logFn?: LogFn): import("@powerlines/core").Logger;
|
|
22
21
|
get executions(): EngineExecutionItem[];
|
|
23
22
|
get devtools(): DevToolsNodeContext;
|
|
24
23
|
get envPaths(): EnvPaths;
|
|
@@ -51,4 +50,4 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
|
|
|
51
50
|
}
|
|
52
51
|
//#endregion
|
|
53
52
|
export { PowerlinesEngineContext as t };
|
|
54
|
-
//# sourceMappingURL=engine-context-
|
|
53
|
+
//# sourceMappingURL=engine-context-Cc93ql_I.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-context-Cc93ql_I.d.mts","names":[],"sources":["../src/context/engine-context.ts"],"mappings":";;;;;;;;cAmDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,0BAAA,CAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,CAAA,GAAc,mBAAA;EAAA,IAId,QAAA,CAAA,GAAY,mBAAA;EAAA,IAIZ,QAAA,CAAA,GAAY,QAAA;EAAA,IAQZ,SAAA,CAAA,GAAa,gBAAA;EAAA,IAQb,KAAA,CAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,MAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EAwNlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { n as EngineOptions } from "./config-D6xUniHh.cjs";
|
|
2
2
|
import { n as EngineExecutionItem, t as EngineContext } from "./context-epL7NPvL.cjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { FrameworkOptions, InlineConfig, LogFn, LoggerOptions } from "@powerlines/core";
|
|
5
4
|
import { ConnectionMeta, DevToolsHost, DevToolsNodeContext } from "devframe/types";
|
|
6
5
|
import { PowerlinesBaseContext } from "@powerlines/core/context/base-context";
|
|
@@ -18,7 +17,7 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
|
|
|
18
17
|
* @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
|
|
19
18
|
*/
|
|
20
19
|
static from<TSystemContext = unknown>(options: EngineOptions, host: DevToolsHost, connection: ConnectionMeta): Promise<PowerlinesEngineContext<TSystemContext>>;
|
|
21
|
-
createLogger(options?: LoggerOptions, logFn?: LogFn):
|
|
20
|
+
createLogger(options?: LoggerOptions, logFn?: LogFn): import("@powerlines/core").Logger;
|
|
22
21
|
get executions(): EngineExecutionItem[];
|
|
23
22
|
get devtools(): DevToolsNodeContext;
|
|
24
23
|
get envPaths(): EnvPaths;
|
|
@@ -51,4 +50,4 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
|
|
|
51
50
|
}
|
|
52
51
|
//#endregion
|
|
53
52
|
export { PowerlinesEngineContext as t };
|
|
54
|
-
//# sourceMappingURL=engine-context-
|
|
53
|
+
//# sourceMappingURL=engine-context-lrWc13AH.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-context-lrWc13AH.d.cts","names":[],"sources":["../src/context/engine-context.ts"],"mappings":";;;;;;;;cAmDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,0BAAA,CAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,CAAA,GAAc,mBAAA;EAAA,IAId,QAAA,CAAA,GAAY,mBAAA;EAAA,IAIZ,QAAA,CAAA,GAAY,QAAA;EAAA,IAQZ,SAAA,CAAA,GAAa,gBAAA;EAAA,IAQb,KAAA,CAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,MAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EAwNlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
|
|
@@ -66,6 +66,9 @@ function getNodeDebugType(nodeOptions) {
|
|
|
66
66
|
if (nodeOptions["inspect-brk"] || nodeOptions.inspect_brk) return "inspect-brk";
|
|
67
67
|
}
|
|
68
68
|
var ExecutionHostWorker = class ExecutionHostWorker {
|
|
69
|
+
executionHostPath;
|
|
70
|
+
exposedMethods;
|
|
71
|
+
options;
|
|
69
72
|
#worker;
|
|
70
73
|
/**
|
|
71
74
|
* Creates a new instance of the ExecutionHostWorker class, which manages a worker process for executing tasks related to the Powerlines Engine. The worker is initialized with the specified options and can be used to run tasks in an isolated environment, with support for automatic restarts and activity monitoring.
|
|
@@ -80,7 +83,11 @@ var ExecutionHostWorker = class ExecutionHostWorker {
|
|
|
80
83
|
if (!resolvedPath) throw new Error(`Could not resolve the provided Execution Host path: \`${apiPath}\`.`);
|
|
81
84
|
let exposedMethods = (0, _stryke_convert_to_array.toArray)(options.apiMethods ?? []);
|
|
82
85
|
if (exposedMethods.length === 0) {
|
|
83
|
-
const jiti$1 = (0, jiti.createJiti)(require("url").pathToFileURL(__filename).href
|
|
86
|
+
const jiti$1 = (0, jiti.createJiti)(require("url").pathToFileURL(__filename).href, {
|
|
87
|
+
cache: false,
|
|
88
|
+
interopDefault: true,
|
|
89
|
+
tsconfigPaths: true
|
|
90
|
+
});
|
|
84
91
|
const mod = await jiti$1.import(jiti$1.esmResolve(resolvedPath));
|
|
85
92
|
if ((0, _stryke_type_checks_is_function.isFunction)(mod)) exposedMethods.push(...exposedMethods, "default");
|
|
86
93
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(mod)) exposedMethods = Object.keys(mod).filter((name) => (0, _stryke_type_checks_is_function.isFunction)(mod[name]));
|
package/dist/engine.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_engine = require('./engine-
|
|
2
|
+
const require_engine = require('./engine-ntih8wNh.cjs');
|
|
3
3
|
|
|
4
4
|
exports.PowerlinesEngine = require_engine.PowerlinesEngine;
|
|
5
5
|
exports.createContext = require_engine.createContext;
|
package/dist/engine.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as EngineOptions } from "./config-D6xUniHh.cjs";
|
|
2
2
|
import { t as EngineContext } from "./context-epL7NPvL.cjs";
|
|
3
3
|
import { n as ExecutionHost, t as Engine } from "./api-DgxYwNuZ.cjs";
|
|
4
|
-
import { t as PowerlinesEngineContext } from "./engine-context-
|
|
4
|
+
import { t as PowerlinesEngineContext } from "./engine-context-lrWc13AH.cjs";
|
|
5
5
|
import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
6
6
|
import { EXECUTION_API_METHODS } from "@powerlines/core/constants";
|
|
7
7
|
|
package/dist/engine.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.cts","names":[],"sources":["../src/engine.ts"],"mappings":";;;;;;;;;;AA+CA;;;cAAa,gBAAA,uBACW,aAAA,kBAA+B,qBAAA,aAE1C,MAAA,CAAO,aAAA,GAAgB,eAAA;EAAA;EAAhB;;;EAAA,IAeP,OAAA,CAAA,GAAW,aAAA;EAmBX;;;EAAA,IAZA,IAAA,CAAA,GAAQ,aAAA,CAAc,aAAA;EA4BmB;;;;;;;cAhBlD,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,aAAA,CAAc,aAAA;EAsF0B;;;;;;;;;EAvEnC,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA+KlB;;;;;;;;EA7JrB,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAtElD;;;;;;;;EAwFa,OAAA,CAAQ,YAAA,EAAc,mBAAA,GAAmB,OAAA;EAhE3C;;;;;;;;;EAmFE,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAvDhB;;;;;;EAuErB,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAnCnC;;;;;;;;;EAsDA,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAnB9B;;;;;;;;;EAsCL,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAgBrC;;;;;;EAAA,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAmBI;;;;;;;;;EAAvC,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA+ClD
|
|
1
|
+
{"version":3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AAa,OAAA,CAAA,uBAAA;AAAA,iBAuBpC,YAAA,uBAAmC,aAAA,SAAA,CACvD,OAAA,EAAS,aAAA,EACT,OAAA,WACA,UAAA,GAAa,aAAA,GAAa,OAAA,CAAA,gBAAA,CAAA,aAAA"}
|
package/dist/engine.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as EngineOptions } from "./config-C9AD-erz.mjs";
|
|
2
2
|
import { t as EngineContext } from "./context-S3XH2DWP.mjs";
|
|
3
3
|
import { n as ExecutionHost, t as Engine } from "./api-B2dWvRMM.mjs";
|
|
4
|
-
import { t as PowerlinesEngineContext } from "./engine-context-
|
|
4
|
+
import { t as PowerlinesEngineContext } from "./engine-context-Cc93ql_I.mjs";
|
|
5
5
|
import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
6
6
|
import { EXECUTION_API_METHODS } from "@powerlines/core/constants";
|
|
7
7
|
|
package/dist/engine.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.mts","names":[],"sources":["../src/engine.ts"],"mappings":";;;;;;;;;;AA+CA;;;cAAa,gBAAA,uBACW,aAAA,kBAA+B,qBAAA,aAE1C,MAAA,CAAO,aAAA,GAAgB,eAAA;EAAA;EAAhB;;;EAAA,IAeP,OAAA,CAAA,GAAW,aAAA;EAmBX;;;EAAA,IAZA,IAAA,CAAA,GAAQ,aAAA,CAAc,aAAA;EA4BmB;;;;;;;cAhBlD,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,aAAA,CAAc,aAAA;EAsF0B;;;;;;;;;EAvEnC,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA+KlB;;;;;;;;EA7JrB,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAtElD;;;;;;;;EAwFa,OAA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B;;;;;;;;;EAsCL,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAgBrC;;;;;;EAAA,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAmBI;;;;;;;;;EAAvC,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA+ClD;;;AAA0B;AA+B9B;;;;EA5De,QAAA,CAAA,GAAQ,OAAA;EA4DmC;;;EAAA,CA/C1C,MAAA,CAAO,YAAA,KAAa,OAAA;EA+CA;;;;AAAsB;AAuB1D;;;;;EAvBoC,UAjClB,OAAA,CACd,MAAA,EAAQ,aAAA,UACR,YAAA,EAAc,YAAA,GAAY,OAAA;AAAA;AAAA,iBA+BR,aAAA,CAAc,OAAA,EAAS,aAAA,GAAa,OAAA,CAAA,uBAAA;AAAA,iBAuBpC,YAAA,uBAAmC,aAAA,SAAA,CACvD,OAAA,EAAS,aAAA,EACT,OAAA,WACA,UAAA,GAAa,aAAA,GAAa,OAAA,CAAA,gBAAA,CAAA,aAAA"}
|
package/dist/engine.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-execution-host.mjs","names":[],"sources":["../../src/helpers/create-execution-host.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 ExecutionContext,\n InlineConfig,\n LogFnMeta\n} from \"@powerlines/core\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { consoleLogger } from \"@powerlines/core/plugin-utils\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial, MaybePromise } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { defu } from \"defu\";\nimport type { RpcClient } from \"../types\";\nimport type { ExecutionHostParams } from \"../types/api\";\nimport type { EngineResolvedConfig } from \"../types/config\";\nimport type { EngineSystemContext } from \"../types/context\";\nimport { createRpcClient } from \"./rpc\";\nimport { MessagePortDuplex } from \"./stream\";\n\n/**\n * Creates an execution host with the provided methods. Each method will be wrapped to create an execution context and handle errors appropriately.\n *\n * @param methods - An object where keys are method names and values are functions that take an execution context and return a promise.\n * @param inlineConfig - An optional partial inline configuration object that will be merged with the context's options when creating the execution context for each method.\n * @returns An object with the same keys as the input methods, but each function is wrapped to create an execution context and handle errors.\n */\nexport function createExecutionHost<\n TContext extends ExecutionContext<EngineResolvedConfig, EngineSystemContext> =\n ExecutionContext<EngineResolvedConfig, EngineSystemContext>\n>(\n methods: Record<string, (context: TContext) => Promise<void>>,\n inlineConfig:\n | DeepPartial<InlineConfig>\n | ((prev: InlineConfig) => MaybePromise<InlineConfig>) = {}\n) {\n return Object.fromEntries(\n Object.entries(methods).map(([method, fn]) => [\n method,\n async (params: ExecutionHostParams) => {\n const { options, port } = params;\n\n const duplex = new MessagePortDuplex(port);\n duplex.setEncoding(\"utf8\");\n duplex.on(\"data\", (chunk: string) => duplex.write(chunk.toUpperCase()));\n duplex.on(\"end\", () => {\n duplex.end();\n });\n\n let rpc!: RpcClient;\n if (options.baseURL && options.connection) {\n rpc = createRpcClient(options);\n } else {\n throw new Error(\n `Execution RPC client could not be created - Missing ${\n !options.baseURL\n ? `baseURL${options.connection ? ` and connection information` : \"\"}`\n : \"connection\"\n } or connection information.`\n );\n }\n\n const logFn = (meta: LogFnMeta, message: string) => {\n consoleLogger(meta, message);\n if (rpc) {\n void rpc.callEvent(\"powerlines:log\", {\n meta: {\n category: \"general\",\n ...options,\n ...(isSetObject(meta) ? meta : { type: meta }),\n logId: uuid(),\n timestamp: Date.now()\n },\n message\n });\n }\n };\n\n const context = (await PowerlinesExecutionContext.from<\n EngineResolvedConfig,\n EngineSystemContext\n >(\n { ...options, logFn },\n isFunction(inlineConfig)\n ? await Promise.resolve(inlineConfig(params.inlineConfig ?? {}))\n : (defu(inlineConfig, params.inlineConfig ?? {}) as InlineConfig),\n {\n rpc\n }\n )) as TContext;\n\n context.logger.info(\n `Starting ${\n titleCase(options.framework?.name) || \"Powerlines\"\n } - ${titleCase(method)} execution (${options.executionId})`\n );\n\n await resolvePluginConfig<EngineResolvedConfig, EngineSystemContext>(\n context\n );\n await fn(context);\n }\n ])\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,oBAId,SACA,eAE2D,
|
|
1
|
+
{"version":3,"file":"create-execution-host.mjs","names":[],"sources":["../../src/helpers/create-execution-host.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 ExecutionContext,\n InlineConfig,\n LogFnMeta\n} from \"@powerlines/core\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { consoleLogger } from \"@powerlines/core/plugin-utils\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial, MaybePromise } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { defu } from \"defu\";\nimport type { RpcClient } from \"../types\";\nimport type { ExecutionHostParams } from \"../types/api\";\nimport type { EngineResolvedConfig } from \"../types/config\";\nimport type { EngineSystemContext } from \"../types/context\";\nimport { createRpcClient } from \"./rpc\";\nimport { MessagePortDuplex } from \"./stream\";\n\n/**\n * Creates an execution host with the provided methods. Each method will be wrapped to create an execution context and handle errors appropriately.\n *\n * @param methods - An object where keys are method names and values are functions that take an execution context and return a promise.\n * @param inlineConfig - An optional partial inline configuration object that will be merged with the context's options when creating the execution context for each method.\n * @returns An object with the same keys as the input methods, but each function is wrapped to create an execution context and handle errors.\n */\nexport function createExecutionHost<\n TContext extends ExecutionContext<EngineResolvedConfig, EngineSystemContext> =\n ExecutionContext<EngineResolvedConfig, EngineSystemContext>\n>(\n methods: Record<string, (context: TContext) => Promise<void>>,\n inlineConfig:\n | DeepPartial<InlineConfig>\n | ((prev: InlineConfig) => MaybePromise<InlineConfig>) = {}\n) {\n return Object.fromEntries(\n Object.entries(methods).map(([method, fn]) => [\n method,\n async (params: ExecutionHostParams) => {\n const { options, port } = params;\n\n const duplex = new MessagePortDuplex(port);\n duplex.setEncoding(\"utf8\");\n duplex.on(\"data\", (chunk: string) => duplex.write(chunk.toUpperCase()));\n duplex.on(\"end\", () => {\n duplex.end();\n });\n\n let rpc!: RpcClient;\n if (options.baseURL && options.connection) {\n rpc = createRpcClient(options);\n } else {\n throw new Error(\n `Execution RPC client could not be created - Missing ${\n !options.baseURL\n ? `baseURL${options.connection ? ` and connection information` : \"\"}`\n : \"connection\"\n } or connection information.`\n );\n }\n\n const logFn = (meta: LogFnMeta, message: string) => {\n consoleLogger(meta, message);\n if (rpc) {\n void rpc.callEvent(\"powerlines:log\", {\n meta: {\n category: \"general\",\n ...options,\n ...(isSetObject(meta) ? meta : { type: meta }),\n logId: uuid(),\n timestamp: Date.now()\n },\n message\n });\n }\n };\n\n const context = (await PowerlinesExecutionContext.from<\n EngineResolvedConfig,\n EngineSystemContext\n >(\n { ...options, logFn },\n isFunction(inlineConfig)\n ? await Promise.resolve(inlineConfig(params.inlineConfig ?? {}))\n : (defu(inlineConfig, params.inlineConfig ?? {}) as InlineConfig),\n {\n rpc\n }\n )) as TContext;\n\n context.logger.info(\n `Starting ${\n titleCase(options.framework?.name) || \"Powerlines\"\n } - ${titleCase(method)} execution (${options.executionId})`\n );\n\n await resolvePluginConfig<EngineResolvedConfig, EngineSystemContext>(\n context\n );\n await fn(context);\n }\n ])\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,oBAId,SACA,eAE2D,CAAC,GAC5D;CACA,OAAO,OAAO,YACZ,OAAO,QAAQ,OAAO,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAC5C,QACA,OAAO,WAAgC;EACrC,MAAM,EAAE,SAAS,SAAS;EAE1B,MAAM,SAAS,IAAI,kBAAkB,IAAI;EACzC,OAAO,YAAY,MAAM;EACzB,OAAO,GAAG,SAAS,UAAkB,OAAO,MAAM,MAAM,YAAY,CAAC,CAAC;EACtE,OAAO,GAAG,aAAa;GACrB,OAAO,IAAI;EACb,CAAC;EAED,IAAI;EACJ,IAAI,QAAQ,WAAW,QAAQ,YAC7B,MAAM,gBAAgB,OAAO;OAE7B,MAAM,IAAI,MACR,uDACE,CAAC,QAAQ,UACL,UAAU,QAAQ,aAAa,gCAAgC,OAC/D,aACL,4BACH;EAGF,MAAM,SAAS,MAAiB,YAAoB;GAClD,cAAc,MAAM,OAAO;GAC3B,IAAI,KACF,AAAK,IAAI,UAAU,kBAAkB;IACnC,MAAM;KACJ,UAAU;KACV,GAAG;KACH,GAAI,YAAY,IAAI,IAAI,OAAO,EAAE,MAAM,KAAK;KAC5C,OAAO,KAAK;KACZ,WAAW,KAAK,IAAI;IACtB;IACA;GACF,CAAC;EAEL;EAEA,MAAM,UAAW,MAAM,2BAA2B,KAIhD;GAAE,GAAG;GAAS;EAAM,GACpB,WAAW,YAAY,IACnB,MAAM,QAAQ,QAAQ,aAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAC5D,KAAK,cAAc,OAAO,gBAAgB,CAAC,CAAC,GACjD,EACE,IACF,CACF;EAEA,QAAQ,OAAO,KACb,YACE,UAAU,QAAQ,WAAW,IAAI,KAAK,aACvC,KAAK,UAAU,MAAM,EAAE,cAAc,QAAQ,YAAY,EAC5D;EAEA,MAAM,oBACJ,OACF;EACA,MAAM,GAAG,OAAO;CAClB,CACF,CAAC,CACH;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize.mjs","names":[],"sources":["../../src/helpers/finalize.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 { ExecutionContext, ResolvedConfig } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { callHook } from \"@powerlines/core/lib/hooks\";\nimport { removeDirectory } from \"@stryke/fs/helpers\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { existsSync } from \"node:fs\";\n\n/**\n * Finalize the execution context by disposing resources and cleaning up.\n *\n * @param context - The execution context to finalize\n */\nexport async function finalize<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: ExecutionContext<TResolvedConfig>) {\n const timer = context.timer(\"Finalization\");\n\n await executeEnvironments(context, async env => {\n await callHook(context, \"finalize\", { environment: env });\n await env.fs.dispose();\n\n if (\n existsSync(env.cachePath) &&\n !(await listFiles(joinPaths(env.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(env.cachePath);\n }\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,eAAsB,SAEpB,SAA4C;CAC5C,MAAM,QAAQ,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"finalize.mjs","names":[],"sources":["../../src/helpers/finalize.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 { ExecutionContext, ResolvedConfig } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { callHook } from \"@powerlines/core/lib/hooks\";\nimport { removeDirectory } from \"@stryke/fs/helpers\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { existsSync } from \"node:fs\";\n\n/**\n * Finalize the execution context by disposing resources and cleaning up.\n *\n * @param context - The execution context to finalize\n */\nexport async function finalize<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: ExecutionContext<TResolvedConfig>) {\n const timer = context.timer(\"Finalization\");\n\n await executeEnvironments(context, async env => {\n await callHook(context, \"finalize\", { environment: env });\n await env.fs.dispose();\n\n if (\n existsSync(env.cachePath) &&\n !(await listFiles(joinPaths(env.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(env.cachePath);\n }\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,eAAsB,SAEpB,SAA4C;CAC5C,MAAM,QAAQ,QAAQ,MAAM,cAAc;CAE1C,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,SAAS,SAAS,YAAY,EAAE,aAAa,IAAI,CAAC;EACxD,MAAM,IAAI,GAAG,QAAQ;EAErB,IACE,WAAW,IAAI,SAAS,KACxB,EAAE,MAAM,UAAU,UAAU,IAAI,WAAW,MAAM,CAAC,IAAI,QAEtD,MAAM,gBAAgB,IAAI,SAAS;CAEvC,CAAC;CAED,MAAM;AACR"}
|
package/dist/helpers/rpc.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.mjs","names":["createDevframeRpcClient"],"sources":["../../src/helpers/rpc.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 { createEventEmitter } from \"@powerlines/core/lib/events\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { StormURL } from \"@stryke/url\";\nimport { BirpcOptions } from \"birpc\";\nimport {\n createRpcStreamingClientHost,\n DevToolsClientRpcHost,\n DevToolsRpcClientMode,\n RpcClientEvents\n} from \"devframe/client\";\nimport { RpcCacheManager, RpcFunctionsCollectorBase } from \"devframe/rpc\";\nimport { createRpcClient as createDevframeRpcClient } from \"devframe/rpc/client\";\nimport {\n createWsRpcChannel,\n WsRpcChannelOptions\n} from \"devframe/rpc/transports/ws-client\";\nimport {\n ConnectionMeta,\n EventEmitter as DevFrameEventEmitter\n} from \"devframe/types\";\nimport { promiseWithResolver } from \"devframe/utils/promise\";\nimport { humanId } from \"human-id\";\nimport { EventEmitter } from \"node:events\";\nimport { RpcClientOptions } from \"../types/config\";\nimport {\n RpcClient,\n RpcClientFunctions,\n RpcContext,\n RpcServerFunctions\n} from \"../types/rpc\";\n\nfunction createWsRpcClientMode(\n baseURL: StormURL,\n connectionMeta: ConnectionMeta,\n events: DevFrameEventEmitter<RpcClientEvents>,\n clientRpc: DevToolsClientRpcHost,\n authToken: string = humanId({ separator: \"-\", capitalize: false }),\n rpcOptions: Partial<\n BirpcOptions<RpcServerFunctions, RpcClientFunctions, boolean>\n > = {},\n wsOptions: Partial<WsRpcChannelOptions> = {}\n): DevToolsRpcClientMode {\n let isTrusted = false;\n const trustedPromise = promiseWithResolver<boolean>();\n const url =\n isNumber(connectionMeta.websocket) ||\n (isSet(connectionMeta.websocket) &&\n `${+connectionMeta.websocket}` === `${connectionMeta.websocket}`)\n ? `${baseURL.protocol.replace(\"http\", \"ws\")}//${baseURL.hostname}:${connectionMeta.websocket}`\n : (connectionMeta.websocket as string);\n\n // Build a minimal `defs` map from the connection meta so the per-call\n // wire serializer dispatches outgoing requests with the correct\n // encoding (JSON for `jsonSerializable: true` methods; structured-\n // clone for the rest).\n const definitions = new Map<string, { jsonSerializable: true }>();\n for (const name of connectionMeta.jsonSerializableMethods ?? [])\n definitions.set(name, { jsonSerializable: true });\n\n const serverRpc = createDevframeRpcClient<\n RpcServerFunctions,\n RpcClientFunctions\n >(clientRpc.functions, {\n channel: createWsRpcChannel({\n url,\n authToken,\n definitions,\n ...wsOptions\n }),\n rpcOptions\n });\n\n // Handle server-initiated auth revocation\n clientRpc.register({\n name: \"devframe:auth:revoked\",\n type: \"event\",\n handler: () => {\n isTrusted = false;\n events.emit(\"rpc:is-trusted:updated\", false);\n }\n });\n\n let currentAuthToken = authToken;\n\n async function requestTrustWithToken(token: string) {\n currentAuthToken = token;\n\n // const info = parseUA(navigator.userAgent);\n // const ua = [\n // \"powerlines\",\n // \"1.0\",\n // \"|\",\n // info.os.name,\n // info.os.version,\n // info.device.type\n // ]\n // .filter(i => i)\n // .join(\" \");\n\n // const result = await serverRpc.$call(\"vite:anonymous:auth\", {\n // authToken: token,\n // ua,\n // origin: baseURL.origin\n // });\n\n // isTrusted = result.isTrusted;\n // trustedPromise.resolve(isTrusted);\n // events.emit(\"rpc:is-trusted:updated\", isTrusted);\n // return result.isTrusted;\n\n return true;\n }\n\n async function requestTrust() {\n if (isTrusted) return true;\n return requestTrustWithToken(currentAuthToken);\n }\n\n async function ensureTrusted(timeout = 60_000): Promise<boolean> {\n if (isTrusted) trustedPromise.resolve(true);\n\n if (timeout <= 0) return trustedPromise.promise;\n\n let clear = () => {};\n await Promise.race([\n trustedPromise.promise.then(clear),\n new Promise((resolve, reject) => {\n const id = setTimeout(() => {\n reject(new Error(\"Timeout waiting for rpc to be trusted\"));\n }, timeout);\n clear = () => clearTimeout(id);\n })\n ]);\n\n return isTrusted;\n }\n\n return {\n get isTrusted() {\n return isTrusted;\n },\n requestTrust,\n requestTrustWithToken,\n ensureTrusted,\n call: (...args: any): any => {\n return serverRpc.$call(\n // @ts-expect-error casting\n ...args\n );\n },\n callEvent: (...args: any): any => {\n return serverRpc.$callEvent(\n // @ts-expect-error casting\n ...args\n );\n },\n callOptional: (...args: any): any => {\n return serverRpc.$callOptional(\n // @ts-expect-error casting\n ...args\n );\n }\n };\n}\n\nconst CONNECTION_AUTH_TOKEN_KEY = \"__DEVTOOLS_CONNECTION_AUTH_TOKEN__\";\n\nexport function createRpcClient(options: RpcClientOptions) {\n const baseURL = new StormURL(options.baseURL);\n\n const cacheManager = new RpcCacheManager({\n functions: [],\n ...(typeof options.cacheOptions === \"object\" ? options.cacheOptions : {})\n });\n const context: RpcContext = {\n rpc: undefined!\n };\n\n const clientRpc: DevToolsClientRpcHost = new RpcFunctionsCollectorBase<\n RpcClientFunctions,\n RpcContext\n >(context);\n\n EventEmitter.setMaxListeners(100);\n const events = createEventEmitter<RpcClientEvents>();\n\n const mode = createWsRpcClientMode(\n baseURL,\n options.connection,\n events,\n clientRpc,\n undefined,\n {\n ...options.rpcOptions,\n async onRequest(req, next, resolve) {\n await options.rpcOptions?.onRequest?.call(this, req, next, resolve);\n if (options.cacheOptions && cacheManager?.validate(req.m)) {\n const cached = cacheManager.cached(req.m, req.a);\n if (cached) {\n return resolve(cached);\n } else {\n const res = await next(req);\n cacheManager?.apply(req, res);\n }\n } else {\n await next(req);\n }\n }\n },\n options.wsOptions\n );\n\n const rpc: RpcClient = {\n events,\n get isTrusted() {\n return mode.isTrusted;\n },\n connectionMeta: options.connection,\n ensureTrusted: mode.ensureTrusted,\n requestTrust: mode.requestTrust,\n requestTrustWithToken: async (token: string) => {\n // Update stored token for future reconnections\n localStorage.setItem(CONNECTION_AUTH_TOKEN_KEY, token);\n (globalThis as any)[CONNECTION_AUTH_TOKEN_KEY] = token;\n return mode.requestTrustWithToken(token);\n },\n call: mode.call,\n callEvent: mode.callEvent,\n callOptional: mode.callOptional,\n client: clientRpc,\n sharedState: undefined!,\n streaming: undefined!,\n cacheManager\n };\n\n // rpc.sharedState = createRpcSharedStateClientHost(rpc);\n rpc.streaming = createRpcStreamingClientHost(rpc);\n\n // @ts-expect-error assign to readonly property\n context.rpc = rpc;\n void mode.requestTrust();\n\n // Listen for auth updates from other tabs (e.g., auth URL page)\n try {\n const bc = new BroadcastChannel(\"vite-devtools-auth\");\n bc.onmessage = event => {\n if (event.data?.type === \"auth-update\" && event.data.authToken) {\n void rpc.requestTrustWithToken(event.data.authToken);\n }\n };\n } catch {\n // BroadcastChannel is not supported in all environments, so we can safely ignore errors here\n }\n\n return rpc;\n}\n"],"mappings":";;;;;;;;;;;;;AAkDA,SAAS,sBACP,SACA,gBACA,QACA,WACA,YAAoB,QAAQ;CAAE,WAAW;CAAK,YAAY;CAAO,CAAC,EAClE,aAEI,EAAE,EACN,YAA0C,EAAE,EACrB;CACvB,IAAI,YAAY;CAChB,MAAM,iBAAiB,qBAA8B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AA6B,IAAI;AAGjD,SAAQ,MAAM;AACd,CAAK,KAAK,cAAc;AAGxB,KAAI;EACF,MAAM,KAAK,IAAI,iBAAiB,qBAAqB;AACrD,KAAG,aAAY,UAAS;AACtB,OAAI,MAAM,MAAM,SAAS,iBAAiB,MAAM,KAAK,UACnD,CAAK,IAAI,sBAAsB,MAAM,KAAK,UAAU;;SAGlD;AAIR,QAAO"}
|
|
1
|
+
{"version":3,"file":"rpc.mjs","names":["createDevframeRpcClient"],"sources":["../../src/helpers/rpc.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 { createEventEmitter } from \"@powerlines/core/lib/events\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { StormURL } from \"@stryke/url\";\nimport { BirpcOptions } from \"birpc\";\nimport {\n createRpcStreamingClientHost,\n DevToolsClientRpcHost,\n DevToolsRpcClientMode,\n RpcClientEvents\n} from \"devframe/client\";\nimport { RpcCacheManager, RpcFunctionsCollectorBase } from \"devframe/rpc\";\nimport { createRpcClient as createDevframeRpcClient } from \"devframe/rpc/client\";\nimport {\n createWsRpcChannel,\n WsRpcChannelOptions\n} from \"devframe/rpc/transports/ws-client\";\nimport {\n ConnectionMeta,\n EventEmitter as DevFrameEventEmitter\n} from \"devframe/types\";\nimport { promiseWithResolver } from \"devframe/utils/promise\";\nimport { humanId } from \"human-id\";\nimport { EventEmitter } from \"node:events\";\nimport { RpcClientOptions } from \"../types/config\";\nimport {\n RpcClient,\n RpcClientFunctions,\n RpcContext,\n RpcServerFunctions\n} from \"../types/rpc\";\n\nfunction createWsRpcClientMode(\n baseURL: StormURL,\n connectionMeta: ConnectionMeta,\n events: DevFrameEventEmitter<RpcClientEvents>,\n clientRpc: DevToolsClientRpcHost,\n authToken: string = humanId({ separator: \"-\", capitalize: false }),\n rpcOptions: Partial<\n BirpcOptions<RpcServerFunctions, RpcClientFunctions, boolean>\n > = {},\n wsOptions: Partial<WsRpcChannelOptions> = {}\n): DevToolsRpcClientMode {\n let isTrusted = false;\n const trustedPromise = promiseWithResolver<boolean>();\n const url =\n isNumber(connectionMeta.websocket) ||\n (isSet(connectionMeta.websocket) &&\n `${+connectionMeta.websocket}` === `${connectionMeta.websocket}`)\n ? `${baseURL.protocol.replace(\"http\", \"ws\")}//${baseURL.hostname}:${connectionMeta.websocket}`\n : (connectionMeta.websocket as string);\n\n // Build a minimal `defs` map from the connection meta so the per-call\n // wire serializer dispatches outgoing requests with the correct\n // encoding (JSON for `jsonSerializable: true` methods; structured-\n // clone for the rest).\n const definitions = new Map<string, { jsonSerializable: true }>();\n for (const name of connectionMeta.jsonSerializableMethods ?? [])\n definitions.set(name, { jsonSerializable: true });\n\n const serverRpc = createDevframeRpcClient<\n RpcServerFunctions,\n RpcClientFunctions\n >(clientRpc.functions, {\n channel: createWsRpcChannel({\n url,\n authToken,\n definitions,\n ...wsOptions\n }),\n rpcOptions\n });\n\n // Handle server-initiated auth revocation\n clientRpc.register({\n name: \"devframe:auth:revoked\",\n type: \"event\",\n handler: () => {\n isTrusted = false;\n events.emit(\"rpc:is-trusted:updated\", false);\n }\n });\n\n let currentAuthToken = authToken;\n\n async function requestTrustWithToken(token: string) {\n currentAuthToken = token;\n\n // const info = parseUA(navigator.userAgent);\n // const ua = [\n // \"powerlines\",\n // \"1.0\",\n // \"|\",\n // info.os.name,\n // info.os.version,\n // info.device.type\n // ]\n // .filter(i => i)\n // .join(\" \");\n\n // const result = await serverRpc.$call(\"vite:anonymous:auth\", {\n // authToken: token,\n // ua,\n // origin: baseURL.origin\n // });\n\n // isTrusted = result.isTrusted;\n // trustedPromise.resolve(isTrusted);\n // events.emit(\"rpc:is-trusted:updated\", isTrusted);\n // return result.isTrusted;\n\n return true;\n }\n\n async function requestTrust() {\n if (isTrusted) return true;\n return requestTrustWithToken(currentAuthToken);\n }\n\n async function ensureTrusted(timeout = 60_000): Promise<boolean> {\n if (isTrusted) trustedPromise.resolve(true);\n\n if (timeout <= 0) return trustedPromise.promise;\n\n let clear = () => {};\n await Promise.race([\n trustedPromise.promise.then(clear),\n new Promise((resolve, reject) => {\n const id = setTimeout(() => {\n reject(new Error(\"Timeout waiting for rpc to be trusted\"));\n }, timeout);\n clear = () => clearTimeout(id);\n })\n ]);\n\n return isTrusted;\n }\n\n return {\n get isTrusted() {\n return isTrusted;\n },\n requestTrust,\n requestTrustWithToken,\n ensureTrusted,\n call: (...args: any): any => {\n return serverRpc.$call(\n // @ts-expect-error casting\n ...args\n );\n },\n callEvent: (...args: any): any => {\n return serverRpc.$callEvent(\n // @ts-expect-error casting\n ...args\n );\n },\n callOptional: (...args: any): any => {\n return serverRpc.$callOptional(\n // @ts-expect-error casting\n ...args\n );\n }\n };\n}\n\nconst CONNECTION_AUTH_TOKEN_KEY = \"__DEVTOOLS_CONNECTION_AUTH_TOKEN__\";\n\nexport function createRpcClient(options: RpcClientOptions) {\n const baseURL = new StormURL(options.baseURL);\n\n const cacheManager = new RpcCacheManager({\n functions: [],\n ...(typeof options.cacheOptions === \"object\" ? options.cacheOptions : {})\n });\n const context: RpcContext = {\n rpc: undefined!\n };\n\n const clientRpc: DevToolsClientRpcHost = new RpcFunctionsCollectorBase<\n RpcClientFunctions,\n RpcContext\n >(context);\n\n EventEmitter.setMaxListeners(100);\n const events = createEventEmitter<RpcClientEvents>();\n\n const mode = createWsRpcClientMode(\n baseURL,\n options.connection,\n events,\n clientRpc,\n undefined,\n {\n ...options.rpcOptions,\n async onRequest(req, next, resolve) {\n await options.rpcOptions?.onRequest?.call(this, req, next, resolve);\n if (options.cacheOptions && cacheManager?.validate(req.m)) {\n const cached = cacheManager.cached(req.m, req.a);\n if (cached) {\n return resolve(cached);\n } else {\n const res = await next(req);\n cacheManager?.apply(req, res);\n }\n } else {\n await next(req);\n }\n }\n },\n options.wsOptions\n );\n\n const rpc: RpcClient = {\n events,\n get isTrusted() {\n return mode.isTrusted;\n },\n connectionMeta: options.connection,\n ensureTrusted: mode.ensureTrusted,\n requestTrust: mode.requestTrust,\n requestTrustWithToken: async (token: string) => {\n // Update stored token for future reconnections\n localStorage.setItem(CONNECTION_AUTH_TOKEN_KEY, token);\n (globalThis as any)[CONNECTION_AUTH_TOKEN_KEY] = token;\n return mode.requestTrustWithToken(token);\n },\n call: mode.call,\n callEvent: mode.callEvent,\n callOptional: mode.callOptional,\n client: clientRpc,\n sharedState: undefined!,\n streaming: undefined!,\n cacheManager\n };\n\n // rpc.sharedState = createRpcSharedStateClientHost(rpc);\n rpc.streaming = createRpcStreamingClientHost(rpc);\n\n // @ts-expect-error assign to readonly property\n context.rpc = rpc;\n void mode.requestTrust();\n\n // Listen for auth updates from other tabs (e.g., auth URL page)\n try {\n const bc = new BroadcastChannel(\"vite-devtools-auth\");\n bc.onmessage = event => {\n if (event.data?.type === \"auth-update\" && event.data.authToken) {\n void rpc.requestTrustWithToken(event.data.authToken);\n }\n };\n } catch {\n // BroadcastChannel is not supported in all environments, so we can safely ignore errors here\n }\n\n return rpc;\n}\n"],"mappings":";;;;;;;;;;;;;AAkDA,SAAS,sBACP,SACA,gBACA,QACA,WACA,YAAoB,QAAQ;CAAE,WAAW;CAAK,YAAY;AAAM,CAAC,GACjE,aAEI,CAAC,GACL,YAA0C,CAAC,GACpB;CACvB,IAAI,YAAY;CAChB,MAAM,iBAAiB,oBAA6B;CACpD,MAAM,MACJ,SAAS,eAAe,SAAS,KAChC,MAAM,eAAe,SAAS,KAC7B,GAAG,CAAC,eAAe,gBAAgB,GAAG,eAAe,cACnD,GAAG,QAAQ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AM,KAAK,IAAI,iBAAiB,oBAAoB;EACpD,GAAG,aAAY,UAAS;GACtB,IAAI,MAAM,MAAM,SAAS,iBAAiB,MAAM,KAAK,WACnD,AAAK,IAAI,sBAAsB,MAAM,KAAK,SAAS;EAEvD;CACF,QAAQ,CAER;CAEA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.cts","names":[],"sources":["../../src/helpers/stream.ts"],"mappings":";;;;cA0BM,KAAA;AAAA,UAMI,WAAA;EACR,KAAA;EACA,QAAA,EAAU,
|
|
1
|
+
{"version":3,"file":"stream.d.cts","names":[],"sources":["../../src/helpers/stream.ts"],"mappings":";;;;cA0BM,KAAA;AAAA,UAMI,WAAA;EACR,KAAA;EACA,QAAA,EAAU,cAAc;AAAA;AAAA,cAeb,mBAAA,SAA4B,QAAA;EAAA,SAC9B,KAAA;cAEU,IAAA,EAAM,WAAA,EAAa,OAAA,GAAU,eAAA;EAKhC,MAAA,CACd,KAAA,WACA,SAAA,EAAW,cAAA,EACX,QAAA,GAAW,KAAA,GAAQ,KAAA;EAOL,OAAA,CACd,IAAA,EAAM,WAAA,IACN,QAAA,GAAW,KAAA,GAAQ,KAAA;EAWL,MAAA,CAAO,QAAA,GAAW,KAAA,GAAQ,KAAA;EAK1B,QAAA,CACd,KAAA,EAAO,KAAA,SACP,QAAA,GAAW,KAAA,GAAQ,KAAA;EAKd,KAAA,CAAA;EAKA,GAAA,CAAA;AAAA;AAAA,cAMI,mBAAA,SAA4B,QAAA;EAAA,SAC9B,KAAA;cAEU,IAAA,EAAM,WAAA,EAAa,OAAA,GAAU,eAAA;EAQhC,KAAA,CAAM,KAAA;EAIN,QAAA,CACd,KAAA,EAAO,KAAA,SACP,QAAA,GAAW,KAAA,GAAQ,KAAA;EAQd,KAAA,CAAA;EAKA,GAAA,CAAA;AAAA;AAAA,UAMQ,wBAAA,SAAiC,aAAa;EAC7D,eAAe;AAAA;AAAA,cAGJ,iBAAA,SAA0B,MAAA;EAAA,SAC5B,KAAA;EAAA,QAED,qBAAA;cAEW,IAAA,EAAM,WAAA,EAAa,OAAA,GAAU,wBAAA;EAUhC,KAAA,CAAM,KAAA;EAIN,MAAA,CACd,KAAA,WACA,SAAA,EAAW,cAAA,EACX,QAAA,GAAW,KAAA,GAAQ,KAAA;EAUL,OAAA,CACd,IAAA,EAAM,WAAA,IACN,QAAA,GAAW,KAAA,GAAQ,KAAA;EAWL,MAAA,CAAO,QAAA,GAAW,KAAA,GAAQ,KAAA;EAK1B,QAAA,CACd,KAAA,EAAO,KAAA,SACP,QAAA,GAAW,KAAA,GAAQ,KAAA;EAQd,KAAA,CAAA;EAKA,GAAA,CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.mts","names":[],"sources":["../../src/helpers/stream.ts"],"mappings":";;;;cA0BM,KAAA;AAAA,UAMI,WAAA;EACR,KAAA;EACA,QAAA,EAAU,
|
|
1
|
+
{"version":3,"file":"stream.d.mts","names":[],"sources":["../../src/helpers/stream.ts"],"mappings":";;;;cA0BM,KAAA;AAAA,UAMI,WAAA;EACR,KAAA;EACA,QAAA,EAAU,cAAc;AAAA;AAAA,cAeb,mBAAA,SAA4B,QAAA;EAAA,SAC9B,KAAA;cAEU,IAAA,EAAM,WAAA,EAAa,OAAA,GAAU,eAAA;EAKhC,MAAA,CACd,KAAA,WACA,SAAA,EAAW,cAAA,EACX,QAAA,GAAW,KAAA,GAAQ,KAAA;EAOL,OAAA,CACd,IAAA,EAAM,WAAA,IACN,QAAA,GAAW,KAAA,GAAQ,KAAA;EAWL,MAAA,CAAO,QAAA,GAAW,KAAA,GAAQ,KAAA;EAK1B,QAAA,CACd,KAAA,EAAO,KAAA,SACP,QAAA,GAAW,KAAA,GAAQ,KAAA;EAKd,KAAA,CAAA;EAKA,GAAA,CAAA;AAAA;AAAA,cAMI,mBAAA,SAA4B,QAAA;EAAA,SAC9B,KAAA;cAEU,IAAA,EAAM,WAAA,EAAa,OAAA,GAAU,eAAA;EAQhC,KAAA,CAAM,KAAA;EAIN,QAAA,CACd,KAAA,EAAO,KAAA,SACP,QAAA,GAAW,KAAA,GAAQ,KAAA;EAQd,KAAA,CAAA;EAKA,GAAA,CAAA;AAAA;AAAA,UAMQ,wBAAA,SAAiC,aAAa;EAC7D,eAAe;AAAA;AAAA,cAGJ,iBAAA,SAA0B,MAAA;EAAA,SAC5B,KAAA;EAAA,QAED,qBAAA;cAEW,IAAA,EAAM,WAAA,EAAa,OAAA,GAAU,wBAAA;EAUhC,KAAA,CAAM,KAAA;EAIN,MAAA,CACd,KAAA,WACA,SAAA,EAAW,cAAA,EACX,QAAA,GAAW,KAAA,GAAQ,KAAA;EAUL,OAAA,CACd,IAAA,EAAM,WAAA,IACN,QAAA,GAAW,KAAA,GAAQ,KAAA;EAWL,MAAA,CAAO,QAAA,GAAW,KAAA,GAAQ,KAAA;EAK1B,QAAA,CACd,KAAA,EAAO,KAAA,SACP,QAAA,GAAW,KAAA,GAAQ,KAAA;EAQd,KAAA,CAAA;EAKA,GAAA,CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.mjs","names":[],"sources":["../../src/helpers/stream.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 DuplexOptions,\n ReadableOptions,\n WritableOptions\n} from \"node:stream\";\nimport { Duplex, Readable, Writable } from \"node:stream\";\nimport type { MessagePort, Transferable } from \"node:worker_threads\";\n\nconst kPort = Symbol(\"kPort\");\n\ntype PortLike = MessagePort & {\n close: (callback?: () => void) => void;\n};\n\ninterface WritevChunk {\n chunk: unknown;\n encoding: BufferEncoding;\n}\n\nfunction toTransferable(chunk: unknown): Transferable | undefined {\n if (ArrayBuffer.isView(chunk)) {\n return chunk.buffer instanceof ArrayBuffer ? chunk.buffer : undefined;\n }\n\n if (chunk instanceof ArrayBuffer) {\n return chunk;\n }\n\n return undefined;\n}\n\nexport class MessagePortWritable extends Writable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: WritableOptions) {\n super(options);\n this[kPort] = port;\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => callback(error));\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport class MessagePortReadable extends Readable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: ReadableOptions) {\n super(options);\n this[kPort] = port;\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport interface MessagePortDuplexOptions extends DuplexOptions {\n onActivityAbort?: () => void;\n}\n\nexport class MessagePortDuplex extends Duplex {\n private [kPort]: PortLike;\n\n private _activityAbortHandler?: () => void;\n\n public constructor(port: MessagePort, options?: MessagePortDuplexOptions) {\n super(options);\n this[kPort] = port;\n this._activityAbortHandler = options?.onActivityAbort;\n\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n if (this._activityAbortHandler) {\n this._activityAbortHandler();\n }\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n"],"mappings":";;;AA0BA,MAAM,QAAQ,OAAO,
|
|
1
|
+
{"version":3,"file":"stream.mjs","names":[],"sources":["../../src/helpers/stream.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 DuplexOptions,\n ReadableOptions,\n WritableOptions\n} from \"node:stream\";\nimport { Duplex, Readable, Writable } from \"node:stream\";\nimport type { MessagePort, Transferable } from \"node:worker_threads\";\n\nconst kPort = Symbol(\"kPort\");\n\ntype PortLike = MessagePort & {\n close: (callback?: () => void) => void;\n};\n\ninterface WritevChunk {\n chunk: unknown;\n encoding: BufferEncoding;\n}\n\nfunction toTransferable(chunk: unknown): Transferable | undefined {\n if (ArrayBuffer.isView(chunk)) {\n return chunk.buffer instanceof ArrayBuffer ? chunk.buffer : undefined;\n }\n\n if (chunk instanceof ArrayBuffer) {\n return chunk;\n }\n\n return undefined;\n}\n\nexport class MessagePortWritable extends Writable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: WritableOptions) {\n super(options);\n this[kPort] = port;\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => callback(error));\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport class MessagePortReadable extends Readable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: ReadableOptions) {\n super(options);\n this[kPort] = port;\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport interface MessagePortDuplexOptions extends DuplexOptions {\n onActivityAbort?: () => void;\n}\n\nexport class MessagePortDuplex extends Duplex {\n private [kPort]: PortLike;\n\n private _activityAbortHandler?: () => void;\n\n public constructor(port: MessagePort, options?: MessagePortDuplexOptions) {\n super(options);\n this[kPort] = port;\n this._activityAbortHandler = options?.onActivityAbort;\n\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n if (this._activityAbortHandler) {\n this._activityAbortHandler();\n }\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n"],"mappings":";;;AA0BA,MAAM,QAAQ,OAAO,OAAO;AAW5B,SAAS,eAAe,OAA0C;CAChE,IAAI,YAAY,OAAO,KAAK,GAC1B,OAAO,MAAM,kBAAkB,cAAc,MAAM,SAAS;CAG9D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AAO,IAAI;EAChB,OAAO;CACT;AACF;AAMA,IAAa,oBAAb,cAAuC,OAAO;CAC5C,CAAS;CAET,AAAQ;CAER,AAAO,YAAY,MAAmB,SAAoC;EACxE,MAAM,OAAO;EACb,KAAK,SAAS;EACd,KAAK,wBAAwB,SAAS;EAEtC,KAAK,aAAa,EAAE,WAAW;GAC7B,KAAK,KAAK,IAAI;EAChB;CACF;CAEA,AAAgB,MAAM,OAAqB;EACzC,KAAK,OAAO,MAAM;CACpB;CAEA,AAAgB,OACd,OACA,WACA,UACM;EACN,IAAI,KAAK,uBACP,KAAK,sBAAsB;EAE7B,MAAM,WAAW,eAAe,KAAK;EACrC,KAAK,OAAO,YAAY,OAAO,WAAW,CAAC,QAAQ,IAAI,CAAC,CAAC;EACzD,SAAS;CACX;CAEA,AAAgB,QACd,MACA,UACM;EACN,MAAM,SAAS,KAAK,KAAI,UAAS,MAAM,KAAK;EAC5C,MAAM,YAAY,KACf,KAAI,UAAS,eAAe,MAAM,KAAK,CAAC,EACxC,QAAQ,UAAiC,QAAQ,KAAK,CAAC;EAE1D,KAAK,OAAO,YAAY,QAAQ,SAAS;EACzC,SAAS;CACX;CAEA,AAAgB,OAAO,UAAgD;EACrE,KAAK,OAAO,YAAY,IAAI;EAC5B,SAAS;CACX;CAEA,AAAgB,SACd,OACA,UACM;EACN,KAAK,OAAO,YAAY;GACtB,KAAK,OAAO,YAAY;GACxB,SAAS,KAAK;EAChB,CAAC;CACH;CAEA,AAAO,QAAc;EACnB,KAAK,OAAO,MAAM;EAClB,OAAO;CACT;CAEA,AAAO,MAAY;EACjB,KAAK,OAAO,IAAI;EAChB,OAAO;CACT;AACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_engine = require('./engine-
|
|
2
|
+
const require_engine = require('./engine-ntih8wNh.cjs');
|
|
3
3
|
const require_context_engine_context = require('./context/engine-context.cjs');
|
|
4
4
|
require('./context/index.cjs');
|
|
5
5
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as RpcServerFunctions, D as WrappedRpcFunctions, E as WrappedRpcFunction, S as RpcPayloadMetadata, T as WrapRpcFunctions, _ as RpcClientRemoteFunctions, a as ExtractRpcFunction, b as RpcFunctions, c as InputRpcFunctions, d as RpcClientCall, f as RpcClientCallEvent, g as RpcClientHost, h as RpcClientFunctions, i as RpcClientOptions, l as LogPayload, m as RpcClientEvents, n as EngineOptions, o as ExtractRpcFunctions, p as RpcClientCallOptional, r as EngineResolvedConfig, s as InputRpcFunction, t as EngineExecutionOptions, u as RpcClient, v as RpcContext, w as WrapRpcFunction, x as RpcPayloadEnvelop, y as RpcFunction } from "./config-D6xUniHh.cjs";
|
|
2
2
|
import { a as ExecutionHookScopeState, c as ExecutionScopeType, i as ExecutionCommandScopeState, l as ExecutionState, n as EngineExecutionItem, o as ExecutionPluginScopeState, r as EngineSystemContext, s as ExecutionScopeState, t as EngineContext } from "./context-epL7NPvL.cjs";
|
|
3
3
|
import { a as PowerlinesExecutionHost, i as ExecutionInterface, n as ExecutionHost, o as Worker, r as ExecutionHostParams, t as Engine } from "./api-DgxYwNuZ.cjs";
|
|
4
|
-
import { t as PowerlinesEngineContext } from "./engine-context-
|
|
4
|
+
import { t as PowerlinesEngineContext } from "./engine-context-lrWc13AH.cjs";
|
|
5
5
|
import { PowerlinesEngine, createContext, createEngine } from "./engine.cjs";
|
|
6
|
-
export { Engine, EngineContext, EngineExecutionItem, EngineExecutionOptions, EngineOptions, EngineResolvedConfig, EngineSystemContext, ExecutionCommandScopeState, ExecutionHookScopeState, ExecutionHost, ExecutionHostParams, ExecutionInterface, ExecutionPluginScopeState, ExecutionScopeState, ExecutionScopeType, ExecutionState, ExtractRpcFunction, ExtractRpcFunctions, InputRpcFunction, InputRpcFunctions, LogPayload, PowerlinesEngine, PowerlinesEngineContext, PowerlinesExecutionHost, RpcClient, RpcClientCall, RpcClientCallEvent, RpcClientCallOptional, RpcClientEvents, RpcClientFunctions, RpcClientHost, RpcClientOptions, RpcClientRemoteFunctions, RpcContext, RpcFunction, RpcFunctions, RpcPayloadEnvelop, RpcPayloadMetadata, RpcServerFunctions, Worker, WrapRpcFunction, WrapRpcFunctions, WrappedRpcFunction, WrappedRpcFunctions, createContext, createEngine };
|
|
6
|
+
export { type Engine, type EngineContext, type EngineExecutionItem, type EngineExecutionOptions, type EngineOptions, type EngineResolvedConfig, type EngineSystemContext, type ExecutionCommandScopeState, type ExecutionHookScopeState, type ExecutionHost, type ExecutionHostParams, type ExecutionInterface, type ExecutionPluginScopeState, type ExecutionScopeState, type ExecutionScopeType, type ExecutionState, type ExtractRpcFunction, type ExtractRpcFunctions, type InputRpcFunction, type InputRpcFunctions, type LogPayload, PowerlinesEngine, PowerlinesEngineContext, type PowerlinesExecutionHost, type RpcClient, type RpcClientCall, type RpcClientCallEvent, type RpcClientCallOptional, type RpcClientEvents, type RpcClientFunctions, type RpcClientHost, type RpcClientOptions, type RpcClientRemoteFunctions, type RpcContext, type RpcFunction, type RpcFunctions, type RpcPayloadEnvelop, type RpcPayloadMetadata, type RpcServerFunctions, type Worker, type WrapRpcFunction, type WrapRpcFunctions, type WrappedRpcFunction, type WrappedRpcFunctions, createContext, createEngine };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as RpcServerFunctions, D as WrappedRpcFunctions, E as WrappedRpcFunction, S as RpcPayloadMetadata, T as WrapRpcFunctions, _ as RpcClientRemoteFunctions, a as ExtractRpcFunction, b as RpcFunctions, c as InputRpcFunctions, d as RpcClientCall, f as RpcClientCallEvent, g as RpcClientHost, h as RpcClientFunctions, i as RpcClientOptions, l as LogPayload, m as RpcClientEvents, n as EngineOptions, o as ExtractRpcFunctions, p as RpcClientCallOptional, r as EngineResolvedConfig, s as InputRpcFunction, t as EngineExecutionOptions, u as RpcClient, v as RpcContext, w as WrapRpcFunction, x as RpcPayloadEnvelop, y as RpcFunction } from "./config-C9AD-erz.mjs";
|
|
2
2
|
import { a as ExecutionHookScopeState, c as ExecutionScopeType, i as ExecutionCommandScopeState, l as ExecutionState, n as EngineExecutionItem, o as ExecutionPluginScopeState, r as EngineSystemContext, s as ExecutionScopeState, t as EngineContext } from "./context-S3XH2DWP.mjs";
|
|
3
3
|
import { a as PowerlinesExecutionHost, i as ExecutionInterface, n as ExecutionHost, o as Worker, r as ExecutionHostParams, t as Engine } from "./api-B2dWvRMM.mjs";
|
|
4
|
-
import { t as PowerlinesEngineContext } from "./engine-context-
|
|
4
|
+
import { t as PowerlinesEngineContext } from "./engine-context-Cc93ql_I.mjs";
|
|
5
5
|
import { PowerlinesEngine, createContext, createEngine } from "./engine.mjs";
|
|
6
|
-
export { Engine, EngineContext, EngineExecutionItem, EngineExecutionOptions, EngineOptions, EngineResolvedConfig, EngineSystemContext, ExecutionCommandScopeState, ExecutionHookScopeState, ExecutionHost, ExecutionHostParams, ExecutionInterface, ExecutionPluginScopeState, ExecutionScopeState, ExecutionScopeType, ExecutionState, ExtractRpcFunction, ExtractRpcFunctions, InputRpcFunction, InputRpcFunctions, LogPayload, PowerlinesEngine, PowerlinesEngineContext, PowerlinesExecutionHost, RpcClient, RpcClientCall, RpcClientCallEvent, RpcClientCallOptional, RpcClientEvents, RpcClientFunctions, RpcClientHost, RpcClientOptions, RpcClientRemoteFunctions, RpcContext, RpcFunction, RpcFunctions, RpcPayloadEnvelop, RpcPayloadMetadata, RpcServerFunctions, Worker, WrapRpcFunction, WrapRpcFunctions, WrappedRpcFunction, WrappedRpcFunctions, createContext, createEngine };
|
|
6
|
+
export { type Engine, type EngineContext, type EngineExecutionItem, type EngineExecutionOptions, type EngineOptions, type EngineResolvedConfig, type EngineSystemContext, type ExecutionCommandScopeState, type ExecutionHookScopeState, type ExecutionHost, type ExecutionHostParams, type ExecutionInterface, type ExecutionPluginScopeState, type ExecutionScopeState, type ExecutionScopeType, type ExecutionState, type ExtractRpcFunction, type ExtractRpcFunctions, type InputRpcFunction, type InputRpcFunctions, type LogPayload, PowerlinesEngine, PowerlinesEngineContext, type PowerlinesExecutionHost, type RpcClient, type RpcClientCall, type RpcClientCallEvent, type RpcClientCallOptional, type RpcClientEvents, type RpcClientFunctions, type RpcClientHost, type RpcClientOptions, type RpcClientRemoteFunctions, type RpcContext, type RpcFunction, type RpcFunctions, type RpcPayloadEnvelop, type RpcPayloadMetadata, type RpcServerFunctions, type Worker, type WrapRpcFunction, type WrapRpcFunctions, type WrappedRpcFunction, type WrappedRpcFunctions, createContext, createEngine };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-
|
|
1
|
+
import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-Ct0OGdyp.mjs";
|
|
2
2
|
import { PowerlinesEngineContext } from "./context/engine-context.mjs";
|
|
3
3
|
import "./context/index.mjs";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/engine",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An internal package containing the core engine modules for Powerlines.",
|
|
6
6
|
"homepage": "https://stormsoftware.com",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"types": "./dist/index.d.cts",
|
|
117
117
|
"files": ["dist"],
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@powerlines/core": "^0.15.
|
|
119
|
+
"@powerlines/core": "^0.15.19",
|
|
120
120
|
"@storm-software/config": "^1.137.52",
|
|
121
121
|
"@storm-software/config-tools": "^1.190.20",
|
|
122
122
|
"@stryke/async": "^0.1.5",
|
|
@@ -153,5 +153,5 @@
|
|
|
153
153
|
"@types/node": "^25.8.0",
|
|
154
154
|
"typescript": "^6.0.3"
|
|
155
155
|
},
|
|
156
|
-
"gitHead": "
|
|
156
|
+
"gitHead": "b5c7361d0ca942652f98baf11488435c7918fd65"
|
|
157
157
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"engine-DELjWFmN.mjs","names":["#worker","#context","#host"],"sources":["../src/_internal/execution-host-worker.ts","../src/engine.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 { InlineConfig, Mode } from \"@powerlines/core\";\nimport { getDefaultMode } from \"@powerlines/core/lib/config\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolve } from \"@stryke/fs/resolve\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport { formatDuration } from \"date-fns/formatDuration\";\nimport { createJiti } from \"jiti\";\nimport { pipeline } from \"node:stream\";\nimport { parseArgs } from \"node:util\";\nimport {\n MessageChannel,\n StructuredSerializeOptions\n} from \"node:worker_threads\";\nimport Piscina from \"piscina\";\nimport { MessagePortDuplex } from \"../helpers/stream\";\nimport { ExecutionHost } from \"../types/api\";\nimport { EngineExecutionOptions } from \"../types/config\";\nimport { EngineContext } from \"../types/context\";\n\nconst RESTARTED = Symbol(\"powerlines-worker:restarted\");\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ninterface DebugAddress {\n host?: string;\n port: number;\n}\n\n/**\n * Formats the debug address into a string.\n */\nconst formatDebugAddress = ({ host, port }: DebugAddress): string => {\n return host ? `${host}:${port}` : `${port}`;\n};\n\nexport type NodeOptions = Record<string, string | boolean | undefined>;\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nconst getParsedDebugAddress = (\n address: string | boolean | undefined\n): DebugAddress => {\n if (!address || !isString(address)) {\n return { host: undefined, port: 9229 };\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(\":\")) {\n const [host, port] = address.split(\":\");\n if (!host || !port) {\n throw new Error(`Invalid debug address: ${address}`);\n }\n\n return { host, port: Number.parseInt(port, 10) };\n }\n\n return { host: undefined, port: Number.parseInt(address, 10) };\n};\n\ntype NodeInspectType = \"inspect\" | \"inspect-brk\" | undefined;\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nfunction getNodeDebugType(nodeOptions: NodeOptions): NodeInspectType {\n if (nodeOptions.inspect) {\n return \"inspect\";\n }\n if (nodeOptions[\"inspect-brk\"] || nodeOptions.inspect_brk) {\n return \"inspect-brk\";\n }\n\n return undefined;\n}\n\nexport interface ExecutionHostWorkerOptions<\n TExecutionAPI extends ReadonlyArray<string>\n> {\n // /**\n // * `-1` if not inspectable\n // */\n // debuggerPortOffset?: number;\n\n // /**\n // * Whether to enable source maps support in the worker, which can improve the quality of stack traces at the cost of increased memory usage and slower performance. Defaults to `false`.\n // */\n // enableSourceMaps?: boolean;\n\n /**\n * The maximum time in milliseconds a worker can run before being terminated.\n *\n * @defaultValue 900000 (15 minutes)\n */\n timeout?: number;\n\n /**\n * True if `--max-old-space-size` should not be forwarded to the worker.\n */\n isolatedMemory?: boolean;\n\n /**\n * The mode to run the worker in, which can affect how the worker is initialized and how it behaves. This is determined based on the resolved configuration of the engine, and can be used to optimize the worker for different environments (e.g., development, production, etc.).\n */\n mode?: Mode;\n\n /**\n * An optional root to resolve the execution host path from, which can be used to specify a custom root directory for the worker to use when resolving paths and loading configuration files. If this option is not provided, the worker will use the current working directory as the root directory by default.\n */\n root?: string;\n\n /**\n * The context of the {@link @powerlines/engine#Engine | Engine instance}, which can be used to access the engine's state and services within the worker.\n */\n context: EngineContext;\n\n /**\n * An array of method names that the worker exposes. These methods will be available on the Worker instance and can be called to execute tasks in the worker process.\n */\n apiMethods?: TExecutionAPI;\n}\n\nexport class ExecutionHostWorker<TExecutionAPI extends ReadonlyArray<string>> {\n #worker: Piscina | undefined;\n\n /**\n * Creates a new instance of the ExecutionHostWorker class, which manages a worker process for executing tasks related to the Powerlines Engine. The worker is initialized with the specified options and can be used to run tasks in an isolated environment, with support for automatic restarts and activity monitoring.\n *\n * @param apiPath - The path to the Execution Host file.\n * @param options - The options for configuring the worker, including the execution context, exposed methods, timeout, and mode.\n * @returns A promise that resolves to an instance of the ExecutionHostWorker class.\n */\n public static async from<TExecutionAPI extends ReadonlyArray<string>>(\n apiPath: string,\n options: ExecutionHostWorkerOptions<TExecutionAPI>\n ) {\n const mode = await getDefaultMode(options.context.cwd);\n\n const resolvedPath = await resolve(apiPath, {\n paths: [\n options.context.cwd,\n options.root ? appendPath(options.root, options.context.cwd) : undefined\n ].filter(Boolean) as string[]\n });\n if (!resolvedPath) {\n throw new Error(\n `Could not resolve the provided Execution Host path: \\`${apiPath}\\`.`\n );\n }\n\n let exposedMethods = toArray((options.apiMethods ?? []) as string[]);\n if (exposedMethods.length === 0) {\n const jiti = createJiti(import.meta.url);\n const mod: Record<string, AnyFunction> = await jiti.import(\n jiti.esmResolve(resolvedPath)\n );\n if (isFunction(mod)) {\n exposedMethods.push(...exposedMethods, \"default\");\n } else if (isSetObject(mod)) {\n exposedMethods = Object.keys(mod).filter(name => isFunction(mod[name]));\n }\n }\n\n return new ExecutionHostWorker<TExecutionAPI>(\n resolvedPath,\n exposedMethods,\n {\n mode,\n ...options\n }\n ) as unknown as ExecutionHost<TExecutionAPI>;\n }\n\n /**\n * Create a new worker instance.\n *\n * @param executionHostPath - The path to the worker file.\n * @param exposedMethods - An array of method names that the worker exposes.\n * @param options - The options for the worker, including exposed methods, timeout, and hooks for activity and restart.\n */\n public constructor(\n protected executionHostPath: string,\n protected exposedMethods: string[],\n protected options: ExecutionHostWorkerOptions<TExecutionAPI>\n ) {\n const {\n timeout = 900_000,\n isolatedMemory = false,\n mode = \"production\",\n context\n } = this.options;\n\n const logger = context.extendLogger({ category: \"communication\" });\n\n let restartPromise: Promise<typeof RESTARTED>;\n let resolveRestartPromise: (arg: typeof RESTARTED) => void;\n let activeTasks = 0;\n\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n void this.finalize();\n });\n\n let nodeOptions = {} as {\n [longOption: string]: string | boolean | undefined;\n };\n\n const args: string[] = [...process.execArgv];\n if (process.env.NODE_OPTIONS) {\n let isInString = false;\n let willStartNewArg = true;\n\n const stringifiedNodeOptions = process.env.NODE_OPTIONS.split(\" \").filter(\n part =>\n ((part.startsWith('\"') && part.endsWith('\"')) ||\n (part.startsWith(\"'\") && part.endsWith(\"'\"))) &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString).length > 0 &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString)\n .every(p => p.startsWith(\"--\"))\n );\n args.push(\n ...stringifiedNodeOptions.map(part => part.replace(/^['\"]|['\"]$/g, \"\"))\n );\n\n const inputNodeModules = stringifiedNodeOptions.reduce((acc, part) => {\n return acc.replace(part, \"\").trim();\n }, process.env.NODE_OPTIONS);\n for (let i = 0; i < inputNodeModules.length; i++) {\n let char = inputNodeModules[i];\n if (char) {\n // Skip any escaped characters in strings.\n if (char === \"\\\\\" && isInString) {\n // Ensure we don't have an escape character at the end.\n if (inputNodeModules.length === i + 1) {\n throw new Error(\"Invalid escape character at the end.\");\n }\n\n // Skip the next character.\n char = inputNodeModules[++i];\n if (!char) {\n continue;\n }\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === \" \" && !isInString) {\n willStartNewArg = true;\n continue;\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString;\n continue;\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char);\n willStartNewArg = false;\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char;\n }\n }\n }\n\n if (isInString) {\n throw new Error(\"Unterminated string\");\n }\n }\n\n if (args.length > 0) {\n const { values, tokens } = parseArgs({\n args,\n strict: false,\n tokens: true\n });\n nodeOptions = values;\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (!token) continue;\n\n if (token.kind === \"option-terminator\") {\n break;\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === \"option\") {\n orphan = !isSet(token.value) ? token : null;\n continue;\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== \"positional\") {\n orphan = null;\n continue;\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue;\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in nodeOptions && isString(nodeOptions[orphan.name])) {\n nodeOptions[orphan.name] += ` ${token.value}`;\n } else {\n nodeOptions[orphan.name] = token.value;\n }\n }\n }\n\n const originalOptions = { ...nodeOptions };\n\n delete nodeOptions.inspect;\n delete nodeOptions[\"inspect-brk\"];\n delete nodeOptions.inspect_brk;\n\n if (mode === \"development\") {\n const nodeDebugType = getNodeDebugType(originalOptions);\n if (nodeDebugType) {\n const debuggerAddress = getParsedDebugAddress(\n originalOptions[nodeDebugType]\n );\n const address: DebugAddress = {\n host: debuggerAddress.host,\n // current process runs on `address.port`\n port: debuggerAddress.port === 0 ? 0 : debuggerAddress.port + 1 + 1\n };\n nodeOptions[nodeDebugType] = formatDebugAddress(address);\n }\n\n nodeOptions[\"enable-source-maps\"] = true;\n }\n\n if (isolatedMemory) {\n delete nodeOptions[\"max-old-space-size\"];\n delete nodeOptions.max_old_space_size;\n }\n\n const execArgv: string[] = [];\n const nodeOptionsParts: string[] = [];\n for (const [key, value] of Object.entries(nodeOptions)) {\n let formatted: string | null = null;\n if (value === true) {\n formatted = `--${key}`;\n } else if (value) {\n formatted = `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(\" \") && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`;\n }\n\n if (formatted === null) {\n continue;\n }\n\n if (\n [\n \"experimental-network-inspection\",\n \"experimental-storage-inspection\",\n \"experimental-worker-inspection\",\n \"experimental-inspector-network-resource\"\n ].includes(key)\n ) {\n execArgv.push(formatted);\n } else {\n nodeOptionsParts.push(formatted);\n }\n }\n\n const onHanging = () => {\n if (!this.#worker) {\n return;\n }\n\n const resolve = resolveRestartPromise;\n // eslint-disable-next-line ts/no-use-before-define\n createWorker();\n\n logger.warn(\n `Sending SIGTERM signal to worker due to timeout${\n timeout ? ` of ${formatDuration({ seconds: timeout / 1000 })}` : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void this.finalize().then(() => {\n resolve(RESTARTED);\n });\n };\n\n let hangingTimer: NodeJS.Timeout | false = false;\n\n const onActivity = () => {\n if (hangingTimer) {\n clearTimeout(hangingTimer);\n }\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);\n };\n\n const createWorker = () => {\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n NODE_ENV: mode,\n NODE_OPTIONS: nodeOptionsParts.join(\" \"),\n POWERLINES_EXECUTION_HOST_WORKER: \"true\"\n };\n\n if (env.FORCE_COLOR === undefined) {\n // Mirror the enablement heuristic from picocolors (see https://github.com/vercel/next.js/blob/6a40da0345939fe4f7b1ae519b296a86dd103432/packages/next/src/lib/picocolors.ts#L21-L24).\n // Picocolors snapshots `process.env`/`stdout.isTTY` at module load time, so when the worker\n // process bootstraps with piped stdio its own check would disable colors. Re-evaluating the\n // same conditions here lets us opt the worker into color output only when the parent would\n // have seen colors, while still respecting explicit opt-outs like NO_COLOR.\n const supportsColors =\n !env.NO_COLOR &&\n !env.CI &&\n env.TERM !== \"dumb\" &&\n (process.stdout.isTTY || process.stderr?.isTTY);\n\n if (supportsColors) {\n env.FORCE_COLOR = \"1\";\n }\n }\n\n this.#worker = new Piscina({\n filename: executionHostPath,\n execArgv,\n env\n });\n\n restartPromise = new Promise(resolve => {\n resolveRestartPromise = resolve;\n });\n\n this.#worker.on(\"exit\", (code, signal) => {\n logger.debug(\n `Worker process exited with code ${code} and signal ${signal}`\n );\n\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n const error = new Error(\n `Execution Host Worker exited unexpectedly with code ${\n code\n } and signal ${signal}`\n );\n logger.error(error);\n\n void this.finalize().then(() => {\n throw error;\n });\n }\n });\n\n this.#worker.on(\"error\", error => {\n logger.error({\n meta: { category: \"communication\" },\n message: `Worker process emitted an error: ${error.message}`,\n error\n });\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n this.#worker.on(\"message\", data => {\n onActivity();\n\n if (Array.isArray(data) && data.length > 1 && isNumber(data[0])) {\n if (data[0] === 0) {\n logger.trace(\n `Received message from worker: ${JSON.stringify(data.slice(1), null, 2)}`\n );\n } else {\n logger.debug(\n `Received error message from worker: ${JSON.stringify(\n data.slice(1),\n null,\n 2\n )}`\n );\n }\n }\n\n logger.trace(\n `Received message from worker: ${JSON.stringify(data, null, 2)}`\n );\n });\n };\n\n createWorker();\n\n for (const method of this.exposedMethods) {\n if (method.startsWith(\"_\")) {\n continue;\n }\n\n const callWorker = async (\n options: EngineExecutionOptions,\n inlineConfig: InlineConfig\n ) => {\n if (!this.#worker) {\n throw new Error(\"Execution Host Worker is not initialized\");\n }\n\n const { port1, port2 } = new MessageChannel();\n const promise = this.#worker.run(\n { options, inlineConfig, port: port2 },\n {\n name: method,\n transferList: [port2] as StructuredSerializeOptions\n }\n );\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n aborted = true;\n }\n };\n const duplex = new MessagePortDuplex(port1, { onActivityAbort });\n\n pipeline(\n duplex,\n process.stdout,\n (err: NodeJS.ErrnoException | null) => {\n if (err) {\n logger.debug(\n `Received exception message from worker: ${JSON.stringify(\n err,\n null,\n 2\n )}`\n );\n\n throw err;\n }\n }\n );\n\n await promise;\n };\n\n (this as any)[method] = timeout\n ? async (\n options: EngineExecutionOptions,\n inlineConfig: InlineConfig\n ) => {\n activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n onActivity();\n\n const result = await Promise.race([\n callWorker(options, inlineConfig),\n restartPromise\n ]);\n if (result !== RESTARTED) {\n return result;\n }\n\n logger.warn(\n `Execution Host Worker was restarted while calling method \"${\n method\n }\" (attempt ${attempts++}). Retrying the call...`\n );\n }\n } finally {\n activeTasks--;\n onActivity();\n }\n }\n : callWorker.bind(this);\n }\n }\n\n /**\n * Closes the worker process, terminating it if it's still running. This method should be called when the worker is no longer needed, to free up system resources and ensure a clean shutdown. If the worker has already been terminated, this method will have no effect.\n */\n public async finalize(): Promise<void> {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n await worker.close({\n force: true\n });\n this.#worker = undefined;\n }\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 BuildInlineConfig,\n CleanInlineConfig,\n CreateInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n InlineConfig,\n LintInlineConfig,\n PrepareInlineConfig,\n TestInlineConfig,\n TypesInlineConfig\n} from \"@powerlines/core\";\nimport { EXECUTION_API_METHODS } from \"@powerlines/core/constants\";\nimport { createH3DevToolsHost } from \"devframe/node\";\nimport { getPort } from \"get-port-please\";\nimport { createApp, fromNodeMiddleware } from \"h3\";\nimport { EventEmitter } from \"node:events\";\nimport sirv from \"sirv\";\nimport { ExecutionHostWorker } from \"./_internal/execution-host-worker\";\nimport { PowerlinesEngineContext } from \"./context/engine-context\";\nimport { Engine, ExecutionHost } from \"./types/api\";\nimport { EngineOptions } from \"./types/config\";\nimport { EngineContext } from \"./types/context\";\n\n/**\n * The Powerlines process' orchestration and coordination API.\n *\n * @public\n */\nexport class PowerlinesEngine<\n TExecutionAPI extends ReadonlyArray<string> = typeof EXECUTION_API_METHODS\n>\n implements Engine<TExecutionAPI>, AsyncDisposable\n{\n /**\n * The Powerlines context\n */\n #context: EngineContext;\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n #host: ExecutionHost<TExecutionAPI>;\n\n /**\n * The Powerlines context\n */\n public get context(): EngineContext {\n return this.#context;\n }\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n public get host(): ExecutionHost<TExecutionAPI> {\n return this.#host;\n }\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param context - The Powerlines context\n * @param host - The API host for the execution workers\n * @returns A new instance of the Powerlines Engine\n */\n public constructor(\n context: EngineContext,\n host: ExecutionHost<TExecutionAPI>\n ) {\n this.#context = context;\n this.#host = host;\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the create command\n * @returns A promise that resolves when the project has been created\n */\n public async create(inlineConfig: CreateInlineConfig) {\n const timer = this.context.timer(\"Create\");\n this.context.info(\"🆕 Creating a new project\");\n\n await this.execute(\"create\", inlineConfig);\n\n this.context.debug(\"✔ Create command completed successfully\");\n timer();\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(inlineConfig: TypesInlineConfig) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\"🏗️ Generating typescript declarations for the project\");\n\n await this.execute(\"types\", inlineConfig);\n\n this.context.debug(\"✔ Types generation has completed successfully\");\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(inlineConfig: PrepareInlineConfig) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\"🏗️ Preparing the project\");\n\n await this.execute(\"prepare\", inlineConfig);\n\n this.context.debug(\"✔ Preparation has completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(inlineConfig: CleanInlineConfig) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\"🧹 Cleaning the previous artifacts\");\n\n await this.execute(\"clean\", inlineConfig);\n\n this.context.debug(\"✔ Cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(inlineConfig: LintInlineConfig) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\"📝 Linting the project\");\n\n await this.execute(\"lint\", inlineConfig);\n\n this.context.debug(\"✔ Linting completed successfully\");\n timer();\n }\n\n /**\n * Test the project\n *\n * @remarks\n * This method will run the tests for the Powerlines project.\n *\n * @param inlineConfig - The inline configuration for the test command\n * @returns A promise that resolves when the test command has completed\n */\n public async test(inlineConfig: TestInlineConfig) {\n const timer = this.context.timer(\"Test\");\n this.context.info(\"🧪 Running tests for the project\");\n\n await this.execute(\"test\", inlineConfig);\n\n this.context.debug(\"✔ Testing completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(inlineConfig: BuildInlineConfig) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\"📦 Building the project\");\n\n await this.execute(\"build\", inlineConfig);\n\n this.context.debug(\"✔ Build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\"📓 Generating documentation for the project\");\n\n await this.execute(\"docs\", inlineConfig);\n\n this.context.debug(\"✔ Documentation generation completed successfully\");\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n * @returns A promise that resolves when the deploy command has completed\n */\n public async deploy(inlineConfig: DeployInlineConfig) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\"🚀 Deploying the project\");\n\n await this.execute(\"deploy\", inlineConfig);\n\n this.context.debug(\"✔ Deployment completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalize\");\n this.context.info(\"🏁 Finalization processes started\");\n\n await this.host.finalize();\n\n this.context.debug(\"✔ Finalization completed successfully\");\n timer();\n }\n\n /**\n * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.\n */\n public async [Symbol.asyncDispose]() {\n return this.finalize();\n }\n\n /**\n * Execute a Powerlines command based on the provided execution path and inline configuration, loading the necessary executions from the context and managing their lifecycle.\n *\n * @remarks\n * This method will load the executions for the specified command and inline configuration, then execute each one while managing their lifecycle, including handling their completion and any errors that may occur during execution.\n *\n * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n * @returns A promise that resolves when all executions for the specified command have completed\n */\n protected async execute(\n method: TExecutionAPI[number],\n inlineConfig: InlineConfig\n ) {\n await Promise.all(\n (await this.context.loadExecutions(method, inlineConfig)).map(\n async execution => {\n try {\n await this.host[method](execution.options, inlineConfig);\n } catch (error) {\n this.context.error(\n `Execution of method \"${method}\" failed for execution with invocation ID \"${\n execution.invocationId\n }\" and execution ID \"${execution.options.executionId}\": \\n\\n${\n error instanceof Error\n ? error.stack || error.message\n : String(error)\n }`\n );\n\n throw error;\n } finally {\n this.context.completeExecution(\n execution.invocationId,\n execution.options.executionId\n );\n }\n }\n )\n );\n }\n}\n\nexport async function createContext(options: EngineOptions) {\n const port =\n options.port ??\n (await getPort({\n host: options.host || \"localhost\",\n random: true\n }));\n\n const app = createApp();\n const host = createH3DevToolsHost({\n appName: options.framework?.name || \"powerlines\",\n origin: `http://${options.host || \"localhost\"}:${port}`,\n mount: (base, dir) => {\n app.use(base, fromNodeMiddleware(sirv(dir, { dev: true, single: true })));\n }\n });\n\n return PowerlinesEngineContext.from(options, host, {\n backend: \"websocket\",\n websocket: port\n });\n}\n\nexport async function createEngine<TExecutionAPI extends ReadonlyArray<string>>(\n options: EngineOptions,\n apiPath = \"@powerlines/engine/api\",\n apiMethods?: TExecutionAPI\n) {\n EventEmitter.setMaxListeners(Infinity);\n\n const context = await createContext(options);\n const host = await ExecutionHostWorker.from<TExecutionAPI>(apiPath, {\n root: options.root,\n context,\n apiMethods\n });\n\n return new PowerlinesEngine<TExecutionAPI>(context, host);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,YAAY,OAAO,8BAA8B;;;;AAavD,MAAM,sBAAsB,EAAE,MAAM,WAAiC;AACnE,QAAO,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG;;;;;;;;;AAYvC,MAAM,yBACJ,YACiB;AACjB,KAAI,CAAC,WAAW,CAAC,SAAS,QAAQ,CAChC,QAAO;EAAE,MAAM;EAAW,MAAM;EAAM;AAIxC,KAAI,QAAQ,SAAS,IAAI,EAAE;EACzB,MAAM,CAAC,MAAM,QAAQ,QAAQ,MAAM,IAAI;AACvC,MAAI,CAAC,QAAQ,CAAC,KACZ,OAAM,IAAI,MAAM,0BAA0B,UAAU;AAGtD,SAAO;GAAE;GAAM,MAAM,OAAO,SAAS,MAAM,GAAG;GAAE;;AAGlD,QAAO;EAAE,MAAM;EAAW,MAAM,OAAO,SAAS,SAAS,GAAG;EAAE;;;;;AAQhE,SAAS,iBAAiB,aAA2C;AACnE,KAAI,YAAY,QACd,QAAO;AAET,KAAI,YAAY,kBAAkB,YAAY,YAC5C,QAAO;;AAoDX,IAAa,sBAAb,MAAa,oBAAiE;CAC5E;;;;;;;;CASA,aAAoB,KAClB,SACA,SACA;EACA,MAAM,OAAO,MAAM,eAAe,QAAQ,QAAQ,IAAI;EAEtD,MAAM,eAAe,MAAM,QAAQ,SAAS,EAC1C,OAAO,CACL,QAAQ,QAAQ,KAChB,QAAQ,OAAO,WAAW,QAAQ,MAAM,QAAQ,QAAQ,IAAI,GAAG,OAChE,CAAC,OAA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