nitro-nightly 3.0.1-20251110-102933-36971ba8 → 3.0.1-20251110-114636-6d7c4b0f
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/_presets.mjs +15 -20
- package/dist/runtime/meta.mjs +4 -3
- package/package.json +1 -1
package/dist/_presets.mjs
CHANGED
|
@@ -576,19 +576,14 @@ async function writeWranglerConfig(nitro, cfTarget) {
|
|
|
576
576
|
wranglerConfig.name = await generateWorkerName(nitro);
|
|
577
577
|
nitro.logger.info(`Using auto generated worker name: \`${wranglerConfig.name}\``);
|
|
578
578
|
}
|
|
579
|
-
|
|
580
|
-
if (nitro.options.cloudflare?.nodeCompat)
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
compatFlags.add("nodejs_compat");
|
|
588
|
-
compatFlags.add("no_nodejs_compat_v2");
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
wranglerConfig.compatibility_flags = [...compatFlags];
|
|
579
|
+
wranglerConfig.compatibility_flags ??= [];
|
|
580
|
+
if (nitro.options.cloudflare?.nodeCompat && !wranglerConfig.compatibility_flags.includes("nodejs_compat")) wranglerConfig.compatibility_flags.push("nodejs_compat");
|
|
581
|
+
if (wranglerConfig.no_bundle === void 0) wranglerConfig.no_bundle = true;
|
|
582
|
+
wranglerConfig.rules ??= [];
|
|
583
|
+
if (!wranglerConfig.rules.some((rule) => rule.type === "ESModule")) wranglerConfig.rules.push({
|
|
584
|
+
type: "ESModule",
|
|
585
|
+
globs: ["**/*.mjs", "**/*.js"]
|
|
586
|
+
});
|
|
592
587
|
await writeFile$1(wranglerConfigPath, JSON.stringify(wranglerConfig, null, 2), true);
|
|
593
588
|
const configPath = join$1(nitro.options.rootDir, ".wrangler/deploy/config.json");
|
|
594
589
|
await writeFile$1(configPath, JSON.stringify({ configPath: relative(dirname(configPath), wranglerConfigPath) }), true);
|
|
@@ -604,6 +599,10 @@ async function generateWorkerName(nitro) {
|
|
|
604
599
|
//#region src/presets/cloudflare/dev.ts
|
|
605
600
|
async function cloudflareDevModule(nitro) {
|
|
606
601
|
if (!nitro.options.dev) return;
|
|
602
|
+
nitro.options.unenv.push({
|
|
603
|
+
meta: { name: "nitro:cloudflare-dev" },
|
|
604
|
+
alias: { "cloudflare:workers": resolve(presetsDir, "cloudflare/runtime/shims/workers.dev.mjs") }
|
|
605
|
+
});
|
|
607
606
|
if (!await resolveModulePath("wrangler", {
|
|
608
607
|
from: nitro.options.nodeModulesDirs,
|
|
609
608
|
try: true
|
|
@@ -658,7 +657,6 @@ const cloudflarePages = defineNitroPreset({
|
|
|
658
657
|
publicDir: "{{ output.dir }}/{{ baseURL }}",
|
|
659
658
|
serverDir: "{{ output.dir }}/_worker.js"
|
|
660
659
|
},
|
|
661
|
-
unenv: [unenvCfExternals],
|
|
662
660
|
alias: { _mime: "mime/index.js" },
|
|
663
661
|
wasm: {
|
|
664
662
|
lazy: false,
|
|
@@ -671,6 +669,7 @@ const cloudflarePages = defineNitroPreset({
|
|
|
671
669
|
} },
|
|
672
670
|
hooks: {
|
|
673
671
|
"build:before": async (nitro) => {
|
|
672
|
+
nitro.options.unenv.push(unenvCfExternals);
|
|
674
673
|
await enableNodeCompat(nitro);
|
|
675
674
|
},
|
|
676
675
|
async compiled(nitro) {
|
|
@@ -705,11 +704,7 @@ const cloudflarePagesStatic = defineNitroPreset({
|
|
|
705
704
|
});
|
|
706
705
|
const cloudflareDev = defineNitroPreset({
|
|
707
706
|
extends: "nitro-dev",
|
|
708
|
-
modules: [cloudflareDevModule]
|
|
709
|
-
unenv: {
|
|
710
|
-
meta: { name: "cloudflare-dev" },
|
|
711
|
-
alias: { "cloudflare:workers": resolve$1(presetsDir, "cloudflare/runtime/shims/workers.dev.mjs") }
|
|
712
|
-
}
|
|
707
|
+
modules: [cloudflareDevModule]
|
|
713
708
|
}, {
|
|
714
709
|
name: "cloudflare-dev",
|
|
715
710
|
aliases: [
|
|
@@ -730,7 +725,6 @@ const cloudflareModule = defineNitroPreset({
|
|
|
730
725
|
preview: "npx wrangler --cwd ./ dev",
|
|
731
726
|
deploy: "npx wrangler --cwd ./ deploy"
|
|
732
727
|
},
|
|
733
|
-
unenv: [unenvCfExternals],
|
|
734
728
|
rollupConfig: { output: {
|
|
735
729
|
format: "esm",
|
|
736
730
|
exports: "named",
|
|
@@ -742,6 +736,7 @@ const cloudflareModule = defineNitroPreset({
|
|
|
742
736
|
},
|
|
743
737
|
hooks: {
|
|
744
738
|
"build:before": async (nitro) => {
|
|
739
|
+
nitro.options.unenv.push(unenvCfExternals);
|
|
745
740
|
await enableNodeCompat(nitro);
|
|
746
741
|
},
|
|
747
742
|
async compiled(nitro) {
|
package/dist/runtime/meta.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import packageJson from "../../package.json" with { type: "json" };
|
|
3
3
|
export const version = packageJson.version;
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
4
|
+
const resolve = (path) => fileURLToPath(new URL(path, import.meta.url));
|
|
5
|
+
export const pkgDir = /* @__PURE__ */ resolve("../../");
|
|
6
|
+
export const runtimeDir = /* @__PURE__ */ resolve("./");
|
|
7
|
+
export const presetsDir = /* @__PURE__ */ resolve("../presets/");
|
|
7
8
|
export const runtimeDependencies = [
|
|
8
9
|
"crossws",
|
|
9
10
|
"croner",
|
package/package.json
CHANGED