powerlines 0.41.6 → 0.41.7
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/README.md +14 -16
- package/dist/{api-CY668wMZ.mjs → api-6f2oVwGy.mjs} +142 -333
- package/dist/api-6f2oVwGy.mjs.map +1 -0
- package/dist/{api-GPlMYw0d.cjs → api-CFXLaAxU.cjs} +505 -722
- package/dist/astro.cjs +8 -18
- package/dist/astro.d.cts +1 -2
- package/dist/astro.d.cts.map +1 -1
- package/dist/astro.d.mts +1 -6
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +6 -16
- package/dist/astro.mjs.map +1 -1
- package/dist/{chunk-CbDLau6x.cjs → chunk-AIJqnxB6.cjs} +27 -1
- package/dist/chunk-CtajNgzt.mjs +36 -0
- package/dist/config.cjs +20 -4
- package/dist/config.d.cts +1 -2
- package/dist/config.d.mts +1 -3
- package/dist/config.mjs +11 -2
- package/dist/config.mjs.map +1 -0
- package/dist/constants.cjs +20 -20
- package/dist/constants.d.cts +1 -24
- package/dist/constants.d.mts +1 -24
- package/dist/constants.mjs +11 -3
- package/dist/constants.mjs.map +1 -0
- package/dist/context/index.cjs +4 -9
- package/dist/context/index.d.cts +56 -132
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +55 -135
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -9
- package/dist/esbuild.cjs +60 -17
- package/dist/esbuild.d.cts +5 -29
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts +5 -33
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs +44 -12
- package/dist/esbuild.mjs.map +1 -0
- package/dist/farm.cjs +6 -13
- package/dist/farm.d.cts +2 -3
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +2 -6
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +4 -11
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +7 -13
- package/dist/index.d.cts +263 -6
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +263 -7
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -9
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +7 -14
- package/dist/next.d.cts +0 -1
- package/dist/next.d.cts.map +1 -1
- package/dist/next.d.mts +0 -1
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +6 -13
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt.cjs +12 -22
- package/dist/nuxt.d.cts +2 -3
- package/dist/nuxt.d.cts.map +1 -1
- package/dist/nuxt.d.mts +2 -7
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +8 -18
- package/dist/nuxt.mjs.map +1 -1
- package/dist/plugin-utils.cjs +20 -28
- package/dist/plugin-utils.d.cts +1 -267
- package/dist/plugin-utils.d.mts +1 -272
- package/dist/plugin-utils.mjs +11 -4
- package/dist/plugin-utils.mjs.map +1 -0
- package/dist/rolldown.cjs +52 -18
- package/dist/rolldown.d.cts +5 -29
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts +5 -32
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +36 -13
- package/dist/rolldown.mjs.map +1 -0
- package/dist/rollup.cjs +20 -48
- package/dist/rollup.d.cts +5 -29
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts +5 -32
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +6 -44
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +20 -82
- package/dist/rspack.d.cts +4 -24
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +4 -27
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +5 -77
- package/dist/rspack.mjs.map +1 -1
- package/dist/storage/index.cjs +2 -3
- package/dist/storage/index.d.cts +7 -7
- package/dist/storage/index.d.cts.map +1 -1
- package/dist/storage/index.d.mts +7 -11
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +1 -3
- package/dist/{tsconfig-C8M8X6U0.cjs → tsconfig-BJrUrPC_.cjs} +13 -13
- package/dist/{tsconfig-B92heKit.mjs → tsconfig-D9GCB2I9.mjs} +5 -5
- package/dist/tsconfig-D9GCB2I9.mjs.map +1 -0
- package/dist/tsdown.cjs +38 -187
- package/dist/tsdown.d.cts +2 -24
- package/dist/tsdown.d.cts.map +1 -1
- package/dist/tsdown.d.mts +4 -30
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +8 -167
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +29 -134
- package/dist/tsup.d.cts +2 -24
- package/dist/tsup.d.cts.map +1 -1
- package/dist/tsup.d.mts +2 -28
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +7 -122
- package/dist/tsup.mjs.map +1 -1
- package/dist/types-DerAvFjs.d.cts +4 -0
- package/dist/types-DerAvFjs.d.cts.map +1 -0
- package/dist/types-ro7jWCtL.d.mts +4 -0
- package/dist/types-ro7jWCtL.d.mts.map +1 -0
- package/dist/typescript/index.cjs +2 -1
- package/dist/typescript/index.d.cts +2 -2
- package/dist/typescript/index.d.cts.map +1 -1
- package/dist/typescript/index.d.mts +1 -4
- package/dist/typescript/index.d.mts.map +1 -1
- package/dist/typescript/index.mjs +1 -1
- package/dist/unloader.cjs +6 -13
- package/dist/unloader.d.cts +2 -4
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +2 -7
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +4 -11
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin.cjs +11 -14
- package/dist/unplugin.d.cts +5 -6
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts +3 -6
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +6 -10
- package/dist/utils.cjs +38 -22
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.mts +3 -3
- package/dist/utils.mjs +19 -3
- package/dist/utils.mjs.map +1 -0
- package/dist/{virtual-B1MLgqnQ.cjs → virtual-Cbvj12lU.cjs} +33 -33
- package/dist/{virtual-B9imjOqe.mjs → virtual-DvkJm7gK.mjs} +7 -7
- package/dist/virtual-DvkJm7gK.mjs.map +1 -0
- package/dist/vite.cjs +84 -19
- package/dist/vite.d.cts +5 -16
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +5 -19
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +67 -14
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack.cjs +42 -16
- package/dist/webpack.d.cts +5 -29
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts +5 -32
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +26 -11
- package/dist/webpack.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/api-CY668wMZ.mjs.map +0 -1
- package/dist/commands-7TWNqTU1.d.cts +0 -12
- package/dist/commands-7TWNqTU1.d.cts.map +0 -1
- package/dist/commands-yacLkOi0.d.mts +0 -12
- package/dist/commands-yacLkOi0.d.mts.map +0 -1
- package/dist/config-CK756s0L.d.mts +0 -2232
- package/dist/config-CK756s0L.d.mts.map +0 -1
- package/dist/config-CiPXgwzt.d.mts +0 -39
- package/dist/config-CiPXgwzt.d.mts.map +0 -1
- package/dist/config-D4Fh2gQL.mjs +0 -87
- package/dist/config-D4Fh2gQL.mjs.map +0 -1
- package/dist/config-D86Vw7SC.cjs +0 -105
- package/dist/config-J74ORCFY.d.cts +0 -39
- package/dist/config-J74ORCFY.d.cts.map +0 -1
- package/dist/config-vnrrSxEB.d.cts +0 -2232
- package/dist/config-vnrrSxEB.d.cts.map +0 -1
- package/dist/constants-CZh5rsgh.cjs +0 -103
- package/dist/constants-cXxSHhNp.mjs +0 -32
- package/dist/constants-cXxSHhNp.mjs.map +0 -1
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.mts.map +0 -1
- package/dist/esbuild-B3NuCco0.cjs +0 -100
- package/dist/esbuild-DWiE0pYc.mjs +0 -82
- package/dist/esbuild-DWiE0pYc.mjs.map +0 -1
- package/dist/index-2JXW-b2-.d.mts +0 -82
- package/dist/index-2JXW-b2-.d.mts.map +0 -1
- package/dist/index-6BLROVtJ.d.mts +0 -261
- package/dist/index-6BLROVtJ.d.mts.map +0 -1
- package/dist/index-C7W0kmm7.d.mts +0 -171
- package/dist/index-C7W0kmm7.d.mts.map +0 -1
- package/dist/index-DJ-k0GOX.d.cts +0 -261
- package/dist/index-DJ-k0GOX.d.cts.map +0 -1
- package/dist/paths-CS8ecCnW.mjs +0 -81
- package/dist/paths-CS8ecCnW.mjs.map +0 -1
- package/dist/paths-YmyIGEVo.cjs +0 -98
- package/dist/plugin-B9TQt-p0.d.cts +0 -82
- package/dist/plugin-B9TQt-p0.d.cts.map +0 -1
- package/dist/plugin-BE3wmhoU.d.cts +0 -26
- package/dist/plugin-BE3wmhoU.d.cts.map +0 -1
- package/dist/plugin-CZ_PJPpQ.cjs +0 -96
- package/dist/plugin-C_8RhG5V.d.mts +0 -26
- package/dist/plugin-C_8RhG5V.d.mts.map +0 -1
- package/dist/plugin-E5foRD0k.mjs +0 -61
- package/dist/plugin-E5foRD0k.mjs.map +0 -1
- package/dist/plugin-utils-C3HnZJl1.mjs +0 -387
- package/dist/plugin-utils-C3HnZJl1.mjs.map +0 -1
- package/dist/plugin-utils-Ck3cx3w6.cjs +0 -531
- package/dist/plugin-utils.d.cts.map +0 -1
- package/dist/plugin-utils.d.mts.map +0 -1
- package/dist/resolve-options-6sXFqzEA.mjs +0 -116
- package/dist/resolve-options-6sXFqzEA.mjs.map +0 -1
- package/dist/resolve-options-BQnTgg3V.cjs +0 -105
- package/dist/resolve-options-D-RGs8j8.mjs +0 -117
- package/dist/resolve-options-D-RGs8j8.mjs.map +0 -1
- package/dist/resolve-options-DHL3RM8F.mjs +0 -87
- package/dist/resolve-options-DHL3RM8F.mjs.map +0 -1
- package/dist/resolve-options-lxQ2pm0W.cjs +0 -127
- package/dist/resolve-options-vyFhhkLp.cjs +0 -133
- package/dist/rolldown-CQI8ps6f.cjs +0 -83
- package/dist/rolldown-DsXEFXyP.mjs +0 -65
- package/dist/rolldown-DsXEFXyP.mjs.map +0 -1
- package/dist/tsconfig-B92heKit.mjs.map +0 -1
- package/dist/types-Bh_vLuQ0.d.mts +0 -1
- package/dist/utils-BbDma_5Y.cjs +0 -449
- package/dist/utils-DoQcX7Sk.mjs +0 -339
- package/dist/utils-DoQcX7Sk.mjs.map +0 -1
- package/dist/virtual-B9imjOqe.mjs.map +0 -1
- package/dist/vite-Bx1gbbj3.mjs +0 -171
- package/dist/vite-Bx1gbbj3.mjs.map +0 -1
- package/dist/vite-XV170zx6.cjs +0 -189
- package/dist/webpack-9G4xJBfz.cjs +0 -107
- package/dist/webpack-BkTkELre.mjs +0 -88
- package/dist/webpack-BkTkELre.mjs.map +0 -1
- package/dist/write-file-CpNWY8SV.d.cts +0 -171
- package/dist/write-file-CpNWY8SV.d.cts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils-C3HnZJl1.mjs","names":["result: string | undefined","invalidItems: string[]","prefix: string"],"sources":["../../core/src/plugin-utils/build-helpers.ts","../../core/src/plugin-utils/context-helpers.ts","../../core/src/plugin-utils/helpers.ts","../../core/src/plugin-utils/merge.ts","../../core/src/plugin-utils/extend.ts","../../core/src/plugin-utils/format-package-json.ts","../../core/src/plugin-utils/get-config-path.ts","../../core/src/plugin-utils/modules.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 { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { ResolveConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport interface GetDependencyConfigResult {\n external: ResolveConfig[\"external\"];\n noExternal: ResolveConfig[\"noExternal\"];\n}\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig(\n context: Context\n): GetDependencyConfigResult {\n const noExternal = getUnique(\n toArray(context.config.resolve.noExternal).concat(context.builtins)\n );\n\n const external = getUnique(\n toArray(context.config.resolve.external).reduce(\n (ret, ext) => {\n if (isRegExp(ext)) {\n if (\n noExternal.some(\n noExt => isRegExp(noExt) && noExt.source === ext.source\n )\n ) {\n return ret;\n }\n\n const noExts = noExternal.filter(\n noExt => isSetString(noExt) && ext.test(noExt)\n );\n if (noExts.length > 0) {\n ret.push(\n new RegExp(\n noExts.reduce(\n (regex: string, noExt: string | RegExp) =>\n `(?!${\n isRegExp(noExt) ? noExt.source : `^${noExt}$`\n })${regex}`,\n `${ext.source\n .replace(/^\\^@\\?/, \"^@\")\n .replace(/^@\\?/, \"@\")\n .replace(/\\$$/, \"\")\n .replace(/\\.\\*$/, \"\")}.*$`\n )\n )\n );\n return ret;\n }\n }\n\n ret.push(ext);\n return ret;\n },\n [] as (string | RegExp)[]\n )\n );\n\n return {\n external: external.length === 0 ? undefined : external,\n noExternal: noExternal.length === 0 ? undefined : noExternal\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 { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getOrganizationName(\n context: UnresolvedContext\n): string | undefined {\n let result: string | undefined;\n if (isSetObject(context.workspaceConfig.organization)) {\n result = context.workspaceConfig.organization.name;\n }\n\n if (!result && isSetString(context.workspaceConfig.organization)) {\n result = context.workspaceConfig.organization;\n }\n\n if (\n !result &&\n Array.isArray(context.packageJson.maintainers) &&\n context.packageJson.maintainers.length > 0\n ) {\n if (isSetObject(context.packageJson.maintainers[0])) {\n result = (context.packageJson.maintainers[0] as { name: string }).name;\n }\n\n if (!result && isSetString(context.packageJson.maintainers[0])) {\n result = context.packageJson.maintainers[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(context.packageJson.author) &&\n context.packageJson.author.length > 0\n ) {\n if (isSetObject(context.packageJson.author[0])) {\n result = (context.packageJson.author[0] as { name: string }).name;\n }\n\n if (!result && isSetString(context.packageJson.author[0])) {\n result = context.packageJson.author[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(context.packageJson.contributors) &&\n context.packageJson.contributors.length > 0\n ) {\n if (isSetObject(context.packageJson.contributors[0])) {\n result = (context.packageJson.contributors[0] as { name: string }).name;\n }\n\n if (!result && isSetString(context.packageJson.contributors[0])) {\n result = context.packageJson.contributors[0];\n }\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getWorkspaceName(\n context: UnresolvedContext\n): string | undefined {\n let result: string | undefined;\n if (isSetString(context.workspaceConfig.name)) {\n result = context.workspaceConfig.name;\n }\n\n if (!result && isSetString(context.workspaceConfig.namespace)) {\n result = context.workspaceConfig.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\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 { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n BUILDER_VARIANTS,\n PLUGIN_HOOKS_FIELDS,\n UNPLUGIN_BUILDER_VARIANTS\n} from \"../constants/plugin\";\nimport type {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n ResolvedConfig\n} from \"../types/config\";\nimport type { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport type {\n HookFields,\n PluginHooksListItem,\n UnpluginHooksListItem\n} from \"../types/hooks\";\nimport type {\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport type {\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n ) &&\n BUILDER_VARIANTS.every(\n variant =>\n isUndefined((value as Plugin<TContext>)[variant]) ||\n (variant in value && isSetObject((value as Plugin<TContext>)[variant]))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> = TField extends PluginHookFields\n ? PluginHooksListItem<TContext, TField>[\"handler\"]\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, TField>[\"handler\"]\n : never;\n\ntype HooksListItemForField<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> =\n TField extends PluginHookFields<TContext>\n ? PluginHooksListItem<TContext, Extract<TField, PluginHookFields<TContext>>>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, Extract<TField, UnpluginBuilderVariant>>\n : never;\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TField> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TField>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n): keys is PluginHookFields<TContext> {\n return (\n !isUnpluginHookKey(keys) &&\n PLUGIN_HOOKS_FIELDS.includes(keys as PluginHookFields<TContext>)\n );\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends PluginHooksListItem<TContext, TField> = PluginHooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n) {\n if (\n !checkDedupe(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as HooksListItemForField<\n TContext,\n TField\n >[\"handler\"];\n if (!handler) {\n return;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport type {\n PartialPlugin,\n Plugin,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n\n/**\n * Merges two configuration objects together, with special handling for string values.\n * If the value from the second object is a non-empty string, it will overwrite the value from the first object.\n *\n * @example\n * ```ts\n * const configA = { name: \"Default\", version: \"1.0.0\" };\n * const configB = { name: \"Custom\", description: \"A custom config\" };\n * const mergedConfig = mergeConfig(configA, configB);\n * // Result: { name: \"Custom\", version: \"1.0.0\", description: \"A custom config\" }\n * ```\n *\n * @param objA - The first configuration object.\n * @param objB - The second configuration object.\n * @returns The merged configuration object.\n */\nexport const mergeConfig = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n }\n\n return false;\n}) as (...configs: unknown[]) => ResolvedConfig;\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 { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport {\n PartialPlugin,\n PartialPluginFactory,\n PluginFactory\n} from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { merge } from \"./merge\";\n\n/**\n * Adds additional helper functionality to a plugin via a plugin builder function.\n *\n * @param plugin - The base plugin object or factory function to extend.\n * @param extension - The plugin extension object or factory function. This function receives the plugin options and returns a plugin object.\n * @returns A function accepting the plugin options and returning the extended plugin.\n */\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown,\n TExtensionOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TPluginOptions & TExtensionOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPlugin<TContext>\n): PluginFactory<TContext, TPluginOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TExtensionOptions = unknown\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TExtensionOptions>;\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPlugin<TContext>\n): Plugin<TContext>[];\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext, any>,\n extension: PartialPlugin<TContext> | PartialPluginFactory<TContext, any>\n): PluginFactory<TContext, any> | Plugin<TContext>[] {\n if (isFunction(plugin)) {\n if (isFunction(extension)) {\n return async (options: any) => {\n const pluginResult = toArray(await Promise.resolve(plugin(options)));\n const extensionResult = toArray(\n await Promise.resolve(extension(options))\n );\n\n return pluginResult\n .map(p => extensionResult.map(e => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return async (options: any) => {\n const result = toArray(await Promise.resolve(plugin(options)));\n\n return result.map(p => merge(p, extension) as Plugin<TContext>);\n };\n } else if (isFunction(extension)) {\n return async (options: any) => {\n const result = toArray(await Promise.resolve(extension(options)));\n\n return result\n .map(e => toArray(plugin).map(p => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return toArray(plugin).map(p => merge(p, extension) as Plugin<TContext>);\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 { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { format } from \"../lib/utilities/format\";\nimport { Context } from \"../types/context\";\n\n/**\n * Formats the `package.json` file in the project root.\n *\n * @param context - The powerlines context.\n */\nexport async function formatPackageJson(context: Context) {\n const packageJsonPath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"package.json\"\n );\n\n const packageJsonFile = await context.fs.read(packageJsonPath);\n if (isSetString(packageJsonFile)) {\n await context.fs.write(\n packageJsonPath,\n await format(context, packageJsonPath, packageJsonFile)\n );\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 { joinPaths } from \"@stryke/path/join\";\nimport { existsSync } from \"node:fs\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the configuration file path for a given name.\n *\n * @param context - The Powerlines context.\n * @param name - The name of the configuration file (without extension).\n * @returns The absolute path to the configuration file, or undefined if not found.\n */\nexport function getConfigPath(\n context: UnresolvedContext,\n name: string\n): string | undefined {\n if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.yml`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.yml`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.yaml`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.yaml`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.json`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.json`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.jsonc`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.jsonc`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.ts`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.ts`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.cts`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.cts`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.mts`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.mts`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.js`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.js`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.cjs`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.cjs`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.mjs`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.mjs`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.ts`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.ts`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.cts`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.cts`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.mts`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.mts`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.js`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.js`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.cjs`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.cjs`\n );\n } else if (\n existsSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.mjs`\n )\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n `${name}.config.mjs`\n );\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`);\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`)\n )\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`);\n } else if (\n existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`))\n ) {\n return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`);\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`)\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n `${name}.config.ts`\n );\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`)\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n `${name}.config.cts`\n );\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`)\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n `${name}.config.mts`\n );\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`)\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n `${name}.config.js`\n );\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`)\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n `${name}.config.cjs`\n );\n } else if (\n existsSync(\n joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`)\n )\n ) {\n return joinPaths(\n context.workspaceConfig.workspaceRoot,\n `${name}.config.mjs`\n );\n }\n\n return undefined;\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 { Context } from \"../types/context\";\n\n/**\n * Determine if a module ID is a built-in Powerlines module ID.\n *\n * @param context - The Powerlines context.\n * @param moduleName - The name of the module to check.\n * @returns `true` if the module is a built-in module, otherwise `false`.\n */\nexport function isBuiltinModule(context: Context, moduleName: string): boolean {\n const prefix: string = context.config?.framework || \"powerlines\";\n\n return (\n moduleName.startsWith(`${prefix.replace(/:$/, \"\")}:`) ||\n Object.keys(context.fs.metadata)\n .filter(key => context.fs.metadata[key]?.type === \"builtin\")\n .includes(moduleName)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,aAAa,UACjB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,CAAC,OAAO,QAAQ,SAAS,CACpE;CAED,MAAM,WAAW,UACf,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC,QACtC,KAAK,QAAQ;AACZ,MAAI,SAAS,IAAI,EAAE;AACjB,OACE,WAAW,MACT,UAAS,SAAS,MAAM,IAAI,MAAM,WAAW,IAAI,OAClD,CAED,QAAO;GAGT,MAAM,SAAS,WAAW,QACxB,UAAS,YAAY,MAAM,IAAI,IAAI,KAAK,MAAM,CAC/C;AACD,OAAI,OAAO,SAAS,GAAG;AACrB,QAAI,KACF,IAAI,OACF,OAAO,QACJ,OAAe,UACd,MACE,SAAS,MAAM,GAAG,MAAM,SAAS,IAAI,MAAM,GAC5C,GAAG,SACN,GAAG,IAAI,OACJ,QAAQ,UAAU,KAAK,CACvB,QAAQ,QAAQ,IAAI,CACpB,QAAQ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AS,WAAW"}
|
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_plugin = require('./plugin-CZ_PJPpQ.cjs');
|
|
3
|
-
const require_paths = require('./paths-YmyIGEVo.cjs');
|
|
4
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
5
|
-
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
6
|
-
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
7
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
-
let defu = require("defu");
|
|
10
|
-
defu = require_chunk.__toESM(defu);
|
|
11
|
-
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
12
|
-
let __stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
13
|
-
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
14
|
-
let __stryke_path_join = require("@stryke/path/join");
|
|
15
|
-
let node_fs = require("node:fs");
|
|
16
|
-
|
|
17
|
-
//#region ../core/src/plugin-utils/build-helpers.ts
|
|
18
|
-
/**
|
|
19
|
-
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
20
|
-
*
|
|
21
|
-
* @param context - The build context.
|
|
22
|
-
* @returns The dependency configuration.
|
|
23
|
-
*/
|
|
24
|
-
function getDependencyConfig(context) {
|
|
25
|
-
const noExternal = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.resolve.noExternal).concat(context.builtins));
|
|
26
|
-
const external = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.resolve.external).reduce((ret, ext) => {
|
|
27
|
-
if ((0, __stryke_type_checks_is_regexp.isRegExp)(ext)) {
|
|
28
|
-
if (noExternal.some((noExt) => (0, __stryke_type_checks_is_regexp.isRegExp)(noExt) && noExt.source === ext.source)) return ret;
|
|
29
|
-
const noExts = noExternal.filter((noExt) => (0, __stryke_type_checks_is_set_string.isSetString)(noExt) && ext.test(noExt));
|
|
30
|
-
if (noExts.length > 0) {
|
|
31
|
-
ret.push(new RegExp(noExts.reduce((regex, noExt) => `(?!${(0, __stryke_type_checks_is_regexp.isRegExp)(noExt) ? noExt.source : `^${noExt}$`})${regex}`, `${ext.source.replace(/^\^@\?/, "^@").replace(/^@\?/, "@").replace(/\$$/, "").replace(/\.\*$/, "")}.*$`)));
|
|
32
|
-
return ret;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
ret.push(ext);
|
|
36
|
-
return ret;
|
|
37
|
-
}, []));
|
|
38
|
-
return {
|
|
39
|
-
external: external.length === 0 ? void 0 : external,
|
|
40
|
-
noExternal: noExternal.length === 0 ? void 0 : noExternal
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region ../core/src/plugin-utils/context-helpers.ts
|
|
46
|
-
/**
|
|
47
|
-
* Get the organization name from the context
|
|
48
|
-
*
|
|
49
|
-
* @param context - The Powerlines plugin context.
|
|
50
|
-
* @returns The organization name or undefined if not found.
|
|
51
|
-
*/
|
|
52
|
-
function getOrganizationName(context) {
|
|
53
|
-
let result;
|
|
54
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.workspaceConfig.organization)) result = context.workspaceConfig.organization.name;
|
|
55
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.organization)) result = context.workspaceConfig.organization;
|
|
56
|
-
if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
|
|
57
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0].name;
|
|
58
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
|
|
59
|
-
}
|
|
60
|
-
if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
|
|
61
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.author[0])) result = context.packageJson.author[0].name;
|
|
62
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.author[0])) result = context.packageJson.author[0];
|
|
63
|
-
}
|
|
64
|
-
if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
|
|
65
|
-
if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.contributors[0])) result = context.packageJson.contributors[0].name;
|
|
66
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.contributors[0])) result = context.packageJson.contributors[0];
|
|
67
|
-
}
|
|
68
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
69
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the organization name from the context
|
|
74
|
-
*
|
|
75
|
-
* @param context - The Powerlines plugin context.
|
|
76
|
-
* @returns The organization name or undefined if not found.
|
|
77
|
-
*/
|
|
78
|
-
function getWorkspaceName(context) {
|
|
79
|
-
let result;
|
|
80
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.name)) result = context.workspaceConfig.name;
|
|
81
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.namespace)) result = context.workspaceConfig.namespace.replace(/^@/, "");
|
|
82
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
83
|
-
if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region ../core/src/plugin-utils/helpers.ts
|
|
89
|
-
/**
|
|
90
|
-
* Type guard to check if an object is a {@link Plugin}
|
|
91
|
-
*
|
|
92
|
-
* @param value - The object to check
|
|
93
|
-
* @returns True if the object is a {@link Plugin}, false otherwise
|
|
94
|
-
*/
|
|
95
|
-
function isPlugin(value) {
|
|
96
|
-
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "name" in value && (0, __stryke_type_checks_is_set_string.isSetString)(value.name) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.api) || "api" in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value.api)) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.applyToEnvironment) || "applyToEnvironment" in value && (0, __stryke_type_checks_is_function.isFunction)(value.applyToEnvironment)) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.dedupe) || "dedupe" in value && (0, __stryke_type_checks_is_function.isFunction)(value.dedupe)) && require_plugin.PLUGIN_HOOKS_FIELDS.every((hook) => (0, __stryke_type_checks_is_undefined.isUndefined)(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && (0, __stryke_type_checks_is_set_object.isSetObject)(value[hook]))) && require_plugin.BUILDER_VARIANTS.every((variant) => (0, __stryke_type_checks_is_undefined.isUndefined)(value[variant]) || variant in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value[variant]));
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Type guard to check if an object is a {@link PluginConfigObject}
|
|
100
|
-
*
|
|
101
|
-
* @param value - The object to check
|
|
102
|
-
* @returns True if the object is a {@link PluginConfigObject}, false otherwise
|
|
103
|
-
*/
|
|
104
|
-
function isPluginConfigObject(value) {
|
|
105
|
-
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "plugin" in value && (((0, __stryke_type_checks_is_set_string.isSetString)(value.plugin) || (0, __stryke_type_checks_is_function.isFunction)(value.plugin)) && "options" in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value.options) || isPlugin(value.plugin));
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Type guard to check if an object is a {@link PluginConfigTuple}
|
|
109
|
-
*
|
|
110
|
-
* @param value - The object to check
|
|
111
|
-
* @returns True if the object is a {@link PluginConfigTuple}, false otherwise
|
|
112
|
-
*/
|
|
113
|
-
function isPluginConfigTuple(value) {
|
|
114
|
-
return Array.isArray(value) && (value.length === 1 || value.length === 2) && (((0, __stryke_type_checks_is_set_string.isSetString)(value[0]) || (0, __stryke_type_checks_is_function.isFunction)(value[0])) && value.length > 1 && (0, __stryke_type_checks_is_set_object.isSetObject)(value[1]) || isPlugin(value[0]));
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Type guard to check if an object is a {@link PluginConfig}
|
|
118
|
-
*
|
|
119
|
-
* @param value - The object to check
|
|
120
|
-
* @returns True if the object is a {@link PluginConfig}, false otherwise
|
|
121
|
-
*/
|
|
122
|
-
function isPluginConfig(value) {
|
|
123
|
-
return (0, __stryke_type_checks_is_set_string.isSetString)(value) || (0, __stryke_type_checks_is_function.isFunction)(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value) || Array.isArray(value) && value.every((item) => isPluginConfig(item));
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Type guard to check if an value is a {@link PluginHook} function
|
|
127
|
-
*
|
|
128
|
-
* @param value - The value to check
|
|
129
|
-
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
130
|
-
*/
|
|
131
|
-
function isPluginHookObject(value) {
|
|
132
|
-
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "handler" in value && (0, __stryke_type_checks_is_function.isFunction)(value.handler);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Type guard to check if an value is a {@link PluginHook} function
|
|
136
|
-
*
|
|
137
|
-
* @param value - The value to check
|
|
138
|
-
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
139
|
-
*/
|
|
140
|
-
function isPluginHookFunction(value) {
|
|
141
|
-
return (0, __stryke_type_checks_is_function.isFunction)(value) || isPluginHookObject(value);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Type guard to check if an object is a {@link PluginHook}
|
|
145
|
-
*
|
|
146
|
-
* @param value - The object to check
|
|
147
|
-
* @returns True if the object is a {@link PluginHook}, false otherwise
|
|
148
|
-
*/
|
|
149
|
-
function isPluginHook(value) {
|
|
150
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Extract the hook handler function from a plugin hook
|
|
154
|
-
*
|
|
155
|
-
* @param pluginHook - The plugin hook to extract the handler function from
|
|
156
|
-
* @returns The hook handler function
|
|
157
|
-
*/
|
|
158
|
-
function getHookHandler(pluginHook) {
|
|
159
|
-
return (0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? pluginHook : pluginHook.handler;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Extract a plugin hook from a plugin
|
|
163
|
-
*
|
|
164
|
-
* @param context - The build context
|
|
165
|
-
* @param plugin - The plugin to extract the hook from
|
|
166
|
-
* @param hook - The name of the hook to extract
|
|
167
|
-
* @returns The extracted hook, or undefined if the hook does not exist
|
|
168
|
-
*/
|
|
169
|
-
function extractPluginHook(context, plugin, hook) {
|
|
170
|
-
const pluginHook = plugin[hook];
|
|
171
|
-
if (!isPluginHook(pluginHook)) return;
|
|
172
|
-
return (0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? { normal: pluginHook.bind(context) } : { [pluginHook.order ? pluginHook.order : "normal"]: pluginHook.handler.bind(context) };
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Check if a hook is external.
|
|
176
|
-
*
|
|
177
|
-
* @param keys - The name of the hook to check.
|
|
178
|
-
* @returns True if the hook is external, false otherwise.
|
|
179
|
-
*/
|
|
180
|
-
function isUnpluginHookKey(keys) {
|
|
181
|
-
return require_plugin.UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Check if a hook is internal.
|
|
185
|
-
*
|
|
186
|
-
* @param keys - The name of the hook to check.
|
|
187
|
-
* @returns True if the hook is external, false otherwise.
|
|
188
|
-
*/
|
|
189
|
-
function isPluginHookField(keys) {
|
|
190
|
-
return !isUnpluginHookKey(keys) && require_plugin.PLUGIN_HOOKS_FIELDS.includes(keys);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Check if a hook is external.
|
|
194
|
-
*
|
|
195
|
-
* @param field - The name of the hook to check.
|
|
196
|
-
* @returns True if the hook is external, false otherwise.
|
|
197
|
-
*/
|
|
198
|
-
function isUnpluginHookField(field) {
|
|
199
|
-
return !isPluginHookField(field) && require_plugin.UNPLUGIN_BUILDER_VARIANTS.includes(field);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Check if a plugin should be deduplicated.
|
|
203
|
-
*
|
|
204
|
-
* @param plugin - The plugin to check
|
|
205
|
-
* @param plugins - The list of plugins to check against
|
|
206
|
-
* @returns True if the plugin should be deduplicated, false otherwise
|
|
207
|
-
*/
|
|
208
|
-
function checkDedupe(plugin, plugins) {
|
|
209
|
-
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && ((0, __stryke_type_checks_is_function.isFunction)(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Add a plugin hook to the hooks list.
|
|
213
|
-
*
|
|
214
|
-
* @param context - The plugin context
|
|
215
|
-
* @param plugin - The plugin to add the hook from
|
|
216
|
-
* @param pluginHook - The plugin hook to add
|
|
217
|
-
* @param hooksList - The list of hooks to add to
|
|
218
|
-
*/
|
|
219
|
-
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
220
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin).filter(Boolean))) {
|
|
221
|
-
const handler = ((...args) => getHookHandler(pluginHook).apply(context, args));
|
|
222
|
-
if (!handler) return;
|
|
223
|
-
hooksList.push({
|
|
224
|
-
plugin,
|
|
225
|
-
handler
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.
|
|
231
|
-
*
|
|
232
|
-
* @param config - The plugin configuration to check
|
|
233
|
-
* @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
|
|
234
|
-
*/
|
|
235
|
-
function findInvalidPluginConfig(config) {
|
|
236
|
-
if (isPluginConfig(config)) return null;
|
|
237
|
-
if (Array.isArray(config)) {
|
|
238
|
-
const invalidItems = [];
|
|
239
|
-
config.forEach((item) => {
|
|
240
|
-
const invalid = findInvalidPluginConfig(item);
|
|
241
|
-
if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
|
|
242
|
-
});
|
|
243
|
-
return invalidItems.length > 0 ? invalidItems : null;
|
|
244
|
-
}
|
|
245
|
-
return [JSON.stringify(config, null, 2)];
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
//#endregion
|
|
249
|
-
//#region ../core/src/plugin-utils/merge.ts
|
|
250
|
-
const mergePlugin = (0, defu.createDefu)((obj, key, value) => {
|
|
251
|
-
if (isPluginHook(obj[key]) && isPluginHook(value)) {
|
|
252
|
-
obj[key] = {
|
|
253
|
-
...obj[key],
|
|
254
|
-
...value,
|
|
255
|
-
handler: async (...params) => {
|
|
256
|
-
const [resultA, resultB] = await Promise.all([getHookHandler(obj[key])(...params), getHookHandler(value)(...params)]);
|
|
257
|
-
return resultB && resultA ? (0, defu.default)(resultA, resultB) : resultA || resultB;
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
return false;
|
|
263
|
-
});
|
|
264
|
-
/**
|
|
265
|
-
* Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.
|
|
266
|
-
*
|
|
267
|
-
* @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.
|
|
268
|
-
* @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.
|
|
269
|
-
* @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.
|
|
270
|
-
*/
|
|
271
|
-
function merge(pluginA, pluginB) {
|
|
272
|
-
return mergePlugin(pluginA, pluginB);
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Merges two configuration objects together, with special handling for string values.
|
|
276
|
-
* If the value from the second object is a non-empty string, it will overwrite the value from the first object.
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```ts
|
|
280
|
-
* const configA = { name: "Default", version: "1.0.0" };
|
|
281
|
-
* const configB = { name: "Custom", description: "A custom config" };
|
|
282
|
-
* const mergedConfig = mergeConfig(configA, configB);
|
|
283
|
-
* // Result: { name: "Custom", version: "1.0.0", description: "A custom config" }
|
|
284
|
-
* ```
|
|
285
|
-
*
|
|
286
|
-
* @param objA - The first configuration object.
|
|
287
|
-
* @param objB - The second configuration object.
|
|
288
|
-
* @returns The merged configuration object.
|
|
289
|
-
*/
|
|
290
|
-
const mergeConfig = (0, defu.createDefu)((obj, key, value) => {
|
|
291
|
-
if ((0, __stryke_type_checks_is_string.isString)(obj[key]) && (0, __stryke_type_checks_is_string.isString)(value)) {
|
|
292
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(value)) obj[key] = value;
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
return false;
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
//#endregion
|
|
299
|
-
//#region ../core/src/plugin-utils/extend.ts
|
|
300
|
-
function extend(plugin, extension) {
|
|
301
|
-
if ((0, __stryke_type_checks_is_function.isFunction)(plugin)) {
|
|
302
|
-
if ((0, __stryke_type_checks_is_function.isFunction)(extension)) return async (options) => {
|
|
303
|
-
const pluginResult = (0, __stryke_convert_to_array.toArray)(await Promise.resolve(plugin(options)));
|
|
304
|
-
const extensionResult = (0, __stryke_convert_to_array.toArray)(await Promise.resolve(extension(options)));
|
|
305
|
-
return pluginResult.map((p) => extensionResult.map((e) => merge(p, e))).flat();
|
|
306
|
-
};
|
|
307
|
-
return async (options) => {
|
|
308
|
-
return (0, __stryke_convert_to_array.toArray)(await Promise.resolve(plugin(options))).map((p) => merge(p, extension));
|
|
309
|
-
};
|
|
310
|
-
} else if ((0, __stryke_type_checks_is_function.isFunction)(extension)) return async (options) => {
|
|
311
|
-
return (0, __stryke_convert_to_array.toArray)(await Promise.resolve(extension(options))).map((e) => (0, __stryke_convert_to_array.toArray)(plugin).map((p) => merge(p, e))).flat();
|
|
312
|
-
};
|
|
313
|
-
return (0, __stryke_convert_to_array.toArray)(plugin).map((p) => merge(p, extension));
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region ../core/src/plugin-utils/format-package-json.ts
|
|
318
|
-
/**
|
|
319
|
-
* Formats the `package.json` file in the project root.
|
|
320
|
-
*
|
|
321
|
-
* @param context - The powerlines context.
|
|
322
|
-
*/
|
|
323
|
-
async function formatPackageJson(context) {
|
|
324
|
-
const packageJsonPath = (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "package.json");
|
|
325
|
-
const packageJsonFile = await context.fs.read(packageJsonPath);
|
|
326
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(packageJsonFile)) await context.fs.write(packageJsonPath, await require_paths.format(context, packageJsonPath, packageJsonFile));
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region ../core/src/plugin-utils/get-config-path.ts
|
|
331
|
-
/**
|
|
332
|
-
* Get the configuration file path for a given name.
|
|
333
|
-
*
|
|
334
|
-
* @param context - The Powerlines context.
|
|
335
|
-
* @param name - The name of the configuration file (without extension).
|
|
336
|
-
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
337
|
-
*/
|
|
338
|
-
function getConfigPath(context, name) {
|
|
339
|
-
if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.yml`);
|
|
340
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.yaml`);
|
|
341
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.json`);
|
|
342
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.jsonc`);
|
|
343
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.ts`);
|
|
344
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.cts`);
|
|
345
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.mts`);
|
|
346
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.js`);
|
|
347
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.cjs`);
|
|
348
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.mjs`);
|
|
349
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.ts`);
|
|
350
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.cts`);
|
|
351
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.mts`);
|
|
352
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.js`);
|
|
353
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.cjs`);
|
|
354
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, `${name}.config.mjs`);
|
|
355
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
356
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
357
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
358
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
359
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
360
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
361
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
362
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
363
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
364
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
365
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
366
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
367
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
368
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
369
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
370
|
-
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
//#endregion
|
|
374
|
-
//#region ../core/src/plugin-utils/modules.ts
|
|
375
|
-
/**
|
|
376
|
-
* Determine if a module ID is a built-in Powerlines module ID.
|
|
377
|
-
*
|
|
378
|
-
* @param context - The Powerlines context.
|
|
379
|
-
* @param moduleName - The name of the module to check.
|
|
380
|
-
* @returns `true` if the module is a built-in module, otherwise `false`.
|
|
381
|
-
*/
|
|
382
|
-
function isBuiltinModule(context, moduleName) {
|
|
383
|
-
const prefix = context.config?.framework || "powerlines";
|
|
384
|
-
return moduleName.startsWith(`${prefix.replace(/:$/, "")}:`) || Object.keys(context.fs.metadata).filter((key) => context.fs.metadata[key]?.type === "builtin").includes(moduleName);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
//#endregion
|
|
388
|
-
Object.defineProperty(exports, 'addPluginHook', {
|
|
389
|
-
enumerable: true,
|
|
390
|
-
get: function () {
|
|
391
|
-
return addPluginHook;
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
Object.defineProperty(exports, 'checkDedupe', {
|
|
395
|
-
enumerable: true,
|
|
396
|
-
get: function () {
|
|
397
|
-
return checkDedupe;
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
Object.defineProperty(exports, 'extend', {
|
|
401
|
-
enumerable: true,
|
|
402
|
-
get: function () {
|
|
403
|
-
return extend;
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
Object.defineProperty(exports, 'extractPluginHook', {
|
|
407
|
-
enumerable: true,
|
|
408
|
-
get: function () {
|
|
409
|
-
return extractPluginHook;
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
Object.defineProperty(exports, 'findInvalidPluginConfig', {
|
|
413
|
-
enumerable: true,
|
|
414
|
-
get: function () {
|
|
415
|
-
return findInvalidPluginConfig;
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
Object.defineProperty(exports, 'formatPackageJson', {
|
|
419
|
-
enumerable: true,
|
|
420
|
-
get: function () {
|
|
421
|
-
return formatPackageJson;
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
Object.defineProperty(exports, 'getConfigPath', {
|
|
425
|
-
enumerable: true,
|
|
426
|
-
get: function () {
|
|
427
|
-
return getConfigPath;
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
Object.defineProperty(exports, 'getDependencyConfig', {
|
|
431
|
-
enumerable: true,
|
|
432
|
-
get: function () {
|
|
433
|
-
return getDependencyConfig;
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
Object.defineProperty(exports, 'getHookHandler', {
|
|
437
|
-
enumerable: true,
|
|
438
|
-
get: function () {
|
|
439
|
-
return getHookHandler;
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
Object.defineProperty(exports, 'getOrganizationName', {
|
|
443
|
-
enumerable: true,
|
|
444
|
-
get: function () {
|
|
445
|
-
return getOrganizationName;
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
Object.defineProperty(exports, 'getWorkspaceName', {
|
|
449
|
-
enumerable: true,
|
|
450
|
-
get: function () {
|
|
451
|
-
return getWorkspaceName;
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
Object.defineProperty(exports, 'isBuiltinModule', {
|
|
455
|
-
enumerable: true,
|
|
456
|
-
get: function () {
|
|
457
|
-
return isBuiltinModule;
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
Object.defineProperty(exports, 'isPlugin', {
|
|
461
|
-
enumerable: true,
|
|
462
|
-
get: function () {
|
|
463
|
-
return isPlugin;
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
Object.defineProperty(exports, 'isPluginConfig', {
|
|
467
|
-
enumerable: true,
|
|
468
|
-
get: function () {
|
|
469
|
-
return isPluginConfig;
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
Object.defineProperty(exports, 'isPluginConfigObject', {
|
|
473
|
-
enumerable: true,
|
|
474
|
-
get: function () {
|
|
475
|
-
return isPluginConfigObject;
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
Object.defineProperty(exports, 'isPluginConfigTuple', {
|
|
479
|
-
enumerable: true,
|
|
480
|
-
get: function () {
|
|
481
|
-
return isPluginConfigTuple;
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
Object.defineProperty(exports, 'isPluginHook', {
|
|
485
|
-
enumerable: true,
|
|
486
|
-
get: function () {
|
|
487
|
-
return isPluginHook;
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
Object.defineProperty(exports, 'isPluginHookField', {
|
|
491
|
-
enumerable: true,
|
|
492
|
-
get: function () {
|
|
493
|
-
return isPluginHookField;
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
Object.defineProperty(exports, 'isPluginHookFunction', {
|
|
497
|
-
enumerable: true,
|
|
498
|
-
get: function () {
|
|
499
|
-
return isPluginHookFunction;
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
Object.defineProperty(exports, 'isPluginHookObject', {
|
|
503
|
-
enumerable: true,
|
|
504
|
-
get: function () {
|
|
505
|
-
return isPluginHookObject;
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
Object.defineProperty(exports, 'isUnpluginHookField', {
|
|
509
|
-
enumerable: true,
|
|
510
|
-
get: function () {
|
|
511
|
-
return isUnpluginHookField;
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
Object.defineProperty(exports, 'isUnpluginHookKey', {
|
|
515
|
-
enumerable: true,
|
|
516
|
-
get: function () {
|
|
517
|
-
return isUnpluginHookKey;
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
Object.defineProperty(exports, 'merge', {
|
|
521
|
-
enumerable: true,
|
|
522
|
-
get: function () {
|
|
523
|
-
return merge;
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
Object.defineProperty(exports, 'mergeConfig', {
|
|
527
|
-
enumerable: true,
|
|
528
|
-
get: function () {
|
|
529
|
-
return mergeConfig;
|
|
530
|
-
}
|
|
531
|
-
});
|