@netlify/dev 4.3.7 → 4.4.0
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.
- package/dist/main.cjs +27 -9
- package/dist/main.d.cts +8 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.js +27 -9
- package/package.json +2 -2
package/dist/main.cjs
CHANGED
|
@@ -295,6 +295,7 @@ var getRuntime = async ({ blobs, deployID, projectRoot, siteID }) => {
|
|
|
295
295
|
});
|
|
296
296
|
return {
|
|
297
297
|
env,
|
|
298
|
+
envSnapshot,
|
|
298
299
|
stop: async () => {
|
|
299
300
|
restoreEnvironment(envSnapshot);
|
|
300
301
|
await blobsServer?.stop();
|
|
@@ -315,6 +316,7 @@ var NetlifyDev = class {
|
|
|
315
316
|
#config;
|
|
316
317
|
#features;
|
|
317
318
|
#headersHandler;
|
|
319
|
+
#imageRemoteURLPatterns;
|
|
318
320
|
#imageHandler;
|
|
319
321
|
#logger;
|
|
320
322
|
#projectRoot;
|
|
@@ -343,6 +345,7 @@ var NetlifyDev = class {
|
|
|
343
345
|
static: options.staticFiles?.enabled !== false
|
|
344
346
|
};
|
|
345
347
|
this.#functionsServePath = import_node_path2.default.join(projectRoot, ".netlify", "functions-serve");
|
|
348
|
+
this.#imageRemoteURLPatterns = options.images?.remoteURLPatterns ?? [];
|
|
346
349
|
this.#logger = options.logger ?? globalThis.console;
|
|
347
350
|
this.#serverAddress = options.serverAddress;
|
|
348
351
|
this.#projectRoot = projectRoot;
|
|
@@ -543,19 +546,31 @@ var NetlifyDev = class {
|
|
|
543
546
|
});
|
|
544
547
|
}
|
|
545
548
|
if (this.#features.edgeFunctions) {
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
+
const edgeFunctionsEnv = {
|
|
550
|
+
// User-defined env vars + documented runtime env vars
|
|
551
|
+
...Object.entries(envVariables).reduce(
|
|
552
|
+
(acc, [key, variable]) => ({
|
|
549
553
|
...acc,
|
|
550
554
|
[key]: variable.value
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
}),
|
|
556
|
+
{}
|
|
557
|
+
),
|
|
558
|
+
// Add runtime env vars that we've set ourselves so far. These are "internal" env vars,
|
|
559
|
+
// part of the runtime emulation. They've already been populated on this process's env, which
|
|
560
|
+
// is needed to make other dev features work. These are different than the "documented" runtime
|
|
561
|
+
// env vars, in that they are implementation details, needed to make our features work.
|
|
562
|
+
...Object.keys(runtime.envSnapshot).reduce(
|
|
563
|
+
(acc, key) => ({
|
|
564
|
+
...acc,
|
|
565
|
+
[key]: runtime.env.get(key) ?? ""
|
|
566
|
+
}),
|
|
567
|
+
{}
|
|
568
|
+
)
|
|
569
|
+
};
|
|
555
570
|
const edgeFunctionsHandler = new import_dev.EdgeFunctionsHandler({
|
|
556
571
|
configDeclarations: this.#config?.config.edge_functions ?? [],
|
|
557
572
|
directories: [this.#config?.config.build.edge_functions].filter(Boolean),
|
|
558
|
-
env,
|
|
573
|
+
env: edgeFunctionsEnv,
|
|
559
574
|
geolocation: import_dev_utils.mockLocation,
|
|
560
575
|
logger: this.#logger,
|
|
561
576
|
siteID,
|
|
@@ -606,8 +621,11 @@ var NetlifyDev = class {
|
|
|
606
621
|
});
|
|
607
622
|
}
|
|
608
623
|
if (this.#features.images) {
|
|
624
|
+
const remoteImages = [...this.#config?.config?.images?.remote_images ?? [], ...this.#imageRemoteURLPatterns];
|
|
609
625
|
this.#imageHandler = new import_images.ImageHandler({
|
|
610
|
-
imagesConfig:
|
|
626
|
+
imagesConfig: {
|
|
627
|
+
remote_images: remoteImages
|
|
628
|
+
},
|
|
611
629
|
logger: this.#logger
|
|
612
630
|
});
|
|
613
631
|
}
|
package/dist/main.d.cts
CHANGED
|
@@ -50,6 +50,14 @@ interface Features {
|
|
|
50
50
|
*/
|
|
51
51
|
images?: {
|
|
52
52
|
enabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Allowed URL patterns for remote images, described as an array of regular
|
|
55
|
+
* expression strings. This list will be merged with the `remote_images`
|
|
56
|
+
* configuration property.
|
|
57
|
+
*
|
|
58
|
+
* {@link} https://docs.netlify.com/image-cdn/overview/#remote-path
|
|
59
|
+
*/
|
|
60
|
+
remoteURLPatterns?: string[];
|
|
53
61
|
};
|
|
54
62
|
/**
|
|
55
63
|
* Configuration options for Netlify redirects and rewrites.
|
package/dist/main.d.ts
CHANGED
|
@@ -50,6 +50,14 @@ interface Features {
|
|
|
50
50
|
*/
|
|
51
51
|
images?: {
|
|
52
52
|
enabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Allowed URL patterns for remote images, described as an array of regular
|
|
55
|
+
* expression strings. This list will be merged with the `remote_images`
|
|
56
|
+
* configuration property.
|
|
57
|
+
*
|
|
58
|
+
* {@link} https://docs.netlify.com/image-cdn/overview/#remote-path
|
|
59
|
+
*/
|
|
60
|
+
remoteURLPatterns?: string[];
|
|
53
61
|
};
|
|
54
62
|
/**
|
|
55
63
|
* Configuration options for Netlify redirects and rewrites.
|
package/dist/main.js
CHANGED
|
@@ -261,6 +261,7 @@ var getRuntime = async ({ blobs, deployID, projectRoot, siteID }) => {
|
|
|
261
261
|
});
|
|
262
262
|
return {
|
|
263
263
|
env,
|
|
264
|
+
envSnapshot,
|
|
264
265
|
stop: async () => {
|
|
265
266
|
restoreEnvironment(envSnapshot);
|
|
266
267
|
await blobsServer?.stop();
|
|
@@ -281,6 +282,7 @@ var NetlifyDev = class {
|
|
|
281
282
|
#config;
|
|
282
283
|
#features;
|
|
283
284
|
#headersHandler;
|
|
285
|
+
#imageRemoteURLPatterns;
|
|
284
286
|
#imageHandler;
|
|
285
287
|
#logger;
|
|
286
288
|
#projectRoot;
|
|
@@ -309,6 +311,7 @@ var NetlifyDev = class {
|
|
|
309
311
|
static: options.staticFiles?.enabled !== false
|
|
310
312
|
};
|
|
311
313
|
this.#functionsServePath = path2.join(projectRoot, ".netlify", "functions-serve");
|
|
314
|
+
this.#imageRemoteURLPatterns = options.images?.remoteURLPatterns ?? [];
|
|
312
315
|
this.#logger = options.logger ?? globalThis.console;
|
|
313
316
|
this.#serverAddress = options.serverAddress;
|
|
314
317
|
this.#projectRoot = projectRoot;
|
|
@@ -509,19 +512,31 @@ var NetlifyDev = class {
|
|
|
509
512
|
});
|
|
510
513
|
}
|
|
511
514
|
if (this.#features.edgeFunctions) {
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
515
|
+
const edgeFunctionsEnv = {
|
|
516
|
+
// User-defined env vars + documented runtime env vars
|
|
517
|
+
...Object.entries(envVariables).reduce(
|
|
518
|
+
(acc, [key, variable]) => ({
|
|
515
519
|
...acc,
|
|
516
520
|
[key]: variable.value
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
+
}),
|
|
522
|
+
{}
|
|
523
|
+
),
|
|
524
|
+
// Add runtime env vars that we've set ourselves so far. These are "internal" env vars,
|
|
525
|
+
// part of the runtime emulation. They've already been populated on this process's env, which
|
|
526
|
+
// is needed to make other dev features work. These are different than the "documented" runtime
|
|
527
|
+
// env vars, in that they are implementation details, needed to make our features work.
|
|
528
|
+
...Object.keys(runtime.envSnapshot).reduce(
|
|
529
|
+
(acc, key) => ({
|
|
530
|
+
...acc,
|
|
531
|
+
[key]: runtime.env.get(key) ?? ""
|
|
532
|
+
}),
|
|
533
|
+
{}
|
|
534
|
+
)
|
|
535
|
+
};
|
|
521
536
|
const edgeFunctionsHandler = new EdgeFunctionsHandler({
|
|
522
537
|
configDeclarations: this.#config?.config.edge_functions ?? [],
|
|
523
538
|
directories: [this.#config?.config.build.edge_functions].filter(Boolean),
|
|
524
|
-
env,
|
|
539
|
+
env: edgeFunctionsEnv,
|
|
525
540
|
geolocation: mockLocation,
|
|
526
541
|
logger: this.#logger,
|
|
527
542
|
siteID,
|
|
@@ -572,8 +587,11 @@ var NetlifyDev = class {
|
|
|
572
587
|
});
|
|
573
588
|
}
|
|
574
589
|
if (this.#features.images) {
|
|
590
|
+
const remoteImages = [...this.#config?.config?.images?.remote_images ?? [], ...this.#imageRemoteURLPatterns];
|
|
575
591
|
this.#imageHandler = new ImageHandler({
|
|
576
|
-
imagesConfig:
|
|
592
|
+
imagesConfig: {
|
|
593
|
+
remote_images: remoteImages
|
|
594
|
+
},
|
|
577
595
|
logger: this.#logger
|
|
578
596
|
});
|
|
579
597
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/dev",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Emulation of the Netlify environment for local development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@netlify/edge-functions": "2.15.6",
|
|
59
59
|
"@netlify/functions": "4.1.10",
|
|
60
60
|
"@netlify/headers": "2.0.4",
|
|
61
|
-
"@netlify/images": "1.
|
|
61
|
+
"@netlify/images": "1.2.0",
|
|
62
62
|
"@netlify/redirects": "3.0.4",
|
|
63
63
|
"@netlify/runtime": "4.0.8",
|
|
64
64
|
"@netlify/static": "3.0.4",
|