@netlify/edge-bundler 14.2.0 → 14.2.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.
@@ -265,14 +265,14 @@ test('Loads function paths from the in-source `config` function', async () => {
265
265
  path: '/user-func1',
266
266
  headers: {
267
267
  'x-must-be-there': {
268
- style: 'exists',
268
+ matcher: 'exists',
269
269
  },
270
270
  'x-must-match': {
271
271
  pattern: '^(foo|bar)$',
272
- style: 'regex',
272
+ matcher: 'regex',
273
273
  },
274
274
  'x-must-not-be-there': {
275
- style: 'missing',
275
+ matcher: 'missing',
276
276
  },
277
277
  },
278
278
  });
@@ -2,9 +2,9 @@ import { FunctionConfig, HeadersConfig, HTTPMethod, Path } from './config.js';
2
2
  import { FeatureFlags } from './feature_flags.js';
3
3
  export type HeaderMatch = {
4
4
  pattern: string;
5
- style: 'regex';
5
+ matcher: 'regex';
6
6
  } | {
7
- style: 'exists' | 'missing';
7
+ matcher: 'exists' | 'missing';
8
8
  };
9
9
  type HeaderMatchers = Record<string, HeaderMatch>;
10
10
  interface BaseDeclaration {
@@ -130,10 +130,10 @@ export const getHeaderMatchers = (headers) => {
130
130
  }
131
131
  for (const header in headers) {
132
132
  if (typeof headers[header] === 'boolean') {
133
- matchers[header] = { style: headers[header] ? 'exists' : 'missing' };
133
+ matchers[header] = { matcher: headers[header] ? 'exists' : 'missing' };
134
134
  }
135
135
  else if (typeof headers[header] === 'string') {
136
- matchers[header] = { style: 'regex', pattern: normalizePattern(headers[header]) };
136
+ matchers[header] = { matcher: 'regex', pattern: normalizePattern(headers[header]) };
137
137
  }
138
138
  else {
139
139
  throw new BundleError(new Error(headerConfigError));
@@ -215,11 +215,11 @@ test('excludedPath from ISC goes into function_config, TOML goes into routes', (
215
215
  },
216
216
  });
217
217
  const matcher = getRouteMatcher(manifest);
218
- expect(matcher('/showcases/boho-style')).toBeDefined();
218
+ expect(matcher('/showcases/boho-matcher')).toBeDefined();
219
219
  expect(matcher('/checkout/address')).toBeDefined();
220
220
  expect(matcher('/checkout/terms-and-conditions')).toBeUndefined();
221
221
  expect(matcher('/checkout/scrooge-mc-duck-animation.css')).toBeUndefined();
222
- expect(matcher('/showcases/boho-style/expensive-chair.jpg')).toBeUndefined();
222
+ expect(matcher('/showcases/boho-matcher/expensive-chair.jpg')).toBeUndefined();
223
223
  });
224
224
  test('URLPattern named groups are supported', () => {
225
225
  const functions = [{ name: 'customisation', path: '/path/to/customisation.ts' }];
@@ -570,25 +570,25 @@ describe('Header matching', () => {
570
570
  path: '/f1/*',
571
571
  headers: {
572
572
  'x-absent': {
573
- style: 'missing',
573
+ matcher: 'missing',
574
574
  },
575
575
  'x-also-present': {
576
- style: 'exists',
576
+ matcher: 'exists',
577
577
  },
578
578
  'x-match-exact': {
579
579
  pattern: '^exact$',
580
- style: 'regex',
580
+ matcher: 'regex',
581
581
  },
582
582
  'x-match-prefix': {
583
583
  pattern: '^prefix(.*)$',
584
- style: 'regex',
584
+ matcher: 'regex',
585
585
  },
586
586
  'x-match-suffix': {
587
587
  pattern: '^(.*)suffix$',
588
- style: 'regex',
588
+ matcher: 'regex',
589
589
  },
590
590
  'x-present': {
591
- style: 'exists',
591
+ matcher: 'exists',
592
592
  },
593
593
  },
594
594
  },
@@ -143,35 +143,35 @@ describe('import map URL', () => {
143
143
  });
144
144
  });
145
145
  describe('route headers', () => {
146
- test('should accept valid headers with exists style', () => {
146
+ test('should accept valid headers with exists matcher', () => {
147
147
  const manifest = getBaseManifest();
148
148
  manifest.routes[0].headers = {
149
149
  'x-custom-header': {
150
- style: 'exists',
150
+ matcher: 'exists',
151
151
  },
152
152
  };
153
153
  expect(() => validateManifest(manifest)).not.toThrowError();
154
154
  });
155
- test('should accept valid headers with missing style', () => {
155
+ test('should accept valid headers with missing matcher', () => {
156
156
  const manifest = getBaseManifest();
157
157
  manifest.routes[0].headers = {
158
158
  'x-custom-header': {
159
- style: 'missing',
159
+ matcher: 'missing',
160
160
  },
161
161
  };
162
162
  expect(() => validateManifest(manifest)).not.toThrowError();
163
163
  });
164
- test('should accept valid headers with regex style and pattern', () => {
164
+ test('should accept valid headers with regex matcher and pattern', () => {
165
165
  const manifest = getBaseManifest();
166
166
  manifest.routes[0].headers = {
167
167
  'x-custom-header': {
168
- style: 'regex',
168
+ matcher: 'regex',
169
169
  pattern: '^Bearer .+$',
170
170
  },
171
171
  };
172
172
  expect(() => validateManifest(manifest)).not.toThrowError();
173
173
  });
174
- test('should throw on missing style property', () => {
174
+ test('should throw on missing matcher property', () => {
175
175
  const manifest = getBaseManifest();
176
176
  manifest.routes[0].headers = {
177
177
  'x-custom-header': {
@@ -180,20 +180,20 @@ describe('route headers', () => {
180
180
  };
181
181
  expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot();
182
182
  });
183
- test('should throw on invalid style value', () => {
183
+ test('should throw on invalid matcher value', () => {
184
184
  const manifest = getBaseManifest();
185
185
  manifest.routes[0].headers = {
186
186
  'x-custom-header': {
187
- style: 'invalid',
187
+ matcher: 'invalid',
188
188
  },
189
189
  };
190
190
  expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot();
191
191
  });
192
- test('should throw when style is regex but pattern is missing', () => {
192
+ test('should throw when matcher is regex but pattern is missing', () => {
193
193
  const manifest = getBaseManifest();
194
194
  manifest.routes[0].headers = {
195
195
  'x-custom-header': {
196
- style: 'regex',
196
+ matcher: 'regex',
197
197
  },
198
198
  };
199
199
  expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot();
@@ -202,7 +202,7 @@ describe('route headers', () => {
202
202
  const manifest = getBaseManifest();
203
203
  manifest.routes[0].headers = {
204
204
  'x-custom-header': {
205
- style: 'regex',
205
+ matcher: 'regex',
206
206
  pattern: '/^Bearer .+/',
207
207
  },
208
208
  };
@@ -212,23 +212,23 @@ describe('route headers', () => {
212
212
  const manifest = getBaseManifest();
213
213
  manifest.routes[0].headers = {
214
214
  'x-custom-header': {
215
- style: 'exists',
215
+ matcher: 'exists',
216
216
  foo: 'bar',
217
217
  },
218
218
  };
219
219
  expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot();
220
220
  });
221
- test('should accept multiple headers with different styles', () => {
221
+ test('should accept multiple headers with different matchers', () => {
222
222
  const manifest = getBaseManifest();
223
223
  manifest.routes[0].headers = {
224
224
  'x-exists-header': {
225
- style: 'exists',
225
+ matcher: 'exists',
226
226
  },
227
227
  'x-missing-header': {
228
- style: 'missing',
228
+ matcher: 'missing',
229
229
  },
230
230
  authorization: {
231
- style: 'regex',
231
+ matcher: 'regex',
232
232
  pattern: '^Bearer [a-zA-Z0-9]+$',
233
233
  },
234
234
  };
@@ -68,7 +68,7 @@ declare const edgeManifestSchema: {
68
68
  type: string;
69
69
  format: string;
70
70
  };
71
- style: {
71
+ matcher: {
72
72
  type: string;
73
73
  enum: string[];
74
74
  };
@@ -76,7 +76,7 @@ declare const edgeManifestSchema: {
76
76
  additionalProperties: boolean;
77
77
  if: {
78
78
  properties: {
79
- style: {
79
+ matcher: {
80
80
  const: string;
81
81
  };
82
82
  };
@@ -141,7 +141,7 @@ declare const edgeManifestSchema: {
141
141
  type: string;
142
142
  format: string;
143
143
  };
144
- style: {
144
+ matcher: {
145
145
  type: string;
146
146
  enum: string[];
147
147
  };
@@ -149,7 +149,7 @@ declare const edgeManifestSchema: {
149
149
  additionalProperties: boolean;
150
150
  if: {
151
151
  properties: {
152
- style: {
152
+ matcher: {
153
153
  const: string;
154
154
  };
155
155
  };
@@ -20,13 +20,13 @@ const headersSchema = {
20
20
  patternProperties: {
21
21
  '.*': {
22
22
  type: 'object',
23
- required: ['style'],
23
+ required: ['matcher'],
24
24
  properties: {
25
25
  pattern: {
26
26
  type: 'string',
27
27
  format: 'regexPattern',
28
28
  },
29
- style: {
29
+ matcher: {
30
30
  type: 'string',
31
31
  enum: ['exists', 'missing', 'regex'],
32
32
  },
@@ -34,7 +34,7 @@ const headersSchema = {
34
34
  additionalProperties: false,
35
35
  if: {
36
36
  properties: {
37
- style: { const: 'regex' },
37
+ matcher: { const: 'regex' },
38
38
  },
39
39
  },
40
40
  then: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "14.2.0",
3
+ "version": "14.2.1",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.js",
@@ -81,5 +81,5 @@
81
81
  "urlpattern-polyfill": "8.0.2",
82
82
  "uuid": "^11.0.0"
83
83
  },
84
- "gitHead": "9ba8975b7363b7003117aa0b224ad0d129c11ef4"
84
+ "gitHead": "18c4e2a28edc081235558f151b4c2d41b8e204e8"
85
85
  }