@netlify/dev 4.17.3 → 4.18.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.
package/dist/main.cjs CHANGED
@@ -32,6 +32,7 @@ var main_exports = {};
32
32
  __export(main_exports, {
33
33
  NetlifyDev: () => NetlifyDev,
34
34
  applyMigrations: () => import_database_dev2.applyMigrations,
35
+ initializeTrackingTable: () => import_database_dev2.initializeTrackingTable,
35
36
  resetDatabase: () => import_database_dev2.resetDatabase
36
37
  });
37
38
  module.exports = __toCommonJS(main_exports);
@@ -342,6 +343,7 @@ var NetlifyDev = class {
342
343
  #siteID;
343
344
  #staticHandler;
344
345
  #staticHandlerAdditionalDirectories;
346
+ #skipGitignore;
345
347
  constructor(options) {
346
348
  if (options.apiURL) {
347
349
  const apiURL = new URL(options.apiURL);
@@ -355,7 +357,7 @@ var NetlifyDev = class {
355
357
  this.#features = {
356
358
  aiGateway: options.aiGateway?.enabled !== false,
357
359
  blobs: options.blobs?.enabled !== false,
358
- db: import_node_process2.default.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === "1",
360
+ database: options.database?.enabled !== false,
359
361
  edgeFunctions: options.edgeFunctions?.enabled !== false,
360
362
  environmentVariables: options.environmentVariables?.enabled !== false,
361
363
  functions: options.functions?.enabled !== false,
@@ -371,6 +373,7 @@ var NetlifyDev = class {
371
373
  this.#serverAddress = options.serverAddress;
372
374
  this.#projectRoot = projectRoot;
373
375
  this.#staticHandlerAdditionalDirectories = options.staticFiles?.directories ?? [];
376
+ this.#skipGitignore = options.skipGitignore ?? false;
374
377
  }
375
378
  getServerAddress(requestServerAddress) {
376
379
  if (requestServerAddress) {
@@ -530,7 +533,9 @@ var NetlifyDev = class {
530
533
  return Boolean(this.#siteID);
531
534
  }
532
535
  async start() {
533
- await (0, import_dev_utils.ensureNetlifyIgnore)(this.#projectRoot, this.#logger);
536
+ if (!this.#skipGitignore) {
537
+ await (0, import_dev_utils.ensureNetlifyIgnore)(this.#projectRoot, this.#logger);
538
+ }
534
539
  this.#apiToken = this.#apiToken ?? await (0, import_dev_utils.getAPIToken)();
535
540
  const state = new import_dev_utils.LocalState(this.#projectRoot);
536
541
  const siteID = state.get("siteId");
@@ -567,12 +572,13 @@ var NetlifyDev = class {
567
572
  siteID: siteID ?? "0"
568
573
  });
569
574
  this.#cleanupJobs.push(() => runtime.stop());
570
- if (this.#features.db) {
575
+ if (this.#features.database) {
571
576
  try {
572
577
  const dbDirectory = import_node_path2.default.join(this.#projectRoot, ".netlify", "db");
573
578
  const db = new import_database_dev.NetlifyDB({ directory: dbDirectory });
574
579
  const connectionString = await db.start();
575
580
  runtime.env.set("NETLIFY_DB_URL", connectionString);
581
+ runtime.env.set("NETLIFY_DB_DRIVER", "server");
576
582
  state.set("dbConnectionString", connectionString);
577
583
  this.#db = db;
578
584
  this.#cleanupJobs.push(async () => {
@@ -746,5 +752,6 @@ var NetlifyDev = class {
746
752
  0 && (module.exports = {
747
753
  NetlifyDev,
748
754
  applyMigrations,
755
+ initializeTrackingTable,
749
756
  resetDatabase
750
757
  });
package/dist/main.d.cts CHANGED
@@ -2,7 +2,7 @@ import { IncomingMessage } from 'node:http';
2
2
  import { Logger } from '@netlify/dev-utils';
3
3
  import { HeadersCollector } from '@netlify/headers';
4
4
  import { NetlifyDB } from '@netlify/database-dev';
5
- export { SQLExecutor, applyMigrations, resetDatabase } from '@netlify/database-dev';
5
+ export { SQLExecutor, applyMigrations, initializeTrackingTable, resetDatabase } from '@netlify/database-dev';
6
6
 
7
7
  interface Features {
8
8
  /**
@@ -13,6 +13,14 @@ interface Features {
13
13
  blobs?: {
14
14
  enabled?: boolean;
15
15
  };
16
+ /**
17
+ * Configuration options for Netlify Database.
18
+ *
19
+ * {@link} https://docs.netlify.com/build/data-and-storage/netlify-database/
20
+ */
21
+ database?: {
22
+ enabled?: boolean;
23
+ };
16
24
  /**
17
25
  * Configuration options for environment variables.
18
26
  *
@@ -109,6 +117,7 @@ interface NetlifyDevOptions extends Features {
109
117
  apiToken?: string;
110
118
  logger?: Logger;
111
119
  projectRoot?: string;
120
+ skipGitignore?: boolean;
112
121
  /**
113
122
  * If your local development setup has its own HTTP server (e.g. Vite), set
114
123
  * its address here.
package/dist/main.d.ts CHANGED
@@ -2,7 +2,7 @@ import { IncomingMessage } from 'node:http';
2
2
  import { Logger } from '@netlify/dev-utils';
3
3
  import { HeadersCollector } from '@netlify/headers';
4
4
  import { NetlifyDB } from '@netlify/database-dev';
5
- export { SQLExecutor, applyMigrations, resetDatabase } from '@netlify/database-dev';
5
+ export { SQLExecutor, applyMigrations, initializeTrackingTable, resetDatabase } from '@netlify/database-dev';
6
6
 
7
7
  interface Features {
8
8
  /**
@@ -13,6 +13,14 @@ interface Features {
13
13
  blobs?: {
14
14
  enabled?: boolean;
15
15
  };
16
+ /**
17
+ * Configuration options for Netlify Database.
18
+ *
19
+ * {@link} https://docs.netlify.com/build/data-and-storage/netlify-database/
20
+ */
21
+ database?: {
22
+ enabled?: boolean;
23
+ };
16
24
  /**
17
25
  * Configuration options for environment variables.
18
26
  *
@@ -109,6 +117,7 @@ interface NetlifyDevOptions extends Features {
109
117
  apiToken?: string;
110
118
  logger?: Logger;
111
119
  projectRoot?: string;
120
+ skipGitignore?: boolean;
112
121
  /**
113
122
  * If your local development setup has its own HTTP server (e.g. Vite), set
114
123
  * its address here.
package/dist/main.js CHANGED
@@ -20,7 +20,7 @@ import { ImageHandler } from "@netlify/images";
20
20
  import { RedirectsHandler } from "@netlify/redirects";
21
21
  import { StaticHandler } from "@netlify/static";
22
22
  import { NetlifyDB } from "@netlify/database-dev";
23
- import { applyMigrations, resetDatabase } from "@netlify/database-dev";
23
+ import { applyMigrations, initializeTrackingTable, resetDatabase } from "@netlify/database-dev";
24
24
 
25
25
  // src/lib/env.ts
26
26
  var SUPPORTED_CONTEXTS = ["all", "production", "deploy-preview", "branch-deploy", "dev", "dev-server"];
@@ -314,6 +314,7 @@ var NetlifyDev = class {
314
314
  #siteID;
315
315
  #staticHandler;
316
316
  #staticHandlerAdditionalDirectories;
317
+ #skipGitignore;
317
318
  constructor(options) {
318
319
  if (options.apiURL) {
319
320
  const apiURL = new URL(options.apiURL);
@@ -327,7 +328,7 @@ var NetlifyDev = class {
327
328
  this.#features = {
328
329
  aiGateway: options.aiGateway?.enabled !== false,
329
330
  blobs: options.blobs?.enabled !== false,
330
- db: process2.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === "1",
331
+ database: options.database?.enabled !== false,
331
332
  edgeFunctions: options.edgeFunctions?.enabled !== false,
332
333
  environmentVariables: options.environmentVariables?.enabled !== false,
333
334
  functions: options.functions?.enabled !== false,
@@ -343,6 +344,7 @@ var NetlifyDev = class {
343
344
  this.#serverAddress = options.serverAddress;
344
345
  this.#projectRoot = projectRoot;
345
346
  this.#staticHandlerAdditionalDirectories = options.staticFiles?.directories ?? [];
347
+ this.#skipGitignore = options.skipGitignore ?? false;
346
348
  }
347
349
  getServerAddress(requestServerAddress) {
348
350
  if (requestServerAddress) {
@@ -502,7 +504,9 @@ var NetlifyDev = class {
502
504
  return Boolean(this.#siteID);
503
505
  }
504
506
  async start() {
505
- await ensureNetlifyIgnore(this.#projectRoot, this.#logger);
507
+ if (!this.#skipGitignore) {
508
+ await ensureNetlifyIgnore(this.#projectRoot, this.#logger);
509
+ }
506
510
  this.#apiToken = this.#apiToken ?? await getAPIToken();
507
511
  const state = new LocalState(this.#projectRoot);
508
512
  const siteID = state.get("siteId");
@@ -539,12 +543,13 @@ var NetlifyDev = class {
539
543
  siteID: siteID ?? "0"
540
544
  });
541
545
  this.#cleanupJobs.push(() => runtime.stop());
542
- if (this.#features.db) {
546
+ if (this.#features.database) {
543
547
  try {
544
548
  const dbDirectory = path2.join(this.#projectRoot, ".netlify", "db");
545
549
  const db = new NetlifyDB({ directory: dbDirectory });
546
550
  const connectionString = await db.start();
547
551
  runtime.env.set("NETLIFY_DB_URL", connectionString);
552
+ runtime.env.set("NETLIFY_DB_DRIVER", "server");
548
553
  state.set("dbConnectionString", connectionString);
549
554
  this.#db = db;
550
555
  this.#cleanupJobs.push(async () => {
@@ -717,5 +722,6 @@ var NetlifyDev = class {
717
722
  export {
718
723
  NetlifyDev,
719
724
  applyMigrations,
725
+ initializeTrackingTable,
720
726
  resetDatabase
721
727
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/dev",
3
- "version": "4.17.3",
3
+ "version": "4.18.1",
4
4
  "description": "Emulation of the Netlify environment for local development",
5
5
  "type": "module",
6
6
  "engines": {
@@ -59,7 +59,7 @@
59
59
  "@netlify/ai": "^0.4.1",
60
60
  "@netlify/blobs": "10.7.4",
61
61
  "@netlify/config": "^24.4.3",
62
- "@netlify/database-dev": "0.10.0",
62
+ "@netlify/database-dev": "0.10.1",
63
63
  "@netlify/dev-utils": "4.4.3",
64
64
  "@netlify/edge-functions-dev": "1.0.16",
65
65
  "@netlify/functions-dev": "1.2.6",