@halospv3/hce.shared-config 3.5.2-develop.1 → 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.
- package/CHANGELOG.md +12 -0
- package/mjs/CaseInsensitiveMap.mjs.map +1 -1
- package/mjs/debug.mjs.map +1 -1
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs +1 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +6 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -1
- package/mjs/dotnet/MSBuildProject.mjs +54 -0
- package/mjs/dotnet/MSBuildProject.mjs.map +1 -1
- package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -1
- package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -1
- package/mjs/dotnet/NugetRegistryInfo.mjs +68 -0
- package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/helpers.mjs +65 -1
- package/mjs/dotnet/helpers.mjs.map +1 -1
- package/mjs/insertPlugins.mjs.map +1 -1
- package/mjs/semanticReleaseConfig.mjs +1 -0
- package/mjs/semanticReleaseConfig.mjs.map +1 -1
- package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -1
- package/mjs/setupGitPluginSpec.mjs.map +1 -1
- package/mjs/utils/env.mjs.map +1 -1
- package/mjs/utils/execAsync.mjs.map +1 -1
- package/mjs/utils/isError.mjs.map +1 -1
- package/mjs/utils/reflection/filterForGetters.mjs.map +1 -1
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -1
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -1
- package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -1
- package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -1
- package/mjs/utils/reflection/isConstructor.mjs.map +1 -1
- package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -1
- package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -1
- package/package.json +10 -10
- package/src/utils/isError.ts +1 -1
- package/src/utils/reflection/getPrototypeOf.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [3.5.3-develop.1](https://github.com/HaloSPV3/HCE.Shared/compare/v3.5.2...v3.5.3-develop.1) (2026-05-11)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **deps:** update commitlint monorepo to v21 ([a8739ee](https://github.com/HaloSPV3/HCE.Shared/commit/a8739ee6fda0d062550d6bd650decccc3a4dd755))
|
|
6
|
+
|
|
7
|
+
## [3.5.2](https://github.com/HaloSPV3/HCE.Shared/compare/v3.5.1...v3.5.2) (2026-04-18)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** bump the npm-dependencies group across 1 directory with 5 updates ([#674](https://github.com/HaloSPV3/HCE.Shared/issues/674)) ([fa05274](https://github.com/HaloSPV3/HCE.Shared/commit/fa052741a2d36e090a75d399726e8eafe6bde979))
|
|
12
|
+
|
|
1
13
|
## [3.5.2-develop.1](https://github.com/HaloSPV3/HCE.Shared/compare/v3.5.1...v3.5.2-develop.1) (2026-04-17)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseInsensitiveMap.mjs","names":[],"sources":["../src/CaseInsensitiveMap.ts"],"sourcesContent":["/**\n * https://stackoverflow.com/a/50022230/14894786\n * licensed under CC BY-SA 4.0\n * changes: add overrides, remove \"as any\", remove empty lines\n */\nexport class CaseInsensitiveMap<T, U> extends Map<T, U> {\n override delete(key: T): boolean {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.delete(key);\n }\n\n override get(key: T): U | undefined {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.get(key);\n }\n\n override has(key: T): boolean {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.has(key);\n }\n\n override set(key: T, value: U): this {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.set(key, value);\n }\n}\n"],"mappings":";;;;;;AAKA,IAAa,qBAAb,cAA8C,IAAU;CACtD,OAAgB,KAAiB;
|
|
1
|
+
{"version":3,"file":"CaseInsensitiveMap.mjs","names":[],"sources":["../src/CaseInsensitiveMap.ts"],"sourcesContent":["/**\n * https://stackoverflow.com/a/50022230/14894786\n * licensed under CC BY-SA 4.0\n * changes: add overrides, remove \"as any\", remove empty lines\n */\nexport class CaseInsensitiveMap<T, U> extends Map<T, U> {\n override delete(key: T): boolean {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.delete(key);\n }\n\n override get(key: T): U | undefined {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.get(key);\n }\n\n override has(key: T): boolean {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.has(key);\n }\n\n override set(key: T, value: U): this {\n if (typeof key === 'string') {\n key = key.toLowerCase() as T;\n }\n return super.set(key, value);\n }\n}\n"],"mappings":";;;;;;AAKA,IAAa,qBAAb,cAA8C,IAAU;CACtD,OAAgB,KAAiB;EAC/B,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,aAAa;EAEzB,OAAO,MAAM,OAAO,IAAI;;CAG1B,IAAa,KAAuB;EAClC,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,aAAa;EAEzB,OAAO,MAAM,IAAI,IAAI;;CAGvB,IAAa,KAAiB;EAC5B,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,aAAa;EAEzB,OAAO,MAAM,IAAI,IAAI;;CAGvB,IAAa,KAAQ,OAAgB;EACnC,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,aAAa;EAEzB,OAAO,MAAM,IAAI,KAAK,MAAM"}
|
package/mjs/debug.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.mjs","names":[],"sources":["../src/debug.ts"],"sourcesContent":["// note: @types/debug is incorrect. There is no .log function!\nimport createDebugger, { type Debugger } from 'debug';\nimport * as process from 'node:process';\n\nconst _debug = createDebugger('@halospv3/hce.shared-config') as Debugger & { log: never };\n\nif (process.argv.some(v => v.includes('--debug')) || createDebugger.enabled('@halospv3/hce.shared-config')) {\n createDebugger.enable(_debug.namespace);\n}\n\nexport default _debug;\n"],"mappings":";;;AAIA,MAAM,SAAS,eAAe,8BAA8B;AAE5D,IAAI,QAAQ,KAAK,MAAK,MAAK,EAAE,SAAS,UAAU,CAAC,IAAI,eAAe,QAAQ,8BAA8B,
|
|
1
|
+
{"version":3,"file":"debug.mjs","names":[],"sources":["../src/debug.ts"],"sourcesContent":["// note: @types/debug is incorrect. There is no .log function!\nimport createDebugger, { type Debugger } from 'debug';\nimport * as process from 'node:process';\n\nconst _debug = createDebugger('@halospv3/hce.shared-config') as Debugger & { log: never };\n\nif (process.argv.some(v => v.includes('--debug')) || createDebugger.enabled('@halospv3/hce.shared-config')) {\n createDebugger.enable(_debug.namespace);\n}\n\nexport default _debug;\n"],"mappings":";;;AAIA,MAAM,SAAS,eAAe,8BAA8B;AAE5D,IAAI,QAAQ,KAAK,MAAK,MAAK,EAAE,SAAS,UAAU,CAAC,IAAI,eAAe,QAAQ,8BAA8B,EACxG,eAAe,OAAO,OAAO,UAAU"}
|
|
@@ -31,6 +31,7 @@ const GHNRI = GithubNugetRegistryInfo;
|
|
|
31
31
|
* environment variable `GITHUB_REPOSITORY_OWNER` is undefined!
|
|
32
32
|
*/
|
|
33
33
|
const GHNRIOpts = NRIOptsBase.merge({
|
|
34
|
+
/** @see {@link GHNRI.getNugetGitHubUrl } */
|
|
34
35
|
source: NRIOptsBase.get("source").default(() => GHNRI.getNugetGitHubUrl() ?? ""),
|
|
35
36
|
tokenEnvVars: NRIOptsBase.get("tokenEnvVars").default(() => DefaultGithubTokenEnvVars)
|
|
36
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GithubNugetRegistryInfo.mjs","names":[],"sources":["../../src/dotnet/GithubNugetRegistryInfo.ts"],"sourcesContent":["import type { Type } from 'arktype';\nimport { getEnvVarValue } from '../utils/env.ts';\nimport type { MSBuildProject, MSBuildEvaluationOutput } from './MSBuildProject.ts';\nimport type { NugetProjectProperties } from './NugetProjectProperties.ts';\nimport {\n NugetRegistryInfo,\n NRIOptsBase,\n} from './NugetRegistryInfo.ts';\nimport type { Default } from 'arktype/internal/attributes.ts';\n\nconst NUGET_PKG_GITHUB_COM = 'https://nuget.pkg.github.com';\nexport const DefaultGithubTokenEnvVars: readonly ['GH_TOKEN', 'GITHUB_TOKEN'] = Object.freeze([\n 'GH_TOKEN',\n 'GITHUB_TOKEN',\n]);\n\nexport class GithubNugetRegistryInfo extends NugetRegistryInfo {\n static readonly NUGET_PKG_GITHUB_COM = 'https://nuget.pkg.github.com';\n\n // GithubNugetRegistryInfo.CtorArgs(...) behaves differently than NugetRegistryInfo.CtorArgs(...)\n /**\n * Creates an instance of GithubNugetRegistryInfo.\n * @param opts The input type of {@link GHNRIOpts.from}\n */\n constructor(opts: typeof GHNRIOpts.inferIn) {\n super(GHNRIOpts.from(opts));\n }\n\n /**\n * Returns `https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json`\n * or (if GITHUB_REPOSITORY_OWNER is not defined in {@link process.env} nor\n * {@link process.cwd() $CWD}/.env) `undefined`.\n * @returns If GITHUB_REPOSITORY_OWNER is defined, returns the GitHub Package Repository URL endpoint for NuGet pushes (--source).\\\n * Otherwise, returns `undefined`\n */\n static getNugetGitHubUrl(): string | undefined {\n const owner = getEnvVarValue('GITHUB_REPOSITORY_OWNER');\n return owner === undefined\n ? undefined\n : `${NUGET_PKG_GITHUB_COM}/${owner}/index.json`;\n }\n}\nconst GHNRI = GithubNugetRegistryInfo;\n\n/**\n * The default value of {@link GHNRIOpts.t.source `source`} is dependent on\n * {@link GHNRI.getNugetGitHubUrl} and will default to an empty string if the\n * environment variable `GITHUB_REPOSITORY_OWNER` is undefined!\n */\nexport const GHNRIOpts: Type<{\n project: MSBuildProject | {\n readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;\n readonly Properties: Readonly<NugetProjectProperties>;\n readonly Targets: readonly string[];\n readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];\n };\n source: Default<string, string>;\n tokenEnvVars: Default<readonly string[], readonly ['GH_TOKEN', 'GITHUB_TOKEN']>;\n}> = NRIOptsBase.merge({\n /** @see {@link GHNRI.getNugetGitHubUrl } */\n source: NRIOptsBase.get('source')\n .default(() => GHNRI.getNugetGitHubUrl() ?? ''),\n tokenEnvVars: NRIOptsBase.get('tokenEnvVars')\n .default(\n /* must be a function. A fixed-length array is NOT a primitive type! */\n (): typeof DefaultGithubTokenEnvVars => DefaultGithubTokenEnvVars,\n ),\n});\n"],"mappings":";;;AAUA,MAAM,uBAAuB;AAC7B,MAAa,4BAAmE,OAAO,OAAO,CAC5F,YACA,eACD,CAAC;AAEF,IAAa,0BAAb,cAA6C,kBAAkB;CAC7D,OAAgB,uBAAuB;;;;;CAOvC,YAAY,MAAgC;
|
|
1
|
+
{"version":3,"file":"GithubNugetRegistryInfo.mjs","names":[],"sources":["../../src/dotnet/GithubNugetRegistryInfo.ts"],"sourcesContent":["import type { Type } from 'arktype';\nimport { getEnvVarValue } from '../utils/env.ts';\nimport type { MSBuildProject, MSBuildEvaluationOutput } from './MSBuildProject.ts';\nimport type { NugetProjectProperties } from './NugetProjectProperties.ts';\nimport {\n NugetRegistryInfo,\n NRIOptsBase,\n} from './NugetRegistryInfo.ts';\nimport type { Default } from 'arktype/internal/attributes.ts';\n\nconst NUGET_PKG_GITHUB_COM = 'https://nuget.pkg.github.com';\nexport const DefaultGithubTokenEnvVars: readonly ['GH_TOKEN', 'GITHUB_TOKEN'] = Object.freeze([\n 'GH_TOKEN',\n 'GITHUB_TOKEN',\n]);\n\nexport class GithubNugetRegistryInfo extends NugetRegistryInfo {\n static readonly NUGET_PKG_GITHUB_COM = 'https://nuget.pkg.github.com';\n\n // GithubNugetRegistryInfo.CtorArgs(...) behaves differently than NugetRegistryInfo.CtorArgs(...)\n /**\n * Creates an instance of GithubNugetRegistryInfo.\n * @param opts The input type of {@link GHNRIOpts.from}\n */\n constructor(opts: typeof GHNRIOpts.inferIn) {\n super(GHNRIOpts.from(opts));\n }\n\n /**\n * Returns `https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json`\n * or (if GITHUB_REPOSITORY_OWNER is not defined in {@link process.env} nor\n * {@link process.cwd() $CWD}/.env) `undefined`.\n * @returns If GITHUB_REPOSITORY_OWNER is defined, returns the GitHub Package Repository URL endpoint for NuGet pushes (--source).\\\n * Otherwise, returns `undefined`\n */\n static getNugetGitHubUrl(): string | undefined {\n const owner = getEnvVarValue('GITHUB_REPOSITORY_OWNER');\n return owner === undefined\n ? undefined\n : `${NUGET_PKG_GITHUB_COM}/${owner}/index.json`;\n }\n}\nconst GHNRI = GithubNugetRegistryInfo;\n\n/**\n * The default value of {@link GHNRIOpts.t.source `source`} is dependent on\n * {@link GHNRI.getNugetGitHubUrl} and will default to an empty string if the\n * environment variable `GITHUB_REPOSITORY_OWNER` is undefined!\n */\nexport const GHNRIOpts: Type<{\n project: MSBuildProject | {\n readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;\n readonly Properties: Readonly<NugetProjectProperties>;\n readonly Targets: readonly string[];\n readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];\n };\n source: Default<string, string>;\n tokenEnvVars: Default<readonly string[], readonly ['GH_TOKEN', 'GITHUB_TOKEN']>;\n}> = NRIOptsBase.merge({\n /** @see {@link GHNRI.getNugetGitHubUrl } */\n source: NRIOptsBase.get('source')\n .default(() => GHNRI.getNugetGitHubUrl() ?? ''),\n tokenEnvVars: NRIOptsBase.get('tokenEnvVars')\n .default(\n /* must be a function. A fixed-length array is NOT a primitive type! */\n (): typeof DefaultGithubTokenEnvVars => DefaultGithubTokenEnvVars,\n ),\n});\n"],"mappings":";;;AAUA,MAAM,uBAAuB;AAC7B,MAAa,4BAAmE,OAAO,OAAO,CAC5F,YACA,eACD,CAAC;AAEF,IAAa,0BAAb,cAA6C,kBAAkB;CAC7D,OAAgB,uBAAuB;;;;;CAOvC,YAAY,MAAgC;EAC1C,MAAM,UAAU,KAAK,KAAK,CAAC;;;;;;;;;CAU7B,OAAO,oBAAwC;EAC7C,MAAM,QAAQ,eAAe,0BAA0B;EACvD,OAAO,UAAU,KAAA,IACb,KAAA,IACA,GAAG,qBAAqB,GAAG,MAAM;;;AAGzC,MAAM,QAAQ;;;;;;AAOd,MAAa,YASR,YAAY,MAAM;;CAErB,QAAQ,YAAY,IAAI,SAAS,CAC9B,cAAc,MAAM,mBAAmB,IAAI,GAAG;CACjD,cAAc,YAAY,IAAI,eAAe,CAC1C,cAEyC,0BACzC;CACJ,CAAC"}
|
|
@@ -68,6 +68,12 @@ const GLNRI = GitlabNugetRegistryInfo;
|
|
|
68
68
|
*/
|
|
69
69
|
const GLNRIOpts = NRIOpts.merge({
|
|
70
70
|
tokenEnvVars: NRIOptsBase.get("tokenEnvVars").default(() => GLNRI.DefaultGitlabTokenEnvVars),
|
|
71
|
+
/**
|
|
72
|
+
* The GitLab Nuget API URL to push packages to -OR- a keyword such as "group"
|
|
73
|
+
* or "project" used to determine URL.
|
|
74
|
+
* @default GLNRI.projectUrl
|
|
75
|
+
* @see {@link GLNRI.projectUrl}, {@link GLNRI.groupUrl}
|
|
76
|
+
*/
|
|
71
77
|
source: NRIOptsBase.get("source").or("\"group\" | \"project\" | Error").pipe((source) => {
|
|
72
78
|
switch (source) {
|
|
73
79
|
case "group": return GLNRI.groupUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitlabNugetRegistryInfo.mjs","names":[],"sources":["../../src/dotnet/GitlabNugetRegistryInfo.ts"],"sourcesContent":["import { getEnvVarValue } from '../utils/env.ts';\nimport { isError } from '../utils/isError.ts';\nimport {\n NugetRegistryInfo,\n NRIOpts,\n NRIOptsBase,\n} from './NugetRegistryInfo.ts';\nimport type { Out, Type } from 'arktype';\nimport type { Default } from 'arktype/internal/attributes.ts';\nimport type { MSBuildProject, MSBuildEvaluationOutput } from './MSBuildProject.ts';\nimport type { NugetProjectProperties } from './NugetProjectProperties.ts';\n\n// https://docs.gitlab.com/ee/user/packages/nuget_repository/\nexport class GitlabNugetRegistryInfo extends NugetRegistryInfo {\n /**\n * The GitLab API v4 root URL.\n * @returns The value of the environment variable `CI_API_V4_URL`.\n * If that's `undefined`, 'https://gitlab.com/api/v4' is returned, instead.\n */\n static get CI_API_V4_URL(): string {\n return getEnvVarValue('CI_API_V4_URL') ?? 'https://gitlab.com/api/v4';\n }\n\n /**\n * CI_PROJECT_ID - If you want to publish to your GitLab server, this needs to be set to the Id of the project you want to publish to. When running in GitLab CI this is already set to the project the pipeline runs in by GitLab.\n * This method checks the contents of your `.env` file, if present.\n * @returns The value of the environment variable `CI_PROJECT_ID` or `undefined`.\n * @todo add URI encoded project pathname as alternative e.g. 'halospv3%2FHCE.Shared' in 'https://gitlab.com/api/v4/projects/halospv3%2FHCE.Shared'\n */\n static get projectId(): string | undefined {\n return getEnvVarValue('CI_PROJECT_ID');\n }\n\n /**\n * CI_PROJECT_NAMESPACE_ID\n * This method checks the contents of your `.env` file, if present.\n * @returns The value of the environment variable 'CI_PROJECT_NAMESPACE_ID' or `undefined`.\n */\n static get ownerId(): string | undefined {\n return getEnvVarValue('CI_PROJECT_NAMESPACE_ID');\n }\n\n static readonly DefaultGitlabTokenEnvVars: readonly ['GL_TOKEN', 'GITLAB_TOKEN', 'CI_JOB_TOKEN'] = Object.freeze([\n 'GL_TOKEN',\n 'GITLAB_TOKEN',\n 'CI_JOB_TOKEN',\n ] as const);\n\n /**\n * Creates an instance of GitlabNugetRegistryInfo.\n * @param opts The input type of {@link GLNRIOpts.from}\n */\n constructor(opts: typeof GLNRIOpts.inferIn) {\n const optsOut = GLNRIOpts.from(opts);\n if (isError(optsOut.source))\n throw optsOut.source;\n super(optsOut as typeof optsOut & { source: string });\n }\n\n /**\n * Get the GitLab Nuget API for your project url as seen in https://docs.gitlab.com/ee/user/packages/nuget_repository/index.html#publish-a-nuget-package-by-using-cicd\n * ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json\n * @returns If {@link this.projectId} is a string, a string formatted like\n * `${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json`.\n * Else, {@link Error}.\n */\n static get projectUrl(): string | Error {\n return this.projectId\n ? `${this.CI_API_V4_URL}/projects/${this.projectId}/packages/nuget/index.json`\n : new Error('The project-type URL was specified, but one or more of the required environment variables (CI_API_V4_URL, CI_PROJECT_ID) were undefined.');\n }\n\n /**\n * ${CI_API_V4_URL}/groups/${CI_PROJECT_NAMESPACE_ID}/-/packages/nuget/index.json\n * @returns If {@link ownerId} is a string, then a string formatted like\n * `${CI_API_V4_URL}/groups/${CI_PROJECT_NAMESPACE_ID}/-/packages/nuget/index.json`.\n * Else, {@link Error}.\n */\n static get groupUrl(): string | Error {\n return this.ownerId\n ? `${this.CI_API_V4_URL}/groups/${this.ownerId}/-/packages/nuget/index.json`\n : new Error('env.CI_PROJECT_NAMESPACE_ID must be defined to use its GitLab API endpoint!');\n }\n}\nconst GLNRI = GitlabNugetRegistryInfo;\n\n/**\n * The Arktype definition for {@link GitlabNugetRegistryInfo}'s constructor parameter. Construct an object of this type by calling {@link GLNRIOpts.from}\n */\nexport const GLNRIOpts: Type<{\n project: MSBuildProject | {\n readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;\n readonly Properties: Readonly<NugetProjectProperties>;\n readonly Targets: readonly string[];\n readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];\n };\n tokenEnvVars: Default<readonly string[], readonly ['GL_TOKEN', 'GITLAB_TOKEN', 'CI_JOB_TOKEN']>;\n source: (In: Default<string | Error, string | Error>) => Out<string | Error>;\n}> = NRIOpts.merge({\n tokenEnvVars: NRIOptsBase.get('tokenEnvVars').default(\n () => GLNRI.DefaultGitlabTokenEnvVars,\n ),\n /**\n * The GitLab Nuget API URL to push packages to -OR- a keyword such as \"group\"\n * or \"project\" used to determine URL.\n * @default GLNRI.projectUrl\n * @see {@link GLNRI.projectUrl}, {@link GLNRI.groupUrl}\n */\n // todo: change '\"group\" | \"project\"' to '\"GITLAB:PROJECT\" | \"GITLAB:GROUP\"'\n source: NRIOptsBase.get('source')\n .or('\"group\" | \"project\" | Error')\n .pipe((source: string | Error): string | Error => {\n switch (source) {\n case 'group': {\n return GLNRI.groupUrl;\n }\n case 'project': {\n return GLNRI.projectUrl;\n }\n default: {\n return source;\n }\n }\n }).default(() => GLNRI.projectUrl),\n});\n"],"mappings":";;;;AAaA,IAAa,0BAAb,cAA6C,kBAAkB;;;;;;CAM7D,WAAW,gBAAwB;
|
|
1
|
+
{"version":3,"file":"GitlabNugetRegistryInfo.mjs","names":[],"sources":["../../src/dotnet/GitlabNugetRegistryInfo.ts"],"sourcesContent":["import { getEnvVarValue } from '../utils/env.ts';\nimport { isError } from '../utils/isError.ts';\nimport {\n NugetRegistryInfo,\n NRIOpts,\n NRIOptsBase,\n} from './NugetRegistryInfo.ts';\nimport type { Out, Type } from 'arktype';\nimport type { Default } from 'arktype/internal/attributes.ts';\nimport type { MSBuildProject, MSBuildEvaluationOutput } from './MSBuildProject.ts';\nimport type { NugetProjectProperties } from './NugetProjectProperties.ts';\n\n// https://docs.gitlab.com/ee/user/packages/nuget_repository/\nexport class GitlabNugetRegistryInfo extends NugetRegistryInfo {\n /**\n * The GitLab API v4 root URL.\n * @returns The value of the environment variable `CI_API_V4_URL`.\n * If that's `undefined`, 'https://gitlab.com/api/v4' is returned, instead.\n */\n static get CI_API_V4_URL(): string {\n return getEnvVarValue('CI_API_V4_URL') ?? 'https://gitlab.com/api/v4';\n }\n\n /**\n * CI_PROJECT_ID - If you want to publish to your GitLab server, this needs to be set to the Id of the project you want to publish to. When running in GitLab CI this is already set to the project the pipeline runs in by GitLab.\n * This method checks the contents of your `.env` file, if present.\n * @returns The value of the environment variable `CI_PROJECT_ID` or `undefined`.\n * @todo add URI encoded project pathname as alternative e.g. 'halospv3%2FHCE.Shared' in 'https://gitlab.com/api/v4/projects/halospv3%2FHCE.Shared'\n */\n static get projectId(): string | undefined {\n return getEnvVarValue('CI_PROJECT_ID');\n }\n\n /**\n * CI_PROJECT_NAMESPACE_ID\n * This method checks the contents of your `.env` file, if present.\n * @returns The value of the environment variable 'CI_PROJECT_NAMESPACE_ID' or `undefined`.\n */\n static get ownerId(): string | undefined {\n return getEnvVarValue('CI_PROJECT_NAMESPACE_ID');\n }\n\n static readonly DefaultGitlabTokenEnvVars: readonly ['GL_TOKEN', 'GITLAB_TOKEN', 'CI_JOB_TOKEN'] = Object.freeze([\n 'GL_TOKEN',\n 'GITLAB_TOKEN',\n 'CI_JOB_TOKEN',\n ] as const);\n\n /**\n * Creates an instance of GitlabNugetRegistryInfo.\n * @param opts The input type of {@link GLNRIOpts.from}\n */\n constructor(opts: typeof GLNRIOpts.inferIn) {\n const optsOut = GLNRIOpts.from(opts);\n if (isError(optsOut.source))\n throw optsOut.source;\n super(optsOut as typeof optsOut & { source: string });\n }\n\n /**\n * Get the GitLab Nuget API for your project url as seen in https://docs.gitlab.com/ee/user/packages/nuget_repository/index.html#publish-a-nuget-package-by-using-cicd\n * ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json\n * @returns If {@link this.projectId} is a string, a string formatted like\n * `${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json`.\n * Else, {@link Error}.\n */\n static get projectUrl(): string | Error {\n return this.projectId\n ? `${this.CI_API_V4_URL}/projects/${this.projectId}/packages/nuget/index.json`\n : new Error('The project-type URL was specified, but one or more of the required environment variables (CI_API_V4_URL, CI_PROJECT_ID) were undefined.');\n }\n\n /**\n * ${CI_API_V4_URL}/groups/${CI_PROJECT_NAMESPACE_ID}/-/packages/nuget/index.json\n * @returns If {@link ownerId} is a string, then a string formatted like\n * `${CI_API_V4_URL}/groups/${CI_PROJECT_NAMESPACE_ID}/-/packages/nuget/index.json`.\n * Else, {@link Error}.\n */\n static get groupUrl(): string | Error {\n return this.ownerId\n ? `${this.CI_API_V4_URL}/groups/${this.ownerId}/-/packages/nuget/index.json`\n : new Error('env.CI_PROJECT_NAMESPACE_ID must be defined to use its GitLab API endpoint!');\n }\n}\nconst GLNRI = GitlabNugetRegistryInfo;\n\n/**\n * The Arktype definition for {@link GitlabNugetRegistryInfo}'s constructor parameter. Construct an object of this type by calling {@link GLNRIOpts.from}\n */\nexport const GLNRIOpts: Type<{\n project: MSBuildProject | {\n readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;\n readonly Properties: Readonly<NugetProjectProperties>;\n readonly Targets: readonly string[];\n readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];\n };\n tokenEnvVars: Default<readonly string[], readonly ['GL_TOKEN', 'GITLAB_TOKEN', 'CI_JOB_TOKEN']>;\n source: (In: Default<string | Error, string | Error>) => Out<string | Error>;\n}> = NRIOpts.merge({\n tokenEnvVars: NRIOptsBase.get('tokenEnvVars').default(\n () => GLNRI.DefaultGitlabTokenEnvVars,\n ),\n /**\n * The GitLab Nuget API URL to push packages to -OR- a keyword such as \"group\"\n * or \"project\" used to determine URL.\n * @default GLNRI.projectUrl\n * @see {@link GLNRI.projectUrl}, {@link GLNRI.groupUrl}\n */\n // todo: change '\"group\" | \"project\"' to '\"GITLAB:PROJECT\" | \"GITLAB:GROUP\"'\n source: NRIOptsBase.get('source')\n .or('\"group\" | \"project\" | Error')\n .pipe((source: string | Error): string | Error => {\n switch (source) {\n case 'group': {\n return GLNRI.groupUrl;\n }\n case 'project': {\n return GLNRI.projectUrl;\n }\n default: {\n return source;\n }\n }\n }).default(() => GLNRI.projectUrl),\n});\n"],"mappings":";;;;AAaA,IAAa,0BAAb,cAA6C,kBAAkB;;;;;;CAM7D,WAAW,gBAAwB;EACjC,OAAO,eAAe,gBAAgB,IAAI;;;;;;;;CAS5C,WAAW,YAAgC;EACzC,OAAO,eAAe,gBAAgB;;;;;;;CAQxC,WAAW,UAA8B;EACvC,OAAO,eAAe,0BAA0B;;CAGlD,OAAgB,4BAAmF,OAAO,OAAO;EAC/G;EACA;EACA;EACD,CAAU;;;;;CAMX,YAAY,MAAgC;EAC1C,MAAM,UAAU,UAAU,KAAK,KAAK;EACpC,IAAI,QAAQ,QAAQ,OAAO,EACzB,MAAM,QAAQ;EAChB,MAAM,QAA+C;;;;;;;;;CAUvD,WAAW,aAA6B;EACtC,OAAO,KAAK,YACR,GAAG,KAAK,cAAc,YAAY,KAAK,UAAU,8CACjD,IAAI,MAAM,2IAA2I;;;;;;;;CAS3J,WAAW,WAA2B;EACpC,OAAO,KAAK,UACR,GAAG,KAAK,cAAc,UAAU,KAAK,QAAQ,gDAC7C,IAAI,MAAM,8EAA8E;;;AAGhG,MAAM,QAAQ;;;;AAKd,MAAa,YASR,QAAQ,MAAM;CACjB,cAAc,YAAY,IAAI,eAAe,CAAC,cACtC,MAAM,0BACb;;;;;;;CAQD,QAAQ,YAAY,IAAI,SAAS,CAC9B,GAAG,kCAA8B,CACjC,MAAM,WAA2C;EAChD,QAAQ,QAAR;GACE,KAAK,SACH,OAAO,MAAM;GAEf,KAAK,WACH,OAAO,MAAM;GAEf,SACE,OAAO;;GAGX,CAAC,cAAc,MAAM,WAAW;CACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsNextVersionAlreadyPublished.cli.mjs","names":[],"sources":["../../src/dotnet/IsNextVersionAlreadyPublished.cli.ts"],"sourcesContent":["import * as console from 'node:console';\nimport { NugetRegistryInfo, getGithubOutput } from './NugetRegistryInfo.ts';\nimport esMain from 'es-main';\n\n/**\n * @returns if successful\n * @throws {Error} if...\n * - {@link process.argv} does not include...\n * - `--packageId [string]`\n * - `--source [string]`\n * - Value of `await getGithubOutput())['new-release-version']`...\n * - is not a valid Version\n * - already exists at `source`\n */\nasync function main(): Promise<0> {\n const args = process.argv.slice(2);\n // Parse command-line arguments - https://stackoverflow.com/a/76298476/14894786\n const options: {\n packageId: string | undefined;\n source: string | undefined;\n } & Record<string, string | undefined> = { packageId: undefined, source: undefined };\n for (let i = 0; i < args.length; i += 2) {\n const argName = args[i];\n const argValue = args[i + 1];\n if (argValue !== undefined && argName?.startsWith('--') === true) {\n options[argName.slice(2)] = argValue;\n }\n }\n\n if (typeof options.packageId !== 'string')\n throw new Error('packageId must be a string');\n if (typeof options.source !== 'string')\n throw new Error('source must be a string');\n\n const packageId = options.packageId,\n source = options.source,\n versionPattern = new RegExp(/\\d+\\.\\d+\\.\\d+([-+].+)?/);\n const ghOutput = await getGithubOutput() ?? {};\n const matches = versionPattern.exec(ghOutput['new-release-version'] ?? '');\n if (matches === null || matches.length === 0)\n throw new Error(\n 'The variable new-release-version is not present in the GITHUB_OUTPUT env file or its value contains invalid characters.',\n );\n\n const nextVersion = matches[0];\n const isPublished = await NugetRegistryInfo.IsNextVersionAlreadyPublished(\n source,\n packageId,\n nextVersion,\n );\n\n if (typeof isPublished !== 'boolean')\n throw new Error('isPublished is not a boolean');\n if (isPublished)\n throw new Error(`${packageId}@${nextVersion} already exists at ${source}.`);\n console.log(`OK: ${packageId}@${nextVersion} does NOT yet exist at ${source}. Yay.`);\n\n return 0;\n}\n\nif (esMain(import.meta))\n await main();\n"],"mappings":";;;;;;;;;;;;;;AAcA,eAAe,OAAmB;CAChC,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAElC,MAAM,UAGmC;EAAE,WAAW,KAAA;EAAW,QAAQ,KAAA;EAAW;
|
|
1
|
+
{"version":3,"file":"IsNextVersionAlreadyPublished.cli.mjs","names":[],"sources":["../../src/dotnet/IsNextVersionAlreadyPublished.cli.ts"],"sourcesContent":["import * as console from 'node:console';\nimport { NugetRegistryInfo, getGithubOutput } from './NugetRegistryInfo.ts';\nimport esMain from 'es-main';\n\n/**\n * @returns if successful\n * @throws {Error} if...\n * - {@link process.argv} does not include...\n * - `--packageId [string]`\n * - `--source [string]`\n * - Value of `await getGithubOutput())['new-release-version']`...\n * - is not a valid Version\n * - already exists at `source`\n */\nasync function main(): Promise<0> {\n const args = process.argv.slice(2);\n // Parse command-line arguments - https://stackoverflow.com/a/76298476/14894786\n const options: {\n packageId: string | undefined;\n source: string | undefined;\n } & Record<string, string | undefined> = { packageId: undefined, source: undefined };\n for (let i = 0; i < args.length; i += 2) {\n const argName = args[i];\n const argValue = args[i + 1];\n if (argValue !== undefined && argName?.startsWith('--') === true) {\n options[argName.slice(2)] = argValue;\n }\n }\n\n if (typeof options.packageId !== 'string')\n throw new Error('packageId must be a string');\n if (typeof options.source !== 'string')\n throw new Error('source must be a string');\n\n const packageId = options.packageId,\n source = options.source,\n versionPattern = new RegExp(/\\d+\\.\\d+\\.\\d+([-+].+)?/);\n const ghOutput = await getGithubOutput() ?? {};\n const matches = versionPattern.exec(ghOutput['new-release-version'] ?? '');\n if (matches === null || matches.length === 0)\n throw new Error(\n 'The variable new-release-version is not present in the GITHUB_OUTPUT env file or its value contains invalid characters.',\n );\n\n const nextVersion = matches[0];\n const isPublished = await NugetRegistryInfo.IsNextVersionAlreadyPublished(\n source,\n packageId,\n nextVersion,\n );\n\n if (typeof isPublished !== 'boolean')\n throw new Error('isPublished is not a boolean');\n if (isPublished)\n throw new Error(`${packageId}@${nextVersion} already exists at ${source}.`);\n console.log(`OK: ${packageId}@${nextVersion} does NOT yet exist at ${source}. Yay.`);\n\n return 0;\n}\n\nif (esMain(import.meta))\n await main();\n"],"mappings":";;;;;;;;;;;;;;AAcA,eAAe,OAAmB;CAChC,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAElC,MAAM,UAGmC;EAAE,WAAW,KAAA;EAAW,QAAQ,KAAA;EAAW;CACpF,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;EACvC,MAAM,UAAU,KAAK;EACrB,MAAM,WAAW,KAAK,IAAI;EAC1B,IAAI,aAAa,KAAA,KAAa,SAAS,WAAW,KAAK,KAAK,MAC1D,QAAQ,QAAQ,MAAM,EAAE,IAAI;;CAIhC,IAAI,OAAO,QAAQ,cAAc,UAC/B,MAAM,IAAI,MAAM,6BAA6B;CAC/C,IAAI,OAAO,QAAQ,WAAW,UAC5B,MAAM,IAAI,MAAM,0BAA0B;CAE5C,MAAM,YAAY,QAAQ,WACxB,SAAS,QAAQ,QACjB,iCAAiB,IAAI,OAAO,yBAAyB;CACvD,MAAM,WAAW,MAAM,iBAAiB,IAAI,EAAE;CAC9C,MAAM,UAAU,eAAe,KAAK,SAAS,0BAA0B,GAAG;CAC1E,IAAI,YAAY,QAAQ,QAAQ,WAAW,GACzC,MAAM,IAAI,MACR,0HACD;CAEH,MAAM,cAAc,QAAQ;CAC5B,MAAM,cAAc,MAAM,kBAAkB,8BAC1C,QACA,WACA,YACD;CAED,IAAI,OAAO,gBAAgB,WACzB,MAAM,IAAI,MAAM,+BAA+B;CACjD,IAAI,aACF,MAAM,IAAI,MAAM,GAAG,UAAU,GAAG,YAAY,qBAAqB,OAAO,GAAG;CAC7E,QAAQ,IAAI,OAAO,UAAU,GAAG,YAAY,yBAAyB,OAAO,QAAQ;CAEpF,OAAO;;AAGT,IAAI,OAAO,OAAO,KAAK,EACrB,MAAM,MAAM"}
|
|
@@ -15,27 +15,46 @@ import { setTimeout } from "node:timers/promises";
|
|
|
15
15
|
*/
|
|
16
16
|
const interface_ItemMetadataBuiltIn = type({
|
|
17
17
|
"[string]": "string",
|
|
18
|
+
/** @example "c:\\source\\repos\\ConsoleApp1\\ConsoleApp1\\bin\\Debug\\net6.0\\ConsoleApp1.dll" */
|
|
18
19
|
Identity: "string",
|
|
20
|
+
/** @example "Designer" */
|
|
19
21
|
"SubType?": "string",
|
|
22
|
+
/** @example ".NETCoreApp" */
|
|
20
23
|
"TargetFrameworkIdentifier?": "string",
|
|
21
24
|
"TargetPlatformMoniker?": "string",
|
|
25
|
+
/** @example "c:\\source\\repos\\ConsoleApp1\\ConsoleApp1\\obj\\Debug\\net6.0\\ConsoleApp1.csproj.CopyComplete" */
|
|
22
26
|
"CopyUpToDateMarker?": "string",
|
|
23
27
|
"TargetPlatformIdentifier?": "string",
|
|
28
|
+
/** @example "6.0" */
|
|
24
29
|
"TargetFrameworkVersion?": "string",
|
|
30
|
+
/** @example "c:\\source\\repos\\ConsoleApp1\\ConsoleApp1\\obj\\Debug\\net6.0\\ref\\ConsoleApp1.dll" */
|
|
25
31
|
"ReferenceAssembly?": "string",
|
|
32
|
+
/** @example "c:\\source\\repos\\ConsoleApp1\\ConsoleApp1\\bin\\Debug\\net6.0\\ConsoleApp1.dll" */
|
|
26
33
|
FullPath: "string",
|
|
34
|
+
/** @example "c:\\" */
|
|
27
35
|
RootDir: "string",
|
|
36
|
+
/** @example "ConsoleApp1" */
|
|
28
37
|
Filename: "string",
|
|
38
|
+
/** @example ".dll" */
|
|
29
39
|
Extension: "string",
|
|
40
|
+
/** @example "c:\\source\\repos\\ConsoleApp1\\ConsoleApp1\\bin\\Debug\\net6.0\\" */
|
|
30
41
|
RelativeDir: "string",
|
|
42
|
+
/** @example "source\\repos\\ConsoleApp1\\ConsoleApp1\\bin\\Debug\\net6.0\\" */
|
|
31
43
|
Directory: "string",
|
|
32
44
|
RecursiveDir: "string",
|
|
45
|
+
/** @example "2023-11-30 13:38:06.5084339" */
|
|
33
46
|
ModifiedTime: "string",
|
|
47
|
+
/** @example "2023-11-30 13:38:06.9308716" */
|
|
34
48
|
CreatedTime: "string",
|
|
49
|
+
/** @example "2023-11-30 13:38:06.9318732" */
|
|
35
50
|
AccessedTime: "string",
|
|
51
|
+
/** @example "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets" */
|
|
36
52
|
DefiningProjectFullPath: "string",
|
|
53
|
+
/** @example "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\MSBuild\\Current\\Bin\\amd64\\" */
|
|
37
54
|
DefiningProjectDirectory: "string",
|
|
55
|
+
/** @example "Microsoft.Common.CurrentVersion" */
|
|
38
56
|
DefiningProjectName: "string",
|
|
57
|
+
/** @example ".targets" */
|
|
39
58
|
DefiningProjectExtension: "string"
|
|
40
59
|
});
|
|
41
60
|
const targetSuccess = type({
|
|
@@ -82,9 +101,44 @@ var MSBuildEvaluationOutput = class {
|
|
|
82
101
|
TargetResults;
|
|
83
102
|
};
|
|
84
103
|
const EvaluationOptions = Object.freeze(type({
|
|
104
|
+
/**
|
|
105
|
+
* The project file's full path.
|
|
106
|
+
*/
|
|
85
107
|
FullName: "string",
|
|
108
|
+
/**
|
|
109
|
+
* User-defined Properties and their values.
|
|
110
|
+
* { Configuration: "Release" } will cause the MSBuild to first set the
|
|
111
|
+
* Configuration property to Release before evaluating the project
|
|
112
|
+
* or the project's Target(s).
|
|
113
|
+
* ```txt
|
|
114
|
+
* -property:<n>=<v> Set or override these project-level properties. <n> is
|
|
115
|
+
* the property name, and <v> is the property value. Use a
|
|
116
|
+
* semicolon or a comma to separate multiple properties, or
|
|
117
|
+
* specify each property separately. (Short form: -p)
|
|
118
|
+
* Example:
|
|
119
|
+
* -property:WarningLevel=2;OutDir=bin\Debug\
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
86
122
|
Property: type({ "[string]": "string" }).as().partial(),
|
|
123
|
+
/**
|
|
124
|
+
* The MSBuild Targets to run for evaluation. ["Pack"] is recommended.
|
|
125
|
+
* Property values may be changed by Targets such as those provided by
|
|
126
|
+
* dependencies.
|
|
127
|
+
*
|
|
128
|
+
* ```txt
|
|
129
|
+
* -target:<targets> Build these targets in this project. Use a semicolon or a
|
|
130
|
+
* comma to separate multiple targets, or specify each
|
|
131
|
+
* target separately. (Short form: -t)
|
|
132
|
+
* Example:
|
|
133
|
+
* -target:Resources;Compile
|
|
134
|
+
* ```
|
|
135
|
+
* @default []
|
|
136
|
+
*/
|
|
87
137
|
Targets: type.string.array().readonly().or("string[]"),
|
|
138
|
+
/**
|
|
139
|
+
* MSBuild Items to evaluate. `["Compile"]` will result in the MSBuild output
|
|
140
|
+
* including {@link MSBuild}
|
|
141
|
+
*/
|
|
88
142
|
GetItem: type.string.array().readonly().or("string[]"),
|
|
89
143
|
GetProperty: type.string.array().readonly().or("string[]"),
|
|
90
144
|
GetTargetResult: type.string.array().readonly().or("string[]")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MSBuildProject.mjs","names":[],"sources":["../../src/dotnet/MSBuildProject.ts"],"sourcesContent":["import { type, type Scope, type Type } from 'arktype';\nimport { warn } from 'node:console';\nimport { type Dirent } from 'node:fs';\nimport { readdir, realpath, stat } from 'node:fs/promises';\n// eslint-disable-next-line unicorn/import-style\nimport * as path from 'node:path';\nimport { setTimeout } from 'node:timers/promises';\nimport { CaseInsensitiveMap } from '../CaseInsensitiveMap.ts';\nimport { execAsync } from '../utils/execAsync.ts';\nimport { isError } from '../utils/isError.ts';\nimport { MSBuildProjectProperties } from './MSBuildProjectProperties.ts';\nimport {\n NPPGetterNames,\n NugetProjectProperties,\n} from './NugetProjectProperties.ts';\n\n/**\n * See [MSBuild well-known item metadata](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-well-known-item-metadata).\n * Additional string-type properties may be present (e.g. `{ SubType: \"designer\" }`).\n */\nconst interface_ItemMetadataBuiltIn = type({\n '[string]': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\ConsoleApp1.dll\" */\n Identity: 'string',\n /** @example \"Designer\" */\n 'SubType?': 'string',\n /** @example \".NETCoreApp\" */\n 'TargetFrameworkIdentifier?': 'string',\n 'TargetPlatformMoniker?': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\obj\\\\Debug\\\\net6.0\\\\ConsoleApp1.csproj.CopyComplete\" */\n 'CopyUpToDateMarker?': 'string',\n 'TargetPlatformIdentifier?': 'string',\n /** @example \"6.0\" */\n 'TargetFrameworkVersion?': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\obj\\\\Debug\\\\net6.0\\\\ref\\\\ConsoleApp1.dll\" */\n 'ReferenceAssembly?': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\ConsoleApp1.dll\" */\n FullPath: 'string',\n /** @example \"c:\\\\\" */\n RootDir: 'string',\n /** @example \"ConsoleApp1\" */\n Filename: 'string',\n /** @example \".dll\" */\n Extension: 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\\" */\n RelativeDir: 'string',\n /** @example \"source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\\" */\n Directory: 'string',\n RecursiveDir: 'string',\n /** @example \"2023-11-30 13:38:06.5084339\" */\n ModifiedTime: 'string',\n /** @example \"2023-11-30 13:38:06.9308716\" */\n CreatedTime: 'string',\n /** @example \"2023-11-30 13:38:06.9318732\" */\n AccessedTime: 'string',\n /** @example \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Preview\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\Microsoft.Common.CurrentVersion.targets\" */\n DefiningProjectFullPath: 'string',\n /** @example \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Preview\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\\" */\n DefiningProjectDirectory: 'string',\n /** @example \"Microsoft.Common.CurrentVersion\" */\n DefiningProjectName: 'string',\n /** @example \".targets\" */\n DefiningProjectExtension: 'string',\n});\n\nconst targetSuccess = type({\n Result: '\\'Success\\'',\n Items: interface_ItemMetadataBuiltIn.array(),\n});\n\nconst targetFailure = type({\n Result: '\\'Failure\\'',\n Items: 'never[]',\n});\n\nconst msbuildEvaluationOutput: Type<{\n Properties?: Record<string, string> | undefined;\n Items?: Record<string, {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[]> | undefined;\n TargetResults?: Record<string, {\n Result: 'Success';\n Items: {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string | undefined;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[];\n } | {\n Result: 'Failure';\n Items: never[];\n }> | undefined;\n}> = type({\n 'Properties?': type({ '[string]': 'string' }),\n 'Items?': type({ '[string]': interface_ItemMetadataBuiltIn.array() }),\n 'TargetResults?': type({ '[string]': targetSuccess.or(targetFailure) }),\n});\n\nexport class MSBuildEvaluationOutput {\n /**\n * @param rawMSBuildEvaluation The output of a CLI MSBuild project evaluation.\n * May be the UTF-8 string-encoded JSON or the object decoded from that JSON.\n */\n constructor(rawMSBuildEvaluation: Parameters<typeof JSON.parse>[0] | Parameters<typeof msbuildEvaluationOutput.from>[0]) {\n /** `.assert` instead of `.from` to allow `unknown` JSON.parse return type */\n const knownObject = msbuildEvaluationOutput.assert(typeof rawMSBuildEvaluation === 'string' ? JSON.parse(rawMSBuildEvaluation) : rawMSBuildEvaluation);\n\n this.Properties = knownObject.Properties;\n this.Items = knownObject.Items;\n this.TargetResults = knownObject.TargetResults;\n }\n\n /**\n * The specified properties and their values as evaluated by MSBuild Core.\n * `-getProperty:{propertyName,...}`\n */\n Properties?: typeof msbuildEvaluationOutput.infer.Properties;\n /**\n * The specified items and their values and associated metadata as evaluated\n * by MSBuild Core.\n * `-getItem:{itemName,...}`\n */\n Items?: typeof msbuildEvaluationOutput.infer.Items;\n /**\n * The specified Targets and their output values as evaluated by MSBuild\n * Core.\n * `-getTargetResult:{targetName,...}`\n */\n TargetResults?: typeof msbuildEvaluationOutput.infer.TargetResults;\n}\n\nexport const EvaluationOptions: Type<{\n FullName: string;\n Property: {\n MSBuildProjectFullPath?: string | undefined;\n AssemblyName?: string | undefined;\n BaseIntermediateOutputPath?: string | undefined;\n BaseOutputPath?: string | undefined;\n Description?: string | undefined;\n IntermediateOutput?: string | undefined;\n OutDir?: string | undefined;\n OutputPath?: string | undefined;\n Version?: string | undefined;\n VersionPrefix?: string | undefined;\n VersionSuffix?: string | undefined;\n TargetFramework?: string | undefined;\n TargetFrameworks?: string | undefined;\n RuntimeIdentifier?: string | undefined;\n RuntimeIdentifiers?: string | undefined;\n };\n Targets: readonly string[] | string[];\n GetItem: readonly string[] | string[];\n GetProperty: readonly string[] | string[];\n GetTargetResult: readonly string[] | string[];\n}> = Object.freeze(\n type({\n /**\n * The project file's full path.\n */\n FullName: 'string',\n /**\n * User-defined Properties and their values.\n * { Configuration: \"Release\" } will cause the MSBuild to first set the\n * Configuration property to Release before evaluating the project\n * or the project's Target(s).\n * ```txt\n * -property:<n>=<v> Set or override these project-level properties. <n> is\n * the property name, and <v> is the property value. Use a\n * semicolon or a comma to separate multiple properties, or\n * specify each property separately. (Short form: -p)\n * Example:\n * -property:WarningLevel=2;OutDir=bin\\Debug\\\n * ```\n */\n Property: type({ '[string]': 'string' })\n .as<{ -readonly [P in keyof MSBuildProjectProperties]: MSBuildProjectProperties[P] }>()\n .partial(),\n /**\n * The MSBuild Targets to run for evaluation. [\"Pack\"] is recommended.\n * Property values may be changed by Targets such as those provided by\n * dependencies.\n *\n * ```txt\n * -target:<targets> Build these targets in this project. Use a semicolon or a\n * comma to separate multiple targets, or specify each\n * target separately. (Short form: -t)\n * Example:\n * -target:Resources;Compile\n * ```\n * @default []\n */\n Targets: type.string.array().readonly().or('string[]'),\n /**\n * MSBuild Items to evaluate. `[\"Compile\"]` will result in the MSBuild output\n * including {@link MSBuild}\n */\n GetItem: type.string.array().readonly().or('string[]'),\n GetProperty: type.string.array().readonly().or('string[]'),\n GetTargetResult: type.string.array().readonly().or('string[]'),\n }),\n);\n\nexport class MSBuildProject {\n /**\n * Properties for multi-targeting `dotnet publish` outputs.\n * These are included in {@link NPPGetterNames.InstanceGettersRecursive}.\n */\n public static readonly MatrixProperties: readonly string[] = Object.freeze([\n 'TargetFramework',\n 'TargetFrameworks',\n 'RuntimeIdentifier',\n 'RuntimeIdentifiers',\n ]);\n\n /**\n * Creates an instance of MSBuildProject.\n * @param opts The order-independent arguments for this constructor.\n * Properties may be added or moved around in this definition without\n * breaking compatibility.\n * @param opts.fullPath The full path of the MSBuild project's file. This\n * should have a '.csproj', '.fsproj', or '.vbproj' file extension.\n * @param opts.projTargets A list of MSBuild Targets supported by the project.\n * @param opts.evaluation The output of an MSBuild project evaluation. This\n * comprises MSBuild Properties, Items, and Target results.\n */\n public constructor(opts: {\n fullPath: string;\n projTargets: string[];\n evaluation: MSBuildEvaluationOutput;\n }) {\n this.Items = opts.evaluation.Items ?? {};\n this.Properties = new NugetProjectProperties(\n opts.fullPath,\n new CaseInsensitiveMap<string, string>(\n Object.entries(opts.evaluation.Properties ?? {}),\n ),\n );\n this.Targets = opts.projTargets;\n this.TargetResults\n = opts.evaluation.TargetResults === undefined\n ? []\n : [opts.evaluation.TargetResults];\n }\n\n readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;\n readonly Properties: Readonly<NugetProjectProperties>;\n readonly Targets: readonly string[];\n /**\n * Allows appending subsequent target results.\n */\n readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];\n\n /**\n * @param projectPath The full path of the project file or its directory. A\n * relative path may be passed, but will resolve relative to the current\n * working directory.\n * @param includeNonPublic Include conventionally internal/private MSBuild\n * targets in the result.\n * @returns A string array of the project's MSBuild targets.\n * @todo consider 'file' of -targets[:file]\n * Prints a list of available targets without executing the\n * actual build process. By default the output is written to\n * the console window. If the path to an output file\n * is provided that will be used instead.\n * (Short form: -ts)\n * Example:\n * -ts:out.txt\n */\n static async GetTargets(\n projectPath: string,\n includeNonPublic = false,\n ): Promise<string[]> {\n return execAsync(`dotnet msbuild ${projectPath} -targets`, true)\n .then((v) => {\n const targets = v.stdout\n .split('\\n')\n .filter((v, index) => v !== '' && index !== 0)\n .map(v => v.replaceAll('\\r', ''))\n .sort((a, b) => a.localeCompare(b));\n return includeNonPublic\n ? targets\n : targets.filter(v => !v.startsWith('_'));\n });\n }\n\n /**\n * Evaluate {@link Items}, {@link Properties}, and {@link TargetResults},\n * returning them as an instance of {@link MSBuildProject}.\\\n * Note: MSBuild will probably fail if Restore is skipped and another\n * target is specified. If you choose Pack, you must do ['Restore', 'Pack'].\n * @param options The result of {@link EvaluationOptions.from}.\n * @returns A promised {@link MSBuildProject} instance.\n * @throws {Error} if the exec command fails -OR- the JSON parse fails -OR-\n * MSBuildProject's constructor fails.\n * @see {@link PackableProjectsToMSBuildProjects} for most use-cases.\n */\n public static async Evaluate(\n options: typeof EvaluationOptions.inferOut,\n ): Promise<MSBuildProject> {\n if (\n options.GetProperty.length === 0\n && options.GetItem.length === 0\n && options.GetTargetResult.length === 0\n ) {\n throw new Error(\n 'No MSBuild Property, Item, or TargetResult queries were provided.',\n );\n }\n // reminder: args containing spaces and semi-colons MUST be quote-enclosed!\n options.FullName = MSBuildProjectProperties.GetFullPath(options.FullName);\n const _pairs = Object.entries(options.Property).filter(p => typeof p[1] === 'string');\n const property\n = _pairs.length === 0\n ? ''\n : `-p:\"${_pairs.map(pair => pair[0] + '=' + pair[1]).join(';')}\"`;\n const target\n = options.Targets.length === 0\n ? ''\n : `\"-t:${options.Targets.join(';')}\"`;\n const getItem\n = options.GetItem.length === 0\n ? ''\n : `-getItem:\"${options.GetItem.join(',')}\"`;\n const getProperty\n = options.GetProperty.length === 0\n ? ''\n : `-getProperty:\"${options.GetProperty.join(',')}\"`;\n const getTargetResult\n = options.GetTargetResult.length === 0\n ? ''\n : `-getTargetResult:\"${options.GetTargetResult.join(',')}\"`;\n const cmdLine = [\n 'dotnet',\n 'msbuild',\n `\"${options.FullName}\"`,\n '-restore',\n property,\n target,\n getItem,\n getProperty,\n getTargetResult,\n ]\n .filter(v => v !== '')\n .join(' ');\n let stdio: Awaited<ReturnType<typeof execAsync>> | undefined = undefined;\n // may throw\n while (stdio === undefined) {\n stdio = await setTimeout(\n 1000,\n execAsync(cmdLine, true),\n )\n .then(async p => await p)\n .catch<undefined>(catchEBUSY);\n }\n\n // todo: consider -getResultOutputFile:file\n // Redirect output from get* into a file.\n //\n // Example:\n // -getProperty:Bar -getResultOutputFile:Biz.txt\n // This writes the value of property Bar into Biz.txt.\n\n /**\n * The following issues have triggered this code path:\n * - BaseIntermediateOutputPath must use Unix path separators ('/') on all\n * platforms. Even Windows. Otherwise, MSBuild/dotnet will error-exit with\n * \"The BaseIntermediateOutputPath must end with a trailing slash\".\n */\n if (stdio.stdout.startsWith('MSBuild version')) {\n warn(stdio.stdout);\n throw new Error(\n 'dotnet msbuild was expected to output JSON, but output its version header instead.',\n );\n }\n\n let rawOutput: ConstructorParameters<typeof MSBuildEvaluationOutput>[0];\n if (stdio.stdout.startsWith('{')) {\n /** stdout is JSON string */\n rawOutput = stdio.stdout;\n }\n else if (options.GetProperty.length > 0 && options.GetProperty[0] !== undefined) {\n rawOutput = {\n Properties: {\n [options.GetProperty[0]]: String(JSON.parse(stdio.stdout)),\n },\n };\n }\n else {\n throw new Error('Dotnet/MSBuild evaluation output is not a string nor JSON object or array.');\n }\n\n const evaluation = new MSBuildEvaluationOutput(rawOutput);\n\n return new MSBuildProject({\n fullPath: options.FullName,\n projTargets: await MSBuildProject.GetTargets(options.FullName),\n evaluation,\n });\n }\n\n /**\n * Evaluate multiple project paths with some default Evaluate options.\n * @async\n * @param projectsToPackAndPush An array of MSBuild projects' full file\n * paths. If a path is a directory, files in that directory are filtered for\n * `.csproj`, `.fsproj`, and `.vbproj` project files.\n * See https://github.com/dotnet/sdk/blob/497f334b2862bdf98b30c00ede2fd259ea5f624d/src/Cli/dotnet/Commands/New/MSBuildEvaluation/MSBuildEvaluationResult.cs#L19-L32.\\\n * @returns A promised array of {@link MSBuildProject} instances.\n * All known MSBuild and NuGet properties are evaluated.\n * If applicable, a project's \"Pack\" target is evaluated.\n */\n public static async PackableProjectsToMSBuildProjects(\n projectsToPackAndPush: string[],\n ): Promise<Promise<MSBuildProject>[]> {\n const dirEntriesPromise = toDirEntries(typeof projectsToPackAndPush === 'string' ? [projectsToPackAndPush] : projectsToPackAndPush);\n const projectPromises: Promise<MSBuildProject>[] = await dirEntriesPromise\n .then(\n (direntArray: Dirent[]) =>\n direntArray.map(element => convertDirentToMSBuildProject(element)),\n );\n return projectPromises;\n\n /**\n * Map an array of filesystem paths to {@link Dirent} instances representing project files.\n * @param projectsToPackAndPush An array of MSBuild projects' full file\n * paths. If a path is a directory, files in that directory are filtered for\n * `.csproj`, `.fsproj`, and `.vbproj` project files. See\n * https://github.com/dotnet/sdk/blob/497f334b2862bdf98b30c00ede2fd259ea5f624d/src/Cli/dotnet/Commands/New/MSBuildEvaluation/MSBuildEvaluationResult.cs#L19-L32.\\\n * @returns An promised array of Dirent instances for discovered project files.\n */\n async function toDirEntries(\n projectsToPackAndPush: string[],\n ): Promise<Dirent[]> {\n const dirEntries: (Dirent | Dirent[])[] = await Promise.all(\n projectsToPackAndPush.map(async (proj) => {\n proj = await realpath(makeAbsolute(proj));\n const stats = await stat(proj);\n let entries: Dirent[];\n\n if (stats.isFile()) {\n entries = await readdir(path.dirname(proj), { withFileTypes: true });\n const dirent: Dirent | undefined = entries.find(v =>\n path.join(\n // condition required for compatibility. `.path` was deprecated, but `.parentPath` is not available in our node minversion\n ('path' in v ? v.path as string | undefined : undefined) ?? (v as unknown as Omit<typeof v, 'path'> & { parentPath: string }).parentPath,\n v.name,\n ) === proj,\n );\n if (dirent)\n return dirent;\n else\n throw new Error(\n `file \"${proj}\" not found. It may have been moved or deleted.`,\n );\n }\n if (!stats.isDirectory())\n throw new Error(`\"${proj}\" is not a file or directory`);\n\n entries = await readdir(proj, { withFileTypes: true });\n return entries.filter(v =>\n v.isFile()\n && (v.name.endsWith('.csproj') || v.name.endsWith('.fsproj') || v.name.endsWith('.vbproj')),\n );\n }),\n );\n\n return dirEntries.flat();\n }\n\n /**\n * Map a {@link Dirent} instance to an {@link MSBuildProject} instance.\n * @param dirent A {@link Dirent} instance. This instance should be an MSBuild project file.\n * @returns An instance of {@link MSBuildProject} evaluated with the `Pack` target result, if applicable. Evaluated properties will be those whose names are returned by {@link NPPGetterNames.InstanceGettersRecursive}.\n */\n async function convertDirentToMSBuildProject(dirent: Dirent): Promise<MSBuildProject> {\n const fullPath = path.join(\n // condition required for compatibility. `.path` was deprecated, but `.parentPath` is not available in our node minversion\n ('path' in dirent ? dirent.path as string | undefined : undefined) ?? (dirent as unknown as Omit<typeof dirent, 'path'> & { parentPath: string }).parentPath,\n dirent.name,\n );\n const projTargets: Promise<string[]> = MSBuildProject.GetTargets(fullPath);\n const evalTargets = await projTargets.then(v =>\n v.includes('Pack') ? ['Pack'] : [],\n );\n // this might be too long for a command line. What was it on Windows?\n // 2^15 (32,768) character limit for command lines?\n const getProperties = NPPGetterNames.InstanceGettersRecursive;\n\n return await MSBuildProject.Evaluate(\n EvaluationOptions.from({\n FullName: fullPath,\n GetItem: [],\n GetProperty: getProperties,\n GetTargetResult: [],\n Property: {},\n Targets: evalTargets,\n }),\n );\n }\n }\n\n public static fromJSON(json: string): MSBuildProject {\n const parsed = T_PseudoMSBPInstance.assert(JSON.parse(json));\n\n type.true.assert(\n Reflect.setPrototypeOf(parsed, MSBuildProject.prototype),\n );\n type.true.assert(\n Reflect.setPrototypeOf(parsed.Properties, NugetProjectProperties.prototype),\n );\n parsed.Properties = T_NPP.assert(parsed.Properties);\n return T_MSBuildProject.assert(parsed);\n }\n}\n\nconst T_MSBuildProject = type.instanceOf(MSBuildProject);\nconst T_NPP = type.instanceOf(NugetProjectProperties);\nconst T_PseudoMSBPInstance = type({\n Items: type({\n '[string]': type({\n '[string]': 'string',\n Identity: 'string',\n FullPath: 'string',\n RootDir: 'string',\n Filename: 'string',\n Extension: 'string',\n RelativeDir: 'string',\n Directory: 'string',\n RecursiveDir: 'string',\n ModifiedTime: 'string',\n CreatedTime: 'string',\n AccessedTime: 'string',\n DefiningProjectFullPath: 'string',\n DefiningProjectDirectory: 'string',\n DefiningProjectName: 'string',\n DefiningProjectExtension: 'string',\n 'SubType?': ' string | undefined',\n 'TargetFrameworkIdentifier?': 'string | undefined',\n 'TargetPlatformMoniker?': 'string | undefined',\n 'CopyUpToDateMarker?': 'string | undefined',\n 'TargetPlatformIdentifier?': 'string | undefined',\n 'TargetFrameworkVersion?': 'string | undefined',\n 'ReferenceAssembly?': 'string | undefined',\n }).array(),\n }),\n Properties: type.Record('string', 'string').or(T_NPP),\n Targets: type.string.array(),\n TargetResults: msbuildEvaluationOutput.get('TargetResults').exclude('undefined').array(),\n\n});\n\n/**\n * ArkType type definitions for internal usage, but may be re-used elsewhere\n * @internal\n */\nexport const _InternalMSBuildEvaluationTypes: Scope<{\n msbuildEvaluationOutput: {\n Properties?: Record<string, string> | undefined;\n Items?: Record<string, {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string | undefined;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[]> | undefined;\n TargetResults?: Record<string, {\n Result: 'Success';\n Items: {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string | undefined;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[];\n } | {\n Result: 'Failure';\n Items: never[];\n }> | undefined;\n };\n}> = type.scope({\n msbuildEvaluationOutput,\n});\n\n/**\n * Resolve a path if it is not already absolute.\n * @param _path A filesystem path.\n * @returns A full path to a filesystem entry. The path is unchecked for whether or not the path (or its parts) exist.\n */\nfunction makeAbsolute(_path: string) {\n return path.isAbsolute(_path) ? _path : path.resolve(_path);\n}\n\n/**\n * Use this in your catch statement or .catch call to return `undefined` when\n * a \"file in use by another process\" (i.e. EBUSY/ERROR_SHARING_VIOLATION) error is reported.\n * @param error Probably an Error object\n * @returns `undefined` if file in use by another process\n */\nexport function catchEBUSY(error: unknown): undefined {\n if (isError(error)) {\n if ('stderr' in error && typeof error.stderr === 'string') {\n // Normalize colon-like chars: '\\uFF1A'.normalize('NFKC') === ':' === true;\n const normalizedStderr = error.stderr.normalize('NFKC');\n const patternEN = /The process cannot access the file '[^']+' because it is being used by another process\\./gm;\n const hasErrMsgPattern = patternEN.test(normalizedStderr);\n const isCS2012 = /^CSC ?:.+CS2012:/gm.test(normalizedStderr);\n // generic error code; error message must be checked.\n const isAVLN9999 = /AVLN9999:/gm.test(normalizedStderr)\n && hasErrMsgPattern;\n if (isCS2012 || isAVLN9999 || hasErrMsgPattern)\n // eslint-disable-next-line unicorn/no-useless-undefined\n return undefined; /* retry */\n }\n /**\n * some known warnings/errors:\n * - warning MSB3073:\n * The command \"dotnet tool list kuinox.nupkgdeterministicator\"\n * exited with code 145.\n * > $ dotnet tool list kuinox.nupkgdeterministicator\n * > The command could not be loaded, possibly because:\n * > * You intended to execute a .NET application:\n * > The application 'tool' does not exist.\n * > * You intended to execute a .NET SDK command:\n * > No .NET SDKs were found.\n * >\n * > Download a .NET SDK:\n * > https://aka.ms/dotnet/download\n * >\n * > Learn about SDK resolution:\n * > https://aka.ms/dotnet/sdk-not-found\n */\n else throw error;\n }\n else throw new Error('unknown error', { cause: error });\n}\n\n/**\n *\n * Use this in your catch statement or .catch call to return `undefined` when\n * MSBuild error CSC2012 (e.g. \"file in use by another process\") is reported.\n * @param error Probably an Error object\n * @returns `undefined` if CSC2012 (file in use by another process) occurs\n * @deprecated Use {@link catchEBUSY}.\n */\nexport function catchCsc2012(error: unknown): undefined {\n if (isError(error)) {\n // check for error reported when \"file in use by another process\" i.e. EBUSY\n // (UNIX), NTSTATUS.ERROR_SHARING_VIOLATION == 0x20 == 32 (Windows)\n if ('stderr' in error && typeof error.stderr === 'string'\n && /^CSC ?:.+CS2012:/gm.test(\n // '\\uFF1A'.normalize('NFKC') === ':' === true;\n error.stderr.normalize('NFKC'),\n )\n ) {\n // eslint-disable-next-line unicorn/no-useless-undefined\n return undefined; /* retry */\n }\n /**\n * some known warnings/errors:\n * - warning MSB3073:\n * The command \"dotnet tool list kuinox.nupkgdeterministicator\"\n * exited with code 145.\n * > $ dotnet tool list kuinox.nupkgdeterministicator\n * > The command could not be loaded, possibly because:\n * > * You intended to execute a .NET application:\n * > The application 'tool' does not exist.\n * > * You intended to execute a .NET SDK command:\n * > No .NET SDKs were found.\n * >\n * > Download a .NET SDK:\n * > https://aka.ms/dotnet/download\n * >\n * > Learn about SDK resolution:\n * > https://aka.ms/dotnet/sdk-not-found\n */\n else throw error;\n }\n else throw new Error('unknown error', { cause: error });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,gCAAgC,KAAK;CACzC,YAAY;CAEZ,UAAU;CAEV,YAAY;CAEZ,8BAA8B;CAC9B,0BAA0B;CAE1B,uBAAuB;CACvB,6BAA6B;CAE7B,2BAA2B;CAE3B,sBAAsB;CAEtB,UAAU;CAEV,SAAS;CAET,UAAU;CAEV,WAAW;CAEX,aAAa;CAEb,WAAW;CACX,cAAc;CAEd,cAAc;CAEd,aAAa;CAEb,cAAc;CAEd,yBAAyB;CAEzB,0BAA0B;CAE1B,qBAAqB;CAErB,0BAA0B;CAC3B,CAAC;AAEF,MAAM,gBAAgB,KAAK;CACzB,QAAQ;CACR,OAAO,8BAA8B,OAAO;CAC7C,CAAC;AAEF,MAAM,gBAAgB,KAAK;CACzB,QAAQ;CACR,OAAO;CACR,CAAC;AAEF,MAAM,0BA0DD,KAAK;CACR,eAAe,KAAK,EAAE,YAAY,UAAU,CAAC;CAC7C,UAAU,KAAK,EAAE,YAAY,8BAA8B,OAAO,EAAE,CAAC;CACrE,kBAAkB,KAAK,EAAE,YAAY,cAAc,GAAG,cAAc,EAAE,CAAC;CACxE,CAAC;AAEF,IAAa,0BAAb,MAAqC;;;;;CAKnC,YAAY,sBAA6G;;EAEv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C1B,qBAAqB;EACrB,0BAA0B;EAC1B,YAAY;EACZ,8BAA8B;EAC9B,0BAA0B;EAC1B,uBAAuB;EACvB,6BAA6B;EAC7B,2BAA2B;EAC3B,sBAAsB;EACvB,CAAC,CAAC,OAAO,EACX,CAAC;CACF,YAAY,KAAK,OAAO,UAAU,SAAS,CAAC,GAAG,MAAM;CACrD,SAAS,KAAK,OAAO,OAAO;CAC5B,eAAe,wBAAwB,IAAI,gBAAgB,CAAC,QAAQ,YAAY,CAAC,OAAO;CAEzF,CAAC;;;;;AAMF,MAAa,kCA4DR,KAAK,MAAM,EACd,yBACD,CAAC;;;;;;AAOF,SAAS,aAAa,OAAe;AACnC,QAAO,KAAK,WAAW,MAAM,GAAG,QAAQ,KAAK,QAAQ,MAAM;;;;;;;;AAS7D,SAAgB,WAAW,OAA2B;AACpD,KAAI,QAAQ,MAAM,CAChB,KAAI,YAAY,SAAS,OAAO,MAAM,WAAW,UAAU;EAEzD,MAAM,mBAAmB,MAAM,OAAO,UAAU,OAAO;EAEvD,MAAM,mBADY,6FACiB,KAAK,iBAAiB;EACzD,MAAM,WAAW,qBAAqB,KAAK,iBAAiB;EAE5D,MAAM,aAAa,cAAc,KAAK,iBAAiB,IAClD;AACL,MAAI,YAAY,cAAc,iBAE5B,QAAO,KAAA;OAoBN,OAAM;KAER,OAAM,IAAI,MAAM,iBAAiB,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;AAWzD,SAAgB,aAAa,OAA2B;AACtD,KAAI,QAAQ,MAAM,CAGhB,KAAI,YAAY,SAAS,OAAO,MAAM,WAAW,YAC5C,qBAAqB,KAEtB,MAAM,OAAO,UAAU,OAAO,CAC/B,CAGD;KAoBG,OAAM;KAER,OAAM,IAAI,MAAM,iBAAiB,EAAE,OAAO,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"MSBuildProject.mjs","names":[],"sources":["../../src/dotnet/MSBuildProject.ts"],"sourcesContent":["import { type, type Scope, type Type } from 'arktype';\nimport { warn } from 'node:console';\nimport { type Dirent } from 'node:fs';\nimport { readdir, realpath, stat } from 'node:fs/promises';\n// eslint-disable-next-line unicorn/import-style\nimport * as path from 'node:path';\nimport { setTimeout } from 'node:timers/promises';\nimport { CaseInsensitiveMap } from '../CaseInsensitiveMap.ts';\nimport { execAsync } from '../utils/execAsync.ts';\nimport { isError } from '../utils/isError.ts';\nimport { MSBuildProjectProperties } from './MSBuildProjectProperties.ts';\nimport {\n NPPGetterNames,\n NugetProjectProperties,\n} from './NugetProjectProperties.ts';\n\n/**\n * See [MSBuild well-known item metadata](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-well-known-item-metadata).\n * Additional string-type properties may be present (e.g. `{ SubType: \"designer\" }`).\n */\nconst interface_ItemMetadataBuiltIn = type({\n '[string]': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\ConsoleApp1.dll\" */\n Identity: 'string',\n /** @example \"Designer\" */\n 'SubType?': 'string',\n /** @example \".NETCoreApp\" */\n 'TargetFrameworkIdentifier?': 'string',\n 'TargetPlatformMoniker?': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\obj\\\\Debug\\\\net6.0\\\\ConsoleApp1.csproj.CopyComplete\" */\n 'CopyUpToDateMarker?': 'string',\n 'TargetPlatformIdentifier?': 'string',\n /** @example \"6.0\" */\n 'TargetFrameworkVersion?': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\obj\\\\Debug\\\\net6.0\\\\ref\\\\ConsoleApp1.dll\" */\n 'ReferenceAssembly?': 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\ConsoleApp1.dll\" */\n FullPath: 'string',\n /** @example \"c:\\\\\" */\n RootDir: 'string',\n /** @example \"ConsoleApp1\" */\n Filename: 'string',\n /** @example \".dll\" */\n Extension: 'string',\n /** @example \"c:\\\\source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\\" */\n RelativeDir: 'string',\n /** @example \"source\\\\repos\\\\ConsoleApp1\\\\ConsoleApp1\\\\bin\\\\Debug\\\\net6.0\\\\\" */\n Directory: 'string',\n RecursiveDir: 'string',\n /** @example \"2023-11-30 13:38:06.5084339\" */\n ModifiedTime: 'string',\n /** @example \"2023-11-30 13:38:06.9308716\" */\n CreatedTime: 'string',\n /** @example \"2023-11-30 13:38:06.9318732\" */\n AccessedTime: 'string',\n /** @example \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Preview\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\Microsoft.Common.CurrentVersion.targets\" */\n DefiningProjectFullPath: 'string',\n /** @example \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Preview\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\\" */\n DefiningProjectDirectory: 'string',\n /** @example \"Microsoft.Common.CurrentVersion\" */\n DefiningProjectName: 'string',\n /** @example \".targets\" */\n DefiningProjectExtension: 'string',\n});\n\nconst targetSuccess = type({\n Result: '\\'Success\\'',\n Items: interface_ItemMetadataBuiltIn.array(),\n});\n\nconst targetFailure = type({\n Result: '\\'Failure\\'',\n Items: 'never[]',\n});\n\nconst msbuildEvaluationOutput: Type<{\n Properties?: Record<string, string> | undefined;\n Items?: Record<string, {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[]> | undefined;\n TargetResults?: Record<string, {\n Result: 'Success';\n Items: {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string | undefined;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[];\n } | {\n Result: 'Failure';\n Items: never[];\n }> | undefined;\n}> = type({\n 'Properties?': type({ '[string]': 'string' }),\n 'Items?': type({ '[string]': interface_ItemMetadataBuiltIn.array() }),\n 'TargetResults?': type({ '[string]': targetSuccess.or(targetFailure) }),\n});\n\nexport class MSBuildEvaluationOutput {\n /**\n * @param rawMSBuildEvaluation The output of a CLI MSBuild project evaluation.\n * May be the UTF-8 string-encoded JSON or the object decoded from that JSON.\n */\n constructor(rawMSBuildEvaluation: Parameters<typeof JSON.parse>[0] | Parameters<typeof msbuildEvaluationOutput.from>[0]) {\n /** `.assert` instead of `.from` to allow `unknown` JSON.parse return type */\n const knownObject = msbuildEvaluationOutput.assert(typeof rawMSBuildEvaluation === 'string' ? JSON.parse(rawMSBuildEvaluation) : rawMSBuildEvaluation);\n\n this.Properties = knownObject.Properties;\n this.Items = knownObject.Items;\n this.TargetResults = knownObject.TargetResults;\n }\n\n /**\n * The specified properties and their values as evaluated by MSBuild Core.\n * `-getProperty:{propertyName,...}`\n */\n Properties?: typeof msbuildEvaluationOutput.infer.Properties;\n /**\n * The specified items and their values and associated metadata as evaluated\n * by MSBuild Core.\n * `-getItem:{itemName,...}`\n */\n Items?: typeof msbuildEvaluationOutput.infer.Items;\n /**\n * The specified Targets and their output values as evaluated by MSBuild\n * Core.\n * `-getTargetResult:{targetName,...}`\n */\n TargetResults?: typeof msbuildEvaluationOutput.infer.TargetResults;\n}\n\nexport const EvaluationOptions: Type<{\n FullName: string;\n Property: {\n MSBuildProjectFullPath?: string | undefined;\n AssemblyName?: string | undefined;\n BaseIntermediateOutputPath?: string | undefined;\n BaseOutputPath?: string | undefined;\n Description?: string | undefined;\n IntermediateOutput?: string | undefined;\n OutDir?: string | undefined;\n OutputPath?: string | undefined;\n Version?: string | undefined;\n VersionPrefix?: string | undefined;\n VersionSuffix?: string | undefined;\n TargetFramework?: string | undefined;\n TargetFrameworks?: string | undefined;\n RuntimeIdentifier?: string | undefined;\n RuntimeIdentifiers?: string | undefined;\n };\n Targets: readonly string[] | string[];\n GetItem: readonly string[] | string[];\n GetProperty: readonly string[] | string[];\n GetTargetResult: readonly string[] | string[];\n}> = Object.freeze(\n type({\n /**\n * The project file's full path.\n */\n FullName: 'string',\n /**\n * User-defined Properties and their values.\n * { Configuration: \"Release\" } will cause the MSBuild to first set the\n * Configuration property to Release before evaluating the project\n * or the project's Target(s).\n * ```txt\n * -property:<n>=<v> Set or override these project-level properties. <n> is\n * the property name, and <v> is the property value. Use a\n * semicolon or a comma to separate multiple properties, or\n * specify each property separately. (Short form: -p)\n * Example:\n * -property:WarningLevel=2;OutDir=bin\\Debug\\\n * ```\n */\n Property: type({ '[string]': 'string' })\n .as<{ -readonly [P in keyof MSBuildProjectProperties]: MSBuildProjectProperties[P] }>()\n .partial(),\n /**\n * The MSBuild Targets to run for evaluation. [\"Pack\"] is recommended.\n * Property values may be changed by Targets such as those provided by\n * dependencies.\n *\n * ```txt\n * -target:<targets> Build these targets in this project. Use a semicolon or a\n * comma to separate multiple targets, or specify each\n * target separately. (Short form: -t)\n * Example:\n * -target:Resources;Compile\n * ```\n * @default []\n */\n Targets: type.string.array().readonly().or('string[]'),\n /**\n * MSBuild Items to evaluate. `[\"Compile\"]` will result in the MSBuild output\n * including {@link MSBuild}\n */\n GetItem: type.string.array().readonly().or('string[]'),\n GetProperty: type.string.array().readonly().or('string[]'),\n GetTargetResult: type.string.array().readonly().or('string[]'),\n }),\n);\n\nexport class MSBuildProject {\n /**\n * Properties for multi-targeting `dotnet publish` outputs.\n * These are included in {@link NPPGetterNames.InstanceGettersRecursive}.\n */\n public static readonly MatrixProperties: readonly string[] = Object.freeze([\n 'TargetFramework',\n 'TargetFrameworks',\n 'RuntimeIdentifier',\n 'RuntimeIdentifiers',\n ]);\n\n /**\n * Creates an instance of MSBuildProject.\n * @param opts The order-independent arguments for this constructor.\n * Properties may be added or moved around in this definition without\n * breaking compatibility.\n * @param opts.fullPath The full path of the MSBuild project's file. This\n * should have a '.csproj', '.fsproj', or '.vbproj' file extension.\n * @param opts.projTargets A list of MSBuild Targets supported by the project.\n * @param opts.evaluation The output of an MSBuild project evaluation. This\n * comprises MSBuild Properties, Items, and Target results.\n */\n public constructor(opts: {\n fullPath: string;\n projTargets: string[];\n evaluation: MSBuildEvaluationOutput;\n }) {\n this.Items = opts.evaluation.Items ?? {};\n this.Properties = new NugetProjectProperties(\n opts.fullPath,\n new CaseInsensitiveMap<string, string>(\n Object.entries(opts.evaluation.Properties ?? {}),\n ),\n );\n this.Targets = opts.projTargets;\n this.TargetResults\n = opts.evaluation.TargetResults === undefined\n ? []\n : [opts.evaluation.TargetResults];\n }\n\n readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;\n readonly Properties: Readonly<NugetProjectProperties>;\n readonly Targets: readonly string[];\n /**\n * Allows appending subsequent target results.\n */\n readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];\n\n /**\n * @param projectPath The full path of the project file or its directory. A\n * relative path may be passed, but will resolve relative to the current\n * working directory.\n * @param includeNonPublic Include conventionally internal/private MSBuild\n * targets in the result.\n * @returns A string array of the project's MSBuild targets.\n * @todo consider 'file' of -targets[:file]\n * Prints a list of available targets without executing the\n * actual build process. By default the output is written to\n * the console window. If the path to an output file\n * is provided that will be used instead.\n * (Short form: -ts)\n * Example:\n * -ts:out.txt\n */\n static async GetTargets(\n projectPath: string,\n includeNonPublic = false,\n ): Promise<string[]> {\n return execAsync(`dotnet msbuild ${projectPath} -targets`, true)\n .then((v) => {\n const targets = v.stdout\n .split('\\n')\n .filter((v, index) => v !== '' && index !== 0)\n .map(v => v.replaceAll('\\r', ''))\n .sort((a, b) => a.localeCompare(b));\n return includeNonPublic\n ? targets\n : targets.filter(v => !v.startsWith('_'));\n });\n }\n\n /**\n * Evaluate {@link Items}, {@link Properties}, and {@link TargetResults},\n * returning them as an instance of {@link MSBuildProject}.\\\n * Note: MSBuild will probably fail if Restore is skipped and another\n * target is specified. If you choose Pack, you must do ['Restore', 'Pack'].\n * @param options The result of {@link EvaluationOptions.from}.\n * @returns A promised {@link MSBuildProject} instance.\n * @throws {Error} if the exec command fails -OR- the JSON parse fails -OR-\n * MSBuildProject's constructor fails.\n * @see {@link PackableProjectsToMSBuildProjects} for most use-cases.\n */\n public static async Evaluate(\n options: typeof EvaluationOptions.inferOut,\n ): Promise<MSBuildProject> {\n if (\n options.GetProperty.length === 0\n && options.GetItem.length === 0\n && options.GetTargetResult.length === 0\n ) {\n throw new Error(\n 'No MSBuild Property, Item, or TargetResult queries were provided.',\n );\n }\n // reminder: args containing spaces and semi-colons MUST be quote-enclosed!\n options.FullName = MSBuildProjectProperties.GetFullPath(options.FullName);\n const _pairs = Object.entries(options.Property).filter(p => typeof p[1] === 'string');\n const property\n = _pairs.length === 0\n ? ''\n : `-p:\"${_pairs.map(pair => pair[0] + '=' + pair[1]).join(';')}\"`;\n const target\n = options.Targets.length === 0\n ? ''\n : `\"-t:${options.Targets.join(';')}\"`;\n const getItem\n = options.GetItem.length === 0\n ? ''\n : `-getItem:\"${options.GetItem.join(',')}\"`;\n const getProperty\n = options.GetProperty.length === 0\n ? ''\n : `-getProperty:\"${options.GetProperty.join(',')}\"`;\n const getTargetResult\n = options.GetTargetResult.length === 0\n ? ''\n : `-getTargetResult:\"${options.GetTargetResult.join(',')}\"`;\n const cmdLine = [\n 'dotnet',\n 'msbuild',\n `\"${options.FullName}\"`,\n '-restore',\n property,\n target,\n getItem,\n getProperty,\n getTargetResult,\n ]\n .filter(v => v !== '')\n .join(' ');\n let stdio: Awaited<ReturnType<typeof execAsync>> | undefined = undefined;\n // may throw\n while (stdio === undefined) {\n stdio = await setTimeout(\n 1000,\n execAsync(cmdLine, true),\n )\n .then(async p => await p)\n .catch<undefined>(catchEBUSY);\n }\n\n // todo: consider -getResultOutputFile:file\n // Redirect output from get* into a file.\n //\n // Example:\n // -getProperty:Bar -getResultOutputFile:Biz.txt\n // This writes the value of property Bar into Biz.txt.\n\n /**\n * The following issues have triggered this code path:\n * - BaseIntermediateOutputPath must use Unix path separators ('/') on all\n * platforms. Even Windows. Otherwise, MSBuild/dotnet will error-exit with\n * \"The BaseIntermediateOutputPath must end with a trailing slash\".\n */\n if (stdio.stdout.startsWith('MSBuild version')) {\n warn(stdio.stdout);\n throw new Error(\n 'dotnet msbuild was expected to output JSON, but output its version header instead.',\n );\n }\n\n let rawOutput: ConstructorParameters<typeof MSBuildEvaluationOutput>[0];\n if (stdio.stdout.startsWith('{')) {\n /** stdout is JSON string */\n rawOutput = stdio.stdout;\n }\n else if (options.GetProperty.length > 0 && options.GetProperty[0] !== undefined) {\n rawOutput = {\n Properties: {\n [options.GetProperty[0]]: String(JSON.parse(stdio.stdout)),\n },\n };\n }\n else {\n throw new Error('Dotnet/MSBuild evaluation output is not a string nor JSON object or array.');\n }\n\n const evaluation = new MSBuildEvaluationOutput(rawOutput);\n\n return new MSBuildProject({\n fullPath: options.FullName,\n projTargets: await MSBuildProject.GetTargets(options.FullName),\n evaluation,\n });\n }\n\n /**\n * Evaluate multiple project paths with some default Evaluate options.\n * @async\n * @param projectsToPackAndPush An array of MSBuild projects' full file\n * paths. If a path is a directory, files in that directory are filtered for\n * `.csproj`, `.fsproj`, and `.vbproj` project files.\n * See https://github.com/dotnet/sdk/blob/497f334b2862bdf98b30c00ede2fd259ea5f624d/src/Cli/dotnet/Commands/New/MSBuildEvaluation/MSBuildEvaluationResult.cs#L19-L32.\\\n * @returns A promised array of {@link MSBuildProject} instances.\n * All known MSBuild and NuGet properties are evaluated.\n * If applicable, a project's \"Pack\" target is evaluated.\n */\n public static async PackableProjectsToMSBuildProjects(\n projectsToPackAndPush: string[],\n ): Promise<Promise<MSBuildProject>[]> {\n const dirEntriesPromise = toDirEntries(typeof projectsToPackAndPush === 'string' ? [projectsToPackAndPush] : projectsToPackAndPush);\n const projectPromises: Promise<MSBuildProject>[] = await dirEntriesPromise\n .then(\n (direntArray: Dirent[]) =>\n direntArray.map(element => convertDirentToMSBuildProject(element)),\n );\n return projectPromises;\n\n /**\n * Map an array of filesystem paths to {@link Dirent} instances representing project files.\n * @param projectsToPackAndPush An array of MSBuild projects' full file\n * paths. If a path is a directory, files in that directory are filtered for\n * `.csproj`, `.fsproj`, and `.vbproj` project files. See\n * https://github.com/dotnet/sdk/blob/497f334b2862bdf98b30c00ede2fd259ea5f624d/src/Cli/dotnet/Commands/New/MSBuildEvaluation/MSBuildEvaluationResult.cs#L19-L32.\\\n * @returns An promised array of Dirent instances for discovered project files.\n */\n async function toDirEntries(\n projectsToPackAndPush: string[],\n ): Promise<Dirent[]> {\n const dirEntries: (Dirent | Dirent[])[] = await Promise.all(\n projectsToPackAndPush.map(async (proj) => {\n proj = await realpath(makeAbsolute(proj));\n const stats = await stat(proj);\n let entries: Dirent[];\n\n if (stats.isFile()) {\n entries = await readdir(path.dirname(proj), { withFileTypes: true });\n const dirent: Dirent | undefined = entries.find(v =>\n path.join(\n // condition required for compatibility. `.path` was deprecated, but `.parentPath` is not available in our node minversion\n ('path' in v ? v.path as string | undefined : undefined) ?? (v as unknown as Omit<typeof v, 'path'> & { parentPath: string }).parentPath,\n v.name,\n ) === proj,\n );\n if (dirent)\n return dirent;\n else\n throw new Error(\n `file \"${proj}\" not found. It may have been moved or deleted.`,\n );\n }\n if (!stats.isDirectory())\n throw new Error(`\"${proj}\" is not a file or directory`);\n\n entries = await readdir(proj, { withFileTypes: true });\n return entries.filter(v =>\n v.isFile()\n && (v.name.endsWith('.csproj') || v.name.endsWith('.fsproj') || v.name.endsWith('.vbproj')),\n );\n }),\n );\n\n return dirEntries.flat();\n }\n\n /**\n * Map a {@link Dirent} instance to an {@link MSBuildProject} instance.\n * @param dirent A {@link Dirent} instance. This instance should be an MSBuild project file.\n * @returns An instance of {@link MSBuildProject} evaluated with the `Pack` target result, if applicable. Evaluated properties will be those whose names are returned by {@link NPPGetterNames.InstanceGettersRecursive}.\n */\n async function convertDirentToMSBuildProject(dirent: Dirent): Promise<MSBuildProject> {\n const fullPath = path.join(\n // condition required for compatibility. `.path` was deprecated, but `.parentPath` is not available in our node minversion\n ('path' in dirent ? dirent.path as string | undefined : undefined) ?? (dirent as unknown as Omit<typeof dirent, 'path'> & { parentPath: string }).parentPath,\n dirent.name,\n );\n const projTargets: Promise<string[]> = MSBuildProject.GetTargets(fullPath);\n const evalTargets = await projTargets.then(v =>\n v.includes('Pack') ? ['Pack'] : [],\n );\n // this might be too long for a command line. What was it on Windows?\n // 2^15 (32,768) character limit for command lines?\n const getProperties = NPPGetterNames.InstanceGettersRecursive;\n\n return await MSBuildProject.Evaluate(\n EvaluationOptions.from({\n FullName: fullPath,\n GetItem: [],\n GetProperty: getProperties,\n GetTargetResult: [],\n Property: {},\n Targets: evalTargets,\n }),\n );\n }\n }\n\n public static fromJSON(json: string): MSBuildProject {\n const parsed = T_PseudoMSBPInstance.assert(JSON.parse(json));\n\n type.true.assert(\n Reflect.setPrototypeOf(parsed, MSBuildProject.prototype),\n );\n type.true.assert(\n Reflect.setPrototypeOf(parsed.Properties, NugetProjectProperties.prototype),\n );\n parsed.Properties = T_NPP.assert(parsed.Properties);\n return T_MSBuildProject.assert(parsed);\n }\n}\n\nconst T_MSBuildProject = type.instanceOf(MSBuildProject);\nconst T_NPP = type.instanceOf(NugetProjectProperties);\nconst T_PseudoMSBPInstance = type({\n Items: type({\n '[string]': type({\n '[string]': 'string',\n Identity: 'string',\n FullPath: 'string',\n RootDir: 'string',\n Filename: 'string',\n Extension: 'string',\n RelativeDir: 'string',\n Directory: 'string',\n RecursiveDir: 'string',\n ModifiedTime: 'string',\n CreatedTime: 'string',\n AccessedTime: 'string',\n DefiningProjectFullPath: 'string',\n DefiningProjectDirectory: 'string',\n DefiningProjectName: 'string',\n DefiningProjectExtension: 'string',\n 'SubType?': ' string | undefined',\n 'TargetFrameworkIdentifier?': 'string | undefined',\n 'TargetPlatformMoniker?': 'string | undefined',\n 'CopyUpToDateMarker?': 'string | undefined',\n 'TargetPlatformIdentifier?': 'string | undefined',\n 'TargetFrameworkVersion?': 'string | undefined',\n 'ReferenceAssembly?': 'string | undefined',\n }).array(),\n }),\n Properties: type.Record('string', 'string').or(T_NPP),\n Targets: type.string.array(),\n TargetResults: msbuildEvaluationOutput.get('TargetResults').exclude('undefined').array(),\n\n});\n\n/**\n * ArkType type definitions for internal usage, but may be re-used elsewhere\n * @internal\n */\nexport const _InternalMSBuildEvaluationTypes: Scope<{\n msbuildEvaluationOutput: {\n Properties?: Record<string, string> | undefined;\n Items?: Record<string, {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string | undefined;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[]> | undefined;\n TargetResults?: Record<string, {\n Result: 'Success';\n Items: {\n [x: string]: string | undefined;\n Identity: string;\n FullPath: string;\n RootDir: string;\n Filename: string;\n Extension: string;\n RelativeDir: string;\n Directory: string;\n RecursiveDir: string;\n ModifiedTime: string;\n CreatedTime: string;\n AccessedTime: string;\n DefiningProjectFullPath: string;\n DefiningProjectDirectory: string;\n DefiningProjectName: string;\n DefiningProjectExtension: string;\n SubType?: string | undefined;\n TargetFrameworkIdentifier?: string | undefined;\n TargetPlatformMoniker?: string | undefined;\n CopyUpToDateMarker?: string | undefined;\n TargetPlatformIdentifier?: string | undefined;\n TargetFrameworkVersion?: string | undefined;\n ReferenceAssembly?: string | undefined;\n }[];\n } | {\n Result: 'Failure';\n Items: never[];\n }> | undefined;\n };\n}> = type.scope({\n msbuildEvaluationOutput,\n});\n\n/**\n * Resolve a path if it is not already absolute.\n * @param _path A filesystem path.\n * @returns A full path to a filesystem entry. The path is unchecked for whether or not the path (or its parts) exist.\n */\nfunction makeAbsolute(_path: string) {\n return path.isAbsolute(_path) ? _path : path.resolve(_path);\n}\n\n/**\n * Use this in your catch statement or .catch call to return `undefined` when\n * a \"file in use by another process\" (i.e. EBUSY/ERROR_SHARING_VIOLATION) error is reported.\n * @param error Probably an Error object\n * @returns `undefined` if file in use by another process\n */\nexport function catchEBUSY(error: unknown): undefined {\n if (isError(error)) {\n if ('stderr' in error && typeof error.stderr === 'string') {\n // Normalize colon-like chars: '\\uFF1A'.normalize('NFKC') === ':' === true;\n const normalizedStderr = error.stderr.normalize('NFKC');\n const patternEN = /The process cannot access the file '[^']+' because it is being used by another process\\./gm;\n const hasErrMsgPattern = patternEN.test(normalizedStderr);\n const isCS2012 = /^CSC ?:.+CS2012:/gm.test(normalizedStderr);\n // generic error code; error message must be checked.\n const isAVLN9999 = /AVLN9999:/gm.test(normalizedStderr)\n && hasErrMsgPattern;\n if (isCS2012 || isAVLN9999 || hasErrMsgPattern)\n // eslint-disable-next-line unicorn/no-useless-undefined\n return undefined; /* retry */\n }\n /**\n * some known warnings/errors:\n * - warning MSB3073:\n * The command \"dotnet tool list kuinox.nupkgdeterministicator\"\n * exited with code 145.\n * > $ dotnet tool list kuinox.nupkgdeterministicator\n * > The command could not be loaded, possibly because:\n * > * You intended to execute a .NET application:\n * > The application 'tool' does not exist.\n * > * You intended to execute a .NET SDK command:\n * > No .NET SDKs were found.\n * >\n * > Download a .NET SDK:\n * > https://aka.ms/dotnet/download\n * >\n * > Learn about SDK resolution:\n * > https://aka.ms/dotnet/sdk-not-found\n */\n else throw error;\n }\n else throw new Error('unknown error', { cause: error });\n}\n\n/**\n *\n * Use this in your catch statement or .catch call to return `undefined` when\n * MSBuild error CSC2012 (e.g. \"file in use by another process\") is reported.\n * @param error Probably an Error object\n * @returns `undefined` if CSC2012 (file in use by another process) occurs\n * @deprecated Use {@link catchEBUSY}.\n */\nexport function catchCsc2012(error: unknown): undefined {\n if (isError(error)) {\n // check for error reported when \"file in use by another process\" i.e. EBUSY\n // (UNIX), NTSTATUS.ERROR_SHARING_VIOLATION == 0x20 == 32 (Windows)\n if ('stderr' in error && typeof error.stderr === 'string'\n && /^CSC ?:.+CS2012:/gm.test(\n // '\\uFF1A'.normalize('NFKC') === ':' === true;\n error.stderr.normalize('NFKC'),\n )\n ) {\n // eslint-disable-next-line unicorn/no-useless-undefined\n return undefined; /* retry */\n }\n /**\n * some known warnings/errors:\n * - warning MSB3073:\n * The command \"dotnet tool list kuinox.nupkgdeterministicator\"\n * exited with code 145.\n * > $ dotnet tool list kuinox.nupkgdeterministicator\n * > The command could not be loaded, possibly because:\n * > * You intended to execute a .NET application:\n * > The application 'tool' does not exist.\n * > * You intended to execute a .NET SDK command:\n * > No .NET SDKs were found.\n * >\n * > Download a .NET SDK:\n * > https://aka.ms/dotnet/download\n * >\n * > Learn about SDK resolution:\n * > https://aka.ms/dotnet/sdk-not-found\n */\n else throw error;\n }\n else throw new Error('unknown error', { cause: error });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,gCAAgC,KAAK;CACzC,YAAY;;CAEZ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AAK,QAAQ,MAAM;;;;;;;;AAS7D,SAAgB,WAAW,OAA2B;CACpD,IAAI,QAAQ,MAAM,EAChB,IAAI,YAAY,SAAS,OAAO,MAAM,WAAW,UAAU;EAEzD,MAAM,mBAAmB,MAAM,OAAO,UAAU,OAAO;EAEvD,MAAM,mBAAmB,6FAAU,KAAK,iBAAiB;EACzD,MAAM,WAAW,qBAAqB,KAAK,iBAAiB;EAE5D,MAAM,aAAa,cAAc,KAAK,iBAAiB,IAClD;EACL,IAAI,YAAY,cAAc,kBAE5B,OAAO,KAAA;QAoBN,MAAM;MAER,MAAM,IAAI,MAAM,iBAAiB,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;AAWzD,SAAgB,aAAa,OAA2B;CACtD,IAAI,QAAQ,MAAM,EAGhB,IAAI,YAAY,SAAS,OAAO,MAAM,WAAW,YAC5C,qBAAqB,KAEtB,MAAM,OAAO,UAAU,OAAO,CAC/B,EAGD;MAoBG,MAAM;MAER,MAAM,IAAI,MAAM,iBAAiB,EAAE,OAAO,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MSBuildProjectProperties.mjs","names":[],"sources":["../../src/dotnet/MSBuildProjectProperties.ts"],"sourcesContent":["import { strictEqual } from 'node:assert/strict';\nimport { existsSync } from 'node:fs';\n// eslint-disable-next-line unicorn/import-style\nimport * as node_path from 'node:path';\nimport { CaseInsensitiveMap } from '../CaseInsensitiveMap.ts';\nimport type { BaseClass, ClassLike } from '../utils/reflection.ts';\n\n/**\n * Known properties. Additional properties may be added upon request.\n *\n * todo: add Reserved properties, Well-Known properties, Common properties, and more. Maybe as sub classes.\n * See:\n * - {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2022 MSBuild Reserved and Well-known Properties}\n * - {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022 Common MSBuild project properties}\n * - {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props Microsoft.NET.Sdk}\n * - {@link https://learn.microsoft.com/en-us/aspnet/core/razor-pages/web-sdk?view=aspnetcore-8.0&toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json#properties Microsoft.NET.Sdk.Web}\n * - {@link https://learn.microsoft.com/en-us/aspnet/core/razor-pages/sdk?view=aspnetcore-8.0&toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json Microsoft.NET.Sdk.Razor}\n * - {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props-desktop Microsoft.NET.Sdk.Desktop}\n */\nexport class MSBuildProjectProperties {\n // #region static\n\n /**\n * Resolve the given path if it is not absolute. If the path exists, it is returned. Else, an Error is thrown.\n * @param path The full file path of an MSBuild project.\n * @returns The absolute path to the MSBuild project file.\n * @throws {Error} if the path cannot be resolved to an existing file.\n */\n static GetFullPath(path: string): string {\n if (!node_path.isAbsolute(path))\n path = node_path.resolve(path);\n if (!existsSync(path))\n throw new Error(`${node_path.basename(path)} could not be found at \"${path}\"`);\n return path;\n }\n\n /**\n * Note: This method may remove elements from {@link properties}.\\\n * Try to get an element from {@link properties} by its {@link key}.\n * If an element is found, it is removed and the value of the element is returned.\n * Otherwise, `undefined` is returned.\n * @param properties The CaseInsensitiveMap of properties passed to the constructor.\n * @param key The key of the property to get from {@link properties}\n * @returns If found, the value of the `[string, string]` tuple found in {@link properties}. Else, `undefined`.\n */\n protected static getAndForget(\n properties: CaseInsensitiveMap<string, string>,\n key: string,\n ): string | undefined {\n const v: string | undefined = properties.get(key);\n if (v !== undefined)\n properties.delete(key);\n return v;\n }\n\n // #endregion static\n // #endregion static\n\n // #region private\n private _msbuildProjectFullPath: string | undefined;\n private _assemblyName: string | undefined;\n private _baseIntermediateOutputPath: string | undefined;\n private _baseOutputPath: string | undefined;\n private _description: string | undefined;\n private _intermediateOutputPath: string | undefined;\n private _outDir: string | undefined;\n private _outputPath: string | undefined;\n private _runtimeIdentifier: string | undefined;\n private _runtimeIdentifiers: string | undefined;\n private _targetFramework: string | undefined;\n private _targetFrameworks: string | undefined;\n private _version: string | undefined;\n private _versionPrefix: string | undefined;\n private _versionSuffix: string | undefined;\n // #endregion private\n\n constructor(\n msbuildProjectFullPath: string,\n properties: CaseInsensitiveMap<string, string>,\n ) {\n // runtime type checks\n strictEqual(\n typeof msbuildProjectFullPath,\n 'string',\n new TypeError(\n `msbuildProjectFullPath should be a string, not ${typeof msbuildProjectFullPath}!`,\n ),\n );\n strictEqual(\n properties instanceof CaseInsensitiveMap,\n true,\n `arg 'properties' should be instanceof ${CaseInsensitiveMap.name}`,\n );\n strictEqual(\n [...properties.keys()].every((v): v is string => typeof v === 'string'),\n true,\n 'all keys in arg \\'properties\\' should be strings',\n );\n\n this._msbuildProjectFullPath = MPP.GetFullPath(msbuildProjectFullPath);\n this._assemblyName = MPP.getAndForget(properties, 'AssemblyName');\n this._description = MPP.getAndForget(properties, 'Description');\n this._outputPath = MPP.getAndForget(properties, 'OutputPath');\n this._runtimeIdentifier = MPP.getAndForget(properties, 'RuntimeIdentifier');\n this._runtimeIdentifiers = MPP.getAndForget(\n properties,\n 'RuntimeIdentifiers',\n );\n this._targetFramework = MPP.getAndForget(properties, 'TargetFramework');\n this._targetFrameworks = MPP.getAndForget(properties, 'TargetFrameworks');\n this._version = MPP.getAndForget(properties, 'Version');\n this._versionPrefix = MPP.getAndForget(properties, 'VersionPrefix');\n this._versionSuffix = MPP.getAndForget(properties, 'VersionSuffix');\n // rest\n for (const key of properties.keys()) {\n const value = MPP.getAndForget(properties, key);\n if (value !== undefined) {\n Object.defineProperty(this, key, {\n value: value,\n writable: false,\n enumerable: true,\n configurable: true,\n });\n }\n }\n }\n\n get MSBuildProjectFullPath(): string {\n return this._msbuildProjectFullPath ??= '';\n }\n\n /**\n * @returns The name of the assembly.\n *\n * Default: {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties#:~:text=MSBuildProjectDirectory,-Reserved MSBuildProjectDirectory}\n */\n get AssemblyName(): string {\n return this._assemblyName ??= '';\n }\n\n /**\n * @returns The top-level folder where all configuration-specific intermediate output\n * folders are created. The default value is `obj\\`.\n * @example\n * ```xml\n * <BaseIntermediateOutputPath>c:\\xyz\\obj\\</BaseIntermediateOutputPath>\n * ```\n */\n get BaseIntermediateOutputPath(): string {\n return this._baseIntermediateOutputPath ??= '';\n }\n\n /**\n * @returns The base path for the output file.\n * If it's set, MSBuild uses `OutputPath = $(BaseOutputPath)\\$(Configuration)\\`.\n * @example ```xml\n * <BaseOutputPath>c:\\xyz\\bin\\</BaseOutputPath>\n * ```\n */\n get BaseOutputPath(): string {\n return this._baseOutputPath ??= '';\n }\n\n /**\n * A long description for the assembly.\n * If {@link NugetProperties.PackageDescription} is not specified, then this property is also used as the description of the package.\n * @returns The value of the `Description` property.\n */\n get Description(): string {\n return this._description ??= '';\n }\n\n /**\n * @returns The full intermediate output path as derived from\n * {@link BaseIntermediateOutputPath}, if no path is specified.\n * @example \"obj\\\\debug\\\\\"\n */\n get IntermediateOutput(): string {\n return this._intermediateOutputPath ??= '';\n }\n\n /**\n * @returns The final output location for the project or solution.\n * When you build a solution, OutDir can be used to gather multiple project outputs in one location.\n * In addition, OutDir is included in AssemblySearchPaths used for resolving references.\n * @example\n * `bin/Debug`\n */\n get OutDir(): string {\n return this._outDir ??= '';\n }\n\n /**\n * @returns The path to the output directory, relative to the project\n * directory.\n * @example\n * `bin/Debug`\n * /// non-AnyCPU builds\n * `bin/Debug/${Platform}`\n */\n get OutputPath(): string {\n return this._outputPath ??= '';\n }\n\n /**\n * Set Version -OR- VersionPrefix.\n * @returns The value of the `Version` property.\n *\n * Default: `\"1.0.0\"`\n */\n get Version(): string {\n return this._version ??= '1.0.0';\n }\n\n /**\n * Set Version -OR- VersionPrefix.\\\n * Setting {@link NugetProperties.PackageVersion} overwrites {@link VersionPrefix}\n * @returns The MAJOR.MINOR.PATCH string of the version.\n * @see {@link VersionSuffix}\n */\n get VersionPrefix(): string {\n return this._versionPrefix ??= '';\n }\n\n /**\n * The effect of this property on the package version depends on the values of the Version and VersionPrefix properties, as shown in the following table:\n * | Properties with values | Package version |\n * | ---------------------- | --------------- |\n * | None | 1.0.0 |\n * | Version | $(Version) |\n * | VersionPrefix only | $(VersionPrefix) |\n * | VersionSuffix only | 1.0.0-$(VersionSuffix) |\n * | VersionPrefix and VersionSuffix | $(VersionPrefix)-$(VersionSuffix) |\n * \\\n * Setting {@link PackageVersion} overwrites {@link VersionSuffix}\n * @returns The string appended to the end of the MAJOR.MINOR.PATCH semver string (i.e. {@link VersionPrefix})\n */\n get VersionSuffix(): string {\n return this._versionSuffix ??= '';\n }\n\n /**\n * @returns The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframework Target Framework}\n * @see\n * https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks\n * https://learn.microsoft.com/en-us/dotnet/standard/frameworks\n */\n get TargetFramework(): string {\n return this._targetFramework ??= '';\n }\n\n /**\n * @returns The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframeworks Target Frameworks} (plural)\n * @see\n * https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks\n * https://learn.microsoft.com/en-us/dotnet/standard/frameworks\n */\n get TargetFrameworks(): string {\n return this._targetFrameworks ??= '';\n }\n\n /**\n * @returns\n * > The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifier `Runtime Identifier`} property lets you specify a single runtime\n * > identifier (RID) for the project. The RID enables publishing a\n * > self-contained deployment.\n * @see\n * https://learn.microsoft.com/en-us/dotnet/core/rid-catalog\n */\n get RuntimeIdentifier(): string {\n return this._runtimeIdentifier ??= '';\n }\n\n /**\n * @returns\n * > The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifiers `RuntimeIdentifiers`} property lets you specify a\n * > semicolon-delimited list of runtime identifiers (RIDs) for the project.\n * > Use this property if you need to publish for multiple runtimes.\n * > `RuntimeIdentifiers` is used at restore time to ensure the right assets\n * > are in the graph.\n * @see\n * https://learn.microsoft.com/en-us/dotnet/core/rid-catalog\n */\n get RuntimeIdentifiers(): string {\n return this._runtimeIdentifiers ??= '';\n }\n}\n\nconst MPP = MSBuildProjectProperties;\nexport type Class_MSBPP = ClassLike<BaseClass<typeof MSBuildProjectProperties & {\n // @ts-expect-error Property 'getAndForget' is protected and only accessible within class 'MSBuildProjectProperties' and its subclasses. ts(2445)\n getAndForget: ProtectedMember<typeof MSBuildProjectProperties.getAndForget>;\n}>>;\n\ntype ProtectedMember<T> = T;\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,IAAa,2BAAb,MAAsC;;;;;;;CASpC,OAAO,YAAY,MAAsB;AACvC,MAAI,CAAC,UAAU,WAAW,KAAK,CAC7B,QAAO,UAAU,QAAQ,KAAK;AAChC,MAAI,CAAC,WAAW,KAAK,CACnB,OAAM,IAAI,MAAM,GAAG,UAAU,SAAS,KAAK,CAAC,0BAA0B,KAAK,GAAG;AAChF,SAAO;;;;;;;;;;;CAYT,OAAiB,aACf,YACA,KACoB;EACpB,MAAM,IAAwB,WAAW,IAAI,IAAI;AACjD,MAAI,MAAM,KAAA,EACR,YAAW,OAAO,IAAI;AACxB,SAAO;;CAOT;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA,YACE,wBACA,YACA;AAEA,cACE,OAAO,wBACP,0BACA,IAAI,UACF,kDAAkD,OAAO,uBAAuB,GACjF,CACF;AACD,cACE,sBAAsB,oBACtB,MACA,yCAAyC,mBAAmB,OAC7D;AACD,cACE,CAAC,GAAG,WAAW,MAAM,CAAC,CAAC,OAAO,MAAmB,OAAO,MAAM,SAAS,EACvE,MACA,iDACD;AAED,OAAK,0BA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;;;;;;;;;;CAgBjC,IAAI,gBAAwB;AAC1B,SAAO,KAAK,mBAAmB;;;;;;;;CASjC,IAAI,kBAA0B;AAC5B,SAAO,KAAK,qBAAqB;;;;;;;;CASnC,IAAI,mBAA2B;AAC7B,SAAO,KAAK,sBAAsB;;;;;;;;;;CAWpC,IAAI,oBAA4B;AAC9B,SAAO,KAAK,uBAAuB;;;;;;;;;;;;CAarC,IAAI,qBAA6B;AAC/B,SAAO,KAAK,wBAAwB;;;AAIxC,MAAM,MAAM"}
|
|
1
|
+
{"version":3,"file":"MSBuildProjectProperties.mjs","names":[],"sources":["../../src/dotnet/MSBuildProjectProperties.ts"],"sourcesContent":["import { strictEqual } from 'node:assert/strict';\nimport { existsSync } from 'node:fs';\n// eslint-disable-next-line unicorn/import-style\nimport * as node_path from 'node:path';\nimport { CaseInsensitiveMap } from '../CaseInsensitiveMap.ts';\nimport type { BaseClass, ClassLike } from '../utils/reflection.ts';\n\n/**\n * Known properties. Additional properties may be added upon request.\n *\n * todo: add Reserved properties, Well-Known properties, Common properties, and more. Maybe as sub classes.\n * See:\n * - {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2022 MSBuild Reserved and Well-known Properties}\n * - {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022 Common MSBuild project properties}\n * - {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props Microsoft.NET.Sdk}\n * - {@link https://learn.microsoft.com/en-us/aspnet/core/razor-pages/web-sdk?view=aspnetcore-8.0&toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json#properties Microsoft.NET.Sdk.Web}\n * - {@link https://learn.microsoft.com/en-us/aspnet/core/razor-pages/sdk?view=aspnetcore-8.0&toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json Microsoft.NET.Sdk.Razor}\n * - {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props-desktop Microsoft.NET.Sdk.Desktop}\n */\nexport class MSBuildProjectProperties {\n // #region static\n\n /**\n * Resolve the given path if it is not absolute. If the path exists, it is returned. Else, an Error is thrown.\n * @param path The full file path of an MSBuild project.\n * @returns The absolute path to the MSBuild project file.\n * @throws {Error} if the path cannot be resolved to an existing file.\n */\n static GetFullPath(path: string): string {\n if (!node_path.isAbsolute(path))\n path = node_path.resolve(path);\n if (!existsSync(path))\n throw new Error(`${node_path.basename(path)} could not be found at \"${path}\"`);\n return path;\n }\n\n /**\n * Note: This method may remove elements from {@link properties}.\\\n * Try to get an element from {@link properties} by its {@link key}.\n * If an element is found, it is removed and the value of the element is returned.\n * Otherwise, `undefined` is returned.\n * @param properties The CaseInsensitiveMap of properties passed to the constructor.\n * @param key The key of the property to get from {@link properties}\n * @returns If found, the value of the `[string, string]` tuple found in {@link properties}. Else, `undefined`.\n */\n protected static getAndForget(\n properties: CaseInsensitiveMap<string, string>,\n key: string,\n ): string | undefined {\n const v: string | undefined = properties.get(key);\n if (v !== undefined)\n properties.delete(key);\n return v;\n }\n\n // #endregion static\n // #endregion static\n\n // #region private\n private _msbuildProjectFullPath: string | undefined;\n private _assemblyName: string | undefined;\n private _baseIntermediateOutputPath: string | undefined;\n private _baseOutputPath: string | undefined;\n private _description: string | undefined;\n private _intermediateOutputPath: string | undefined;\n private _outDir: string | undefined;\n private _outputPath: string | undefined;\n private _runtimeIdentifier: string | undefined;\n private _runtimeIdentifiers: string | undefined;\n private _targetFramework: string | undefined;\n private _targetFrameworks: string | undefined;\n private _version: string | undefined;\n private _versionPrefix: string | undefined;\n private _versionSuffix: string | undefined;\n // #endregion private\n\n constructor(\n msbuildProjectFullPath: string,\n properties: CaseInsensitiveMap<string, string>,\n ) {\n // runtime type checks\n strictEqual(\n typeof msbuildProjectFullPath,\n 'string',\n new TypeError(\n `msbuildProjectFullPath should be a string, not ${typeof msbuildProjectFullPath}!`,\n ),\n );\n strictEqual(\n properties instanceof CaseInsensitiveMap,\n true,\n `arg 'properties' should be instanceof ${CaseInsensitiveMap.name}`,\n );\n strictEqual(\n [...properties.keys()].every((v): v is string => typeof v === 'string'),\n true,\n 'all keys in arg \\'properties\\' should be strings',\n );\n\n this._msbuildProjectFullPath = MPP.GetFullPath(msbuildProjectFullPath);\n this._assemblyName = MPP.getAndForget(properties, 'AssemblyName');\n this._description = MPP.getAndForget(properties, 'Description');\n this._outputPath = MPP.getAndForget(properties, 'OutputPath');\n this._runtimeIdentifier = MPP.getAndForget(properties, 'RuntimeIdentifier');\n this._runtimeIdentifiers = MPP.getAndForget(\n properties,\n 'RuntimeIdentifiers',\n );\n this._targetFramework = MPP.getAndForget(properties, 'TargetFramework');\n this._targetFrameworks = MPP.getAndForget(properties, 'TargetFrameworks');\n this._version = MPP.getAndForget(properties, 'Version');\n this._versionPrefix = MPP.getAndForget(properties, 'VersionPrefix');\n this._versionSuffix = MPP.getAndForget(properties, 'VersionSuffix');\n // rest\n for (const key of properties.keys()) {\n const value = MPP.getAndForget(properties, key);\n if (value !== undefined) {\n Object.defineProperty(this, key, {\n value: value,\n writable: false,\n enumerable: true,\n configurable: true,\n });\n }\n }\n }\n\n get MSBuildProjectFullPath(): string {\n return this._msbuildProjectFullPath ??= '';\n }\n\n /**\n * @returns The name of the assembly.\n *\n * Default: {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties#:~:text=MSBuildProjectDirectory,-Reserved MSBuildProjectDirectory}\n */\n get AssemblyName(): string {\n return this._assemblyName ??= '';\n }\n\n /**\n * @returns The top-level folder where all configuration-specific intermediate output\n * folders are created. The default value is `obj\\`.\n * @example\n * ```xml\n * <BaseIntermediateOutputPath>c:\\xyz\\obj\\</BaseIntermediateOutputPath>\n * ```\n */\n get BaseIntermediateOutputPath(): string {\n return this._baseIntermediateOutputPath ??= '';\n }\n\n /**\n * @returns The base path for the output file.\n * If it's set, MSBuild uses `OutputPath = $(BaseOutputPath)\\$(Configuration)\\`.\n * @example ```xml\n * <BaseOutputPath>c:\\xyz\\bin\\</BaseOutputPath>\n * ```\n */\n get BaseOutputPath(): string {\n return this._baseOutputPath ??= '';\n }\n\n /**\n * A long description for the assembly.\n * If {@link NugetProperties.PackageDescription} is not specified, then this property is also used as the description of the package.\n * @returns The value of the `Description` property.\n */\n get Description(): string {\n return this._description ??= '';\n }\n\n /**\n * @returns The full intermediate output path as derived from\n * {@link BaseIntermediateOutputPath}, if no path is specified.\n * @example \"obj\\\\debug\\\\\"\n */\n get IntermediateOutput(): string {\n return this._intermediateOutputPath ??= '';\n }\n\n /**\n * @returns The final output location for the project or solution.\n * When you build a solution, OutDir can be used to gather multiple project outputs in one location.\n * In addition, OutDir is included in AssemblySearchPaths used for resolving references.\n * @example\n * `bin/Debug`\n */\n get OutDir(): string {\n return this._outDir ??= '';\n }\n\n /**\n * @returns The path to the output directory, relative to the project\n * directory.\n * @example\n * `bin/Debug`\n * /// non-AnyCPU builds\n * `bin/Debug/${Platform}`\n */\n get OutputPath(): string {\n return this._outputPath ??= '';\n }\n\n /**\n * Set Version -OR- VersionPrefix.\n * @returns The value of the `Version` property.\n *\n * Default: `\"1.0.0\"`\n */\n get Version(): string {\n return this._version ??= '1.0.0';\n }\n\n /**\n * Set Version -OR- VersionPrefix.\\\n * Setting {@link NugetProperties.PackageVersion} overwrites {@link VersionPrefix}\n * @returns The MAJOR.MINOR.PATCH string of the version.\n * @see {@link VersionSuffix}\n */\n get VersionPrefix(): string {\n return this._versionPrefix ??= '';\n }\n\n /**\n * The effect of this property on the package version depends on the values of the Version and VersionPrefix properties, as shown in the following table:\n * | Properties with values | Package version |\n * | ---------------------- | --------------- |\n * | None | 1.0.0 |\n * | Version | $(Version) |\n * | VersionPrefix only | $(VersionPrefix) |\n * | VersionSuffix only | 1.0.0-$(VersionSuffix) |\n * | VersionPrefix and VersionSuffix | $(VersionPrefix)-$(VersionSuffix) |\n * \\\n * Setting {@link PackageVersion} overwrites {@link VersionSuffix}\n * @returns The string appended to the end of the MAJOR.MINOR.PATCH semver string (i.e. {@link VersionPrefix})\n */\n get VersionSuffix(): string {\n return this._versionSuffix ??= '';\n }\n\n /**\n * @returns The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframework Target Framework}\n * @see\n * https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks\n * https://learn.microsoft.com/en-us/dotnet/standard/frameworks\n */\n get TargetFramework(): string {\n return this._targetFramework ??= '';\n }\n\n /**\n * @returns The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframeworks Target Frameworks} (plural)\n * @see\n * https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks\n * https://learn.microsoft.com/en-us/dotnet/standard/frameworks\n */\n get TargetFrameworks(): string {\n return this._targetFrameworks ??= '';\n }\n\n /**\n * @returns\n * > The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifier `Runtime Identifier`} property lets you specify a single runtime\n * > identifier (RID) for the project. The RID enables publishing a\n * > self-contained deployment.\n * @see\n * https://learn.microsoft.com/en-us/dotnet/core/rid-catalog\n */\n get RuntimeIdentifier(): string {\n return this._runtimeIdentifier ??= '';\n }\n\n /**\n * @returns\n * > The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifiers `RuntimeIdentifiers`} property lets you specify a\n * > semicolon-delimited list of runtime identifiers (RIDs) for the project.\n * > Use this property if you need to publish for multiple runtimes.\n * > `RuntimeIdentifiers` is used at restore time to ensure the right assets\n * > are in the graph.\n * @see\n * https://learn.microsoft.com/en-us/dotnet/core/rid-catalog\n */\n get RuntimeIdentifiers(): string {\n return this._runtimeIdentifiers ??= '';\n }\n}\n\nconst MPP = MSBuildProjectProperties;\nexport type Class_MSBPP = ClassLike<BaseClass<typeof MSBuildProjectProperties & {\n // @ts-expect-error Property 'getAndForget' is protected and only accessible within class 'MSBuildProjectProperties' and its subclasses. ts(2445)\n getAndForget: ProtectedMember<typeof MSBuildProjectProperties.getAndForget>;\n}>>;\n\ntype ProtectedMember<T> = T;\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,IAAa,2BAAb,MAAsC;;;;;;;CASpC,OAAO,YAAY,MAAsB;EACvC,IAAI,CAAC,UAAU,WAAW,KAAK,EAC7B,OAAO,UAAU,QAAQ,KAAK;EAChC,IAAI,CAAC,WAAW,KAAK,EACnB,MAAM,IAAI,MAAM,GAAG,UAAU,SAAS,KAAK,CAAC,0BAA0B,KAAK,GAAG;EAChF,OAAO;;;;;;;;;;;CAYT,OAAiB,aACf,YACA,KACoB;EACpB,MAAM,IAAwB,WAAW,IAAI,IAAI;EACjD,IAAI,MAAM,KAAA,GACR,WAAW,OAAO,IAAI;EACxB,OAAO;;CAOT;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA,YACE,wBACA,YACA;EAEA,YACE,OAAO,wBACP,0BACA,IAAI,UACF,kDAAkD,OAAO,uBAAuB,GACjF,CACF;EACD,YACE,sBAAsB,oBACtB,MACA,yCAAyC,mBAAmB,OAC7D;EACD,YACE,CAAC,GAAG,WAAW,MAAM,CAAC,CAAC,OAAO,MAAmB,OAAO,MAAM,SAAS,EACvE,MACA,iDACD;EAED,KAAK,0BAA0B,IAAI,YAAY,uBAAuB;EACtE,KAAK,gBAAgB,IAAI,aAAa,YAAY,eAAe;EACjE,KAAK,eAAe,IAAI,aAAa,YAAY,cAAc;EAC/D,KAAK,cAAc,IAAI,aAAa,YAAY,aAAa;EAC7D,KAAK,qBAAqB,IAAI,aAAa,YAAY,oBAAoB;EAC3E,KAAK,sBAAsB,IAAI,aAC7B,YACA,qBACD;EACD,KAAK,mBAAmB,IAAI,aAAa,YAAY,kBAAkB;EACvE,KAAK,oBAAoB,IAAI,aAAa,YAAY,mBAAmB;EACzE,KAAK,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