@cloudflare/vite-plugin 2.0.0-beta.v.1 → 2.0.0-beta.v.2
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
|
@@ -50144,7 +50144,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
50144
50144
|
}, {});
|
|
50145
50145
|
}
|
|
50146
50146
|
__name$3(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
50147
|
-
var DEFAULT_COMPAT_DATE = "2026-10-
|
|
50147
|
+
var DEFAULT_COMPAT_DATE = "2026-10-19";
|
|
50148
50148
|
function constructWranglerConfig(config$3) {
|
|
50149
50149
|
const mappedBindings = mapWorkerMetadataBindings(config$3.bindings);
|
|
50150
50150
|
const durableObjectClassNames = config$3.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$3.name).map((durableObject) => durableObject.class_name);
|
|
@@ -52249,50 +52249,6 @@ The local dev server started at ${origin.href}
|
|
|
52249
52249
|
return new Error(errorMessage);
|
|
52250
52250
|
}
|
|
52251
52251
|
__name$3(createTunnelStartupError, "createTunnelStartupError");
|
|
52252
|
-
var WRANGLER_COMMANDS = {
|
|
52253
|
-
deploy: "wrangler deploy",
|
|
52254
|
-
preview: "wrangler preview",
|
|
52255
|
-
versionsUpload: "wrangler versions upload",
|
|
52256
|
-
versionsDeploy: "wrangler versions deploy",
|
|
52257
|
-
versionsDeployAt: /* @__PURE__ */ __name$3((n2) => `wrangler versions deploy <new-version-id>@${n2}%`, "versionsDeployAt"),
|
|
52258
|
-
triggersDeploy: "wrangler triggers deploy",
|
|
52259
|
-
d1List: "wrangler d1 list",
|
|
52260
|
-
d1Delete: "wrangler d1 delete",
|
|
52261
|
-
queuesCreate: "wrangler queues create",
|
|
52262
|
-
secretPut: "wrangler secret put",
|
|
52263
|
-
versionsSecretPut: "wrangler versions secret put",
|
|
52264
|
-
containerRegistryConfigure: "wrangler containers registries configure"
|
|
52265
|
-
};
|
|
52266
|
-
var WRANGLER_CONFIG_FIELDS = {
|
|
52267
|
-
workersDev: "workers_dev",
|
|
52268
|
-
containerObservabilityTargetPercentage: "target_instance_percentage",
|
|
52269
|
-
containerObservabilityTargetCount: "target_instance_count"
|
|
52270
|
-
};
|
|
52271
|
-
var WRANGLER_CLI_PRESENTATION = {
|
|
52272
|
-
cliName: "wrangler",
|
|
52273
|
-
displayName: "Wrangler",
|
|
52274
|
-
displayConfigFileName: "Wrangler config file",
|
|
52275
|
-
configFieldAssignmentSeparator: " = ",
|
|
52276
|
-
commands: WRANGLER_COMMANDS,
|
|
52277
|
-
configFields: WRANGLER_CONFIG_FIELDS
|
|
52278
|
-
};
|
|
52279
|
-
function resolveCliPresentation(overrides) {
|
|
52280
|
-
return {
|
|
52281
|
-
cliName: overrides?.cliName ?? WRANGLER_CLI_PRESENTATION.cliName,
|
|
52282
|
-
displayName: overrides?.displayName ?? WRANGLER_CLI_PRESENTATION.displayName,
|
|
52283
|
-
displayConfigFileName: overrides?.displayConfigFileName ?? WRANGLER_CLI_PRESENTATION.displayConfigFileName,
|
|
52284
|
-
configFieldAssignmentSeparator: overrides?.configFieldAssignmentSeparator ?? WRANGLER_CLI_PRESENTATION.configFieldAssignmentSeparator,
|
|
52285
|
-
commands: {
|
|
52286
|
-
...WRANGLER_COMMANDS,
|
|
52287
|
-
...overrides?.commands
|
|
52288
|
-
},
|
|
52289
|
-
configFields: {
|
|
52290
|
-
...WRANGLER_CONFIG_FIELDS,
|
|
52291
|
-
...overrides?.configFields
|
|
52292
|
-
}
|
|
52293
|
-
};
|
|
52294
|
-
}
|
|
52295
|
-
__name$3(resolveCliPresentation, "resolveCliPresentation");
|
|
52296
52252
|
var UPDATE_CHECK_TIMEOUT_MS = 3e3;
|
|
52297
52253
|
var CACHE_TTL_MS = 3600 * 1e3;
|
|
52298
52254
|
var NPM_REGISTRY_URL = "https://registry.npmjs.org/";
|
|
@@ -75691,9 +75647,7 @@ var fetchResult$1 = /* @__PURE__ */ __name$2(() => {
|
|
|
75691
75647
|
var fetchPagedListResult = /* @__PURE__ */ __name$2(() => {
|
|
75692
75648
|
throw new Error("initContainersSharedContext() must be called first");
|
|
75693
75649
|
}, "fetchPagedListResult");
|
|
75694
|
-
var cliPresentation = resolveCliPresentation();
|
|
75695
75650
|
function initContainersSharedContext(ctx) {
|
|
75696
|
-
cliPresentation = resolveCliPresentation(ctx.cliPresentation);
|
|
75697
75651
|
logger$1 = ctx.logger;
|
|
75698
75652
|
fetchResult$1 = ctx.fetchResult;
|
|
75699
75653
|
if (ctx.fetchPagedListResult !== void 0) fetchPagedListResult = ctx.fetchPagedListResult;
|
|
@@ -75950,7 +75904,7 @@ async function pullEgressInterceptorImage(dockerPath) {
|
|
|
75950
75904
|
await runDockerCmd(dockerPath, args);
|
|
75951
75905
|
}
|
|
75952
75906
|
__name$2(pullEgressInterceptorImage, "pullEgressInterceptorImage");
|
|
75953
|
-
async function pullImage(dockerPath, options, logger2, complianceConfig) {
|
|
75907
|
+
async function pullImage(dockerPath, options, logger2, complianceConfig, registryConfigureCommand) {
|
|
75954
75908
|
const domain$1 = new URL(`http://${options.image_uri}`).hostname;
|
|
75955
75909
|
const isExternalRegistry = domain$1 !== getCloudflareContainerRegistry(complianceConfig);
|
|
75956
75910
|
try {
|
|
@@ -75958,7 +75912,7 @@ async function pullImage(dockerPath, options, logger2, complianceConfig) {
|
|
|
75958
75912
|
} catch (e) {
|
|
75959
75913
|
if (!isExternalRegistry) throw e;
|
|
75960
75914
|
logger2?.warn(`Unable to retrieve configured registry credentials from Cloudflare.
|
|
75961
|
-
Unless this is a public image, you will need to run \`${
|
|
75915
|
+
Unless this is a public image, you will need to run \`${registryConfigureCommand}\` before deploying.
|
|
75962
75916
|
Attempting to pull image anyway...`);
|
|
75963
75917
|
}
|
|
75964
75918
|
const pull = runDockerCmd(dockerPath, [
|
|
@@ -75991,7 +75945,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
75991
75945
|
dockerPath,
|
|
75992
75946
|
operation: "running dev",
|
|
75993
75947
|
imageNoun: containerOptions.length !== 1 ? "the configured images" : "the configured image",
|
|
75994
|
-
hint: `To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your ${
|
|
75948
|
+
hint: `To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your ${args.configFileName} or pass --enable-containers=false.`
|
|
75995
75949
|
});
|
|
75996
75950
|
for (const options of containerOptions) {
|
|
75997
75951
|
if ("dockerfile" in options) {
|
|
@@ -76016,7 +75970,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
76016
75970
|
await build.ready;
|
|
76017
75971
|
onContainerImagePreparationEnd({ containerOptions: options });
|
|
76018
75972
|
} else {
|
|
76019
|
-
const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig);
|
|
75973
|
+
const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig, args.registryConfigureCommand);
|
|
76020
75974
|
onContainerImagePreparationStart({
|
|
76021
75975
|
containerOptions: options,
|
|
76022
75976
|
abort: /* @__PURE__ */ __name$2(() => {
|
|
@@ -77134,7 +77088,7 @@ function createDurableObjectNamespaceResolver(config$3, { versionId, accountId,
|
|
|
77134
77088
|
};
|
|
77135
77089
|
}
|
|
77136
77090
|
__name$2(createDurableObjectNamespaceResolver, "createDurableObjectNamespaceResolver");
|
|
77137
|
-
async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace }) {
|
|
77091
|
+
async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace, configFileName: configFileName$1, observabilityTargetPercentageField, observabilityTargetCountField }) {
|
|
77138
77092
|
const resolveNamespaceId = createDurableObjectNamespaceResolver(config$3, {
|
|
77139
77093
|
versionId,
|
|
77140
77094
|
accountId,
|
|
@@ -77143,7 +77097,10 @@ async function deployContainers(config$3, containerDeployments, { versionId, acc
|
|
|
77143
77097
|
});
|
|
77144
77098
|
for (const { container, imageRef } of containerDeployments) await apply({
|
|
77145
77099
|
imageRef,
|
|
77146
|
-
durable_object_namespace_id: await resolveNamespaceId(container.class_name)
|
|
77100
|
+
durable_object_namespace_id: await resolveNamespaceId(container.class_name),
|
|
77101
|
+
configFileName: configFileName$1,
|
|
77102
|
+
observabilityTargetPercentageField,
|
|
77103
|
+
observabilityTargetCountField
|
|
77147
77104
|
}, container, config$3, accountId);
|
|
77148
77105
|
}
|
|
77149
77106
|
__name$2(deployContainers, "deployContainers");
|
|
@@ -77287,10 +77244,10 @@ function buildApplicationObservabilityPatch(observability, writeTarget, prevApp)
|
|
|
77287
77244
|
return nextTopLevelObservability !== void 0 ? { observability: nextTopLevelObservability } : {};
|
|
77288
77245
|
}
|
|
77289
77246
|
__name$2(buildApplicationObservabilityPatch, "buildApplicationObservabilityPatch");
|
|
77290
|
-
function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig) {
|
|
77247
|
+
function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, options) {
|
|
77291
77248
|
if (!hasTopLevelOnlyObservabilityFields(containerConfig.observability)) return;
|
|
77292
77249
|
if (!hasLegacyRolloutObservabilityEnabled(prevApp)) return;
|
|
77293
|
-
throw new UserError(`Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${
|
|
77250
|
+
throw new UserError(`Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${options.configFileName} and deploy once, then deploy again with ${options.observabilityTargetPercentageField} or ${options.observabilityTargetCountField}.`, { telemetryMessage: "containers deploy observability migration blocked" });
|
|
77294
77251
|
}
|
|
77295
77252
|
__name$2(assertCanUseApplicationObservabilityTargeting, "assertCanUseApplicationObservabilityTargeting");
|
|
77296
77253
|
function hasRolloutDiff(prevApp, nextApp) {
|
|
@@ -77363,7 +77320,7 @@ async function apply(args, containerConfig, config$3, accountId) {
|
|
|
77363
77320
|
}
|
|
77364
77321
|
}
|
|
77365
77322
|
const observabilityWriteTarget = selectObservabilityWriteTarget(prevApp);
|
|
77366
|
-
if (prevApp !== void 0) assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig);
|
|
77323
|
+
if (prevApp !== void 0) assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, args);
|
|
77367
77324
|
const appConfig = stripUndefined(mergeIfUnsafe(config$3, containerConfigToCreateRequest(accountId, containerConfig, imageRef, args.durable_object_namespace_id, config$3, observabilityWriteTarget, prevApp), containerConfig.name));
|
|
77368
77325
|
if (prevApp !== void 0 && prevApp !== null) {
|
|
77369
77326
|
const normalisedPrevApp = sortObjectRecursive(stripUndefined(cleanApplicationFromAPI(prevApp, containerConfig, accountId, observabilityWriteTarget, config$3)));
|
|
@@ -77726,7 +77683,7 @@ __toESM(require_sender());
|
|
|
77726
77683
|
__toESM(require_subprotocol());
|
|
77727
77684
|
var import_websocket = __toESM(require_websocket());
|
|
77728
77685
|
__toESM(require_websocket_server());
|
|
77729
|
-
async function sshCommand(sshArgs) {
|
|
77686
|
+
async function sshCommand(sshArgs, userAgent) {
|
|
77730
77687
|
const useStdio = shouldUseStdio(sshArgs);
|
|
77731
77688
|
let sshResponse;
|
|
77732
77689
|
try {
|
|
@@ -77743,7 +77700,7 @@ async function sshCommand(sshArgs) {
|
|
|
77743
77700
|
}
|
|
77744
77701
|
const ws = new import_websocket.default(sshResponse.url, { headers: {
|
|
77745
77702
|
authorization: `Bearer ${sshResponse.token}`,
|
|
77746
|
-
"user-agent":
|
|
77703
|
+
"user-agent": userAgent
|
|
77747
77704
|
} });
|
|
77748
77705
|
ws.binaryType = "arraybuffer";
|
|
77749
77706
|
if (useStdio) {
|
|
@@ -87604,7 +87561,9 @@ async function prepareContainerImagesForVite(options) {
|
|
|
87604
87561
|
onContainerImagePreparationStart: () => {},
|
|
87605
87562
|
onContainerImagePreparationEnd: () => {},
|
|
87606
87563
|
logger: options.logger,
|
|
87607
|
-
complianceConfig
|
|
87564
|
+
complianceConfig,
|
|
87565
|
+
configFileName: "cloudflare.config.ts",
|
|
87566
|
+
registryConfigureCommand: options.cliDisplayName === "cf" ? "cf containers registries create" : "wrangler containers registries configure"
|
|
87608
87567
|
});
|
|
87609
87568
|
}
|
|
87610
87569
|
|
|
@@ -88427,7 +88386,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
88427
88386
|
//#endregion
|
|
88428
88387
|
//#region ../remote-bindings/dist/index.mjs
|
|
88429
88388
|
var import_undici = require_undici();
|
|
88430
|
-
var version$1 = "0.0.
|
|
88389
|
+
var version$1 = "0.0.50";
|
|
88431
88390
|
var NoDefaultValueProvided = class extends UserError {
|
|
88432
88391
|
constructor() {
|
|
88433
88392
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -90363,7 +90322,8 @@ const devPlugin = createPlugin("dev", (ctx) => {
|
|
|
90363
90322
|
dockerPath,
|
|
90364
90323
|
containerOptions,
|
|
90365
90324
|
settings: ctx.resolvedPluginConfig.settings,
|
|
90366
|
-
logger: viteDevServer.config.logger
|
|
90325
|
+
logger: viteDevServer.config.logger,
|
|
90326
|
+
cliDisplayName: ctx.resolvedPluginConfig.cliDisplayName
|
|
90367
90327
|
});
|
|
90368
90328
|
containerCleanup.track(dockerPath, containerOptions.map(({ image_tag }) => image_tag));
|
|
90369
90329
|
viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("\n⚡️ Containers successfully built. To rebuild your containers during development, restart the Vite dev server (r + enter).")));
|
|
@@ -90509,7 +90469,8 @@ const previewPlugin = createPlugin("preview", (ctx) => {
|
|
|
90509
90469
|
dockerPath: getDockerPath(),
|
|
90510
90470
|
containerOptions,
|
|
90511
90471
|
settings: ctx.resolvedPluginConfig.settings,
|
|
90512
|
-
logger: vitePreviewServer.config.logger
|
|
90472
|
+
logger: vitePreviewServer.config.logger,
|
|
90473
|
+
cliDisplayName: ctx.resolvedPluginConfig.cliDisplayName
|
|
90513
90474
|
});
|
|
90514
90475
|
}
|
|
90515
90476
|
if (vitePreviewServer.httpServer) vitePreviewServer.httpServer.on("listening", () => {
|
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.2",
|
|
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/config": "0.27.0",
|
|
46
|
-
"@cloudflare/runtime-types": "0.1.12",
|
|
47
45
|
"@cloudflare/build-output-utils": "0.9.3",
|
|
48
|
-
"@cloudflare/
|
|
49
|
-
"
|
|
46
|
+
"@cloudflare/runtime-types": "0.1.13",
|
|
47
|
+
"@cloudflare/config": "0.27.0",
|
|
48
|
+
"miniflare": "5.20261019.0-beta",
|
|
49
|
+
"@cloudflare/unenv-preset": "2.16.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@cloudflare/workers-types": "^5.
|
|
52
|
+
"@cloudflare/workers-types": "^5.20261019.1",
|
|
53
53
|
"@remix-run/node-fetch-server": "^0.8.0",
|
|
54
54
|
"@types/node": "22.15.17",
|
|
55
55
|
"@types/semver": "^7.5.1",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"vite": "8.1.5",
|
|
71
71
|
"vite-legacy": "npm:vite@7.1.12",
|
|
72
72
|
"vitest": "4.1.0",
|
|
73
|
+
"@cloudflare/cli-shared-helpers": "0.2.6",
|
|
74
|
+
"@cloudflare/containers-shared": "0.23.0",
|
|
73
75
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
74
|
-
"@cloudflare/
|
|
76
|
+
"@cloudflare/remote-bindings": "0.0.50",
|
|
75
77
|
"@cloudflare/workers-auth": "0.14.0",
|
|
76
78
|
"@cloudflare/workers-shared": "0.20.1",
|
|
77
|
-
"@cloudflare/remote-bindings": "0.0.49",
|
|
78
79
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
79
|
-
"@cloudflare/cli-shared-helpers": "0.2.6",
|
|
80
80
|
"@cloudflare/workers-utils": "0.47.2"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|