@halospv3/hce.shared-config 3.5.2 → 3.5.3-develop.1

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/mjs/CaseInsensitiveMap.mjs.map +1 -1
  3. package/mjs/debug.mjs.map +1 -1
  4. package/mjs/dotnet/GithubNugetRegistryInfo.mjs +1 -0
  5. package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -1
  6. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +6 -0
  7. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -1
  8. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -1
  9. package/mjs/dotnet/MSBuildProject.mjs +54 -0
  10. package/mjs/dotnet/MSBuildProject.mjs.map +1 -1
  11. package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -1
  12. package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -1
  13. package/mjs/dotnet/NugetRegistryInfo.mjs +68 -0
  14. package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -1
  15. package/mjs/dotnet/helpers.mjs +65 -1
  16. package/mjs/dotnet/helpers.mjs.map +1 -1
  17. package/mjs/insertPlugins.mjs.map +1 -1
  18. package/mjs/semanticReleaseConfig.mjs +1 -0
  19. package/mjs/semanticReleaseConfig.mjs.map +1 -1
  20. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -1
  21. package/mjs/setupGitPluginSpec.mjs.map +1 -1
  22. package/mjs/utils/env.mjs.map +1 -1
  23. package/mjs/utils/execAsync.mjs.map +1 -1
  24. package/mjs/utils/isError.mjs.map +1 -1
  25. package/mjs/utils/reflection/filterForGetters.mjs.map +1 -1
  26. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -1
  27. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -1
  28. package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -1
  29. package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -1
  30. package/mjs/utils/reflection/isConstructor.mjs.map +1 -1
  31. package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -1
  32. package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -1
  33. package/package.json +9 -9
  34. package/src/utils/isError.ts +1 -1
  35. package/src/utils/reflection/getPrototypeOf.ts +1 -0
@@ -209,14 +209,78 @@ function formatDotnetNugetSign(opts) {
209
209
  }
210
210
  }
211
211
  const DotnetNugetSignOptions = type({
212
+ /**
213
+ * Password for the certificate, if needed. This option can be used to specify
214
+ * the password for the certificate. The command will throw an error message
215
+ * if certificate is password protected but password is not provided as input.
216
+ */
212
217
  "certificatePassword?": "string",
218
+ /**
219
+ * Hash algorithm to be used to sign the package. Defaults to SHA256.
220
+ */
213
221
  "hashAlgorithm?": "string | \"SHA256\"",
222
+ /**
223
+ * Directory where the signed package(s) should be saved. By default the
224
+ * original package is overwritten by the signed package.
225
+ */
214
226
  "output?": "string",
227
+ /**
228
+ * Switch to indicate if the current signature should be overwritten. By
229
+ * default the command will fail if the package already has a signature.
230
+ */
215
231
  "overwrite?": "true",
232
+ /**
233
+ * URL to an RFC 3161 timestamping server.
234
+ */
216
235
  timestamper: "string = \"https://rfc3161.ai.moda/\"",
236
+ /**
237
+ * Hash algorithm to be used to sign the package. Defaults to SHA256.
238
+ */
217
239
  "timestampHashAlgorithm?": "string | \"SHA256\"",
240
+ /**
241
+ * Set the verbosity level of the command. Allowed values are q[uiet],
242
+ * m[inimal], n[ormal], d[etailed], and diag[nostic].
243
+ */
218
244
  "verbosity?": "\"q\"|\"quiet\"|\"m\"|\"minimal\"|\"n\"|\"normal\"|\"d\"|\"detailed\"|\"diag\"|\"diagnostic\""
219
- }).and(type({ certificatePath: "string" }).or(type({ certificateStoreName: "string" }).or({ certificateStoreLocation: "string" })).and(type({ certificateSubjectName: "string" }).or({ certificateFingerprint: "string" })));
245
+ }).and(type({
246
+ /**
247
+ * File path to the certificate to be used while signing the package.
248
+ */
249
+ certificatePath: "string" }).or(type({
250
+ /**
251
+ * Name of the X.509 certificate store to use to search for the
252
+ * certificate. Defaults to "My", the X.509 certificate store for personal
253
+ * certificates.
254
+ *
255
+ * This option should be used when specifying the certificate via
256
+ * --certificate-subject-name or --certificate-fingerprint options.
257
+ */
258
+ certificateStoreName: "string" }).or({
259
+ /**
260
+ * Name of the X.509 certificate store use to search for the
261
+ * certificate. Defaults to "CurrentUser", the X.509 certificate store
262
+ * used by the current user.
263
+ *
264
+ * This option should be used when specifying the certificate via
265
+ * --certificate-subject-name or --certificate-fingerprint options.
266
+ */
267
+ certificateStoreLocation: "string" })).and(type({
268
+ /**
269
+ * Subject name of the certificate used to search a local certificate
270
+ * store for the certificate. The search is a case-insensitive string
271
+ * comparison using the supplied value, which will find all certificates
272
+ * with the subject name containing that string, regardless of other
273
+ * subject values. The certificate store can be specified by
274
+ * --certificate-store-name and --certificate-store-location options.
275
+ */
276
+ certificateSubjectName: "string" }).or({
277
+ /**
278
+ * SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to
279
+ * search a local certificate store for the certificate. The certificate
280
+ * store can be specified by --certificate-store-name and
281
+ * --certificate-store-location options.
282
+ */
283
+ certificateFingerprint: "string" })));
220
284
  //#endregion
221
285
  export { configureDotnetNugetPush, configurePrepareCmd };
222
286
 
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":["MSBPP"],"sources":["../../src/dotnet/helpers.ts"],"sourcesContent":["import { type, type Type } from 'arktype';\n// eslint-disable-next-line unicorn/import-style\nimport * as path from 'node:path';\nimport { cwd } from 'node:process';\nimport { MSBuildProject } from './MSBuildProject.ts';\nimport { MSBuildProjectProperties as MSBPP } from './MSBuildProjectProperties.ts';\nimport { NugetRegistryInfo } from './NugetRegistryInfo.ts';\nimport type { Default } from 'arktype/internal/attributes.ts';\n\nconst ourDefaultPubDir = path.join('.', 'publish') as `.${'/' | '\\\\'}publish`;\n\n/**\n * Build a prepareCmd string from .NET projects.\\\n * This will include a `dotnet publish` for each project's RID and TFM permutation,\\\n * `dotnet pack` for each project with output paths separated by NuGet Source and PackageId,\\\n * and `dotnet nuget sign` for each nupkg output directory.\n * @todo parse Solution files to publish all projects with default Publish parameters (as evaluated by MSBuild).\n * @param projectsToPublish An array of relative or full file paths of `.csproj`\n * projects -OR- an array of {@link MSBuildProject} objects.\n * The project paths will be passed to `dotnet publish` commands.\n * @param projectsToPackAndPush\n * Relative and/or full file paths of projects to pass to `dotnet pack`. If\n * string[], only the default NuGet Source will be used. If GitHub, GitLab,\n * etc. are also desired, pass {@link NugetRegistryInfo}[]\n * @param dotnetNugetSignOpts A {@link DotnetNugetSignOptions} object. The value\n * of the `--output` argument will be set to {@link ourDefaultPubDir} if `undefined`.\n * @returns A single string of CLI commands joined by ' && '\n */\nexport async function configurePrepareCmd(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush?: string[] | NugetRegistryInfo[],\n dotnetNugetSignOpts?: typeof DotnetNugetSignOptions.inferIn,\n): Promise<string> {\n const evaluatedProjects: MSBuildProject[] = [];\n\n // append evaluated projects\n for (const p of projectsToPublish.filter(p => p instanceof MSBuildProject)) {\n evaluatedProjects.push(p);\n }\n if (projectsToPackAndPush) {\n for (const p of projectsToPackAndPush.filter(p => p instanceof NugetRegistryInfo)) {\n evaluatedProjects.push(p.project);\n }\n }\n\n const dotnetPublishCmd: string = await formatDotnetPublish(projectsToPublish);\n const dotnetPackCmd: string | undefined = await formatDotnetPack(projectsToPackAndPush ?? []);\n const dotnetNugetSignCmd: string | undefined = formatDotnetNugetSign(dotnetNugetSignOpts);\n\n return [\n dotnetPublishCmd,\n dotnetPackCmd,\n dotnetNugetSignCmd,\n // remove no-op commands\n ]\n .filter(v => v !== undefined)\n .join(' && ');\n\n /**\n * Create a string of CLI commands to run `dotnet publish` or the Publish\n * MSBuild target for one or more projects.\n * @async\n * @param projectsToPublish An array of one or more projects, either\n * pre-evaluated (see {@link MSBuildProject.Evaluate}) or as full file paths.\\\n * NOTE: Although `dotnet publish` allows directory or Solution file (.sln,\n * .slnx) paths, this function expects projects' full or relative file\n * paths.\n * @returns A Promise of a string. This string contains one or more `dotnet publish`\n * commands conjoined by \" && \". It may also include one or more\n * `dotnet msbuild ${...} -t:PublishAll -p:Configuration=Release` commands.\n */\n async function formatDotnetPublish(\n projectsToPublish: string[] | MSBuildProject[],\n ): Promise<string> {\n /* Fun Fact: You can define a property and get the evaluated value in the same command!\n ```pwsh\n dotnet msbuild .\\src\\HXE.csproj -property:RuntimeIdentifiers=\"\"\"place;holder\"\"\" -getProperty:RuntimeIdentifiers\n place;holder\n ```\n enclosing with \"\"\" is required in pwsh to prevent the semicolon from breaking the string.\n */\n if (!Array.isArray(projectsToPublish) || projectsToPublish.length === 0) {\n throw new Error(\n `Type of projectsToPublish (${typeof projectsToPublish}) is not allowed. Expected a string[] or MSBuildProject[] where length > 0.`,\n );\n }\n\n // each may have TargetFramework OR TargetFrameworks (plural)\n const evaluatedPublishProjects: MSBuildProject[] = await Promise.all(\n projectsToPublish.map(async (proj): Promise<MSBuildProject> => {\n if (proj instanceof MSBuildProject)\n return proj;\n\n // filter for projects whose full paths match the full path of the given string\n const filteredProjects = evaluatedProjects.filter(p =>\n p.Properties.MSBuildProjectFullPath === MSBPP.GetFullPath(proj),\n );\n\n // if no pre-existing MSBuildProject found,\n // evaluate a new one and push it\n if (filteredProjects.length === 0) {\n const _proj = await MSBuildProject.Evaluate({\n FullName: proj,\n GetProperty: MSBuildProject.MatrixProperties,\n GetItem: [],\n GetTargetResult: [],\n Property: {},\n Targets: ['Restore'],\n });\n evaluatedProjects.push(_proj);\n return _proj;\n }\n\n /**\n * Finds and returns the subjectively \"best\" project in {@link filteredProjects}\n * @returns the subjective \"best\" project in {@link filteredProjects}\n */\n function getBest() {\n let best: MSBuildProject | undefined;\n if (filteredProjects.length > 0 && (best = filteredProjects[0]) instanceof MSBuildProject)\n return best;\n throw new Error('No MSBuildProjects could be found!');\n }\n\n /*\n todo: improve filtering to select \"optimal\" instance.\n Which properties are most-needed?\n For now, we just pray the project has a well-defined publish flow e.g.\n @halospv3/hce.shared-config/dotnet/PublishAll.targets\n */\n return getBest();\n }),\n );\n\n /**\n * Returns an array of one or more `dotnet` arguments.\n * @param proj An {@link MSBuildProject} to be published for one or more\n * runtime-framework combinations.\n * @returns If {@link proj} imports {@link ../../dotnet/PublishAll.targets}...\n * ```\n * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll -p:Configuration=Release`]\n * ```\n * Else, an array of `dotnet publish` arguments permutations e.g.\n * ```\n * [\n * 'myProj.csproj --runtime win7-x86 --framework net6.0',\n * 'myProj.csproj --runtime win7-x64 --framework net6.0'\n * ]\n * ```\n * @example\n * const publishCmdArray = [];\n * const permutations = getPublishArgsPermutations(msbuildProject);\n * for (const permutation of permutations) {\n * if (permutation[0] === 'PublishAll') {\n * // 'dotnet msbuild full/path/to/myProj.csproj t:PublishAll'\n * publishCmdArray.push(`dotnet msbuild ${permutation[1]}`)\n * }\n * else {\n * publishCmdArray.push(`dotnet publish ${permutation}`)\n * }\n * }\n * // return array as success-chained CLI commands.\n * return publishCmdArray.join(' && ');\n */\n function getPublishArgsPermutations(proj: MSBuildProject):\n ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`])\n | ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\"`])\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`)[] {\n /**\n * If the project imports PublishAll to publish for each TFM-RID\n * permutation, return the appropriate command line.\n */\n if (proj.Targets.includes('PublishAll'))\n return [`\"${proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`];\n\n // #region formatFrameworksAndRuntimes\n const tfmRidPermutations: `--runtime ${string} --framework ${string}`[]\n | `--runtime ${string}`[]\n | `--framework ${string}`[]\n = []; // forEach, run dotnet [proj.Properties.MSBuildProjectFullPath,...v]\n const RIDs: string[] = proj.Properties.RuntimeIdentifiers.split(';').filter(v => v !== '');\n const TFMs: string[] = proj.Properties.TargetFrameworks.split(';').filter(v => v !== '');\n\n if (TFMs.length === 0 && RIDs.length === 0)\n return [`\"${proj.Properties.MSBuildProjectFullPath}\"`] as [`\"${string}\"`];\n\n if (RIDs.length > 0) {\n if (TFMs.length > 0) {\n for (const RID of RIDs) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--runtime ${string} --framework ${string}`[]).push(\n `--runtime ${RID} --framework ${TFM}`,\n );\n }\n }\n }\n else {\n // assume singular TFM. No need to specify it.\n for (const RID of RIDs) {\n (tfmRidPermutations as `--runtime ${string}`[]).push(\n `--runtime ${RID}`,\n );\n }\n }\n }\n else if (TFMs.length > 0) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--framework ${string}`[]).push(`--framework ${TFM}`);\n }\n }\n\n /** prepend each set of args with the project's path */\n return tfmRidPermutations.map(permArgs =>\n `\"${proj.Properties.MSBuildProjectFullPath}\" ${permArgs}`,\n ) as `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`[];\n // #endregion formatFrameworksAndRuntimes\n }\n\n const publishCmds: (`dotnet publish \"${string}\"` | `dotnet publish \"${string}\" ${string}` | `dotnet msbuild \"${string}\" -t:PublishAll -p:Configuration=Release`)[] = [];\n /** convert {@link evaluatedPublishProjects} to sets of space-separated CLI args. */\n const argsSets = evaluatedPublishProjects.map(\n proj => getPublishArgsPermutations(proj),\n );\n for (const args of argsSets) {\n if (typeof args === 'string')\n throw new Error(`\\`args\\` should not be a string!`);\n for (const permutation of args) {\n if (typeof permutation === 'string' && permutation.length === 1)\n throw new Error('Something has gone terribly wrong. A `dotnet publish` argument set was split to single characters!');\n if (/\".+\" -t:PublishAll -p:Configuration=Release/.test(permutation))\n publishCmds.push(`dotnet msbuild ${permutation as `\"${string}\" -t:PublishAll -p:Configuration=Release`}`);\n else\n publishCmds.push(`dotnet publish ${permutation}`);\n }\n }\n\n // For each argSet, create a new exec command. Then, join all commands with ' && ' so they are executed serially, synchronously.\n // e.g. `dotnet publish project.csproj --runtime win7-x86 --framework net6.0 && dotnet publish project.csproj --runtime win-x64 --framework net8.0\n return publishCmds.join(' && ');\n }\n\n /**\n * @param projectsToPackAndPush a string[] or {@link NugetRegistryInfo}[].\n * If a string[], the string must be the platform-dependent (not file://),\n * full path(s) to one or more projects with the .NET \"Pack\" MSBuild target.\n * See {@link https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack}\n * for command line usage.\n * @returns one or more command line strings joined with ' && '.\n * Each command line comprises the `dotnet pack` command, a project file path,\n * and a hardcoded output path (`--output ${cwd()}/publish`)\n */\n async function formatDotnetPack(\n projectsToPackAndPush: string[] | NugetRegistryInfo[],\n ): Promise<string | undefined> {\n if (projectsToPackAndPush.length === 0)\n return undefined;\n return await Promise.all(\n projectsToPackAndPush.map(async (proj) => {\n if (proj instanceof NugetRegistryInfo)\n return proj;\n\n const msbpArr: MSBuildProject[] = await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects([proj]));\n if (msbpArr.length === 0 || msbpArr[0] === undefined) {\n throw new Error('This should be impossible!');\n }\n const msbp: MSBuildProject = msbpArr[0];\n\n evaluatedProjects.push(msbp);\n\n return new NugetRegistryInfo({ project: msbp });\n }),\n ).then((nriArray: NugetRegistryInfo[]): string => {\n return nriArray\n .map((nri: NugetRegistryInfo): string =>\n nri.GetPackCommand(NugetRegistryInfo.PackPackagesOptionsType.from({})),\n ).join(' && ');\n });\n }\n}\n\n/**\n * Prepare the CLI command to push NuGet packages. This should added to the `publishCmd` option of `@semantic-release/exec`\n *\n * Ensure your verifyConditionsCmd is set to prevent releases failing due to bad tokens or packages!\n * See {@link NugetRegistryInfo#PackDummyPackage}, {@link NugetRegistryInfo#GetPushDummyCommand}\n * @param registryInfos an array of {@link NugetRegistryInfo} (or derived classes) instances.\n * @param packageOutputPath Default: `${cwd()}/publish`.\\\n * The directory at which dotnet outputs the given projects' packages. Passed to\n * `dotnet pack` via the `--output` argument.\n * @returns a string of `dotnet pack` and `dotnet push` commands, joined by ' && '.\n */\nexport function configureDotnetNugetPush(\n registryInfos: NugetRegistryInfo[],\n // Explicit type required by JSR\n // eslint-disable-next-line @typescript-eslint/no-inferrable-types\n packageOutputPath: string = `${cwd()}/publish`,\n): string {\n if (registryInfos.some(registry => registry.source.trim() === ''))\n throw new Error('The URL for one of the provided NuGet registries was empty or whitespace.');\n\n const packCmds = registryInfos.map(\n (nri): string =>\n nri.GetPackCommand(\n { output: packageOutputPath },\n true,\n true,\n ),\n );\n\n const pushCmds = registryInfos.map(nri => nri.GetPushCommand({ root: packageOutputPath }, true, true));\n\n return [...packCmds, ...pushCmds].join(' && ');\n}\n\n/**\n * You should try {@link ../../dotnet/SignAfterPack.targets}!.\n * @param opts A {@link DotnetNugetSignOptions} object to be deconstructed and\n * passed to `dotnet nuget sign` as args.\n * @returns `dotnet nuget sign {...}`\n */\nfunction formatDotnetNugetSign(\n opts: typeof DotnetNugetSignOptions.inferIn | undefined,\n): string | undefined {\n if (opts === undefined)\n return undefined;\n\n const validOpts = DotnetNugetSignOptions.from(opts);\n const args: ['--timestamper', typeof validOpts.timestamper, '-o', string, ...string[]] = [\n '--timestamper', validOpts.timestamper,\n '-o', validOpts.output ?? ourDefaultPubDir,\n ];\n if (validOpts.certificatePassword)\n args.push('---certificate-password', validOpts.certificatePassword);\n if (validOpts.hashAlgorithm)\n args.push('--hash-algorithm', validOpts.hashAlgorithm);\n if (validOpts.overwrite)\n args.push('--overwrite');\n if (validOpts.timestampHashAlgorithm)\n args.push('--timestamp-hash-algorithm', validOpts.timestampHashAlgorithm);\n if (validOpts.verbosity)\n args.push('-v', validOpts.verbosity);\n\n if ('certificatePath' in validOpts)\n args.push('--certificate-path', validOpts.certificatePath);\n else if ('certificateStoreName' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-name', validOpts.certificateStoreName);\n }\n else if ('certificateStoreLocation' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-location', validOpts.certificateStoreLocation);\n }\n else throw new Error('No code signing certificate was specified!');\n\n return `dotnet nuget sign ${args.join(' ')} `;\n\n // eslint-disable-next-line jsdoc/require-jsdoc\n function SetSubjectNameOrFingerprint() {\n if ('certificateSubjectName' in validOpts)\n args.push('--certificate-subject-name', validOpts.certificateSubjectName);\n\n else if ('certificateFingerprint' in validOpts)\n args.push('--certificate-fingerprint', validOpts.certificateFingerprint);\n else throw new Error('If certificateStoreName or certificateStoreLocation is set, either certificateSubjectName or certificateFingerprint must also be set!');\n }\n}\n\nconst DotnetNugetSignOptions: Type<\n {\n timestamper: Default<string, 'https://rfc3161.ai.moda/'>;\n certificatePassword?: string | undefined;\n hashAlgorithm?: string | undefined;\n output?: string | undefined;\n overwrite?: true | undefined;\n timestampHashAlgorithm?: string | undefined;\n verbosity?: 'q' | 'quiet' | 'm' | 'minimal' | 'n' | 'normal' | 'd' | 'detailed' | 'diag' | 'diagnostic';\n } & ({\n certificatePath: string;\n certificateSubjectName: string;\n } | {\n certificatePath: string;\n certificateFingerprint: string;\n } | {\n certificateStoreName: string;\n certificateSubjectName: string;\n } | {\n certificateStoreName: string;\n certificateFingerprint: string;\n } | {\n certificateStoreLocation: string;\n certificateSubjectName: string;\n } | {\n certificateStoreLocation: string;\n certificateFingerprint: string;\n })> = type({\n /**\n * Password for the certificate, if needed. This option can be used to specify\n * the password for the certificate. The command will throw an error message\n * if certificate is password protected but password is not provided as input.\n */\n 'certificatePassword?': 'string',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'hashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Directory where the signed package(s) should be saved. By default the\n * original package is overwritten by the signed package.\n */\n 'output?': 'string',\n /**\n * Switch to indicate if the current signature should be overwritten. By\n * default the command will fail if the package already has a signature.\n */\n 'overwrite?': 'true',\n /**\n * URL to an RFC 3161 timestamping server.\n */\n timestamper: 'string = \"https://rfc3161.ai.moda/\"',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'timestampHashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Set the verbosity level of the command. Allowed values are q[uiet],\n * m[inimal], n[ormal], d[etailed], and diag[nostic].\n */\n 'verbosity?': '\"q\"|\"quiet\"|\"m\"|\"minimal\"|\"n\"|\"normal\"|\"d\"|\"detailed\"|\"diag\"|\"diagnostic\"',\n}).and(\n type({\n /**\n * File path to the certificate to be used while signing the package.\n */\n certificatePath: 'string',\n }).or(\n type({\n /**\n * Name of the X.509 certificate store to use to search for the\n * certificate. Defaults to \"My\", the X.509 certificate store for personal\n * certificates.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreName: 'string',\n }).or({\n /**\n * Name of the X.509 certificate store use to search for the\n * certificate. Defaults to \"CurrentUser\", the X.509 certificate store\n * used by the current user.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreLocation: 'string',\n }),\n ).and(\n type({\n /**\n * Subject name of the certificate used to search a local certificate\n * store for the certificate. The search is a case-insensitive string\n * comparison using the supplied value, which will find all certificates\n * with the subject name containing that string, regardless of other\n * subject values. The certificate store can be specified by\n * --certificate-store-name and --certificate-store-location options.\n */\n certificateSubjectName: 'string',\n }).or({\n /**\n * SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to\n * search a local certificate store for the certificate. The certificate\n * store can be specified by --certificate-store-name and\n * --certificate-store-location options.\n */\n certificateFingerprint: 'string',\n }),\n ),\n);\n"],"mappings":";;;;;;;AASA,MAAM,mBAAmB,KAA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AAoB,UAAU,cAAc;AACxD,KAAI,UAAU,UACZ,MAAK,KAAK,cAAc;AAC1B,KAAI,UAAU,uBACZ,MAAK,KAAK,8BAA8B,UAAU,uBAAuB;AAC3E,KAAI,UAAU,UACZ,MAAK,KAAK,MAAM,UAAU,UAAU;AAEtC,KAAI,qBAAqB,UACvB,MAAK,KAAK,sBAAsB,UAAU,gBAAgB;UACnD,0BAA0B,WAAW;AAC5C,+BAA6B;AAC7B,OAAK,KAAK,4BAA4B,UAAU,qBAAqB;YAE9D,8BAA8B,WAAW;AAChD,+BAA6B;AAC7B,OAAK,KAAK,gCAAgC,UAAU,yBAAyB;OAE1E,OAAM,IAAI,MAAM,6CAA6C;AAElE,QAAO,qBAAqB,KAAK,KAAK,IAAI,CAAC;CAG3C,SAAS,8BAA8B;AACrC,MAAI,4BAA4B,UAC9B,MAAK,KAAK,8BAA8B,UAAU,uBAAuB;WAElE,4BAA4B,UACnC,MAAK,KAAK,6BAA6B,UAAU,uBAAuB;MACrE,OAAM,IAAI,MAAM,wIAAwI;;;AAIjK,MAAM,yBA2BE,KAAK;CAMX,wBAAwB;CAIxB,kBAAkB;CAKlB,WAAW;CAKX,cAAc;CAId,aAAa;CAIb,2BAA2B;CAK3B,cAAc;CACf,CAAC,CAAC,IACD,KAAK,EAIH,iBAAiB,UAClB,CAAC,CAAC,GACD,KAAK,EASH,sBAAsB,UACvB,CAAC,CAAC,GAAG,EASJ,0BAA0B,UAC3B,CAAC,CACH,CAAC,IACA,KAAK,EASH,wBAAwB,UACzB,CAAC,CAAC,GAAG,EAOJ,wBAAwB,UACzB,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"helpers.mjs","names":["MSBPP"],"sources":["../../src/dotnet/helpers.ts"],"sourcesContent":["import { type, type Type } from 'arktype';\n// eslint-disable-next-line unicorn/import-style\nimport * as path from 'node:path';\nimport { cwd } from 'node:process';\nimport { MSBuildProject } from './MSBuildProject.ts';\nimport { MSBuildProjectProperties as MSBPP } from './MSBuildProjectProperties.ts';\nimport { NugetRegistryInfo } from './NugetRegistryInfo.ts';\nimport type { Default } from 'arktype/internal/attributes.ts';\n\nconst ourDefaultPubDir = path.join('.', 'publish') as `.${'/' | '\\\\'}publish`;\n\n/**\n * Build a prepareCmd string from .NET projects.\\\n * This will include a `dotnet publish` for each project's RID and TFM permutation,\\\n * `dotnet pack` for each project with output paths separated by NuGet Source and PackageId,\\\n * and `dotnet nuget sign` for each nupkg output directory.\n * @todo parse Solution files to publish all projects with default Publish parameters (as evaluated by MSBuild).\n * @param projectsToPublish An array of relative or full file paths of `.csproj`\n * projects -OR- an array of {@link MSBuildProject} objects.\n * The project paths will be passed to `dotnet publish` commands.\n * @param projectsToPackAndPush\n * Relative and/or full file paths of projects to pass to `dotnet pack`. If\n * string[], only the default NuGet Source will be used. If GitHub, GitLab,\n * etc. are also desired, pass {@link NugetRegistryInfo}[]\n * @param dotnetNugetSignOpts A {@link DotnetNugetSignOptions} object. The value\n * of the `--output` argument will be set to {@link ourDefaultPubDir} if `undefined`.\n * @returns A single string of CLI commands joined by ' && '\n */\nexport async function configurePrepareCmd(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush?: string[] | NugetRegistryInfo[],\n dotnetNugetSignOpts?: typeof DotnetNugetSignOptions.inferIn,\n): Promise<string> {\n const evaluatedProjects: MSBuildProject[] = [];\n\n // append evaluated projects\n for (const p of projectsToPublish.filter(p => p instanceof MSBuildProject)) {\n evaluatedProjects.push(p);\n }\n if (projectsToPackAndPush) {\n for (const p of projectsToPackAndPush.filter(p => p instanceof NugetRegistryInfo)) {\n evaluatedProjects.push(p.project);\n }\n }\n\n const dotnetPublishCmd: string = await formatDotnetPublish(projectsToPublish);\n const dotnetPackCmd: string | undefined = await formatDotnetPack(projectsToPackAndPush ?? []);\n const dotnetNugetSignCmd: string | undefined = formatDotnetNugetSign(dotnetNugetSignOpts);\n\n return [\n dotnetPublishCmd,\n dotnetPackCmd,\n dotnetNugetSignCmd,\n // remove no-op commands\n ]\n .filter(v => v !== undefined)\n .join(' && ');\n\n /**\n * Create a string of CLI commands to run `dotnet publish` or the Publish\n * MSBuild target for one or more projects.\n * @async\n * @param projectsToPublish An array of one or more projects, either\n * pre-evaluated (see {@link MSBuildProject.Evaluate}) or as full file paths.\\\n * NOTE: Although `dotnet publish` allows directory or Solution file (.sln,\n * .slnx) paths, this function expects projects' full or relative file\n * paths.\n * @returns A Promise of a string. This string contains one or more `dotnet publish`\n * commands conjoined by \" && \". It may also include one or more\n * `dotnet msbuild ${...} -t:PublishAll -p:Configuration=Release` commands.\n */\n async function formatDotnetPublish(\n projectsToPublish: string[] | MSBuildProject[],\n ): Promise<string> {\n /* Fun Fact: You can define a property and get the evaluated value in the same command!\n ```pwsh\n dotnet msbuild .\\src\\HXE.csproj -property:RuntimeIdentifiers=\"\"\"place;holder\"\"\" -getProperty:RuntimeIdentifiers\n place;holder\n ```\n enclosing with \"\"\" is required in pwsh to prevent the semicolon from breaking the string.\n */\n if (!Array.isArray(projectsToPublish) || projectsToPublish.length === 0) {\n throw new Error(\n `Type of projectsToPublish (${typeof projectsToPublish}) is not allowed. Expected a string[] or MSBuildProject[] where length > 0.`,\n );\n }\n\n // each may have TargetFramework OR TargetFrameworks (plural)\n const evaluatedPublishProjects: MSBuildProject[] = await Promise.all(\n projectsToPublish.map(async (proj): Promise<MSBuildProject> => {\n if (proj instanceof MSBuildProject)\n return proj;\n\n // filter for projects whose full paths match the full path of the given string\n const filteredProjects = evaluatedProjects.filter(p =>\n p.Properties.MSBuildProjectFullPath === MSBPP.GetFullPath(proj),\n );\n\n // if no pre-existing MSBuildProject found,\n // evaluate a new one and push it\n if (filteredProjects.length === 0) {\n const _proj = await MSBuildProject.Evaluate({\n FullName: proj,\n GetProperty: MSBuildProject.MatrixProperties,\n GetItem: [],\n GetTargetResult: [],\n Property: {},\n Targets: ['Restore'],\n });\n evaluatedProjects.push(_proj);\n return _proj;\n }\n\n /**\n * Finds and returns the subjectively \"best\" project in {@link filteredProjects}\n * @returns the subjective \"best\" project in {@link filteredProjects}\n */\n function getBest() {\n let best: MSBuildProject | undefined;\n if (filteredProjects.length > 0 && (best = filteredProjects[0]) instanceof MSBuildProject)\n return best;\n throw new Error('No MSBuildProjects could be found!');\n }\n\n /*\n todo: improve filtering to select \"optimal\" instance.\n Which properties are most-needed?\n For now, we just pray the project has a well-defined publish flow e.g.\n @halospv3/hce.shared-config/dotnet/PublishAll.targets\n */\n return getBest();\n }),\n );\n\n /**\n * Returns an array of one or more `dotnet` arguments.\n * @param proj An {@link MSBuildProject} to be published for one or more\n * runtime-framework combinations.\n * @returns If {@link proj} imports {@link ../../dotnet/PublishAll.targets}...\n * ```\n * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll -p:Configuration=Release`]\n * ```\n * Else, an array of `dotnet publish` arguments permutations e.g.\n * ```\n * [\n * 'myProj.csproj --runtime win7-x86 --framework net6.0',\n * 'myProj.csproj --runtime win7-x64 --framework net6.0'\n * ]\n * ```\n * @example\n * const publishCmdArray = [];\n * const permutations = getPublishArgsPermutations(msbuildProject);\n * for (const permutation of permutations) {\n * if (permutation[0] === 'PublishAll') {\n * // 'dotnet msbuild full/path/to/myProj.csproj t:PublishAll'\n * publishCmdArray.push(`dotnet msbuild ${permutation[1]}`)\n * }\n * else {\n * publishCmdArray.push(`dotnet publish ${permutation}`)\n * }\n * }\n * // return array as success-chained CLI commands.\n * return publishCmdArray.join(' && ');\n */\n function getPublishArgsPermutations(proj: MSBuildProject):\n ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`])\n | ([`\"${typeof proj.Properties.MSBuildProjectFullPath}\"`])\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`)[]\n | (`\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`)[] {\n /**\n * If the project imports PublishAll to publish for each TFM-RID\n * permutation, return the appropriate command line.\n */\n if (proj.Targets.includes('PublishAll'))\n return [`\"${proj.Properties.MSBuildProjectFullPath}\" -t:PublishAll -p:Configuration=Release`];\n\n // #region formatFrameworksAndRuntimes\n const tfmRidPermutations: `--runtime ${string} --framework ${string}`[]\n | `--runtime ${string}`[]\n | `--framework ${string}`[]\n = []; // forEach, run dotnet [proj.Properties.MSBuildProjectFullPath,...v]\n const RIDs: string[] = proj.Properties.RuntimeIdentifiers.split(';').filter(v => v !== '');\n const TFMs: string[] = proj.Properties.TargetFrameworks.split(';').filter(v => v !== '');\n\n if (TFMs.length === 0 && RIDs.length === 0)\n return [`\"${proj.Properties.MSBuildProjectFullPath}\"`] as [`\"${string}\"`];\n\n if (RIDs.length > 0) {\n if (TFMs.length > 0) {\n for (const RID of RIDs) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--runtime ${string} --framework ${string}`[]).push(\n `--runtime ${RID} --framework ${TFM}`,\n );\n }\n }\n }\n else {\n // assume singular TFM. No need to specify it.\n for (const RID of RIDs) {\n (tfmRidPermutations as `--runtime ${string}`[]).push(\n `--runtime ${RID}`,\n );\n }\n }\n }\n else if (TFMs.length > 0) {\n for (const TFM of TFMs) {\n (tfmRidPermutations as `--framework ${string}`[]).push(`--framework ${TFM}`);\n }\n }\n\n /** prepend each set of args with the project's path */\n return tfmRidPermutations.map(permArgs =>\n `\"${proj.Properties.MSBuildProjectFullPath}\" ${permArgs}`,\n ) as `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string} --framework ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --runtime ${string}`[]\n | `\"${typeof proj.Properties.MSBuildProjectFullPath}\" --framework ${string}`[];\n // #endregion formatFrameworksAndRuntimes\n }\n\n const publishCmds: (`dotnet publish \"${string}\"` | `dotnet publish \"${string}\" ${string}` | `dotnet msbuild \"${string}\" -t:PublishAll -p:Configuration=Release`)[] = [];\n /** convert {@link evaluatedPublishProjects} to sets of space-separated CLI args. */\n const argsSets = evaluatedPublishProjects.map(\n proj => getPublishArgsPermutations(proj),\n );\n for (const args of argsSets) {\n if (typeof args === 'string')\n throw new Error(`\\`args\\` should not be a string!`);\n for (const permutation of args) {\n if (typeof permutation === 'string' && permutation.length === 1)\n throw new Error('Something has gone terribly wrong. A `dotnet publish` argument set was split to single characters!');\n if (/\".+\" -t:PublishAll -p:Configuration=Release/.test(permutation))\n publishCmds.push(`dotnet msbuild ${permutation as `\"${string}\" -t:PublishAll -p:Configuration=Release`}`);\n else\n publishCmds.push(`dotnet publish ${permutation}`);\n }\n }\n\n // For each argSet, create a new exec command. Then, join all commands with ' && ' so they are executed serially, synchronously.\n // e.g. `dotnet publish project.csproj --runtime win7-x86 --framework net6.0 && dotnet publish project.csproj --runtime win-x64 --framework net8.0\n return publishCmds.join(' && ');\n }\n\n /**\n * @param projectsToPackAndPush a string[] or {@link NugetRegistryInfo}[].\n * If a string[], the string must be the platform-dependent (not file://),\n * full path(s) to one or more projects with the .NET \"Pack\" MSBuild target.\n * See {@link https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack}\n * for command line usage.\n * @returns one or more command line strings joined with ' && '.\n * Each command line comprises the `dotnet pack` command, a project file path,\n * and a hardcoded output path (`--output ${cwd()}/publish`)\n */\n async function formatDotnetPack(\n projectsToPackAndPush: string[] | NugetRegistryInfo[],\n ): Promise<string | undefined> {\n if (projectsToPackAndPush.length === 0)\n return undefined;\n return await Promise.all(\n projectsToPackAndPush.map(async (proj) => {\n if (proj instanceof NugetRegistryInfo)\n return proj;\n\n const msbpArr: MSBuildProject[] = await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects([proj]));\n if (msbpArr.length === 0 || msbpArr[0] === undefined) {\n throw new Error('This should be impossible!');\n }\n const msbp: MSBuildProject = msbpArr[0];\n\n evaluatedProjects.push(msbp);\n\n return new NugetRegistryInfo({ project: msbp });\n }),\n ).then((nriArray: NugetRegistryInfo[]): string => {\n return nriArray\n .map((nri: NugetRegistryInfo): string =>\n nri.GetPackCommand(NugetRegistryInfo.PackPackagesOptionsType.from({})),\n ).join(' && ');\n });\n }\n}\n\n/**\n * Prepare the CLI command to push NuGet packages. This should added to the `publishCmd` option of `@semantic-release/exec`\n *\n * Ensure your verifyConditionsCmd is set to prevent releases failing due to bad tokens or packages!\n * See {@link NugetRegistryInfo#PackDummyPackage}, {@link NugetRegistryInfo#GetPushDummyCommand}\n * @param registryInfos an array of {@link NugetRegistryInfo} (or derived classes) instances.\n * @param packageOutputPath Default: `${cwd()}/publish`.\\\n * The directory at which dotnet outputs the given projects' packages. Passed to\n * `dotnet pack` via the `--output` argument.\n * @returns a string of `dotnet pack` and `dotnet push` commands, joined by ' && '.\n */\nexport function configureDotnetNugetPush(\n registryInfos: NugetRegistryInfo[],\n // Explicit type required by JSR\n // eslint-disable-next-line @typescript-eslint/no-inferrable-types\n packageOutputPath: string = `${cwd()}/publish`,\n): string {\n if (registryInfos.some(registry => registry.source.trim() === ''))\n throw new Error('The URL for one of the provided NuGet registries was empty or whitespace.');\n\n const packCmds = registryInfos.map(\n (nri): string =>\n nri.GetPackCommand(\n { output: packageOutputPath },\n true,\n true,\n ),\n );\n\n const pushCmds = registryInfos.map(nri => nri.GetPushCommand({ root: packageOutputPath }, true, true));\n\n return [...packCmds, ...pushCmds].join(' && ');\n}\n\n/**\n * You should try {@link ../../dotnet/SignAfterPack.targets}!.\n * @param opts A {@link DotnetNugetSignOptions} object to be deconstructed and\n * passed to `dotnet nuget sign` as args.\n * @returns `dotnet nuget sign {...}`\n */\nfunction formatDotnetNugetSign(\n opts: typeof DotnetNugetSignOptions.inferIn | undefined,\n): string | undefined {\n if (opts === undefined)\n return undefined;\n\n const validOpts = DotnetNugetSignOptions.from(opts);\n const args: ['--timestamper', typeof validOpts.timestamper, '-o', string, ...string[]] = [\n '--timestamper', validOpts.timestamper,\n '-o', validOpts.output ?? ourDefaultPubDir,\n ];\n if (validOpts.certificatePassword)\n args.push('---certificate-password', validOpts.certificatePassword);\n if (validOpts.hashAlgorithm)\n args.push('--hash-algorithm', validOpts.hashAlgorithm);\n if (validOpts.overwrite)\n args.push('--overwrite');\n if (validOpts.timestampHashAlgorithm)\n args.push('--timestamp-hash-algorithm', validOpts.timestampHashAlgorithm);\n if (validOpts.verbosity)\n args.push('-v', validOpts.verbosity);\n\n if ('certificatePath' in validOpts)\n args.push('--certificate-path', validOpts.certificatePath);\n else if ('certificateStoreName' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-name', validOpts.certificateStoreName);\n }\n else if ('certificateStoreLocation' in validOpts) {\n SetSubjectNameOrFingerprint();\n args.push('--certificate-store-location', validOpts.certificateStoreLocation);\n }\n else throw new Error('No code signing certificate was specified!');\n\n return `dotnet nuget sign ${args.join(' ')} `;\n\n // eslint-disable-next-line jsdoc/require-jsdoc\n function SetSubjectNameOrFingerprint() {\n if ('certificateSubjectName' in validOpts)\n args.push('--certificate-subject-name', validOpts.certificateSubjectName);\n\n else if ('certificateFingerprint' in validOpts)\n args.push('--certificate-fingerprint', validOpts.certificateFingerprint);\n else throw new Error('If certificateStoreName or certificateStoreLocation is set, either certificateSubjectName or certificateFingerprint must also be set!');\n }\n}\n\nconst DotnetNugetSignOptions: Type<\n {\n timestamper: Default<string, 'https://rfc3161.ai.moda/'>;\n certificatePassword?: string | undefined;\n hashAlgorithm?: string | undefined;\n output?: string | undefined;\n overwrite?: true | undefined;\n timestampHashAlgorithm?: string | undefined;\n verbosity?: 'q' | 'quiet' | 'm' | 'minimal' | 'n' | 'normal' | 'd' | 'detailed' | 'diag' | 'diagnostic';\n } & ({\n certificatePath: string;\n certificateSubjectName: string;\n } | {\n certificatePath: string;\n certificateFingerprint: string;\n } | {\n certificateStoreName: string;\n certificateSubjectName: string;\n } | {\n certificateStoreName: string;\n certificateFingerprint: string;\n } | {\n certificateStoreLocation: string;\n certificateSubjectName: string;\n } | {\n certificateStoreLocation: string;\n certificateFingerprint: string;\n })> = type({\n /**\n * Password for the certificate, if needed. This option can be used to specify\n * the password for the certificate. The command will throw an error message\n * if certificate is password protected but password is not provided as input.\n */\n 'certificatePassword?': 'string',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'hashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Directory where the signed package(s) should be saved. By default the\n * original package is overwritten by the signed package.\n */\n 'output?': 'string',\n /**\n * Switch to indicate if the current signature should be overwritten. By\n * default the command will fail if the package already has a signature.\n */\n 'overwrite?': 'true',\n /**\n * URL to an RFC 3161 timestamping server.\n */\n timestamper: 'string = \"https://rfc3161.ai.moda/\"',\n /**\n * Hash algorithm to be used to sign the package. Defaults to SHA256.\n */\n 'timestampHashAlgorithm?': 'string | \"SHA256\"',\n /**\n * Set the verbosity level of the command. Allowed values are q[uiet],\n * m[inimal], n[ormal], d[etailed], and diag[nostic].\n */\n 'verbosity?': '\"q\"|\"quiet\"|\"m\"|\"minimal\"|\"n\"|\"normal\"|\"d\"|\"detailed\"|\"diag\"|\"diagnostic\"',\n}).and(\n type({\n /**\n * File path to the certificate to be used while signing the package.\n */\n certificatePath: 'string',\n }).or(\n type({\n /**\n * Name of the X.509 certificate store to use to search for the\n * certificate. Defaults to \"My\", the X.509 certificate store for personal\n * certificates.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreName: 'string',\n }).or({\n /**\n * Name of the X.509 certificate store use to search for the\n * certificate. Defaults to \"CurrentUser\", the X.509 certificate store\n * used by the current user.\n *\n * This option should be used when specifying the certificate via\n * --certificate-subject-name or --certificate-fingerprint options.\n */\n certificateStoreLocation: 'string',\n }),\n ).and(\n type({\n /**\n * Subject name of the certificate used to search a local certificate\n * store for the certificate. The search is a case-insensitive string\n * comparison using the supplied value, which will find all certificates\n * with the subject name containing that string, regardless of other\n * subject values. The certificate store can be specified by\n * --certificate-store-name and --certificate-store-location options.\n */\n certificateSubjectName: 'string',\n }).or({\n /**\n * SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to\n * search a local certificate store for the certificate. The certificate\n * store can be specified by --certificate-store-name and\n * --certificate-store-location options.\n */\n certificateFingerprint: 'string',\n }),\n ),\n);\n"],"mappings":";;;;;;;AASA,MAAM,mBAAmB,KAAK,KAAK,KAAK,UAAU;;;;;;;;;;;;;;;;;;AAmBlD,eAAsB,oBACpB,mBACA,uBACA,qBACiB;CACjB,MAAM,oBAAsC,EAAE;CAG9C,KAAK,MAAM,KAAK,kBAAkB,QAAO,MAAK,aAAa,eAAe,EACxE,kBAAkB,KAAK,EAAE;CAE3B,IAAI,uBACF,KAAK,MAAM,KAAK,sBAAsB,QAAO,MAAK,aAAa,kBAAkB,EAC/E,kBAAkB,KAAK,EAAE,QAAQ;CAQrC,OAAO;EACL,MALqC,oBAAoB,kBAAkB;EAM3E,MAL8C,iBAAiB,yBAAyB,EAAE,CAAC;EAC9C,sBAAsB,oBAKjD;EAEnB,CACE,QAAO,MAAK,MAAM,KAAA,EAAU,CAC5B,KAAK,OAAO;;;;;;;;;;;;;;CAef,eAAe,oBACb,mBACiB;EAQjB,IAAI,CAAC,MAAM,QAAQ,kBAAkB,IAAI,kBAAkB,WAAW,GACpE,MAAM,IAAI,MACR,8BAA8B,OAAO,kBAAkB,6EACxD;EAIH,MAAM,2BAA6C,MAAM,QAAQ,IAC/D,kBAAkB,IAAI,OAAO,SAAkC;GAC7D,IAAI,gBAAgB,gBAClB,OAAO;GAGT,MAAM,mBAAmB,kBAAkB,QAAO,MAChD,EAAE,WAAW,2BAA2BA,yBAAM,YAAY,KAAK,CAChE;GAID,IAAI,iBAAiB,WAAW,GAAG;IACjC,MAAM,QAAQ,MAAM,eAAe,SAAS;KAC1C,UAAU;KACV,aAAa,eAAe;KAC5B,SAAS,EAAE;KACX,iBAAiB,EAAE;KACnB,UAAU,EAAE;KACZ,SAAS,CAAC,UAAU;KACrB,CAAC;IACF,kBAAkB,KAAK,MAAM;IAC7B,OAAO;;;;;;GAOT,SAAS,UAAU;IACjB,IAAI;IACJ,IAAI,iB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,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"insertPlugins.mjs","names":[],"sources":["../src/insertPlugins.ts"],"sourcesContent":["import type {\n PluginSpec,\n Options as SemanticReleaseOptions,\n} from 'semantic-release';\n\n/**\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\ninterface PluginInsertRuleSet {\n Id: string;\n BeforeIds: string[];\n AfterIds: string[];\n}\n\n/**\n * [W.I.P. STUB]\n *\n * Given an array of {@link PluginInsertRuleSet}s, insert plugins into a\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone structured clone}\n * (i.e. deep-copy) of the {@link plugins} array, sort the plugin entries, and\n * return the modified array copy.\n * @todo implement\n * @param plugins Your {@link SemanticReleaseOptions.plugins} array.\n * @param inserts An array of {@link PluginInsertRuleSet}s.\n *\n * If a plugin is already in the plugins array, inserting is skipped. The\n * existing entry is sorted according to its ruleset.\n *\n * If any rulesets conflict, an error will be thrown.\n * - error: A must precede B; B must precede A.\n * - pass: C must precede D and E; D must precede E and follow B. Add ruleset\n * interface: {Id:string, BeforeIds:string[], AfterIds:string[] }\n * @returns A deep-cloned, modified copy of {@link plugins} with plugins\n * inserted and sorted where needed.\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ndeclare function insertAndSortPlugins(\n plugins: Exclude<SemanticReleaseOptions['plugins'], undefined>,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n inserts: PluginInsertRuleSet[],\n): PluginSpec[];\n\n/**\n * @param plugins {@link SemanticReleaseOptions.plugins}\n * @param afterPluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must follow.\n * @param insertPluginIDs The `string` IDs of plugins to insert into a copy of the {@link plugins} array.\n * @param beforePluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must precede.\n * @returns\n * A modified copy of {@link plugins} with the given plugins inserted\n * before {@link beforePluginsIDs} and after {@link afterPluginsIDs}.\n *\n * Inserted plugins will be a `[string, {}]` tuple.\n * @throws {ReferenceError} This should never occur. One or more of the\n * {@link afterPluginsIDs} had been found in {@link plugins}, but a `.find` call\n * to get the highest index of the found plugins had returned `undefined`\n * @throws {AggregateError} One or more error occurred when inserting plugins: `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`\n */\nexport function insertPlugin(\n plugins: Exclude<PluginSpec, string>[],\n afterPluginsIDs: string[],\n insertPluginIDs: string[],\n beforePluginsIDs: string[],\n): Exclude<PluginSpec, string>[] {\n const pluginIDs = plugins.map(v =>\n typeof v === 'string' ? v : v[0],\n );\n\n // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.\n\n const indexOfLastAfter = afterPluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort()\n .find((_v, i, obj) => i === obj.length - 1);\n if (undefined === indexOfLastAfter)\n throw new ReferenceError(\n 'An attempt to get the last element of an array returned undefined.',\n );\n\n const indicesOfBefore = beforePluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort();\n\n // This for-of collects *all* sorting errors. The resulting AggregateError\n // notifies the API user of *all* errors in the order rather than just the\n // first error encountered.\n const errors: Error[] = [];\n for (const index of indicesOfBefore) {\n if (index <= indexOfLastAfter) {\n errors.push(\n new Error(\n `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`,\n ),\n );\n }\n }\n if (errors.length > 0)\n throw new AggregateError(errors, 'One or more errors occurred while inserting plugin configs into the Semantic Release config!');\n\n // insert plugin(s)\n\n const beforeInsert = plugins.slice(0, indexOfLastAfter + 1);\n const afterInsert = plugins.slice(indexOfLastAfter + 1, plugins.length + 1);\n\n return [\n ...beforeInsert,\n ...insertPluginIDs.map(id =>\n [id, {}] as [string, unknown],\n ),\n ...afterInsert,\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4DA,SAAgB,aACd,SACA,iBACA,iBACA,kBAC+B;CAC/B,MAAM,YAAY,QAAQ,KAAI,MAC5B,OAAO,MAAM,WAAW,IAAI,EAAE,GAC/B;CAID,MAAM,mBAAmB,gBACtB,QAAO,MAAK,UAAU,SAAS,EAAE,CAAC,CAClC,KAAI,MAAK,UAAU,QAAQ,EAAE,CAAC,CAC9B,MAAM,CACN,MAAM,IAAI,GAAG,QAAQ,MAAM,IAAI,SAAS,EAAE;AAC7C,KAAI,KAAA,MAAc,iBAChB,OAAM,IAAI,eACR,qEACD;CAEH,MAAM,kBAAkB,iBACrB,QAAO,MAAK,UAAU,SAAS,EAAE,CAAC,CAClC,KAAI,MAAK,UAAU,QAAQ,EAAE,CAAC,CAC9B,MAAM;CAKT,MAAM,SAAkB,EAAE;AAC1B,MAAK,MAAM,SAAS,gBAClB,KAAI,SAAS,iBACX,QAAO,qBACL,IAAI,MACF,oEAAoE,gBAAgB,KAAI,MAAK,OAAM,IAAI,KAAI,CAAC,KAAK,KAAK,CAAC,gBAAgB,iBAAiB,KAAI,MAAK,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC,SAAS,KAAK,UAAU,UAAU,kBAAkB,CAAC,eAAe,KAAK,UAAU,UAAU,OAAO,CAAC,GAC5R,CACF;AAGL,KAAI,OAAO,SAAS,EAClB,OAAM,IAAI,eAAe,QAAQ,+FAA+F;CAIlI,MAAM,eAAe,QAAQ,MAAM,GAAG,mBAAmB,EAAE;CAC3D,MAAM,cAAc,QAAQ,MAAM,mBAAmB,GAAG,QAAQ,SAAS,EAAE;AAE3E,QAAO;EACL,GAAG;EACH,GAAG,gBAAgB,KAAI,OACrB,CAAC,IAAI,EAAE,CAAC,CACT;EACD,GAAG;EACJ"}
1
+ {"version":3,"file":"insertPlugins.mjs","names":[],"sources":["../src/insertPlugins.ts"],"sourcesContent":["import type {\n PluginSpec,\n Options as SemanticReleaseOptions,\n} from 'semantic-release';\n\n/**\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\ninterface PluginInsertRuleSet {\n Id: string;\n BeforeIds: string[];\n AfterIds: string[];\n}\n\n/**\n * [W.I.P. STUB]\n *\n * Given an array of {@link PluginInsertRuleSet}s, insert plugins into a\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone structured clone}\n * (i.e. deep-copy) of the {@link plugins} array, sort the plugin entries, and\n * return the modified array copy.\n * @todo implement\n * @param plugins Your {@link SemanticReleaseOptions.plugins} array.\n * @param inserts An array of {@link PluginInsertRuleSet}s.\n *\n * If a plugin is already in the plugins array, inserting is skipped. The\n * existing entry is sorted according to its ruleset.\n *\n * If any rulesets conflict, an error will be thrown.\n * - error: A must precede B; B must precede A.\n * - pass: C must precede D and E; D must precede E and follow B. Add ruleset\n * interface: {Id:string, BeforeIds:string[], AfterIds:string[] }\n * @returns A deep-cloned, modified copy of {@link plugins} with plugins\n * inserted and sorted where needed.\n * @since 3.0.0\n * @deprecated EXPERIMENTAL\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ndeclare function insertAndSortPlugins(\n plugins: Exclude<SemanticReleaseOptions['plugins'], undefined>,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n inserts: PluginInsertRuleSet[],\n): PluginSpec[];\n\n/**\n * @param plugins {@link SemanticReleaseOptions.plugins}\n * @param afterPluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must follow.\n * @param insertPluginIDs The `string` IDs of plugins to insert into a copy of the {@link plugins} array.\n * @param beforePluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must precede.\n * @returns\n * A modified copy of {@link plugins} with the given plugins inserted\n * before {@link beforePluginsIDs} and after {@link afterPluginsIDs}.\n *\n * Inserted plugins will be a `[string, {}]` tuple.\n * @throws {ReferenceError} This should never occur. One or more of the\n * {@link afterPluginsIDs} had been found in {@link plugins}, but a `.find` call\n * to get the highest index of the found plugins had returned `undefined`\n * @throws {AggregateError} One or more error occurred when inserting plugins: `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`\n */\nexport function insertPlugin(\n plugins: Exclude<PluginSpec, string>[],\n afterPluginsIDs: string[],\n insertPluginIDs: string[],\n beforePluginsIDs: string[],\n): Exclude<PluginSpec, string>[] {\n const pluginIDs = plugins.map(v =>\n typeof v === 'string' ? v : v[0],\n );\n\n // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.\n\n const indexOfLastAfter = afterPluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort()\n .find((_v, i, obj) => i === obj.length - 1);\n if (undefined === indexOfLastAfter)\n throw new ReferenceError(\n 'An attempt to get the last element of an array returned undefined.',\n );\n\n const indicesOfBefore = beforePluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort();\n\n // This for-of collects *all* sorting errors. The resulting AggregateError\n // notifies the API user of *all* errors in the order rather than just the\n // first error encountered.\n const errors: Error[] = [];\n for (const index of indicesOfBefore) {\n if (index <= indexOfLastAfter) {\n errors.push(\n new Error(\n `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '\"' + v + '\"').join(', ')}] and before [${beforePluginsIDs.map(v => `\"${v}\"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`,\n ),\n );\n }\n }\n if (errors.length > 0)\n throw new AggregateError(errors, 'One or more errors occurred while inserting plugin configs into the Semantic Release config!');\n\n // insert plugin(s)\n\n const beforeInsert = plugins.slice(0, indexOfLastAfter + 1);\n const afterInsert = plugins.slice(indexOfLastAfter + 1, plugins.length + 1);\n\n return [\n ...beforeInsert,\n ...insertPluginIDs.map(id =>\n [id, {}] as [string, unknown],\n ),\n ...afterInsert,\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4DA,SAAgB,aACd,SACA,iBACA,iBACA,kBAC+B;CAC/B,MAAM,YAAY,QAAQ,KAAI,MAC5B,OAAO,MAAM,WAAW,IAAI,EAAE,GAC/B;CAID,MAAM,mBAAmB,gBACtB,QAAO,MAAK,UAAU,SAAS,EAAE,CAAC,CAClC,KAAI,MAAK,UAAU,QAAQ,EAAE,CAAC,CAC9B,MAAM,CACN,MAAM,IAAI,GAAG,QAAQ,MAAM,IAAI,SAAS,EAAE;CAC7C,IAAI,KAAA,MAAc,kBAChB,MAAM,IAAI,eACR,qEACD;CAEH,MAAM,kBAAkB,iBACrB,QAAO,MAAK,UAAU,SAAS,EAAE,CAAC,CAClC,KAAI,MAAK,UAAU,QAAQ,EAAE,CAAC,CAC9B,MAAM;CAKT,MAAM,SAAkB,EAAE;CAC1B,KAAK,MAAM,SAAS,iBAClB,IAAI,SAAS,kBACX,OAAO,qBACL,IAAI,MACF,oEAAoE,gBAAgB,KAAI,MAAK,OAAM,IAAI,KAAI,CAAC,KAAK,KAAK,CAAC,gBAAgB,iBAAiB,KAAI,MAAK,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC,SAAS,KAAK,UAAU,UAAU,kBAAkB,CAAC,eAAe,KAAK,UAAU,UAAU,OAAO,CAAC,GAC5R,CACF;CAGL,IAAI,OAAO,SAAS,GAClB,MAAM,IAAI,eAAe,QAAQ,+FAA+F;CAIlI,MAAM,eAAe,QAAQ,MAAM,GAAG,mBAAmB,EAAE;CAC3D,MAAM,cAAc,QAAQ,MAAM,mBAAmB,GAAG,QAAQ,SAAS,EAAE;CAE3E,OAAO;EACL,GAAG;EACH,GAAG,gBAAgB,KAAI,OACrB,CAAC,IAAI,EAAE,CAAC,CACT;EACD,GAAG;EACJ"}
@@ -39,6 +39,7 @@ const defaultPlugins = Object.freeze([
39
39
  * @satisfies {Options}
40
40
  */
41
41
  const baseConfig = {
42
+ /** @see https://semantic-release.gitbook.io/semantic-release/usage/plugins#plugin-options-configuration */
42
43
  preset: "conventionalcommits",
43
44
  branches: ["main", {
44
45
  name: "develop",
@@ -1 +1 @@
1
- {"version":3,"file":"semanticReleaseConfig.mjs","names":[],"sources":["../src/semanticReleaseConfig.ts"],"sourcesContent":["// @ts-types=\"./semantic-release__commit-analyzer.d.ts\"\nimport type { Options as SRCommitAnalyzerOptions } from '@semantic-release/commit-analyzer';\n// @ts-types=\"./semantic-release__exec.d.ts\"\nimport type { Options as SRExecOptions } from '@semantic-release/exec';\n// @ts-types=\"./semantic-release__git.d.ts\"\nimport type { Options as SRGitOptions } from '@semantic-release/git';\n// @ts-types=\"./semantic-release__github.d.ts\"\nimport type { Options as SRGithubOptions } from '@semantic-release/github';\nimport type { Options, PluginSpec } from 'semantic-release';\nimport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\nexport interface SRReleaseNotesGeneratorOptions {\n /**\n * conventional-changelog preset.\n * @default 'angular'\n */\n preset?: 'angular' | 'atom' | 'codemirror' | 'ember' | 'eslint' | 'express' | 'jquery' | 'jscs' | 'jshint' | 'conventionalcommits' | (string & Record<never, never>) | undefined;\n /**\n * Requireable npm package with a custom conventional-changelog preset.\n */\n config?: string | undefined;\n /**\n * Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.\n */\n parserOpts: object;\n /**\n * Additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.\n */\n writerOpts: object;\n}\n\n/**\n * A two-type PluginSpec to tie a plugin's name to its Options type. This is\n * intended for use by plugins to associate their Options type with their plugin\n * name.\n */\nexport type PluginSpecTuple<P extends string = string, T = unknown> = [P, T];\nexport type PluginSpecSRCommitAnalyzer<V extends SRCommitAnalyzerOptions = SRCommitAnalyzerOptions> = PluginSpecTuple<'@semantic-release/commit-analyzer', V>;\nexport type PluginSpecSRChangelog<V extends Record<'changelogFile' | 'changelogTitle', string>> = PluginSpecTuple<'@semantic-release/changelog', V>;\nexport type PluginSpecExportData<V extends Record<string, unknown> = Record<string, unknown>> = PluginSpecTuple<'semantic-release-export-data', V>;\nexport type PluginSpecSRReleaseNotesGen<V extends SRReleaseNotesGeneratorOptions = SRReleaseNotesGeneratorOptions> = PluginSpecTuple<'@semantic-release/release-notes-generator', V>;\nexport type PluginSpecSRExec<V extends SRExecOptions = SRExecOptions> = PluginSpecTuple<'@semantic-release/exec', V>;\nexport type PluginSpecSRGit<V extends SRGitOptions = SRGitOptions> = PluginSpecTuple<'@semantic-release/git', V>;\nexport type PluginSpecSRGithub<V extends SRGithubOptions = SRGithubOptions> = PluginSpecTuple<'@semantic-release/github', V>;\n\n/**\n * @satisfies { Readonly<PluginSpec[]> }\n */\nexport const defaultPlugins: readonly [\n '@semantic-release/commit-analyzer',\n '@semantic-release/release-notes-generator',\n '@semantic-release/npm',\n '@semantic-release/github',\n] = Object.freeze([\n '@semantic-release/commit-analyzer',\n '@semantic-release/release-notes-generator',\n '@semantic-release/npm',\n '@semantic-release/github',\n] as const) satisfies readonly PluginSpec[];\n\n// define as const for string literals in type, then...\n/**\n * @see baseConfig\n */\nconst _baseConfig = {\n /** @see https://semantic-release.gitbook.io/semantic-release/usage/plugins#plugin-options-configuration */\n preset: 'conventionalcommits' as const,\n branches: [\n 'main',\n { name: 'develop', channel: 'develop', prerelease: true },\n ] as ['main', { name: 'develop'; channel: 'develop'; prerelease: true }],\n plugins: [\n ['@semantic-release/commit-analyzer', {}],\n ['semantic-release-export-data', {}],\n ['@semantic-release/release-notes-generator', {}],\n ['@semantic-release/changelog', {}],\n ['@semantic-release/git', DefaultOptions],\n ['@semantic-release/exec', {}],\n ['@semantic-release/github', { addReleases: 'bottom', assets: ['./publish/*', '!./publish/.gitkeep'] }],\n ] as [\n PluginSpecSRCommitAnalyzer,\n PluginSpecExportData,\n PluginSpecSRReleaseNotesGen,\n PluginSpecSRChangelog<Record<'changelogFile' | 'changelogTitle', string>>,\n PluginSpecSRGit<typeof DefaultOptions>,\n PluginSpecSRExec,\n PluginSpecSRGithub<{ addReleases: 'bottom'; assets: [{ path: './publish/*' }] }>,\n ] | Exclude<PluginSpec, string>[],\n};\n\n/**\n * The base configuration for various Semantic Release scenarios.\n * - Prefers preset \"conventionalcommits\"\n * (Conventional-Changelog-ConventionalCommits).\n * - Creates tags and release commits on \"main\" branch, pre-releases on\n * \"develop\" branch in \"develop\" channel.\n * - Creates GitHub Releases.\n * - Exports the following variables as GitHub Actions outputs:\n * - \"new-release-published\": \"true\" | \"false\"\n * - \"new-release-version\" : string\n * - \"new-release-git-tag\" : string\n * - includes default plugins (except `@semantic-release/npm`) and more\n * - `@semantic-release/commit-analyzer`\n * - semantic-release-export-data\n * - `@semantic-release/release-notes-generator`\n * - `@semantic-release/changelog`\n * - `@semantic-release/git`\n * - add modified CHANGELOG.md in release commit\n * - `@semantic-release/exec`\n * - does nothing by default. Included for convenience.\n * - `@semantic-release/github`\n * - uploads all files from `./publish/*`. This is non-recursive.\n * - adds a list of links to related release pages (e.g. the release's page on npmjs.com)\n *\n * (OPTIONAL) update static Version strings before Git plugin\n * - https://github.com/jpoehnelt/semantic-release-replace-plugin\n * - https://github.com/droidsolutions/semantic-release-update-file\n * @satisfies {Options}\n */\nexport const baseConfig: typeof _baseConfig = _baseConfig satisfies Options;\n"],"mappings":";;;;;AAgDA,MAAa,iBAKT,OAAO,OAAO;CAChB;CACA;CACA;CACA;CACD,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DX,MAAa,aAvDO;CAElB,QAAQ;CACR,UAAU,CACR,QACA;EAAE,MAAM;EAAW,SAAS;EAAW,YAAY;EAAM,CAC1D;CACD,SAAS;EACP,CAAC,qCAAqC,EAAE,CAAC;EACzC,CAAC,gCAAgC,EAAE,CAAC;EACpC,CAAC,6CAA6C,EAAE,CAAC;EACjD,CAAC,+BAA+B,EAAE,CAAC;EACnC,CAAC,yBAAyB,eAAe;EACzC,CAAC,0BAA0B,EAAE,CAAC;EAC9B,CAAC,4BAA4B;GAAE,aAAa;GAAU,QAAQ,CAAC,eAAe,sBAAsB;GAAE,CAAC;EACxG;CASF"}
1
+ {"version":3,"file":"semanticReleaseConfig.mjs","names":[],"sources":["../src/semanticReleaseConfig.ts"],"sourcesContent":["// @ts-types=\"./semantic-release__commit-analyzer.d.ts\"\nimport type { Options as SRCommitAnalyzerOptions } from '@semantic-release/commit-analyzer';\n// @ts-types=\"./semantic-release__exec.d.ts\"\nimport type { Options as SRExecOptions } from '@semantic-release/exec';\n// @ts-types=\"./semantic-release__git.d.ts\"\nimport type { Options as SRGitOptions } from '@semantic-release/git';\n// @ts-types=\"./semantic-release__github.d.ts\"\nimport type { Options as SRGithubOptions } from '@semantic-release/github';\nimport type { Options, PluginSpec } from 'semantic-release';\nimport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\nexport interface SRReleaseNotesGeneratorOptions {\n /**\n * conventional-changelog preset.\n * @default 'angular'\n */\n preset?: 'angular' | 'atom' | 'codemirror' | 'ember' | 'eslint' | 'express' | 'jquery' | 'jscs' | 'jshint' | 'conventionalcommits' | (string & Record<never, never>) | undefined;\n /**\n * Requireable npm package with a custom conventional-changelog preset.\n */\n config?: string | undefined;\n /**\n * Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.\n */\n parserOpts: object;\n /**\n * Additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.\n */\n writerOpts: object;\n}\n\n/**\n * A two-type PluginSpec to tie a plugin's name to its Options type. This is\n * intended for use by plugins to associate their Options type with their plugin\n * name.\n */\nexport type PluginSpecTuple<P extends string = string, T = unknown> = [P, T];\nexport type PluginSpecSRCommitAnalyzer<V extends SRCommitAnalyzerOptions = SRCommitAnalyzerOptions> = PluginSpecTuple<'@semantic-release/commit-analyzer', V>;\nexport type PluginSpecSRChangelog<V extends Record<'changelogFile' | 'changelogTitle', string>> = PluginSpecTuple<'@semantic-release/changelog', V>;\nexport type PluginSpecExportData<V extends Record<string, unknown> = Record<string, unknown>> = PluginSpecTuple<'semantic-release-export-data', V>;\nexport type PluginSpecSRReleaseNotesGen<V extends SRReleaseNotesGeneratorOptions = SRReleaseNotesGeneratorOptions> = PluginSpecTuple<'@semantic-release/release-notes-generator', V>;\nexport type PluginSpecSRExec<V extends SRExecOptions = SRExecOptions> = PluginSpecTuple<'@semantic-release/exec', V>;\nexport type PluginSpecSRGit<V extends SRGitOptions = SRGitOptions> = PluginSpecTuple<'@semantic-release/git', V>;\nexport type PluginSpecSRGithub<V extends SRGithubOptions = SRGithubOptions> = PluginSpecTuple<'@semantic-release/github', V>;\n\n/**\n * @satisfies { Readonly<PluginSpec[]> }\n */\nexport const defaultPlugins: readonly [\n '@semantic-release/commit-analyzer',\n '@semantic-release/release-notes-generator',\n '@semantic-release/npm',\n '@semantic-release/github',\n] = Object.freeze([\n '@semantic-release/commit-analyzer',\n '@semantic-release/release-notes-generator',\n '@semantic-release/npm',\n '@semantic-release/github',\n] as const) satisfies readonly PluginSpec[];\n\n// define as const for string literals in type, then...\n/**\n * @see baseConfig\n */\nconst _baseConfig = {\n /** @see https://semantic-release.gitbook.io/semantic-release/usage/plugins#plugin-options-configuration */\n preset: 'conventionalcommits' as const,\n branches: [\n 'main',\n { name: 'develop', channel: 'develop', prerelease: true },\n ] as ['main', { name: 'develop'; channel: 'develop'; prerelease: true }],\n plugins: [\n ['@semantic-release/commit-analyzer', {}],\n ['semantic-release-export-data', {}],\n ['@semantic-release/release-notes-generator', {}],\n ['@semantic-release/changelog', {}],\n ['@semantic-release/git', DefaultOptions],\n ['@semantic-release/exec', {}],\n ['@semantic-release/github', { addReleases: 'bottom', assets: ['./publish/*', '!./publish/.gitkeep'] }],\n ] as [\n PluginSpecSRCommitAnalyzer,\n PluginSpecExportData,\n PluginSpecSRReleaseNotesGen,\n PluginSpecSRChangelog<Record<'changelogFile' | 'changelogTitle', string>>,\n PluginSpecSRGit<typeof DefaultOptions>,\n PluginSpecSRExec,\n PluginSpecSRGithub<{ addReleases: 'bottom'; assets: [{ path: './publish/*' }] }>,\n ] | Exclude<PluginSpec, string>[],\n};\n\n/**\n * The base configuration for various Semantic Release scenarios.\n * - Prefers preset \"conventionalcommits\"\n * (Conventional-Changelog-ConventionalCommits).\n * - Creates tags and release commits on \"main\" branch, pre-releases on\n * \"develop\" branch in \"develop\" channel.\n * - Creates GitHub Releases.\n * - Exports the following variables as GitHub Actions outputs:\n * - \"new-release-published\": \"true\" | \"false\"\n * - \"new-release-version\" : string\n * - \"new-release-git-tag\" : string\n * - includes default plugins (except `@semantic-release/npm`) and more\n * - `@semantic-release/commit-analyzer`\n * - semantic-release-export-data\n * - `@semantic-release/release-notes-generator`\n * - `@semantic-release/changelog`\n * - `@semantic-release/git`\n * - add modified CHANGELOG.md in release commit\n * - `@semantic-release/exec`\n * - does nothing by default. Included for convenience.\n * - `@semantic-release/github`\n * - uploads all files from `./publish/*`. This is non-recursive.\n * - adds a list of links to related release pages (e.g. the release's page on npmjs.com)\n *\n * (OPTIONAL) update static Version strings before Git plugin\n * - https://github.com/jpoehnelt/semantic-release-replace-plugin\n * - https://github.com/droidsolutions/semantic-release-update-file\n * @satisfies {Options}\n */\nexport const baseConfig: typeof _baseConfig = _baseConfig satisfies Options;\n"],"mappings":";;;;;AAgDA,MAAa,iBAKT,OAAO,OAAO;CAChB;CACA;CACA;CACA;CACD,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DX,MAAa,aAAiC;;CArD5C,QAAQ;CACR,UAAU,CACR,QACA;EAAE,MAAM;EAAW,SAAS;EAAW,YAAY;EAAM,CAC1D;CACD,SAAS;EACP,CAAC,qCAAqC,EAAE,CAAC;EACzC,CAAC,gCAAgC,EAAE,CAAC;EACpC,CAAC,6CAA6C,EAAE,CAAC;EACjD,CAAC,+BAA+B,EAAE,CAAC;EACnC,CAAC,yBAAyB,eAAe;EACzC,CAAC,0BAA0B,EAAE,CAAC;EAC9B,CAAC,4BAA4B;GAAE,aAAa;GAAU,QAAQ,CAAC,eAAe,sBAAsB;GAAE,CAAC;EACxG;CAwC2C"}
@@ -1 +1 @@
1
- {"version":3,"file":"semanticReleaseConfigDotnet.mjs","names":["debug"],"sources":["../src/semanticReleaseConfigDotnet.ts"],"sourcesContent":["/**\n * # Semantic-Release Config Factory (dotnet)\n * A functional Semantic-Release configuration for dotnet projects\n *\n * extends {@link baseConfig }\n *\n * <-- TABLE OF CONTENTS -->\n *\n * EASY: {@link getConfig}\n * Just provide the paths of the project file(s) and keep your API tokens ready.\n * ADVANCED: {@link SemanticReleaseConfigDotnet}\n * Allows for a hands-on customization if {@link getConfig} doesn't meet your needs.\n * Use a copy of {@link getConfig} as the starting point of a new function and make changes from there.\n * - {@link SemanticReleaseConfigDotnet#splicePlugin splicePlugin (insert/edit plugins)}\n * - {@link SemanticReleaseConfigDotnet#setupDotnetCommands setupDotnetCommands}\n * - {@link SemanticReleaseConfigDotnet#getTokenTestingCommands getTokenTestingCommands}\n */\n\nimport { inspect } from 'node:util';\nimport type { Options } from 'semantic-release';\n// @ts-types=\"./semantic-release__exec.d.ts\"\nimport type { Options as SRExecOptions } from '@semantic-release/exec';\nimport * as console from 'node:console';\nimport debug from './debug.ts';\nimport { configureDotnetNugetPush, configurePrepareCmd } from './dotnet/helpers.ts';\nimport { getEnvVarValue } from './utils/env.ts';\nimport { baseConfig } from './semanticReleaseConfig.ts';\nimport { NugetRegistryInfo } from './dotnet/NugetRegistryInfo.ts';\nimport { MSBuildProject } from './dotnet/MSBuildProject.ts';\nimport { insertPlugin } from './insertPlugins.ts';\n\ntype UnArray<T> = T extends (infer U)[] ? U : T;\ninterface SRConfigDotnetOptions extends Omit<typeof baseConfig, 'plugins'> {\n plugins: (UnArray<typeof baseConfig.plugins> | [string, unknown])[];\n}\n\nexport class SemanticReleaseConfigDotnet {\n private readonly options: SRConfigDotnetOptions;\n private readonly _projectsToPublish: string[] | MSBuildProject[];\n private _projectsToPackAndPush: string[] | NugetRegistryInfo[];\n private readonly _evaluatedProjects: MSBuildProject[];\n\n /**\n * Creates an instance of SemanticReleaseConfigDotnet.\n * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet` publish, pack, and push.\n *\n * Note: To sign packages, create a Target in the corresponding project(s) e.g.\n * ```xml\n * <Target Name=\"SignNupkgs\" AfterTargets=\"Pack\">\n * <Exec Command=\"dotnet nuget sign $(PackageOutputPath) [remaining args]\" ConsoleToMsBuild=\"true\" />\n * </Target>\n * ```\n * Alternatively, splice your signing commands into the publishCmd string,\n * inserting them before `dotnet nuget push`.\n * If you sign different signatures depending on the NuGet registry,\n * splice your signing command (with \"overwrite signature\" enabled, if\n * desired) before the corresponding registry's `dotnet nuget push` command.\n * @param projectsToPublish An array of dotnet projects' relative paths. If\n * empty or unspecified, tries getting projects' semi-colon-separated relative\n * paths from the `PROJECTS_TO_PUBLISH` environment variable. If configured as\n * recommended, the projects' publish outputs will be zipped to '$PWD/publish'\n * for use in the `publish` semantic-release step (typically, GitHub release).\n * @param projectsToPackAndPush An array of dotnet projects' relative paths.\n * If empty or unspecified, tries getting projects' semi-colon-separated\n * relative paths from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.\n * Otherwise, no packages will be packed and pushed.\n * If configured as recommended, `dotnet pack` will output the nupkg/snupkg\n * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.\n */\n constructor(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush: string[] | NugetRegistryInfo[],\n ) {\n this.options = baseConfig;\n /* normalize PluginSpecs to tuples */\n this.options.plugins = this.options.plugins.map(pluginSpec => typeof pluginSpec === 'string'\n ? [pluginSpec, {}]\n : pluginSpec,\n );\n\n this._projectsToPublish = projectsToPublish;\n if (this._projectsToPublish.length === 0) {\n const p = getEnvVarValue('PROJECTS_TO_PUBLISH')?.split(';');\n if (p && p.length > 0) {\n this._projectsToPublish = p;\n }\n else if (debug.enabled) {\n debug(new Error('At least one project must be published. `projectsToPackAndPush` is empty and environment variable `PROJECTS_TO_PUBLISH` is undefined or empty.'));\n }\n }\n\n this._projectsToPackAndPush = projectsToPackAndPush;\n if (this._projectsToPackAndPush.length === 0) {\n const p = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH')?.split(';');\n if (p && p.length > 0) {\n this._projectsToPackAndPush = p;\n }\n else if (debug.enabled) {\n debug(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));\n }\n }\n\n // may be zero-length array\n this._evaluatedProjects = [\n ...this._projectsToPublish.filter(v => v instanceof MSBuildProject),\n ...this._projectsToPackAndPush\n .filter(v => v instanceof NugetRegistryInfo)\n .map(v => v.project),\n ];\n }\n\n get ProjectsToPublish(): string[] | MSBuildProject[] {\n return this._projectsToPublish;\n }\n\n get ProjectsToPackAndPush(): string[] | NugetRegistryInfo[] {\n return this._projectsToPackAndPush;\n }\n\n get EvaluatedProjects(): MSBuildProject[] {\n return this._evaluatedProjects;\n }\n\n // eslint-disable-next-line jsdoc/require-param\n /** @deprecated Superseded by {@link splicePlugin} */\n insertPlugin(\n afterPluginsIDs: string[],\n insertPluginIDs: string[],\n beforePluginsIDs: string[],\n ): void {\n this.options.plugins = insertPlugin(this.options.plugins, afterPluginsIDs, insertPluginIDs, beforePluginsIDs);\n }\n\n /**\n * generate dotnet commands for \\@semantic-release/exec, appending commands with ' && ' when necessary.\n *\n * Note: All strings in {@link this.ProjectsToPackAndPush} will be converted to basic {@link NugetRegistryInfo} instances with default values.\n * If you need specific NRI settings or you need to push to GitLab-like or GitHub-like registries, instantiate them instead of passing their paths.\n * @todo change to builder method? e.g. static async SetupDotnetCommands(this: SemanticReleaseConfigDotnet): Promise<SemanticReleaseConfigDotnet>\n * @todo Add options param to allow users to enable pushing to GitLab, GitHub, NuGet.org with default settings -OR- with entirely custom settings.\n * @see https://github.com/semantic-release/exec#usage\n */\n async setupDotnetCommands(): Promise<void> {\n let srExecIndex = this.options.plugins.findIndex(\n v => v[0] === '@semantic-release/exec',\n );\n if (srExecIndex === -1) {\n const message = `\\\nUnable to find\\`['@semantic-release/exec', unknown]\\` in plugins array!\nAppending it to the end of the array...This may cause an unexpected order of operations!`;\n console.warn(message);\n srExecIndex = this.options.plugins.push(['@semantic-release/exec', {}]) - 1;\n }\n\n const plugin = this.options.plugins[srExecIndex] as ['@semantic-release/exec', SRExecOptions];\n const execOptions: SRExecOptions = plugin[1];\n\n // ensure all packable projects are evaluated\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n this._projectsToPackAndPush = await Promise.all(\n this._projectsToPackAndPush.map(async (project) => {\n if (typeof project === 'string') {\n const packableProjects = await Promise.all(\n await MSBuildProject.PackableProjectsToMSBuildProjects(\n [project],\n ),\n );\n if (packableProjects.length === 0)\n throw new Error('No MSBuildProject instances were returned!');\n this._evaluatedProjects.push(...packableProjects);\n\n // if the user doesn't want a defaulted NRI, they should pass their own NRI (or derived) instance.\n return packableProjects.map(project => new NugetRegistryInfo({ project }));\n }\n else return [project];\n }),\n ).then(p => p.flat()) as NugetRegistryInfo[];\n\n // todo: double-check token-testing commands. Are they formatted prepended correctly?\n const verifyConditionsCmdAppendix = await Promise.all(\n this._projectsToPackAndPush\n .map(async project =>\n await project.PackDummyPackage({})\n .then(() =>\n project.GetPushDummyCommand({}),\n ),\n ),\n ).then(cmds =>\n cmds.join(' && '),\n );\n execOptions.verifyConditionsCmd\n = execOptions.verifyConditionsCmd && execOptions.verifyConditionsCmd.trim().length > 0\n ? `${execOptions.verifyConditionsCmd} && ${verifyConditionsCmdAppendix}`\n : verifyConditionsCmdAppendix;\n\n const verifyReleaseCmdAppendix\n = this.ProjectsToPackAndPush\n .filter(project =>\n typeof project !== 'string',\n ).map(project =>\n project.GetIsNextVersionAlreadyPublishedCommand(),\n ).join(' && ');\n execOptions.verifyReleaseCmd\n = execOptions.verifyReleaseCmd && execOptions.verifyReleaseCmd.trim().length > 0\n ? `${execOptions.verifyReleaseCmd} && ${verifyReleaseCmdAppendix}`\n : verifyConditionsCmdAppendix;\n\n const prepareCmdAppendix = await configurePrepareCmd(\n this._projectsToPublish,\n this._projectsToPackAndPush,\n );\n\n // 'ZipPublishDir' zips each publish folder to ./publish/*.zip\n execOptions.prepareCmd\n = execOptions.prepareCmd && execOptions.prepareCmd.trim().length > 0\n ? `${execOptions.prepareCmd} && ${prepareCmdAppendix}`\n : prepareCmdAppendix;\n\n // FINISHED execOptions.prepareCmd\n // STARTING execOptions.publishCmd\n if (this._projectsToPackAndPush.length > 0) {\n const publishCmdAppendix: string = configureDotnetNugetPush(\n this._projectsToPackAndPush,\n );\n execOptions.publishCmd\n = execOptions.publishCmd && execOptions.publishCmd.trim().length > 0\n ? `${execOptions.publishCmd} && ${publishCmdAppendix}`\n : publishCmdAppendix;\n }\n\n // FINISHED execOptions.publishCmd\n }\n\n /**\n * Insert a plugin into the plugins array.\n * @param insertAfterPluginIDs Plugins which should appear BEFORE\n * {@link insertPluginIDs}.\n * @param insertPluginIDs The plugin(s) to insert into the plugins array.\n * @param insertBeforePluginsIDs plugins which should appear AFTER the\n * inserted plugin(s).\n */\n splicePlugin(\n insertAfterPluginIDs: string[],\n insertPluginIDs: string[],\n insertBeforePluginsIDs: string[],\n ): void {\n const errors: Error[] = [];\n const pluginIDs = this.options.plugins.map(v =>\n typeof v === 'string' ? v : v[0],\n ) as (typeof this.options.plugins[number])[][0];\n\n // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.\n\n const indexOfLastPreceding: number | undefined = insertAfterPluginIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort()\n .find((_v, i, obj) => i === obj.length - 1);\n if (!indexOfLastPreceding)\n throw new ReferenceError(\n 'An attempt to get the last element of indexOfLastAfter returned undefined.',\n );\n\n const indicesOfBefore: number[] = insertBeforePluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort();\n\n for (const index of indicesOfBefore) {\n if (index <= indexOfLastPreceding) {\n const formattedInsertIds: string\n = '[' + insertPluginIDs.map(v => `\"${v}\"`).join(', ') + ']';\n const formattedAfterIds: string\n = '[' + insertAfterPluginIDs.map(v => `\"${v}\"`).join(', ') + ']';\n const formattedBeforeIds: string\n = '[' + insertBeforePluginsIDs.map(v => `\"${v}\"`).join(', ') + ']';\n errors.push(\n new Error(\n `insertPlugin was instructed to insert ${formattedInsertIds} after ${formattedAfterIds} and before ${formattedBeforeIds}, `\n + `but ${JSON.stringify(pluginIDs[indexOfLastPreceding])} is ordered after ${JSON.stringify(pluginIDs[index])}!`,\n ),\n );\n }\n }\n\n if (errors.length > 0)\n throw new AggregateError(errors, 'One or more errors occurred while splicing plugin-option tuples into the Semantic Release config!');\n\n this.options.plugins.splice(\n indexOfLastPreceding + 1,\n 0,\n ...insertPluginIDs.map(v => [v, {}] satisfies [string, unknown]),\n );\n }\n\n // todo: join result with dummy pack commands\n protected async getTokenTestingCommands(): Promise<string> {\n const promiseProjects = this.ProjectsToPackAndPush.every(nri => nri instanceof NugetRegistryInfo)\n ? this.ProjectsToPackAndPush.map(nri => nri.project)\n : await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects(this.ProjectsToPackAndPush));\n\n /** if a project is not in {@link EvaluatedProjects}, add it */\n for (const project of promiseProjects) {\n if (!this.EvaluatedProjects.includes(project))\n this.EvaluatedProjects.push(project);\n }\n\n const regInfos = promiseProjects.map(\n p => new NugetRegistryInfo({ project: p }),\n );\n const nupkgPaths = await Promise.all(\n regInfos.map(nri =>\n nri.PackDummyPackage({}).then((nupkgs) => {\n // this is a full file path.\n const mainNupkg = nupkgs.find(nupkg =>\n new RegExp(/(?<!symbols)\\.nupkg$/).test(nupkg),\n );\n if (mainNupkg !== undefined)\n return { nri: nri, nupkgPath: mainNupkg } as const;\n throw new Error(\n 'None of the following dummy packages are non-symbol .nupkg files:\\n'\n + nupkgs.map(nupkg => ` - ${nupkg}`).join('\\n')\n + '\\nIf you intended to push only symbol packages, check if a feature request already exists (https://github.com/HaloSPV3/HCE.Shared/issues?q=push+snupkg) and, if one does not exist, create one containing the keywords \"push snupkg\".',\n );\n }),\n ),\n );\n const pushCommands = nupkgPaths.map(pair =>\n pair.nri.GetPushDummyCommand({}),\n );\n return pushCommands.join(' && ');\n }\n\n toOptions(): Options {\n return this.options;\n }\n}\n\n/**\n * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet`\n * publish, pack, and nuget-push.\n * @param projectsToPublish\n * An array of dotnet projects' relative paths -OR- an array of\n * {@link MSBuildProject} instances.\n * - If `MSBuildProject[]`, the instances will be used as-is.\n * - If `[]`, tries getting projects' semi-colon-separated relative paths from\n * the `PROJECTS_TO_PUBLISH` environment variable.\n * - If configured as recommended, the projects' publish outputs will be zipped\n * to '$PWD/publish' for use in the `publish` semantic-release step e.g. for a\n * GitHub release.\n * @param projectsToPackAndPush An array of dotnet projects' relative paths -OR-\n * an array of instances of {@link NugetRegistryInfo} and/or derived classes.\n * - If `NugetRegistryInfo[]`, no conversions or modifications will occur.\n * - If `string[]`, the project paths will be converted to\n * {@link NugetRegistryInfo} instances with default values. This may be undesired.\n * - If `[]`, `dotnet pack` and `dotnet nuget push` commands will not be configured.\n * - If `undefined`, tries getting projects' semi-colon-separated relative paths\n * from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.\n * With the recommended configuration, `dotnet pack` will write the nupkg/snupkg\n * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.\n * @returns a semantic-release Options object, based on\n * `@halospv3/hce.shared-config` (our base config), with the\n * `@semantic-release/exec` plugin configured to `dotnet publish`, `pack`, and\n * `push` the specified projects.\n */\nexport async function getConfig(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush?: string[] | NugetRegistryInfo[],\n): Promise<Options> {\n if (debug.enabled) {\n debug(\n 'hce.shared-config:\\n' + inspect(baseConfig, false, Infinity, true),\n );\n }\n\n const errors: Error[] = [];\n\n if (projectsToPublish.length === 0) {\n const _ = getEnvVarValue('PROJECTS_TO_PUBLISH');\n if (_ === undefined)\n errors.push(\n new Error(\n 'projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path.',\n ),\n );\n else projectsToPublish = _.split(';');\n }\n\n if (!projectsToPackAndPush) {\n const _ = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH');\n if (_ === undefined)\n errors.push(\n new Error(\n 'projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.',\n ),\n );\n else projectsToPackAndPush = _.split(';');\n }\n\n if (errors.length > 0) {\n throw new Error(\n [\n 'getConfig cannot continue. One or more errors occurred.',\n ...errors.map(v => v.stack),\n ].join('\\n'),\n );\n }\n\n const config = new SemanticReleaseConfigDotnet(\n projectsToPublish,\n projectsToPackAndPush ?? [],\n );\n await config.setupDotnetCommands();\n\n const options: Options = config.toOptions();\n if (debug.enabled) {\n debug('modified plugins array:');\n debug(inspect(options.plugins, false, Infinity));\n }\n\n return options;\n}\n\n/**\n * @module semanticReleaseConfigDotnet\n */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,8BAAb,MAAyC;CACvC;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BA,YACE,mBACA,uBACA;AACA,OAAK,UAAU;AAEf,OAAK,QAAQ,UAAU,KAAK,QAAQ,QAAQ,KAAI,eAAc,OAAO,eAAe,WAChF,CAAC,YAAY,EAAE,CAAC,GAChB,WACH;AAED,OAAK,qBAAqB;AAC1B,MAAI,KAAK,mBAAmB,WAAW,GAAG;GACxC,MAAM,IAAI,eAAe,sBAAsB,EAAE,MAAM,IAAI;AAC3D,OAAI,KAAK,EAAE,SAAS,EAClB,MAAK,qBAAqB;YAEnBA,OAAM,QACb,wBAAM,IAAI,MAAM,iJAAiJ,CAAC;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,OAAM,SAAS;AACjB,SAAM,0BAA0B;AAChC,SAAM,QAAQ,QAAQ,SAAS,OAAO,SAAS,CAAC;;AAGlD,QAAO"}
1
+ {"version":3,"file":"semanticReleaseConfigDotnet.mjs","names":["debug"],"sources":["../src/semanticReleaseConfigDotnet.ts"],"sourcesContent":["/**\n * # Semantic-Release Config Factory (dotnet)\n * A functional Semantic-Release configuration for dotnet projects\n *\n * extends {@link baseConfig }\n *\n * <-- TABLE OF CONTENTS -->\n *\n * EASY: {@link getConfig}\n * Just provide the paths of the project file(s) and keep your API tokens ready.\n * ADVANCED: {@link SemanticReleaseConfigDotnet}\n * Allows for a hands-on customization if {@link getConfig} doesn't meet your needs.\n * Use a copy of {@link getConfig} as the starting point of a new function and make changes from there.\n * - {@link SemanticReleaseConfigDotnet#splicePlugin splicePlugin (insert/edit plugins)}\n * - {@link SemanticReleaseConfigDotnet#setupDotnetCommands setupDotnetCommands}\n * - {@link SemanticReleaseConfigDotnet#getTokenTestingCommands getTokenTestingCommands}\n */\n\nimport { inspect } from 'node:util';\nimport type { Options } from 'semantic-release';\n// @ts-types=\"./semantic-release__exec.d.ts\"\nimport type { Options as SRExecOptions } from '@semantic-release/exec';\nimport * as console from 'node:console';\nimport debug from './debug.ts';\nimport { configureDotnetNugetPush, configurePrepareCmd } from './dotnet/helpers.ts';\nimport { getEnvVarValue } from './utils/env.ts';\nimport { baseConfig } from './semanticReleaseConfig.ts';\nimport { NugetRegistryInfo } from './dotnet/NugetRegistryInfo.ts';\nimport { MSBuildProject } from './dotnet/MSBuildProject.ts';\nimport { insertPlugin } from './insertPlugins.ts';\n\ntype UnArray<T> = T extends (infer U)[] ? U : T;\ninterface SRConfigDotnetOptions extends Omit<typeof baseConfig, 'plugins'> {\n plugins: (UnArray<typeof baseConfig.plugins> | [string, unknown])[];\n}\n\nexport class SemanticReleaseConfigDotnet {\n private readonly options: SRConfigDotnetOptions;\n private readonly _projectsToPublish: string[] | MSBuildProject[];\n private _projectsToPackAndPush: string[] | NugetRegistryInfo[];\n private readonly _evaluatedProjects: MSBuildProject[];\n\n /**\n * Creates an instance of SemanticReleaseConfigDotnet.\n * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet` publish, pack, and push.\n *\n * Note: To sign packages, create a Target in the corresponding project(s) e.g.\n * ```xml\n * <Target Name=\"SignNupkgs\" AfterTargets=\"Pack\">\n * <Exec Command=\"dotnet nuget sign $(PackageOutputPath) [remaining args]\" ConsoleToMsBuild=\"true\" />\n * </Target>\n * ```\n * Alternatively, splice your signing commands into the publishCmd string,\n * inserting them before `dotnet nuget push`.\n * If you sign different signatures depending on the NuGet registry,\n * splice your signing command (with \"overwrite signature\" enabled, if\n * desired) before the corresponding registry's `dotnet nuget push` command.\n * @param projectsToPublish An array of dotnet projects' relative paths. If\n * empty or unspecified, tries getting projects' semi-colon-separated relative\n * paths from the `PROJECTS_TO_PUBLISH` environment variable. If configured as\n * recommended, the projects' publish outputs will be zipped to '$PWD/publish'\n * for use in the `publish` semantic-release step (typically, GitHub release).\n * @param projectsToPackAndPush An array of dotnet projects' relative paths.\n * If empty or unspecified, tries getting projects' semi-colon-separated\n * relative paths from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.\n * Otherwise, no packages will be packed and pushed.\n * If configured as recommended, `dotnet pack` will output the nupkg/snupkg\n * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.\n */\n constructor(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush: string[] | NugetRegistryInfo[],\n ) {\n this.options = baseConfig;\n /* normalize PluginSpecs to tuples */\n this.options.plugins = this.options.plugins.map(pluginSpec => typeof pluginSpec === 'string'\n ? [pluginSpec, {}]\n : pluginSpec,\n );\n\n this._projectsToPublish = projectsToPublish;\n if (this._projectsToPublish.length === 0) {\n const p = getEnvVarValue('PROJECTS_TO_PUBLISH')?.split(';');\n if (p && p.length > 0) {\n this._projectsToPublish = p;\n }\n else if (debug.enabled) {\n debug(new Error('At least one project must be published. `projectsToPackAndPush` is empty and environment variable `PROJECTS_TO_PUBLISH` is undefined or empty.'));\n }\n }\n\n this._projectsToPackAndPush = projectsToPackAndPush;\n if (this._projectsToPackAndPush.length === 0) {\n const p = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH')?.split(';');\n if (p && p.length > 0) {\n this._projectsToPackAndPush = p;\n }\n else if (debug.enabled) {\n debug(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));\n }\n }\n\n // may be zero-length array\n this._evaluatedProjects = [\n ...this._projectsToPublish.filter(v => v instanceof MSBuildProject),\n ...this._projectsToPackAndPush\n .filter(v => v instanceof NugetRegistryInfo)\n .map(v => v.project),\n ];\n }\n\n get ProjectsToPublish(): string[] | MSBuildProject[] {\n return this._projectsToPublish;\n }\n\n get ProjectsToPackAndPush(): string[] | NugetRegistryInfo[] {\n return this._projectsToPackAndPush;\n }\n\n get EvaluatedProjects(): MSBuildProject[] {\n return this._evaluatedProjects;\n }\n\n // eslint-disable-next-line jsdoc/require-param\n /** @deprecated Superseded by {@link splicePlugin} */\n insertPlugin(\n afterPluginsIDs: string[],\n insertPluginIDs: string[],\n beforePluginsIDs: string[],\n ): void {\n this.options.plugins = insertPlugin(this.options.plugins, afterPluginsIDs, insertPluginIDs, beforePluginsIDs);\n }\n\n /**\n * generate dotnet commands for \\@semantic-release/exec, appending commands with ' && ' when necessary.\n *\n * Note: All strings in {@link this.ProjectsToPackAndPush} will be converted to basic {@link NugetRegistryInfo} instances with default values.\n * If you need specific NRI settings or you need to push to GitLab-like or GitHub-like registries, instantiate them instead of passing their paths.\n * @todo change to builder method? e.g. static async SetupDotnetCommands(this: SemanticReleaseConfigDotnet): Promise<SemanticReleaseConfigDotnet>\n * @todo Add options param to allow users to enable pushing to GitLab, GitHub, NuGet.org with default settings -OR- with entirely custom settings.\n * @see https://github.com/semantic-release/exec#usage\n */\n async setupDotnetCommands(): Promise<void> {\n let srExecIndex = this.options.plugins.findIndex(\n v => v[0] === '@semantic-release/exec',\n );\n if (srExecIndex === -1) {\n const message = `\\\nUnable to find\\`['@semantic-release/exec', unknown]\\` in plugins array!\nAppending it to the end of the array...This may cause an unexpected order of operations!`;\n console.warn(message);\n srExecIndex = this.options.plugins.push(['@semantic-release/exec', {}]) - 1;\n }\n\n const plugin = this.options.plugins[srExecIndex] as ['@semantic-release/exec', SRExecOptions];\n const execOptions: SRExecOptions = plugin[1];\n\n // ensure all packable projects are evaluated\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n this._projectsToPackAndPush = await Promise.all(\n this._projectsToPackAndPush.map(async (project) => {\n if (typeof project === 'string') {\n const packableProjects = await Promise.all(\n await MSBuildProject.PackableProjectsToMSBuildProjects(\n [project],\n ),\n );\n if (packableProjects.length === 0)\n throw new Error('No MSBuildProject instances were returned!');\n this._evaluatedProjects.push(...packableProjects);\n\n // if the user doesn't want a defaulted NRI, they should pass their own NRI (or derived) instance.\n return packableProjects.map(project => new NugetRegistryInfo({ project }));\n }\n else return [project];\n }),\n ).then(p => p.flat()) as NugetRegistryInfo[];\n\n // todo: double-check token-testing commands. Are they formatted prepended correctly?\n const verifyConditionsCmdAppendix = await Promise.all(\n this._projectsToPackAndPush\n .map(async project =>\n await project.PackDummyPackage({})\n .then(() =>\n project.GetPushDummyCommand({}),\n ),\n ),\n ).then(cmds =>\n cmds.join(' && '),\n );\n execOptions.verifyConditionsCmd\n = execOptions.verifyConditionsCmd && execOptions.verifyConditionsCmd.trim().length > 0\n ? `${execOptions.verifyConditionsCmd} && ${verifyConditionsCmdAppendix}`\n : verifyConditionsCmdAppendix;\n\n const verifyReleaseCmdAppendix\n = this.ProjectsToPackAndPush\n .filter(project =>\n typeof project !== 'string',\n ).map(project =>\n project.GetIsNextVersionAlreadyPublishedCommand(),\n ).join(' && ');\n execOptions.verifyReleaseCmd\n = execOptions.verifyReleaseCmd && execOptions.verifyReleaseCmd.trim().length > 0\n ? `${execOptions.verifyReleaseCmd} && ${verifyReleaseCmdAppendix}`\n : verifyConditionsCmdAppendix;\n\n const prepareCmdAppendix = await configurePrepareCmd(\n this._projectsToPublish,\n this._projectsToPackAndPush,\n );\n\n // 'ZipPublishDir' zips each publish folder to ./publish/*.zip\n execOptions.prepareCmd\n = execOptions.prepareCmd && execOptions.prepareCmd.trim().length > 0\n ? `${execOptions.prepareCmd} && ${prepareCmdAppendix}`\n : prepareCmdAppendix;\n\n // FINISHED execOptions.prepareCmd\n // STARTING execOptions.publishCmd\n if (this._projectsToPackAndPush.length > 0) {\n const publishCmdAppendix: string = configureDotnetNugetPush(\n this._projectsToPackAndPush,\n );\n execOptions.publishCmd\n = execOptions.publishCmd && execOptions.publishCmd.trim().length > 0\n ? `${execOptions.publishCmd} && ${publishCmdAppendix}`\n : publishCmdAppendix;\n }\n\n // FINISHED execOptions.publishCmd\n }\n\n /**\n * Insert a plugin into the plugins array.\n * @param insertAfterPluginIDs Plugins which should appear BEFORE\n * {@link insertPluginIDs}.\n * @param insertPluginIDs The plugin(s) to insert into the plugins array.\n * @param insertBeforePluginsIDs plugins which should appear AFTER the\n * inserted plugin(s).\n */\n splicePlugin(\n insertAfterPluginIDs: string[],\n insertPluginIDs: string[],\n insertBeforePluginsIDs: string[],\n ): void {\n const errors: Error[] = [];\n const pluginIDs = this.options.plugins.map(v =>\n typeof v === 'string' ? v : v[0],\n ) as (typeof this.options.plugins[number])[][0];\n\n // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.\n\n const indexOfLastPreceding: number | undefined = insertAfterPluginIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort()\n .find((_v, i, obj) => i === obj.length - 1);\n if (!indexOfLastPreceding)\n throw new ReferenceError(\n 'An attempt to get the last element of indexOfLastAfter returned undefined.',\n );\n\n const indicesOfBefore: number[] = insertBeforePluginsIDs\n .filter(v => pluginIDs.includes(v))\n .map(v => pluginIDs.indexOf(v))\n .sort();\n\n for (const index of indicesOfBefore) {\n if (index <= indexOfLastPreceding) {\n const formattedInsertIds: string\n = '[' + insertPluginIDs.map(v => `\"${v}\"`).join(', ') + ']';\n const formattedAfterIds: string\n = '[' + insertAfterPluginIDs.map(v => `\"${v}\"`).join(', ') + ']';\n const formattedBeforeIds: string\n = '[' + insertBeforePluginsIDs.map(v => `\"${v}\"`).join(', ') + ']';\n errors.push(\n new Error(\n `insertPlugin was instructed to insert ${formattedInsertIds} after ${formattedAfterIds} and before ${formattedBeforeIds}, `\n + `but ${JSON.stringify(pluginIDs[indexOfLastPreceding])} is ordered after ${JSON.stringify(pluginIDs[index])}!`,\n ),\n );\n }\n }\n\n if (errors.length > 0)\n throw new AggregateError(errors, 'One or more errors occurred while splicing plugin-option tuples into the Semantic Release config!');\n\n this.options.plugins.splice(\n indexOfLastPreceding + 1,\n 0,\n ...insertPluginIDs.map(v => [v, {}] satisfies [string, unknown]),\n );\n }\n\n // todo: join result with dummy pack commands\n protected async getTokenTestingCommands(): Promise<string> {\n const promiseProjects = this.ProjectsToPackAndPush.every(nri => nri instanceof NugetRegistryInfo)\n ? this.ProjectsToPackAndPush.map(nri => nri.project)\n : await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects(this.ProjectsToPackAndPush));\n\n /** if a project is not in {@link EvaluatedProjects}, add it */\n for (const project of promiseProjects) {\n if (!this.EvaluatedProjects.includes(project))\n this.EvaluatedProjects.push(project);\n }\n\n const regInfos = promiseProjects.map(\n p => new NugetRegistryInfo({ project: p }),\n );\n const nupkgPaths = await Promise.all(\n regInfos.map(nri =>\n nri.PackDummyPackage({}).then((nupkgs) => {\n // this is a full file path.\n const mainNupkg = nupkgs.find(nupkg =>\n new RegExp(/(?<!symbols)\\.nupkg$/).test(nupkg),\n );\n if (mainNupkg !== undefined)\n return { nri: nri, nupkgPath: mainNupkg } as const;\n throw new Error(\n 'None of the following dummy packages are non-symbol .nupkg files:\\n'\n + nupkgs.map(nupkg => ` - ${nupkg}`).join('\\n')\n + '\\nIf you intended to push only symbol packages, check if a feature request already exists (https://github.com/HaloSPV3/HCE.Shared/issues?q=push+snupkg) and, if one does not exist, create one containing the keywords \"push snupkg\".',\n );\n }),\n ),\n );\n const pushCommands = nupkgPaths.map(pair =>\n pair.nri.GetPushDummyCommand({}),\n );\n return pushCommands.join(' && ');\n }\n\n toOptions(): Options {\n return this.options;\n }\n}\n\n/**\n * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet`\n * publish, pack, and nuget-push.\n * @param projectsToPublish\n * An array of dotnet projects' relative paths -OR- an array of\n * {@link MSBuildProject} instances.\n * - If `MSBuildProject[]`, the instances will be used as-is.\n * - If `[]`, tries getting projects' semi-colon-separated relative paths from\n * the `PROJECTS_TO_PUBLISH` environment variable.\n * - If configured as recommended, the projects' publish outputs will be zipped\n * to '$PWD/publish' for use in the `publish` semantic-release step e.g. for a\n * GitHub release.\n * @param projectsToPackAndPush An array of dotnet projects' relative paths -OR-\n * an array of instances of {@link NugetRegistryInfo} and/or derived classes.\n * - If `NugetRegistryInfo[]`, no conversions or modifications will occur.\n * - If `string[]`, the project paths will be converted to\n * {@link NugetRegistryInfo} instances with default values. This may be undesired.\n * - If `[]`, `dotnet pack` and `dotnet nuget push` commands will not be configured.\n * - If `undefined`, tries getting projects' semi-colon-separated relative paths\n * from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.\n * With the recommended configuration, `dotnet pack` will write the nupkg/snupkg\n * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.\n * @returns a semantic-release Options object, based on\n * `@halospv3/hce.shared-config` (our base config), with the\n * `@semantic-release/exec` plugin configured to `dotnet publish`, `pack`, and\n * `push` the specified projects.\n */\nexport async function getConfig(\n projectsToPublish: string[] | MSBuildProject[],\n projectsToPackAndPush?: string[] | NugetRegistryInfo[],\n): Promise<Options> {\n if (debug.enabled) {\n debug(\n 'hce.shared-config:\\n' + inspect(baseConfig, false, Infinity, true),\n );\n }\n\n const errors: Error[] = [];\n\n if (projectsToPublish.length === 0) {\n const _ = getEnvVarValue('PROJECTS_TO_PUBLISH');\n if (_ === undefined)\n errors.push(\n new Error(\n 'projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path.',\n ),\n );\n else projectsToPublish = _.split(';');\n }\n\n if (!projectsToPackAndPush) {\n const _ = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH');\n if (_ === undefined)\n errors.push(\n new Error(\n 'projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.',\n ),\n );\n else projectsToPackAndPush = _.split(';');\n }\n\n if (errors.length > 0) {\n throw new Error(\n [\n 'getConfig cannot continue. One or more errors occurred.',\n ...errors.map(v => v.stack),\n ].join('\\n'),\n );\n }\n\n const config = new SemanticReleaseConfigDotnet(\n projectsToPublish,\n projectsToPackAndPush ?? [],\n );\n await config.setupDotnetCommands();\n\n const options: Options = config.toOptions();\n if (debug.enabled) {\n debug('modified plugins array:');\n debug(inspect(options.plugins, false, Infinity));\n }\n\n return options;\n}\n\n/**\n * @module semanticReleaseConfigDotnet\n */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,8BAAb,MAAyC;CACvC;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BA,YACE,mBACA,uBACA;EACA,KAAK,UAAU;EAEf,KAAK,QAAQ,UAAU,KAAK,QAAQ,QAAQ,KAAI,eAAc,OAAO,eAAe,WAChF,CAAC,YAAY,EAAE,CAAC,GAChB,WACH;EAED,KAAK,qBAAqB;EAC1B,IAAI,KAAK,mBAAmB,WAAW,GAAG;GACxC,MAAM,IAAI,eAAe,sBAAsB,EAAE,MAAM,IAAI;GAC3D,IAAI,KAAK,EAAE,SAAS,GAClB,KAAK,qBAAqB;QAEvB,IAAIA,OAAM,SACb,uBAAM,IAAI,MAAM,iJAAiJ,CAAC;;EAItK,KAAK,yBAAyB;EAC9B,IAAI,KAAK,uBAAuB,WAAW,GAAG;GAC5C,MAAM,IAAI,eAAe,4BAA4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AGlD,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"setupGitPluginSpec.mjs","names":[],"sources":["../src/setupGitPluginSpec.ts"],"sourcesContent":["// @ts-types=\"./semantic-release__git.d.ts\"\nimport type { AssetEntry, Options as GitOptions } from '@semantic-release/git';\nimport type { PluginSpecSRGit, PluginSpecTuple } from './semanticReleaseConfig.ts';\nimport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\nexport const GitPluginId = '@semantic-release/git';\nexport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\n/**\n * Check if {@link unk} is an {@link AssetEntry}.\n * @param unk Anything.\n * @returns `true` if {@link unk} is an {@link AssetEntry}. Else, `false`.\n */\nfunction isGitAsset(unk: unknown): unk is AssetEntry {\n if (typeof unk === 'string')\n return true;\n // Avoid ending condition with `typeof unk.path === 'string'`.\n // TS narrowing is bugged; requires the check to be performed TWICE!!\n if (typeof unk === 'object' && unk != undefined && 'path' in unk) {\n return typeof unk.path === 'string';\n }\n return false;\n}\n\n/**\n * Convert one or more {@link AssetEntry AssetEntries} to a `string[]`.\n * @param assets The `assets` property of a {@link GitOptions} object. This may not be `false`.\n * @returns A `string[]` of the given {@link AssetEntry} objects or strings.\n */\nfunction gitAssetsToStringArray(\n assets: Exclude<GitOptions['assets'], false>,\n): string[] {\n if (assets === undefined)\n return [];\n if (Array.isArray(assets)) {\n return assets.filter(asset => isGitAsset(asset))\n .map(v => typeof v === 'string' ? v : v.path);\n }\n if (typeof assets === 'string')\n return [assets] as string[];\n if (typeof assets.path === 'string')\n return [assets.path];\n else\n throw new TypeError('assets is not typeof GitOptions[\\'assets\\'!');\n}\n\n/**\n * Sanitize a {@link GitOptions} object so its {@link GitOptions#assets} property is either `false` or a `string[]`.\n * @param opts A {@link GitOptions} object.\n * @returns A {@link GitOptions} object whose {@link GitOptions#assets} is `string[] | false`.\n */\nfunction sanitizeGitOptions(opts: GitOptions): Omit<GitOptions, 'assets'> & { assets: string[] | false } {\n return { ...opts, assets: opts.assets === false ? opts.assets : gitAssetsToStringArray(opts.assets) };\n}\n\n/**\n *Determine if {@link opts} is a {@link GitOptions} object.\n * @param opts Anything.\n * @returns `true` if {@link opts} is a {@link GitOptions} object. Else, `false`.\n */\nfunction isGitOptions(opts: unknown): opts is GitOptions {\n let isOptions = false;\n\n if (typeof opts !== 'object' || opts == undefined)\n return isOptions;\n if ('assets' in opts) {\n isOptions = Array.isArray(opts.assets)\n ? opts.assets.every(unk => isGitAsset(unk))\n : isGitAsset(opts.assets);\n }\n if ('message' in opts)\n isOptions = typeof opts.message === 'string';\n return isOptions;\n}\n\n/**\n * Determine if {@link pluginSpec} includes a {@link GitOptions} object.\n * @param pluginSpec a {@link PluginSpecTuple}.\n * @returns `true` if {@link pluginSpec[1]} is a {@link GitOptions} object. Else, `false`.\n */\nfunction hasGitOptions<P extends string>(pluginSpec: PluginSpecTuple<P>): pluginSpec is PluginSpecTuple<P, GitOptions> {\n return isGitOptions(pluginSpec[1]);\n};\n\n/**\n * Determined if the plugin ID in {@link pluginSpec} is {@link GitPluginId}.\n * @param pluginSpec A {@link PluginSpecTuple}\n * @returns `true` if {@link pluginSpec[0]} is {@link GitPluginId}\n */\nfunction isGitPluginSpecTuple<T>(pluginSpec: [string, T]): pluginSpec is [typeof GitPluginId, T] {\n return pluginSpec[0] === GitPluginId;\n}\n\n/**\n * https://github.com/semantic-release/git#options\n *\n * This plugin may be deprecated at a later date.\n * Q: Why would I need to commit during release?\n * A: This is for committing your changelog, README, and/or other files updated during the release procedure.\n * @param plugins An ordered array of {@link PluginSpecTuple PluginSpecTuples}.\n * @returns A {@link PluginSpecTuple}[]. Duplicate `@semantic-release/git` plugin entries are merged or overridden. The last entry takes priority e.g. if the last entry is `{assets: false}`, previous entries' assets are ignored.\n */\nexport function setupGitPluginSpec(plugins: PluginSpecTuple[]): PluginSpecTuple[] {\n /** if Git plugin not in load order, return as-is. */\n const firstGitPluginIndex = plugins.findIndex(plugin => isGitPluginSpecTuple(plugin));\n if (firstGitPluginIndex === -1)\n return plugins;\n\n /**\n * the following two const variables are references--not clones.\n * Modifying them will affect the plugins array.\n */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const firstGitPlugin = plugins[firstGitPluginIndex]!;\n const firstGitOpts: ReturnType<typeof sanitizeGitOptions> = isGitOptions(firstGitPlugin[1])\n ? sanitizeGitOptions(firstGitPlugin[1])\n : DefaultOptions;\n\n /**\n * remove duplicate Git plugin entries;\n * merge extra options into firstGitPlugin's options\n * if `firstGitOpts.assets === false`, do not change it.\n * All duplicate PluginSpecSRGit entries are then reassigned `undefined` and all\n * `undefined` items are filtered from the plugins array.\n */\n return plugins.map((current: PluginSpecTuple, index): PluginSpecTuple | PluginSpecSRGit | undefined => {\n // skip everything up to and including the first Git PluginSpec\n if (index <= firstGitPluginIndex || !isGitPluginSpecTuple(current))\n return current;\n\n /** if another Git PluginSpec is discovered, copy its options to the first Git PluginSpec and return undefined. */\n if (hasGitOptions(current)) {\n const currentGitOpts = sanitizeGitOptions(current[1]);\n\n if (currentGitOpts.assets === false) {\n firstGitOpts.assets = false;\n }\n else {\n const assets: string[] = gitAssetsToStringArray(currentGitOpts.assets);\n if (Array.isArray(firstGitOpts.assets)) {\n firstGitOpts.assets.push(...assets);\n }\n else {\n firstGitOpts.assets = assets;\n }\n }\n\n if (typeof currentGitOpts.message === 'string')\n firstGitOpts.message = currentGitOpts.message;\n }\n return undefined;\n }).filter(pluginSpec => pluginSpec !== undefined);\n}\n"],"mappings":";;AAKA,MAAa,cAAc;;;;;;AAQ3B,SAAS,WAAW,KAAiC;AACnD,KAAI,OAAO,QAAQ,SACjB,QAAO;AAGT,KAAI,OAAO,QAAQ,YAAY,OAAO,KAAA,KAAa,UAAU,IAC3D,QAAO,OAAO,IAAI,SAAS;AAE7B,QAAO;;;;;;;AAQT,SAAS,uBACP,QACU;AACV,KAAI,WAAW,KAAA,EACb,QAAO,EAAE;AACX,KAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,OAAO,QAAO,U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a,SAAS;QAEnB;IACH,MAAM,SAAmB,uBAAuB,eAAe,OAAO;AACtE,QAAI,MAAM,QAAQ,aAAa,OAAO,CACpC,cAAa,OAAO,KAAK,GAAG,OAAO;QAGnC,cAAa,SAAS;;AAI1B,OAAI,OAAO,eAAe,YAAY,SACpC,cAAa,UAAU,eAAe;;GAG1C,CAAC,QAAO,eAAc,eAAe,KAAA,EAAU"}
1
+ {"version":3,"file":"setupGitPluginSpec.mjs","names":[],"sources":["../src/setupGitPluginSpec.ts"],"sourcesContent":["// @ts-types=\"./semantic-release__git.d.ts\"\nimport type { AssetEntry, Options as GitOptions } from '@semantic-release/git';\nimport type { PluginSpecSRGit, PluginSpecTuple } from './semanticReleaseConfig.ts';\nimport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\nexport const GitPluginId = '@semantic-release/git';\nexport { DefaultOptions } from './setupGitPluginSpec.default.ts';\n\n/**\n * Check if {@link unk} is an {@link AssetEntry}.\n * @param unk Anything.\n * @returns `true` if {@link unk} is an {@link AssetEntry}. Else, `false`.\n */\nfunction isGitAsset(unk: unknown): unk is AssetEntry {\n if (typeof unk === 'string')\n return true;\n // Avoid ending condition with `typeof unk.path === 'string'`.\n // TS narrowing is bugged; requires the check to be performed TWICE!!\n if (typeof unk === 'object' && unk != undefined && 'path' in unk) {\n return typeof unk.path === 'string';\n }\n return false;\n}\n\n/**\n * Convert one or more {@link AssetEntry AssetEntries} to a `string[]`.\n * @param assets The `assets` property of a {@link GitOptions} object. This may not be `false`.\n * @returns A `string[]` of the given {@link AssetEntry} objects or strings.\n */\nfunction gitAssetsToStringArray(\n assets: Exclude<GitOptions['assets'], false>,\n): string[] {\n if (assets === undefined)\n return [];\n if (Array.isArray(assets)) {\n return assets.filter(asset => isGitAsset(asset))\n .map(v => typeof v === 'string' ? v : v.path);\n }\n if (typeof assets === 'string')\n return [assets] as string[];\n if (typeof assets.path === 'string')\n return [assets.path];\n else\n throw new TypeError('assets is not typeof GitOptions[\\'assets\\'!');\n}\n\n/**\n * Sanitize a {@link GitOptions} object so its {@link GitOptions#assets} property is either `false` or a `string[]`.\n * @param opts A {@link GitOptions} object.\n * @returns A {@link GitOptions} object whose {@link GitOptions#assets} is `string[] | false`.\n */\nfunction sanitizeGitOptions(opts: GitOptions): Omit<GitOptions, 'assets'> & { assets: string[] | false } {\n return { ...opts, assets: opts.assets === false ? opts.assets : gitAssetsToStringArray(opts.assets) };\n}\n\n/**\n *Determine if {@link opts} is a {@link GitOptions} object.\n * @param opts Anything.\n * @returns `true` if {@link opts} is a {@link GitOptions} object. Else, `false`.\n */\nfunction isGitOptions(opts: unknown): opts is GitOptions {\n let isOptions = false;\n\n if (typeof opts !== 'object' || opts == undefined)\n return isOptions;\n if ('assets' in opts) {\n isOptions = Array.isArray(opts.assets)\n ? opts.assets.every(unk => isGitAsset(unk))\n : isGitAsset(opts.assets);\n }\n if ('message' in opts)\n isOptions = typeof opts.message === 'string';\n return isOptions;\n}\n\n/**\n * Determine if {@link pluginSpec} includes a {@link GitOptions} object.\n * @param pluginSpec a {@link PluginSpecTuple}.\n * @returns `true` if {@link pluginSpec[1]} is a {@link GitOptions} object. Else, `false`.\n */\nfunction hasGitOptions<P extends string>(pluginSpec: PluginSpecTuple<P>): pluginSpec is PluginSpecTuple<P, GitOptions> {\n return isGitOptions(pluginSpec[1]);\n};\n\n/**\n * Determined if the plugin ID in {@link pluginSpec} is {@link GitPluginId}.\n * @param pluginSpec A {@link PluginSpecTuple}\n * @returns `true` if {@link pluginSpec[0]} is {@link GitPluginId}\n */\nfunction isGitPluginSpecTuple<T>(pluginSpec: [string, T]): pluginSpec is [typeof GitPluginId, T] {\n return pluginSpec[0] === GitPluginId;\n}\n\n/**\n * https://github.com/semantic-release/git#options\n *\n * This plugin may be deprecated at a later date.\n * Q: Why would I need to commit during release?\n * A: This is for committing your changelog, README, and/or other files updated during the release procedure.\n * @param plugins An ordered array of {@link PluginSpecTuple PluginSpecTuples}.\n * @returns A {@link PluginSpecTuple}[]. Duplicate `@semantic-release/git` plugin entries are merged or overridden. The last entry takes priority e.g. if the last entry is `{assets: false}`, previous entries' assets are ignored.\n */\nexport function setupGitPluginSpec(plugins: PluginSpecTuple[]): PluginSpecTuple[] {\n /** if Git plugin not in load order, return as-is. */\n const firstGitPluginIndex = plugins.findIndex(plugin => isGitPluginSpecTuple(plugin));\n if (firstGitPluginIndex === -1)\n return plugins;\n\n /**\n * the following two const variables are references--not clones.\n * Modifying them will affect the plugins array.\n */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const firstGitPlugin = plugins[firstGitPluginIndex]!;\n const firstGitOpts: ReturnType<typeof sanitizeGitOptions> = isGitOptions(firstGitPlugin[1])\n ? sanitizeGitOptions(firstGitPlugin[1])\n : DefaultOptions;\n\n /**\n * remove duplicate Git plugin entries;\n * merge extra options into firstGitPlugin's options\n * if `firstGitOpts.assets === false`, do not change it.\n * All duplicate PluginSpecSRGit entries are then reassigned `undefined` and all\n * `undefined` items are filtered from the plugins array.\n */\n return plugins.map((current: PluginSpecTuple, index): PluginSpecTuple | PluginSpecSRGit | undefined => {\n // skip everything up to and including the first Git PluginSpec\n if (index <= firstGitPluginIndex || !isGitPluginSpecTuple(current))\n return current;\n\n /** if another Git PluginSpec is discovered, copy its options to the first Git PluginSpec and return undefined. */\n if (hasGitOptions(current)) {\n const currentGitOpts = sanitizeGitOptions(current[1]);\n\n if (currentGitOpts.assets === false) {\n firstGitOpts.assets = false;\n }\n else {\n const assets: string[] = gitAssetsToStringArray(currentGitOpts.assets);\n if (Array.isArray(firstGitOpts.assets)) {\n firstGitOpts.assets.push(...assets);\n }\n else {\n firstGitOpts.assets = assets;\n }\n }\n\n if (typeof currentGitOpts.message === 'string')\n firstGitOpts.message = currentGitOpts.message;\n }\n return undefined;\n }).filter(pluginSpec => pluginSpec !== undefined);\n}\n"],"mappings":";;AAKA,MAAa,cAAc;;;;;;AAQ3B,SAAS,WAAW,KAAiC;CACnD,IAAI,OAAO,QAAQ,UACjB,OAAO;CA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rC;;;;;;;;CASJ,OAAO,QAAQ,KAAK,SAA0B,UAAyD;EAErG,IAAI,SAAS,uBAAuB,CAAC,qBAAqB,QAAQ,EAChE,OAAO;;EAGT,IAAI,cAAc,QAAQ,EAAE;GAC1B,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG;GAErD,IAAI,eAAe,WAAW,OAC5B,aAAa,SAAS;QAEnB;IACH,MAAM,SAAmB,uBAAuB,eAAe,OAAO;IACtE,IAAI,MAAM,QAAQ,aAAa,OAAO,EACpC,aAAa,OAAO,KAAK,GAAG,OAAO;SAGnC,aAAa,SAAS;;GAI1B,IAAI,OAAO,eAAe,YAAY,UACpC,aAAa,UAAU,eAAe;;GAG1C,CAAC,QAAO,eAAc,eAAe,KAAA,EAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"env.mjs","names":[],"sources":["../../src/utils/env.ts"],"sourcesContent":["import dotenvx, {\n type DotenvConfigOptions,\n type GetOptions,\n} from '@dotenvx/dotenvx';\nimport { env } from 'node:process';\n\n// I hate importing CommonJS modules with their broken default exports\nconst {\n get,\n config: loadDotenv,\n} = dotenvx;\n\n/** `get` can return `undefined`. It can also return a `Record`, but that's internal. */\ntype Get = (key: string, options?: GetOptions) => string | undefined;\n\n/**\n * A thin wrapper for {@link loadDotenv}. Loads a .env file from {@link process.cwd()} with the given options (or defaults), returns the new value of {@link process.env} with optional overrides.\n * @param [dotenvOptions] An optional {@link DotenvConfigOptions} object to pass to {@link loadDotenv}.\n * @param [overrides] If provided, this {@link NodeJS.ProcessEnv} object is merged into the return value, overriding existing properties where overlap occurs.\n * @returns A {@link NodeJS.ProcessEnv} object whose properties are variables loaded from the\n * process environment, the nearest .env file, and {@link overrides} (if provided). Where\n * overlap occurs, the later source takes priority.\n */\nexport function getEnv(dotenvOptions?: DotenvConfigOptions, overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n loadDotenv(dotenvOptions);\n\n if (overrides)\n Object.assign(env, overrides);\n\n return env;\n}\n\n/**\n * Get the value from the given env var in the current process or nearby .env file.\n * If found in process environment, its value is returned.\n * Else, try to get it from the nearest .env file.\n * If NOT found, return `undefined`\n * @param envVar The environment variable to lookup.\n * @param [options] Options to pass to {@link get}\n * @returns The string value of the environment variable or `undefined`.\n * `undefined` may be returned when the variable is undefined or its string is\n * empty, whitespace, or appears to have been converted from `null` or\n * `undefined`.\n */\nexport function getEnvVarValue(envVar: string, options?: GetOptions): string | undefined {\n options ??= { ignore: ['MISSING_KEY', 'MISSING_ENV_FILE'] };\n let value = env[envVar];\n const x = (get as Get)(envVar, options);\n if (typeof x === 'string')\n value = x;\n // I hate this. Why is undefined converted to a string?\n return value === '' || value === 'undefined'\n ? undefined\n : value;\n}\n"],"mappings":";;;AAOA,MAAM,EACJ,KACA,QAAQ,eACN;;;;;;;;;AAaJ,SAAgB,OAAO,eAAqC,WAAkD;AAC5G,YAAW,cAAc;AAEzB,KAAI,UACF,QAAO,OAAO,KAAK,UAAU;AAE/B,QAAO;;;;;;;;;;;;;;AAeT,SAAgB,eAAe,QAAgB,SAA0C;AACvF,aAAY,EAAE,QAAQ,CAAC,eAAe,mBAAmB,EAAE;CAC3D,IAAI,QAAQ,IAAI;CAChB,MAAM,IAAK,IAAY,QAAQ,QAAQ;AACvC,KAAI,OAAO,MAAM,SACf,SAAQ;AAEV,QAAO,UAAU,MAAM,UAAU,cAC7B,KAAA,IACA"}
1
+ {"version":3,"file":"env.mjs","names":[],"sources":["../../src/utils/env.ts"],"sourcesContent":["import dotenvx, {\n type DotenvConfigOptions,\n type GetOptions,\n} from '@dotenvx/dotenvx';\nimport { env } from 'node:process';\n\n// I hate importing CommonJS modules with their broken default exports\nconst {\n get,\n config: loadDotenv,\n} = dotenvx;\n\n/** `get` can return `undefined`. It can also return a `Record`, but that's internal. */\ntype Get = (key: string, options?: GetOptions) => string | undefined;\n\n/**\n * A thin wrapper for {@link loadDotenv}. Loads a .env file from {@link process.cwd()} with the given options (or defaults), returns the new value of {@link process.env} with optional overrides.\n * @param [dotenvOptions] An optional {@link DotenvConfigOptions} object to pass to {@link loadDotenv}.\n * @param [overrides] If provided, this {@link NodeJS.ProcessEnv} object is merged into the return value, overriding existing properties where overlap occurs.\n * @returns A {@link NodeJS.ProcessEnv} object whose properties are variables loaded from the\n * process environment, the nearest .env file, and {@link overrides} (if provided). Where\n * overlap occurs, the later source takes priority.\n */\nexport function getEnv(dotenvOptions?: DotenvConfigOptions, overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n loadDotenv(dotenvOptions);\n\n if (overrides)\n Object.assign(env, overrides);\n\n return env;\n}\n\n/**\n * Get the value from the given env var in the current process or nearby .env file.\n * If found in process environment, its value is returned.\n * Else, try to get it from the nearest .env file.\n * If NOT found, return `undefined`\n * @param envVar The environment variable to lookup.\n * @param [options] Options to pass to {@link get}\n * @returns The string value of the environment variable or `undefined`.\n * `undefined` may be returned when the variable is undefined or its string is\n * empty, whitespace, or appears to have been converted from `null` or\n * `undefined`.\n */\nexport function getEnvVarValue(envVar: string, options?: GetOptions): string | undefined {\n options ??= { ignore: ['MISSING_KEY', 'MISSING_ENV_FILE'] };\n let value = env[envVar];\n const x = (get as Get)(envVar, options);\n if (typeof x === 'string')\n value = x;\n // I hate this. Why is undefined converted to a string?\n return value === '' || value === 'undefined'\n ? undefined\n : value;\n}\n"],"mappings":";;;AAOA,MAAM,EACJ,KACA,QAAQ,eACN;;;;;;;;;AAaJ,SAAgB,OAAO,eAAqC,WAAkD;CAC5G,WAAW,cAAc;CAEzB,IAAI,WACF,OAAO,OAAO,KAAK,UAAU;CAE/B,OAAO;;;;;;;;;;;;;;AAeT,SAAgB,eAAe,QAAgB,SAA0C;CACvF,YAAY,EAAE,QAAQ,CAAC,eAAe,mBAAmB,EAAE;CAC3D,IAAI,QAAQ,IAAI;CAChB,MAAM,IAAK,IAAY,QAAQ,QAAQ;CACvC,IAAI,OAAO,MAAM,UACf,QAAQ;CAEV,OAAO,UAAU,MAAM,UAAU,cAC7B,KAAA,IACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"execAsync.mjs","names":[],"sources":["../../src/utils/execAsync.ts"],"sourcesContent":["/* eslint-disable jsdoc/no-defaults */\nimport { type, type Type } from 'arktype';\nimport { exec } from 'node:child_process';\nimport { constants } from 'node:os';\nimport { promisify } from 'node:util';\nimport { isError } from './isError.ts';\n\n/**\n * A `promisify(exec)` wrapper to optionally assign the child process's STDERR as the {@link Error.prototype.cause}.\n * @see {@link promisify}, {@link exec}\n * @param command The command to run, with space-separated arguments.\n * @param [setStderrAsCause=false] If true and the child process's stderr is available, the thrown Error's {@link Error.prototype.cause} is assigned the stderr string.\n * @returns A promise of the child process's STDOUT and STDERR streams as strings\n * @throws {Error | ChildProcessSpawnException}\n */\nexport async function execAsync(command: string, setStderrAsCause = false): Promise<{\n stdout: string;\n stderr: string;\n}> {\n return await promisify(exec)(command).catch((error: unknown): never => {\n if (!isError(error))\n throw new Error(JSON.stringify(error));\n\n if (setStderrAsCause && 'stderr' in error && typeof error.stderr === 'string' && error.stderr !== '')\n error.cause ??= error.stderr;\n\n if ('stdout' in error && typeof error.stdout === 'string') {\n error.message\n += '\\nSTDOUT:\\n'\n + ` ${error.stdout.replaceAll('\\n', '\\n ')}`;\n }\n if ('stderr' in error && typeof error.stderr === 'string') {\n error.message\n += '\\nSTDERR:\\n'\n + ` ${error.stderr.replaceAll('\\n', '\\n ')}`;\n }\n\n throw new ChildProcessSpawnException(error.message, error);\n });\n}\n\nconst T_ExecException: Type<{\n name: string;\n message: string;\n stack?: string | undefined;\n cause?: unknown;\n cmd?: string | null | undefined;\n killed?: boolean | null | undefined;\n code?: number | null | undefined;\n signal?: 'SIGABRT' | 'SIGALRM' | 'SIGBUS' | 'SIGCHLD' | 'SIGCONT' | 'SIGFPE' | 'SIGHUP' | 'SIGILL' | 'SIGINT' | 'SIGIO' | 'SIGIOT' | 'SIGKILL' | 'SIGPIPE' | 'SIGPOLL' | 'SIGPROF' | 'SIGPWR' | 'SIGQUIT' | 'SIGSEGV' | 'SIGSTKFLT' | 'SIGSTOP' | 'SIGSYS' | 'SIGTERM' | 'SIGTRAP' | 'SIGTSTP' | 'SIGTTIN' | 'SIGTTOU' | 'SIGUNUSED' | 'SIGURG' | 'SIGUSR1' | 'SIGUSR2' | 'SIGVTALRM' | 'SIGWINCH' | 'SIGXCPU' | 'SIGXFSZ' | 'SIGBREAK' | 'SIGLOST' | 'SIGINFO' | null | undefined;\n stdout?: string | undefined;\n stderr?: string | undefined;\n}> = type('Error').and({\n 'cmd?': 'string | null',\n 'killed?': 'boolean | null',\n 'code?': 'number | null',\n 'signal?': type.null.or((Object.keys(constants.signals) as NodeJS.Signals[])\n .map(v => type(`'${v}'`))\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((previous, current) => previous.or(current))),\n 'stdout?': 'string',\n 'stderr?': 'string',\n});\n\ntype _ExecException = typeof T_ExecException.inferOut;\n\nexport class ChildProcessSpawnException extends Error implements _ExecException {\n constructor(\n message: Parameters<typeof Error>[0],\n options: typeof T_ExecException.inferIn,\n ) {\n options = T_ExecException.from(options);\n super(message, options);\n this.cmd = options.cmd;\n this.code = options.code;\n this.killed = options.killed;\n this.signal = options.signal;\n this.stderr = options.stderr;\n this.stdout = options.stdout;\n }\n\n cmd: typeof T_ExecException.inferOut.cmd;\n code: typeof T_ExecException.inferOut.code;\n killed: typeof T_ExecException.inferOut.killed;\n signal: typeof T_ExecException.inferOut.signal;\n stderr: typeof T_ExecException.inferOut.stderr;\n stdout: typeof T_ExecException.inferOut.stdout;\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,eAAsB,UAAU,SAAiB,mBAAmB,OAGjE;AACD,QAAO,MAAM,UAAU,KAAK,CAAC,QAAQ,CAAC,OAAO,UAA0B;AACrE,MAAI,CAAC,QAAQ,MAAM,CACjB,OAAM,IAAI,MAAM,KAAK,UAAU,MAAM,CAAC;AAExC,MAAI,oBAAoB,YAAY,SAAS,OAAO,MAAM,WAAW,YAAY,MAAM,WAAW,GAChG,OAAM,UAAU,MAAM;AAExB,MAAI,YAAY,SAAS,OAAO,MAAM,WAAW,SAC/C,OAAM,WACD;;IACM,MAAM,OAAO,WAAW,MAAM,OAAO;AAElD,MAAI,YAAY,SAAS,OAAO,MAAM,WAAW,SAC/C,OAAM,WACD;;IACM,MAAM,OAAO,WAAW,MAAM,OAAO;AAGlD,QAAM,IAAI,2BAA2B,MAAM,SAAS,MAAM;GAC1D;;AAGJ,MAAM,kBAWD,KAAK,QAAQ,CAAC,IAAI;CACrB,QAAQ;CACR,WAAW;CACX,SAAS;CACT,WAAW,KAAK,KAAK,GAAI,OAAO,KAAK,UAAU,QAAQ,CACpD,KAAI,MAAK,KAAK,IAAI,EAAE,GAAG,CAAC,CAExB,QAAQ,UAAU,YAAY,SAAS,GAAG,QAAQ,CAAC,CAAC;CACvD,WAAW;CACX,WAAW;CACZ,CAAC;AAIF,IAAa,6BAAb,cAAgD,MAAgC;CAC9E,YACE,SACA,SACA;AACA,YAAU,gBAAgB,KAAK,QAAQ;AACvC,QAAM,SAAS,QAAQ;AACvB,OAAK,MAAM,QAAQ;AACnB,OAAK,OAAO,QAAQ;AACpB,OAAK,SAAS,QAAQ;AACtB,OAAK,SAAS,QAAQ;AACtB,OAAK,SAAS,QAAQ;AACtB,OAAK,SAAS,QAAQ;;CAGxB;CACA;CACA;CACA;CACA;CACA"}
1
+ {"version":3,"file":"execAsync.mjs","names":[],"sources":["../../src/utils/execAsync.ts"],"sourcesContent":["/* eslint-disable jsdoc/no-defaults */\nimport { type, type Type } from 'arktype';\nimport { exec } from 'node:child_process';\nimport { constants } from 'node:os';\nimport { promisify } from 'node:util';\nimport { isError } from './isError.ts';\n\n/**\n * A `promisify(exec)` wrapper to optionally assign the child process's STDERR as the {@link Error.prototype.cause}.\n * @see {@link promisify}, {@link exec}\n * @param command The command to run, with space-separated arguments.\n * @param [setStderrAsCause=false] If true and the child process's stderr is available, the thrown Error's {@link Error.prototype.cause} is assigned the stderr string.\n * @returns A promise of the child process's STDOUT and STDERR streams as strings\n * @throws {Error | ChildProcessSpawnException}\n */\nexport async function execAsync(command: string, setStderrAsCause = false): Promise<{\n stdout: string;\n stderr: string;\n}> {\n return await promisify(exec)(command).catch((error: unknown): never => {\n if (!isError(error))\n throw new Error(JSON.stringify(error));\n\n if (setStderrAsCause && 'stderr' in error && typeof error.stderr === 'string' && error.stderr !== '')\n error.cause ??= error.stderr;\n\n if ('stdout' in error && typeof error.stdout === 'string') {\n error.message\n += '\\nSTDOUT:\\n'\n + ` ${error.stdout.replaceAll('\\n', '\\n ')}`;\n }\n if ('stderr' in error && typeof error.stderr === 'string') {\n error.message\n += '\\nSTDERR:\\n'\n + ` ${error.stderr.replaceAll('\\n', '\\n ')}`;\n }\n\n throw new ChildProcessSpawnException(error.message, error);\n });\n}\n\nconst T_ExecException: Type<{\n name: string;\n message: string;\n stack?: string | undefined;\n cause?: unknown;\n cmd?: string | null | undefined;\n killed?: boolean | null | undefined;\n code?: number | null | undefined;\n signal?: 'SIGABRT' | 'SIGALRM' | 'SIGBUS' | 'SIGCHLD' | 'SIGCONT' | 'SIGFPE' | 'SIGHUP' | 'SIGILL' | 'SIGINT' | 'SIGIO' | 'SIGIOT' | 'SIGKILL' | 'SIGPIPE' | 'SIGPOLL' | 'SIGPROF' | 'SIGPWR' | 'SIGQUIT' | 'SIGSEGV' | 'SIGSTKFLT' | 'SIGSTOP' | 'SIGSYS' | 'SIGTERM' | 'SIGTRAP' | 'SIGTSTP' | 'SIGTTIN' | 'SIGTTOU' | 'SIGUNUSED' | 'SIGURG' | 'SIGUSR1' | 'SIGUSR2' | 'SIGVTALRM' | 'SIGWINCH' | 'SIGXCPU' | 'SIGXFSZ' | 'SIGBREAK' | 'SIGLOST' | 'SIGINFO' | null | undefined;\n stdout?: string | undefined;\n stderr?: string | undefined;\n}> = type('Error').and({\n 'cmd?': 'string | null',\n 'killed?': 'boolean | null',\n 'code?': 'number | null',\n 'signal?': type.null.or((Object.keys(constants.signals) as NodeJS.Signals[])\n .map(v => type(`'${v}'`))\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((previous, current) => previous.or(current))),\n 'stdout?': 'string',\n 'stderr?': 'string',\n});\n\ntype _ExecException = typeof T_ExecException.inferOut;\n\nexport class ChildProcessSpawnException extends Error implements _ExecException {\n constructor(\n message: Parameters<typeof Error>[0],\n options: typeof T_ExecException.inferIn,\n ) {\n options = T_ExecException.from(options);\n super(message, options);\n this.cmd = options.cmd;\n this.code = options.code;\n this.killed = options.killed;\n this.signal = options.signal;\n this.stderr = options.stderr;\n this.stdout = options.stdout;\n }\n\n cmd: typeof T_ExecException.inferOut.cmd;\n code: typeof T_ExecException.inferOut.code;\n killed: typeof T_ExecException.inferOut.killed;\n signal: typeof T_ExecException.inferOut.signal;\n stderr: typeof T_ExecException.inferOut.stderr;\n stdout: typeof T_ExecException.inferOut.stdout;\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,eAAsB,UAAU,SAAiB,mBAAmB,OAGjE;CACD,OAAO,MAAM,UAAU,KAAK,CAAC,QAAQ,CAAC,OAAO,UAA0B;EACrE,IAAI,CAAC,QAAQ,MAAM,EACjB,MAAM,IAAI,MAAM,KAAK,UAAU,MAAM,CAAC;EAExC,IAAI,oBAAoB,YAAY,SAAS,OAAO,MAAM,WAAW,YAAY,MAAM,WAAW,IAChG,MAAM,UAAU,MAAM;EAExB,IAAI,YAAY,SAAS,OAAO,MAAM,WAAW,UAC/C,MAAM,WACD;;IACM,MAAM,OAAO,WAAW,MAAM,OAAO;EAElD,IAAI,YAAY,SAAS,OAAO,MAAM,WAAW,UAC/C,MAAM,WACD;;IACM,MAAM,OAAO,WAAW,MAAM,OAAO;EAGlD,MAAM,IAAI,2BAA2B,MAAM,SAAS,MAAM;GAC1D;;AAGJ,MAAM,kBAWD,KAAK,QAAQ,CAAC,IAAI;CACrB,QAAQ;CACR,WAAW;CACX,SAAS;CACT,WAAW,KAAK,KAAK,GAAI,OAAO,KAAK,UAAU,QAAQ,CACpD,KAAI,MAAK,KAAK,IAAI,EAAE,GAAG,CAAC,CAExB,QAAQ,UAAU,YAAY,SAAS,GAAG,QAAQ,CAAC,CAAC;CACvD,WAAW;CACX,WAAW;CACZ,CAAC;AAIF,IAAa,6BAAb,cAAgD,MAAgC;CAC9E,YACE,SACA,SACA;EACA,UAAU,gBAAgB,KAAK,QAAQ;EACvC,MAAM,SAAS,QAAQ;EACvB,KAAK,MAAM,QAAQ;EACnB,KAAK,OAAO,QAAQ;EACpB,KAAK,SAAS,QAAQ;EACtB,KAAK,SAAS,QAAQ;EACtB,KAAK,SAAS,QAAQ;EACtB,KAAK,SAAS,QAAQ;;CAGxB;CACA;CACA;CACA;CACA;CACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"isError.mjs","names":[],"sources":["../../src/utils/isError.ts"],"sourcesContent":["import { isNativeError } from 'node:util/types';\n\n/** @import 'typescript/lib/lib.esnext.error.d.ts' */\n\n/**\n * Compatibility wrapper for ES2026 (Node.js 25)\n * {@link Error.isError Error.isError}\n * with failover to the deprecated {@link isNativeError utils.types.isNativeError}.\n * @param error A parameter which may be an Error.\n * @returns `true` if {@link error} is derived from or is sufficiently similar to {@link Error}. Else, `false`.\n * Note: DOMExceptions will result in `false`\n */\nexport function isError(error: unknown): error is Error {\n return 'isError' in Error && typeof Error.isError === 'function' && Error.isError.length > 0\n ? (Error.isError as typeof isError)(error)\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n : isNativeError(error);\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,QAAQ,OAAgC;AACtD,QAAO,aAAa,SAAS,OAAO,MAAM,YAAY,cAAc,MAAM,QAAQ,SAAS,IACtF,MAAM,QAA2B,MAAM,GAExC,cAAc,MAAM"}
1
+ {"version":3,"file":"isError.mjs","names":[],"sources":["../../src/utils/isError.ts"],"sourcesContent":["import { isNativeError } from 'node:util/types';\n\n/** @import 'typescript/lib/lib.esnext.error.d.ts' */\n\n/**\n * Compatibility wrapper for ES2026 (Node.js 25)\n * {@link Error.isError Error.isError}\n * with failover to the deprecated {@link isNativeError utils.types.isNativeError}.\n * @param error A parameter which may be an Error.\n * @returns `true` if {@link error} is derived from or is sufficiently similar to {@link Error}. Else, `false`.\n * Note: DOMExceptions will result in `false`\n */\nexport function isError(error: unknown): error is Error {\n return 'isError' in Error && typeof Error.isError === 'function' && Error.isError.length > 0\n ? Error.isError(error)\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n : isNativeError(error);\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,QAAQ,OAAgC;CACtD,OAAO,aAAa,SAAS,OAAO,MAAM,YAAY,cAAc,MAAM,QAAQ,SAAS,IACvF,MAAM,QAAQ,MAAM,GAEpB,cAAc,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"filterForGetters.mjs","names":[],"sources":["../../../src/utils/reflection/filterForGetters.ts"],"sourcesContent":["import type {\n BaseClassProto,\n baseClassProto,\n ClassLike,\n ConstructorConstraint,\n InstanceTypeOrSelf,\n SuperClassLike,\n WithProto,\n} from './inheritance.ts';\nimport type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.d.ts';\nimport type { OwnGetterDescriptorMap } from './OwnGetterDescriptorMap.d.ts';\nimport type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.d.ts';\nimport type { PropertyDescriptorMap } from './PropertyDescriptorMap.d.ts';\n\nexport function filterForGetters<\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | typeof baseClassProto>>,\n>(\n descriptorMap: InstancePropertyDescriptorMap<Class>,\n): Partial<OwnGetterDescriptorMap<\n InstanceType<Class>,\n Class['__proto__'] extends BaseClassProto ? null : InstanceTypeOrSelf<Class['__proto__']>\n>>;\nexport function filterForGetters<\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n>(\n descriptorMap: OwnPropertyDescriptorMap<Class>,\n): Partial<OwnGetterDescriptorMap<Class, Class['__proto__']>>;\n/**\n * Iterates through the descriptors object, checking for property descriptors whose `get` is a function.\n * Returns an {@link OwnGetterDescriptorMap} of the getters.\n * If you want only own, non-inherited getters, you must filter sanitize the\n * type the `descriptors` parameter yourself e.g. `Omit<Class, keyof\n * SuperClass>`.\n * @param descriptorMap An object like the return value of Object.getOwnPropertyDescriptors\n * @template Class Any ClassLike type\n * @template T Any `object`-like type.\n * @template [__proto__=null] If {@link Class} is not {@link ClassLike}, the `__proto__` of {@link T}.\n * @returns An {@link OwnGetterDescriptorMap}.\n * @since 3.0.0\n */\nexport function filterForGetters<\n T extends object,\n __proto__ extends object | null = null,\n>(\n descriptorMap: PropertyDescriptorMap<T, __proto__> | PropertyDescriptorMap<T>,\n): Partial<OwnGetterDescriptorMap<T, __proto__>> {\n let getterDescriptorMap: Partial<OwnGetterDescriptorMap<T, __proto__>> = {};\n for (const key in descriptorMap) {\n const element = descriptorMap[key as keyof typeof descriptorMap];\n if (typeof element.get === 'function') {\n getterDescriptorMap = Object.assign(\n getterDescriptorMap,\n { [key]: element },\n );\n }\n }\n\n return getterDescriptorMap;\n}\n"],"mappings":";;;;;;;;;;;;;;AAwCA,SAAgB,iBAId,eAC+C;CAC/C,IAAI,sBAAqE,EAAE;AAC3E,MAAK,MAAM,OAAO,eAAe;EAC/B,MAAM,UAAU,cAAc;AAC9B,MAAI,OAAO,QAAQ,QAAQ,WACzB,uBAAsB,OAAO,OAC3B,qBACA,GAAG,MAAM,SAAS,CACnB;;AAIL,QAAO"}
1
+ {"version":3,"file":"filterForGetters.mjs","names":[],"sources":["../../../src/utils/reflection/filterForGetters.ts"],"sourcesContent":["import type {\n BaseClassProto,\n baseClassProto,\n ClassLike,\n ConstructorConstraint,\n InstanceTypeOrSelf,\n SuperClassLike,\n WithProto,\n} from './inheritance.ts';\nimport type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.d.ts';\nimport type { OwnGetterDescriptorMap } from './OwnGetterDescriptorMap.d.ts';\nimport type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.d.ts';\nimport type { PropertyDescriptorMap } from './PropertyDescriptorMap.d.ts';\n\nexport function filterForGetters<\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | typeof baseClassProto>>,\n>(\n descriptorMap: InstancePropertyDescriptorMap<Class>,\n): Partial<OwnGetterDescriptorMap<\n InstanceType<Class>,\n Class['__proto__'] extends BaseClassProto ? null : InstanceTypeOrSelf<Class['__proto__']>\n>>;\nexport function filterForGetters<\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n>(\n descriptorMap: OwnPropertyDescriptorMap<Class>,\n): Partial<OwnGetterDescriptorMap<Class, Class['__proto__']>>;\n/**\n * Iterates through the descriptors object, checking for property descriptors whose `get` is a function.\n * Returns an {@link OwnGetterDescriptorMap} of the getters.\n * If you want only own, non-inherited getters, you must filter sanitize the\n * type the `descriptors` parameter yourself e.g. `Omit<Class, keyof\n * SuperClass>`.\n * @param descriptorMap An object like the return value of Object.getOwnPropertyDescriptors\n * @template Class Any ClassLike type\n * @template T Any `object`-like type.\n * @template [__proto__=null] If {@link Class} is not {@link ClassLike}, the `__proto__` of {@link T}.\n * @returns An {@link OwnGetterDescriptorMap}.\n * @since 3.0.0\n */\nexport function filterForGetters<\n T extends object,\n __proto__ extends object | null = null,\n>(\n descriptorMap: PropertyDescriptorMap<T, __proto__> | PropertyDescriptorMap<T>,\n): Partial<OwnGetterDescriptorMap<T, __proto__>> {\n let getterDescriptorMap: Partial<OwnGetterDescriptorMap<T, __proto__>> = {};\n for (const key in descriptorMap) {\n const element = descriptorMap[key as keyof typeof descriptorMap];\n if (typeof element.get === 'function') {\n getterDescriptorMap = Object.assign(\n getterDescriptorMap,\n { [key]: element },\n );\n }\n }\n\n return getterDescriptorMap;\n}\n"],"mappings":";;;;;;;;;;;;;;AAwCA,SAAgB,iBAId,eAC+C;CAC/C,IAAI,sBAAqE,EAAE;CAC3E,KAAK,MAAM,OAAO,eAAe;EAC/B,MAAM,UAAU,cAAc;EAC9B,IAAI,OAAO,QAAQ,QAAQ,YACzB,sBAAsB,OAAO,OAC3B,qBACA,GAAG,MAAM,SAAS,CACnB;;CAIL,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"getOwnPropertyDescriptors.mjs","names":[],"sources":["../../../src/utils/reflection/getOwnPropertyDescriptors.ts"],"sourcesContent":["import type { InstanceOrStatic } from '../miscTypes.ts';\nimport type { BaseClassProto, ClassLike, ConstructorConstraint, SuperClassLike, WithProto } from './inheritance.ts';\nimport type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.d.ts';\nimport type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.d.ts';\n\n/**\n * Get the property descriptors of the class or constructor similar to {@link Object.getOwnPropertyDescriptors}, but with more options--including recursion.\n * @template {InstanceOrStatic} _InstanceOrStatic 'Instance' or 'Static'. Determines the return type.\n * @param classDefinition A class or constructor, cast to {@link ClassLike}.\n * @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.\n * @template {ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>} Class\n * The typeof {@link classDefinition}.\n * {@link WithProto}<{@link SuperClassLike}> is necessary for walking the\n * prototype chain for both Instance and Static properties.\n * If unspecified, the return type may be incorrect.\n * @returns ({@link instanceOrStatic} === 'Instance') ? {@link InstancePropertyDescriptorMap<Class>}\\\n * : ({@link instanceOrStatic} === 'Static') ? {@link OwnPropertyDescriptorMap<Class>}\\\n * : never\n * @throws {TypeError}\n * @since 3.0.0\n */\nexport function getOwnPropertyDescriptors<\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n _InstanceOrStatic extends InstanceOrStatic,\n>(\n classDefinition: Class,\n instanceOrStatic: _InstanceOrStatic,\n): [_InstanceOrStatic] extends ['Instance']\n ? InstancePropertyDescriptorMap<Class>\n : [_InstanceOrStatic] extends ['Static']\n ? OwnPropertyDescriptorMap<Class>\n : never {\n switch (instanceOrStatic) {\n case 'Instance': {\n return Object.getOwnPropertyDescriptors(classDefinition.prototype) as [Extract<typeof instanceOrStatic, 'Instance'>] extends ['Instance']\n ? InstancePropertyDescriptorMap<Class>\n : [_InstanceOrStatic] extends ['Static']\n ? OwnPropertyDescriptorMap<Class>\n : never;\n }\n case 'Static': {\n return Object.getOwnPropertyDescriptors(classDefinition) as [Extract<typeof instanceOrStatic, 'Static'>] extends ['Instance']\n ? InstancePropertyDescriptorMap<Class>\n : [_InstanceOrStatic] extends ['Static']\n ? OwnPropertyDescriptorMap<Class>\n : never;\n }\n default: {\n throw new TypeError('Argument `instanceOrStatic` must be \"Instance\" or \"Static\".');\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,SAAgB,0BAId,iBACA,kBAKY;AACZ,SAAQ,kBAAR;EACE,KAAK,WACH,QAAO,OAAO,0BAA0B,gBAAgB,UAAU;EAMpE,KAAK,SACH,QAAO,OAAO,0BAA0B,gBAAgB;EAM1D,QACE,OAAM,IAAI,UAAU,kEAA8D"}
1
+ {"version":3,"file":"getOwnPropertyDescriptors.mjs","names":[],"sources":["../../../src/utils/reflection/getOwnPropertyDescriptors.ts"],"sourcesContent":["import type { InstanceOrStatic } from '../miscTypes.ts';\nimport type { BaseClassProto, ClassLike, ConstructorConstraint, SuperClassLike, WithProto } from './inheritance.ts';\nimport type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.d.ts';\nimport type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.d.ts';\n\n/**\n * Get the property descriptors of the class or constructor similar to {@link Object.getOwnPropertyDescriptors}, but with more options--including recursion.\n * @template {InstanceOrStatic} _InstanceOrStatic 'Instance' or 'Static'. Determines the return type.\n * @param classDefinition A class or constructor, cast to {@link ClassLike}.\n * @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.\n * @template {ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>} Class\n * The typeof {@link classDefinition}.\n * {@link WithProto}<{@link SuperClassLike}> is necessary for walking the\n * prototype chain for both Instance and Static properties.\n * If unspecified, the return type may be incorrect.\n * @returns ({@link instanceOrStatic} === 'Instance') ? {@link InstancePropertyDescriptorMap<Class>}\\\n * : ({@link instanceOrStatic} === 'Static') ? {@link OwnPropertyDescriptorMap<Class>}\\\n * : never\n * @throws {TypeError}\n * @since 3.0.0\n */\nexport function getOwnPropertyDescriptors<\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n _InstanceOrStatic extends InstanceOrStatic,\n>(\n classDefinition: Class,\n instanceOrStatic: _InstanceOrStatic,\n): [_InstanceOrStatic] extends ['Instance']\n ? InstancePropertyDescriptorMap<Class>\n : [_InstanceOrStatic] extends ['Static']\n ? OwnPropertyDescriptorMap<Class>\n : never {\n switch (instanceOrStatic) {\n case 'Instance': {\n return Object.getOwnPropertyDescriptors(classDefinition.prototype) as [Extract<typeof instanceOrStatic, 'Instance'>] extends ['Instance']\n ? InstancePropertyDescriptorMap<Class>\n : [_InstanceOrStatic] extends ['Static']\n ? OwnPropertyDescriptorMap<Class>\n : never;\n }\n case 'Static': {\n return Object.getOwnPropertyDescriptors(classDefinition) as [Extract<typeof instanceOrStatic, 'Static'>] extends ['Instance']\n ? InstancePropertyDescriptorMap<Class>\n : [_InstanceOrStatic] extends ['Static']\n ? OwnPropertyDescriptorMap<Class>\n : never;\n }\n default: {\n throw new TypeError('Argument `instanceOrStatic` must be \"Instance\" or \"Static\".');\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,SAAgB,0BAId,iBACA,kBAKY;CACZ,QAAQ,kBAAR;EACE,KAAK,YACH,OAAO,OAAO,0BAA0B,gBAAgB,UAAU;EAMpE,KAAK,UACH,OAAO,OAAO,0BAA0B,gBAAgB;EAM1D,SACE,MAAM,IAAI,UAAU,kEAA8D"}
@@ -1 +1 @@
1
- {"version":3,"file":"getOwnPropertyDescriptorsRecursively.mjs","names":[],"sources":["../../../src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts"],"sourcesContent":["import type { Increment } from '../GracefulRecursion.d.ts';\nimport type { InstanceOrStatic, Integer } from '../miscTypes.ts';\nimport { getOwnPropertyDescriptors } from './getOwnPropertyDescriptors.ts';\nimport { getPrototypesChainOf } from './getPrototypeChainOf.ts';\nimport type {\n BaseClass,\n BaseClassProto,\n ClassLike,\n ConstructorConstraint,\n ConstructorLike,\n ProtoChainOfClass,\n SuperClassLike,\n WithProto,\n} from './inheritance.ts';\nimport type { InstanceTypeOrSelfPropertyDescriptorMap } from './InstanceTypeOrSelfPropertyDescriptorMap.d.ts';\nimport type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.d.ts';\n/**\n * JSDoc type imports\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type { getPrototypeOf as _getPrototypeOf } from './getPrototypeOf.ts';\nimport type { listOwnGetters as _listOwnGetters } from './listOwnGetters.ts';\nimport type { InstancePropertyDescriptorMap as _InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.d.ts';\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/**\n * A conditional wrapper for {@link InstanceTypeOrSelfPropertyDescriptorMap} and\n * {@link OwnPropertyDescriptorMap}.\n *\n * If {@link _InstanceOrStatic} is 'Instance', {@link InstanceTypeOrSelfPropertyDescriptorMap}.\\\n * Else if {@link _InstanceOrStatic} is 'Static',\n * {@link OwnPropertyDescriptorMap }.\\\n * Else, `never`.\n * @template {ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>} Class\n * A class definition cast to {@link ClassLike}.\n * @template {InstanceOrStatic} _InstanceOrStatic\n * 'Instance' or 'Static'. Determines the return type.\n * @since 3.0.0\n */\nexport type RecursedPropertyDescriptorMap<\n Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,\n _InstanceOrStatic extends InstanceOrStatic,\n> = [_InstanceOrStatic] extends ['Instance'] ? InstanceTypeOrSelfPropertyDescriptorMap<Class, Class['__proto__']>\n : [_InstanceOrStatic] extends ['Static'] ? OwnPropertyDescriptorMap<Class>\n : never;\n\n/**\n * An\n * ordered array of {@link OwnPropertyDescriptorMap} or\n * {@link InstancePropertyDescriptorMap} starting with {@link classDefinition}\n * and ending with a {@link BaseClass}.\n * @template {ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>} Class\n * @template {'Instance' | 'Static'} InstanceOrStatic\n * @template {Integer<number>} [Limit=16]\n * @template {Integer<number>} [CurrentLevel=0]\n */\nexport type RecursedPropertyDescriptorMapArray<\n Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,\n InstanceOrStatic extends 'Instance' | 'Static',\n Limit extends Integer<number> = 16,\n CurrentLevel extends Integer<number> = 0,\n> = Class['__proto__'] extends BaseClassProto['__proto__'] | BaseClassProto['__proto__']['__proto__'] ? never\n : Class['__proto__'] extends BaseClassProto ? [RecursedPropertyDescriptorMap<BaseClass<Class>, InstanceOrStatic>]\n : Class['__proto__'] extends ConstructorLike<Class['__proto__']>\n ? [\n RecursedPropertyDescriptorMap<Class, InstanceOrStatic>,\n ...RecursedPropertyDescriptorMapArray<\n ClassLike<Exclude<Class['__proto__'], BaseClassProto> & WithProto<SuperClassLike | BaseClassProto>>,\n InstanceOrStatic,\n Limit,\n Increment<CurrentLevel>\n >,\n ]\n : never;\n/**\n * Walks the class inheritance chain to get a PropertyDescriptorMap of each class.\n *\n * While you _can_ use this to get an array of getter names/keys, you should use {@link getPrototypeOf} and {@link listOwnGetters}, instead!\n * @template Class Any class definition type-cast to {@link ClassLike}\n * @template _InstanceOrStatic\n * @param classDefinition Any class definition type-cast to {@link ClassLike}\n * @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.\n * @returns An\n * ordered array of {@link OwnPropertyDescriptorMap} or\n * {@link InstancePropertyDescriptorMap} starting with {@link classDefinition}\n * and ending with a {@link BaseClass}.\n * @since 3.0.0\n */\nexport function getOwnPropertyDescriptorsRecursively<\n // Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n _InstanceOrStatic extends InstanceOrStatic,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\n Limit extends Integer<number> = 16,\n>(\n classDefinition: Class,\n instanceOrStatic: _InstanceOrStatic,\n): RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic> {\n const staticProtoChain: ProtoChainOfClass<Class> = getPrototypesChainOf(classDefinition, 'classes');\n if (isSingleTuple(staticProtoChain)) {\n return [\n getOwnPropertyDescriptors(\n staticProtoChain[0],\n instanceOrStatic,\n ) as RecursedPropertyDescriptorMap<Class, _InstanceOrStatic>,\n ] as unknown as RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic, Limit>;\n }\n\n const recursedPropertyDescriptorMapArray = staticProtoChain.map(classDefinition =>\n getOwnPropertyDescriptors(\n classDefinition,\n instanceOrStatic,\n ),\n );\n\n return recursedPropertyDescriptorMapArray as RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic>;\n}\n\n/**\n * Simple utility for single-tuple type assertion\n * @template {T} T T in T[]\n * @param array an array\n * @returns array is [T]\n */\nfunction isSingleTuple<T>(array: T[]): array is [T] {\n return Array.isArray(array) && array.length === 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwFA,SAAgB,qCAOd,iBACA,kBAC8D;CAC9D,MAAM,mBAA6C,qBAAqB,iBAAiB,UAAU;AACnG,KAAI,cAAc,iBAAiB,CACjC,QAAO,CACL,0BACE,iBAAiB,IACjB,iBACD,CACF;AAUH,QAP2C,iBAAiB,KAAI,oBAC9D,0BACE,iBACA,iBACD,CACF;;;;;;;;AAWH,SAAS,cAAiB,OAA0B;AAClD,QAAO,MAAM,QAAQ,MAAM,IAAI,MAAM,WAAW"}
1
+ {"version":3,"file":"getOwnPropertyDescriptorsRecursively.mjs","names":[],"sources":["../../../src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts"],"sourcesContent":["import type { Increment } from '../GracefulRecursion.d.ts';\nimport type { InstanceOrStatic, Integer } from '../miscTypes.ts';\nimport { getOwnPropertyDescriptors } from './getOwnPropertyDescriptors.ts';\nimport { getPrototypesChainOf } from './getPrototypeChainOf.ts';\nimport type {\n BaseClass,\n BaseClassProto,\n ClassLike,\n ConstructorConstraint,\n ConstructorLike,\n ProtoChainOfClass,\n SuperClassLike,\n WithProto,\n} from './inheritance.ts';\nimport type { InstanceTypeOrSelfPropertyDescriptorMap } from './InstanceTypeOrSelfPropertyDescriptorMap.d.ts';\nimport type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.d.ts';\n/**\n * JSDoc type imports\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type { getPrototypeOf as _getPrototypeOf } from './getPrototypeOf.ts';\nimport type { listOwnGetters as _listOwnGetters } from './listOwnGetters.ts';\nimport type { InstancePropertyDescriptorMap as _InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.d.ts';\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/**\n * A conditional wrapper for {@link InstanceTypeOrSelfPropertyDescriptorMap} and\n * {@link OwnPropertyDescriptorMap}.\n *\n * If {@link _InstanceOrStatic} is 'Instance', {@link InstanceTypeOrSelfPropertyDescriptorMap}.\\\n * Else if {@link _InstanceOrStatic} is 'Static',\n * {@link OwnPropertyDescriptorMap }.\\\n * Else, `never`.\n * @template {ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>} Class\n * A class definition cast to {@link ClassLike}.\n * @template {InstanceOrStatic} _InstanceOrStatic\n * 'Instance' or 'Static'. Determines the return type.\n * @since 3.0.0\n */\nexport type RecursedPropertyDescriptorMap<\n Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,\n _InstanceOrStatic extends InstanceOrStatic,\n> = [_InstanceOrStatic] extends ['Instance'] ? InstanceTypeOrSelfPropertyDescriptorMap<Class, Class['__proto__']>\n : [_InstanceOrStatic] extends ['Static'] ? OwnPropertyDescriptorMap<Class>\n : never;\n\n/**\n * An\n * ordered array of {@link OwnPropertyDescriptorMap} or\n * {@link InstancePropertyDescriptorMap} starting with {@link classDefinition}\n * and ending with a {@link BaseClass}.\n * @template {ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>} Class\n * @template {'Instance' | 'Static'} InstanceOrStatic\n * @template {Integer<number>} [Limit=16]\n * @template {Integer<number>} [CurrentLevel=0]\n */\nexport type RecursedPropertyDescriptorMapArray<\n Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,\n InstanceOrStatic extends 'Instance' | 'Static',\n Limit extends Integer<number> = 16,\n CurrentLevel extends Integer<number> = 0,\n> = Class['__proto__'] extends BaseClassProto['__proto__'] | BaseClassProto['__proto__']['__proto__'] ? never\n : Class['__proto__'] extends BaseClassProto ? [RecursedPropertyDescriptorMap<BaseClass<Class>, InstanceOrStatic>]\n : Class['__proto__'] extends ConstructorLike<Class['__proto__']>\n ? [\n RecursedPropertyDescriptorMap<Class, InstanceOrStatic>,\n ...RecursedPropertyDescriptorMapArray<\n ClassLike<Exclude<Class['__proto__'], BaseClassProto> & WithProto<SuperClassLike | BaseClassProto>>,\n InstanceOrStatic,\n Limit,\n Increment<CurrentLevel>\n >,\n ]\n : never;\n/**\n * Walks the class inheritance chain to get a PropertyDescriptorMap of each class.\n *\n * While you _can_ use this to get an array of getter names/keys, you should use {@link getPrototypeOf} and {@link listOwnGetters}, instead!\n * @template Class Any class definition type-cast to {@link ClassLike}\n * @template _InstanceOrStatic\n * @param classDefinition Any class definition type-cast to {@link ClassLike}\n * @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.\n * @returns An\n * ordered array of {@link OwnPropertyDescriptorMap} or\n * {@link InstancePropertyDescriptorMap} starting with {@link classDefinition}\n * and ending with a {@link BaseClass}.\n * @since 3.0.0\n */\nexport function getOwnPropertyDescriptorsRecursively<\n // Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,\n _InstanceOrStatic extends InstanceOrStatic,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\n Limit extends Integer<number> = 16,\n>(\n classDefinition: Class,\n instanceOrStatic: _InstanceOrStatic,\n): RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic> {\n const staticProtoChain: ProtoChainOfClass<Class> = getPrototypesChainOf(classDefinition, 'classes');\n if (isSingleTuple(staticProtoChain)) {\n return [\n getOwnPropertyDescriptors(\n staticProtoChain[0],\n instanceOrStatic,\n ) as RecursedPropertyDescriptorMap<Class, _InstanceOrStatic>,\n ] as unknown as RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic, Limit>;\n }\n\n const recursedPropertyDescriptorMapArray = staticProtoChain.map(classDefinition =>\n getOwnPropertyDescriptors(\n classDefinition,\n instanceOrStatic,\n ),\n );\n\n return recursedPropertyDescriptorMapArray as RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic>;\n}\n\n/**\n * Simple utility for single-tuple type assertion\n * @template {T} T T in T[]\n * @param array an array\n * @returns array is [T]\n */\nfunction isSingleTuple<T>(array: T[]): array is [T] {\n return Array.isArray(array) && array.length === 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwFA,SAAgB,qCAOd,iBACA,kBAC8D;CAC9D,MAAM,mBAA6C,qBAAqB,iBAAiB,UAAU;CACnG,IAAI,cAAc,iBAAiB,EACjC,OAAO,CACL,0BACE,iBAAiB,IACjB,iBACD,CACF;CAUH,OAP2C,iBAAiB,KAAI,oBAC9D,0BACE,iBACA,iBACD,CAGsC;;;;;;;;AAS3C,SAAS,cAAiB,OAA0B;CAClD,OAAO,MAAM,QAAQ,MAAM,IAAI,MAAM,WAAW"}