[cli][build-utils] Rename variants to flags (#11121)

- Removes all the legacy `flags`
 - Renames the new `variants` to `flags`

Neither the legacy flags, nor the new variants were exposed to anyone, except for the type in build-utils, so there shouldn't be any issues removing/renaming them.
This commit is contained in:
Andy
2024-03-08 17:06:23 +01:00
committed by GitHub
parent dfa2f07c45
commit 908e7837d5
11 changed files with 149 additions and 117 deletions

View File

@@ -16,6 +16,7 @@ import {
EdgeFunction,
Images,
File,
FlagDefinitions,
} from '@vercel/build-utils';
import { NodeFileTraceReasons } from '@vercel/nft';
import type {
@@ -3307,19 +3308,14 @@ export function isApiPage(page: string | undefined) {
.match(/(serverless|server)\/pages\/api(\/|\.js$)/);
}
/** @deprecated */
export type VariantsManifestLegacy = Record<
string,
{
defaultValue?: unknown;
metadata?: Record<string, unknown>;
}
>;
export type VariantsManifest = {
definitions: FlagDefinitions;
};
export async function getVariantsManifest(
entryPath: string,
outputDirectory: string
): Promise<null | VariantsManifestLegacy> {
): Promise<null | VariantsManifest> {
const pathVariantsManifest = path.join(
entryPath,
outputDirectory,
@@ -3333,7 +3329,7 @@ export async function getVariantsManifest(
if (!hasVariantsManifest) return null;
const variantsManifest: VariantsManifestLegacy = await fs.readJSON(
const variantsManifest: VariantsManifest = await fs.readJSON(
pathVariantsManifest
);