@netlify/dev 4.7.1 → 4.8.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
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(main_exports);
36
36
  var import_node_fs2 = require("fs");
37
37
  var import_node_path2 = __toESM(require("path"), 1);
38
38
  var import_node_process2 = __toESM(require("process"), 1);
39
+ var import_bootstrap = require("@netlify/ai/bootstrap");
39
40
  var import_config = require("@netlify/config");
40
41
  var import_dev_utils = require("@netlify/dev-utils");
41
42
  var import_edge_functions_dev = require("@netlify/edge-functions-dev");
@@ -526,6 +527,28 @@ var NetlifyDev = class {
526
527
  siteID: siteID ?? "0"
527
528
  });
528
529
  this.#cleanupJobs.push(() => runtime.stop());
530
+ if (this.#features.environmentVariables && config?.api && siteID && config?.siteInfo?.url) {
531
+ await (0, import_bootstrap.setupAIGateway)({
532
+ api: config.api,
533
+ env: config.env || {},
534
+ siteID,
535
+ siteURL: config.siteInfo.url
536
+ });
537
+ if (config.env.AI_GATEWAY) {
538
+ runtime.env.set("AI_GATEWAY", config.env.AI_GATEWAY.value);
539
+ const aiGatewayContext = (0, import_bootstrap.parseAIGatewayContext)(config.env.AI_GATEWAY.value);
540
+ if (aiGatewayContext) {
541
+ runtime.env.set("NETLIFY_AI_GATEWAY_KEY", aiGatewayContext.token);
542
+ runtime.env.set("NETLIFY_AI_GATEWAY_URL", aiGatewayContext.url);
543
+ if (aiGatewayContext.envVars) {
544
+ for (const envVar of aiGatewayContext.envVars) {
545
+ runtime.env.set(envVar.key, aiGatewayContext.token);
546
+ runtime.env.set(envVar.url, aiGatewayContext.url);
547
+ }
548
+ }
549
+ }
550
+ }
551
+ }
529
552
  let serverAddress;
530
553
  if (typeof this.#serverAddress === "string") {
531
554
  serverAddress = this.#serverAddress;
package/dist/main.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { promises as fs2 } from "fs";
3
3
  import path2 from "path";
4
4
  import process2 from "process";
5
+ import { parseAIGatewayContext, setupAIGateway } from "@netlify/ai/bootstrap";
5
6
  import { resolveConfig } from "@netlify/config";
6
7
  import {
7
8
  ensureNetlifyIgnore,
@@ -498,6 +499,28 @@ var NetlifyDev = class {
498
499
  siteID: siteID ?? "0"
499
500
  });
500
501
  this.#cleanupJobs.push(() => runtime.stop());
502
+ if (this.#features.environmentVariables && config?.api && siteID && config?.siteInfo?.url) {
503
+ await setupAIGateway({
504
+ api: config.api,
505
+ env: config.env || {},
506
+ siteID,
507
+ siteURL: config.siteInfo.url
508
+ });
509
+ if (config.env.AI_GATEWAY) {
510
+ runtime.env.set("AI_GATEWAY", config.env.AI_GATEWAY.value);
511
+ const aiGatewayContext = parseAIGatewayContext(config.env.AI_GATEWAY.value);
512
+ if (aiGatewayContext) {
513
+ runtime.env.set("NETLIFY_AI_GATEWAY_KEY", aiGatewayContext.token);
514
+ runtime.env.set("NETLIFY_AI_GATEWAY_URL", aiGatewayContext.url);
515
+ if (aiGatewayContext.envVars) {
516
+ for (const envVar of aiGatewayContext.envVars) {
517
+ runtime.env.set(envVar.key, aiGatewayContext.token);
518
+ runtime.env.set(envVar.url, aiGatewayContext.url);
519
+ }
520
+ }
521
+ }
522
+ }
523
+ }
501
524
  let serverAddress;
502
525
  if (typeof this.#serverAddress === "string") {
503
526
  serverAddress = this.#serverAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/dev",
3
- "version": "4.7.1",
3
+ "version": "4.8.0",
4
4
  "description": "Emulation of the Netlify environment for local development",
5
5
  "type": "module",
6
6
  "engines": {
@@ -56,6 +56,7 @@
56
56
  "vitest": "^3.0.0"
57
57
  },
58
58
  "dependencies": {
59
+ "@netlify/ai": "^0.3.3",
59
60
  "@netlify/blobs": "10.3.3",
60
61
  "@netlify/config": "^23.2.0",
61
62
  "@netlify/dev-utils": "4.3.1",