@cloudflare/vite-plugin 0.0.0-3af2e30f8 → 0.0.0-3b384e28c

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.
@@ -1985,7 +1985,7 @@ var we = class {
1985
1985
  this.hasWritten || this.readyAnalytics && (this.hasWritten = true, this.readyAnalytics.logEvent({ version: 1, accountId: this.data.accountId, indexId: this.data.scriptId?.toString(), doubles: [this.data.requestTime ?? -1, this.data.coloId ?? -1, this.data.metalId ?? -1, this.data.coloTier ?? -1, this.data.userWorkerAhead === void 0 ? -1 : Number(this.data.userWorkerAhead)], blobs: [this.data.hostname?.substring(0, 256), this.data.dispatchtype, this.data.error?.substring(0, 256), this.data.version, this.data.coloRegion] }));
1986
1986
  }
1987
1987
  };
1988
- var On = (t4) => ({ invoke_user_worker_ahead_of_assets: t4?.invoke_user_worker_ahead_of_assets ?? false, has_user_worker: t4?.has_user_worker ?? false, account_id: t4?.account_id ?? -1, script_id: t4?.script_id ?? -1 });
1988
+ var On = (t4) => ({ invoke_user_worker_ahead_of_assets: t4?.invoke_user_worker_ahead_of_assets ?? false, has_user_worker: t4?.has_user_worker ?? false, account_id: t4?.account_id ?? -1, script_id: t4?.script_id ?? -1, debug: t4?.debug ?? false });
1989
1989
  var Bc = { async fetch(t4, e, n) {
1990
1990
  let r, o = false, s = new we(e.ANALYTICS), i = new ue(e.UNSAFE_PERFORMANCE), a = i.now();
1991
1991
  try {
package/dist/index.js CHANGED
@@ -489,7 +489,8 @@ import assert10 from "node:assert";
489
489
  import * as fs5 from "node:fs";
490
490
  import * as fsp2 from "node:fs/promises";
491
491
  import * as path9 from "node:path";
492
- import { createMiddleware } from "@hattip/adapter-node";
492
+ import { createRequest, sendResponse } from "@mjackson/node-fetch-server";
493
+ import replace from "@rollup/plugin-replace";
493
494
 
494
495
  // ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
495
496
  var comma = ",".charCodeAt(0);
@@ -1557,7 +1558,7 @@ var MagicString = class _MagicString {
1557
1558
 
1558
1559
  // src/index.ts
1559
1560
  import { Miniflare } from "miniflare";
1560
- import colors2 from "picocolors";
1561
+ import colors3 from "picocolors";
1561
1562
  import * as vite7 from "vite";
1562
1563
 
1563
1564
  // src/constants.ts
@@ -5783,7 +5784,8 @@ var z = /* @__PURE__ */ Object.freeze({
5783
5784
  // ../workers-shared/utils/types.ts
5784
5785
  var InternalConfigSchema = z.object({
5785
5786
  account_id: z.number().optional(),
5786
- script_id: z.number().optional()
5787
+ script_id: z.number().optional(),
5788
+ debug: z.boolean().optional()
5787
5789
  });
5788
5790
  var RouterConfigSchema = z.object({
5789
5791
  invoke_user_worker_ahead_of_assets: z.boolean().optional(),
@@ -5831,14 +5833,14 @@ var AssetConfigSchema = z.object({
5831
5833
  });
5832
5834
 
5833
5835
  // src/asset-config.ts
5834
- function hasAssetsConfigChanged(resolvedPluginConfig, resolvedViteConfig, changedFile) {
5836
+ function hasAssetsConfigChanged(resolvedPluginConfig, resolvedViteConfig, changedFilePath) {
5835
5837
  if (!resolvedPluginConfig.experimental?.headersAndRedirectsDevModeSupport) {
5836
5838
  return false;
5837
5839
  }
5838
5840
  return [
5839
5841
  getRedirectsConfigPath(resolvedViteConfig),
5840
5842
  getHeadersConfigPath(resolvedViteConfig)
5841
- ].includes(path.resolve(changedFile));
5843
+ ].includes(changedFilePath);
5842
5844
  }
5843
5845
  function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig) {
5844
5846
  const assetsConfig = resolvedPluginConfig.type === "assets-only" ? resolvedPluginConfig.config.assets : entryWorkerConfig?.assets;
@@ -12879,6 +12881,15 @@ function isNodeCompat(workerConfig) {
12879
12881
  }
12880
12882
  return false;
12881
12883
  }
12884
+ function isNodeAls(workerConfig) {
12885
+ return workerConfig !== void 0 && getNodeCompat(
12886
+ workerConfig.compatibility_date,
12887
+ workerConfig.compatibility_flags ?? []
12888
+ ).mode === "als";
12889
+ }
12890
+ function isNodeAlsModule(path10) {
12891
+ return /^(node:)?async_hooks$/.test(path10);
12892
+ }
12882
12893
  function injectGlobalCode(id, code) {
12883
12894
  const injectedCode = Object.entries(env.inject).map(([globalName, globalInject]) => {
12884
12895
  if (typeof globalInject === "string") {
@@ -12909,7 +12920,7 @@ globalThis.${globalName} = var_${globalName}.${exportName};
12909
12920
  }
12910
12921
  function resolveNodeJSImport(source) {
12911
12922
  const alias = env.alias[source];
12912
- if (alias) {
12923
+ if (alias && !nodeCompatExternals.has(alias)) {
12913
12924
  return {
12914
12925
  unresolved: alias,
12915
12926
  resolved: resolvePathSync(alias, { url: import.meta.url })
@@ -13018,19 +13029,6 @@ function toMiniflareRequest(request) {
13018
13029
  duplex: "half"
13019
13030
  });
13020
13031
  }
13021
- function nodeHeadersToWebHeaders(nodeHeaders) {
13022
- const headers = new Headers();
13023
- for (const [key, value] of Object.entries(nodeHeaders)) {
13024
- if (typeof value === "string") {
13025
- headers.append(key, value);
13026
- } else if (Array.isArray(value)) {
13027
- for (const item of value) {
13028
- headers.append(key, item);
13029
- }
13030
- }
13031
- }
13032
- return headers;
13033
- }
13034
13032
  var postfixRE = /[?#].*$/;
13035
13033
  function cleanUrl(url) {
13036
13034
  return url.replace(postfixRE, "");
@@ -13344,6 +13342,7 @@ import {
13344
13342
  LogLevel,
13345
13343
  Response as MiniflareResponse
13346
13344
  } from "miniflare";
13345
+ import colors2 from "picocolors";
13347
13346
  import { globSync } from "tinyglobby";
13348
13347
  import "vite";
13349
13348
  import { unstable_getMiniflareWorkerOptions } from "wrangler";
@@ -13448,6 +13447,29 @@ function getEntryWorkerConfig(resolvedPluginConfig) {
13448
13447
  }
13449
13448
  return resolvedPluginConfig.workers[resolvedPluginConfig.entryWorkerEnvironmentName];
13450
13449
  }
13450
+ function filterTails(tails, userWorkers, log) {
13451
+ return tails?.filter((tailService) => {
13452
+ let name;
13453
+ if (typeof tailService === "string") {
13454
+ name = tailService;
13455
+ } else if (typeof tailService === "object" && "name" in tailService && typeof tailService.name === "string") {
13456
+ name = tailService.name;
13457
+ } else {
13458
+ return true;
13459
+ }
13460
+ const found = userWorkers.some((w) => w.name === name);
13461
+ if (!found) {
13462
+ log(
13463
+ colors2.dim(
13464
+ colors2.yellow(
13465
+ `Tail consumer "${name}" was not found in your config. Make sure you add it if you'd like to simulate receiving tail events locally.`
13466
+ )
13467
+ )
13468
+ );
13469
+ }
13470
+ return found;
13471
+ });
13472
+ }
13451
13473
  function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspectorPort) {
13452
13474
  const resolvedViteConfig = viteDevServer.config;
13453
13475
  const entryWorkerConfig = getEntryWorkerConfig(resolvedPluginConfig);
@@ -13639,6 +13661,11 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspectorPo
13639
13661
  }
13640
13662
  return {
13641
13663
  ...workerOptions,
13664
+ tails: filterTails(
13665
+ workerOptions.tails,
13666
+ userWorkers,
13667
+ viteDevServer.config.logger.warn
13668
+ ),
13642
13669
  modules: [
13643
13670
  {
13644
13671
  type: "ESModule",
@@ -13729,6 +13756,11 @@ function getPreviewMiniflareOptions(vitePreviewServer, workerConfigs, persistSta
13729
13756
  return [
13730
13757
  {
13731
13758
  ...workerOptions,
13759
+ tails: filterTails(
13760
+ workerOptions.tails,
13761
+ workerConfigs,
13762
+ vitePreviewServer.config.logger.warn
13763
+ ),
13732
13764
  name: workerOptions.name ?? config.name,
13733
13765
  unsafeInspectorProxy: inspectorPort !== false,
13734
13766
  ...miniflareWorkerOptions.main ? getPreviewModules(miniflareWorkerOptions.main, modulesRules) : { modules: true, script: "" }
@@ -14137,6 +14169,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14137
14169
  }
14138
14170
 
14139
14171
  // src/websockets.ts
14172
+ import { createHeaders } from "@mjackson/node-fetch-server";
14140
14173
  import { coupleWebSocket } from "miniflare";
14141
14174
  import { WebSocketServer } from "ws";
14142
14175
  function handleWebSocket(httpServer, getFetcher) {
@@ -14148,7 +14181,7 @@ function handleWebSocket(httpServer, getFetcher) {
14148
14181
  if (request.headers["sec-websocket-protocol"]?.startsWith("vite")) {
14149
14182
  return;
14150
14183
  }
14151
- const headers = nodeHeadersToWebHeaders(request.headers);
14184
+ const headers = createHeaders(request);
14152
14185
  const fetcher = await getFetcher();
14153
14186
  const response = await fetcher(url, {
14154
14187
  headers,
@@ -14180,12 +14213,15 @@ function validateWorkerEnvironmentsResolvedConfigs(resolvedPluginConfig, resolve
14180
14213
  for (const envName of workersEnvironmentNames) {
14181
14214
  const workerEnvConfig = resolvedViteConfig.environments[envName];
14182
14215
  assert9(workerEnvConfig, `Missing environment config for "${envName}"`);
14183
- const { optimizeDeps, resolve: resolve8 } = workerEnvConfig;
14216
+ const { optimizeDeps, resolve: resolve7 } = workerEnvConfig;
14184
14217
  const disallowedConfig = {};
14185
14218
  const disallowedOptimizeDepsExcludeEntries = (optimizeDeps.exclude ?? []).filter((entry) => {
14186
14219
  if (cloudflareBuiltInModules.includes(entry)) {
14187
14220
  return false;
14188
14221
  }
14222
+ if (isNodeAlsModule(entry) && isNodeAls(resolvedPluginConfig.workers[envName])) {
14223
+ return false;
14224
+ }
14189
14225
  if (NODEJS_MODULES_RE.test(entry) && isNodeCompat(resolvedPluginConfig.workers[envName])) {
14190
14226
  return false;
14191
14227
  }
@@ -14194,8 +14230,8 @@ function validateWorkerEnvironmentsResolvedConfigs(resolvedPluginConfig, resolve
14194
14230
  if (disallowedOptimizeDepsExcludeEntries.length > 0) {
14195
14231
  disallowedConfig.optimizeDepsExclude = disallowedOptimizeDepsExcludeEntries;
14196
14232
  }
14197
- if (resolve8.external === true || resolve8.external.length > 0) {
14198
- disallowedConfig.resolveExternal = resolve8.external;
14233
+ if (resolve7.external === true || resolve7.external.length > 0) {
14234
+ disallowedConfig.resolveExternal = resolve7.external;
14199
14235
  }
14200
14236
  if (Object.keys(disallowedConfig).length > 0) {
14201
14237
  disallowedEnvsConfigs.set(envName, disallowedConfig);
@@ -14401,28 +14437,22 @@ function cloudflare2(pluginConfig = {}) {
14401
14437
  }
14402
14438
  },
14403
14439
  hotUpdate(options) {
14404
- if (
14405
- // Vite normalizes `options.file` so we use `path.resolve` for Windows compatibility
14406
- resolvedPluginConfig.configPaths.has(path9.resolve(options.file)) || hasAssetsConfigChanged(
14407
- resolvedPluginConfig,
14408
- resolvedViteConfig,
14409
- options.file
14410
- )
14411
- ) {
14440
+ const changedFilePath = path9.resolve(options.file);
14441
+ if (resolvedPluginConfig.configPaths.has(changedFilePath) || hasDotDevDotVarsFileChanged(resolvedPluginConfig, changedFilePath) || hasAssetsConfigChanged(
14442
+ resolvedPluginConfig,
14443
+ resolvedViteConfig,
14444
+ changedFilePath
14445
+ )) {
14412
14446
  options.server.restart();
14413
14447
  return [];
14414
14448
  }
14415
14449
  },
14416
14450
  async configureServer(viteDevServer) {
14417
- assert10(
14418
- viteDevServer.httpServer,
14419
- "Unexpected error: No Vite HTTP server"
14451
+ const inputInspectorPort = await getInputInspectorPortOption(
14452
+ pluginConfig,
14453
+ viteDevServer
14420
14454
  );
14421
14455
  if (!miniflare) {
14422
- const inputInspectorPort = await getInputInspectorPortOption(
14423
- pluginConfig,
14424
- viteDevServer
14425
- );
14426
14456
  miniflare = new Miniflare(
14427
14457
  getDevMiniflareOptions(
14428
14458
  resolvedPluginConfig,
@@ -14431,34 +14461,41 @@ function cloudflare2(pluginConfig = {}) {
14431
14461
  )
14432
14462
  );
14433
14463
  } else {
14434
- const resolvedInspectorPort = await getResolvedInspectorPort(pluginConfig);
14435
14464
  await miniflare.setOptions(
14436
14465
  getDevMiniflareOptions(
14437
14466
  resolvedPluginConfig,
14438
14467
  viteDevServer,
14439
- resolvedInspectorPort ?? false
14468
+ inputInspectorPort
14440
14469
  )
14441
14470
  );
14442
14471
  }
14443
14472
  await initRunners(resolvedPluginConfig, viteDevServer, miniflare);
14444
- const middleware = createMiddleware(
14445
- async ({ request }) => {
14473
+ if (viteDevServer.httpServer) {
14474
+ handleWebSocket(viteDevServer.httpServer, async () => {
14446
14475
  assert10(miniflare, `Miniflare not defined`);
14447
14476
  const routerWorker = await getRouterWorker(miniflare);
14448
- return routerWorker.fetch(toMiniflareRequest(request), {
14449
- redirect: "manual"
14450
- });
14451
- },
14452
- { alwaysCallNext: false }
14453
- );
14454
- handleWebSocket(viteDevServer.httpServer, async () => {
14455
- assert10(miniflare, `Miniflare not defined`);
14456
- const routerWorker = await getRouterWorker(miniflare);
14457
- return routerWorker.fetch;
14458
- });
14477
+ return routerWorker.fetch;
14478
+ });
14479
+ }
14459
14480
  return () => {
14460
- viteDevServer.middlewares.use((req, res, next) => {
14461
- middleware(req, res, next);
14481
+ viteDevServer.middlewares.use(async (req, res, next) => {
14482
+ try {
14483
+ assert10(miniflare, `Miniflare not defined`);
14484
+ const routerWorker = await getRouterWorker(miniflare);
14485
+ const request = createRequest(req, res);
14486
+ const response = await routerWorker.fetch(
14487
+ toMiniflareRequest(request),
14488
+ {
14489
+ redirect: "manual"
14490
+ }
14491
+ );
14492
+ if (req.httpVersionMajor === 2) {
14493
+ response.headers.delete("transfer-encoding");
14494
+ }
14495
+ await sendResponse(res, response);
14496
+ } catch (error) {
14497
+ next(error);
14498
+ }
14462
14499
  });
14463
14500
  };
14464
14501
  },
@@ -14476,20 +14513,24 @@ function cloudflare2(pluginConfig = {}) {
14476
14513
  inputInspectorPort
14477
14514
  )
14478
14515
  );
14479
- const middleware = createMiddleware(
14480
- ({ request }) => {
14481
- return miniflare2.dispatchFetch(toMiniflareRequest(request), {
14482
- redirect: "manual"
14483
- });
14484
- },
14485
- { alwaysCallNext: false }
14486
- );
14487
14516
  handleWebSocket(
14488
14517
  vitePreviewServer.httpServer,
14489
14518
  () => miniflare2.dispatchFetch
14490
14519
  );
14491
- vitePreviewServer.middlewares.use((req, res, next) => {
14492
- middleware(req, res, next);
14520
+ vitePreviewServer.middlewares.use(async (req, res, next) => {
14521
+ try {
14522
+ const request = createRequest(req, res);
14523
+ const response = await miniflare2.dispatchFetch(
14524
+ toMiniflareRequest(request),
14525
+ { redirect: "manual" }
14526
+ );
14527
+ if (req.httpVersionMajor === 2) {
14528
+ response.headers.delete("transfer-encoding");
14529
+ }
14530
+ await sendResponse(res, response);
14531
+ } catch (error) {
14532
+ next(error);
14533
+ }
14493
14534
  });
14494
14535
  }
14495
14536
  },
@@ -14598,6 +14639,18 @@ function cloudflare2(pluginConfig = {}) {
14598
14639
  configEnvironment(name) {
14599
14640
  if (isNodeCompat(getWorkerConfig2(name))) {
14600
14641
  return {
14642
+ build: {
14643
+ rollupOptions: {
14644
+ plugins: [
14645
+ replace({
14646
+ "process.env.NODE_ENV": JSON.stringify(
14647
+ process.env.NODE_ENV ?? "production"
14648
+ ),
14649
+ preventAssignment: true
14650
+ })
14651
+ ]
14652
+ }
14653
+ },
14601
14654
  resolve: {
14602
14655
  builtins: [...nodeCompatExternals]
14603
14656
  },
@@ -14639,7 +14692,9 @@ function cloudflare2(pluginConfig = {}) {
14639
14692
  },
14640
14693
  async transform(code, id) {
14641
14694
  const workerConfig = getWorkerConfig2(this.environment.name);
14642
- assert10(workerConfig, "Expected a worker config");
14695
+ if (!workerConfig) {
14696
+ return;
14697
+ }
14643
14698
  const resolvedId = await this.resolve(workerConfig.main);
14644
14699
  if (id === resolvedId?.id) {
14645
14700
  return injectGlobalCode(id, code);
@@ -14668,6 +14723,25 @@ function cloudflare2(pluginConfig = {}) {
14668
14723
  );
14669
14724
  }
14670
14725
  },
14726
+ // Plugin that handles Node.js Async Local Storage (ALS) compatibility support for Vite Environments that are hosted in Cloudflare Workers.
14727
+ {
14728
+ name: "vite-plugin-cloudflare:nodejs-als",
14729
+ apply(_config, env2) {
14730
+ return !env2.isPreview;
14731
+ },
14732
+ configEnvironment(name, config) {
14733
+ if (isNodeAls(getWorkerConfig2(name))) {
14734
+ return {
14735
+ resolve: {
14736
+ builtins: ["async_hooks", "node:async_hooks"]
14737
+ },
14738
+ optimizeDeps: {
14739
+ exclude: ["async_hooks", "node:async_hooks"]
14740
+ }
14741
+ };
14742
+ }
14743
+ }
14744
+ },
14671
14745
  // Plugin that provides an __debug path for debugging the Cloudflare Workers.
14672
14746
  {
14673
14747
  name: "vite-plugin-cloudflare:debug",
@@ -14733,6 +14807,9 @@ function cloudflare2(pluginConfig = {}) {
14733
14807
  build.onResolve(
14734
14808
  { filter: NODEJS_MODULES_RE },
14735
14809
  ({ path: path10, importer }) => {
14810
+ if (isNodeAls(workerConfig) && isNodeAlsModule(path10)) {
14811
+ return;
14812
+ }
14736
14813
  const nodeJsCompatWarnings = nodeJsCompatWarningsMap.get(workerConfig);
14737
14814
  nodeJsCompatWarnings?.registerImport(path10, importer);
14738
14815
  return { path: path10, external: true };
@@ -14762,6 +14839,9 @@ function cloudflare2(pluginConfig = {}) {
14762
14839
  async resolveId(source, importer) {
14763
14840
  const workerConfig = getWorkerConfig2(this.environment.name);
14764
14841
  if (workerConfig && !isNodeCompat(workerConfig)) {
14842
+ if (isNodeAls(workerConfig) && isNodeAlsModule(source)) {
14843
+ return;
14844
+ }
14765
14845
  const nodeJsCompatWarnings = nodeJsCompatWarningsMap.get(workerConfig);
14766
14846
  if (nodejsBuiltins.has(source)) {
14767
14847
  nodeJsCompatWarnings?.registerImport(source, importer);
@@ -14780,10 +14860,16 @@ function cloudflare2(pluginConfig = {}) {
14780
14860
  }
14781
14861
  }
14782
14862
  async function getInputInspectorPortOption(pluginConfig, viteServer) {
14863
+ if (pluginConfig.inspectorPort === void 0 || pluginConfig.inspectorPort === 0) {
14864
+ const resolvedInspectorPort = await getResolvedInspectorPort(pluginConfig);
14865
+ if (resolvedInspectorPort !== null) {
14866
+ return resolvedInspectorPort;
14867
+ }
14868
+ }
14783
14869
  const inputInspectorPort = pluginConfig.inspectorPort ?? await getFirstAvailablePort(DEFAULT_INSPECTOR_PORT);
14784
14870
  if (pluginConfig.inspectorPort === void 0 && inputInspectorPort !== DEFAULT_INSPECTOR_PORT) {
14785
14871
  viteServer.config.logger.warn(
14786
- colors2.dim(
14872
+ colors3.dim(
14787
14873
  `Default inspector port ${DEFAULT_INSPECTOR_PORT} not available, using ${inputInspectorPort} instead
14788
14874
  `
14789
14875
  )
@@ -14809,6 +14895,19 @@ function getDotDevDotVarsContent(configPath, cloudflareEnv) {
14809
14895
  }
14810
14896
  return null;
14811
14897
  }
14898
+ function hasDotDevDotVarsFileChanged(resolvedPluginConfig, changedFilePath) {
14899
+ return [...resolvedPluginConfig.configPaths].some((configPath) => {
14900
+ const dotDevDotVars = path9.join(path9.dirname(configPath), ".dev.vars");
14901
+ if (dotDevDotVars === changedFilePath) {
14902
+ return true;
14903
+ }
14904
+ if (resolvedPluginConfig.cloudflareEnv) {
14905
+ const dotDevDotVarsForEnv = `${dotDevDotVars}.${resolvedPluginConfig.cloudflareEnv}`;
14906
+ return dotDevDotVarsForEnv === changedFilePath;
14907
+ }
14908
+ return false;
14909
+ });
14910
+ }
14812
14911
  export {
14813
14912
  cloudflare2 as cloudflare
14814
14913
  };
@@ -29,7 +29,7 @@ function stripInternalEnv(internalEnv) {
29
29
  return userEnv;
30
30
  }
31
31
 
32
- // ../../node_modules/.pnpm/vite@6.1.0_@types+node@18.19.76_jiti@2.4.2_lightningcss@1.29.2/node_modules/vite/dist/node/module-runner.js
32
+ // ../../node_modules/.pnpm/vite@6.1.0_@types+node@20.17.32_jiti@2.4.2_lightningcss@1.29.2/node_modules/vite/dist/node/module-runner.js
33
33
  var VALID_ID_PREFIX = "/@id/";
34
34
  var NULL_BYTE_PLACEHOLDER = "__x00__";
35
35
  var SOURCEMAPPING_URL = "sourceMa";
@@ -1435,20 +1435,21 @@ async function getWorkerEntryExport(path, entrypoint) {
1435
1435
  }
1436
1436
 
1437
1437
  // src/runner-worker/index.ts
1438
+ var IGNORED_KEYS = ["self", "tailStream"];
1438
1439
  var WORKER_ENTRYPOINT_KEYS = [
1439
1440
  "fetch",
1441
+ "queue",
1440
1442
  "tail",
1443
+ "test",
1441
1444
  "trace",
1442
- "scheduled",
1443
- "queue",
1444
- "test"
1445
+ "scheduled"
1445
1446
  ];
1446
1447
  var DURABLE_OBJECT_KEYS = [
1447
- "fetch",
1448
1448
  "alarm",
1449
- "webSocketMessage",
1449
+ "fetch",
1450
1450
  "webSocketClose",
1451
- "webSocketError"
1451
+ "webSocketError",
1452
+ "webSocketMessage"
1452
1453
  ];
1453
1454
  var WORKFLOW_ENTRYPOINT_KEYS = ["run"];
1454
1455
  var entryPath = "";
@@ -1513,7 +1514,7 @@ function createWorkerEntrypointWrapper(entrypoint) {
1513
1514
  if (value !== void 0) {
1514
1515
  return value;
1515
1516
  }
1516
- if (key === "self" || typeof key === "symbol" || DURABLE_OBJECT_KEYS.includes(key)) {
1517
+ if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || DURABLE_OBJECT_KEYS.includes(key)) {
1517
1518
  return;
1518
1519
  }
1519
1520
  const property = getWorkerEntrypointRpcProperty.call(
@@ -1611,7 +1612,7 @@ function createDurableObjectWrapper(className) {
1611
1612
  if (value !== void 0) {
1612
1613
  return value;
1613
1614
  }
1614
- if (key === "self" || typeof key === "symbol" || WORKER_ENTRYPOINT_KEYS.includes(key)) {
1615
+ if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || WORKER_ENTRYPOINT_KEYS.includes(key)) {
1615
1616
  return;
1616
1617
  }
1617
1618
  const property = getDurableObjectRpcProperty.call(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "0.0.0-3af2e30f8",
3
+ "version": "0.0.0-3b384e28c",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -33,18 +33,19 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@hattip/adapter-node": "^0.0.49",
36
+ "@cloudflare/unenv-preset": "2.3.1",
37
+ "@mjackson/node-fetch-server": "^0.6.1",
38
+ "@rollup/plugin-replace": "^6.0.1",
37
39
  "get-port": "^7.1.0",
38
40
  "picocolors": "^1.1.1",
39
41
  "tinyglobby": "^0.2.12",
40
42
  "unenv": "2.0.0-rc.15",
41
43
  "ws": "8.18.0",
42
- "miniflare": "0.0.0-3af2e30f8",
43
- "wrangler": "0.0.0-3af2e30f8",
44
- "@cloudflare/unenv-preset": "0.0.0-3af2e30f8"
44
+ "miniflare": "0.0.0-3b384e28c",
45
+ "wrangler": "0.0.0-3b384e28c"
45
46
  },
46
47
  "devDependencies": {
47
- "@cloudflare/workers-types": "^4.20250404.0",
48
+ "@cloudflare/workers-types": "^4.20250508.0",
48
49
  "@types/node": "^22.10.1",
49
50
  "@types/ws": "^8.5.13",
50
51
  "magic-string": "^0.30.12",
@@ -53,10 +54,10 @@
53
54
  "typescript": "^5.7.2",
54
55
  "undici": "^5.28.5",
55
56
  "vite": "^6.1.0",
56
- "vitest": "~3.0.8",
57
+ "vitest": "~3.1.1",
57
58
  "@cloudflare/mock-npm-registry": "0.0.0",
58
- "@cloudflare/workers-shared": "0.0.0-3af2e30f8",
59
- "@cloudflare/workers-tsconfig": "0.0.0"
59
+ "@cloudflare/workers-tsconfig": "0.0.0",
60
+ "@cloudflare/workers-shared": "0.0.0-3b384e28c"
60
61
  },
61
62
  "peerDependencies": {
62
63
  "vite": "^6.1.0",