@cloudflare/vite-plugin 1.30.1 → 1.30.3

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/index.mjs CHANGED
@@ -1940,7 +1940,7 @@ var __toESM = (mod, isNodeMode, target$1) => (target$1 = mod != null ? __create(
1940
1940
  }) : target$1, mod));
1941
1941
 
1942
1942
  //#endregion
1943
- //#region ../workers-utils/dist/chunk-DMN4LFFR.mjs
1943
+ //#region ../workers-utils/dist/chunk-GMX45GYB.mjs
1944
1944
  function getLocalWorkerdCompatibilityDate({ projectPath = process.cwd() } = {}) {
1945
1945
  try {
1946
1946
  const miniflareEntry = module$1.createRequire(path3.join(projectPath, "package.json")).resolve("miniflare");
@@ -2119,6 +2119,18 @@ function mapWorkerMetadataBindings(bindings) {
2119
2119
  index_name: binding.index_name
2120
2120
  }];
2121
2121
  break;
2122
+ case "ai_search_namespace":
2123
+ configObj.ai_search_namespaces = [...configObj.ai_search_namespaces ?? [], {
2124
+ binding: binding.name,
2125
+ namespace: binding.namespace
2126
+ }];
2127
+ break;
2128
+ case "ai_search":
2129
+ configObj.ai_search = [...configObj.ai_search ?? [], {
2130
+ binding: binding.name,
2131
+ instance_name: binding.instance_name
2132
+ }];
2133
+ break;
2122
2134
  case "hyperdrive":
2123
2135
  configObj.hyperdrive = [...configObj.hyperdrive ?? [], {
2124
2136
  binding: binding.name,
@@ -2290,7 +2302,7 @@ var MetricsRegistry = class {
2290
2302
  };
2291
2303
 
2292
2304
  //#endregion
2293
- //#region ../workers-utils/dist/chunk-R5I2EYQO.mjs
2305
+ //#region ../workers-utils/dist/chunk-A4F3D336.mjs
2294
2306
  var UserError = class extends Error {
2295
2307
  static {
2296
2308
  __name(this, "UserError");
@@ -4292,6 +4304,9 @@ var APIError = class extends ParseError {
4292
4304
  this.name = this.constructor.name;
4293
4305
  this.#status = status;
4294
4306
  }
4307
+ get status() {
4308
+ return this.#status;
4309
+ }
4295
4310
  isGatewayError() {
4296
4311
  if (this.#status !== void 0) return [524].includes(this.#status);
4297
4312
  return false;
@@ -5275,6 +5290,8 @@ var defaultWranglerConfig = {
5275
5290
  r2_buckets: [],
5276
5291
  d1_databases: [],
5277
5292
  vectorize: [],
5293
+ ai_search_namespaces: [],
5294
+ ai_search: [],
5278
5295
  hyperdrive: [],
5279
5296
  workflows: [],
5280
5297
  secrets_store_secrets: [],
@@ -9310,6 +9327,8 @@ var friendlyBindingNames = {
9310
9327
  queues: "Queue",
9311
9328
  d1_databases: "D1 Database",
9312
9329
  vectorize: "Vectorize Index",
9330
+ ai_search_namespaces: "AI Search Namespace",
9331
+ ai_search: "AI Search Instance",
9313
9332
  hyperdrive: "Hyperdrive Config",
9314
9333
  r2_buckets: "R2 Bucket",
9315
9334
  logfwdr: "logfwdr",
@@ -9356,6 +9375,8 @@ var bindingTypeFriendlyNames = {
9356
9375
  r2_bucket: "R2 Bucket",
9357
9376
  d1: "D1 Database",
9358
9377
  vectorize: "Vectorize Index",
9378
+ ai_search_namespace: "AI Search Namespace",
9379
+ ai_search: "AI Search Instance",
9359
9380
  hyperdrive: "Hyperdrive Config",
9360
9381
  service: "Worker",
9361
9382
  fetcher: "Service Binding",
@@ -9819,6 +9840,8 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
9819
9840
  r2_buckets: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "r2_buckets", validateBindingArray(envName, validateR2Binding), []),
9820
9841
  d1_databases: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "d1_databases", validateBindingArray(envName, validateD1Binding), []),
9821
9842
  vectorize: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vectorize", validateBindingArray(envName, validateVectorizeBinding), []),
9843
+ ai_search_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search_namespaces", validateBindingArray(envName, validateAISearchNamespaceBinding), []),
9844
+ ai_search: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search", validateBindingArray(envName, validateAISearchBinding), []),
9822
9845
  hyperdrive: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "hyperdrive", validateBindingArray(envName, validateHyperdriveBinding), []),
9823
9846
  services: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "services", validateBindingArray(envName, validateServiceBinding), []),
9824
9847
  analytics_engine_datasets: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "analytics_engine_datasets", validateBindingArray(envName, validateAnalyticsEngineBinding), []),
@@ -10255,6 +10278,8 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
10255
10278
  "text_blob",
10256
10279
  "browser",
10257
10280
  "ai",
10281
+ "ai_search_namespace",
10282
+ "ai_search",
10258
10283
  "kv_namespace",
10259
10284
  "durable_object_namespace",
10260
10285
  "d1_database",
@@ -10684,6 +10709,50 @@ var validateVectorizeBinding = /* @__PURE__ */ __name((diagnostics, field, value
10684
10709
  ]);
10685
10710
  return isValid2;
10686
10711
  }, "validateVectorizeBinding");
10712
+ var validateAISearchNamespaceBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
10713
+ if (typeof value !== "object" || value === null) {
10714
+ diagnostics.errors.push(`"ai_search_namespaces" bindings should be objects, but got ${JSON.stringify(value)}`);
10715
+ return false;
10716
+ }
10717
+ let isValid2 = true;
10718
+ if (!isRequiredProperty(value, "binding", "string")) {
10719
+ diagnostics.errors.push(`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(value)}.`);
10720
+ isValid2 = false;
10721
+ }
10722
+ if (!isRequiredProperty(value, "namespace", "string")) {
10723
+ diagnostics.errors.push(`"${field}" bindings must have a "namespace" field but got ${JSON.stringify(value)}.`);
10724
+ isValid2 = false;
10725
+ }
10726
+ if (!isRemoteValid(value, field, diagnostics)) isValid2 = false;
10727
+ validateAdditionalProperties(diagnostics, field, Object.keys(value), [
10728
+ "binding",
10729
+ "namespace",
10730
+ "remote"
10731
+ ]);
10732
+ return isValid2;
10733
+ }, "validateAISearchNamespaceBinding");
10734
+ var validateAISearchBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
10735
+ if (typeof value !== "object" || value === null) {
10736
+ diagnostics.errors.push(`"ai_search" bindings should be objects, but got ${JSON.stringify(value)}`);
10737
+ return false;
10738
+ }
10739
+ let isValid2 = true;
10740
+ if (!isRequiredProperty(value, "binding", "string")) {
10741
+ diagnostics.errors.push(`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(value)}.`);
10742
+ isValid2 = false;
10743
+ }
10744
+ if (!isRequiredProperty(value, "instance_name", "string")) {
10745
+ diagnostics.errors.push(`"${field}" bindings must have an "instance_name" field but got ${JSON.stringify(value)}.`);
10746
+ isValid2 = false;
10747
+ }
10748
+ if (!isRemoteValid(value, field, diagnostics)) isValid2 = false;
10749
+ validateAdditionalProperties(diagnostics, field, Object.keys(value), [
10750
+ "binding",
10751
+ "instance_name",
10752
+ "remote"
10753
+ ]);
10754
+ return isValid2;
10755
+ }, "validateAISearchBinding");
10687
10756
  var validateHyperdriveBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
10688
10757
  if (typeof value !== "object" || value === null) {
10689
10758
  diagnostics.errors.push(`"hyperdrive" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -10899,6 +10968,10 @@ var validateConsumer = /* @__PURE__ */ __name((diagnostics, field, value, _confi
10899
10968
  "retry_delay"
10900
10969
  ])) isValid2 = false;
10901
10970
  if (!isRequiredProperty(value, "queue", "string")) diagnostics.errors.push(`"${field}" should have a string "queue" field but got ${JSON.stringify(value)}.`);
10971
+ if ("type" in value && value.type !== void 0 && value.type !== "worker") {
10972
+ diagnostics.errors.push(`"${field}.type" has an invalid value "${value.type}". Only "worker" consumers can be configured in your Wrangler configuration.`);
10973
+ isValid2 = false;
10974
+ }
10902
10975
  for (const optionalOpt of [
10903
10976
  {
10904
10977
  key: "type",
@@ -26258,6 +26331,7 @@ let ImageRegistryNotFoundError;
26258
26331
  let ImageRegistryPermissions = /* @__PURE__ */ function(ImageRegistryPermissions$1) {
26259
26332
  ImageRegistryPermissions$1["PULL"] = "pull";
26260
26333
  ImageRegistryPermissions$1["PUSH"] = "push";
26334
+ ImageRegistryPermissions$1["LIBRARY_PUSH"] = "library_push";
26261
26335
  return ImageRegistryPermissions$1;
26262
26336
  }({});
26263
26337
 
@@ -26547,7 +26621,8 @@ function dockerBuild(dockerPath, options) {
26547
26621
  "inherit",
26548
26622
  "inherit"
26549
26623
  ],
26550
- detached: true
26624
+ detached: process.platform !== "win32",
26625
+ windowsHide: true
26551
26626
  });
26552
26627
  if (child.stdin !== null) {
26553
26628
  child.stdin.write(options.dockerfile);
@@ -26569,7 +26644,8 @@ function dockerBuild(dockerPath, options) {
26569
26644
  return {
26570
26645
  abort: () => {
26571
26646
  child.unref();
26572
- if (child.pid !== void 0) process.kill(-child.pid);
26647
+ if (child.pid !== void 0) if (process.platform === "win32") child.kill();
26648
+ else process.kill(-child.pid);
26573
26649
  },
26574
26650
  ready
26575
26651
  };
@@ -26677,7 +26753,8 @@ const runDockerCmd = (dockerPath, args, stdio) => {
26677
26753
  });
26678
26754
  const child = spawn(dockerPath, args, {
26679
26755
  stdio: stdio ?? "inherit",
26680
- detached: true
26756
+ detached: process.platform !== "win32",
26757
+ windowsHide: true
26681
26758
  });
26682
26759
  let errorHandled = false;
26683
26760
  child.on("close", (code) => {
@@ -26697,7 +26774,8 @@ const runDockerCmd = (dockerPath, args, stdio) => {
26697
26774
  abort: () => {
26698
26775
  aborted = true;
26699
26776
  child.unref();
26700
- if (child.pid !== void 0) process.kill(-child.pid);
26777
+ if (child.pid !== void 0) if (process.platform === "win32") child.kill();
26778
+ else process.kill(-child.pid);
26701
26779
  },
26702
26780
  ready,
26703
26781
  then: async (onResolve, onReject) => ready.then(onResolve).catch(onReject)