Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: netlify/build
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f62a7f814decf726c329f3709d267020e3dfa4b8
Choose a base ref
...
head repository: netlify/build
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 454d87faac1d6f2b8dc790fd6476e57a735d8ae3
Choose a head ref
  • 4 commits
  • 18 files changed
  • 4 contributors

Commits on Jul 3, 2024

  1. feat: support 'pattern' in inline edge function config (#5749)

    * test: add test cases for using pattern and excludedPattern in edge function inline config
    
    * feat: support 'pattern' in inline edge function config
    
    * chore: update inline comment to reflect code changes
    pieh authored Jul 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c7a86d6 View commit details
  2. fix(deps): update dependency @netlify/blobs to ^7.4.0 (#5755)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jul 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6502384 View commit details

Commits on Jul 4, 2024

  1. fix: bump serverless-functions-api version with the fix (#5758)

    Lukas Holzer authored Jul 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    67e3208 View commit details
  2. chore: release main (#5754)

    netlify-circleci authored Jul 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    454d87f View commit details
8 changes: 4 additions & 4 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"packages/build-info": "7.14.0",
"packages/build": "29.50.4",
"packages/edge-bundler": "12.1.1",
"packages/build": "29.50.5",
"packages/edge-bundler": "12.2.0",
"packages/cache-utils": "5.1.5",
"packages/config": "20.16.0",
"packages/framework-info": "9.8.13",
"packages/functions-utils": "5.2.72",
"packages/functions-utils": "5.2.73",
"packages/git-utils": "5.1.1",
"packages/headers-parser": "7.1.4",
"packages/js-client": "13.1.20",
@@ -14,5 +14,5 @@
"packages/run-utils": "5.1.1",
"packages/opentelemetry-sdk-setup": "1.1.3",
"packages/opentelemetry-utils": "1.2.1",
"packages/zip-it-and-ship-it": "9.37.4"
"packages/zip-it-and-ship-it": "9.37.5"
}
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions packages/build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -105,6 +105,22 @@
* dependencies
* @netlify/config bumped from ^20.8.0 to ^20.8.1

## [29.50.5](https://github.com/netlify/build/compare/build-v29.50.4...build-v29.50.5) (2024-07-04)


### Bug Fixes

* **deps:** update dependency @netlify/blobs to ^7.4.0 ([#5755](https://github.com/netlify/build/issues/5755)) ([6502384](https://github.com/netlify/build/commit/65023846d51372f42095265550d737355983fbb7))


### Dependencies

* The following workspace dependencies were updated
* dependencies
* @netlify/edge-bundler bumped from 12.1.1 to 12.2.0
* @netlify/functions-utils bumped from ^5.2.72 to ^5.2.73
* @netlify/zip-it-and-ship-it bumped from 9.37.4 to 9.37.5

## [29.50.4](https://github.com/netlify/build/compare/build-v29.50.3...build-v29.50.4) (2024-07-03)


10 changes: 5 additions & 5 deletions packages/build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netlify/build",
"version": "29.50.4",
"version": "29.50.5",
"description": "Netlify build module",
"type": "module",
"exports": "./lib/index.js",
@@ -68,17 +68,17 @@
"license": "MIT",
"dependencies": {
"@bugsnag/js": "^7.0.0",
"@netlify/blobs": "^7.3.0",
"@netlify/blobs": "^7.4.0",
"@netlify/cache-utils": "^5.1.5",
"@netlify/config": "^20.16.0",
"@netlify/edge-bundler": "12.1.1",
"@netlify/edge-bundler": "12.2.0",
"@netlify/framework-info": "^9.8.13",
"@netlify/functions-utils": "^5.2.72",
"@netlify/functions-utils": "^5.2.73",
"@netlify/git-utils": "^5.1.1",
"@netlify/opentelemetry-utils": "^1.2.1",
"@netlify/plugins-list": "^6.80.0",
"@netlify/run-utils": "^5.1.1",
"@netlify/zip-it-and-ship-it": "9.37.4",
"@netlify/zip-it-and-ship-it": "9.37.5",
"@sindresorhus/slugify": "^2.0.0",
"ansi-escapes": "^6.0.0",
"chalk": "^5.0.0",
7 changes: 7 additions & 0 deletions packages/edge-bundler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [12.2.0](https://github.com/netlify/build/compare/edge-bundler-v12.1.1...edge-bundler-v12.2.0) (2024-07-04)


### Features

* support 'pattern' in inline edge function config ([#5749](https://github.com/netlify/build/issues/5749)) ([c7a86d6](https://github.com/netlify/build/commit/c7a86d611b82e424bec5bad76d6d647a04dfe4ac))

## [12.1.1](https://github.com/netlify/build/compare/edge-bundler-v12.1.0...edge-bundler-v12.1.1) (2024-06-24)


52 changes: 47 additions & 5 deletions packages/edge-bundler/node/config.test.ts
Original file line number Diff line number Diff line change
@@ -240,7 +240,7 @@ test('Loads function paths from the in-source `config` function', async () => {
})
const generatedFiles = await fs.readdir(distPath)

expect(result.functions.length).toBe(7)
expect(result.functions.length).toBe(11)
expect(generatedFiles.length).toBe(2)

const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8')
@@ -251,7 +251,7 @@ test('Loads function paths from the in-source `config` function', async () => {
expect(bundles[0].format).toBe('eszip2')
expect(generatedFiles.includes(bundles[0].asset)).toBe(true)

expect(routes.length).toBe(6)
expect(routes.length).toBe(12)
expect(routes[0]).toEqual({
function: 'framework-func2',
pattern: '^/framework-func2/?$',
@@ -272,24 +272,54 @@ test('Loads function paths from the in-source `config` function', async () => {
path: '/framework-func1',
})
expect(routes[3]).toEqual({
function: 'framework-func3',
pattern: '^/framework-func3(/.*)?$',
excluded_patterns: ['^/framework-func3/excluded$'],
})
expect(routes[4]).toEqual({
function: 'framework-func4',
pattern: '^/framework-func4(/.*)?$',
excluded_patterns: ['^/framework-func4/excluded$', '^/framework-func4-alt/excluded$'],
})
expect(routes[5]).toEqual({
function: 'framework-func4',
pattern: '^/framework-func4-alt(/.*)?$',
excluded_patterns: ['^/framework-func4/excluded$', '^/framework-func4-alt/excluded$'],
})
expect(routes[6]).toEqual({
function: 'user-func1',
pattern: '^/user-func1/?$',
excluded_patterns: [],
path: '/user-func1',
})
expect(routes[4]).toEqual({
expect(routes[7]).toEqual({
function: 'user-func3',
pattern: '^/user-func3/?$',
excluded_patterns: [],
path: '/user-func3',
})
expect(routes[5]).toEqual({
expect(routes[8]).toEqual({
function: 'user-func5',
pattern: '^/user-func5(?:/(.*))/?$',
excluded_patterns: ['^/user-func5/excluded/?$'],
path: '/user-func5/*',
methods: ['GET'],
})
expect(routes[9]).toEqual({
function: 'user-func6',
pattern: '^/user-func6(/.*)?$',
excluded_patterns: ['^/user-func6/excluded$'],
})
expect(routes[10]).toEqual({
function: 'user-func7',
pattern: '^/user-func7(/.*)?$',
excluded_patterns: ['^/user-func7/excluded$', '^/user-func7-alt/excluded$'],
})
expect(routes[11]).toEqual({
function: 'user-func7',
pattern: '^/user-func7-alt(/.*)?$',
excluded_patterns: ['^/user-func7/excluded$', '^/user-func7-alt/excluded$'],
})

expect(postCacheRoutes.length).toBe(1)
expect(postCacheRoutes[0]).toEqual({
@@ -300,10 +330,22 @@ test('Loads function paths from the in-source `config` function', async () => {
methods: ['POST', 'PUT'],
})

expect(Object.keys(functionConfig)).toHaveLength(1)
expect(Object.keys(functionConfig)).toHaveLength(5)
expect(functionConfig['user-func5']).toEqual({
excluded_patterns: ['^/user-func5/excluded/?$'],
})
expect(functionConfig['user-func6']).toEqual({
excluded_patterns: ['^/user-func6/excluded$'],
})
expect(functionConfig['user-func7']).toEqual({
excluded_patterns: ['^/user-func7/excluded$', '^/user-func7-alt/excluded$'],
})
expect(functionConfig['framework-func3']).toEqual({
excluded_patterns: ['^/framework-func3/excluded$'],
})
expect(functionConfig['framework-func4']).toEqual({
excluded_patterns: ['^/framework-func4/excluded$', '^/framework-func4-alt/excluded$'],
})

await cleanup()
})
19 changes: 16 additions & 3 deletions packages/edge-bundler/node/config.ts
Original file line number Diff line number Diff line change
@@ -39,17 +39,30 @@ export const isValidOnError = (value: unknown): value is OnError => {
return value === 'fail' || value === 'bypass' || value.startsWith('/')
}

export interface FunctionConfig {
interface BaseFunctionConfig {
cache?: Cache
path?: Path | Path[]
excludedPath?: Path | Path[]
onError?: OnError
name?: string
generator?: string
method?: HTTPMethod | HTTPMethod[]
rateLimit?: RateLimit
}

interface FunctionConfigWithPath extends BaseFunctionConfig {
path?: Path | Path[]
excludedPath?: Path | Path[]
}

interface FunctionConfigWithPattern extends BaseFunctionConfig {
pattern: string | string[]
excludedPattern?: string | string[]
}

export type FunctionConfig = FunctionConfigWithPath | FunctionConfigWithPattern

export type FunctionConfigWithAllPossibleFields = BaseFunctionConfig &
Partial<FunctionConfigWithPath & FunctionConfigWithPattern>

const getConfigExtractor = () => {
const packagePath = getPackagePath()
const configExtractorPath = join(packagePath, 'deno', 'config.ts')
Loading