@nuxt/nitro-compat-nightly 0.0.0 β†’ 5.0.0-2612051804-2a33920

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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -0
  3. package/dist/index.d.mts +109 -0
  4. package/dist/index.mjs +1485 -0
  5. package/dist/legacy-handler-C_9CWzRw.mjs +539 -0
  6. package/dist/runtime/cache-control-plugin.mjs +24 -0
  7. package/dist/runtime/cache.d.ts +22 -0
  8. package/dist/runtime/cache.mjs +81 -0
  9. package/dist/runtime/decorate.mjs +113 -0
  10. package/dist/runtime/diagnostics.mjs +46 -0
  11. package/dist/runtime/ended-response.mjs +37 -0
  12. package/dist/runtime/entry.mjs +7 -0
  13. package/dist/runtime/error-shape.d.ts +34 -0
  14. package/dist/runtime/error-shape.mjs +162 -0
  15. package/dist/runtime/event-plugin.mjs +19 -0
  16. package/dist/runtime/event.d.ts +20 -0
  17. package/dist/runtime/event.mjs +330 -0
  18. package/dist/runtime/h3-v1-app.d.ts +67 -0
  19. package/dist/runtime/h3-v1-app.mjs +233 -0
  20. package/dist/runtime/h3-v1.d.ts +38 -0
  21. package/dist/runtime/h3-v1.mjs +57 -0
  22. package/dist/runtime/hook-registry.mjs +49 -0
  23. package/dist/runtime/hooks-plugin.mjs +122 -0
  24. package/dist/runtime/import-meta.mjs +13 -0
  25. package/dist/runtime/legacy-handler.mjs +58 -0
  26. package/dist/runtime/legacy-plugin.mjs +94 -0
  27. package/dist/runtime/nitro-v2-types.d.ts +18 -0
  28. package/dist/runtime/nitro-v2-types.mjs +1 -0
  29. package/dist/runtime/nitro-v2.mjs +28 -0
  30. package/dist/runtime/render-before.mjs +90 -0
  31. package/dist/runtime/render-response.mjs +121 -0
  32. package/dist/runtime/render.d.ts +12 -0
  33. package/dist/runtime/render.mjs +20 -0
  34. package/dist/runtime/runtime-config.d.ts +9 -0
  35. package/dist/runtime/runtime-config.mjs +16 -0
  36. package/dist/runtime/wrapper.mjs +11 -0
  37. package/package.json +51 -2
  38. package/dist/.gitkeep +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-present - Nuxt Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ <a href="https://nuxt.com"><img width="830" height="276" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/banner.avif" alt="Nuxt banner"></a>
2
+
3
+ # Nuxt
4
+
5
+ <p>
6
+ <a href="https://npmx.dev/package/nuxt"><img src="https://npmx.dev/api/registry/badge/version/nuxt" alt="Version"></a>
7
+ <a href="https://npmx.dev/package/nuxt"><img src="https://npmx.dev/api/registry/badge/downloads/nuxt" alt="Downloads"></a>
8
+ <a href="https://github.com/nuxt/nuxt/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
9
+ <a href="https://nuxt.com/modules"><img src="https://img.shields.io/badge/dynamic/json?url=https://nuxt.com/api/v1/modules&query=$.stats.modules&label=Modules&style=flat&colorA=18181B&colorB=28CF8D" alt="Modules"></a>
10
+ <a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
11
+ <a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
12
+ <a href="https://securityscorecards.dev/viewer/?uri=github.com/nuxt/nuxt"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
13
+ </p>
14
+
15
+ Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.
16
+
17
+ It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
18
+ - Server-side rendering, static site generation, hybrid rendering and edge-side rendering
19
+ - Automatic routing with code-splitting and pre-fetching
20
+ - Data fetching and state management
21
+ - Search engine optimization and defining meta tags
22
+ - Auto imports of components, composables and utils
23
+ - TypeScript with zero configuration
24
+ - Go full-stack with our server/ directory
25
+ - Extensible with [300+ modules](https://nuxt.com/modules)
26
+ - Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
27
+ - ...[and much more](https://nuxt.com) πŸš€
28
+
29
+ ## πŸš€ Getting Started
30
+
31
+ Use the following command to create a new starter project. This will create a starter project with all the necessary files and dependencies:
32
+
33
+ ```bash
34
+ npm create nuxt@latest <my-project>
35
+ ```
36
+
37
+ > [!TIP]
38
+ > Discover also [nuxt.new](https://nuxt.new): Open a Nuxt starter on CodeSandbox, StackBlitz or locally to get up and running in a few seconds.
39
+
40
+ ## πŸ’» Vue Development
41
+
42
+ Simple, intuitive and powerful, Nuxt lets you write Vue components in a way that makes sense. Every repetitive task is automated, so you can focus on writing your full-stack Vue application with confidence.
43
+
44
+ Example of an `app.vue`:
45
+
46
+ ```vue
47
+ <script setup lang="ts">
48
+ useSeoMeta({
49
+ title: 'Meet Nuxt',
50
+ description: 'The Intuitive Vue Framework.',
51
+ })
52
+ </script>
53
+
54
+ <template>
55
+ <div id="app">
56
+ <AppHeader />
57
+ <NuxtPage />
58
+ <AppFooter />
59
+ </div>
60
+ </template>
61
+
62
+ <style scoped>
63
+ #app {
64
+ background-color: #020420;
65
+ color: #00DC82;
66
+ }
67
+ </style>
68
+ ```
69
+
70
+ ## πŸ“– Documentation
71
+
72
+ We highly recommend you take a look at the [Nuxt documentation](https://nuxt.com/docs) to level up. It’s a great resource for learning more about the framework. It covers everything from getting started to advanced topics.
73
+
74
+ ## 🧩 Modules
75
+
76
+ Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nuxt project, created by the Nuxt team and community.
77
+
78
+ ## ❀️ Contribute
79
+
80
+ We invite you to contribute and help improve Nuxt πŸ’š
81
+
82
+ Here are a few ways you can get involved:
83
+ - **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/4.x/community/reporting-bugs) to learn how to submit a bug report.
84
+ - **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/4.x/community/contribution) to share your suggestions.
85
+ - **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/4.x/community/getting-help) provides resources to help you out.
86
+
87
+ ## 🏠 Local Development
88
+
89
+ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/4.x/community/framework-contribution#setup) to contribute to the framework and documentation.
90
+
91
+ ## πŸ›Ÿ Professional Support
92
+
93
+ - Technical audit & consulting: [Nuxt Experts](https://nuxt.com/enterprise/support)
94
+ - Custom development & more: [Nuxt Agencies Partners](https://nuxt.com/enterprise/agencies)
95
+
96
+ ## πŸ”— Follow Us
97
+
98
+ <p valign="center">
99
+ <a href="https://go.nuxt.com/discord"><img width="20" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/x"><img width="20" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/github"><img width="20" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/github.svg" alt="GitHub"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/bluesky"><img width="20" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
100
+ </p>
101
+
102
+ ## <a name="license">βš–οΈ License</a>
103
+
104
+ [MIT](https://github.com/nuxt/nuxt/blob/main/LICENSE)
@@ -0,0 +1,109 @@
1
+ import { Nuxt, ResolvedNitroLegacyOptions, ServerApi } from "@nuxt/schema";
2
+ import { Nitro, NitroConfig } from "nitro/types";
3
+ interface LegacyImportsPreset {
4
+ from: string;
5
+ imports: Array<string | {
6
+ name: string;
7
+ as?: string;
8
+ typeFrom?: string;
9
+ }>;
10
+ }
11
+ /** The default server auto-import presets, which the `nitroLegacy` toggles redirect names of. */
12
+ interface ServerImportsBase {
13
+ /** The portable `nuxt/server` surface. */
14
+ portable: {
15
+ from: string;
16
+ imports: string[];
17
+ };
18
+ /** The Nitro v2 names of Nitro v3 helpers. */
19
+ v2: LegacyImportsPreset[];
20
+ /** h3's remaining helpers, from `nitro/h3`. */
21
+ h3: () => Promise<{
22
+ from: string;
23
+ imports: string[];
24
+ }>;
25
+ /** The module `useAppConfig` is imported from. */
26
+ appConfig: string;
27
+ }
28
+ interface InstalledModule {
29
+ /** Package root (or in-project directory) of the module. */
30
+ dir: string;
31
+ /** The module's `meta.name`, for the build notice. */
32
+ name?: string;
33
+ /** The module's `meta.compatibility.server`, when it declared one. */
34
+ server?: ServerApi;
35
+ }
36
+ export interface NitroCompatOptions {
37
+ /** Whether the app is built by Nuxt 4. */
38
+ nuxt4Host: boolean;
39
+ /** Server plugins registered as Nitro v3 code. */
40
+ migratedPlugins: Set<string>;
41
+ /** The specifier that app code of a Nuxt 4 host imports the h3 v1 helpers from. */
42
+ hostH3Entry: string;
43
+ /** The server runtime, which is never Nitro v2 code. */
44
+ runtimeDir: string;
45
+ /** The server runtime module the compat runtime reads route rules through. */
46
+ routeRules: string;
47
+ /** The server runtime module the compat runtime reads host specifics through. */
48
+ host: string;
49
+ /** The default server auto-import presets. */
50
+ imports: ServerImportsBase;
51
+ }
52
+ /** The rejected scan suffixes of server files, as reported to the user. */
53
+ export interface ScanSuffixesReport {
54
+ count: number;
55
+ files: string;
56
+ suffixes: string;
57
+ }
58
+ type StorageMounts = NonNullable<NitroConfig["kv"]>;
59
+ export interface NitroConfigContext {
60
+ /** Modules installed in the app, whose server code is Nitro v2 code unless they declare otherwise. */
61
+ installedModules: InstalledModule[];
62
+ /** Registered variants the build does not use. */
63
+ unusedVariants: string[];
64
+ }
65
+ /**
66
+ * The Nitro v2 compatibility layer of a server build. Each method is called once, at a
67
+ * fixed point of the build.
68
+ */
69
+ export interface NitroCompat {
70
+ /** The `nitroLegacy` toggles of the app. */
71
+ readonly legacy: ResolvedNitroLegacyOptions;
72
+ /** The directory the compat runtime is loaded from, which the server build bundles. */
73
+ readonly distDir: string;
74
+ /** Register the app build plugins, before anything else is set up. */
75
+ setupApp: () => void;
76
+ /** Aliases for the server build. */
77
+ aliases: () => Record<string, string>;
78
+ /** The packages whose types the server program resolves from Nitro's copies, given the ones it already does. */
79
+ typePackages: (packages: string[]) => string[];
80
+ /** The server auto-import presets under the `nitroLegacy` toggles of the app. */
81
+ serverImportsPresets: () => Promise<Array<LegacyImportsPreset & {
82
+ priority?: number;
83
+ }>>;
84
+ /** Called before `nitro:config`. */
85
+ beforeNitroConfig: (nitroConfig: NitroConfig) => void;
86
+ /** Called after `nitro:config`, once the server registrations are collected. */
87
+ afterNitroConfig: (nitroConfig: NitroConfig, context: NitroConfigContext) => Promise<void>;
88
+ /** Reports rejected scan suffixes that are kept as part of the name, or `undefined` when they are not kept. */
89
+ readonly keepScanSuffixes: ((report: ScanSuffixesReport) => void) | undefined;
90
+ /** Called after `createNitro`, with the storage mounts of the project sources. */
91
+ afterCreateNitro: (nitro: Nitro, sourceMounts: StorageMounts) => Promise<void>;
92
+ /** Called after `nitro:init`, once modules can no longer register server code through Nuxt. */
93
+ afterNitroInit: (nitro: Nitro) => void;
94
+ /** Add the paths and references of the server program, after the paths of the server aliases. */
95
+ prepareServerTypes: (paths: Record<string, string[]>, references: Array<{
96
+ path: string;
97
+ } | {
98
+ types: string;
99
+ }>) => void;
100
+ /** The module the server runtime reads its compatibility hooks from, while the layer is active. */
101
+ runtimeEntry: () => string | undefined;
102
+ }
103
+ export declare function createNitroCompat(nuxt: Nuxt, options: NitroCompatOptions): NitroCompat;
104
+ /**
105
+ * Key cached handlers and cached routes on their whole query, and pass it to the handler,
106
+ * unless the app sets a default `allowQuery` of its own.
107
+ */
108
+ export declare function keepCachedQuery(nitroConfig: Pick<NitroConfig, "cache">): void;
109
+ export type { InstalledModule, LegacyImportsPreset, ServerImportsBase };