nitro-nightly 3.0.1-20251116-164626-65799949 → 3.0.1-20251116-223140-b9920d49

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.
@@ -13,7 +13,7 @@ import "../_libs/tinyglobby.mjs";
13
13
  import "../_libs/compatx.mjs";
14
14
  import "../_libs/klona.mjs";
15
15
  import { r as a } from "../_libs/std-env.mjs";
16
- import "../_chunks/Clc3YR4F.mjs";
16
+ import "../_chunks/QnObqKaP.mjs";
17
17
  import "../_libs/escape-string-regexp.mjs";
18
18
  import "../_libs/tsconfck.mjs";
19
19
  import "../_libs/dot-prop.mjs";
@@ -2,7 +2,7 @@ import { C as isAbsolute$1, O as relative$1, b as basename$1, h as resolveModule
2
2
  import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
3
3
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
4
4
  import { n as T, r as a } from "../_libs/std-env.mjs";
5
- import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/Clc3YR4F.mjs";
5
+ import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/QnObqKaP.mjs";
6
6
  import { n as prettyPath } from "../_chunks/DJvLZH4H.mjs";
7
7
  import { i as scanHandlers } from "../_chunks/XHOrB-Xs.mjs";
8
8
  import { n as writeBuildInfo, t as getBuildInfo } from "./common.mjs";
@@ -329,18 +329,25 @@ async function resolvePathOptions(options) {
329
329
  h.handler = resolveNitroPath(h.handler, options);
330
330
  return [route, h];
331
331
  }));
332
- if (!options.routes["/**"] && !options.handlers.some((h) => h.route === "/**")) {
333
- const serverEntry = resolveModulePath("./server", {
334
- from: [options.rootDir, ...options.scanDirs],
335
- extensions: RESOLVE_EXTENSIONS,
336
- try: true
337
- });
338
- if (serverEntry) {
339
- if (!(options.handlers.some((h) => h.handler === serverEntry) || Object.values(options.routes).some((r) => r.handler === serverEntry))) {
340
- options.routes["/**"] = { handler: serverEntry };
341
- consola$1.info(`Using \`${prettyPath(serverEntry)}\` as default route handler.`);
332
+ if (options.serverEntry !== false) {
333
+ if (typeof options?.serverEntry === "string") options.serverEntry = { handler: options.serverEntry };
334
+ if (options.serverEntry?.handler) options.serverEntry.handler = resolveNitroPath(options.serverEntry.handler, options);
335
+ else {
336
+ const detected = resolveModulePath("./server", {
337
+ try: true,
338
+ from: options.rootDir,
339
+ extensions: RESOLVE_EXTENSIONS.flatMap((ext) => [ext, `.node${ext}`])
340
+ });
341
+ if (detected) {
342
+ options.serverEntry ??= { handler: "" };
343
+ options.serverEntry.handler = detected;
344
+ consola$1.info(`Detected \`${prettyPath(detected)}\` as server entry.`);
342
345
  }
343
346
  }
347
+ if (options.serverEntry?.handler && !options.serverEntry?.format) {
348
+ const isNode = /\.(node)\.\w+$/.test(options.serverEntry.handler);
349
+ options.serverEntry.format = isNode ? "node" : "web";
350
+ }
344
351
  }
345
352
  if (options.renderer?.handler) options.renderer.handler = resolveModulePath(resolveNitroPath(options.renderer?.handler, options), {
346
353
  from: [options.rootDir, ...options.scanDirs],
@@ -804,6 +811,12 @@ function initNitroRouting(nitro) {
804
811
  ...nitro.options.handlers,
805
812
  ...nitro.scannedHandlers
806
813
  ].filter((h) => h && !h.middleware && matchesEnv(h));
814
+ if (nitro.options.serverEntry && nitro.options.serverEntry.handler) _routes.push({
815
+ route: "/**",
816
+ lazy: false,
817
+ format: nitro.options.serverEntry.format,
818
+ handler: nitro.options.serverEntry.handler
819
+ });
807
820
  if (nitro.options.renderer?.handler) _routes.push({
808
821
  route: "/**",
809
822
  lazy: true,
package/dist/_presets.mjs CHANGED
@@ -1194,10 +1194,14 @@ const netlify = defineNitroPreset({
1194
1194
  await writeHeaders(nitro);
1195
1195
  await writeRedirects(nitro);
1196
1196
  await promises.writeFile(join$1(nitro.options.output.dir, "server", "server.mjs"), generateNetlifyFunction(nitro));
1197
- if (nitro.options.netlify) {
1197
+ if (nitro.options.netlify?.images) {
1198
+ nitro.options.netlify.config ||= {};
1199
+ nitro.options.netlify.config.images ||= nitro.options.netlify?.images;
1200
+ }
1201
+ if (Object.keys(nitro.options.netlify?.config || {}).length > 0) {
1198
1202
  const configPath = join$1(nitro.options.output.dir, "../deploy/v1/config.json");
1199
1203
  await promises.mkdir(dirname$1(configPath), { recursive: true });
1200
- await promises.writeFile(configPath, JSON.stringify(nitro.options.netlify), "utf8");
1204
+ await promises.writeFile(configPath, JSON.stringify(nitro.options.netlify?.config), "utf8");
1201
1205
  }
1202
1206
  } }
1203
1207
  }, {
package/dist/builder.mjs CHANGED
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
13
13
  import "./_libs/compatx.mjs";
14
14
  import "./_libs/klona.mjs";
15
15
  import "./_libs/std-env.mjs";
16
- import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/Clc3YR4F.mjs";
16
+ import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/QnObqKaP.mjs";
17
17
  import "./_libs/escape-string-regexp.mjs";
18
18
  import "./_libs/tsconfck.mjs";
19
19
  import "./_libs/dot-prop.mjs";
@@ -1671,17 +1671,53 @@ interface AppHostingOutputBundleConfig {
1671
1671
  }
1672
1672
  //#endregion
1673
1673
  //#region src/presets/netlify/types.d.ts
1674
- /**
1675
- * Netlify options
1676
- */
1677
1674
  interface NetlifyOptions {
1678
- images?: {
1679
- /**
1680
- * Permitted remote image sources. Array of regex strings.
1681
- * @see https://docs.netlify.com/image-cdn/overview/#remote-path
1682
- */
1683
- remote_images?: string[];
1684
- };
1675
+ /** @deprecated Use `config.images` */
1676
+ images?: NetlifyImagesConfig;
1677
+ config?: NetlifyConfigJson;
1678
+ }
1679
+ interface NetlifyConfigJson {
1680
+ edge_functions?: NetlifyEdgeFunctionDeclaration[];
1681
+ functions?: NetlifyFunctionsConfig | NetlifyFunctionsConfigByPattern;
1682
+ headers?: NetlifyHeaderRule[];
1683
+ images?: NetlifyImagesConfig;
1684
+ redirects?: NetlifyRedirectRule[];
1685
+ "redirects!"?: NetlifyRedirectRule[];
1686
+ }
1687
+ interface NetlifyEdgeFunctionDeclaration {
1688
+ function: string;
1689
+ path?: string;
1690
+ pattern?: string;
1691
+ excludedPath?: string;
1692
+ excludedPattern?: string;
1693
+ cache?: string;
1694
+ [key: string]: unknown;
1695
+ }
1696
+ interface NetlifyFunctionsConfig extends NetlifyFunctionInlineConfig {
1697
+ directory?: string;
1698
+ }
1699
+ type NetlifyFunctionsConfigByPattern = Record<string, NetlifyFunctionInlineConfig>;
1700
+ interface NetlifyFunctionInlineConfig {
1701
+ included_files?: string[];
1702
+ [key: string]: unknown;
1703
+ }
1704
+ interface NetlifyHeaderRule {
1705
+ for: string;
1706
+ values: Record<string, string>;
1707
+ [key: string]: unknown;
1708
+ }
1709
+ interface NetlifyImagesConfig {
1710
+ remote_images?: string[];
1711
+ [key: string]: unknown;
1712
+ }
1713
+ interface NetlifyRedirectRule {
1714
+ from: string;
1715
+ to: string;
1716
+ status?: number;
1717
+ force?: boolean;
1718
+ conditions?: Record<string, string[]>;
1719
+ query?: Record<string, string>;
1720
+ [key: string]: unknown;
1685
1721
  }
1686
1722
  //#endregion
1687
1723
  //#region src/presets/vercel/types.d.ts
@@ -2956,12 +2992,16 @@ interface NitroOptions extends PresetOptions {
2956
2992
  };
2957
2993
  baseURL: string;
2958
2994
  apiBaseURL: string;
2959
- routes: Record<string, string | Omit<NitroEventHandler, "route" | "middleware">>;
2995
+ serverEntry: false | {
2996
+ handler: string;
2997
+ format?: EventHandlerFormat;
2998
+ };
2960
2999
  handlers: NitroEventHandler[];
2961
3000
  devHandlers: NitroDevEventHandler[];
2962
3001
  routeRules: {
2963
3002
  [path: string]: NitroRouteRules;
2964
3003
  };
3004
+ routes: Record<string, string | Omit<NitroEventHandler, "route" | "middleware">>;
2965
3005
  errorHandler: string | string[];
2966
3006
  devErrorHandler: NitroErrorHandler;
2967
3007
  prerender: {
@@ -3036,7 +3076,7 @@ interface NitroOptions extends PresetOptions {
3036
3076
  /**
3037
3077
  * Nitro input config (nitro.config)
3038
3078
  */
3039
- interface NitroConfig extends DeepPartial<Omit<NitroOptions, "routeRules" | "rollupConfig" | "preset" | "compatibilityDate" | "unenv" | "serverDir" | "_config" | "_c12">>, C12InputConfig<NitroConfig> {
3079
+ interface NitroConfig extends DeepPartial<Omit<NitroOptions, "routeRules" | "rollupConfig" | "preset" | "compatibilityDate" | "unenv" | "serverDir" | "_config" | "_c12" | "serverEntry">>, C12InputConfig<NitroConfig> {
3040
3080
  preset?: PresetNameInput;
3041
3081
  extends?: string | string[] | NitroPreset;
3042
3082
  routeRules?: {
@@ -3046,6 +3086,7 @@ interface NitroConfig extends DeepPartial<Omit<NitroOptions, "routeRules" | "rol
3046
3086
  compatibilityDate?: CompatibilityDateSpec;
3047
3087
  unenv?: Preset | Preset[];
3048
3088
  serverDir?: boolean | "./" | "./server" | (string & {});
3089
+ serverEntry?: string | NitroOptions["serverEntry"];
3049
3090
  }
3050
3091
  interface LoadConfigOptions {
3051
3092
  watch?: boolean;
package/dist/vite.mjs CHANGED
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
13
13
  import "./_libs/compatx.mjs";
14
14
  import "./_libs/klona.mjs";
15
15
  import "./_libs/std-env.mjs";
16
- import "./_chunks/Clc3YR4F.mjs";
16
+ import "./_chunks/QnObqKaP.mjs";
17
17
  import "./_libs/escape-string-regexp.mjs";
18
18
  import "./_libs/tsconfck.mjs";
19
19
  import "./_libs/dot-prop.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251116-164626-65799949",
3
+ "version": "3.0.1-20251116-223140-b9920d49",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",