@powerlines/core 0.0.12 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{types → constants}/commands.cjs +2 -3
- package/dist/constants/commands.d.cts +5 -0
- package/dist/constants/commands.d.cts.map +1 -0
- package/dist/constants/commands.d.mts +5 -0
- package/dist/constants/commands.d.mts.map +1 -0
- package/dist/{types → constants}/commands.mjs +1 -1
- package/dist/constants/commands.mjs.map +1 -0
- package/dist/{lib/constants → constants}/environments.cjs +2 -3
- package/dist/{lib/constants → constants}/environments.d.cts +1 -1
- package/dist/constants/environments.d.cts.map +1 -0
- package/dist/{lib/constants → constants}/environments.d.mts +1 -1
- package/dist/constants/environments.d.mts.map +1 -0
- package/dist/{lib/constants → constants}/environments.mjs +1 -1
- package/dist/constants/environments.mjs.map +1 -0
- package/dist/{types → constants}/fs.cjs +2 -3
- package/dist/constants/fs.d.cts +7 -0
- package/dist/constants/fs.d.cts.map +1 -0
- package/dist/constants/fs.d.mts +7 -0
- package/dist/constants/fs.d.mts.map +1 -0
- package/dist/{types → constants}/fs.mjs +1 -1
- package/dist/constants/fs.mjs.map +1 -0
- package/dist/{types → constants}/hooks.cjs +2 -3
- package/dist/constants/hooks.d.cts +5 -0
- package/dist/constants/hooks.d.cts.map +1 -0
- package/dist/constants/hooks.d.mts +5 -0
- package/dist/constants/hooks.d.mts.map +1 -0
- package/dist/{types → constants}/hooks.mjs +1 -1
- package/dist/constants/hooks.mjs.map +1 -0
- package/dist/constants/index.cjs +25 -0
- package/dist/constants/index.d.cts +7 -0
- package/dist/constants/index.d.mts +7 -0
- package/dist/constants/index.mjs +8 -0
- package/dist/{lib/constants → constants}/meta.cjs +2 -3
- package/dist/{lib/constants → constants}/meta.d.cts +1 -1
- package/dist/constants/meta.d.cts.map +1 -0
- package/dist/{lib/constants → constants}/meta.d.mts +1 -1
- package/dist/constants/meta.d.mts.map +1 -0
- package/dist/{lib/constants → constants}/meta.mjs +1 -1
- package/dist/constants/meta.mjs.map +1 -0
- package/dist/{types → constants}/plugin.cjs +23 -6
- package/dist/constants/plugin.d.cts +9 -0
- package/dist/constants/plugin.d.cts.map +1 -0
- package/dist/constants/plugin.d.mts +9 -0
- package/dist/constants/plugin.d.mts.map +1 -0
- package/dist/{types → constants}/plugin.mjs +19 -3
- package/dist/constants/plugin.mjs.map +1 -0
- package/dist/index.cjs +0 -26
- package/dist/index.d.cts +6 -8
- package/dist/index.d.mts +6 -8
- package/dist/index.mjs +1 -9
- package/dist/lib/config.cjs +1 -2
- package/dist/lib/entry.cjs +1 -2
- package/dist/lib/index.cjs +0 -10
- package/dist/lib/index.d.cts +1 -3
- package/dist/lib/index.d.mts +1 -3
- package/dist/lib/index.mjs +1 -3
- package/dist/lib/logger.cjs +1 -2
- package/dist/lib/unplugin/helpers.cjs +3 -4
- package/dist/lib/unplugin/helpers.d.cts.map +1 -1
- package/dist/lib/unplugin/helpers.d.mts.map +1 -1
- package/dist/lib/unplugin/helpers.mjs +1 -1
- package/dist/lib/unplugin/helpers.mjs.map +1 -1
- package/dist/lib/unplugin/module-resolution.cjs +1 -2
- package/dist/lib/unplugin/plugin.cjs +1 -2
- package/dist/lib/utilities/file-header.cjs +1 -2
- package/dist/lib/utilities/file-header.d.cts.map +1 -1
- package/dist/lib/utilities/file-header.d.mts.map +1 -1
- package/dist/lib/utilities/format.cjs +1 -2
- package/dist/lib/utilities/source-file.cjs +1 -2
- package/dist/lib/utilities/source-map.cjs +1 -2
- package/dist/lib/utilities/write-file.cjs +1 -2
- package/dist/plugin-base.cjs +1 -2
- package/dist/plugin-utils/build-helpers.cjs +1 -2
- package/dist/plugin-utils/build-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +1 -2
- package/dist/plugin-utils/extend.cjs +1 -2
- package/dist/plugin-utils/format-package-json.cjs +1 -2
- package/dist/plugin-utils/get-config-path.cjs +1 -2
- package/dist/plugin-utils/helpers.cjs +6 -8
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +1 -2
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +1 -2
- package/dist/plugin-utils/modules.cjs +1 -2
- package/dist/plugin-utils/paths.cjs +1 -2
- package/dist/types/commands.d.cts +2 -2
- package/dist/types/commands.d.cts.map +1 -1
- package/dist/types/commands.d.mts +2 -2
- package/dist/types/commands.d.mts.map +1 -1
- package/dist/types/config.d.cts +6 -6
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +6 -6
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +4 -4
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +4 -4
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.cts +5 -8
- package/dist/types/fs.d.cts.map +1 -1
- package/dist/types/fs.d.mts +5 -8
- package/dist/types/fs.d.mts.map +1 -1
- package/dist/types/hooks.d.cts +1 -2
- package/dist/types/hooks.d.cts.map +1 -1
- package/dist/types/hooks.d.mts +1 -2
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/index.d.mts +6 -7
- package/dist/types/plugin.d.cts +2 -4
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +2 -4
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/unplugin.d.cts +6 -8
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +6 -8
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +393 -103
- package/dist/lib/config.cjs.map +0 -1
- package/dist/lib/constants/environments.cjs.map +0 -1
- package/dist/lib/constants/environments.d.cts.map +0 -1
- package/dist/lib/constants/environments.d.mts.map +0 -1
- package/dist/lib/constants/environments.mjs.map +0 -1
- package/dist/lib/constants/index.cjs +0 -11
- package/dist/lib/constants/index.d.cts +0 -3
- package/dist/lib/constants/index.d.mts +0 -3
- package/dist/lib/constants/index.mjs +0 -4
- package/dist/lib/constants/meta.cjs.map +0 -1
- package/dist/lib/constants/meta.d.cts.map +0 -1
- package/dist/lib/constants/meta.d.mts.map +0 -1
- package/dist/lib/constants/meta.mjs.map +0 -1
- package/dist/lib/entry.cjs.map +0 -1
- package/dist/lib/logger.cjs.map +0 -1
- package/dist/lib/unplugin/helpers.cjs.map +0 -1
- package/dist/lib/unplugin/module-resolution.cjs.map +0 -1
- package/dist/lib/unplugin/plugin.cjs.map +0 -1
- package/dist/lib/utilities/file-header.cjs.map +0 -1
- package/dist/lib/utilities/format.cjs.map +0 -1
- package/dist/lib/utilities/source-file.cjs.map +0 -1
- package/dist/lib/utilities/source-map.cjs.map +0 -1
- package/dist/lib/utilities/write-file.cjs.map +0 -1
- package/dist/plugin-base.cjs.map +0 -1
- package/dist/plugin-utils/build-helpers.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/extend.cjs.map +0 -1
- package/dist/plugin-utils/format-package-json.cjs.map +0 -1
- package/dist/plugin-utils/get-config-path.cjs.map +0 -1
- package/dist/plugin-utils/helpers.cjs.map +0 -1
- package/dist/plugin-utils/merge.cjs.map +0 -1
- package/dist/plugin-utils/modules.cjs.map +0 -1
- package/dist/plugin-utils/paths.cjs.map +0 -1
- package/dist/types/api.cjs +0 -0
- package/dist/types/api.mjs +0 -1
- package/dist/types/commands.cjs.map +0 -1
- package/dist/types/commands.mjs.map +0 -1
- package/dist/types/config.cjs +0 -0
- package/dist/types/config.mjs +0 -1
- package/dist/types/context.cjs +0 -0
- package/dist/types/context.mjs +0 -1
- package/dist/types/fs.cjs.map +0 -1
- package/dist/types/fs.mjs.map +0 -1
- package/dist/types/hooks.cjs.map +0 -1
- package/dist/types/hooks.mjs.map +0 -1
- package/dist/types/index.cjs +0 -16
- package/dist/types/index.d.cts +0 -10
- package/dist/types/index.mjs +0 -7
- package/dist/types/plugin.cjs.map +0 -1
- package/dist/types/plugin.mjs.map +0 -1
- package/dist/types/tsconfig.cjs +0 -0
- package/dist/types/tsconfig.mjs +0 -1
- package/dist/types/unplugin.cjs +0 -24
- package/dist/types/unplugin.cjs.map +0 -1
- package/dist/types/unplugin.mjs +0 -22
- package/dist/types/unplugin.mjs.map +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./environments.mjs";
|
|
2
|
-
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.mjs";
|
|
3
|
-
|
|
4
|
-
export { CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.cjs","names":[],"sources":["../../../src/lib/constants/meta.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\nexport const ROOT_HASH_LENGTH = 45;\nexport const CACHE_HASH_LENGTH = 62;\n"],"mappings":";;AAkBA,MAAa,mBAAmB;AAChC,MAAa,oBAAoB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.cts","names":[],"sources":["../../../src/lib/constants/meta.ts"],"sourcesContent":[],"mappings":";cAkBa,gBAAA;AAAA,cACA,iBAAA,GADgB,EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.mts","names":[],"sources":["../../../src/lib/constants/meta.ts"],"sourcesContent":[],"mappings":";cAkBa,gBAAA;AAAA,cACA,iBAAA,GADgB,EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/lib/constants/meta.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\nexport const ROOT_HASH_LENGTH = 45;\nexport const CACHE_HASH_LENGTH = 62;\n"],"mappings":";AAkBA,MAAa,mBAAmB;AAChC,MAAa,oBAAoB"}
|
package/dist/lib/entry.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.cjs","names":["replacePathTokens","typeDefinition: TypeDefinition"],"sources":["../../src/lib/entry.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport { BaseConfig } from \"../types\";\nimport { ResolvedEntryTypeDefinition } from \"../types/config\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\"\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n )\n ),\n joinPaths(context.config.root, \"src\")\n ),\n context.config.root\n ),\n \"src\"\n )\n );\n}\n\nexport function resolveInput(\n context: Context,\n typeDefinition: TypeDefinition,\n input?: TypeDefinitionParameter,\n output?: string\n): ResolvedEntryTypeDefinition {\n return {\n ...typeDefinition,\n input: isSetString(input) ? { file: String(input) } : typeDefinition,\n output: output || resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveInputs(\n context: Context,\n typeDefinitions:\n | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n (isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(\n context,\n typeDefinition.file\n );\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (await context.fs.isFile(filePath)) {\n return resolveInput(\n context,\n {\n file: replacePath(filePath, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n );\n }\n\n return (\n await context.fs.glob(\n appendPath(filePath, context.workspaceConfig.workspaceRoot)\n )\n ).map(file =>\n resolveInput(\n context,\n {\n file: replacePath(file, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n )\n );\n })\n .flat()\n .filter(Boolean)\n )\n ).flat();\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveInputsSync(\n context: Context,\n typeDefinitions:\n | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): ResolvedEntryTypeDefinition[] {\n return (\n isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (context.fs.isFileSync(filePath)) {\n return resolveInput(context, {\n file: appendPath(filePath, context.workspaceConfig.workspaceRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs\n .globSync(appendPath(filePath, context.workspaceConfig.workspaceRoot))\n .map(file =>\n resolveInput(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(entry: any): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Get unique inputs from the provided list.\n *\n * @param inputs - The entry points to process.\n * @returns An array of unique inputs (by file path or content hash).\n */\nexport function getUniqueInputs(\n inputs: BaseConfig[\"input\"] = []\n): BaseConfig[\"input\"] {\n return isObject(inputs)\n ? inputs\n : getUniqueBy(toArray(inputs), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"],"mappings":"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"}
|
package/dist/lib/logger.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.cjs","names":["LogLevelLabel","noop"],"sources":["../../src/lib/logger.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 { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { noop } from \"@stryke/helpers/noop\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport chalk from \"chalk\";\nimport type { LogFn, WorkspaceConfig } from \"../types\";\n\nexport interface CreateLogOptions {\n name?: string;\n logLevel?: LogLevelLabel | null;\n customLogger?: LogFn;\n colors?: WorkspaceConfig[\"colors\"];\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function.\n * @returns A logging function.\n */\nexport const createLog = (\n name: string | null,\n options: CreateLogOptions = {}\n): LogFn => {\n const logLevel =\n options.logLevel === null\n ? LogLevelLabel.SILENT\n : options.logLevel || LogLevelLabel.INFO;\n if (logLevel === LogLevelLabel.SILENT) {\n return noop;\n }\n\n if (options.customLogger) {\n return options.customLogger;\n }\n\n return (type: LogLevelLabel, ...args: string[]) =>\n getLogFn(getLogLevel(type), {\n ...options,\n logLevel\n })(\n `${chalk.bold.hex(\n getColor(\"brand\", options as Parameters<typeof getColor>[1])\n )(\n `${name ? kebabCase(name) : \"\"}${options.name ? `${name ? chalk.gray(\" > \") : \"\"}${kebabCase(options.name)}` : \"\"}${chalk.gray(\" > \")}`\n )}${args.join(\" \")} `.trim()\n );\n};\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\nexport const extendLog = (logFn: LogFn, name: string): LogFn => {\n return (type: LogLevelLabel, ...args: string[]) =>\n logFn(\n type,\n ` ${chalk.inverse.hex(\n BADGE_COLORS[\n name\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n )(` ${titleCase(name)} `)} ${args.join(\" \")} `\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,MAAa,aACX,MACA,UAA4B,EAAE,KACpB;CACV,MAAM,WACJ,QAAQ,aAAa,OACjBA,kDAAc,SACd,QAAQ,YAAYA,kDAAc;AACxC,KAAI,aAAaA,kDAAc,OAC7B,QAAOC;AAGT,KAAI,QAAQ,aACV,QAAO,QAAQ;AAGjB,SAAQ,MAAqB,GAAG,kHACT,KAAK,EAAE;EAC1B,GAAG;EACH;EACD,CAAC,CACA,GAAG,cAAM,KAAK,iEACH,SAAS,QAA0C,CAC7D,CACC,GAAG,wDAAiB,KAAK,GAAG,KAAK,QAAQ,OAAO,GAAG,OAAO,cAAM,KAAK,MAAM,GAAG,sDAAe,QAAQ,KAAK,KAAK,KAAK,cAAM,KAAK,MAAM,GACtI,GAAG,KAAK,KAAK,IAAI,CAAC,GAAG,MAAM,CAC7B;;AAGL,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,aAAa,OAAc,SAAwB;AAC9D,SAAQ,MAAqB,GAAG,SAC9B,MACE,MACA,IAAI,cAAM,QAAQ,IAChB,aACE,KACG,MAAM,GAAG,CACT,KAAI,SAAQ,KAAK,WAAW,EAAE,CAAC,CAC/B,QAAQ,KAAK,aAAa,MAAM,UAAU,EAAE,GAAG,aAAa,WAC5D,aAAa,GACnB,CAAC,qDAAc,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,GAC9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","names":["UNPLUGIN_BUILDER_VARIANTS"],"sources":["../../../src/lib/unplugin/helpers.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport { UnpluginBuildContext } from \"unplugin\";\nimport { UnresolvedContext } from \"../../types/context\";\nimport {\n UNPLUGIN_BUILDER_VARIANTS,\n UnpluginBuilderVariant\n} from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,SAAgB,gBAGd,UAAqB,UAA4C;AACjE,uBAAY,UAAU,SAAS;;;;;;;;AASjC,SAAgB,yBACd,KAC+B;AAC/B,4DACc,IAAI,IAChBA,iDAA0B,SAAS,IAA8B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.cjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 { LoadResult } from \"rollup\";\nimport type {\n ExternalIdResult,\n HookFnMap,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends PluginContext = PluginContext\n>(context: TContext): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id\n );\n }\n\n return {\n resolveId,\n load\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAwCA,SAAgB,wCAEd,SAA0D;CAC1D,MAAM,MAAM;CAEZ,eAAe,UAEb,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;EACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,QAAQ,IAAI,UAAU,KAAK;AAC9C,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;;CAGH,eAAe,KAEb,IACwC;EACxC,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,KAAK,GAAG;AAC3B,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;;AAGH,QAAO;EACL;EACA;EACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["extendLog","LogLevelLabel","createUnpluginModuleResolutionFunctions","transformed: TransformResult | string","result: TransformResult | string | undefined","combineContexts","getString"],"sources":["../../../src/lib/unplugin/plugin.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport { createUnpluginModuleResolutionFunctions } from \"./module-resolution\";\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(context: TContext, name = \"unplugin\"): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n name = \"unplugin\"\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,SAAgB,uBAEd,SAAmB,OAAO,YAAuC;CACjE,MAAM,MAAM;AACZ,4BAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAMA,6BAAU,IAAI,KAAK,KAAK;AACpC,MACEC,kDAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,oDAAa,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjBC,+EAAkD,QAAQ;AAE5D,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,+DAAwB,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACF;WACM,OAAO;AACd,OAAID,kDAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM;;;;;;;;;;AAWZ,SAAgB,eACd,SACA,OAAO,YACoB;CAC3B,MAAM,MAAM;AACZ,4BAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAMD,6BAAU,IAAI,KAAK,KAAK;AACpC,MACEC,kDAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,oDAAa,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjBC,+EAAkD,QAAQ;GAE5D,eAAe,aAAuC;AACpD,QAAID,kDAAc,OAAO,sCAAsC;AAE/D,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAIE,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAMC,SACJ,MAAM,KAAK,QAAQ,MAAMC,6CAAgB,KAAK,KAAK,EAAE,CACnDC,4CAAU,YAAY,EACtB,GACD,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAIL,kDAAc,OAAO,uCAAuC;AAEhE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAIA,kDAAc,OAAO,0CAA0C;AAEnE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,+DAAwB,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAIA,kDAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-header.cjs","names":[],"sources":["../../../src/lib/utilities/file-header.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 { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\nexport function getBaseFileHeader(context: Context): string {\n return `\n// Generated with ${titleCase(context.config.framework)}\n// Note: Do not edit this file manually - it will be overwritten automatically\n`;\n}\n\nexport function getFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getBaseFileHeader(context)}\n\n`;\n}\n"],"mappings":";;;;AA0BA,SAAgB,kBAAkB,SAA0B;AAC1D,QAAO;qEACqB,QAAQ,OAAO,UAAU,CAAC;;;;AAKxD,SAAgB,cACd,SACA,UAA6B,EAAE,EACvB;CACR,MAAM,EAAE,YAAY,MAAM,iBAAiB,UAAU;AAErD,QAAO;;EAEP,iBAAiB,uBAAuB,KAAK,YAAY,OAAO,UAAU,MAAM,KAAK;EACrF,kBAAkB,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format.cjs","names":[],"sources":["../../../src/lib/utilities/format.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { format as prettier, resolveConfig } from \"prettier\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n (isParentPath(\n path,\n appendPath(\n context.config.output.outputPath,\n context.workspaceConfig.workspaceRoot\n )\n ) ||\n isParentPath(\n path,\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n )\n ))\n ) {\n return data;\n }\n\n let code = data;\n const resolvedConfig = await resolveConfig(path);\n if (resolvedConfig) {\n code = await prettier(data, {\n absolutePath: path,\n ...resolvedConfig\n });\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !isParentPath(\n path,\n appendPath(\n context.config.output.outputPath,\n context.workspaceConfig.workspaceRoot\n )\n ) &&\n !isParentPath(\n path,\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n )\n )\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n !isParentPath(\n file,\n appendPath(\n context.config.output.outputPath,\n context.workspaceConfig.workspaceRoot\n )\n ) &&\n !isParentPath(\n file,\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n )\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,eAAsB,OACpB,SACA,MACA,MACA,QAAQ,OACS;AACjB,KACE,CAAC,yDAEC,2CAEE,QAAQ,OAAO,OAAO,YACtB,QAAQ,gBAAgB,cACzB,CACF,mDAEG,2CAEE,QAAQ,OAAO,OAAO,WACtB,QAAQ,gBAAgB,cACzB,CACF,EAEH,QAAO;CAGT,IAAI,OAAO;CACX,MAAM,iBAAiB,kCAAoB,KAAK;AAChD,KAAI,eACF,QAAO,2BAAe,MAAM;EAC1B,cAAc;EACd,GAAG;EACJ,CAAC;AAGJ,QAAO;;;;;;;;;AAUT,eAAsB,aAAa,SAAkB,MAAc;AACjE,KACE,gDACE,2CAEE,QAAQ,OAAO,OAAO,YACtB,QAAQ,gBAAgB,cACzB,CACF,IACD,gDACE,2CAEE,QAAQ,OAAO,OAAO,WACtB,QAAQ,gBAAgB,cACzB,CACF,CAED,OAAM,QAAQ,YACX,4CAAgB,KAAK,EAAE,IAAI,OAAM,SAAQ;AACxC,MACE,gDACE,2CAEE,QAAQ,OAAO,OAAO,YACtB,QAAQ,gBAAgB,cACzB,CACF,IACD,gDACE,2CAEE,QAAQ,OAAO,OAAO,WACtB,QAAQ,gBAAgB,cACzB,CACF,EACD;GACA,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,KAAK;AACxC,OAAI,MAAM;IACR,MAAM,YAAY,MAAM,OAAO,SAAS,MAAM,KAAK;AAEnD,WAAO,QAAQ,GAAG,MAAM,MAAM,UAAU;;;GAG5C,CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-file.cjs","names":["MagicString"],"sources":["../../../src/lib/utilities/source-file.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 { readFileIfExistingSync } from \"@stryke/fs/read-file\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport MagicString from \"magic-string\";\nimport { TransformResult } from \"unplugin\";\nimport { SourceFile } from \"../../types/context\";\n\n/**\n * Get the string from the source.\n *\n * @param code - The source string or magic string.\n * @returns The source string.\n */\nexport function getString(\n code: string | MagicString | TransformResult\n): string {\n if (!code) {\n return \"\";\n }\n\n if (isString(code)) {\n return code;\n }\n\n if (isSetObject(code) && \"code\" in code) {\n return code.code;\n }\n\n return code.toString();\n}\n\n/**\n * Get the magic string.\n *\n * @param code - The source string or magic string.\n * @returns The magic string.\n */\nexport function getMagicString(code: string | MagicString): MagicString {\n if (isString(code)) {\n return new MagicString(code);\n }\n\n return code;\n}\n\n/**\n * Get the source file.\n *\n * @param code - The source code.\n * @param id - The name of the file.\n * @returns The source file.\n */\nexport function getSourceFile(\n code: string | MagicString,\n id: string\n): SourceFile {\n const content = code ?? readFileIfExistingSync(id);\n\n return {\n id,\n code: getMagicString(content),\n env: []\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,UACd,MACQ;AACR,KAAI,CAAC,KACH,QAAO;AAGT,kDAAa,KAAK,CAChB,QAAO;AAGT,yDAAgB,KAAK,IAAI,UAAU,KACjC,QAAO,KAAK;AAGd,QAAO,KAAK,UAAU;;;;;;;;AASxB,SAAgB,eAAe,MAAyC;AACtE,kDAAa,KAAK,CAChB,QAAO,IAAIA,qBAAY,KAAK;AAG9B,QAAO;;;;;;;;;AAUT,SAAgB,cACd,MACA,IACY;AAGZ,QAAO;EACL;EACA,MAAM,eAJQ,0DAA+B,GAAG,CAInB;EAC7B,KAAK,EAAE;EACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-map.cjs","names":["Diff"],"sources":["../../../src/lib/utilities/source-map.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 Diff from \"diff-match-patch\";\nimport type MagicString from \"magic-string\";\nimport type { TransformResult } from \"../../types/context\";\n\nconst dmp = new Diff();\n\n/**\n * Generate code with source map.\n *\n * @param code - The source code.\n * @param id - The file name.\n * @param transpiled - The transpiled code.\n * @returns The compiler result.\n */\nexport function generateSourceMap(\n code: MagicString,\n id: string,\n transpiled?: string\n): TransformResult | undefined {\n if (!transpiled) {\n return;\n }\n\n const diff = dmp.diff_main(code.toString(), transpiled);\n dmp.diff_cleanupSemantic(diff);\n\n let offset = 0;\n\n for (let index = 0; index < diff.length; index++) {\n if (diff[index]) {\n const [type, text] = diff[index]!;\n const textLength = text.length;\n\n switch (type) {\n case 0: {\n offset += textLength;\n break;\n }\n case 1: {\n code.prependLeft(offset, text);\n break;\n }\n case -1: {\n const next = diff.at(index + 1);\n\n if (next && next[0] === 1) {\n const replaceText = next[1];\n\n const firstNonWhitespaceIndexOfText = text.search(/\\S/);\n const offsetStart =\n offset + Math.max(firstNonWhitespaceIndexOfText, 0);\n\n code.update(offsetStart, offset + textLength, replaceText);\n index += 1;\n } else {\n code.remove(offset, offset + textLength);\n }\n\n offset += textLength;\n\n break;\n }\n }\n }\n }\n\n if (!code.hasChanged()) {\n return;\n }\n\n return {\n code: code.toString(),\n map: code.generateMap({\n source: id,\n file: `${id}.map`,\n includeContent: true\n })\n };\n}\n"],"mappings":";;;;;AAsBA,MAAM,MAAM,IAAIA,0BAAM;;;;;;;;;AAUtB,SAAgB,kBACd,MACA,IACA,YAC6B;AAC7B,KAAI,CAAC,WACH;CAGF,MAAM,OAAO,IAAI,UAAU,KAAK,UAAU,EAAE,WAAW;AACvD,KAAI,qBAAqB,KAAK;CAE9B,IAAI,SAAS;AAEb,MAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,QACvC,KAAI,KAAK,QAAQ;EACf,MAAM,CAAC,MAAM,QAAQ,KAAK;EAC1B,MAAM,aAAa,KAAK;AAExB,UAAQ,MAAR;GACE,KAAK;AACH,cAAU;AACV;GAEF,KAAK;AACH,SAAK,YAAY,QAAQ,KAAK;AAC9B;GAEF,KAAK,IAAI;IACP,MAAM,OAAO,KAAK,GAAG,QAAQ,EAAE;AAE/B,QAAI,QAAQ,KAAK,OAAO,GAAG;KACzB,MAAM,cAAc,KAAK;KAEzB,MAAM,gCAAgC,KAAK,OAAO,KAAK;KACvD,MAAM,cACJ,SAAS,KAAK,IAAI,+BAA+B,EAAE;AAErD,UAAK,OAAO,aAAa,SAAS,YAAY,YAAY;AAC1D,cAAS;UAET,MAAK,OAAO,QAAQ,SAAS,WAAW;AAG1C,cAAU;AAEV;;;;AAMR,KAAI,CAAC,KAAK,YAAY,CACpB;AAGF,QAAO;EACL,MAAM,KAAK,UAAU;EACrB,KAAK,KAAK,YAAY;GACpB,QAAQ;GACR,MAAM,GAAG,GAAG;GACZ,gBAAgB;GACjB,CAAC;EACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.cjs","names":["LogLevelLabel"],"sources":["../../../src/lib/utilities/write-file.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { writeFile as writeFileBase } from \"@stryke/fs/write-file\";\nimport { format, resolveConfig } from \"prettier\";\nimport type { LogFn } from \"../../types/config\";\n\n/**\n * Writes and formats a file to the file system\n *\n * @param log - The logging function to use for logging errors\n * @param filepath - The file path to write the file\n * @param content - The content to write to the file\n * @param skipFormat - Should the plugin skip formatting the `content` string with Prettier\n */\nexport async function writeFile(\n log: LogFn,\n filepath: string,\n content: string,\n skipFormat = false\n) {\n try {\n if (skipFormat) {\n await writeFileBase(filepath, content);\n } else {\n const config = await resolveConfig(filepath);\n const formatted = await format(content, {\n ...(config ?? {}),\n filepath\n });\n\n await writeFileBase(filepath, formatted || \"\");\n }\n } catch (error) {\n log(\n LogLevelLabel.ERROR,\n `Failed to write file ${filepath} to disk \\n${(error as Error)?.message ? (error as Error).message : \"\"}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,eAAsB,UACpB,KACA,UACA,SACA,aAAa,OACb;AACA,KAAI;AACF,MAAI,WACF,6CAAoB,UAAU,QAAQ;MAQtC,6CAAoB,UALF,2BAAa,SAAS;GACtC,GAFa,kCAAoB,SAAS,IAE5B,EAAE;GAChB;GACD,CAAC,IAEyC,GAAG;UAEzC,OAAO;AACd,MACEA,kDAAc,OACd,wBAAwB,SAAS,aAAc,OAAiB,UAAW,MAAgB,UAAU,KACtG"}
|
package/dist/plugin-base.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-base.cjs","names":["formatPackageJson"],"sources":["../src/plugin-base.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 { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { build, UserConfig as BuildOptions } from \"tsdown\";\nimport { formatPackageJson } from \"./plugin-utils/format-package-json\";\nimport { ResolvedConfig, UserConfig } from \"./types/config\";\nimport { PluginContext } from \"./types/context\";\nimport { Plugin } from \"./types/plugin\";\n\nexport interface BasePluginOptions {\n tsdown?: Partial<BuildOptions>;\n}\n\nexport type BasePluginUserConfig = UserConfig & {\n tsdown: BasePluginOptions;\n};\n\nexport type BasePluginResolvedConfig = ResolvedConfig & {\n tsdown: Required<BasePluginOptions>;\n};\n\nexport type BasePluginContext<\n TResolvedConfig extends BasePluginResolvedConfig = BasePluginResolvedConfig\n> = PluginContext<TResolvedConfig>;\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends BasePluginContext = BasePluginContext>(\n options: BasePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"base\",\n config() {\n return {\n projectType: \"library\",\n input: [\"src/index.ts\", \"src/types/*.ts\", \"src/helpers/*.ts\"],\n output: {\n format: [\"cjs\", \"esm\"],\n dts: false\n },\n platform: \"node\",\n tsdown: {\n format: [\"cjs\", \"esm\"],\n logLevel: \"silent\",\n target: \"node22\",\n cjsDefault: true,\n treeshake: true,\n exports: {\n all: true\n },\n fixedExtension: true,\n nodeProtocol: true,\n minify: false,\n dts: true,\n shims: true,\n outDir: \"dist\",\n clean: true,\n external: [\"powerlines\", /^powerlines\\/.*$/, /^@powerlines\\//],\n skipNodeModulesBundle: true,\n unbundle: false,\n ...options.tsdown\n }\n };\n },\n async build() {\n await build({\n name: this.config.name,\n cwd: appendPath(this.config.root, this.workspaceConfig.workspaceRoot),\n entry:\n this.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n this.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(this.config.root, \"src\")\n ),\n this.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n platform: this.config.platform,\n tsconfig: this.tsconfig.tsconfigFilePath,\n outDir: this.config.output.buildPath,\n ...this.config.tsdown\n });\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AA8CA,MAAa,UACX,UAA6B,EAAE,KACV;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,aAAa;IACb,OAAO;KAAC;KAAgB;KAAkB;KAAmB;IAC7D,QAAQ;KACN,QAAQ,CAAC,OAAO,MAAM;KACtB,KAAK;KACN;IACD,UAAU;IACV,QAAQ;KACN,QAAQ,CAAC,OAAO,MAAM;KACtB,UAAU;KACV,QAAQ;KACR,YAAY;KACZ,WAAW;KACX,SAAS,EACP,KAAK,MACN;KACD,gBAAgB;KAChB,cAAc;KACd,QAAQ;KACR,KAAK;KACL,OAAO;KACP,QAAQ;KACR,OAAO;KACP,UAAU;MAAC;MAAc;MAAoB;MAAiB;KAC9D,uBAAuB;KACvB,UAAU;KACV,GAAG,QAAQ;KACZ;IACF;;EAEH,MAAM,QAAQ;AACZ,2BAAY;IACV,MAAM,KAAK,OAAO;IAClB,0CAAgB,KAAK,OAAO,MAAM,KAAK,gBAAgB,cAAc;IACrE,OACE,KAAK,MAAM,QAAO,UAAS,OAAO,KAAK,CAAC,SAAS,IAC7C,OAAO,YACL,KAAK,MACF,QAAO,UAAS,OAAO,KAAK,CAC5B,KAAI,UAAS,CACZ,MAAM,oIAIE,MAAM,wCACI,KAAK,OAAO,MAAM,MAAM,CACnC,EACD,KAAK,UACN,CACF,EACH,MAAM,KACP,CAAC,CACL,GACD,mCAEI,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,OACA,UACD,oCAEC,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,OACA,WACD,CACF;IACP,UAAU,KAAK,OAAO;IACtB,UAAU,KAAK,SAAS;IACxB,QAAQ,KAAK,OAAO,OAAO;IAC3B,GAAG,KAAK,OAAO;IAChB,CAAC;AAEF,SAAMA,2DAAkB,KAAK;;EAEhC;;AAGH,0BAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-helpers.cjs","names":[],"sources":["../../src/plugin-utils/build-helpers.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"],"mappings":";;;;;;;;;;;;;AAoCA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,+FACI,QAAQ,OAAO,QAAQ,WAAW,CAAC,OAAO,QAAQ,SAAS,CACpE;CAED,MAAM,6FACI,QAAQ,OAAO,QAAQ,SAAS,CAAC,QACtC,KAAK,QAAQ;AACZ,mDAAa,IAAI,EAAE;AACjB,OACE,WAAW,MACT,uDAAkB,MAAM,IAAI,MAAM,WAAW,IAAI,OAClD,CAED,QAAO;GAGT,MAAM,SAAS,WAAW,QACxB,8DAAqB,MAAM,IAAI,IAAI,KAAK,MAAM,CAC/C;AACD,OAAI,OAAO,SAAS,GAAG;AACrB,QAAI,KACF,IAAI,OACF,OAAO,QACJ,OAAe,UACd,mDACW,MAAM,GAAG,MAAM,SAAS,IAAI,MAAM,GAC5C,GAAG,SACN,GAAG,IAAI,OACJ,QAAQ,UAAU,KAAK,CACvB,QAAQ,QAAQ,IAAI,CACpB,QAAQ,OAAO,GAAG,CAClB,QAAQ,SAAS,GAAG,CAAC,KACzB,CACF,CACF;AACD,WAAO;;;AAIX,MAAI,KAAK,IAAI;AACb,SAAO;IAET,EAAE,CACH,CACF;AAED,QAAO;EACL,UAAU,SAAS,WAAW,IAAI,SAAY;EAC9C,YAAY,WAAW,WAAW,IAAI,SAAY;EACnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.cjs","names":["result: string | undefined"],"sources":["../../src/plugin-utils/context-helpers.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 { 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"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,oBACd,SACoB;CACpB,IAAIA;AACJ,yDAAgB,QAAQ,gBAAgB,aAAa,CACnD,UAAS,QAAQ,gBAAgB,aAAa;AAGhD,KAAI,CAAC,8DAAsB,QAAQ,gBAAgB,aAAa,CAC9D,UAAS,QAAQ,gBAAgB;AAGnC,KACE,CAAC,UACD,MAAM,QAAQ,QAAQ,YAAY,YAAY,IAC9C,QAAQ,YAAY,YAAY,SAAS,GACzC;AACA,0DAAgB,QAAQ,YAAY,YAAY,GAAG,CACjD,UAAU,QAAQ,YAAY,YAAY,GAAwB;AAGpE,MAAI,CAAC,8DAAsB,QAAQ,YAAY,YAAY,GAAG,CAC5D,UAAS,QAAQ,YAAY,YAAY;;AAI7C,KACE,CAAC,UACD,MAAM,QAAQ,QAAQ,YAAY,OAAO,IACzC,QAAQ,YAAY,OAAO,SAAS,GACpC;AACA,0DAAgB,QAAQ,YAAY,OAAO,GAAG,CAC5C,UAAU,QAAQ,YAAY,OAAO,GAAwB;AAG/D,MAAI,CAAC,8DAAsB,QAAQ,YAAY,OAAO,GAAG,CACvD,UAAS,QAAQ,YAAY,OAAO;;AAIxC,KACE,CAAC,UACD,MAAM,QAAQ,QAAQ,YAAY,aAAa,IAC/C,QAAQ,YAAY,aAAa,SAAS,GAC1C;AACA,0DAAgB,QAAQ,YAAY,aAAa,GAAG,CAClD,UAAU,QAAQ,YAAY,aAAa,GAAwB;AAGrE,MAAI,CAAC,8DAAsB,QAAQ,YAAY,aAAa,GAAG,CAC7D,UAAS,QAAQ,YAAY,aAAa;;AAI9C,KAAI,CAAC,8DAAsB,QAAQ,YAAY,UAAU,CACvD,UAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,GAAG;AAG1D,KAAI,CAAC,8DAAsB,QAAQ,YAAY,KAAK,CAClD,UAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAG1E,QAAO;;;;;;;;AAST,SAAgB,iBACd,SACoB;CACpB,IAAIA;AACJ,yDAAgB,QAAQ,gBAAgB,KAAK,CAC3C,UAAS,QAAQ,gBAAgB;AAGnC,KAAI,CAAC,8DAAsB,QAAQ,gBAAgB,UAAU,CAC3D,UAAS,QAAQ,gBAAgB,UAAU,QAAQ,MAAM,GAAG;AAG9D,KAAI,CAAC,8DAAsB,QAAQ,YAAY,UAAU,CACvD,UAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,GAAG;AAG1D,KAAI,CAAC,8DAAsB,QAAQ,YAAY,KAAK,CAClD,UAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAG1E,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extend.cjs","names":["merge"],"sources":["../../src/plugin-utils/extend.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 { 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"],"mappings":";;;;;;AA8DA,SAAgB,OACd,QACA,WACmD;AACnD,sDAAe,OAAO,EAAE;AACtB,uDAAe,UAAU,CACvB,QAAO,OAAO,YAAiB;GAC7B,MAAM,sDAAuB,MAAM,QAAQ,QAAQ,OAAO,QAAQ,CAAC,CAAC;GACpE,MAAM,yDACJ,MAAM,QAAQ,QAAQ,UAAU,QAAQ,CAAC,CAC1C;AAED,UAAO,aACJ,KAAI,MAAK,gBAAgB,KAAI,MAAKA,iCAAM,GAAG,EAAE,CAAqB,CAAC,CACnE,MAAM;;AAIb,SAAO,OAAO,YAAiB;AAG7B,iDAFuB,MAAM,QAAQ,QAAQ,OAAO,QAAQ,CAAC,CAAC,CAEhD,KAAI,MAAKA,iCAAM,GAAG,UAAU,CAAqB;;6DAE7C,UAAU,CAC9B,QAAO,OAAO,YAAiB;AAG7B,gDAFuB,MAAM,QAAQ,QAAQ,UAAU,QAAQ,CAAC,CAAC,CAG9D,KAAI,6CAAa,OAAO,CAAC,KAAI,MAAKA,iCAAM,GAAG,EAAE,CAAqB,CAAC,CACnE,MAAM;;AAIb,+CAAe,OAAO,CAAC,KAAI,MAAKA,iCAAM,GAAG,UAAU,CAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-package-json.cjs","names":["format"],"sources":["../../src/plugin-utils/format-package-json.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 { 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"],"mappings":";;;;;;;;;;;AA4BA,eAAsB,kBAAkB,SAAkB;CACxD,MAAM,oDACJ,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,eACD;CAED,MAAM,kBAAkB,MAAM,QAAQ,GAAG,KAAK,gBAAgB;AAC9D,yDAAgB,gBAAgB,CAC9B,OAAM,QAAQ,GAAG,MACf,iBACA,MAAMA,oCAAO,SAAS,iBAAiB,gBAAgB,CACxD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-config-path.cjs","names":[],"sources":["../../src/plugin-utils/get-config-path.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 { 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"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","names":["PLUGIN_HOOKS_FIELDS","BUILDER_VARIANTS","UNPLUGIN_BUILDER_VARIANTS","invalidItems: string[]"],"sources":["../../src/plugin-utils/helpers.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 { 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 PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n ResolvedConfig\n} from \"../types/config\";\nimport { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport {\n HookFields,\n PluginHooksListItem,\n UnpluginHooksListItem\n} from \"../types/hooks\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport {\n BUILDER_VARIANTS,\n UNPLUGIN_BUILDER_VARIANTS,\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"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.cjs","names":["isPluginHook","getHookHandler"],"sources":["../../src/plugin-utils/merge.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport { PartialPlugin, ResolvedConfig } from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\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"],"mappings":";;;;;;;;AAqCA,MAAM,oCAA0B,KAAK,KAAK,UAAU;AAClD,KAAIA,0CAAa,IAAI,KAAK,IAAIA,0CAAa,MAAM,EAAE;AACjD,MAAI,OAAO;GACT,GAAG,IAAI;GACP,GAAG;GACH,SAAS,OAAO,GAAG,WAAkB;IACnC,MAAM,CAAC,SAAS,WAAW,MAAM,QAAQ,IAAI,CAE1CC,4CAAe,IAAI,KAAK,CAAS,GAAG,OAAO,EAE3CA,4CAAe,MAAM,CAAS,GAAG,OAAO,CAC1C,CAAC;AAEF,WAAO,WAAW,4BAAe,SAAS,QAAQ,GAAG,WAAW;;GAEnE;AACD,SAAO;;AAGT,QAAO;EACP;;;;;;;;AASF,SAAgB,MACd,SACA,SACuD;AACvD,QAAO,YAAY,SAAS,QAAQ;;;;;;;;;;;;;;;;;;AAuBtC,MAAa,oCAA0B,KAAK,KAAK,UAAU;AACzD,kDAAa,IAAI,KAAK,iDAAa,MAAM,EAAE;AACzC,0DAAgB,MAAM,CACpB,KAAI,OAAO;AAGb,SAAO;;AAGT,QAAO;EACP"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.cjs","names":["prefix: string"],"sources":["../../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 { 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":";;;;;;;;;AA2BA,SAAgB,gBAAgB,SAAkB,YAA6B;CAC7E,MAAMA,SAAiB,QAAQ,QAAQ,aAAa;AAEpD,QACE,WAAW,WAAW,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,GAAG,IACrD,OAAO,KAAK,QAAQ,GAAG,SAAS,CAC7B,QAAO,QAAO,QAAQ,GAAG,SAAS,MAAM,SAAS,UAAU,CAC3D,SAAS,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.cjs","names":[],"sources":["../../src/plugin-utils/paths.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 { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{workspaceRoot}` - The root directory of the workspace.\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `./src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{buildPath}` - The configured distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n return path\n .replaceAll(\"{workspaceRoot}\", context.workspaceConfig.workspaceRoot)\n .replaceAll(\"{root}\", context.config.root)\n .replaceAll(\"{projectRoot}\", context.config.root)\n .replaceAll(\"{sourceRoot}\", joinPaths(context.config.root, \"src\"))\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\"{outputPath}\", context.config.output.outputPath)\n .replaceAll(\"{buildPath}\", context.config.output.buildPath)\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.workspaceConfig.workspaceRoot)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,kBACd,SACA,MAC4D;AAC5D,KAAI,CAAC,KACH,QAAO;AAGT,QAAO,KACJ,WAAW,mBAAmB,QAAQ,gBAAgB,cAAc,CACpE,WAAW,UAAU,QAAQ,OAAO,KAAK,CACzC,WAAW,iBAAiB,QAAQ,OAAO,KAAK,CAChD,WAAW,kDAA0B,QAAQ,OAAO,MAAM,MAAM,CAAC,CACjE,WAAW,oBAAoB,QAAQ,eAAe,CACtD,WAAW,eAAe,QAAQ,UAAU,CAC5C,WAAW,cAAc,QAAQ,SAAS,CAC1C,WAAW,aAAa,QAAQ,SAAS,IAAI,CAC7C,WAAW,cAAc,QAAQ,SAAS,KAAK,CAC/C,WAAW,gBAAgB,QAAQ,SAAS,OAAO,CACnD,WAAW,gBAAgB,QAAQ,OAAO,OAAO,WAAW,CAC5D,WAAW,eAAe,QAAQ,OAAO,OAAO,UAAU,CAC1D,WACC,0DACY,QAAQ,eAAe,QAAQ,gBAAgB,cAAc,CAC1E,CACA,WACC,wDACY,QAAQ,cAAc,QAAQ,gBAAgB,cAAc,CACzE,CACA,WACC,sDACY,QAAQ,WAAW,QAAQ,gBAAgB,cAAc,CACtE"}
|
package/dist/types/api.cjs
DELETED
|
File without changes
|
package/dist/types/api.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.cjs","names":[],"sources":["../../src/types/commands.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 { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"deploy\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\n>;\n"],"mappings":";;AAsBA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.mjs","names":[],"sources":["../../src/types/commands.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 { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"deploy\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\n>;\n"],"mappings":";AAsBA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/types/config.cjs
DELETED
|
File without changes
|
package/dist/types/config.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/types/context.cjs
DELETED
|
File without changes
|
package/dist/types/context.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/types/fs.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.cjs","names":["STORAGE_PRESETS: StoragePreset[]"],"sources":["../../src/types/fs.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 { ResolveOptions as BaseResolveOptions } from \"@stryke/fs/resolve\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { AssetGlob } from \"@stryke/types/file\";\n\nexport type VirtualFileExtension = \"js\" | \"ts\" | \"jsx\" | \"tsx\";\n\n// eslint-disable-next-line ts/naming-convention\nexport const __VFS_PATCH__ = \"__VFS_PATCH__\";\n\n// eslint-disable-next-line ts/naming-convention\nexport const __VFS_REVERT__ = \"__VFS_REVERT__\";\n\nexport type StoragePreset = \"fs\" | \"virtual\";\n\nexport const STORAGE_PRESETS: StoragePreset[] = [\"fs\", \"virtual\"];\n\n/**\n * Interface defining the methods and properties for a storage adapter.\n */\nexport interface StorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n name: string;\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n preset?: StoragePreset | null;\n\n /**\n * Checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n exists: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n existsSync: (key: string) => boolean;\n\n /**\n * Read a value associated with a key from the storage.\n *\n * @param key - The key to read the value for.\n * @returns A promise that resolves to the value if found, otherwise `null`.\n */\n get: (key: string) => Promise<string | null>;\n\n /**\n * Synchronously reads the value associated with a key from the storage.\n *\n * @param key - The key to read the value for.\n * @returns The value if found, otherwise `null`.\n */\n getSync: (key: string) => string | null;\n\n /**\n * Writes a value to the storage for the given key.\n *\n * @param key - The key to associate the value with.\n * @param value - The value to store.\n */\n set: (key: string, value: string) => Promise<void>;\n\n /**\n * Synchronously writes a value to the storage for the given key.\n *\n * @param key - The key to associate the value with.\n * @param value - The value to store.\n */\n setSync: (key: string, value: string) => void;\n\n /**\n * Removes a value from the storage.\n *\n * @param key - The key whose value should be removed.\n */\n remove: (key: string) => Promise<void>;\n\n /**\n * Synchronously removes a value from the storage.\n *\n * @param key - The key whose value should be removed.\n */\n removeSync: (key: string) => void;\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdir: (dirPath: string) => Promise<void>;\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdirSync: (dirPath: string) => void;\n\n /**\n * Remove all entries from the storage that match the provided base path.\n *\n * @param base - The base path or prefix to clear entries from.\n */\n clear: (base?: string) => Promise<void>;\n\n /**\n * Synchronously remove all entries from the storage that match the provided base path.\n *\n * @param base - The base path or prefix to clear entries from.\n */\n clearSync: (base?: string) => void;\n\n /**\n * Lists all keys under the provided base path.\n *\n * @param base - The base path or prefix to list keys from.\n * @returns A promise resolving to the list of keys.\n */\n list: (base?: string) => Promise<string[]>;\n\n /**\n * Synchronously lists all keys under the provided base path.\n *\n * @param base - The base path or prefix to list keys from.\n * @returns The list of keys.\n */\n listSync: (base?: string) => string[];\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n isDirectory: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n isDirectorySync: (key: string) => boolean;\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n isFile: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n isFileSync: (key: string) => boolean;\n\n /**\n * Releases any resources held by the storage adapter.\n */\n dispose: () => MaybePromise<void>;\n}\n\n/**\n * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.\n */\nexport type StoragePort = Record<string, StorageAdapter>;\n\nexport interface VirtualFileMetadata {\n /**\n * The identifier for the file data.\n */\n id: string;\n\n /**\n * The timestamp of the virtual file.\n */\n timestamp: number;\n\n /**\n * The type of the file.\n *\n * @remarks\n * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:\n * - `builtin`: Indicates that the file is a built-in module provided by the system.\n * - `entry`: Indicates that the file is an entry point for execution.\n * - `normal`: Indicates that the file is a standard file without any special role.\n */\n type: string;\n\n /**\n * Additional metadata associated with the file.\n */\n properties: Record<string, string | undefined>;\n}\n\nexport interface VirtualFileData {\n /**\n * The identifier for the file data.\n */\n id?: string;\n\n /**\n * The contents of the virtual file.\n */\n code: string;\n\n /**\n * The type of the file.\n *\n * @remarks\n * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:\n * - `builtin`: Indicates that the file is a built-in module provided by the system.\n * - `entry`: Indicates that the file is an entry point for execution.\n * - `normal`: Indicates that the file is a standard file without any special role.\n */\n type?: string;\n\n /**\n * Additional metadata associated with the file.\n */\n properties?: Record<string, string | undefined>;\n}\n\nexport interface VirtualFile\n extends Required<VirtualFileData>, VirtualFileMetadata {\n /**\n * An additional name for the file.\n */\n path: string;\n\n /**\n * The timestamp of the virtual file.\n */\n timestamp: number;\n}\n\nexport interface WriteOptions {\n /**\n * Should the file skip formatting before being written?\n *\n * @defaultValue false\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output file.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n /**\n * Additional metadata for the file.\n */\n meta?: Partial<VirtualFileMetadata>;\n}\n\nexport type WriteData = string | NodeJS.ArrayBufferView | VirtualFileData;\n\nexport interface ResolveOptions extends BaseResolveOptions {\n /**\n * If true, the module is being resolved as an entry point.\n */\n isEntry?: boolean;\n\n /**\n * If true, the resolver will skip alias resolution when resolving modules.\n */\n skipAlias?: boolean;\n\n /**\n * If true, the resolver will skip using the cache when resolving modules.\n */\n skipCache?: boolean;\n\n /**\n * An array of external modules or patterns to exclude from resolution.\n */\n external?: (string | RegExp)[];\n\n /**\n * An array of modules or patterns to include in the resolution, even if they are marked as external.\n */\n noExternal?: (string | RegExp)[];\n\n /**\n * An array of patterns to match when resolving modules.\n */\n skipNodeModulesBundle?: boolean;\n}\n\nexport interface VirtualFileSystemInterface {\n /**\n * The underlying file metadata.\n */\n metadata: Readonly<Record<string, VirtualFileMetadata>>;\n\n /**\n * A map of file paths to their module ids.\n */\n ids: Readonly<Record<string, string>>;\n\n /**\n * A map of module ids to their file paths.\n */\n paths: Readonly<Record<string, string>>;\n\n /**\n * Checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n exists: (path: string) => Promise<boolean>;\n\n /**\n * Synchronously Checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n existsSync: (path: string) => boolean;\n\n /**\n * Checks if a file is virtual in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file is virtual, otherwise `false`.\n */\n isVirtual: (path: string) => boolean;\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n isDirectory: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n isDirectorySync: (key: string) => boolean;\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n isFile: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n isFileSync: (key: string) => boolean;\n\n /**\n * Gets the metadata of a file in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns The metadata of the file if it exists, otherwise undefined.\n */\n getMetadata: (path: string) => VirtualFileMetadata | undefined;\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n listSync: (path: string) => string[];\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n list: (path: string) => Promise<string[]>;\n\n /**\n * Removes a file or symbolic link in the virtual file system (VFS).\n *\n * @param path - The path to the file to remove.\n * @returns A promise that resolves when the file is removed.\n */\n removeSync: (path: string) => void;\n\n /**\n * Asynchronously removes a file or symbolic link in the virtual file system (VFS).\n *\n * @param path - The path to the file to remove.\n * @returns A promise that resolves when the file is removed.\n */\n remove: (path: string) => Promise<void>;\n\n /**\n * Reads a file from the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns The contents of the file if it exists, otherwise undefined.\n */\n read: (path: string) => Promise<string | undefined>;\n\n /**\n * Reads a file from the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n */\n readSync: (path: string) => string | undefined;\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Options for writing the file.\n * @returns A promise that resolves when the file is written.\n */\n write: (path: string, data: string, options?: WriteOptions) => Promise<void>;\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Options for writing the file.\n */\n writeSync: (path: string, data: string, options?: WriteOptions) => void;\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdir: (dirPath: string) => Promise<void>;\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdirSync: (dirPath: string) => void;\n\n /**\n * Moves a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n move: (srcPath: string, destPath: string) => Promise<void>;\n\n /**\n * Synchronously moves a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n moveSync: (srcPath: string, destPath: string) => void;\n\n /**\n * Copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n copy: (\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) => Promise<void>;\n\n /**\n * Synchronously copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n copySync: (\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) => void;\n\n /**\n * Glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n glob: (\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ) => Promise<string[]>;\n\n /**\n * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n globSync: (\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ) => string[];\n\n /**\n * A helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n resolve: (\n id: string,\n importer?: string,\n options?: ResolveOptions\n ) => Promise<string | undefined>;\n\n /**\n * A synchronous helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = context.resolveSync(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns The resolved module path.\n */\n resolveSync: (\n id: string,\n importer?: string,\n options?: ResolveOptions\n ) => string | undefined;\n\n /**\n * Resolves a given module ID using the configured aliases.\n *\n * @remarks\n * This function can be used to map module IDs to different paths based on the alias configuration.\n *\n * @param id - The module ID to resolve.\n * @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).\n */\n resolveAlias: (id: string) => string;\n\n /**\n * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.\n */\n dispose: () => Promise<void>;\n}\n"],"mappings":";;AAyBA,MAAa,gBAAgB;AAG7B,MAAa,iBAAiB;AAI9B,MAAaA,kBAAmC,CAAC,MAAM,UAAU"}
|
package/dist/types/fs.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.mjs","names":["STORAGE_PRESETS: StoragePreset[]"],"sources":["../../src/types/fs.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 { ResolveOptions as BaseResolveOptions } from \"@stryke/fs/resolve\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { AssetGlob } from \"@stryke/types/file\";\n\nexport type VirtualFileExtension = \"js\" | \"ts\" | \"jsx\" | \"tsx\";\n\n// eslint-disable-next-line ts/naming-convention\nexport const __VFS_PATCH__ = \"__VFS_PATCH__\";\n\n// eslint-disable-next-line ts/naming-convention\nexport const __VFS_REVERT__ = \"__VFS_REVERT__\";\n\nexport type StoragePreset = \"fs\" | \"virtual\";\n\nexport const STORAGE_PRESETS: StoragePreset[] = [\"fs\", \"virtual\"];\n\n/**\n * Interface defining the methods and properties for a storage adapter.\n */\nexport interface StorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n name: string;\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n preset?: StoragePreset | null;\n\n /**\n * Checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n exists: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n existsSync: (key: string) => boolean;\n\n /**\n * Read a value associated with a key from the storage.\n *\n * @param key - The key to read the value for.\n * @returns A promise that resolves to the value if found, otherwise `null`.\n */\n get: (key: string) => Promise<string | null>;\n\n /**\n * Synchronously reads the value associated with a key from the storage.\n *\n * @param key - The key to read the value for.\n * @returns The value if found, otherwise `null`.\n */\n getSync: (key: string) => string | null;\n\n /**\n * Writes a value to the storage for the given key.\n *\n * @param key - The key to associate the value with.\n * @param value - The value to store.\n */\n set: (key: string, value: string) => Promise<void>;\n\n /**\n * Synchronously writes a value to the storage for the given key.\n *\n * @param key - The key to associate the value with.\n * @param value - The value to store.\n */\n setSync: (key: string, value: string) => void;\n\n /**\n * Removes a value from the storage.\n *\n * @param key - The key whose value should be removed.\n */\n remove: (key: string) => Promise<void>;\n\n /**\n * Synchronously removes a value from the storage.\n *\n * @param key - The key whose value should be removed.\n */\n removeSync: (key: string) => void;\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdir: (dirPath: string) => Promise<void>;\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdirSync: (dirPath: string) => void;\n\n /**\n * Remove all entries from the storage that match the provided base path.\n *\n * @param base - The base path or prefix to clear entries from.\n */\n clear: (base?: string) => Promise<void>;\n\n /**\n * Synchronously remove all entries from the storage that match the provided base path.\n *\n * @param base - The base path or prefix to clear entries from.\n */\n clearSync: (base?: string) => void;\n\n /**\n * Lists all keys under the provided base path.\n *\n * @param base - The base path or prefix to list keys from.\n * @returns A promise resolving to the list of keys.\n */\n list: (base?: string) => Promise<string[]>;\n\n /**\n * Synchronously lists all keys under the provided base path.\n *\n * @param base - The base path or prefix to list keys from.\n * @returns The list of keys.\n */\n listSync: (base?: string) => string[];\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n isDirectory: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n isDirectorySync: (key: string) => boolean;\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n isFile: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n isFileSync: (key: string) => boolean;\n\n /**\n * Releases any resources held by the storage adapter.\n */\n dispose: () => MaybePromise<void>;\n}\n\n/**\n * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.\n */\nexport type StoragePort = Record<string, StorageAdapter>;\n\nexport interface VirtualFileMetadata {\n /**\n * The identifier for the file data.\n */\n id: string;\n\n /**\n * The timestamp of the virtual file.\n */\n timestamp: number;\n\n /**\n * The type of the file.\n *\n * @remarks\n * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:\n * - `builtin`: Indicates that the file is a built-in module provided by the system.\n * - `entry`: Indicates that the file is an entry point for execution.\n * - `normal`: Indicates that the file is a standard file without any special role.\n */\n type: string;\n\n /**\n * Additional metadata associated with the file.\n */\n properties: Record<string, string | undefined>;\n}\n\nexport interface VirtualFileData {\n /**\n * The identifier for the file data.\n */\n id?: string;\n\n /**\n * The contents of the virtual file.\n */\n code: string;\n\n /**\n * The type of the file.\n *\n * @remarks\n * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:\n * - `builtin`: Indicates that the file is a built-in module provided by the system.\n * - `entry`: Indicates that the file is an entry point for execution.\n * - `normal`: Indicates that the file is a standard file without any special role.\n */\n type?: string;\n\n /**\n * Additional metadata associated with the file.\n */\n properties?: Record<string, string | undefined>;\n}\n\nexport interface VirtualFile\n extends Required<VirtualFileData>, VirtualFileMetadata {\n /**\n * An additional name for the file.\n */\n path: string;\n\n /**\n * The timestamp of the virtual file.\n */\n timestamp: number;\n}\n\nexport interface WriteOptions {\n /**\n * Should the file skip formatting before being written?\n *\n * @defaultValue false\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output file.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n /**\n * Additional metadata for the file.\n */\n meta?: Partial<VirtualFileMetadata>;\n}\n\nexport type WriteData = string | NodeJS.ArrayBufferView | VirtualFileData;\n\nexport interface ResolveOptions extends BaseResolveOptions {\n /**\n * If true, the module is being resolved as an entry point.\n */\n isEntry?: boolean;\n\n /**\n * If true, the resolver will skip alias resolution when resolving modules.\n */\n skipAlias?: boolean;\n\n /**\n * If true, the resolver will skip using the cache when resolving modules.\n */\n skipCache?: boolean;\n\n /**\n * An array of external modules or patterns to exclude from resolution.\n */\n external?: (string | RegExp)[];\n\n /**\n * An array of modules or patterns to include in the resolution, even if they are marked as external.\n */\n noExternal?: (string | RegExp)[];\n\n /**\n * An array of patterns to match when resolving modules.\n */\n skipNodeModulesBundle?: boolean;\n}\n\nexport interface VirtualFileSystemInterface {\n /**\n * The underlying file metadata.\n */\n metadata: Readonly<Record<string, VirtualFileMetadata>>;\n\n /**\n * A map of file paths to their module ids.\n */\n ids: Readonly<Record<string, string>>;\n\n /**\n * A map of module ids to their file paths.\n */\n paths: Readonly<Record<string, string>>;\n\n /**\n * Checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n exists: (path: string) => Promise<boolean>;\n\n /**\n * Synchronously Checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n existsSync: (path: string) => boolean;\n\n /**\n * Checks if a file is virtual in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file is virtual, otherwise `false`.\n */\n isVirtual: (path: string) => boolean;\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n isDirectory: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n isDirectorySync: (key: string) => boolean;\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n isFile: (key: string) => Promise<boolean>;\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n isFileSync: (key: string) => boolean;\n\n /**\n * Gets the metadata of a file in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns The metadata of the file if it exists, otherwise undefined.\n */\n getMetadata: (path: string) => VirtualFileMetadata | undefined;\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n listSync: (path: string) => string[];\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n list: (path: string) => Promise<string[]>;\n\n /**\n * Removes a file or symbolic link in the virtual file system (VFS).\n *\n * @param path - The path to the file to remove.\n * @returns A promise that resolves when the file is removed.\n */\n removeSync: (path: string) => void;\n\n /**\n * Asynchronously removes a file or symbolic link in the virtual file system (VFS).\n *\n * @param path - The path to the file to remove.\n * @returns A promise that resolves when the file is removed.\n */\n remove: (path: string) => Promise<void>;\n\n /**\n * Reads a file from the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns The contents of the file if it exists, otherwise undefined.\n */\n read: (path: string) => Promise<string | undefined>;\n\n /**\n * Reads a file from the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n */\n readSync: (path: string) => string | undefined;\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Options for writing the file.\n * @returns A promise that resolves when the file is written.\n */\n write: (path: string, data: string, options?: WriteOptions) => Promise<void>;\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Options for writing the file.\n */\n writeSync: (path: string, data: string, options?: WriteOptions) => void;\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdir: (dirPath: string) => Promise<void>;\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdirSync: (dirPath: string) => void;\n\n /**\n * Moves a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n move: (srcPath: string, destPath: string) => Promise<void>;\n\n /**\n * Synchronously moves a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n moveSync: (srcPath: string, destPath: string) => void;\n\n /**\n * Copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n copy: (\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) => Promise<void>;\n\n /**\n * Synchronously copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n copySync: (\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) => void;\n\n /**\n * Glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n glob: (\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ) => Promise<string[]>;\n\n /**\n * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n globSync: (\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ) => string[];\n\n /**\n * A helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n resolve: (\n id: string,\n importer?: string,\n options?: ResolveOptions\n ) => Promise<string | undefined>;\n\n /**\n * A synchronous helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = context.resolveSync(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns The resolved module path.\n */\n resolveSync: (\n id: string,\n importer?: string,\n options?: ResolveOptions\n ) => string | undefined;\n\n /**\n * Resolves a given module ID using the configured aliases.\n *\n * @remarks\n * This function can be used to map module IDs to different paths based on the alias configuration.\n *\n * @param id - The module ID to resolve.\n * @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).\n */\n resolveAlias: (id: string) => string;\n\n /**\n * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.\n */\n dispose: () => Promise<void>;\n}\n"],"mappings":";AAyBA,MAAa,gBAAgB;AAG7B,MAAa,iBAAiB;AAI9B,MAAaA,kBAAmC,CAAC,MAAM,UAAU"}
|
package/dist/types/hooks.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.cjs","names":[],"sources":["../../src/types/hooks.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 { MaybePromise } from \"@stryke/types/base\";\nimport { UnpluginOptions } from \"unplugin\";\nimport type {\n PluginContext,\n SelectHooksOptions,\n WithUnpluginBuildContext\n} from \"./context\";\nimport type { Plugin, PluginHookFields, PluginHookFunctions } from \"./plugin\";\nimport { UnpluginBuilderVariant } from \"./unplugin\";\n\nexport type HookListOrders =\n | \"preOrdered\"\n | \"preEnforced\"\n | \"normal\"\n | \"postEnforced\"\n | \"postOrdered\";\n\nexport const HOOKS_LIST_ORDERS = [\n \"preOrdered\",\n \"preEnforced\",\n \"normal\",\n \"postEnforced\",\n \"postOrdered\"\n] as const;\n\nexport type UnpluginHookFunctions<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant,\n TField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] =\n keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n> = Required<UnpluginOptions>[TUnpluginBuilderVariant][TField] extends\n | infer THandler\n | {\n handler: infer THandler;\n }\n ? THandler extends (\n this: infer THandlerOriginalContext,\n ...args: infer THandlerArgs\n ) => infer THandlerReturn\n ? (\n this: THandlerOriginalContext & WithUnpluginBuildContext<TContext>,\n ...args: THandlerArgs\n ) => THandlerReturn\n : THandler extends { handler: infer THandlerFunction }\n ? THandlerFunction extends (\n this: infer THandlerFunctionOriginalContext,\n ...args: infer THandlerFunctionArgs\n ) => infer THandlerFunctionReturn\n ? (\n this: THandlerFunctionOriginalContext &\n WithUnpluginBuildContext<TContext>,\n ...args: THandlerFunctionArgs\n ) => THandlerFunctionReturn\n : never\n : never\n : never;\n\nexport interface PluginHooksListItem<\n TContext extends PluginContext = PluginContext,\n TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>\n> {\n plugin: Plugin<TContext>;\n handler: PluginHookFunctions<TContext>[TFields];\n}\n\nexport type PluginHooksList<\n TContext extends PluginContext = PluginContext,\n TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>\n> = {\n [TKey in HookListOrders]?:\n | PluginHooksListItem<TContext, TFields>[]\n | undefined;\n};\n\nexport interface UnpluginHooksListItem<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant,\n TField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] =\n keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n> {\n plugin: Plugin<TContext>;\n handler: UnpluginHookFunctions<TContext, TUnpluginBuilderVariant, TField>;\n}\n\nexport type UnpluginHookList<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant,\n TField extends keyof UnpluginOptions[TUnpluginBuilderVariant] =\n keyof UnpluginOptions[TUnpluginBuilderVariant]\n> = {\n [TKey in HookListOrders]?:\n | UnpluginHooksListItem<TContext, TUnpluginBuilderVariant, TField>[]\n | undefined;\n};\n\nexport type UnpluginHookVariantField<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n> = {\n [TKey in keyof UnpluginOptions[TUnpluginBuilderVariant]]?: UnpluginHookList<\n TContext,\n TUnpluginBuilderVariant,\n TKey\n >;\n};\n\nexport type UnpluginHookVariant<\n TContext extends PluginContext = PluginContext\n> = {\n [TKey in UnpluginBuilderVariant]?: UnpluginHookVariantField<TContext, TKey>;\n};\n\nexport type HookFields<TContext extends PluginContext = PluginContext> =\n | PluginHookFields<TContext>\n | UnpluginBuilderVariant;\n\nexport type HooksList<TContext extends PluginContext = PluginContext> = {\n [TField in HookFields<TContext>]?: TField extends PluginHookFields<TContext>\n ? PluginHooksList<TContext, TField>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHookVariant<TContext>[TField]\n : never;\n};\n\nexport type InferHooksListItem<\n TContext extends PluginContext,\n TKey extends string\n> = TKey extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}`\n ? TUnpluginBuilderVariant extends UnpluginBuilderVariant\n ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n ? UnpluginHooksListItem<TContext, TUnpluginBuilderVariant, TUnpluginField>\n : never\n : never\n : TKey extends keyof PluginHookFunctions<TContext>\n ? PluginHooksListItem<TContext, TKey>\n : never;\n\nexport type InferHookFunction<\n TContext extends PluginContext,\n TKey extends string\n> = TKey extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}`\n ? TUnpluginBuilderVariant extends UnpluginBuilderVariant\n ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n ? UnpluginHookFunctions<TContext, TUnpluginBuilderVariant, TUnpluginField>\n : never\n : never\n : TKey extends keyof PluginHookFunctions<TContext>\n ? PluginHookFunctions<TContext>[TKey]\n : never;\n\nexport type InferHookReturnType<\n TContext extends PluginContext,\n TKey extends string\n> = ReturnType<InferHookFunction<TContext, TKey>>;\n\nexport type InferHookParameters<\n TContext extends PluginContext,\n TKey extends string\n> = Parameters<InferHookFunction<TContext, TKey>>;\n\nexport type InferHookThisType<\n TContext extends PluginContext,\n TKey extends string\n> = ThisParameterType<InferHookFunction<TContext, TKey>>;\n\nexport type CallHookOptions = SelectHooksOptions &\n (\n | ({\n /**\n * Whether to call the hooks sequentially or in parallel.\n *\n * @defaultValue true\n */\n sequential?: true;\n } & (\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result: \"first\";\n }\n | ({\n /**\n * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter\n */\n asNextParam?: false | ((previousResult: any) => MaybePromise<any>);\n } & (\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result?: \"merge\";\n\n /**\n * A custom function to merge multiple return values from hooks.\n *\n * @remarks\n * If not provided, the {@link mergeResults} function will be used by default, which merges string results by concatenation and object results by deep merging.\n *\n * @param currentResult - The current hook result to merge with the previous results.\n * @param previousResults - The previous hook results to merge with the current result.\n * @returns The merged result.\n */\n merge?: <T>(currentResult: T, previousResults: T[]) => T[];\n }\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result?: \"last\";\n }\n ))\n ))\n | {\n /**\n * Whether to call the hooks sequentially or in parallel.\n */\n sequential: false;\n }\n );\n"],"mappings":";;AAmCA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/types/hooks.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.mjs","names":[],"sources":["../../src/types/hooks.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 { MaybePromise } from \"@stryke/types/base\";\nimport { UnpluginOptions } from \"unplugin\";\nimport type {\n PluginContext,\n SelectHooksOptions,\n WithUnpluginBuildContext\n} from \"./context\";\nimport type { Plugin, PluginHookFields, PluginHookFunctions } from \"./plugin\";\nimport { UnpluginBuilderVariant } from \"./unplugin\";\n\nexport type HookListOrders =\n | \"preOrdered\"\n | \"preEnforced\"\n | \"normal\"\n | \"postEnforced\"\n | \"postOrdered\";\n\nexport const HOOKS_LIST_ORDERS = [\n \"preOrdered\",\n \"preEnforced\",\n \"normal\",\n \"postEnforced\",\n \"postOrdered\"\n] as const;\n\nexport type UnpluginHookFunctions<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant,\n TField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] =\n keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n> = Required<UnpluginOptions>[TUnpluginBuilderVariant][TField] extends\n | infer THandler\n | {\n handler: infer THandler;\n }\n ? THandler extends (\n this: infer THandlerOriginalContext,\n ...args: infer THandlerArgs\n ) => infer THandlerReturn\n ? (\n this: THandlerOriginalContext & WithUnpluginBuildContext<TContext>,\n ...args: THandlerArgs\n ) => THandlerReturn\n : THandler extends { handler: infer THandlerFunction }\n ? THandlerFunction extends (\n this: infer THandlerFunctionOriginalContext,\n ...args: infer THandlerFunctionArgs\n ) => infer THandlerFunctionReturn\n ? (\n this: THandlerFunctionOriginalContext &\n WithUnpluginBuildContext<TContext>,\n ...args: THandlerFunctionArgs\n ) => THandlerFunctionReturn\n : never\n : never\n : never;\n\nexport interface PluginHooksListItem<\n TContext extends PluginContext = PluginContext,\n TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>\n> {\n plugin: Plugin<TContext>;\n handler: PluginHookFunctions<TContext>[TFields];\n}\n\nexport type PluginHooksList<\n TContext extends PluginContext = PluginContext,\n TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>\n> = {\n [TKey in HookListOrders]?:\n | PluginHooksListItem<TContext, TFields>[]\n | undefined;\n};\n\nexport interface UnpluginHooksListItem<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant,\n TField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] =\n keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n> {\n plugin: Plugin<TContext>;\n handler: UnpluginHookFunctions<TContext, TUnpluginBuilderVariant, TField>;\n}\n\nexport type UnpluginHookList<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant,\n TField extends keyof UnpluginOptions[TUnpluginBuilderVariant] =\n keyof UnpluginOptions[TUnpluginBuilderVariant]\n> = {\n [TKey in HookListOrders]?:\n | UnpluginHooksListItem<TContext, TUnpluginBuilderVariant, TField>[]\n | undefined;\n};\n\nexport type UnpluginHookVariantField<\n TContext extends PluginContext = PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n> = {\n [TKey in keyof UnpluginOptions[TUnpluginBuilderVariant]]?: UnpluginHookList<\n TContext,\n TUnpluginBuilderVariant,\n TKey\n >;\n};\n\nexport type UnpluginHookVariant<\n TContext extends PluginContext = PluginContext\n> = {\n [TKey in UnpluginBuilderVariant]?: UnpluginHookVariantField<TContext, TKey>;\n};\n\nexport type HookFields<TContext extends PluginContext = PluginContext> =\n | PluginHookFields<TContext>\n | UnpluginBuilderVariant;\n\nexport type HooksList<TContext extends PluginContext = PluginContext> = {\n [TField in HookFields<TContext>]?: TField extends PluginHookFields<TContext>\n ? PluginHooksList<TContext, TField>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHookVariant<TContext>[TField]\n : never;\n};\n\nexport type InferHooksListItem<\n TContext extends PluginContext,\n TKey extends string\n> = TKey extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}`\n ? TUnpluginBuilderVariant extends UnpluginBuilderVariant\n ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n ? UnpluginHooksListItem<TContext, TUnpluginBuilderVariant, TUnpluginField>\n : never\n : never\n : TKey extends keyof PluginHookFunctions<TContext>\n ? PluginHooksListItem<TContext, TKey>\n : never;\n\nexport type InferHookFunction<\n TContext extends PluginContext,\n TKey extends string\n> = TKey extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}`\n ? TUnpluginBuilderVariant extends UnpluginBuilderVariant\n ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant]\n ? UnpluginHookFunctions<TContext, TUnpluginBuilderVariant, TUnpluginField>\n : never\n : never\n : TKey extends keyof PluginHookFunctions<TContext>\n ? PluginHookFunctions<TContext>[TKey]\n : never;\n\nexport type InferHookReturnType<\n TContext extends PluginContext,\n TKey extends string\n> = ReturnType<InferHookFunction<TContext, TKey>>;\n\nexport type InferHookParameters<\n TContext extends PluginContext,\n TKey extends string\n> = Parameters<InferHookFunction<TContext, TKey>>;\n\nexport type InferHookThisType<\n TContext extends PluginContext,\n TKey extends string\n> = ThisParameterType<InferHookFunction<TContext, TKey>>;\n\nexport type CallHookOptions = SelectHooksOptions &\n (\n | ({\n /**\n * Whether to call the hooks sequentially or in parallel.\n *\n * @defaultValue true\n */\n sequential?: true;\n } & (\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result: \"first\";\n }\n | ({\n /**\n * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter\n */\n asNextParam?: false | ((previousResult: any) => MaybePromise<any>);\n } & (\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result?: \"merge\";\n\n /**\n * A custom function to merge multiple return values from hooks.\n *\n * @remarks\n * If not provided, the {@link mergeResults} function will be used by default, which merges string results by concatenation and object results by deep merging.\n *\n * @param currentResult - The current hook result to merge with the previous results.\n * @param previousResults - The previous hook results to merge with the current result.\n * @returns The merged result.\n */\n merge?: <T>(currentResult: T, previousResults: T[]) => T[];\n }\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result?: \"last\";\n }\n ))\n ))\n | {\n /**\n * Whether to call the hooks sequentially or in parallel.\n */\n sequential: false;\n }\n );\n"],"mappings":";AAmCA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/types/index.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const require_types_unplugin = require('./unplugin.cjs');
|
|
2
|
-
const require_types_commands = require('./commands.cjs');
|
|
3
|
-
const require_types_fs = require('./fs.cjs');
|
|
4
|
-
const require_types_hooks = require('./hooks.cjs');
|
|
5
|
-
const require_types_plugin = require('./plugin.cjs');
|
|
6
|
-
|
|
7
|
-
exports.BUILDER_VARIANTS = require_types_unplugin.BUILDER_VARIANTS;
|
|
8
|
-
exports.HOOKS_LIST_ORDERS = require_types_hooks.HOOKS_LIST_ORDERS;
|
|
9
|
-
exports.KNOWN_PLUGIN_FIELDS = require_types_plugin.KNOWN_PLUGIN_FIELDS;
|
|
10
|
-
exports.PLUGIN_HOOKS_FIELDS = require_types_plugin.PLUGIN_HOOKS_FIELDS;
|
|
11
|
-
exports.PLUGIN_NON_HOOK_FIELDS = require_types_plugin.PLUGIN_NON_HOOK_FIELDS;
|
|
12
|
-
exports.STORAGE_PRESETS = require_types_fs.STORAGE_PRESETS;
|
|
13
|
-
exports.SUPPORTED_COMMANDS = require_types_commands.SUPPORTED_COMMANDS;
|
|
14
|
-
exports.UNPLUGIN_BUILDER_VARIANTS = require_types_unplugin.UNPLUGIN_BUILDER_VARIANTS;
|
|
15
|
-
exports.__VFS_PATCH__ = require_types_fs.__VFS_PATCH__;
|
|
16
|
-
exports.__VFS_REVERT__ = require_types_fs.__VFS_REVERT__;
|
package/dist/types/index.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ResolveOptions, STORAGE_PRESETS, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WriteData, WriteOptions, __VFS_PATCH__, __VFS_REVERT__, __ΩResolveOptions, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWriteData, __ΩWriteOptions } from "./fs.cjs";
|
|
2
|
-
import { CommandType, Commands, SUPPORTED_COMMANDS, __ΩCommandType, __ΩCommands } from "./commands.cjs";
|
|
3
|
-
import { API, __ΩAPI } from "./api.cjs";
|
|
4
|
-
import { BUILDER_VARIANTS, BuilderVariant, InferUnpluginOptions, InferUnpluginVariant, UNPLUGIN_BUILDER_VARIANTS, UnpluginBuilderVariant, UnpluginFactory, UnpluginOptions, UnpluginUserConfig, __ΩBuilderVariant, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginOptions, __ΩUnpluginUserConfig } from "./unplugin.cjs";
|
|
5
|
-
import { KNOWN_PLUGIN_FIELDS, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, Plugin, PluginFields, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, PluginNonHookFields, TypesResult, __ΩPlugin, __ΩPluginFields, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookFunctions, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginNonHookFields, __ΩTypesResult } from "./plugin.cjs";
|
|
6
|
-
import { CallHookOptions, HOOKS_LIST_ORDERS, HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferHooksListItem, PluginHooksList, PluginHooksListItem, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem, __ΩCallHookOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooksList, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferHooksListItem, __ΩPluginHooksList, __ΩPluginHooksListItem, __ΩUnpluginHookFunctions, __ΩUnpluginHookList, __ΩUnpluginHookVariant, __ΩUnpluginHookVariantField, __ΩUnpluginHooksListItem } from "./hooks.cjs";
|
|
7
|
-
import { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLevel, ReflectionMode, TSCompilerOptions, TSConfig, __ΩDeepkitOptions, __ΩParsedTypeScriptConfig, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩTSCompilerOptions, __ΩTSConfig } from "./tsconfig.cjs";
|
|
8
|
-
import { APIContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentContextPlugin, FetchOptions, InitContextOptions, MetaInfo, ParseOptions, PluginContext, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext, WorkerProcess, __ΩAPIContext, __ΩBuildPluginContext, __ΩContext, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩFetchOptions, __ΩInitContextOptions, __ΩMetaInfo, __ΩParseOptions, __ΩPluginContext, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩTransformResult, __ΩUnimportContext, __ΩUnresolvedContext, __ΩWithUnpluginBuildContext, __ΩWorkerProcess } from "./context.cjs";
|
|
9
|
-
import { AnyUserConfig, BaseConfig, BuildInlineConfig, CleanInlineConfig, ConfigEnv, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, InitialUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, UserConfig, WorkspaceConfig, __ΩAnyUserConfig, __ΩBaseConfig, __ΩBuildInlineConfig, __ΩCleanInlineConfig, __ΩConfigEnv, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEnvironmentConfig, __ΩEnvironmentResolvedConfig, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginFactory, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩResolveConfig, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩUserConfig, __ΩWorkspaceConfig } from "./config.cjs";
|
|
10
|
-
export { API, APIContext, AnyUserConfig, BUILDER_VARIANTS, BaseConfig, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, ConfigEnv, Context, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, FetchOptions, HOOKS_LIST_ORDERS, HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferHooksListItem, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InitialUserConfig, InlineConfig, KNOWN_PLUGIN_FIELDS, LintInlineConfig, LogFn, LogLevel, MetaInfo, NewInlineConfig, OutputConfig, OutputResolvedConfig, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFields, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, PluginHooksList, PluginHooksListItem, PluginNonHookFields, PowerlinesCommand, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionLevel, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, STORAGE_PRESETS, SUPPORTED_COMMANDS, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, TSCompilerOptions, TSConfig, TransformResult, TypesResult, UNPLUGIN_BUILDER_VARIANTS, UnimportContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __VFS_PATCH__, __VFS_REVERT__, __ΩAPI, __ΩAPIContext, __ΩAnyUserConfig, __ΩBaseConfig, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfigEnv, __ΩContext, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩFetchOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooksList, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferHooksListItem, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩMetaInfo, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFields, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookFunctions, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginHooksList, __ΩPluginHooksListItem, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTransformResult, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginHookList, __ΩUnpluginHookVariant, __ΩUnpluginHookVariantField, __ΩUnpluginHooksListItem, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions };
|