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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +33 -10
  3. package/dotnet/.github/workflows/_unit_test.yml +1 -1
  4. package/dotnet/.github/workflows/dotnet-release.yml +1 -1
  5. package/dotnet/.github/workflows/sample-dotnet-build.yml +1 -1
  6. package/dotnet/CleanupWpfTmp.targets +15 -0
  7. package/dotnet/HCE.Shared.targets +3 -0
  8. package/mjs/CaseInsensitiveMap.mjs.map +1 -1
  9. package/mjs/commitlintConfig.mjs.map +1 -1
  10. package/mjs/debug.mjs.map +1 -1
  11. package/mjs/dotnet/GithubNugetRegistryInfo.d.mts +5 -5
  12. package/mjs/dotnet/GithubNugetRegistryInfo.d.mts.map +1 -1
  13. package/mjs/dotnet/GithubNugetRegistryInfo.mjs +7 -7
  14. package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -1
  15. package/mjs/dotnet/GitlabNugetRegistryInfo.d.mts +6 -6
  16. package/mjs/dotnet/GitlabNugetRegistryInfo.d.mts.map +1 -1
  17. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +14 -14
  18. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -1
  19. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +5 -5
  20. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -1
  21. package/mjs/dotnet/MSBuildProject.d.mts +28 -28
  22. package/mjs/dotnet/MSBuildProject.d.mts.map +1 -1
  23. package/mjs/dotnet/MSBuildProject.mjs +88 -66
  24. package/mjs/dotnet/MSBuildProject.mjs.map +1 -1
  25. package/mjs/dotnet/MSBuildProjectProperties.d.mts.map +1 -1
  26. package/mjs/dotnet/MSBuildProjectProperties.mjs +1 -1
  27. package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -1
  28. package/mjs/dotnet/NugetProjectProperties.d.mts +3 -3
  29. package/mjs/dotnet/NugetProjectProperties.d.mts.map +1 -1
  30. package/mjs/dotnet/NugetProjectProperties.mjs +7 -9
  31. package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -1
  32. package/mjs/dotnet/NugetRegistryInfo.d.mts +40 -40
  33. package/mjs/dotnet/NugetRegistryInfo.d.mts.map +1 -1
  34. package/mjs/dotnet/NugetRegistryInfo.mjs +170 -148
  35. package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -1
  36. package/mjs/dotnet/helpers.d.mts.map +1 -1
  37. package/mjs/dotnet/helpers.mjs +33 -34
  38. package/mjs/dotnet/helpers.mjs.map +1 -1
  39. package/mjs/eslintConfig.mjs.map +1 -1
  40. package/mjs/insertPlugins.mjs +2 -2
  41. package/mjs/insertPlugins.mjs.map +1 -1
  42. package/mjs/semantic-release__commit-analyzer.d.mts.map +1 -1
  43. package/mjs/semantic-release__exec.d.mts.map +1 -1
  44. package/mjs/semantic-release__git.d.mts.map +1 -1
  45. package/mjs/semantic-release__github.d.mts +1 -0
  46. package/mjs/semantic-release__github.d.mts.map +1 -1
  47. package/mjs/semanticReleaseConfig.d.mts.map +1 -1
  48. package/mjs/semanticReleaseConfig.mjs.map +1 -1
  49. package/mjs/semanticReleaseConfigDotnet.d.mts.map +1 -1
  50. package/mjs/semanticReleaseConfigDotnet.mjs +23 -16
  51. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -1
  52. package/mjs/setupGitPluginSpec.d.mts.map +1 -1
  53. package/mjs/setupGitPluginSpec.default.mjs.map +1 -1
  54. package/mjs/setupGitPluginSpec.mjs +19 -19
  55. package/mjs/setupGitPluginSpec.mjs.map +1 -1
  56. package/mjs/utils/Exact.d.mts.map +1 -1
  57. package/mjs/utils/GracefulRecursion.d.mts.map +1 -1
  58. package/mjs/utils/env.d.mts.map +1 -1
  59. package/mjs/utils/env.mjs.map +1 -1
  60. package/mjs/utils/execAsync.d.mts +3 -3
  61. package/mjs/utils/execAsync.d.mts.map +1 -1
  62. package/mjs/utils/execAsync.mjs +14 -12
  63. package/mjs/utils/execAsync.mjs.map +1 -1
  64. package/mjs/utils/isError.mjs.map +1 -1
  65. package/mjs/utils/miscTypes.d.mts.map +1 -1
  66. package/mjs/utils/miscTypes.mjs.map +1 -1
  67. package/mjs/utils/reflection/FunctionLike.d.mts +1 -0
  68. package/mjs/utils/reflection/FunctionLike.d.mts.map +1 -1
  69. package/mjs/utils/reflection/GetterDescriptor.d.mts.map +1 -1
  70. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mts.map +1 -1
  71. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mts +1 -1
  72. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mts.map +1 -1
  73. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mts +1 -1
  74. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mts.map +1 -1
  75. package/mjs/utils/reflection/OwnKeyOf.d.mts +1 -1
  76. package/mjs/utils/reflection/OwnKeyOf.d.mts.map +1 -1
  77. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mts.map +1 -1
  78. package/mjs/utils/reflection/PropertyDescriptorMap.d.mts +1 -1
  79. package/mjs/utils/reflection/PropertyDescriptorMap.d.mts.map +1 -1
  80. package/mjs/utils/reflection/filterForGetters.d.mts.map +1 -1
  81. package/mjs/utils/reflection/filterForGetters.mjs.map +1 -1
  82. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.mts.map +1 -1
  83. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -1
  84. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.mts.map +1 -1
  85. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +3 -3
  86. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -1
  87. package/mjs/utils/reflection/getPrototypeChainOf.d.mts +2 -2
  88. package/mjs/utils/reflection/getPrototypeChainOf.d.mts.map +1 -1
  89. package/mjs/utils/reflection/getPrototypeChainOf.mjs +1 -2
  90. package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -1
  91. package/mjs/utils/reflection/getPrototypeOf.d.mts.map +1 -1
  92. package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -1
  93. package/mjs/utils/reflection/inheritance.d.mts +4 -4
  94. package/mjs/utils/reflection/inheritance.d.mts.map +1 -1
  95. package/mjs/utils/reflection/inheritance.mjs.map +1 -1
  96. package/mjs/utils/reflection/isConstructor.d.mts +3 -3
  97. package/mjs/utils/reflection/isConstructor.d.mts.map +1 -1
  98. package/mjs/utils/reflection/isConstructor.mjs +7 -7
  99. package/mjs/utils/reflection/isConstructor.mjs.map +1 -1
  100. package/mjs/utils/reflection/isGetterDescriptor.d.mts.map +1 -1
  101. package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -1
  102. package/mjs/utils/reflection/listOwnGetters.d.mts.map +1 -1
  103. package/mjs/utils/reflection/listOwnGetters.mjs +4 -2
  104. package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -1
  105. package/mjs/utils/reflection.d.mts +1 -1
  106. package/package.json +24 -23
  107. package/src/dotnet/GithubNugetRegistryInfo.ts +18 -15
  108. package/src/dotnet/GitlabNugetRegistryInfo.ts +28 -26
  109. package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +6 -6
  110. package/src/dotnet/MSBuildProject.ts +103 -106
  111. package/src/dotnet/MSBuildProjectProperties.ts +1 -1
  112. package/src/dotnet/NugetProjectProperties.ts +13 -18
  113. package/src/dotnet/NugetRegistryInfo.ts +287 -243
  114. package/src/dotnet/helpers.ts +58 -58
  115. package/src/insertPlugins.ts +3 -3
  116. package/src/semantic-release__github.d.ts +1 -0
  117. package/src/semanticReleaseConfigDotnet.ts +52 -54
  118. package/src/setupGitPluginSpec.ts +25 -26
  119. package/src/utils/env.ts +1 -0
  120. package/src/utils/execAsync.ts +16 -13
  121. package/src/utils/reflection/FunctionLike.d.ts +1 -0
  122. package/src/utils/reflection/InstancePropertyDescriptorMap.d.ts +4 -4
  123. package/src/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.ts +6 -6
  124. package/src/utils/reflection/OwnGetterDescriptorMap.d.ts +2 -2
  125. package/src/utils/reflection/OwnKeyOf.d.ts +3 -3
  126. package/src/utils/reflection/OwnPropertyDescriptorMap.d.ts +3 -3
  127. package/src/utils/reflection/PropertyDescriptorMap.d.ts +3 -3
  128. package/src/utils/reflection/filterForGetters.ts +10 -10
  129. package/src/utils/reflection/getOwnPropertyDescriptors.ts +2 -2
  130. package/src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts +13 -13
  131. package/src/utils/reflection/getPrototypeChainOf.ts +17 -17
  132. package/src/utils/reflection/getPrototypeOf.ts +2 -2
  133. package/src/utils/reflection/inheritance.ts +5 -4
  134. package/src/utils/reflection/isConstructor.ts +7 -7
  135. package/src/utils/reflection/listOwnGetters.ts +8 -8
  136. package/tsconfig.base.json +2 -0
@@ -138,19 +138,6 @@ const msbuildEvaluationOutput: Type<{
138
138
  });
139
139
 
140
140
  export class MSBuildEvaluationOutput {
141
- /**
142
- * @param rawMSBuildEvaluation The output of a CLI MSBuild project evaluation.
143
- * May be the UTF-8 string-encoded JSON or the object decoded from that JSON.
144
- */
145
- constructor(rawMSBuildEvaluation: Parameters<typeof JSON.parse>[0] | Parameters<typeof msbuildEvaluationOutput.from>[0]) {
146
- /** `.assert` instead of `.from` to allow `unknown` JSON.parse return type */
147
- const knownObject = msbuildEvaluationOutput.assert(typeof rawMSBuildEvaluation === 'string' ? JSON.parse(rawMSBuildEvaluation) : rawMSBuildEvaluation);
148
-
149
- this.Properties = knownObject.Properties;
150
- this.Items = knownObject.Items;
151
- this.TargetResults = knownObject.TargetResults;
152
- }
153
-
154
141
  /**
155
142
  * The specified properties and their values as evaluated by MSBuild Core.
156
143
  * `-getProperty:{propertyName,...}`
@@ -168,6 +155,19 @@ export class MSBuildEvaluationOutput {
168
155
  * `-getTargetResult:{targetName,...}`
169
156
  */
170
157
  TargetResults?: typeof msbuildEvaluationOutput.infer.TargetResults;
158
+
159
+ /**
160
+ * @param rawMSBuildEvaluation The output of a CLI MSBuild project evaluation.
161
+ * May be the UTF-8 string-encoded JSON or the object decoded from that JSON.
162
+ */
163
+ constructor(rawMSBuildEvaluation: Parameters<typeof JSON.parse>[0] | Parameters<typeof msbuildEvaluationOutput.from>[0]) {
164
+ /** `.assert` instead of `.from` to allow `unknown` JSON.parse return type */
165
+ const knownObject = msbuildEvaluationOutput.assert(typeof rawMSBuildEvaluation === 'string' ? JSON.parse(rawMSBuildEvaluation) : rawMSBuildEvaluation);
166
+
167
+ this.Properties = knownObject.Properties;
168
+ this.Items = knownObject.Items;
169
+ this.TargetResults = knownObject.TargetResults;
170
+ }
171
171
  }
172
172
 
173
173
  export const EvaluationOptions: Type<{
@@ -253,44 +253,6 @@ export class MSBuildProject {
253
253
  'RuntimeIdentifiers',
254
254
  ]);
255
255
 
256
- /**
257
- * Creates an instance of MSBuildProject.
258
- * @param opts The order-independent arguments for this constructor.
259
- * Properties may be added or moved around in this definition without
260
- * breaking compatibility.
261
- * @param opts.fullPath The full path of the MSBuild project's file. This
262
- * should have a '.csproj', '.fsproj', or '.vbproj' file extension.
263
- * @param opts.projTargets A list of MSBuild Targets supported by the project.
264
- * @param opts.evaluation The output of an MSBuild project evaluation. This
265
- * comprises MSBuild Properties, Items, and Target results.
266
- */
267
- public constructor(opts: {
268
- fullPath: string;
269
- projTargets: string[];
270
- evaluation: MSBuildEvaluationOutput;
271
- }) {
272
- this.Items = opts.evaluation.Items ?? {};
273
- this.Properties = new NugetProjectProperties(
274
- opts.fullPath,
275
- new CaseInsensitiveMap<string, string>(
276
- Object.entries(opts.evaluation.Properties ?? {}),
277
- ),
278
- );
279
- this.Targets = opts.projTargets;
280
- this.TargetResults
281
- = opts.evaluation.TargetResults === undefined
282
- ? []
283
- : [opts.evaluation.TargetResults];
284
- }
285
-
286
- readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;
287
- readonly Properties: Readonly<NugetProjectProperties>;
288
- readonly Targets: readonly string[];
289
- /**
290
- * Allows appending subsequent target results.
291
- */
292
- readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];
293
-
294
256
  /**
295
257
  * @param projectPath The full path of the project file or its directory. A
296
258
  * relative path may be passed, but will resolve relative to the current
@@ -309,19 +271,19 @@ export class MSBuildProject {
309
271
  */
310
272
  static async GetTargets(
311
273
  projectPath: string,
274
+ // eslint-disable-next-line unicorn/consistent-boolean-name
312
275
  includeNonPublic = false,
313
276
  ): Promise<string[]> {
314
- return execAsync(`dotnet msbuild ${projectPath} -targets`, true)
315
- .then((v) => {
316
- const targets = v.stdout
317
- .split('\n')
318
- .filter((v, index) => v !== '' && index !== 0)
319
- .map(v => v.replaceAll('\r', ''))
320
- .sort((a, b) => a.localeCompare(b));
321
- return includeNonPublic
322
- ? targets
323
- : targets.filter(v => !v.startsWith('_'));
324
- });
277
+ const stdPair = await execAsync(`dotnet msbuild ${projectPath} -targets`, true);
278
+
279
+ const targets = stdPair.stdout
280
+ .split('\n')
281
+ .filter((v, index) => v !== '' && index !== 0)
282
+ .map(v => v.replaceAll('\r', ''))
283
+ .sort((a, b) => a.localeCompare(b));
284
+ return includeNonPublic
285
+ ? targets
286
+ : targets.filter(v => !v.startsWith('_'));
325
287
  }
326
288
 
327
289
  /**
@@ -350,48 +312,51 @@ export class MSBuildProject {
350
312
  // reminder: args containing spaces and semi-colons MUST be quote-enclosed!
351
313
  options.FullName = MSBuildProjectProperties.GetFullPath(options.FullName);
352
314
  const _pairs = Object.entries(options.Property).filter(p => typeof p[1] === 'string');
353
- const property
315
+ const string_property
354
316
  = _pairs.length === 0
355
317
  ? ''
356
318
  : `-p:"${_pairs.map(pair => pair[0] + '=' + pair[1]).join(';')}"`;
357
- const target
319
+ const string_target
358
320
  = options.Targets.length === 0
359
321
  ? ''
360
322
  : `"-t:${options.Targets.join(';')}"`;
361
- const getItem
323
+ const string_getItem
362
324
  = options.GetItem.length === 0
363
325
  ? ''
364
326
  : `-getItem:"${options.GetItem.join(',')}"`;
365
- const getProperty
327
+ const string_getProperty
366
328
  = options.GetProperty.length === 0
367
329
  ? ''
368
330
  : `-getProperty:"${options.GetProperty.join(',')}"`;
369
- const getTargetResult
331
+ const string_getTargetResult
370
332
  = options.GetTargetResult.length === 0
371
333
  ? ''
372
334
  : `-getTargetResult:"${options.GetTargetResult.join(',')}"`;
373
- const cmdLine = [
335
+ const commandLine = [
374
336
  'dotnet',
375
337
  'msbuild',
376
338
  `"${options.FullName}"`,
377
339
  '-restore',
378
- property,
379
- target,
380
- getItem,
381
- getProperty,
382
- getTargetResult,
340
+ string_property,
341
+ string_target,
342
+ string_getItem,
343
+ string_getProperty,
344
+ string_getTargetResult,
383
345
  ]
384
346
  .filter(v => v !== '')
385
347
  .join(' ');
386
- let stdio: Awaited<ReturnType<typeof execAsync>> | undefined = undefined;
348
+ let stdio: Awaited<ReturnType<typeof execAsync>> | undefined;
387
349
  // may throw
388
350
  while (stdio === undefined) {
389
- stdio = await setTimeout(
390
- 1000,
391
- execAsync(cmdLine, true),
392
- )
393
- .then(async p => await p)
394
- .catch<undefined>(catchEBUSY);
351
+ try {
352
+ stdio = await setTimeout(
353
+ 1000,
354
+ execAsync(commandLine, true),
355
+ );
356
+ }
357
+ catch (error: unknown) {
358
+ catchEBUSY(error);
359
+ }
395
360
  }
396
361
 
397
362
  // todo: consider -getResultOutputFile:file
@@ -434,7 +399,7 @@ export class MSBuildProject {
434
399
 
435
400
  return new MSBuildProject({
436
401
  fullPath: options.FullName,
437
- projTargets: await MSBuildProject.GetTargets(options.FullName),
402
+ projTargets: await this.GetTargets(options.FullName),
438
403
  evaluation,
439
404
  });
440
405
  }
@@ -453,12 +418,8 @@ export class MSBuildProject {
453
418
  public static async PackableProjectsToMSBuildProjects(
454
419
  projectsToPackAndPush: string[],
455
420
  ): Promise<Promise<MSBuildProject>[]> {
456
- const dirEntriesPromise = toDirEntries(typeof projectsToPackAndPush === 'string' ? [projectsToPackAndPush] : projectsToPackAndPush);
457
- const projectPromises: Promise<MSBuildProject>[] = await dirEntriesPromise
458
- .then(
459
- (direntArray: Dirent[]) =>
460
- direntArray.map(element => convertDirentToMSBuildProject(element)),
461
- );
421
+ const directoryEntriesPromise = await toDirectoryEntries(typeof projectsToPackAndPush === 'string' ? [projectsToPackAndPush] : projectsToPackAndPush);
422
+ const projectPromises: Promise<MSBuildProject>[] = directoryEntriesPromise.map(element => convertDirentToMSBuildProject(element));
462
423
  return projectPromises;
463
424
 
464
425
  /**
@@ -469,10 +430,10 @@ export class MSBuildProject {
469
430
  * https://github.com/dotnet/sdk/blob/497f334b2862bdf98b30c00ede2fd259ea5f624d/src/Cli/dotnet/Commands/New/MSBuildEvaluation/MSBuildEvaluationResult.cs#L19-L32.\
470
431
  * @returns An promised array of Dirent instances for discovered project files.
471
432
  */
472
- async function toDirEntries(
433
+ async function toDirectoryEntries(
473
434
  projectsToPackAndPush: string[],
474
435
  ): Promise<Dirent[]> {
475
- const dirEntries: (Dirent | Dirent[])[] = await Promise.all(
436
+ const directoryEntries: (Dirent | Dirent[])[] = await Promise.all(
476
437
  projectsToPackAndPush.map(async (proj) => {
477
438
  proj = await realpath(makeAbsolute(proj));
478
439
  const stats = await stat(proj);
@@ -489,10 +450,9 @@ export class MSBuildProject {
489
450
  );
490
451
  if (dirent)
491
452
  return dirent;
492
- else
493
- throw new Error(
494
- `file "${proj}" not found. It may have been moved or deleted.`,
495
- );
453
+ throw new Error(
454
+ `file "${proj}" not found. It may have been moved or deleted.`,
455
+ );
496
456
  }
497
457
  if (!stats.isDirectory())
498
458
  throw new Error(`"${proj}" is not a file or directory`);
@@ -505,7 +465,7 @@ export class MSBuildProject {
505
465
  }),
506
466
  );
507
467
 
508
- return dirEntries.flat();
468
+ return directoryEntries.flat();
509
469
  }
510
470
 
511
471
  /**
@@ -519,19 +479,17 @@ export class MSBuildProject {
519
479
  ('path' in dirent ? dirent.path as string | undefined : undefined) ?? (dirent as unknown as Omit<typeof dirent, 'path'> & { parentPath: string }).parentPath,
520
480
  dirent.name,
521
481
  );
522
- const projTargets: Promise<string[]> = MSBuildProject.GetTargets(fullPath);
523
- const evalTargets = await projTargets.then(v =>
524
- v.includes('Pack') ? ['Pack'] : [],
525
- );
482
+ const projTargets: string[] = await MSBuildProject.GetTargets(fullPath);
483
+ const evalTargets: string[] = projTargets.includes('Pack') ? ['Pack'] : [];
526
484
  // this might be too long for a command line. What was it on Windows?
527
485
  // 2^15 (32,768) character limit for command lines?
528
- const getProperties = NPPGetterNames.InstanceGettersRecursive;
486
+ const propertiesToEvaluate = NPPGetterNames.InstanceGettersRecursive;
529
487
 
530
488
  return await MSBuildProject.Evaluate(
531
489
  EvaluationOptions.from({
532
490
  FullName: fullPath,
533
491
  GetItem: [],
534
- GetProperty: getProperties,
492
+ GetProperty: propertiesToEvaluate,
535
493
  GetTargetResult: [],
536
494
  Property: {},
537
495
  Targets: evalTargets,
@@ -544,7 +502,7 @@ export class MSBuildProject {
544
502
  const parsed = T_PseudoMSBPInstance.assert(JSON.parse(json));
545
503
 
546
504
  type.true.assert(
547
- Reflect.setPrototypeOf(parsed, MSBuildProject.prototype),
505
+ Reflect.setPrototypeOf(parsed, this.prototype),
548
506
  );
549
507
  type.true.assert(
550
508
  Reflect.setPrototypeOf(parsed.Properties, NugetProjectProperties.prototype),
@@ -552,6 +510,45 @@ export class MSBuildProject {
552
510
  parsed.Properties = T_NPP.assert(parsed.Properties);
553
511
  return T_MSBuildProject.assert(parsed);
554
512
  }
513
+
514
+ readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;
515
+ readonly Properties: Readonly<NugetProjectProperties>;
516
+ readonly Targets: readonly string[];
517
+ /**
518
+ * Allows appending subsequent target results.
519
+ */
520
+ readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];
521
+
522
+ /**
523
+ * Creates an instance of MSBuildProject.
524
+ * @param opts The order-independent arguments for this constructor.
525
+ * Properties may be added or moved around in this definition without
526
+ * breaking compatibility.
527
+ * @param opts.fullPath The full path of the MSBuild project's file. This
528
+ * should have a '.csproj', '.fsproj', or '.vbproj' file extension.
529
+ * @param opts.projTargets A list of MSBuild Targets supported by the project.
530
+ * @param opts.evaluation The output of an MSBuild project evaluation. This
531
+ * comprises MSBuild Properties, Items, and Target results.
532
+ */
533
+ // eslint-disable-next-line unicorn/name-replacements
534
+ public constructor(opts: {
535
+ fullPath: string;
536
+ projTargets: string[];
537
+ evaluation: MSBuildEvaluationOutput;
538
+ }) {
539
+ this.Items = opts.evaluation.Items ?? {};
540
+ this.Properties = new NugetProjectProperties(
541
+ opts.fullPath,
542
+ new CaseInsensitiveMap<string, string>(
543
+ Object.entries(opts.evaluation.Properties ?? {}),
544
+ ),
545
+ );
546
+ this.Targets = opts.projTargets;
547
+ this.TargetResults
548
+ = opts.evaluation.TargetResults === undefined
549
+ ? []
550
+ : [opts.evaluation.TargetResults];
551
+ }
555
552
  }
556
553
 
557
554
  const T_MSBuildProject = type.instanceOf(MSBuildProject);
@@ -679,12 +676,12 @@ export function catchEBUSY(error: unknown): undefined {
679
676
  // Normalize colon-like chars: '\uFF1A'.normalize('NFKC') === ':' === true;
680
677
  const normalizedStderr = error.stderr.normalize('NFKC');
681
678
  const patternEN = /The process cannot access the file '[^']+' because it is being used by another process\./gm;
682
- const hasErrMsgPattern = patternEN.test(normalizedStderr);
679
+ const hasErrorMessagePattern = patternEN.test(normalizedStderr);
683
680
  const isCS2012 = /^CSC ?:.+CS2012:/gm.test(normalizedStderr);
684
681
  // generic error code; error message must be checked.
685
682
  const isAVLN9999 = /AVLN9999:/gm.test(normalizedStderr)
686
- && hasErrMsgPattern;
687
- if (isCS2012 || isAVLN9999 || hasErrMsgPattern)
683
+ && hasErrorMessagePattern;
684
+ if (isCS2012 || isAVLN9999 || hasErrorMessagePattern)
688
685
  // eslint-disable-next-line unicorn/no-useless-undefined
689
686
  return undefined; /* retry */
690
687
  }
@@ -750,7 +747,7 @@ export function catchCsc2012(error: unknown): undefined {
750
747
  * > Learn about SDK resolution:
751
748
  * > https://aka.ms/dotnet/sdk-not-found
752
749
  */
753
- else throw error;
750
+ throw error;
754
751
  }
755
- else throw new Error('unknown error', { cause: error });
752
+ throw new Error('unknown error', { cause: error });
756
753
  }
@@ -92,7 +92,7 @@ export class MSBuildProjectProperties {
92
92
  `arg 'properties' should be instanceof ${CaseInsensitiveMap.name}`,
93
93
  );
94
94
  strictEqual(
95
- [...properties.keys()].every((v): v is string => typeof v === 'string'),
95
+ properties.keys().every((v): v is string => typeof v === 'string'),
96
96
  true,
97
97
  'all keys in arg \'properties\' should be strings',
98
98
  );
@@ -10,12 +10,12 @@ import {
10
10
  getPrototypesChainOf,
11
11
  listOwnGetters,
12
12
  type ClassLike,
13
- type ProtoChainOfClass,
14
- type WithProto,
13
+ type ProtoChainOfClass as PrototypeChainOfClass,
14
+ type WithProto as WithPrototype,
15
15
  } from '../utils/reflection.ts';
16
16
  import { MSBuildProjectProperties, type Class_MSBPP } from './MSBuildProjectProperties.ts';
17
17
 
18
- const Type_RepositoryType: type<'' | 'git' | 'tfs'> = type('""|"git"|"tfs"');
18
+ const Type_RepoType: type<'' | 'git' | 'tfs'> = type('""|"git"|"tfs"');
19
19
  const Type_SymbolPackageFormat: type<'symbols.nupkg' | 'snupkg'> = type('"symbols.nupkg" | "snupkg"');
20
20
 
21
21
  /**
@@ -91,12 +91,6 @@ export class NugetProjectProperties extends MSBuildProjectProperties {
91
91
  // Pass the remainder to super
92
92
  super(msbuildProjectFullPath, properties);
93
93
 
94
- /** convert values to strings */
95
- for (const [value, key] of consumables.entries()) {
96
- if (typeof value !== 'string')
97
- consumables.set(key, String(value));
98
- }
99
-
100
94
  const _getAndForget = (key: string) => NugetProjectProperties.getAndForget(consumables, key);
101
95
  let data;
102
96
  this._authors = _getAndForget('Authors');
@@ -140,7 +134,7 @@ export class NugetProjectProperties extends MSBuildProjectProperties {
140
134
  this._packageVersion = _getAndForget('PackageVersion');
141
135
  this._product = _getAndForget('Product');
142
136
  this._repositoryCommit = _getAndForget('RepositoryCommit');
143
- if (Type_RepositoryType.allows(data = _getAndForget('RepositoryType')))
137
+ if (Type_RepoType.allows(data = _getAndForget('RepositoryType')))
144
138
  this._repositoryType = data;
145
139
  this._repositoryUrl = _getAndForget('RepositoryUrl');
146
140
  if (tBooleanString.allows(data = _getAndForget('SuppressDependenciesWhenPacking')))
@@ -405,7 +399,7 @@ export class NugetProjectProperties extends MSBuildProjectProperties {
405
399
  * Default: `''`
406
400
  * @example "git", "fts"
407
401
  */
408
- get RepositoryType(): typeof Type_RepositoryType.inferOut {
402
+ get RepositoryType(): typeof Type_RepoType.inferOut {
409
403
  return this._repositoryType ??= '';
410
404
  }
411
405
 
@@ -569,28 +563,29 @@ export class NugetProjectProperties extends MSBuildProjectProperties {
569
563
 
570
564
  export type Class_NPP = ClassLike<
571
565
  typeof NugetProjectProperties
572
- & WithProto<Class_MSBPP>
566
+ & WithPrototype<Class_MSBPP>
573
567
  >;
574
568
 
575
569
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
576
570
  export class NPPGetterNames {
577
- private static _prototypeChain: ProtoChainOfClass<Class_NPP> | undefined;
578
- private static get PrototypeChain(): [Class_NPP, Class_MSBPP] {
579
- return this._prototypeChain ??= getPrototypesChainOf(NugetProjectProperties as Class_NPP, 'classes');
580
- }
571
+ private static _prototypeChain: PrototypeChainOfClass<Class_NPP> | undefined;
581
572
 
582
573
  private static _instanceGetters: Exclude<keyof NugetProjectProperties, keyof MSBuildProjectProperties>[] | undefined;
583
574
  private static _instanceGettersRecursive: (keyof NugetProjectProperties)[] | undefined;
584
575
  private static _StaticGetters: never[] | undefined;
585
576
  private static _StaticGettersRecursive: (keyof typeof NugetProjectProperties)[] | undefined;
586
577
 
578
+ private static get PrototypeChain(): [Class_NPP, Class_MSBPP] {
579
+ return this._prototypeChain ??= getPrototypesChainOf(NugetProjectProperties as Class_NPP, 'classes');
580
+ }
581
+
587
582
  public static get InstanceGetters(): Exclude<keyof NugetProjectProperties, keyof MSBuildProjectProperties>[] {
588
583
  return this._instanceGetters ??= listOwnGetters(NugetProjectProperties as Class_NPP, 'Instance');
589
584
  }
590
585
 
591
586
  public static get InstanceGettersRecursive(): (keyof NugetProjectProperties)[] {
592
587
  return this._instanceGettersRecursive ??= this.PrototypeChain.flatMap(
593
- proto => listOwnGetters<typeof proto, 'Instance'>(proto, 'Instance'),
588
+ prototype => listOwnGetters<typeof prototype, 'Instance'>(prototype, 'Instance'),
594
589
  );
595
590
  }
596
591
 
@@ -600,7 +595,7 @@ export class NPPGetterNames {
600
595
 
601
596
  public static get StaticGettersRecursive(): ('prototype' | 'GetFullPath')[] {
602
597
  return this._StaticGettersRecursive ??= this.PrototypeChain.flatMap(
603
- proto => listOwnGetters(proto, 'Static'),
598
+ prototype => listOwnGetters(prototype, 'Static'),
604
599
  );
605
600
  }
606
601
  }