@cloudflare/vite-plugin 0.0.0-8b510e896 → 0.0.0-8cdabe23f
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/README.md +15 -540
- package/dist/asset-workers/asset-worker.js +678 -659
- package/dist/asset-workers/router-worker.js +1 -1
- package/dist/index.js +134 -34
- package/dist/runner-worker/index.js +10 -9
- package/package.json +9 -8
|
@@ -1985,7 +1985,7 @@ var we = class {
|
|
|
1985
1985
|
this.hasWritten || this.readyAnalytics && (this.hasWritten = true, this.readyAnalytics.logEvent({ version: 1, accountId: this.data.accountId, indexId: this.data.scriptId?.toString(), doubles: [this.data.requestTime ?? -1, this.data.coloId ?? -1, this.data.metalId ?? -1, this.data.coloTier ?? -1, this.data.userWorkerAhead === void 0 ? -1 : Number(this.data.userWorkerAhead)], blobs: [this.data.hostname?.substring(0, 256), this.data.dispatchtype, this.data.error?.substring(0, 256), this.data.version, this.data.coloRegion] }));
|
|
1986
1986
|
}
|
|
1987
1987
|
};
|
|
1988
|
-
var On = (t4) => ({ invoke_user_worker_ahead_of_assets: t4?.invoke_user_worker_ahead_of_assets ?? false, has_user_worker: t4?.has_user_worker ?? false, account_id: t4?.account_id ?? -1, script_id: t4?.script_id ?? -1 });
|
|
1988
|
+
var On = (t4) => ({ invoke_user_worker_ahead_of_assets: t4?.invoke_user_worker_ahead_of_assets ?? false, has_user_worker: t4?.has_user_worker ?? false, account_id: t4?.account_id ?? -1, script_id: t4?.script_id ?? -1, debug: t4?.debug ?? false });
|
|
1989
1989
|
var Bc = { async fetch(t4, e, n) {
|
|
1990
1990
|
let r, o = false, s = new we(e.ANALYTICS), i = new ue(e.UNSAFE_PERFORMANCE), a = i.now();
|
|
1991
1991
|
try {
|
package/dist/index.js
CHANGED
|
@@ -490,6 +490,7 @@ import * as fs5 from "node:fs";
|
|
|
490
490
|
import * as fsp2 from "node:fs/promises";
|
|
491
491
|
import * as path9 from "node:path";
|
|
492
492
|
import { createMiddleware } from "@hattip/adapter-node";
|
|
493
|
+
import replace from "@rollup/plugin-replace";
|
|
493
494
|
|
|
494
495
|
// ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
495
496
|
var comma = ",".charCodeAt(0);
|
|
@@ -1557,7 +1558,7 @@ var MagicString = class _MagicString {
|
|
|
1557
1558
|
|
|
1558
1559
|
// src/index.ts
|
|
1559
1560
|
import { Miniflare } from "miniflare";
|
|
1560
|
-
import
|
|
1561
|
+
import colors3 from "picocolors";
|
|
1561
1562
|
import * as vite7 from "vite";
|
|
1562
1563
|
|
|
1563
1564
|
// src/constants.ts
|
|
@@ -5783,7 +5784,8 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
5783
5784
|
// ../workers-shared/utils/types.ts
|
|
5784
5785
|
var InternalConfigSchema = z.object({
|
|
5785
5786
|
account_id: z.number().optional(),
|
|
5786
|
-
script_id: z.number().optional()
|
|
5787
|
+
script_id: z.number().optional(),
|
|
5788
|
+
debug: z.boolean().optional()
|
|
5787
5789
|
});
|
|
5788
5790
|
var RouterConfigSchema = z.object({
|
|
5789
5791
|
invoke_user_worker_ahead_of_assets: z.boolean().optional(),
|
|
@@ -5831,14 +5833,14 @@ var AssetConfigSchema = z.object({
|
|
|
5831
5833
|
});
|
|
5832
5834
|
|
|
5833
5835
|
// src/asset-config.ts
|
|
5834
|
-
function hasAssetsConfigChanged(resolvedPluginConfig, resolvedViteConfig,
|
|
5836
|
+
function hasAssetsConfigChanged(resolvedPluginConfig, resolvedViteConfig, changedFilePath) {
|
|
5835
5837
|
if (!resolvedPluginConfig.experimental?.headersAndRedirectsDevModeSupport) {
|
|
5836
5838
|
return false;
|
|
5837
5839
|
}
|
|
5838
5840
|
return [
|
|
5839
5841
|
getRedirectsConfigPath(resolvedViteConfig),
|
|
5840
5842
|
getHeadersConfigPath(resolvedViteConfig)
|
|
5841
|
-
].includes(
|
|
5843
|
+
].includes(changedFilePath);
|
|
5842
5844
|
}
|
|
5843
5845
|
function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig) {
|
|
5844
5846
|
const assetsConfig = resolvedPluginConfig.type === "assets-only" ? resolvedPluginConfig.config.assets : entryWorkerConfig?.assets;
|
|
@@ -12879,6 +12881,15 @@ function isNodeCompat(workerConfig) {
|
|
|
12879
12881
|
}
|
|
12880
12882
|
return false;
|
|
12881
12883
|
}
|
|
12884
|
+
function isNodeAls(workerConfig) {
|
|
12885
|
+
return workerConfig !== void 0 && getNodeCompat(
|
|
12886
|
+
workerConfig.compatibility_date,
|
|
12887
|
+
workerConfig.compatibility_flags ?? []
|
|
12888
|
+
).mode === "als";
|
|
12889
|
+
}
|
|
12890
|
+
function isNodeAlsModule(path10) {
|
|
12891
|
+
return /^(node:)?async_hooks$/.test(path10);
|
|
12892
|
+
}
|
|
12882
12893
|
function injectGlobalCode(id, code) {
|
|
12883
12894
|
const injectedCode = Object.entries(env.inject).map(([globalName, globalInject]) => {
|
|
12884
12895
|
if (typeof globalInject === "string") {
|
|
@@ -12909,7 +12920,7 @@ globalThis.${globalName} = var_${globalName}.${exportName};
|
|
|
12909
12920
|
}
|
|
12910
12921
|
function resolveNodeJSImport(source) {
|
|
12911
12922
|
const alias = env.alias[source];
|
|
12912
|
-
if (alias) {
|
|
12923
|
+
if (alias && !nodeCompatExternals.has(alias)) {
|
|
12913
12924
|
return {
|
|
12914
12925
|
unresolved: alias,
|
|
12915
12926
|
resolved: resolvePathSync(alias, { url: import.meta.url })
|
|
@@ -13344,6 +13355,7 @@ import {
|
|
|
13344
13355
|
LogLevel,
|
|
13345
13356
|
Response as MiniflareResponse
|
|
13346
13357
|
} from "miniflare";
|
|
13358
|
+
import colors2 from "picocolors";
|
|
13347
13359
|
import { globSync } from "tinyglobby";
|
|
13348
13360
|
import "vite";
|
|
13349
13361
|
import { unstable_getMiniflareWorkerOptions } from "wrangler";
|
|
@@ -13448,6 +13460,29 @@ function getEntryWorkerConfig(resolvedPluginConfig) {
|
|
|
13448
13460
|
}
|
|
13449
13461
|
return resolvedPluginConfig.workers[resolvedPluginConfig.entryWorkerEnvironmentName];
|
|
13450
13462
|
}
|
|
13463
|
+
function filterTails(tails, userWorkers, log) {
|
|
13464
|
+
return tails?.filter((tailService) => {
|
|
13465
|
+
let name;
|
|
13466
|
+
if (typeof tailService === "string") {
|
|
13467
|
+
name = tailService;
|
|
13468
|
+
} else if (typeof tailService === "object" && "name" in tailService && typeof tailService.name === "string") {
|
|
13469
|
+
name = tailService.name;
|
|
13470
|
+
} else {
|
|
13471
|
+
return true;
|
|
13472
|
+
}
|
|
13473
|
+
const found = userWorkers.some((w) => w.name === name);
|
|
13474
|
+
if (!found) {
|
|
13475
|
+
log(
|
|
13476
|
+
colors2.dim(
|
|
13477
|
+
colors2.yellow(
|
|
13478
|
+
`Tail consumer "${name}" was not found in your config. Make sure you add it if you'd like to simulate receiving tail events locally.`
|
|
13479
|
+
)
|
|
13480
|
+
)
|
|
13481
|
+
);
|
|
13482
|
+
}
|
|
13483
|
+
return found;
|
|
13484
|
+
});
|
|
13485
|
+
}
|
|
13451
13486
|
function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspectorPort) {
|
|
13452
13487
|
const resolvedViteConfig = viteDevServer.config;
|
|
13453
13488
|
const entryWorkerConfig = getEntryWorkerConfig(resolvedPluginConfig);
|
|
@@ -13639,6 +13674,11 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspectorPo
|
|
|
13639
13674
|
}
|
|
13640
13675
|
return {
|
|
13641
13676
|
...workerOptions,
|
|
13677
|
+
tails: filterTails(
|
|
13678
|
+
workerOptions.tails,
|
|
13679
|
+
userWorkers,
|
|
13680
|
+
viteDevServer.config.logger.warn
|
|
13681
|
+
),
|
|
13642
13682
|
modules: [
|
|
13643
13683
|
{
|
|
13644
13684
|
type: "ESModule",
|
|
@@ -13729,6 +13769,11 @@ function getPreviewMiniflareOptions(vitePreviewServer, workerConfigs, persistSta
|
|
|
13729
13769
|
return [
|
|
13730
13770
|
{
|
|
13731
13771
|
...workerOptions,
|
|
13772
|
+
tails: filterTails(
|
|
13773
|
+
workerOptions.tails,
|
|
13774
|
+
workerConfigs,
|
|
13775
|
+
vitePreviewServer.config.logger.warn
|
|
13776
|
+
),
|
|
13732
13777
|
name: workerOptions.name ?? config.name,
|
|
13733
13778
|
unsafeInspectorProxy: inspectorPort !== false,
|
|
13734
13779
|
...miniflareWorkerOptions.main ? getPreviewModules(miniflareWorkerOptions.main, modulesRules) : { modules: true, script: "" }
|
|
@@ -13828,8 +13873,7 @@ var nonApplicableWorkerConfigs = {
|
|
|
13828
13873
|
"preserve_file_names",
|
|
13829
13874
|
"rules",
|
|
13830
13875
|
"site",
|
|
13831
|
-
"tsconfig"
|
|
13832
|
-
"upload_source_maps"
|
|
13876
|
+
"tsconfig"
|
|
13833
13877
|
]
|
|
13834
13878
|
};
|
|
13835
13879
|
var nullableNonApplicable = [
|
|
@@ -13840,8 +13884,7 @@ var nullableNonApplicable = [
|
|
|
13840
13884
|
"no_bundle",
|
|
13841
13885
|
"preserve_file_names",
|
|
13842
13886
|
"site",
|
|
13843
|
-
"tsconfig"
|
|
13844
|
-
"upload_source_maps"
|
|
13887
|
+
"tsconfig"
|
|
13845
13888
|
];
|
|
13846
13889
|
function readWorkerConfig(configPath, env2) {
|
|
13847
13890
|
const nonApplicable = {
|
|
@@ -14182,12 +14225,15 @@ function validateWorkerEnvironmentsResolvedConfigs(resolvedPluginConfig, resolve
|
|
|
14182
14225
|
for (const envName of workersEnvironmentNames) {
|
|
14183
14226
|
const workerEnvConfig = resolvedViteConfig.environments[envName];
|
|
14184
14227
|
assert9(workerEnvConfig, `Missing environment config for "${envName}"`);
|
|
14185
|
-
const { optimizeDeps, resolve:
|
|
14228
|
+
const { optimizeDeps, resolve: resolve7 } = workerEnvConfig;
|
|
14186
14229
|
const disallowedConfig = {};
|
|
14187
14230
|
const disallowedOptimizeDepsExcludeEntries = (optimizeDeps.exclude ?? []).filter((entry) => {
|
|
14188
14231
|
if (cloudflareBuiltInModules.includes(entry)) {
|
|
14189
14232
|
return false;
|
|
14190
14233
|
}
|
|
14234
|
+
if (isNodeAlsModule(entry) && isNodeAls(resolvedPluginConfig.workers[envName])) {
|
|
14235
|
+
return false;
|
|
14236
|
+
}
|
|
14191
14237
|
if (NODEJS_MODULES_RE.test(entry) && isNodeCompat(resolvedPluginConfig.workers[envName])) {
|
|
14192
14238
|
return false;
|
|
14193
14239
|
}
|
|
@@ -14196,8 +14242,8 @@ function validateWorkerEnvironmentsResolvedConfigs(resolvedPluginConfig, resolve
|
|
|
14196
14242
|
if (disallowedOptimizeDepsExcludeEntries.length > 0) {
|
|
14197
14243
|
disallowedConfig.optimizeDepsExclude = disallowedOptimizeDepsExcludeEntries;
|
|
14198
14244
|
}
|
|
14199
|
-
if (
|
|
14200
|
-
disallowedConfig.resolveExternal =
|
|
14245
|
+
if (resolve7.external === true || resolve7.external.length > 0) {
|
|
14246
|
+
disallowedConfig.resolveExternal = resolve7.external;
|
|
14201
14247
|
}
|
|
14202
14248
|
if (Object.keys(disallowedConfig).length > 0) {
|
|
14203
14249
|
disallowedEnvsConfigs.set(envName, disallowedConfig);
|
|
@@ -14403,29 +14449,23 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14403
14449
|
}
|
|
14404
14450
|
},
|
|
14405
14451
|
hotUpdate(options) {
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
resolvedPluginConfig
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
)
|
|
14413
|
-
) {
|
|
14452
|
+
const changedFilePath = path9.resolve(options.file);
|
|
14453
|
+
if (resolvedPluginConfig.configPaths.has(changedFilePath) || hasDotDevDotVarsFileChanged(resolvedPluginConfig, changedFilePath) || hasAssetsConfigChanged(
|
|
14454
|
+
resolvedPluginConfig,
|
|
14455
|
+
resolvedViteConfig,
|
|
14456
|
+
changedFilePath
|
|
14457
|
+
)) {
|
|
14414
14458
|
options.server.restart();
|
|
14415
14459
|
return [];
|
|
14416
14460
|
}
|
|
14417
14461
|
},
|
|
14418
14462
|
async configureServer(viteDevServer) {
|
|
14419
|
-
assert10(
|
|
14420
|
-
viteDevServer.httpServer,
|
|
14421
|
-
"Unexpected error: No Vite HTTP server"
|
|
14422
|
-
);
|
|
14423
14463
|
const inputInspectorPort = await getInputInspectorPortOption(
|
|
14424
14464
|
pluginConfig,
|
|
14425
14465
|
viteDevServer
|
|
14426
14466
|
);
|
|
14427
|
-
if (miniflare) {
|
|
14428
|
-
|
|
14467
|
+
if (!miniflare) {
|
|
14468
|
+
miniflare = new Miniflare(
|
|
14429
14469
|
getDevMiniflareOptions(
|
|
14430
14470
|
resolvedPluginConfig,
|
|
14431
14471
|
viteDevServer,
|
|
@@ -14433,7 +14473,7 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14433
14473
|
)
|
|
14434
14474
|
);
|
|
14435
14475
|
} else {
|
|
14436
|
-
miniflare
|
|
14476
|
+
await miniflare.setOptions(
|
|
14437
14477
|
getDevMiniflareOptions(
|
|
14438
14478
|
resolvedPluginConfig,
|
|
14439
14479
|
viteDevServer,
|
|
@@ -14452,11 +14492,13 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14452
14492
|
},
|
|
14453
14493
|
{ alwaysCallNext: false }
|
|
14454
14494
|
);
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14495
|
+
if (viteDevServer.httpServer) {
|
|
14496
|
+
handleWebSocket(viteDevServer.httpServer, async () => {
|
|
14497
|
+
assert10(miniflare, `Miniflare not defined`);
|
|
14498
|
+
const routerWorker = await getRouterWorker(miniflare);
|
|
14499
|
+
return routerWorker.fetch;
|
|
14500
|
+
});
|
|
14501
|
+
}
|
|
14460
14502
|
return () => {
|
|
14461
14503
|
viteDevServer.middlewares.use((req, res, next) => {
|
|
14462
14504
|
middleware(req, res, next);
|
|
@@ -14599,6 +14641,18 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14599
14641
|
configEnvironment(name) {
|
|
14600
14642
|
if (isNodeCompat(getWorkerConfig2(name))) {
|
|
14601
14643
|
return {
|
|
14644
|
+
build: {
|
|
14645
|
+
rollupOptions: {
|
|
14646
|
+
plugins: [
|
|
14647
|
+
replace({
|
|
14648
|
+
"process.env.NODE_ENV": JSON.stringify(
|
|
14649
|
+
process.env.NODE_ENV ?? "production"
|
|
14650
|
+
),
|
|
14651
|
+
preventAssignment: true
|
|
14652
|
+
})
|
|
14653
|
+
]
|
|
14654
|
+
}
|
|
14655
|
+
},
|
|
14602
14656
|
resolve: {
|
|
14603
14657
|
builtins: [...nodeCompatExternals]
|
|
14604
14658
|
},
|
|
@@ -14640,7 +14694,9 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14640
14694
|
},
|
|
14641
14695
|
async transform(code, id) {
|
|
14642
14696
|
const workerConfig = getWorkerConfig2(this.environment.name);
|
|
14643
|
-
|
|
14697
|
+
if (!workerConfig) {
|
|
14698
|
+
return;
|
|
14699
|
+
}
|
|
14644
14700
|
const resolvedId = await this.resolve(workerConfig.main);
|
|
14645
14701
|
if (id === resolvedId?.id) {
|
|
14646
14702
|
return injectGlobalCode(id, code);
|
|
@@ -14669,6 +14725,25 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14669
14725
|
);
|
|
14670
14726
|
}
|
|
14671
14727
|
},
|
|
14728
|
+
// Plugin that handles Node.js Async Local Storage (ALS) compatibility support for Vite Environments that are hosted in Cloudflare Workers.
|
|
14729
|
+
{
|
|
14730
|
+
name: "vite-plugin-cloudflare:nodejs-als",
|
|
14731
|
+
apply(_config, env2) {
|
|
14732
|
+
return !env2.isPreview;
|
|
14733
|
+
},
|
|
14734
|
+
configEnvironment(name, config) {
|
|
14735
|
+
if (isNodeAls(getWorkerConfig2(name))) {
|
|
14736
|
+
return {
|
|
14737
|
+
resolve: {
|
|
14738
|
+
builtins: ["async_hooks", "node:async_hooks"]
|
|
14739
|
+
},
|
|
14740
|
+
optimizeDeps: {
|
|
14741
|
+
exclude: ["async_hooks", "node:async_hooks"]
|
|
14742
|
+
}
|
|
14743
|
+
};
|
|
14744
|
+
}
|
|
14745
|
+
}
|
|
14746
|
+
},
|
|
14672
14747
|
// Plugin that provides an __debug path for debugging the Cloudflare Workers.
|
|
14673
14748
|
{
|
|
14674
14749
|
name: "vite-plugin-cloudflare:debug",
|
|
@@ -14734,6 +14809,9 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14734
14809
|
build.onResolve(
|
|
14735
14810
|
{ filter: NODEJS_MODULES_RE },
|
|
14736
14811
|
({ path: path10, importer }) => {
|
|
14812
|
+
if (isNodeAls(workerConfig) && isNodeAlsModule(path10)) {
|
|
14813
|
+
return;
|
|
14814
|
+
}
|
|
14737
14815
|
const nodeJsCompatWarnings = nodeJsCompatWarningsMap.get(workerConfig);
|
|
14738
14816
|
nodeJsCompatWarnings?.registerImport(path10, importer);
|
|
14739
14817
|
return { path: path10, external: true };
|
|
@@ -14763,6 +14841,9 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14763
14841
|
async resolveId(source, importer) {
|
|
14764
14842
|
const workerConfig = getWorkerConfig2(this.environment.name);
|
|
14765
14843
|
if (workerConfig && !isNodeCompat(workerConfig)) {
|
|
14844
|
+
if (isNodeAls(workerConfig) && isNodeAlsModule(source)) {
|
|
14845
|
+
return;
|
|
14846
|
+
}
|
|
14766
14847
|
const nodeJsCompatWarnings = nodeJsCompatWarningsMap.get(workerConfig);
|
|
14767
14848
|
if (nodejsBuiltins.has(source)) {
|
|
14768
14849
|
nodeJsCompatWarnings?.registerImport(source, importer);
|
|
@@ -14781,10 +14862,16 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14781
14862
|
}
|
|
14782
14863
|
}
|
|
14783
14864
|
async function getInputInspectorPortOption(pluginConfig, viteServer) {
|
|
14865
|
+
if (pluginConfig.inspectorPort === void 0 || pluginConfig.inspectorPort === 0) {
|
|
14866
|
+
const resolvedInspectorPort = await getResolvedInspectorPort(pluginConfig);
|
|
14867
|
+
if (resolvedInspectorPort !== null) {
|
|
14868
|
+
return resolvedInspectorPort;
|
|
14869
|
+
}
|
|
14870
|
+
}
|
|
14784
14871
|
const inputInspectorPort = pluginConfig.inspectorPort ?? await getFirstAvailablePort(DEFAULT_INSPECTOR_PORT);
|
|
14785
14872
|
if (pluginConfig.inspectorPort === void 0 && inputInspectorPort !== DEFAULT_INSPECTOR_PORT) {
|
|
14786
14873
|
viteServer.config.logger.warn(
|
|
14787
|
-
|
|
14874
|
+
colors3.dim(
|
|
14788
14875
|
`Default inspector port ${DEFAULT_INSPECTOR_PORT} not available, using ${inputInspectorPort} instead
|
|
14789
14876
|
`
|
|
14790
14877
|
)
|
|
@@ -14810,6 +14897,19 @@ function getDotDevDotVarsContent(configPath, cloudflareEnv) {
|
|
|
14810
14897
|
}
|
|
14811
14898
|
return null;
|
|
14812
14899
|
}
|
|
14900
|
+
function hasDotDevDotVarsFileChanged(resolvedPluginConfig, changedFilePath) {
|
|
14901
|
+
return [...resolvedPluginConfig.configPaths].some((configPath) => {
|
|
14902
|
+
const dotDevDotVars = path9.join(path9.dirname(configPath), ".dev.vars");
|
|
14903
|
+
if (dotDevDotVars === changedFilePath) {
|
|
14904
|
+
return true;
|
|
14905
|
+
}
|
|
14906
|
+
if (resolvedPluginConfig.cloudflareEnv) {
|
|
14907
|
+
const dotDevDotVarsForEnv = `${dotDevDotVars}.${resolvedPluginConfig.cloudflareEnv}`;
|
|
14908
|
+
return dotDevDotVarsForEnv === changedFilePath;
|
|
14909
|
+
}
|
|
14910
|
+
return false;
|
|
14911
|
+
});
|
|
14912
|
+
}
|
|
14813
14913
|
export {
|
|
14814
14914
|
cloudflare2 as cloudflare
|
|
14815
14915
|
};
|
|
@@ -29,7 +29,7 @@ function stripInternalEnv(internalEnv) {
|
|
|
29
29
|
return userEnv;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// ../../node_modules/.pnpm/vite@6.1.0_@types+node@
|
|
32
|
+
// ../../node_modules/.pnpm/vite@6.1.0_@types+node@20.17.32_jiti@2.4.2_lightningcss@1.29.2/node_modules/vite/dist/node/module-runner.js
|
|
33
33
|
var VALID_ID_PREFIX = "/@id/";
|
|
34
34
|
var NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
35
35
|
var SOURCEMAPPING_URL = "sourceMa";
|
|
@@ -1435,20 +1435,21 @@ async function getWorkerEntryExport(path, entrypoint) {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
|
|
1437
1437
|
// src/runner-worker/index.ts
|
|
1438
|
+
var IGNORED_KEYS = ["self", "tailStream"];
|
|
1438
1439
|
var WORKER_ENTRYPOINT_KEYS = [
|
|
1439
1440
|
"fetch",
|
|
1441
|
+
"queue",
|
|
1440
1442
|
"tail",
|
|
1443
|
+
"test",
|
|
1441
1444
|
"trace",
|
|
1442
|
-
"scheduled"
|
|
1443
|
-
"queue",
|
|
1444
|
-
"test"
|
|
1445
|
+
"scheduled"
|
|
1445
1446
|
];
|
|
1446
1447
|
var DURABLE_OBJECT_KEYS = [
|
|
1447
|
-
"fetch",
|
|
1448
1448
|
"alarm",
|
|
1449
|
-
"
|
|
1449
|
+
"fetch",
|
|
1450
1450
|
"webSocketClose",
|
|
1451
|
-
"webSocketError"
|
|
1451
|
+
"webSocketError",
|
|
1452
|
+
"webSocketMessage"
|
|
1452
1453
|
];
|
|
1453
1454
|
var WORKFLOW_ENTRYPOINT_KEYS = ["run"];
|
|
1454
1455
|
var entryPath = "";
|
|
@@ -1513,7 +1514,7 @@ function createWorkerEntrypointWrapper(entrypoint) {
|
|
|
1513
1514
|
if (value !== void 0) {
|
|
1514
1515
|
return value;
|
|
1515
1516
|
}
|
|
1516
|
-
if (key === "
|
|
1517
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || DURABLE_OBJECT_KEYS.includes(key)) {
|
|
1517
1518
|
return;
|
|
1518
1519
|
}
|
|
1519
1520
|
const property = getWorkerEntrypointRpcProperty.call(
|
|
@@ -1611,7 +1612,7 @@ function createDurableObjectWrapper(className) {
|
|
|
1611
1612
|
if (value !== void 0) {
|
|
1612
1613
|
return value;
|
|
1613
1614
|
}
|
|
1614
|
-
if (key === "
|
|
1615
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || WORKER_ENTRYPOINT_KEYS.includes(key)) {
|
|
1615
1616
|
return;
|
|
1616
1617
|
}
|
|
1617
1618
|
const property = getDurableObjectRpcProperty.call(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-8cdabe23f",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -34,17 +34,18 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@hattip/adapter-node": "^0.0.49",
|
|
37
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
37
38
|
"get-port": "^7.1.0",
|
|
38
39
|
"picocolors": "^1.1.1",
|
|
39
40
|
"tinyglobby": "^0.2.12",
|
|
40
41
|
"unenv": "2.0.0-rc.15",
|
|
41
42
|
"ws": "8.18.0",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"wrangler": "0.0.0-
|
|
43
|
+
"miniflare": "0.0.0-8cdabe23f",
|
|
44
|
+
"@cloudflare/unenv-preset": "0.0.0-8cdabe23f",
|
|
45
|
+
"wrangler": "0.0.0-8cdabe23f"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@cloudflare/workers-types": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20250428.0",
|
|
48
49
|
"@types/node": "^22.10.1",
|
|
49
50
|
"@types/ws": "^8.5.13",
|
|
50
51
|
"magic-string": "^0.30.12",
|
|
@@ -53,10 +54,10 @@
|
|
|
53
54
|
"typescript": "^5.7.2",
|
|
54
55
|
"undici": "^5.28.5",
|
|
55
56
|
"vite": "^6.1.0",
|
|
56
|
-
"vitest": "~3.
|
|
57
|
+
"vitest": "~3.1.1",
|
|
57
58
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
58
|
-
"@cloudflare/workers-
|
|
59
|
-
"@cloudflare/workers-
|
|
59
|
+
"@cloudflare/workers-shared": "0.0.0-8cdabe23f",
|
|
60
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"vite": "^6.1.0",
|