nitro-nightly 3.0.1-20251210-205305-4754f28d → 3.0.1-20251210-212455-5a5e1f5a

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.
@@ -83,7 +83,6 @@ const getRollupConfig = (nitro) => {
83
83
  extensions: base.extensions,
84
84
  preferBuiltins: !!nitro.options.node,
85
85
  rootDir: nitro.options.rootDir,
86
- modulePaths: nitro.options.nodeModulesDirs,
87
86
  mainFields: ["main"],
88
87
  exportConditions: nitro.options.exportConditions
89
88
  }),
package/dist/_nitro.mjs CHANGED
@@ -19,7 +19,7 @@ import { joinURL, parseURL, withBase, withLeadingSlash, withTrailingSlash, witho
19
19
  import { pathToFileURL } from "node:url";
20
20
  import fsp, { readFile } from "node:fs/promises";
21
21
  import { defu } from "defu";
22
- import { pkgDir, runtimeDir } from "nitro/meta";
22
+ import { runtimeDir } from "nitro/meta";
23
23
  import { colors } from "consola/utils";
24
24
  import { hash } from "ohash";
25
25
  import zlib from "node:zlib";
@@ -96,7 +96,6 @@ const NitroDefaults = {
96
96
  tsconfigPath: "tsconfig.json",
97
97
  tsConfig: void 0
98
98
  },
99
- nodeModulesDirs: [],
100
99
  hooks: {},
101
100
  commands: {},
102
101
  framework: {
@@ -310,12 +309,6 @@ async function resolvePathOptions(options) {
310
309
  options.output.dir = resolveNitroPath(options.output.dir || NitroDefaults.output.dir, options, options.rootDir) + "/";
311
310
  options.output.publicDir = resolveNitroPath(options.output.publicDir || NitroDefaults.output.publicDir, options, options.rootDir) + "/";
312
311
  options.output.serverDir = resolveNitroPath(options.output.serverDir || NitroDefaults.output.serverDir, options, options.rootDir) + "/";
313
- options.nodeModulesDirs.push(resolve(options.rootDir, "node_modules"));
314
- options.nodeModulesDirs.push(resolve(options.workspaceDir, "node_modules"));
315
- options.nodeModulesDirs.push(resolve(pkgDir, "dist/node_modules"));
316
- options.nodeModulesDirs.push(resolve(pkgDir, "node_modules"));
317
- options.nodeModulesDirs.push(resolve(pkgDir, ".."));
318
- options.nodeModulesDirs = [...new Set(options.nodeModulesDirs.map((dir) => resolve(options.rootDir, dir) + "/"))];
319
312
  options.plugins = options.plugins.map((p) => resolveNitroPath(p, options));
320
313
  if (options.serverDir) options.scanDirs.unshift(options.serverDir);
321
314
  options.scanDirs = options.scanDirs.map((dir) => resolve(options.rootDir, dir));
package/dist/_nitro2.mjs CHANGED
@@ -134,7 +134,7 @@ async function writeTypes(nitro) {
134
134
  if (!isAbsolute(path)) {
135
135
  const resolvedPath = resolveModulePath(from, {
136
136
  try: true,
137
- from: nitro.options.nodeModulesDirs,
137
+ from: nitro.options.rootDir,
138
138
  conditions: [
139
139
  "type",
140
140
  "node",
package/dist/_presets.mjs CHANGED
@@ -5,7 +5,7 @@ import "./_libs/@rollup/plugin-commonjs.mjs";
5
5
  import { t as glob } from "./_libs/tinyglobby.mjs";
6
6
  import { r as resolveCompatibilityDatesFromEnv, t as formatCompatibilityDate } from "./_libs/compatx.mjs";
7
7
  import { i as a, n as K, o as p } from "./_libs/std-env.mjs";
8
- import { i as writeFile$2 } from "./_build/shared.mjs";
8
+ import { i as writeFile$2, n as prettyPath } from "./_build/shared.mjs";
9
9
  import { builtinModules } from "node:module";
10
10
  import consola$1 from "consola";
11
11
  import { dirname, extname, relative, resolve } from "node:path";
@@ -227,14 +227,14 @@ var preset_default$4 = [awsLambda];
227
227
 
228
228
  //#endregion
229
229
  //#region src/presets/_utils/fs.ts
230
- function prettyPath(p$1, highlight = true) {
230
+ function prettyPath$1(p$1, highlight = true) {
231
231
  p$1 = relative$1(process.cwd(), p$1);
232
232
  return highlight ? colors.cyan(p$1) : p$1;
233
233
  }
234
234
  async function writeFile$1(file, contents, log = false) {
235
235
  await fsp.mkdir(dirname$1(file), { recursive: true });
236
236
  await fsp.writeFile(file, contents, typeof contents === "string" ? "utf8" : void 0);
237
- if (log) consola$1.info("Generated", prettyPath(file));
237
+ if (log) consola$1.info("Generated", prettyPath$1(file));
238
238
  }
239
239
 
240
240
  //#endregion
@@ -605,7 +605,7 @@ async function cloudflareDevModule(nitro) {
605
605
  alias: { "cloudflare:workers": resolve(presetsDir, "cloudflare/runtime/shims/workers.dev.mjs") }
606
606
  });
607
607
  if (!await resolveModulePath("wrangler", {
608
- from: nitro.options.nodeModulesDirs,
608
+ from: nitro.options.rootDir,
609
609
  try: true
610
610
  })) {
611
611
  nitro.logger.warn("Wrangler is not installed. Please install it using `npx nypm i wrangler` to enable dev emulation.");
@@ -640,6 +640,36 @@ async function cloudflareDevModule(nitro) {
640
640
  }));
641
641
  }
642
642
 
643
+ //#endregion
644
+ //#region src/presets/cloudflare/entry-exports.ts
645
+ const RESOLVE_EXTENSIONS = [
646
+ ".ts",
647
+ ".js",
648
+ ".mts",
649
+ ".mjs"
650
+ ];
651
+ async function setupEntryExports(nitro) {
652
+ const exportsEntry = resolveExportsEntry(nitro);
653
+ if (!exportsEntry) return;
654
+ const originalEntry = nitro.options.entry;
655
+ const virtualEntryId = nitro.options.entry = "#nitro-internal-virtual/cloudflare-server-entry";
656
+ nitro.options.virtual[virtualEntryId] = `
657
+ export * from "${exportsEntry}";
658
+ export * from "${originalEntry}";
659
+ export { default } from "${originalEntry}";
660
+ `;
661
+ }
662
+ function resolveExportsEntry(nitro) {
663
+ const entry = resolveModulePath(nitro.options.cloudflare?.exports || "./exports.cloudflare.ts", {
664
+ from: nitro.options.rootDir,
665
+ extensions: RESOLVE_EXTENSIONS,
666
+ try: true
667
+ });
668
+ if (!entry && nitro.options.cloudflare?.exports) nitro.logger.warn(`Your custom Cloudflare entrypoint \`${prettyPath(nitro.options.cloudflare.exports)}\` file does not exist.`);
669
+ else if (entry && !nitro.options.cloudflare?.exports) nitro.logger.info(`Detected \`${prettyPath(entry)}\` as Cloudflare entrypoint.`);
670
+ return entry;
671
+ }
672
+
643
673
  //#endregion
644
674
  //#region src/presets/cloudflare/preset.ts
645
675
  const cloudflarePages = defineNitroPreset({
@@ -670,6 +700,7 @@ const cloudflarePages = defineNitroPreset({
670
700
  "build:before": async (nitro) => {
671
701
  nitro.options.unenv.push(unenvCfExternals);
672
702
  await enableNodeCompat(nitro);
703
+ await setupEntryExports(nitro);
673
704
  },
674
705
  async compiled(nitro) {
675
706
  await writeWranglerConfig(nitro, "pages");
@@ -737,6 +768,7 @@ const cloudflareModule = defineNitroPreset({
737
768
  "build:before": async (nitro) => {
738
769
  nitro.options.unenv.push(unenvCfExternals);
739
770
  await enableNodeCompat(nitro);
771
+ await setupEntryExports(nitro);
740
772
  },
741
773
  async compiled(nitro) {
742
774
  await writeWranglerConfig(nitro, "module");
@@ -1585,6 +1585,10 @@ interface CloudflareOptions {
1585
1585
  */
1586
1586
  defaultRoutes?: boolean;
1587
1587
  };
1588
+ /**
1589
+ * Custom Cloudflare exports additional classes such as WorkflowEntrypoint.
1590
+ */
1591
+ exports?: string;
1588
1592
  }
1589
1593
  type DurableObjectState = ConstructorParameters<typeof DurableObject>[0];
1590
1594
  declare module "nitro/types" {
@@ -3035,7 +3039,6 @@ interface NitroOptions extends PresetOptions {
3035
3039
  tsconfigPath: string;
3036
3040
  };
3037
3041
  hooks: NestedHooks<NitroHooks>;
3038
- nodeModulesDirs: string[];
3039
3042
  commands: {
3040
3043
  preview: string;
3041
3044
  deploy: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251210-205305-4754f28d",
3
+ "version": "3.0.1-20251210-212455-5a5e1f5a",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",