@cloudflare/vite-plugin 1.23.0 → 1.23.1
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 +26 -58
- package/dist/index.mjs.map +1 -1
- package/dist/{package-DbYXrONb.mjs → package-BnDqs-gP.mjs} +2 -2
- package/dist/{package-DbYXrONb.mjs.map → package-BnDqs-gP.mjs.map} +1 -1
- package/dist/workers/asset-worker.js +1 -1
- package/dist/workers/runner-worker.js +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -21610,7 +21610,17 @@ function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, en
|
|
|
21610
21610
|
noDiscovery: false,
|
|
21611
21611
|
ignoreOutdatedRequests: true,
|
|
21612
21612
|
entries: vite.normalizePath(workerConfig.main),
|
|
21613
|
-
exclude: [
|
|
21613
|
+
exclude: [
|
|
21614
|
+
...cloudflareBuiltInModules,
|
|
21615
|
+
...nonPrefixedNodeModules,
|
|
21616
|
+
...nonPrefixedNodeModules.map((module$2) => `node:${module$2}`),
|
|
21617
|
+
...[
|
|
21618
|
+
"node:sea",
|
|
21619
|
+
"node:sqlite",
|
|
21620
|
+
"node:test",
|
|
21621
|
+
"node:test/reporters"
|
|
21622
|
+
]
|
|
21623
|
+
],
|
|
21614
21624
|
...isRolldown ? { rolldownOptions: {
|
|
21615
21625
|
platform: "neutral",
|
|
21616
21626
|
resolve: {
|
|
@@ -21620,7 +21630,11 @@ function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, en
|
|
|
21620
21630
|
transform: {
|
|
21621
21631
|
target,
|
|
21622
21632
|
define: define$1
|
|
21623
|
-
}
|
|
21633
|
+
},
|
|
21634
|
+
plugins: [vite.esmExternalRequirePlugin({
|
|
21635
|
+
external: [nodeBuiltinsRE],
|
|
21636
|
+
skipDuplicateCheck: true
|
|
21637
|
+
})]
|
|
21624
21638
|
} } : { esbuildOptions: {
|
|
21625
21639
|
platform: "neutral",
|
|
21626
21640
|
conditions: [...defaultConditions, "development"],
|
|
@@ -26307,23 +26321,7 @@ const nodeJsCompatPlugin = createPlugin("nodejs-compat", (ctx) => {
|
|
|
26307
26321
|
...isRolldown ? { build: { rolldownOptions: { plugins: [vite.esmExternalRequirePlugin({
|
|
26308
26322
|
external: [...nodeJsCompat.externals],
|
|
26309
26323
|
skipDuplicateCheck: true
|
|
26310
|
-
})] } } } : {}
|
|
26311
|
-
optimizeDeps: {
|
|
26312
|
-
exclude: [
|
|
26313
|
-
...nonPrefixedNodeModules,
|
|
26314
|
-
...nonPrefixedNodeModules.map((module$2) => `node:${module$2}`),
|
|
26315
|
-
...[
|
|
26316
|
-
"node:sea",
|
|
26317
|
-
"node:sqlite",
|
|
26318
|
-
"node:test",
|
|
26319
|
-
"node:test/reporters"
|
|
26320
|
-
]
|
|
26321
|
-
],
|
|
26322
|
-
...isRolldown ? { rolldownOptions: { plugins: [vite.esmExternalRequirePlugin({
|
|
26323
|
-
external: [nodeBuiltinsRE],
|
|
26324
|
-
skipDuplicateCheck: true
|
|
26325
|
-
})] } } : {}
|
|
26326
|
-
}
|
|
26324
|
+
})] } } } : {}
|
|
26327
26325
|
};
|
|
26328
26326
|
},
|
|
26329
26327
|
applyToEnvironment(environment) {
|
|
@@ -26375,46 +26373,8 @@ const nodeJsCompatWarningsPlugin = createPlugin("nodejs-compat-warnings", (ctx)
|
|
|
26375
26373
|
exitCallback$1 = () => {
|
|
26376
26374
|
for (const nodeJsCompatWarnings of nodeJsCompatWarningsMap.values()) nodeJsCompatWarnings.renderWarnings();
|
|
26377
26375
|
};
|
|
26378
|
-
function resolveId(environmentName, source, importer) {
|
|
26379
|
-
if (!nodeBuiltinsRE.test(source)) return;
|
|
26380
|
-
const workerConfig = ctx.getWorkerConfig(environmentName);
|
|
26381
|
-
const nodeJsCompat = ctx.getNodeJsCompat(environmentName);
|
|
26382
|
-
if (workerConfig && !nodeJsCompat) {
|
|
26383
|
-
if (hasNodeJsAls(workerConfig) && isNodeAlsModule(source)) return;
|
|
26384
|
-
nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(source, importer);
|
|
26385
|
-
return {
|
|
26386
|
-
id: source,
|
|
26387
|
-
external: true
|
|
26388
|
-
};
|
|
26389
|
-
}
|
|
26390
|
-
}
|
|
26391
26376
|
return {
|
|
26392
26377
|
enforce: "pre",
|
|
26393
|
-
configEnvironment(environmentName) {
|
|
26394
|
-
const workerConfig = ctx.getWorkerConfig(environmentName);
|
|
26395
|
-
const nodeJsCompat = ctx.getNodeJsCompat(environmentName);
|
|
26396
|
-
if (workerConfig && !nodeJsCompat) return { optimizeDeps: { ...isRolldown ? { rolldownOptions: { plugins: [{
|
|
26397
|
-
name: "vite-plugin-cloudflare:nodejs-compat-warnings-resolver",
|
|
26398
|
-
resolveId: {
|
|
26399
|
-
filter: { id: nodeBuiltinsRE },
|
|
26400
|
-
handler(source, importer) {
|
|
26401
|
-
return resolveId(environmentName, source, importer);
|
|
26402
|
-
}
|
|
26403
|
-
}
|
|
26404
|
-
}] } } : { esbuildOptions: { plugins: [{
|
|
26405
|
-
name: "vite-plugin-cloudflare:nodejs-compat-warnings-resolver",
|
|
26406
|
-
setup(build$8) {
|
|
26407
|
-
build$8.onResolve({ filter: nodeBuiltinsRE }, ({ path: path$1, importer }) => {
|
|
26408
|
-
if (hasNodeJsAls(workerConfig) && isNodeAlsModule(path$1)) return;
|
|
26409
|
-
nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(path$1, importer);
|
|
26410
|
-
return {
|
|
26411
|
-
path: path$1,
|
|
26412
|
-
external: true
|
|
26413
|
-
};
|
|
26414
|
-
});
|
|
26415
|
-
}
|
|
26416
|
-
}] } } } };
|
|
26417
|
-
},
|
|
26418
26378
|
configResolved(resolvedViteConfig) {
|
|
26419
26379
|
for (const environmentName of Object.keys(resolvedViteConfig.environments)) {
|
|
26420
26380
|
const workerConfig = ctx.getWorkerConfig(environmentName);
|
|
@@ -26428,7 +26388,15 @@ const nodeJsCompatWarningsPlugin = createPlugin("nodejs-compat-warnings", (ctx)
|
|
|
26428
26388
|
resolveId: {
|
|
26429
26389
|
filter: { id: nodeBuiltinsRE },
|
|
26430
26390
|
handler(source, importer) {
|
|
26431
|
-
|
|
26391
|
+
if (!nodeBuiltinsRE.test(source)) return;
|
|
26392
|
+
const workerConfig = ctx.getWorkerConfig(this.environment.name);
|
|
26393
|
+
assert(workerConfig, `expected workerConfig to be defined`);
|
|
26394
|
+
if (hasNodeJsAls(workerConfig) && isNodeAlsModule(source)) return;
|
|
26395
|
+
nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(source, importer);
|
|
26396
|
+
return {
|
|
26397
|
+
id: source,
|
|
26398
|
+
external: true
|
|
26399
|
+
};
|
|
26432
26400
|
}
|
|
26433
26401
|
}
|
|
26434
26402
|
};
|