@netlify/dev 4.12.1 → 4.14.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 CHANGED
@@ -45,6 +45,7 @@ var import_headers = require("@netlify/headers");
45
45
  var import_images = require("@netlify/images");
46
46
  var import_redirects = require("@netlify/redirects");
47
47
  var import_static = require("@netlify/static");
48
+ var import_db_dev = require("@netlify/db-dev");
48
49
 
49
50
  // src/lib/env.ts
50
51
  var SUPPORTED_CONTEXTS = ["all", "production", "deploy-preview", "branch-deploy", "dev", "dev-server"];
@@ -327,6 +328,7 @@ var NetlifyDev = class {
327
328
  #functionsServePath;
328
329
  #config;
329
330
  #features;
331
+ #db;
330
332
  #headersHandler;
331
333
  #imageRemoteURLPatterns;
332
334
  #imageHandler;
@@ -541,14 +543,15 @@ var NetlifyDev = class {
541
543
  this.#cleanupJobs.push(() => runtime.stop());
542
544
  if (this.#features.db) {
543
545
  try {
544
- const { NetlifyDB } = await import("@netlify/db-dev");
545
546
  const dbDirectory = import_node_path2.default.join(this.#projectRoot, ".netlify", "db");
546
- const db = new NetlifyDB({ directory: dbDirectory });
547
+ const db = new import_db_dev.NetlifyDB({ directory: dbDirectory });
547
548
  const connectionString = await db.start();
548
549
  runtime.env.set("NETLIFY_DB_URL", connectionString);
550
+ this.#db = db;
549
551
  this.#cleanupJobs.push(() => db.stop());
550
- } catch {
551
- this.#logger.warn("To use Netlify DB locally, install the @netlify/db-dev package.");
552
+ } catch (error) {
553
+ this.#db = void 0;
554
+ this.#logger.warn(`Failed to start Netlify DB locally: ${String(error)}`);
552
555
  }
553
556
  }
554
557
  if (this.#features.aiGateway && config?.siteInfo?.capabilities?.ai_gateway_disabled) {
@@ -698,6 +701,9 @@ var NetlifyDev = class {
698
701
  serverAddress
699
702
  };
700
703
  }
704
+ get db() {
705
+ return this.#db;
706
+ }
701
707
  async stop() {
702
708
  await Promise.allSettled(this.#cleanupJobs.map((task) => task()));
703
709
  }
package/dist/main.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { IncomingMessage } from 'node:http';
2
2
  import { Logger } from '@netlify/dev-utils';
3
3
  import { HeadersCollector } from '@netlify/headers';
4
+ import { NetlifyDB } from '@netlify/db-dev';
4
5
 
5
6
  interface Features {
6
7
  /**
@@ -175,6 +176,7 @@ declare class NetlifyDev {
175
176
  start(): Promise<{
176
177
  serverAddress: string | undefined;
177
178
  }>;
179
+ get db(): NetlifyDB | undefined;
178
180
  stop(): Promise<void>;
179
181
  getEnabledFeatures(): string[];
180
182
  }
package/dist/main.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { IncomingMessage } from 'node:http';
2
2
  import { Logger } from '@netlify/dev-utils';
3
3
  import { HeadersCollector } from '@netlify/headers';
4
+ import { NetlifyDB } from '@netlify/db-dev';
4
5
 
5
6
  interface Features {
6
7
  /**
@@ -175,6 +176,7 @@ declare class NetlifyDev {
175
176
  start(): Promise<{
176
177
  serverAddress: string | undefined;
177
178
  }>;
179
+ get db(): NetlifyDB | undefined;
178
180
  stop(): Promise<void>;
179
181
  getEnabledFeatures(): string[];
180
182
  }
package/dist/main.js CHANGED
@@ -17,6 +17,7 @@ import { HeadersHandler } from "@netlify/headers";
17
17
  import { ImageHandler } from "@netlify/images";
18
18
  import { RedirectsHandler } from "@netlify/redirects";
19
19
  import { StaticHandler } from "@netlify/static";
20
+ import { NetlifyDB } from "@netlify/db-dev";
20
21
 
21
22
  // src/lib/env.ts
22
23
  var SUPPORTED_CONTEXTS = ["all", "production", "deploy-preview", "branch-deploy", "dev", "dev-server"];
@@ -299,6 +300,7 @@ var NetlifyDev = class {
299
300
  #functionsServePath;
300
301
  #config;
301
302
  #features;
303
+ #db;
302
304
  #headersHandler;
303
305
  #imageRemoteURLPatterns;
304
306
  #imageHandler;
@@ -513,14 +515,15 @@ var NetlifyDev = class {
513
515
  this.#cleanupJobs.push(() => runtime.stop());
514
516
  if (this.#features.db) {
515
517
  try {
516
- const { NetlifyDB } = await import("@netlify/db-dev");
517
518
  const dbDirectory = path2.join(this.#projectRoot, ".netlify", "db");
518
519
  const db = new NetlifyDB({ directory: dbDirectory });
519
520
  const connectionString = await db.start();
520
521
  runtime.env.set("NETLIFY_DB_URL", connectionString);
522
+ this.#db = db;
521
523
  this.#cleanupJobs.push(() => db.stop());
522
- } catch {
523
- this.#logger.warn("To use Netlify DB locally, install the @netlify/db-dev package.");
524
+ } catch (error) {
525
+ this.#db = void 0;
526
+ this.#logger.warn(`Failed to start Netlify DB locally: ${String(error)}`);
524
527
  }
525
528
  }
526
529
  if (this.#features.aiGateway && config?.siteInfo?.capabilities?.ai_gateway_disabled) {
@@ -670,6 +673,9 @@ var NetlifyDev = class {
670
673
  serverAddress
671
674
  };
672
675
  }
676
+ get db() {
677
+ return this.#db;
678
+ }
673
679
  async stop() {
674
680
  await Promise.allSettled(this.#cleanupJobs.map((task) => task()));
675
681
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/dev",
3
- "version": "4.12.1",
3
+ "version": "4.14.0",
4
4
  "description": "Emulation of the Netlify environment for local development",
5
5
  "type": "module",
6
6
  "engines": {
@@ -51,7 +51,6 @@
51
51
  "author": "Netlify Inc.",
52
52
  "devDependencies": {
53
53
  "@netlify/api": "^14.0.17",
54
- "@netlify/db-dev": "0.4.0",
55
54
  "@netlify/types": "2.3.0",
56
55
  "tsup": "^8.0.0",
57
56
  "vitest": "^3.0.0"
@@ -60,6 +59,7 @@
60
59
  "@netlify/ai": "^0.4.0",
61
60
  "@netlify/blobs": "10.7.0",
62
61
  "@netlify/config": "^24.4.0",
62
+ "@netlify/db-dev": "0.4.0",
63
63
  "@netlify/dev-utils": "4.3.3",
64
64
  "@netlify/edge-functions-dev": "1.0.11",
65
65
  "@netlify/functions-dev": "1.1.12",
@@ -69,13 +69,5 @@
69
69
  "@netlify/runtime": "4.1.16",
70
70
  "@netlify/static": "3.1.3",
71
71
  "ulid": "^3.0.0"
72
- },
73
- "peerDependencies": {
74
- "@netlify/db-dev": "0.2.0"
75
- },
76
- "peerDependenciesMeta": {
77
- "@netlify/db-dev": {
78
- "optional": true
79
- }
80
72
  }
81
73
  }