@cloudflare/vite-plugin 1.69.0 → 1.70.0
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/chunk-U6NEESU5--BOJR7M9.mjs +43 -0
- package/dist/index.mjs +42959 -13371
- package/dist/{open-PCXX3ZDZ-f1X9geqt.mjs → open-PCXX3ZDZ-DTR_GsOE.mjs} +1 -1
- package/dist/open-PCXX3ZDZ-_ZOu6YI3.mjs +530 -0
- package/dist/{package-CMKi-Xbu.mjs → package-DkFDJdC8.mjs} +6 -6
- package/dist/workers/asset-worker/index.js +21 -11
- package/package.json +8 -8
- /package/dist/{chunk-U6NEESU5-BwoIZAaT.mjs → chunk-U6NEESU5-BQnRVk7-.mjs} +0 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { r as __name } from "./chunk-U6NEESU5--BOJR7M9.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import fs2 from "node:fs";
|
|
4
|
+
import path__default from "node:path";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import { promisify } from "node:util";
|
|
7
|
+
import process from "node:process";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { Buffer } from "node:buffer";
|
|
10
|
+
import fs, { constants as constants$1 } from "node:fs/promises";
|
|
11
|
+
import childProcess, { execFile } from "node:child_process";
|
|
12
|
+
|
|
13
|
+
//#region ../../node_modules/.pnpm/@cloudflare+workers-utils@0.54.1_vitest@5.0.4_@opentelemetry+api@1.9.1_@types+node@22.1_3fab1fd682aa9fa31ade5e61a1ad4724/node_modules/@cloudflare/workers-utils/dist/open-PCXX3ZDZ.mjs
|
|
14
|
+
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
15
|
+
var isDockerCached;
|
|
16
|
+
function hasDockerEnv() {
|
|
17
|
+
try {
|
|
18
|
+
fs2.statSync("/.dockerenv");
|
|
19
|
+
return true;
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
__name(hasDockerEnv, "hasDockerEnv");
|
|
25
|
+
function hasDockerCGroup() {
|
|
26
|
+
try {
|
|
27
|
+
return fs2.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
__name(hasDockerCGroup, "hasDockerCGroup");
|
|
33
|
+
function isDocker() {
|
|
34
|
+
if (isDockerCached === void 0) isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
35
|
+
return isDockerCached;
|
|
36
|
+
}
|
|
37
|
+
__name(isDocker, "isDocker");
|
|
38
|
+
var cachedResult;
|
|
39
|
+
var hasContainerEnv = /* @__PURE__ */ __name(() => {
|
|
40
|
+
try {
|
|
41
|
+
fs2.statSync("/run/.containerenv");
|
|
42
|
+
return true;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}, "hasContainerEnv");
|
|
47
|
+
function isInsideContainer() {
|
|
48
|
+
if (cachedResult === void 0) cachedResult = hasContainerEnv() || isDocker();
|
|
49
|
+
return cachedResult;
|
|
50
|
+
}
|
|
51
|
+
__name(isInsideContainer, "isInsideContainer");
|
|
52
|
+
var isWsl = /* @__PURE__ */ __name(() => {
|
|
53
|
+
if (process.platform !== "linux") return false;
|
|
54
|
+
if (os.release().toLowerCase().includes("microsoft")) {
|
|
55
|
+
if (isInsideContainer()) return false;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
return fs2.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}, "isWsl");
|
|
64
|
+
var is_wsl_default = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
65
|
+
var execFile$1 = promisify(childProcess.execFile);
|
|
66
|
+
var powerShellPath = /* @__PURE__ */ __name(() => `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, "powerShellPath");
|
|
67
|
+
var executePowerShell = /* @__PURE__ */ __name(async (command, options = {}) => {
|
|
68
|
+
const { powerShellPath: psPath,...execFileOptions } = options;
|
|
69
|
+
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
70
|
+
return execFile$1(psPath ?? powerShellPath(), [...executePowerShell.argumentsPrefix, encodedCommand], {
|
|
71
|
+
encoding: "utf8",
|
|
72
|
+
...execFileOptions
|
|
73
|
+
});
|
|
74
|
+
}, "executePowerShell");
|
|
75
|
+
executePowerShell.argumentsPrefix = [
|
|
76
|
+
"-NoProfile",
|
|
77
|
+
"-NonInteractive",
|
|
78
|
+
"-ExecutionPolicy",
|
|
79
|
+
"Bypass",
|
|
80
|
+
"-EncodedCommand"
|
|
81
|
+
];
|
|
82
|
+
executePowerShell.encodeCommand = (command) => Buffer.from(command, "utf16le").toString("base64");
|
|
83
|
+
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
84
|
+
function parseMountPointFromConfig(content) {
|
|
85
|
+
for (const line of content.split("\n")) {
|
|
86
|
+
if (/^\s*#/.test(line)) continue;
|
|
87
|
+
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
88
|
+
if (!match) continue;
|
|
89
|
+
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__name(parseMountPointFromConfig, "parseMountPointFromConfig");
|
|
93
|
+
var execFile2 = promisify(childProcess.execFile);
|
|
94
|
+
var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
95
|
+
const defaultMountPoint = "/mnt/";
|
|
96
|
+
let mountPoint;
|
|
97
|
+
return async function() {
|
|
98
|
+
if (mountPoint) return mountPoint;
|
|
99
|
+
const configFilePath = "/etc/wsl.conf";
|
|
100
|
+
let isConfigFileExists = false;
|
|
101
|
+
try {
|
|
102
|
+
await fs.access(configFilePath, constants$1.F_OK);
|
|
103
|
+
isConfigFileExists = true;
|
|
104
|
+
} catch {}
|
|
105
|
+
if (!isConfigFileExists) return defaultMountPoint;
|
|
106
|
+
const parsedMountPoint = parseMountPointFromConfig(await fs.readFile(configFilePath, { encoding: "utf8" }));
|
|
107
|
+
if (parsedMountPoint === void 0) return defaultMountPoint;
|
|
108
|
+
mountPoint = parsedMountPoint;
|
|
109
|
+
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
110
|
+
return mountPoint;
|
|
111
|
+
};
|
|
112
|
+
})();
|
|
113
|
+
var powerShellPath2 = is_wsl_default ? /* @__PURE__ */ __name(async () => {
|
|
114
|
+
return `${await wslDrivesMountPoint()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
115
|
+
}, "powerShellPathFromWsl") : powerShellPath;
|
|
116
|
+
var canAccessPowerShellPromise;
|
|
117
|
+
var canAccessPowerShell = /* @__PURE__ */ __name(async () => {
|
|
118
|
+
canAccessPowerShellPromise ??= (async () => {
|
|
119
|
+
try {
|
|
120
|
+
const psPath = await powerShellPath2();
|
|
121
|
+
await fs.access(psPath, constants$1.X_OK);
|
|
122
|
+
return true;
|
|
123
|
+
} catch {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
})();
|
|
127
|
+
return canAccessPowerShellPromise;
|
|
128
|
+
}, "canAccessPowerShell");
|
|
129
|
+
var wslDefaultBrowser = /* @__PURE__ */ __name(async () => {
|
|
130
|
+
const psPath = await powerShellPath2();
|
|
131
|
+
const { stdout: stdout$1 } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
|
|
132
|
+
return stdout$1.trim();
|
|
133
|
+
}, "wslDefaultBrowser");
|
|
134
|
+
var convertWslPathToWindows = /* @__PURE__ */ __name(async (path2) => {
|
|
135
|
+
if (/^[a-z]+:\/\//i.test(path2)) return path2;
|
|
136
|
+
try {
|
|
137
|
+
const { stdout: stdout$1 } = await execFile2("wslpath", ["-aw", path2], { encoding: "utf8" });
|
|
138
|
+
return stdout$1.trim();
|
|
139
|
+
} catch {
|
|
140
|
+
return path2;
|
|
141
|
+
}
|
|
142
|
+
}, "convertWslPathToWindows");
|
|
143
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
144
|
+
const define = /* @__PURE__ */ __name((value) => Object.defineProperty(object, propertyName, {
|
|
145
|
+
value,
|
|
146
|
+
enumerable: true,
|
|
147
|
+
writable: true
|
|
148
|
+
}), "define");
|
|
149
|
+
Object.defineProperty(object, propertyName, {
|
|
150
|
+
configurable: true,
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get() {
|
|
153
|
+
const result = valueGetter();
|
|
154
|
+
define(result);
|
|
155
|
+
return result;
|
|
156
|
+
},
|
|
157
|
+
set(value) {
|
|
158
|
+
define(value);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return object;
|
|
162
|
+
}
|
|
163
|
+
__name(defineLazyProperty, "defineLazyProperty");
|
|
164
|
+
var execFileAsync = promisify(execFile);
|
|
165
|
+
async function defaultBrowserId() {
|
|
166
|
+
if (process.platform !== "darwin") throw new Error("macOS only");
|
|
167
|
+
const { stdout: stdout$1 } = await execFileAsync("defaults", [
|
|
168
|
+
"read",
|
|
169
|
+
"com.apple.LaunchServices/com.apple.launchservices.secure",
|
|
170
|
+
"LSHandlers"
|
|
171
|
+
]);
|
|
172
|
+
const browserId = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout$1)?.groups.id ?? "com.apple.Safari";
|
|
173
|
+
if (browserId === "com.apple.safari") return "com.apple.Safari";
|
|
174
|
+
return browserId;
|
|
175
|
+
}
|
|
176
|
+
__name(defaultBrowserId, "defaultBrowserId");
|
|
177
|
+
var execFileAsync2 = promisify(execFile);
|
|
178
|
+
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
179
|
+
if (process.platform !== "darwin") throw new Error("macOS only");
|
|
180
|
+
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
181
|
+
const execOptions = {};
|
|
182
|
+
if (signal) execOptions.signal = signal;
|
|
183
|
+
const { stdout: stdout$1 } = await execFileAsync2("osascript", [
|
|
184
|
+
"-e",
|
|
185
|
+
script,
|
|
186
|
+
outputArguments
|
|
187
|
+
], execOptions);
|
|
188
|
+
return stdout$1.trim();
|
|
189
|
+
}
|
|
190
|
+
__name(runAppleScript, "runAppleScript");
|
|
191
|
+
async function bundleName(bundleId) {
|
|
192
|
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
193
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
194
|
+
}
|
|
195
|
+
__name(bundleName, "bundleName");
|
|
196
|
+
var execFileAsync3 = promisify(execFile);
|
|
197
|
+
var windowsBrowserProgIds = {
|
|
198
|
+
MSEdgeHTM: {
|
|
199
|
+
name: "Edge",
|
|
200
|
+
id: "com.microsoft.edge"
|
|
201
|
+
},
|
|
202
|
+
MSEdgeBHTML: {
|
|
203
|
+
name: "Edge Beta",
|
|
204
|
+
id: "com.microsoft.edge.beta"
|
|
205
|
+
},
|
|
206
|
+
MSEdgeDHTML: {
|
|
207
|
+
name: "Edge Dev",
|
|
208
|
+
id: "com.microsoft.edge.dev"
|
|
209
|
+
},
|
|
210
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
|
|
211
|
+
name: "Edge",
|
|
212
|
+
id: "com.microsoft.edge.old"
|
|
213
|
+
},
|
|
214
|
+
ChromeHTML: {
|
|
215
|
+
name: "Chrome",
|
|
216
|
+
id: "com.google.chrome"
|
|
217
|
+
},
|
|
218
|
+
ChromeBHTML: {
|
|
219
|
+
name: "Chrome Beta",
|
|
220
|
+
id: "com.google.chrome.beta"
|
|
221
|
+
},
|
|
222
|
+
ChromeDHTML: {
|
|
223
|
+
name: "Chrome Dev",
|
|
224
|
+
id: "com.google.chrome.dev"
|
|
225
|
+
},
|
|
226
|
+
ChromiumHTM: {
|
|
227
|
+
name: "Chromium",
|
|
228
|
+
id: "org.chromium.Chromium"
|
|
229
|
+
},
|
|
230
|
+
BraveHTML: {
|
|
231
|
+
name: "Brave",
|
|
232
|
+
id: "com.brave.Browser"
|
|
233
|
+
},
|
|
234
|
+
BraveBHTML: {
|
|
235
|
+
name: "Brave Beta",
|
|
236
|
+
id: "com.brave.Browser.beta"
|
|
237
|
+
},
|
|
238
|
+
BraveDHTML: {
|
|
239
|
+
name: "Brave Dev",
|
|
240
|
+
id: "com.brave.Browser.dev"
|
|
241
|
+
},
|
|
242
|
+
BraveSSHTM: {
|
|
243
|
+
name: "Brave Nightly",
|
|
244
|
+
id: "com.brave.Browser.nightly"
|
|
245
|
+
},
|
|
246
|
+
FirefoxURL: {
|
|
247
|
+
name: "Firefox",
|
|
248
|
+
id: "org.mozilla.firefox"
|
|
249
|
+
},
|
|
250
|
+
OperaStable: {
|
|
251
|
+
name: "Opera",
|
|
252
|
+
id: "com.operasoftware.Opera"
|
|
253
|
+
},
|
|
254
|
+
VivaldiHTM: {
|
|
255
|
+
name: "Vivaldi",
|
|
256
|
+
id: "com.vivaldi.Vivaldi"
|
|
257
|
+
},
|
|
258
|
+
"IE.HTTP": {
|
|
259
|
+
name: "Internet Explorer",
|
|
260
|
+
id: "com.microsoft.ie"
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
264
|
+
var UnknownBrowserError = class extends Error {
|
|
265
|
+
static {
|
|
266
|
+
__name(this, "UnknownBrowserError");
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
270
|
+
const { stdout: stdout$1 } = await _execFileAsync("reg", [
|
|
271
|
+
"QUERY",
|
|
272
|
+
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
273
|
+
"/v",
|
|
274
|
+
"ProgId"
|
|
275
|
+
]);
|
|
276
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout$1);
|
|
277
|
+
if (!match) throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout$1)}`);
|
|
278
|
+
const { id } = match.groups;
|
|
279
|
+
const browser = windowsBrowserProgIds[id];
|
|
280
|
+
if (!browser) throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
|
|
281
|
+
return browser;
|
|
282
|
+
}
|
|
283
|
+
__name(defaultBrowser, "defaultBrowser");
|
|
284
|
+
var execFileAsync4 = promisify(execFile);
|
|
285
|
+
var titleize = /* @__PURE__ */ __name((string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase()), "titleize");
|
|
286
|
+
async function defaultBrowser2() {
|
|
287
|
+
if (process.platform === "darwin") {
|
|
288
|
+
const id = await defaultBrowserId();
|
|
289
|
+
return {
|
|
290
|
+
name: await bundleName(id),
|
|
291
|
+
id
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (process.platform === "linux") {
|
|
295
|
+
const { stdout: stdout$1 } = await execFileAsync4("xdg-mime", [
|
|
296
|
+
"query",
|
|
297
|
+
"default",
|
|
298
|
+
"x-scheme-handler/http"
|
|
299
|
+
]);
|
|
300
|
+
const id = stdout$1.trim();
|
|
301
|
+
return {
|
|
302
|
+
name: titleize(id.replace(/.desktop$/, "").replace("-", " ")),
|
|
303
|
+
id
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
if (process.platform === "win32") return defaultBrowser();
|
|
307
|
+
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
308
|
+
}
|
|
309
|
+
__name(defaultBrowser2, "defaultBrowser");
|
|
310
|
+
var is_in_ssh_default = Boolean(process.env.SSH_CONNECTION || process.env.SSH_CLIENT || process.env.SSH_TTY);
|
|
311
|
+
var fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
312
|
+
var __dirname$1 = import.meta.url ? path__default.dirname(fileURLToPath(import.meta.url)) : "";
|
|
313
|
+
var localXdgOpenPath = path__default.join(__dirname$1, "xdg-open");
|
|
314
|
+
var { platform, arch: arch$1 } = process;
|
|
315
|
+
var tryEachApp = /* @__PURE__ */ __name(async (apps2, opener) => {
|
|
316
|
+
if (apps2.length === 0) return;
|
|
317
|
+
const errors = [];
|
|
318
|
+
for (const app of apps2) try {
|
|
319
|
+
return await opener(app);
|
|
320
|
+
} catch (error) {
|
|
321
|
+
errors.push(error);
|
|
322
|
+
}
|
|
323
|
+
throw new AggregateError(errors, "Failed to open in all supported apps");
|
|
324
|
+
}, "tryEachApp");
|
|
325
|
+
var baseOpen = /* @__PURE__ */ __name(async (options) => {
|
|
326
|
+
options = {
|
|
327
|
+
wait: false,
|
|
328
|
+
background: false,
|
|
329
|
+
newInstance: false,
|
|
330
|
+
allowNonzeroExitCode: false,
|
|
331
|
+
...options
|
|
332
|
+
};
|
|
333
|
+
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
334
|
+
delete options[fallbackAttemptSymbol];
|
|
335
|
+
if (Array.isArray(options.app)) return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
336
|
+
...options,
|
|
337
|
+
app: singleApp,
|
|
338
|
+
[fallbackAttemptSymbol]: true
|
|
339
|
+
}));
|
|
340
|
+
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
341
|
+
appArguments = [...appArguments];
|
|
342
|
+
if (Array.isArray(app)) return tryEachApp(app, (appName) => baseOpen({
|
|
343
|
+
...options,
|
|
344
|
+
app: {
|
|
345
|
+
name: appName,
|
|
346
|
+
arguments: appArguments
|
|
347
|
+
},
|
|
348
|
+
[fallbackAttemptSymbol]: true
|
|
349
|
+
}));
|
|
350
|
+
if (app === "browser" || app === "browserPrivate") {
|
|
351
|
+
const ids = {
|
|
352
|
+
"com.google.chrome": "chrome",
|
|
353
|
+
"google-chrome.desktop": "chrome",
|
|
354
|
+
"com.brave.browser": "brave",
|
|
355
|
+
"org.mozilla.firefox": "firefox",
|
|
356
|
+
"firefox.desktop": "firefox",
|
|
357
|
+
"com.microsoft.msedge": "edge",
|
|
358
|
+
"com.microsoft.edge": "edge",
|
|
359
|
+
"com.microsoft.edgemac": "edge",
|
|
360
|
+
"microsoft-edge.desktop": "edge",
|
|
361
|
+
"com.apple.safari": "safari"
|
|
362
|
+
};
|
|
363
|
+
const flags = {
|
|
364
|
+
chrome: "--incognito",
|
|
365
|
+
brave: "--incognito",
|
|
366
|
+
firefox: "--private-window",
|
|
367
|
+
edge: "--inPrivate"
|
|
368
|
+
};
|
|
369
|
+
let browser;
|
|
370
|
+
if (is_wsl_default) {
|
|
371
|
+
const progId = await wslDefaultBrowser();
|
|
372
|
+
browser = _windowsBrowserProgIdMap.get(progId) ?? {};
|
|
373
|
+
} else browser = await defaultBrowser2();
|
|
374
|
+
if (browser.id in ids) {
|
|
375
|
+
const browserName = ids[browser.id.toLowerCase()];
|
|
376
|
+
if (app === "browserPrivate") {
|
|
377
|
+
if (browserName === "safari") throw new Error("Safari doesn't support opening in private mode via command line");
|
|
378
|
+
appArguments.push(flags[browserName]);
|
|
379
|
+
}
|
|
380
|
+
return baseOpen({
|
|
381
|
+
...options,
|
|
382
|
+
app: {
|
|
383
|
+
name: apps[browserName],
|
|
384
|
+
arguments: appArguments
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
389
|
+
}
|
|
390
|
+
let command;
|
|
391
|
+
const cliArguments = [];
|
|
392
|
+
const childProcessOptions = {};
|
|
393
|
+
let shouldUseWindowsInWsl = false;
|
|
394
|
+
if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
395
|
+
if (platform === "darwin") {
|
|
396
|
+
command = "open";
|
|
397
|
+
if (options.wait) cliArguments.push("--wait-apps");
|
|
398
|
+
if (options.background) cliArguments.push("--background");
|
|
399
|
+
if (options.newInstance) cliArguments.push("--new");
|
|
400
|
+
if (app) cliArguments.push("-a", app);
|
|
401
|
+
} else if (platform === "win32" || shouldUseWindowsInWsl) {
|
|
402
|
+
command = await powerShellPath2();
|
|
403
|
+
cliArguments.push(...executePowerShell.argumentsPrefix);
|
|
404
|
+
if (!is_wsl_default) childProcessOptions.windowsVerbatimArguments = true;
|
|
405
|
+
if (is_wsl_default && options.target) options.target = await convertWslPathToWindows(options.target);
|
|
406
|
+
const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
|
|
407
|
+
if (options.wait) encodedArguments.push("-Wait");
|
|
408
|
+
if (app) {
|
|
409
|
+
encodedArguments.push(executePowerShell.escapeArgument(app));
|
|
410
|
+
if (options.target) appArguments.push(options.target);
|
|
411
|
+
} else if (options.target) encodedArguments.push(executePowerShell.escapeArgument(options.target));
|
|
412
|
+
if (appArguments.length > 0) {
|
|
413
|
+
appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
|
|
414
|
+
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
415
|
+
}
|
|
416
|
+
options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
|
|
417
|
+
if (!options.wait) childProcessOptions.stdio = "ignore";
|
|
418
|
+
} else {
|
|
419
|
+
if (app) command = app;
|
|
420
|
+
else {
|
|
421
|
+
const isBundled = !__dirname$1 || __dirname$1 === "/";
|
|
422
|
+
let exeLocalXdgOpen = false;
|
|
423
|
+
try {
|
|
424
|
+
await fs.access(localXdgOpenPath, constants$1.X_OK);
|
|
425
|
+
exeLocalXdgOpen = true;
|
|
426
|
+
} catch {}
|
|
427
|
+
command = process.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
|
|
428
|
+
}
|
|
429
|
+
if (appArguments.length > 0) cliArguments.push(...appArguments);
|
|
430
|
+
if (!options.wait) {
|
|
431
|
+
childProcessOptions.stdio = "ignore";
|
|
432
|
+
childProcessOptions.detached = true;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (platform === "darwin" && appArguments.length > 0) cliArguments.push("--args", ...appArguments);
|
|
436
|
+
if (options.target) cliArguments.push(options.target);
|
|
437
|
+
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
438
|
+
if (options.wait) return new Promise((resolve$1, reject) => {
|
|
439
|
+
subprocess.once("error", reject);
|
|
440
|
+
subprocess.once("close", (exitCode) => {
|
|
441
|
+
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
442
|
+
reject(/* @__PURE__ */ new Error(`Exited with code ${exitCode}`));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
resolve$1(subprocess);
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
if (isFallbackAttempt) return new Promise((resolve$1, reject) => {
|
|
449
|
+
subprocess.once("error", reject);
|
|
450
|
+
subprocess.once("spawn", () => {
|
|
451
|
+
subprocess.once("close", (exitCode) => {
|
|
452
|
+
subprocess.off("error", reject);
|
|
453
|
+
if (exitCode !== 0) {
|
|
454
|
+
reject(/* @__PURE__ */ new Error(`Exited with code ${exitCode}`));
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
subprocess.unref();
|
|
458
|
+
resolve$1(subprocess);
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
subprocess.unref();
|
|
463
|
+
return new Promise((resolve$1, reject) => {
|
|
464
|
+
subprocess.once("error", reject);
|
|
465
|
+
subprocess.once("spawn", () => {
|
|
466
|
+
subprocess.off("error", reject);
|
|
467
|
+
resolve$1(subprocess);
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
}, "baseOpen");
|
|
471
|
+
var open = /* @__PURE__ */ __name((target, options) => {
|
|
472
|
+
if (typeof target !== "string") throw new TypeError("Expected a `target`");
|
|
473
|
+
return baseOpen({
|
|
474
|
+
...options,
|
|
475
|
+
target
|
|
476
|
+
});
|
|
477
|
+
}, "open");
|
|
478
|
+
function detectArchBinary(binary) {
|
|
479
|
+
if (typeof binary === "string" || Array.isArray(binary)) return binary;
|
|
480
|
+
const { [arch$1]: archBinary } = binary;
|
|
481
|
+
if (!archBinary) throw new Error(`${arch$1} is not supported`);
|
|
482
|
+
return archBinary;
|
|
483
|
+
}
|
|
484
|
+
__name(detectArchBinary, "detectArchBinary");
|
|
485
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
486
|
+
if (wsl && is_wsl_default) return detectArchBinary(wsl);
|
|
487
|
+
if (!platformBinary) throw new Error(`${platform} is not supported`);
|
|
488
|
+
return detectArchBinary(platformBinary);
|
|
489
|
+
}
|
|
490
|
+
__name(detectPlatformBinary, "detectPlatformBinary");
|
|
491
|
+
var apps = {
|
|
492
|
+
browser: "browser",
|
|
493
|
+
browserPrivate: "browserPrivate"
|
|
494
|
+
};
|
|
495
|
+
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
496
|
+
darwin: "google chrome",
|
|
497
|
+
win32: "chrome",
|
|
498
|
+
linux: [
|
|
499
|
+
"google-chrome",
|
|
500
|
+
"google-chrome-stable",
|
|
501
|
+
"chromium",
|
|
502
|
+
"chromium-browser"
|
|
503
|
+
]
|
|
504
|
+
}, { wsl: {
|
|
505
|
+
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
506
|
+
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
507
|
+
} }));
|
|
508
|
+
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
509
|
+
darwin: "brave browser",
|
|
510
|
+
win32: "brave",
|
|
511
|
+
linux: ["brave-browser", "brave"]
|
|
512
|
+
}, { wsl: {
|
|
513
|
+
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
514
|
+
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
515
|
+
} }));
|
|
516
|
+
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
517
|
+
darwin: "firefox",
|
|
518
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
519
|
+
linux: "firefox"
|
|
520
|
+
}, { wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" }));
|
|
521
|
+
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
522
|
+
darwin: "microsoft edge",
|
|
523
|
+
win32: "msedge",
|
|
524
|
+
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
525
|
+
}, { wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" }));
|
|
526
|
+
defineLazyProperty(apps, "safari", () => detectPlatformBinary({ darwin: "Safari" }));
|
|
527
|
+
var open_default = open;
|
|
528
|
+
|
|
529
|
+
//#endregion
|
|
530
|
+
export { open_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@cloudflare/vite-plugin",
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.70.0",
|
|
5
5
|
description: "Cloudflare plugin for Vite",
|
|
6
6
|
keywords: [
|
|
7
7
|
"cloudflare",
|
|
@@ -39,9 +39,9 @@ var package_default = {
|
|
|
39
39
|
},
|
|
40
40
|
dependencies: {
|
|
41
41
|
"@cloudflare/unenv-preset": "2.16.2",
|
|
42
|
-
"miniflare": "5.
|
|
42
|
+
"miniflare": "5.20261116.0-beta",
|
|
43
43
|
"unenv": "2.0.0-rc.24",
|
|
44
|
-
"wrangler": "4.
|
|
44
|
+
"wrangler": "4.163.0",
|
|
45
45
|
"ws": "8.22.0"
|
|
46
46
|
},
|
|
47
47
|
devDependencies: {
|
|
@@ -50,8 +50,8 @@ var package_default = {
|
|
|
50
50
|
"@cloudflare/remote-bindings": "workspace:*",
|
|
51
51
|
"@cloudflare/workers-shared": "workspace:*",
|
|
52
52
|
"@cloudflare/workers-tsconfig": "workspace:*",
|
|
53
|
-
"@cloudflare/workers-types": "5.
|
|
54
|
-
"@cloudflare/workers-utils": "0.
|
|
53
|
+
"@cloudflare/workers-types": "5.20261116.1",
|
|
54
|
+
"@cloudflare/workers-utils": "0.54.1",
|
|
55
55
|
"@remix-run/node-fetch-server": "1.0.0",
|
|
56
56
|
"@types/node": "22.15.17",
|
|
57
57
|
"@types/semver": "7.8.0",
|
|
@@ -75,7 +75,7 @@ var package_default = {
|
|
|
75
75
|
},
|
|
76
76
|
peerDependencies: {
|
|
77
77
|
"vite": "^6.1.0 || ^7.0.0 || ^8.0.0",
|
|
78
|
-
"wrangler": "^4.
|
|
78
|
+
"wrangler": "^4.163.0"
|
|
79
79
|
},
|
|
80
80
|
"workers-sdk": { "prerelease": true }
|
|
81
81
|
};
|
|
@@ -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": "1.
|
|
3
|
+
"version": "1.70.0",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@cloudflare/unenv-preset": "2.16.2",
|
|
40
|
-
"miniflare": "5.
|
|
40
|
+
"miniflare": "5.20261116.0-beta",
|
|
41
41
|
"unenv": "2.0.0-rc.24",
|
|
42
|
-
"wrangler": "4.
|
|
42
|
+
"wrangler": "4.163.0",
|
|
43
43
|
"ws": "8.22.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@cloudflare/containers-shared": "0.25.0",
|
|
47
|
-
"@cloudflare/workers-types": "5.
|
|
48
|
-
"@cloudflare/workers-utils": "0.
|
|
47
|
+
"@cloudflare/workers-types": "5.20261116.1",
|
|
48
|
+
"@cloudflare/workers-utils": "0.54.1",
|
|
49
49
|
"@remix-run/node-fetch-server": "1.0.0",
|
|
50
50
|
"@types/node": "22.15.17",
|
|
51
51
|
"@types/semver": "7.8.0",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"vite-legacy": "npm:vite@7.1.12",
|
|
68
68
|
"vitest": "5.0.4",
|
|
69
69
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
70
|
-
"@cloudflare/
|
|
70
|
+
"@cloudflare/remote-bindings": "0.0.47",
|
|
71
71
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
72
|
-
"@cloudflare/
|
|
72
|
+
"@cloudflare/workers-shared": "0.20.1"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"vite": "^6.1.0 || ^7.0.0 || ^8.0.0",
|
|
76
|
-
"wrangler": "^4.
|
|
76
|
+
"wrangler": "^4.163.0"
|
|
77
77
|
},
|
|
78
78
|
"workers-sdk": {
|
|
79
79
|
"prerelease": true
|
|
File without changes
|