@cloudflare/vite-plugin 0.0.0-060a4db04 → 0.0.0-08e37f6e2

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.
@@ -2587,7 +2587,7 @@ var cr = class extends Hs {
2587
2587
  try {
2588
2588
  this.env.JAEGER || (this.env.JAEGER = er()), e = Qn(t, this.ctx, this.env.SENTRY_DSN, this.env.SENTRY_ACCESS_CLIENT_ID, this.env.SENTRY_ACCESS_CLIENT_SECRET, this.env.COLO_METADATA, this.env.VERSION_METADATA, this.env.CONFIG?.account_id, this.env.CONFIG?.script_id);
2589
2589
  let i = Gt(this.env.CONFIG), o = t.headers.get("user-agent") ?? "UA UNKNOWN", a = new URL(t.url);
2590
- return this.env.COLO_METADATA && this.env.VERSION_METADATA && this.env.CONFIG && n.setData({ accountId: this.env.CONFIG.account_id, scriptId: this.env.CONFIG.script_id, coloId: this.env.COLO_METADATA.coloId, metalId: this.env.COLO_METADATA.metalId, coloTier: this.env.COLO_METADATA.coloTier, coloRegion: this.env.COLO_METADATA.coloRegion, version: this.env.VERSION_METADATA.id, hostname: a.hostname, htmlHandling: i.html_handling, notFoundHandling: i.not_found_handling, userAgent: o }), await this.env.JAEGER.enterSpan("handleRequest", async (c) => (c.setTags({ hostname: a.hostname, eyeballPath: a.pathname, env: this.env.ENVIRONMENT, version: this.env.VERSION_METADATA?.id }), or(t, this.env, i, this.unstable_exists.bind(this), this.unstable_getByETag.bind(this))));
2590
+ return this.env.COLO_METADATA && this.env.VERSION_METADATA && this.env.CONFIG && n.setData({ accountId: this.env.CONFIG.account_id, scriptId: this.env.CONFIG.script_id, coloId: this.env.COLO_METADATA.coloId, metalId: this.env.COLO_METADATA.metalId, coloTier: this.env.COLO_METADATA.coloTier, coloRegion: this.env.COLO_METADATA.coloRegion, version: this.env.VERSION_METADATA.tag, hostname: a.hostname, htmlHandling: i.html_handling, notFoundHandling: i.not_found_handling, userAgent: o }), await this.env.JAEGER.enterSpan("handleRequest", async (c) => (c.setTags({ hostname: a.hostname, eyeballPath: a.pathname, env: this.env.ENVIRONMENT, version: this.env.VERSION_METADATA?.id }), or(t, this.env, i, this.unstable_exists.bind(this), this.unstable_getByETag.bind(this))));
2591
2591
  } catch (i) {
2592
2592
  return this.handleError(e, n, i);
2593
2593
  } finally {
@@ -2298,7 +2298,7 @@ var nc = { async fetch(t, e, n) {
2298
2298
  try {
2299
2299
  e.JAEGER || (e.JAEGER = Cn()), r = vn(t, n, e.SENTRY_DSN, e.SENTRY_ACCESS_CLIENT_ID, e.SENTRY_ACCESS_CLIENT_SECRET, e.COLO_METADATA, e.VERSION_METADATA, e.CONFIG?.account_id, e.CONFIG?.script_id);
2300
2300
  let u = new URL(t.url);
2301
- e.COLO_METADATA && e.VERSION_METADATA && e.CONFIG && i.setData({ accountId: e.CONFIG.account_id, scriptId: e.CONFIG.script_id, coloId: e.COLO_METADATA.coloId, metalId: e.COLO_METADATA.metalId, coloTier: e.COLO_METADATA.coloTier, coloRegion: e.COLO_METADATA.coloRegion, hostname: u.hostname, version: e.VERSION_METADATA.id, userWorkerAhead: e.CONFIG.invoke_user_worker_ahead_of_assets });
2301
+ e.COLO_METADATA && e.VERSION_METADATA && e.CONFIG && i.setData({ accountId: e.CONFIG.account_id, scriptId: e.CONFIG.script_id, coloId: e.COLO_METADATA.coloId, metalId: e.COLO_METADATA.metalId, coloTier: e.COLO_METADATA.coloTier, coloRegion: e.COLO_METADATA.coloRegion, hostname: u.hostname, version: e.VERSION_METADATA.tag, userWorkerAhead: e.CONFIG.invoke_user_worker_ahead_of_assets });
2302
2302
  let c = t.clone();
2303
2303
  if (e.CONFIG.invoke_user_worker_ahead_of_assets) {
2304
2304
  if (!e.CONFIG.has_user_worker) throw new Error("Fetch for user worker without having a user worker binding");
package/dist/index.js CHANGED
@@ -1321,33 +1321,33 @@ function writeDeployConfig(resolvedPluginConfig, resolvedViteConfig) {
1321
1321
  };
1322
1322
  fs.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
1323
1323
  } else {
1324
- const workerConfigPaths = Object.fromEntries(
1325
- Object.keys(resolvedPluginConfig.workers).map((environmentName) => {
1326
- const outputDirectory = resolvedViteConfig.environments[environmentName]?.build.outDir;
1327
- assert2(
1328
- outputDirectory,
1329
- `Unexpected error: ${environmentName} environment output directory is undefined`
1330
- );
1331
- return [
1332
- environmentName,
1333
- getRelativePathToWorkerConfig(
1334
- deployConfigDirectory,
1335
- resolvedViteConfig.root,
1336
- outputDirectory
1337
- )
1338
- ];
1339
- })
1340
- );
1341
- const { entryWorkerEnvironmentName } = resolvedPluginConfig;
1342
- const configPath = workerConfigPaths[entryWorkerEnvironmentName];
1324
+ let entryWorkerConfigPath;
1325
+ const auxiliaryWorkers = [];
1326
+ for (const environmentName of Object.keys(resolvedPluginConfig.workers)) {
1327
+ const outputDirectory = resolvedViteConfig.environments[environmentName]?.build.outDir;
1328
+ assert2(
1329
+ outputDirectory,
1330
+ `Unexpected error: ${environmentName} environment output directory is undefined`
1331
+ );
1332
+ const configPath = getRelativePathToWorkerConfig(
1333
+ deployConfigDirectory,
1334
+ resolvedViteConfig.root,
1335
+ outputDirectory
1336
+ );
1337
+ if (environmentName === resolvedPluginConfig.entryWorkerEnvironmentName) {
1338
+ entryWorkerConfigPath = configPath;
1339
+ } else {
1340
+ auxiliaryWorkers.push({ configPath });
1341
+ }
1342
+ }
1343
1343
  assert2(
1344
- configPath,
1345
- `Unexpected error: ${entryWorkerEnvironmentName} environment output directory is undefined`
1344
+ entryWorkerConfigPath,
1345
+ `Unexpected error: entryWorkerConfigPath is undefined`
1346
1346
  );
1347
- const auxiliaryWorkers = Object.entries(workerConfigPaths).filter(
1348
- ([environmentName]) => environmentName !== entryWorkerEnvironmentName
1349
- ).map(([_, configPath2]) => ({ configPath: configPath2 }));
1350
- const deployConfig = { configPath, auxiliaryWorkers };
1347
+ const deployConfig = {
1348
+ configPath: entryWorkerConfigPath,
1349
+ auxiliaryWorkers
1350
+ };
1351
1351
  fs.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
1352
1352
  }
1353
1353
  }
@@ -2304,7 +2304,6 @@ function cloudflare2(pluginConfig = {}) {
2304
2304
  )
2305
2305
  );
2306
2306
  }
2307
- writeDeployConfig(resolvedPluginConfig, resolvedViteConfig);
2308
2307
  }
2309
2308
  }
2310
2309
  };
@@ -2376,6 +2375,11 @@ function cloudflare2(pluginConfig = {}) {
2376
2375
  source: JSON.stringify(config)
2377
2376
  });
2378
2377
  },
2378
+ writeBundle() {
2379
+ if (this.environment.name === (resolvedPluginConfig.type === "assets-only" ? "client" : resolvedPluginConfig.entryWorkerEnvironmentName)) {
2380
+ writeDeployConfig(resolvedPluginConfig, resolvedViteConfig);
2381
+ }
2382
+ },
2379
2383
  handleHotUpdate(options) {
2380
2384
  if (resolvedPluginConfig.configPaths.has(options.file)) {
2381
2385
  options.server.restart();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "0.0.0-060a4db04",
3
+ "version": "0.0.0-08e37f6e2",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -37,7 +37,7 @@
37
37
  "@hattip/adapter-node": "^0.0.49",
38
38
  "unenv": "2.0.0-rc.1",
39
39
  "ws": "^8.18.0",
40
- "miniflare": "0.0.0-060a4db04"
40
+ "miniflare": "0.0.0-08e37f6e2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@cloudflare/workers-types": "^4.20250204.0",
@@ -47,9 +47,9 @@
47
47
  "tsup": "8.3.0",
48
48
  "typescript": "^5.7.2",
49
49
  "vite": "^6.1.0",
50
- "@cloudflare/workers-shared": "0.0.0-060a4db04",
51
50
  "@cloudflare/workers-tsconfig": "0.0.0",
52
- "wrangler": "0.0.0-060a4db04"
51
+ "@cloudflare/workers-shared": "0.0.0-08e37f6e2",
52
+ "wrangler": "0.0.0-08e37f6e2"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "vite": "^6.1.0",