Skip to content

Commit 687a92c

Browse files
committed
refactor: rename consts
1 parent cadd32d commit 687a92c

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

packages/build/src/plugins_core/edge_functions/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Metric } from '../../core/report_metrics.js'
88
import { log, reduceLogLines } from '../../log/logger.js'
99
import { logFunctionsToBundle } from '../../log/messages/core_steps.js'
1010
import {
11-
FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT,
11+
FRAMEWORKS_API_EDGE_FUNCTIONS_PATH,
1212
FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP,
1313
} from '../../utils/frameworks_api.js'
1414

@@ -52,7 +52,7 @@ const coreStep = async function ({
5252
const internalSrcPath = resolve(buildDir, internalSrcDirectory)
5353
const distImportMapPath = join(dirname(internalSrcPath), IMPORT_MAP_FILENAME)
5454
const srcPath = srcDirectory ? resolve(buildDir, srcDirectory) : undefined
55-
const frameworksAPISrcPath = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT)
55+
const frameworksAPISrcPath = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_PATH)
5656
const generatedFunctionPaths = [internalSrcPath]
5757

5858
if (await pathExists(frameworksAPISrcPath)) {
@@ -62,7 +62,7 @@ const coreStep = async function ({
6262
const frameworkImportMap = resolve(
6363
buildDir,
6464
packagePath || '',
65-
FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT,
65+
FRAMEWORKS_API_EDGE_FUNCTIONS_PATH,
6666
FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP,
6767
)
6868

@@ -170,7 +170,7 @@ const hasEdgeFunctionsDirectories = async function ({
170170
return true
171171
}
172172

173-
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT)
173+
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_PATH)
174174

175175
return await pathExists(frameworkFunctionsSrc)
176176
}

packages/build/src/plugins_core/frameworks_api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { mergeConfigs } from '@netlify/config'
55

66
import type { NetlifyConfig } from '../../index.js'
77
import { getConfigMutations } from '../../plugins/child/diff.js'
8-
import { DEPLOY_CONFIG_DIST_PATH, FRAMEWORKS_API_SKEW_PROTECTION_ENDPOINT } from '../../utils/frameworks_api.js'
8+
import { DEPLOY_CONFIG_DIST_PATH, FRAMEWORKS_API_SKEW_PROTECTION_PATH } from '../../utils/frameworks_api.js'
99
import { CoreStep, CoreStepFunction } from '../types.js'
1010

1111
import { loadSkewProtectionConfig } from './skew_protection.js'
@@ -35,7 +35,7 @@ const OVERRIDE_PROPERTIES = new Set(['redirects!'])
3535
// and validated against the schema, throwing a build error if validation
3636
// fails. If valid, the contents are written to the edge redirects file.
3737
const handleSkewProtection = async (buildDir: string, packagePath?: string) => {
38-
const inputPath = resolve(buildDir, packagePath ?? '', FRAMEWORKS_API_SKEW_PROTECTION_ENDPOINT)
38+
const inputPath = resolve(buildDir, packagePath ?? '', FRAMEWORKS_API_SKEW_PROTECTION_PATH)
3939
const outputPath = resolve(buildDir, packagePath ?? '', DEPLOY_CONFIG_DIST_PATH)
4040

4141
const skewProtectionConfig = await loadSkewProtectionConfig(inputPath)

packages/build/src/plugins_core/frameworks_api/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { resolve } from 'path'
44
import isPlainObject from 'is-plain-obj'
55

66
import type { NetlifyConfig } from '../../index.js'
7-
import { FRAMEWORKS_API_CONFIG_ENDPOINT } from '../../utils/frameworks_api.js'
7+
import { FRAMEWORKS_API_CONFIG_PATH } from '../../utils/frameworks_api.js'
88
import { SystemLogger } from '../types.js'
99

1010
export const loadConfigFile = async (buildDir: string, packagePath?: string) => {
11-
const configPath = resolve(buildDir, packagePath ?? '', FRAMEWORKS_API_CONFIG_ENDPOINT)
11+
const configPath = resolve(buildDir, packagePath ?? '', FRAMEWORKS_API_CONFIG_PATH)
1212

1313
try {
1414
const data = await fs.readFile(configPath, 'utf8')

packages/build/src/plugins_core/functions/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { addErrorInfo } from '../../error/info.js'
77
import { log } from '../../log/logger.js'
88
import { type GeneratedFunction, getGeneratedFunctions } from '../../steps/return_values.js'
99
import { logBundleResults, logFunctionsNonExistingDir, logFunctionsToBundle } from '../../log/messages/core_steps.js'
10-
import { FRAMEWORKS_API_FUNCTIONS_ENDPOINT } from '../../utils/frameworks_api.js'
10+
import { FRAMEWORKS_API_FUNCTIONS_PATH } from '../../utils/frameworks_api.js'
1111

1212
import { getZipError } from './error.js'
1313
import { getUserAndInternalFunctions, validateFunctionsSrc } from './utils.js'
@@ -147,7 +147,7 @@ const coreStep = async function ({
147147
const functionsDist = resolve(buildDir, relativeFunctionsDist)
148148
const internalFunctionsSrc = resolve(buildDir, relativeInternalFunctionsSrc)
149149
const internalFunctionsSrcExists = await pathExists(internalFunctionsSrc)
150-
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_FUNCTIONS_ENDPOINT)
150+
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_FUNCTIONS_PATH)
151151
const frameworkFunctionsSrcExists = await pathExists(frameworkFunctionsSrc)
152152
const functionsSrcExists = await validateFunctionsSrc({ functionsSrc, relativeFunctionsSrc })
153153
const [userFunctions = [], internalFunctions = [], frameworkFunctions = []] = await getUserAndInternalFunctions({
@@ -240,7 +240,7 @@ const hasFunctionsDirectories = async function ({
240240
return true
241241
}
242242

243-
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_FUNCTIONS_ENDPOINT)
243+
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_FUNCTIONS_PATH)
244244

245245
if (await pathExists(frameworkFunctionsSrc)) {
246246
return true

packages/build/src/plugins_core/pre_cleanup/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { rm } from 'node:fs/promises'
22
import { resolve } from 'node:path'
33

44
import { getBlobsDirs } from '../../utils/blobs.js'
5-
import { FRAMEWORKS_API_ENDPOINT } from '../../utils/frameworks_api.js'
5+
import { FRAMEWORKS_API_PATH } from '../../utils/frameworks_api.js'
66
import { CoreStep, CoreStepFunction } from '../types.js'
77

88
const coreStep: CoreStepFunction = async ({ buildDir, packagePath }) => {
9-
const dirs = [...getBlobsDirs(buildDir, packagePath), resolve(buildDir, packagePath || '', FRAMEWORKS_API_ENDPOINT)]
9+
const dirs = [...getBlobsDirs(buildDir, packagePath), resolve(buildDir, packagePath || '', FRAMEWORKS_API_PATH)]
1010

1111
try {
1212
await Promise.all(dirs.map((dir) => rm(dir, { recursive: true, force: true })))

packages/build/src/utils/blobs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { fdir } from 'fdir'
55

66
import { DEFAULT_API_HOST } from '../core/normalize_flags.js'
77

8-
import { FRAMEWORKS_API_BLOBS_ENDPOINT } from './frameworks_api.js'
8+
import { FRAMEWORKS_API_BLOBS_PATH } from './frameworks_api.js'
99

1010
const LEGACY_BLOBS_PATH = '.netlify/blobs/deploy'
1111
const DEPLOY_CONFIG_BLOBS_PATH = '.netlify/deploy/v1/blobs/deploy'
@@ -60,7 +60,7 @@ export const getBlobsEnvironmentContext = ({
6060
*/
6161
export const scanForBlobs = async function (buildDir: string, packagePath?: string) {
6262
// We start by looking for files using the Frameworks API.
63-
const frameworkBlobsDir = path.resolve(buildDir, packagePath || '', FRAMEWORKS_API_BLOBS_ENDPOINT, 'deploy')
63+
const frameworkBlobsDir = path.resolve(buildDir, packagePath || '', FRAMEWORKS_API_BLOBS_PATH, 'deploy')
6464
const frameworkBlobsDirScan = await new fdir().onlyCounts().crawl(frameworkBlobsDir).withPromise()
6565

6666
if (frameworkBlobsDirScan.files > 0) {

packages/build/src/utils/frameworks_api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { basename, dirname, resolve, sep } from 'node:path'
22

33
import { fdir } from 'fdir'
44

5-
export const FRAMEWORKS_API_ENDPOINT = '.netlify/v1'
6-
export const FRAMEWORKS_API_BLOBS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/blobs`
7-
export const FRAMEWORKS_API_CONFIG_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/config.json`
8-
export const FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/edge-functions`
5+
export const FRAMEWORKS_API_PATH = '.netlify/v1'
6+
export const FRAMEWORKS_API_BLOBS_PATH = `${FRAMEWORKS_API_PATH}/blobs`
7+
export const FRAMEWORKS_API_CONFIG_PATH = `${FRAMEWORKS_API_PATH}/config.json`
8+
export const FRAMEWORKS_API_EDGE_FUNCTIONS_PATH = `${FRAMEWORKS_API_PATH}/edge-functions`
99
export const FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP = 'import_map.json'
10-
export const FRAMEWORKS_API_FUNCTIONS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/functions`
11-
export const FRAMEWORKS_API_SKEW_PROTECTION_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/skew-protection.json`
10+
export const FRAMEWORKS_API_FUNCTIONS_PATH = `${FRAMEWORKS_API_PATH}/functions`
11+
export const FRAMEWORKS_API_SKEW_PROTECTION_PATH = `${FRAMEWORKS_API_PATH}/skew-protection.json`
1212

1313
export const DEPLOY_CONFIG_DIST_PATH = '.netlify/deploy-config/deploy-config.json'
1414

0 commit comments

Comments
 (0)