@netlify/dev 4.14.0 → 4.15.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 +30 -2
- package/dist/main.js +33 -3
- package/package.json +11 -11
package/dist/main.cjs
CHANGED
|
@@ -534,6 +534,29 @@ var NetlifyDev = class {
|
|
|
534
534
|
this.#siteID = siteID;
|
|
535
535
|
const config = await this.getConfig();
|
|
536
536
|
this.#config = config;
|
|
537
|
+
const reactiveConfig = new import_dev_utils.Reactive(config);
|
|
538
|
+
const fileWatcher = new import_dev_utils.FileWatcher();
|
|
539
|
+
this.#cleanupJobs.push(() => fileWatcher.close());
|
|
540
|
+
if (config.configPath) {
|
|
541
|
+
const reloadConfig = () => {
|
|
542
|
+
void (async () => {
|
|
543
|
+
try {
|
|
544
|
+
const newConfig = await this.getConfig();
|
|
545
|
+
this.#config = newConfig;
|
|
546
|
+
reactiveConfig.set(newConfig);
|
|
547
|
+
} catch (error) {
|
|
548
|
+
this.#logger.warn(`Failed to reload config: ${String(error)}`);
|
|
549
|
+
}
|
|
550
|
+
})();
|
|
551
|
+
};
|
|
552
|
+
fileWatcher.subscribe({
|
|
553
|
+
id: "netlify-config",
|
|
554
|
+
paths: config.configPath,
|
|
555
|
+
onChange: reloadConfig,
|
|
556
|
+
onAdd: reloadConfig,
|
|
557
|
+
onUnlink: reloadConfig
|
|
558
|
+
});
|
|
559
|
+
}
|
|
537
560
|
const runtime = await getRuntime({
|
|
538
561
|
blobs: this.#features.blobs,
|
|
539
562
|
deployID: "0",
|
|
@@ -547,8 +570,12 @@ var NetlifyDev = class {
|
|
|
547
570
|
const db = new import_db_dev.NetlifyDB({ directory: dbDirectory });
|
|
548
571
|
const connectionString = await db.start();
|
|
549
572
|
runtime.env.set("NETLIFY_DB_URL", connectionString);
|
|
573
|
+
state.set("dbConnectionString", connectionString);
|
|
550
574
|
this.#db = db;
|
|
551
|
-
this.#cleanupJobs.push(() =>
|
|
575
|
+
this.#cleanupJobs.push(async () => {
|
|
576
|
+
await db.stop();
|
|
577
|
+
state.delete("dbConnectionString");
|
|
578
|
+
});
|
|
552
579
|
} catch (error) {
|
|
553
580
|
this.#db = void 0;
|
|
554
581
|
this.#logger.warn(`Failed to start Netlify DB locally: ${String(error)}`);
|
|
@@ -652,8 +679,9 @@ var NetlifyDev = class {
|
|
|
652
679
|
state
|
|
653
680
|
});
|
|
654
681
|
this.#functionsHandler = new import_functions_dev.FunctionsHandler({
|
|
655
|
-
config:
|
|
682
|
+
config: reactiveConfig,
|
|
656
683
|
destPath: this.#functionsServePath,
|
|
684
|
+
fileWatcher,
|
|
657
685
|
geolocation,
|
|
658
686
|
projectRoot: this.#projectRoot,
|
|
659
687
|
settings: {},
|
package/dist/main.js
CHANGED
|
@@ -6,10 +6,12 @@ import { parseAIGatewayContext, setupAIGateway } from "@netlify/ai/bootstrap";
|
|
|
6
6
|
import { resolveConfig } from "@netlify/config";
|
|
7
7
|
import {
|
|
8
8
|
ensureNetlifyIgnore,
|
|
9
|
+
FileWatcher,
|
|
9
10
|
getAPIToken,
|
|
10
11
|
getGeoLocation,
|
|
11
12
|
LocalState,
|
|
12
|
-
HTTPServer
|
|
13
|
+
HTTPServer,
|
|
14
|
+
Reactive
|
|
13
15
|
} from "@netlify/dev-utils";
|
|
14
16
|
import { EdgeFunctionsHandler } from "@netlify/edge-functions-dev";
|
|
15
17
|
import { FunctionsHandler } from "@netlify/functions-dev";
|
|
@@ -506,6 +508,29 @@ var NetlifyDev = class {
|
|
|
506
508
|
this.#siteID = siteID;
|
|
507
509
|
const config = await this.getConfig();
|
|
508
510
|
this.#config = config;
|
|
511
|
+
const reactiveConfig = new Reactive(config);
|
|
512
|
+
const fileWatcher = new FileWatcher();
|
|
513
|
+
this.#cleanupJobs.push(() => fileWatcher.close());
|
|
514
|
+
if (config.configPath) {
|
|
515
|
+
const reloadConfig = () => {
|
|
516
|
+
void (async () => {
|
|
517
|
+
try {
|
|
518
|
+
const newConfig = await this.getConfig();
|
|
519
|
+
this.#config = newConfig;
|
|
520
|
+
reactiveConfig.set(newConfig);
|
|
521
|
+
} catch (error) {
|
|
522
|
+
this.#logger.warn(`Failed to reload config: ${String(error)}`);
|
|
523
|
+
}
|
|
524
|
+
})();
|
|
525
|
+
};
|
|
526
|
+
fileWatcher.subscribe({
|
|
527
|
+
id: "netlify-config",
|
|
528
|
+
paths: config.configPath,
|
|
529
|
+
onChange: reloadConfig,
|
|
530
|
+
onAdd: reloadConfig,
|
|
531
|
+
onUnlink: reloadConfig
|
|
532
|
+
});
|
|
533
|
+
}
|
|
509
534
|
const runtime = await getRuntime({
|
|
510
535
|
blobs: this.#features.blobs,
|
|
511
536
|
deployID: "0",
|
|
@@ -519,8 +544,12 @@ var NetlifyDev = class {
|
|
|
519
544
|
const db = new NetlifyDB({ directory: dbDirectory });
|
|
520
545
|
const connectionString = await db.start();
|
|
521
546
|
runtime.env.set("NETLIFY_DB_URL", connectionString);
|
|
547
|
+
state.set("dbConnectionString", connectionString);
|
|
522
548
|
this.#db = db;
|
|
523
|
-
this.#cleanupJobs.push(() =>
|
|
549
|
+
this.#cleanupJobs.push(async () => {
|
|
550
|
+
await db.stop();
|
|
551
|
+
state.delete("dbConnectionString");
|
|
552
|
+
});
|
|
524
553
|
} catch (error) {
|
|
525
554
|
this.#db = void 0;
|
|
526
555
|
this.#logger.warn(`Failed to start Netlify DB locally: ${String(error)}`);
|
|
@@ -624,8 +653,9 @@ var NetlifyDev = class {
|
|
|
624
653
|
state
|
|
625
654
|
});
|
|
626
655
|
this.#functionsHandler = new FunctionsHandler({
|
|
627
|
-
config:
|
|
656
|
+
config: reactiveConfig,
|
|
628
657
|
destPath: this.#functionsServePath,
|
|
658
|
+
fileWatcher,
|
|
629
659
|
geolocation,
|
|
630
660
|
projectRoot: this.#projectRoot,
|
|
631
661
|
settings: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/dev",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.0",
|
|
4
4
|
"description": "Emulation of the Netlify environment for local development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@netlify/ai": "^0.4.0",
|
|
60
|
-
"@netlify/blobs": "10.7.
|
|
60
|
+
"@netlify/blobs": "10.7.1",
|
|
61
61
|
"@netlify/config": "^24.4.0",
|
|
62
|
-
"@netlify/db-dev": "0.
|
|
63
|
-
"@netlify/dev-utils": "4.
|
|
64
|
-
"@netlify/edge-functions-dev": "1.0.
|
|
65
|
-
"@netlify/functions-dev": "1.
|
|
66
|
-
"@netlify/headers": "2.1.
|
|
67
|
-
"@netlify/images": "1.3.
|
|
68
|
-
"@netlify/redirects": "3.1.
|
|
69
|
-
"@netlify/runtime": "4.1.
|
|
70
|
-
"@netlify/static": "3.1.
|
|
62
|
+
"@netlify/db-dev": "0.6.0",
|
|
63
|
+
"@netlify/dev-utils": "4.4.0",
|
|
64
|
+
"@netlify/edge-functions-dev": "1.0.12",
|
|
65
|
+
"@netlify/functions-dev": "1.2.0",
|
|
66
|
+
"@netlify/headers": "2.1.4",
|
|
67
|
+
"@netlify/images": "1.3.4",
|
|
68
|
+
"@netlify/redirects": "3.1.6",
|
|
69
|
+
"@netlify/runtime": "4.1.17",
|
|
70
|
+
"@netlify/static": "3.1.4",
|
|
71
71
|
"ulid": "^3.0.0"
|
|
72
72
|
}
|
|
73
73
|
}
|