@cloudflare/vite-plugin 1.0.3 → 1.0.5
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.js +25 -14
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5832,14 +5832,14 @@ var AssetConfigSchema = z.object({
|
|
|
5832
5832
|
});
|
|
5833
5833
|
|
|
5834
5834
|
// src/asset-config.ts
|
|
5835
|
-
function hasAssetsConfigChanged(resolvedPluginConfig, resolvedViteConfig,
|
|
5835
|
+
function hasAssetsConfigChanged(resolvedPluginConfig, resolvedViteConfig, changedFilePath) {
|
|
5836
5836
|
if (!resolvedPluginConfig.experimental?.headersAndRedirectsDevModeSupport) {
|
|
5837
5837
|
return false;
|
|
5838
5838
|
}
|
|
5839
5839
|
return [
|
|
5840
5840
|
getRedirectsConfigPath(resolvedViteConfig),
|
|
5841
5841
|
getHeadersConfigPath(resolvedViteConfig)
|
|
5842
|
-
].includes(
|
|
5842
|
+
].includes(changedFilePath);
|
|
5843
5843
|
}
|
|
5844
5844
|
function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig) {
|
|
5845
5845
|
const assetsConfig = resolvedPluginConfig.type === "assets-only" ? resolvedPluginConfig.config.assets : entryWorkerConfig?.assets;
|
|
@@ -12910,7 +12910,7 @@ globalThis.${globalName} = var_${globalName}.${exportName};
|
|
|
12910
12910
|
}
|
|
12911
12911
|
function resolveNodeJSImport(source) {
|
|
12912
12912
|
const alias = env.alias[source];
|
|
12913
|
-
if (alias) {
|
|
12913
|
+
if (alias && !nodeCompatExternals.has(alias)) {
|
|
12914
12914
|
return {
|
|
12915
12915
|
unresolved: alias,
|
|
12916
12916
|
resolved: resolvePathSync(alias, { url: import.meta.url })
|
|
@@ -14181,7 +14181,7 @@ function validateWorkerEnvironmentsResolvedConfigs(resolvedPluginConfig, resolve
|
|
|
14181
14181
|
for (const envName of workersEnvironmentNames) {
|
|
14182
14182
|
const workerEnvConfig = resolvedViteConfig.environments[envName];
|
|
14183
14183
|
assert9(workerEnvConfig, `Missing environment config for "${envName}"`);
|
|
14184
|
-
const { optimizeDeps, resolve:
|
|
14184
|
+
const { optimizeDeps, resolve: resolve7 } = workerEnvConfig;
|
|
14185
14185
|
const disallowedConfig = {};
|
|
14186
14186
|
const disallowedOptimizeDepsExcludeEntries = (optimizeDeps.exclude ?? []).filter((entry) => {
|
|
14187
14187
|
if (cloudflareBuiltInModules.includes(entry)) {
|
|
@@ -14195,8 +14195,8 @@ function validateWorkerEnvironmentsResolvedConfigs(resolvedPluginConfig, resolve
|
|
|
14195
14195
|
if (disallowedOptimizeDepsExcludeEntries.length > 0) {
|
|
14196
14196
|
disallowedConfig.optimizeDepsExclude = disallowedOptimizeDepsExcludeEntries;
|
|
14197
14197
|
}
|
|
14198
|
-
if (
|
|
14199
|
-
disallowedConfig.resolveExternal =
|
|
14198
|
+
if (resolve7.external === true || resolve7.external.length > 0) {
|
|
14199
|
+
disallowedConfig.resolveExternal = resolve7.external;
|
|
14200
14200
|
}
|
|
14201
14201
|
if (Object.keys(disallowedConfig).length > 0) {
|
|
14202
14202
|
disallowedEnvsConfigs.set(envName, disallowedConfig);
|
|
@@ -14402,14 +14402,12 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14402
14402
|
}
|
|
14403
14403
|
},
|
|
14404
14404
|
hotUpdate(options) {
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
resolvedPluginConfig
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
)
|
|
14412
|
-
) {
|
|
14405
|
+
const changedFilePath = path9.resolve(options.file);
|
|
14406
|
+
if (resolvedPluginConfig.configPaths.has(changedFilePath) || hasDotDevDotVarsFileChanged(resolvedPluginConfig, changedFilePath) || hasAssetsConfigChanged(
|
|
14407
|
+
resolvedPluginConfig,
|
|
14408
|
+
resolvedViteConfig,
|
|
14409
|
+
changedFilePath
|
|
14410
|
+
)) {
|
|
14413
14411
|
options.server.restart();
|
|
14414
14412
|
return [];
|
|
14415
14413
|
}
|
|
@@ -14824,6 +14822,19 @@ function getDotDevDotVarsContent(configPath, cloudflareEnv) {
|
|
|
14824
14822
|
}
|
|
14825
14823
|
return null;
|
|
14826
14824
|
}
|
|
14825
|
+
function hasDotDevDotVarsFileChanged(resolvedPluginConfig, changedFilePath) {
|
|
14826
|
+
return [...resolvedPluginConfig.configPaths].some((configPath) => {
|
|
14827
|
+
const dotDevDotVars = path9.join(path9.dirname(configPath), ".dev.vars");
|
|
14828
|
+
if (dotDevDotVars === changedFilePath) {
|
|
14829
|
+
return true;
|
|
14830
|
+
}
|
|
14831
|
+
if (resolvedPluginConfig.cloudflareEnv) {
|
|
14832
|
+
const dotDevDotVarsForEnv = `${dotDevDotVars}.${resolvedPluginConfig.cloudflareEnv}`;
|
|
14833
|
+
return dotDevDotVarsForEnv === changedFilePath;
|
|
14834
|
+
}
|
|
14835
|
+
return false;
|
|
14836
|
+
});
|
|
14837
|
+
}
|
|
14827
14838
|
export {
|
|
14828
14839
|
cloudflare2 as cloudflare
|
|
14829
14840
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"tinyglobby": "^0.2.12",
|
|
41
41
|
"unenv": "2.0.0-rc.15",
|
|
42
42
|
"ws": "8.18.0",
|
|
43
|
-
"miniflare": "4.20250408.0",
|
|
44
43
|
"@cloudflare/unenv-preset": "2.3.1",
|
|
45
|
-
"
|
|
44
|
+
"miniflare": "4.20250409.0",
|
|
45
|
+
"wrangler": "4.10.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@cloudflare/workers-types": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20250409.0",
|
|
49
49
|
"@types/node": "^22.10.1",
|
|
50
50
|
"@types/ws": "^8.5.13",
|
|
51
51
|
"magic-string": "^0.30.12",
|