@cloudflare/vite-plugin 2.0.0-beta.v.15 → 2.0.0-beta.v.16
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.
|
@@ -5189,17 +5189,27 @@ const staticRedirectsMatcher = (configuration, host, pathname) => {
|
|
|
5189
5189
|
else return withoutHostMatch;
|
|
5190
5190
|
return withHostMatch || withoutHostMatch;
|
|
5191
5191
|
};
|
|
5192
|
-
const generateRedirectsMatcher = (configuration) => generateRulesMatcher(configuration.redirects.version === REDIRECTS_VERSION ? configuration.redirects.rules : {}, ({ status, to }, replacements) => {
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5192
|
+
const generateRedirectsMatcher = (configuration) => generateRulesMatcher(configuration.redirects.version === REDIRECTS_VERSION ? configuration.redirects.rules : {}, ({ status, to }, replacements) => ({
|
|
5193
|
+
status,
|
|
5194
|
+
to: normalizeRedirectTarget(to, replacements)
|
|
5195
|
+
}));
|
|
5196
|
+
/**
|
|
5197
|
+
* Replace redirect placeholders and normalize relative pathnames without changing
|
|
5198
|
+
* query values, fragments or explicitly configured external URLs.
|
|
5199
|
+
*
|
|
5200
|
+
* @param value The configured redirect target before placeholder replacement.
|
|
5201
|
+
* @param replacements Placeholder values captured from the request.
|
|
5202
|
+
* @returns A substituted target with repeated relative pathname separators collapsed.
|
|
5203
|
+
*/
|
|
5204
|
+
function normalizeRedirectTarget(value, replacements) {
|
|
5205
|
+
const isExternal = /^(?:\w+:\/\/|\/\/[^/\\\s?#])/.test(value.trim());
|
|
5206
|
+
const target = replacer(value, replacements).trim();
|
|
5207
|
+
if (isExternal) return target;
|
|
5208
|
+
const suffixStart = target.search(/[?#]/);
|
|
5209
|
+
const pathname = suffixStart === -1 ? target : target.slice(0, suffixStart);
|
|
5210
|
+
const suffix = suffixStart === -1 ? "" : target.slice(suffixStart);
|
|
5211
|
+
return pathname.replace(/[/\\]+/g, "/") + suffix;
|
|
5212
|
+
}
|
|
5203
5213
|
|
|
5204
5214
|
//#endregion
|
|
5205
5215
|
//#region ../workers-shared/asset-worker/src/utils/headers.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "2.0.0-beta.v.
|
|
3
|
+
"version": "2.0.0-beta.v.16",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"unenv": "2.0.0-rc.24",
|
|
44
44
|
"ws": "8.21.0",
|
|
45
45
|
"@cloudflare/build-output-utils": "0.9.13",
|
|
46
|
-
"@cloudflare/runtime-types": "0.1.
|
|
46
|
+
"@cloudflare/runtime-types": "0.1.27",
|
|
47
47
|
"@cloudflare/config": "0.32.0",
|
|
48
48
|
"@cloudflare/unenv-preset": "2.16.2",
|
|
49
|
-
"miniflare": "5.20261110.
|
|
49
|
+
"miniflare": "5.20261110.2-beta"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@cloudflare/workers-types": "^5.20261110.1",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"vite": "8.3.4",
|
|
70
70
|
"vite-legacy": "npm:vite@7.1.12",
|
|
71
71
|
"vitest": "5.0.4",
|
|
72
|
-
"@cloudflare/containers-shared": "0.26.0",
|
|
73
72
|
"@cloudflare/cli-shared-helpers": "0.3.7",
|
|
74
|
-
"@cloudflare/
|
|
75
|
-
"@cloudflare/remote-bindings": "0.0.63",
|
|
73
|
+
"@cloudflare/containers-shared": "0.26.0",
|
|
76
74
|
"@cloudflare/workers-auth": "0.18.1",
|
|
77
|
-
"@cloudflare/
|
|
78
|
-
"@cloudflare/
|
|
79
|
-
"@cloudflare/workers-
|
|
75
|
+
"@cloudflare/remote-bindings": "0.0.64",
|
|
76
|
+
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
77
|
+
"@cloudflare/workers-shared": "0.20.3",
|
|
78
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
79
|
+
"@cloudflare/workers-utils": "0.53.1"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"vite": "^7.0.0 || ^8.0.0"
|