@cloudflare/vite-plugin 0.0.0-3fb801f73 → 0.0.0-41555f831
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/asset-workers/asset-worker.js +663 -753
- package/dist/asset-workers/router-worker.js +563 -639
- package/dist/index.js +36 -47
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1236,7 +1236,6 @@ function createCloudflareEnvironmentOptions(workerConfig, userConfig, environmen
|
|
|
1236
1236
|
optimizeDeps: {
|
|
1237
1237
|
// Note: ssr pre-bundling is opt-in and we need to enable it by setting `noDiscovery` to false
|
|
1238
1238
|
noDiscovery: false,
|
|
1239
|
-
entries: workerConfig.main,
|
|
1240
1239
|
exclude: [
|
|
1241
1240
|
...cloudflareBuiltInModules,
|
|
1242
1241
|
// we have to exclude all node modules to work in dev-mode not just the unenv externals...
|
|
@@ -1322,33 +1321,33 @@ function writeDeployConfig(resolvedPluginConfig, resolvedViteConfig) {
|
|
|
1322
1321
|
};
|
|
1323
1322
|
fs.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
|
|
1324
1323
|
} else {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
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];
|
|
1344
1343
|
assert2(
|
|
1345
|
-
|
|
1346
|
-
`Unexpected error:
|
|
1344
|
+
configPath,
|
|
1345
|
+
`Unexpected error: ${entryWorkerEnvironmentName} environment output directory is undefined`
|
|
1347
1346
|
);
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
};
|
|
1347
|
+
const auxiliaryWorkers = Object.entries(workerConfigPaths).filter(
|
|
1348
|
+
([environmentName]) => environmentName !== entryWorkerEnvironmentName
|
|
1349
|
+
).map(([_, configPath2]) => ({ configPath: configPath2 }));
|
|
1350
|
+
const deployConfig = { configPath, auxiliaryWorkers };
|
|
1352
1351
|
fs.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
|
|
1353
1352
|
}
|
|
1354
1353
|
}
|
|
@@ -2305,6 +2304,7 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
2305
2304
|
)
|
|
2306
2305
|
);
|
|
2307
2306
|
}
|
|
2307
|
+
writeDeployConfig(resolvedPluginConfig, resolvedViteConfig);
|
|
2308
2308
|
}
|
|
2309
2309
|
}
|
|
2310
2310
|
};
|
|
@@ -2376,11 +2376,6 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
2376
2376
|
source: JSON.stringify(config)
|
|
2377
2377
|
});
|
|
2378
2378
|
},
|
|
2379
|
-
writeBundle() {
|
|
2380
|
-
if (this.environment.name === (resolvedPluginConfig.type === "assets-only" ? "client" : resolvedPluginConfig.entryWorkerEnvironmentName)) {
|
|
2381
|
-
writeDeployConfig(resolvedPluginConfig, resolvedViteConfig);
|
|
2382
|
-
}
|
|
2383
|
-
},
|
|
2384
2379
|
handleHotUpdate(options) {
|
|
2385
2380
|
if (resolvedPluginConfig.configPaths.has(options.file)) {
|
|
2386
2381
|
options.server.restart();
|
|
@@ -2405,14 +2400,11 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
2405
2400
|
resolvedPluginConfig,
|
|
2406
2401
|
miniflare
|
|
2407
2402
|
);
|
|
2408
|
-
const middleware = createMiddleware(
|
|
2409
|
-
(
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
},
|
|
2414
|
-
{ alwaysCallNext: false }
|
|
2415
|
-
);
|
|
2403
|
+
const middleware = createMiddleware(({ request }) => {
|
|
2404
|
+
return entryWorker.fetch(toMiniflareRequest(request), {
|
|
2405
|
+
redirect: "manual"
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2416
2408
|
handleWebSocket(
|
|
2417
2409
|
viteDevServer.httpServer,
|
|
2418
2410
|
entryWorker.fetch,
|
|
@@ -2431,14 +2423,11 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
2431
2423
|
pluginConfig.persistState ?? true
|
|
2432
2424
|
)
|
|
2433
2425
|
);
|
|
2434
|
-
const middleware = createMiddleware(
|
|
2435
|
-
(
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
},
|
|
2440
|
-
{ alwaysCallNext: false }
|
|
2441
|
-
);
|
|
2426
|
+
const middleware = createMiddleware(({ request }) => {
|
|
2427
|
+
return miniflare2.dispatchFetch(toMiniflareRequest(request), {
|
|
2428
|
+
redirect: "manual"
|
|
2429
|
+
});
|
|
2430
|
+
});
|
|
2442
2431
|
handleWebSocket(
|
|
2443
2432
|
vitePreviewServer.httpServer,
|
|
2444
2433
|
miniflare2.dispatchFetch,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-41555f831",
|
|
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-
|
|
40
|
+
"miniflare": "0.0.0-41555f831"
|
|
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-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
50
|
+
"@cloudflare/workers-shared": "0.0.0-41555f831",
|
|
51
|
+
"wrangler": "0.0.0-41555f831",
|
|
52
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vite": "^6.1.0",
|