@cloudflare/vite-plugin 2.0.0-beta.v.16 → 2.0.0-beta.v.17
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
CHANGED
|
@@ -50476,7 +50476,7 @@ var BINDING_LOCAL_SUPPORT = {
|
|
|
50476
50476
|
service: "local-and-remote",
|
|
50477
50477
|
queue: "local-and-remote",
|
|
50478
50478
|
flagship: "local-and-remote",
|
|
50479
|
-
artifacts: "
|
|
50479
|
+
artifacts: "local-and-remote",
|
|
50480
50480
|
analytics_engine: "local-and-remote",
|
|
50481
50481
|
vectorize: "remote",
|
|
50482
50482
|
mtls_certificate: "remote",
|
|
@@ -50500,19 +50500,14 @@ function resolveBindingRemote(type, remote, { remoteBindingsDisabled = false } =
|
|
|
50500
50500
|
switch (getBindingLocalSupport(type)) {
|
|
50501
50501
|
case "DO-NOT-USE-this-resource-will-never-have-a-local-simulator": return true;
|
|
50502
50502
|
case "local-only": return false;
|
|
50503
|
-
case "remote-default-with-local-opt-in": return !remoteBindingsDisabled && remote !== false;
|
|
50504
50503
|
case "local-and-remote":
|
|
50505
50504
|
case "remote": return !remoteBindingsDisabled && remote === true;
|
|
50506
50505
|
}
|
|
50507
50506
|
}
|
|
50508
50507
|
__name$3(resolveBindingRemote, "resolveBindingRemote");
|
|
50509
|
-
function validateBindingRemoteSetting(type, remote, warn
|
|
50510
|
-
const remoteSetting = /* @__PURE__ */ __name$3((value) => configFormat2 === "cloudflare-config" ? `\`dev: { remote: ${value} }\`` : `\`remote: ${value}\``, "remoteSetting");
|
|
50508
|
+
function validateBindingRemoteSetting(type, remote, warn) {
|
|
50511
50509
|
switch (getBindingLocalSupport(type)) {
|
|
50512
50510
|
case "local-and-remote": return;
|
|
50513
|
-
case "remote-default-with-local-opt-in":
|
|
50514
|
-
if (remote === void 0 && !remoteBindingsDisabled) warn(`${binding === void 0 ? `${getBindingTypeFriendlyName(type)} bindings use` : `${getBindingTypeFriendlyName(type)} binding ${binding} uses`} the deployed resource. Set ${remoteSetting(false)} to use the local simulator, or ${remoteSetting(true)} to silence this warning.`);
|
|
50515
|
-
return;
|
|
50516
50511
|
case "local-only":
|
|
50517
50512
|
if (remote === true) throw new UserError(`${getBindingTypeFriendlyName(type)} bindings do not support accessing remote resources.`, { telemetryMessage: "utils bindings unsupported remote resources" });
|
|
50518
50513
|
return;
|
|
@@ -50527,6 +50522,23 @@ function validateBindingRemoteSetting(type, remote, warn, { binding, remoteBindi
|
|
|
50527
50522
|
}
|
|
50528
50523
|
}
|
|
50529
50524
|
__name$3(validateBindingRemoteSetting, "validateBindingRemoteSetting");
|
|
50525
|
+
function createArtifactsLocalDefaultWarner(configFormat2) {
|
|
50526
|
+
const remoteSetting = /* @__PURE__ */ __name$3((value) => configFormat2 === "cloudflare-config" ? `\`dev: { remote: ${value} }\`` : `\`remote: ${value}\``, "remoteSetting");
|
|
50527
|
+
const warned$1 = /* @__PURE__ */ new Set();
|
|
50528
|
+
return ({ id, bindings }, warn) => {
|
|
50529
|
+
for (const { name, remote, worker } of bindings) {
|
|
50530
|
+
const key = JSON.stringify([
|
|
50531
|
+
id,
|
|
50532
|
+
worker ?? null,
|
|
50533
|
+
name
|
|
50534
|
+
]);
|
|
50535
|
+
if (remote !== void 0 || warned$1.has(key)) continue;
|
|
50536
|
+
warned$1.add(key);
|
|
50537
|
+
warn(`Artifacts binding ${worker === void 0 ? name : `${name} in Worker ${worker}`} uses the local simulator by default. Set ${remoteSetting(true)} to use deployed repos, or ${remoteSetting(false)} to silence this warning.`);
|
|
50538
|
+
}
|
|
50539
|
+
};
|
|
50540
|
+
}
|
|
50541
|
+
__name$3(createArtifactsLocalDefaultWarner, "createArtifactsLocalDefaultWarner");
|
|
50530
50542
|
var supportedPagesConfigFields = [
|
|
50531
50543
|
"pages_build_output_dir",
|
|
50532
50544
|
"name",
|
|
@@ -50629,9 +50641,8 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
50629
50641
|
try {
|
|
50630
50642
|
const packagePath = getPackagePath(packageName, projectPath);
|
|
50631
50643
|
if (!packagePath) return;
|
|
50632
|
-
const
|
|
50633
|
-
if (!
|
|
50634
|
-
const packageJson = parsePackageJSON(readFileSync$1(packageJsonPath), packageJsonPath);
|
|
50644
|
+
const packageJson = findPackageRootManifest(packagePath, opts.stopAtProjectPath === true ? projectPath : void 0);
|
|
50645
|
+
if (!packageJson) return;
|
|
50635
50646
|
if (packageJson.name !== packageName) {
|
|
50636
50647
|
const bundledVersion = packageJson.bundledVersions?.[packageName];
|
|
50637
50648
|
if (bundledVersion !== void 0) return bundledVersion;
|
|
@@ -50640,21 +50651,20 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
50640
50651
|
} catch {}
|
|
50641
50652
|
}
|
|
50642
50653
|
__name$3(getInstalledPackageVersion, "getInstalledPackageVersion");
|
|
50643
|
-
function
|
|
50654
|
+
function findPackageRootManifest(startDir, lastDir) {
|
|
50644
50655
|
let dir2 = startDir;
|
|
50645
|
-
const root = path__default.parse(dir2).root;
|
|
50646
50656
|
while (true) {
|
|
50647
|
-
const
|
|
50648
|
-
|
|
50649
|
-
|
|
50650
|
-
|
|
50651
|
-
|
|
50657
|
+
const packageJsonPath = path__default.join(dir2, "package.json");
|
|
50658
|
+
if (statSync(packageJsonPath, { throwIfNoEntry: false })?.isFile()) {
|
|
50659
|
+
const packageJson = parsePackageJSON(readFileSync$1(packageJsonPath), packageJsonPath);
|
|
50660
|
+
if (packageJson.name !== void 0) return packageJson.version !== void 0 ? packageJson : void 0;
|
|
50661
|
+
}
|
|
50652
50662
|
const parent = path__default.dirname(dir2);
|
|
50653
|
-
if (parent === dir2 ||
|
|
50663
|
+
if (dir2 === lastDir || parent === dir2 || path__default.basename(parent) === "node_modules" || path__default.basename(parent).startsWith("@") && path__default.basename(path__default.dirname(parent)) === "node_modules") return;
|
|
50654
50664
|
dir2 = parent;
|
|
50655
50665
|
}
|
|
50656
50666
|
}
|
|
50657
|
-
__name$3(
|
|
50667
|
+
__name$3(findPackageRootManifest, "findPackageRootManifest");
|
|
50658
50668
|
function mapWorkerMetadataBindings(bindings) {
|
|
50659
50669
|
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
|
50660
50670
|
switch (binding.type) {
|
|
@@ -50913,7 +50923,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
50913
50923
|
}, {});
|
|
50914
50924
|
}
|
|
50915
50925
|
__name$3(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
50916
|
-
var DEFAULT_COMPAT_DATE = "2026-11-
|
|
50926
|
+
var DEFAULT_COMPAT_DATE = "2026-11-13";
|
|
50917
50927
|
function constructWranglerConfig(config$3) {
|
|
50918
50928
|
const mappedBindings = mapWorkerMetadataBindings(config$3.bindings);
|
|
50919
50929
|
const durableObjectClassNames = config$3.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$3.name).map((durableObject) => durableObject.class_name);
|
|
@@ -89518,17 +89528,6 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
89518
89528
|
//#region ../remote-bindings/dist/index.mjs
|
|
89519
89529
|
var import_undici = require_undici();
|
|
89520
89530
|
/**
|
|
89521
|
-
* Warns before native-config development accesses deployed data by default.
|
|
89522
|
-
* Explicit remote settings and sessions with remote bindings disabled are silent.
|
|
89523
|
-
*/
|
|
89524
|
-
function warnForDefaultRemoteBindings(bindings, remoteBindingsEnabled, warn) {
|
|
89525
|
-
for (const [name, binding] of Object.entries(bindings)) if (getBindingLocalSupport(binding.type) === "remote-default-with-local-opt-in") validateBindingRemoteSetting(binding.type, "remote" in binding ? binding.remote : void 0, warn, {
|
|
89526
|
-
binding: name,
|
|
89527
|
-
remoteBindingsDisabled: !remoteBindingsEnabled,
|
|
89528
|
-
configFormat: "cloudflare-config"
|
|
89529
|
-
});
|
|
89530
|
-
}
|
|
89531
|
-
/**
|
|
89532
89531
|
* Convert native config bindings to the transport shape consumed by the
|
|
89533
89532
|
* remote-bindings session API. Local-only bindings are intentionally omitted.
|
|
89534
89533
|
*/
|
|
@@ -89952,7 +89951,7 @@ var ProxyControllerLogger = class extends Log {
|
|
|
89952
89951
|
super.log(message);
|
|
89953
89952
|
}
|
|
89954
89953
|
};
|
|
89955
|
-
var version$1 = "0.0.
|
|
89954
|
+
var version$1 = "0.0.65";
|
|
89956
89955
|
const TRACE_VERSION = "trace-v1";
|
|
89957
89956
|
/**
|
|
89958
89957
|
* Maximum time (ms) to wait for an individual preview API request before
|
|
@@ -90620,9 +90619,7 @@ function pickRemoteBindings(bindings) {
|
|
|
90620
90619
|
/** Potentially starts or updates a remote proxy session. */
|
|
90621
90620
|
async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExistingRemoteProxySessionData, auth, context, startSession = startRemoteProxySession) {
|
|
90622
90621
|
const { hook, key } = "hook" in auth ? auth : { hook: auth };
|
|
90623
|
-
const
|
|
90624
|
-
if (workerConfigObject.target === "cf") warnForDefaultRemoteBindings(bindings, true, (message) => context.logger.warn(message));
|
|
90625
|
-
const remoteBindings = pickRemoteBindings(bindings);
|
|
90622
|
+
const remoteBindings = pickRemoteBindings(workerConfigObject.target === "cf" ? getRemoteBindings({ env: workerConfigObject.env }) : workerConfigObject.bindings);
|
|
90626
90623
|
if (Object.keys(remoteBindings).length === 0 && !preExistingRemoteProxySessionData?.session) return null;
|
|
90627
90624
|
const authSameAsBefore = key !== void 0 || preExistingRemoteProxySessionData?.authKey !== void 0 ? key === preExistingRemoteProxySessionData?.authKey : deepStrictEqual(hook, preExistingRemoteProxySessionData?.auth);
|
|
90628
90625
|
let remoteProxySession = preExistingRemoteProxySessionData?.session;
|
|
@@ -90778,7 +90775,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
90778
90775
|
const inputInspectorPort = await getInputInspectorPort(ctx, viteDevServer);
|
|
90779
90776
|
const { resolvedPluginConfig, resolvedViteConfig, entryWorkerConfig } = ctx;
|
|
90780
90777
|
const assetsConfig = getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedViteConfig);
|
|
90781
|
-
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, viteDevServer.config.logger);
|
|
90778
|
+
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, resolvedViteConfig.root, viteDevServer.config.logger);
|
|
90782
90779
|
const [routerWorkerManifest, assetWorkerManifest, viteProxyWorkerManifest] = await Promise.all([
|
|
90783
90780
|
getInternalWorkerManifest(ROUTER_WORKER_PATH),
|
|
90784
90781
|
getInternalWorkerManifest(ASSET_WORKER_PATH),
|
|
@@ -91068,7 +91065,7 @@ async function getMiniflareManifest(bundle) {
|
|
|
91068
91065
|
async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
91069
91066
|
const inputInspectorPort = await getInputInspectorPort(ctx, vitePreviewServer);
|
|
91070
91067
|
const { resolvedPluginConfig, resolvedViteConfig } = ctx;
|
|
91071
|
-
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, vitePreviewServer.config.logger);
|
|
91068
|
+
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, resolvedViteConfig.root, vitePreviewServer.config.logger);
|
|
91072
91069
|
const containerPlansByWorkerName = /* @__PURE__ */ new Map();
|
|
91073
91070
|
const containerOptions = [];
|
|
91074
91071
|
for (const previewWorker of resolvedPluginConfig.workers) {
|
|
@@ -91148,16 +91145,27 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
91148
91145
|
containerOptions: containerPlansByWorkerName.size === 0 ? void 0 : containerOptions
|
|
91149
91146
|
};
|
|
91150
91147
|
}
|
|
91151
|
-
|
|
91148
|
+
const warnForArtifactsLocalDefault = createArtifactsLocalDefaultWarner("cloudflare-config");
|
|
91149
|
+
function resolveLocalBindingsByWorkerName(workerConfigs, localEnv, devVars, remoteBindings, mode, projectRoot, logger$2) {
|
|
91152
91150
|
const resolvedLocalBindingsByWorkerName = /* @__PURE__ */ new Map();
|
|
91153
|
-
for (const config$3 of workerConfigs)
|
|
91154
|
-
|
|
91155
|
-
|
|
91156
|
-
|
|
91157
|
-
|
|
91158
|
-
|
|
91159
|
-
|
|
91160
|
-
|
|
91151
|
+
for (const config$3 of workerConfigs) {
|
|
91152
|
+
if (remoteBindings) warnForArtifactsLocalDefault({
|
|
91153
|
+
id: projectRoot,
|
|
91154
|
+
bindings: Object.entries(config$3.env ?? {}).flatMap(([name, binding]) => binding.type === "artifacts" ? [{
|
|
91155
|
+
name,
|
|
91156
|
+
remote: binding.dev?.remote,
|
|
91157
|
+
worker: workerConfigs.length > 1 ? config$3.name : void 0
|
|
91158
|
+
}] : [])
|
|
91159
|
+
}, (message) => logger$2.warn(message));
|
|
91160
|
+
resolvedLocalBindingsByWorkerName.set(config$3.name, resolveLocalBindings(config$3.env, {
|
|
91161
|
+
workerName: config$3.name,
|
|
91162
|
+
localEnv: localEnv.values,
|
|
91163
|
+
devVars,
|
|
91164
|
+
mode,
|
|
91165
|
+
remoteBindings,
|
|
91166
|
+
logger: logger$2
|
|
91167
|
+
}));
|
|
91168
|
+
}
|
|
91161
91169
|
return resolvedLocalBindingsByWorkerName;
|
|
91162
91170
|
}
|
|
91163
91171
|
/**
|
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.17",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"unenv": "2.0.0-rc.24",
|
|
44
44
|
"ws": "8.21.0",
|
|
45
|
-
"@cloudflare/build-output-utils": "0.9.
|
|
46
|
-
"@cloudflare/runtime-types": "0.1.27",
|
|
47
|
-
"@cloudflare/config": "0.32.0",
|
|
45
|
+
"@cloudflare/build-output-utils": "0.9.14",
|
|
48
46
|
"@cloudflare/unenv-preset": "2.16.2",
|
|
49
|
-
"
|
|
47
|
+
"@cloudflare/config": "0.32.1",
|
|
48
|
+
"@cloudflare/runtime-types": "0.1.28",
|
|
49
|
+
"miniflare": "5.20261113.0-beta"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@cloudflare/workers-types": "^5.
|
|
52
|
+
"@cloudflare/workers-types": "^5.20261113.1",
|
|
53
53
|
"@remix-run/node-fetch-server": "^1.0.0",
|
|
54
54
|
"@types/node": "22.15.17",
|
|
55
55
|
"@types/semver": "^7.5.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/cli-shared-helpers": "0.3.
|
|
73
|
-
"@cloudflare/containers-shared": "0.26.
|
|
74
|
-
"@cloudflare/workers-auth": "0.18.1",
|
|
75
|
-
"@cloudflare/remote-bindings": "0.0.64",
|
|
72
|
+
"@cloudflare/cli-shared-helpers": "0.3.8",
|
|
73
|
+
"@cloudflare/containers-shared": "0.26.1",
|
|
76
74
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
75
|
+
"@cloudflare/remote-bindings": "0.0.65",
|
|
76
|
+
"@cloudflare/workers-auth": "0.18.2",
|
|
77
77
|
"@cloudflare/workers-shared": "0.20.3",
|
|
78
78
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
79
|
-
"@cloudflare/workers-utils": "0.
|
|
79
|
+
"@cloudflare/workers-utils": "0.54.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"vite": "^7.0.0 || ^8.0.0"
|