mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 15:33:56 +08:00
refactor(nuget): derive folder lookup from declared roles (#17376)
This commit is contained in:
@@ -49,8 +49,7 @@ export type NugetNupkgBudget = keyof typeof NUGET_NUPKG_BUDGETS;
|
||||
export const nugetNupkgBudgetLimit =
|
||||
parameterBudgetLimitFor<NugetNupkgBudget>(NUGET_NUPKG_BUDGETS);
|
||||
|
||||
/** Path-derived NuGet folder roles; restore-time asset selection is not observed. */
|
||||
export const NUGET_NUPKG_ENTRY_ROLES = [
|
||||
const NUGET_NUPKG_FOLDER_ROLES = [
|
||||
"lib",
|
||||
"ref",
|
||||
"runtimes",
|
||||
@@ -62,6 +61,11 @@ export const NUGET_NUPKG_ENTRY_ROLES = [
|
||||
"content",
|
||||
"contentFiles",
|
||||
"tools",
|
||||
] as const;
|
||||
|
||||
/** Path-derived NuGet folder roles; restore-time asset selection is not observed. */
|
||||
export const NUGET_NUPKG_ENTRY_ROLES = [
|
||||
...NUGET_NUPKG_FOLDER_ROLES,
|
||||
"nuspec",
|
||||
"opc",
|
||||
"unknown",
|
||||
@@ -69,19 +73,9 @@ export const NUGET_NUPKG_ENTRY_ROLES = [
|
||||
export type NugetNupkgEntryRole = (typeof NUGET_NUPKG_ENTRY_ROLES)[number];
|
||||
|
||||
// A Map so arbitrary payload folder names never resolve inherited properties.
|
||||
const FOLDER_ROLES: ReadonlyMap<string, NugetNupkgEntryRole> = new Map([
|
||||
["lib", "lib"],
|
||||
["ref", "ref"],
|
||||
["runtimes", "runtimes"],
|
||||
["native", "native"],
|
||||
["analyzers", "analyzers"],
|
||||
["buildtransitive", "buildTransitive"],
|
||||
["buildmultitargeting", "buildMultiTargeting"],
|
||||
["build", "build"],
|
||||
["contentfiles", "contentFiles"],
|
||||
["content", "content"],
|
||||
["tools", "tools"],
|
||||
]);
|
||||
const FOLDER_ROLES: ReadonlyMap<string, NugetNupkgEntryRole> = new Map(
|
||||
NUGET_NUPKG_FOLDER_ROLES.map((role) => [role.toLowerCase(), role] as const),
|
||||
);
|
||||
|
||||
/** Logical ZIP path with unified separators and without a leading `./`. */
|
||||
export const nugetNupkgLogicalPath = (name: string): string =>
|
||||
|
||||
Reference in New Issue
Block a user