This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
6,816 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"date": "2024-10-11T19:42:58.132Z", | ||
"preset": "nitro-dev", | ||
"framework": { | ||
"name": "nitro", | ||
"version": "" | ||
}, | ||
"versions": { | ||
"nitro": "2.9.6" | ||
}, | ||
"dev": { | ||
"pid": 3442677, | ||
"workerAddress": { | ||
"socketPath": "/tmp/nitro/worker-3442677-1.sock" | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
examples/internal/aws-nitro/.nitro/types/nitro-config.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Generated by nitro | ||
|
||
// App Config | ||
import type { Defu } from 'defu' | ||
|
||
|
||
|
||
type UserAppConfig = Defu<{}, []> | ||
|
||
declare module "nitropack/types" { | ||
interface AppConfig extends UserAppConfig {} | ||
interface NitroRuntimeConfig { | ||
streaming: boolean, | ||
} | ||
} | ||
export {} |
126 changes: 126 additions & 0 deletions
126
examples/internal/aws-nitro/.nitro/types/nitro-imports.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
declare global { | ||
const appendCorsHeaders: typeof import('../../node_modules/h3')['appendCorsHeaders'] | ||
const appendCorsPreflightHeaders: typeof import('../../node_modules/h3')['appendCorsPreflightHeaders'] | ||
const appendHeader: typeof import('../../node_modules/h3')['appendHeader'] | ||
const appendHeaders: typeof import('../../node_modules/h3')['appendHeaders'] | ||
const appendResponseHeader: typeof import('../../node_modules/h3')['appendResponseHeader'] | ||
const appendResponseHeaders: typeof import('../../node_modules/h3')['appendResponseHeaders'] | ||
const assertMethod: typeof import('../../node_modules/h3')['assertMethod'] | ||
const cachedEventHandler: typeof import('../../../../../../nitro/dist/runtime/index')['cachedEventHandler'] | ||
const cachedFunction: typeof import('../../../../../../nitro/dist/runtime/index')['cachedFunction'] | ||
const callNodeListener: typeof import('../../node_modules/h3')['callNodeListener'] | ||
const clearResponseHeaders: typeof import('../../node_modules/h3')['clearResponseHeaders'] | ||
const clearSession: typeof import('../../node_modules/h3')['clearSession'] | ||
const createApp: typeof import('../../node_modules/h3')['createApp'] | ||
const createAppEventHandler: typeof import('../../node_modules/h3')['createAppEventHandler'] | ||
const createError: typeof import('../../node_modules/h3')['createError'] | ||
const createEvent: typeof import('../../node_modules/h3')['createEvent'] | ||
const createEventStream: typeof import('../../node_modules/h3')['createEventStream'] | ||
const createRouter: typeof import('../../node_modules/h3')['createRouter'] | ||
const defaultContentType: typeof import('../../node_modules/h3')['defaultContentType'] | ||
const defineCachedEventHandler: typeof import('../../../../../../nitro/dist/runtime/index')['defineCachedEventHandler'] | ||
const defineCachedFunction: typeof import('../../../../../../nitro/dist/runtime/index')['defineCachedFunction'] | ||
const defineEventHandler: typeof import('../../node_modules/h3')['defineEventHandler'] | ||
const defineLazyEventHandler: typeof import('../../node_modules/h3')['defineLazyEventHandler'] | ||
const defineNitroErrorHandler: typeof import('../../../../../../nitro/dist/runtime/index')['defineNitroErrorHandler'] | ||
const defineNitroPlugin: typeof import('../../../../../../nitro/dist/runtime/index')['defineNitroPlugin'] | ||
const defineNodeListener: typeof import('../../node_modules/h3')['defineNodeListener'] | ||
const defineNodeMiddleware: typeof import('../../node_modules/h3')['defineNodeMiddleware'] | ||
const defineRenderHandler: typeof import('../../../../../../nitro/dist/runtime/index')['defineRenderHandler'] | ||
const defineRequestMiddleware: typeof import('../../node_modules/h3')['defineRequestMiddleware'] | ||
const defineResponseMiddleware: typeof import('../../node_modules/h3')['defineResponseMiddleware'] | ||
const defineRouteMeta: typeof import('../../../../../../nitro/dist/runtime/index')['defineRouteMeta'] | ||
const defineTask: typeof import('../../../../../../nitro/dist/runtime/index')['defineTask'] | ||
const defineWebSocket: typeof import('../../node_modules/h3')['defineWebSocket'] | ||
const defineWebSocketHandler: typeof import('../../node_modules/h3')['defineWebSocketHandler'] | ||
const deleteCookie: typeof import('../../node_modules/h3')['deleteCookie'] | ||
const dynamicEventHandler: typeof import('../../node_modules/h3')['dynamicEventHandler'] | ||
const eventHandler: typeof import('../../node_modules/h3')['eventHandler'] | ||
const fetchWithEvent: typeof import('../../node_modules/h3')['fetchWithEvent'] | ||
const fromNodeMiddleware: typeof import('../../node_modules/h3')['fromNodeMiddleware'] | ||
const fromPlainHandler: typeof import('../../node_modules/h3')['fromPlainHandler'] | ||
const fromWebHandler: typeof import('../../node_modules/h3')['fromWebHandler'] | ||
const getCookie: typeof import('../../node_modules/h3')['getCookie'] | ||
const getHeader: typeof import('../../node_modules/h3')['getHeader'] | ||
const getHeaders: typeof import('../../node_modules/h3')['getHeaders'] | ||
const getMethod: typeof import('../../node_modules/h3')['getMethod'] | ||
const getProxyRequestHeaders: typeof import('../../node_modules/h3')['getProxyRequestHeaders'] | ||
const getQuery: typeof import('../../node_modules/h3')['getQuery'] | ||
const getRequestFingerprint: typeof import('../../node_modules/h3')['getRequestFingerprint'] | ||
const getRequestHeader: typeof import('../../node_modules/h3')['getRequestHeader'] | ||
const getRequestHeaders: typeof import('../../node_modules/h3')['getRequestHeaders'] | ||
const getRequestHost: typeof import('../../node_modules/h3')['getRequestHost'] | ||
const getRequestIP: typeof import('../../node_modules/h3')['getRequestIP'] | ||
const getRequestPath: typeof import('../../node_modules/h3')['getRequestPath'] | ||
const getRequestProtocol: typeof import('../../node_modules/h3')['getRequestProtocol'] | ||
const getRequestURL: typeof import('../../node_modules/h3')['getRequestURL'] | ||
const getRequestWebStream: typeof import('../../node_modules/h3')['getRequestWebStream'] | ||
const getResponseHeader: typeof import('../../node_modules/h3')['getResponseHeader'] | ||
const getResponseHeaders: typeof import('../../node_modules/h3')['getResponseHeaders'] | ||
const getResponseStatus: typeof import('../../node_modules/h3')['getResponseStatus'] | ||
const getResponseStatusText: typeof import('../../node_modules/h3')['getResponseStatusText'] | ||
const getRouteRules: typeof import('../../../../../../nitro/dist/runtime/index')['getRouteRules'] | ||
const getRouterParam: typeof import('../../node_modules/h3')['getRouterParam'] | ||
const getRouterParams: typeof import('../../node_modules/h3')['getRouterParams'] | ||
const getSession: typeof import('../../node_modules/h3')['getSession'] | ||
const getValidatedQuery: typeof import('../../node_modules/h3')['getValidatedQuery'] | ||
const getValidatedRouterParams: typeof import('../../node_modules/h3')['getValidatedRouterParams'] | ||
const handleCacheHeaders: typeof import('../../node_modules/h3')['handleCacheHeaders'] | ||
const handleCors: typeof import('../../node_modules/h3')['handleCors'] | ||
const isCorsOriginAllowed: typeof import('../../node_modules/h3')['isCorsOriginAllowed'] | ||
const isError: typeof import('../../node_modules/h3')['isError'] | ||
const isEvent: typeof import('../../node_modules/h3')['isEvent'] | ||
const isEventHandler: typeof import('../../node_modules/h3')['isEventHandler'] | ||
const isMethod: typeof import('../../node_modules/h3')['isMethod'] | ||
const isPreflightRequest: typeof import('../../node_modules/h3')['isPreflightRequest'] | ||
const isStream: typeof import('../../node_modules/h3')['isStream'] | ||
const isWebResponse: typeof import('../../node_modules/h3')['isWebResponse'] | ||
const lazyEventHandler: typeof import('../../node_modules/h3')['lazyEventHandler'] | ||
const nitroPlugin: typeof import('../../../../../../nitro/dist/runtime/index')['nitroPlugin'] | ||
const parseCookies: typeof import('../../node_modules/h3')['parseCookies'] | ||
const promisifyNodeListener: typeof import('../../node_modules/h3')['promisifyNodeListener'] | ||
const proxyRequest: typeof import('../../node_modules/h3')['proxyRequest'] | ||
const readBody: typeof import('../../node_modules/h3')['readBody'] | ||
const readFormData: typeof import('../../node_modules/h3')['readFormData'] | ||
const readMultipartFormData: typeof import('../../node_modules/h3')['readMultipartFormData'] | ||
const readRawBody: typeof import('../../node_modules/h3')['readRawBody'] | ||
const readValidatedBody: typeof import('../../node_modules/h3')['readValidatedBody'] | ||
const removeResponseHeader: typeof import('../../node_modules/h3')['removeResponseHeader'] | ||
const runTask: typeof import('../../../../../../nitro/dist/runtime/index')['runTask'] | ||
const sanitizeStatusCode: typeof import('../../node_modules/h3')['sanitizeStatusCode'] | ||
const sanitizeStatusMessage: typeof import('../../node_modules/h3')['sanitizeStatusMessage'] | ||
const sealSession: typeof import('../../node_modules/h3')['sealSession'] | ||
const send: typeof import('../../node_modules/h3')['send'] | ||
const sendError: typeof import('../../node_modules/h3')['sendError'] | ||
const sendIterable: typeof import('../../node_modules/h3')['sendIterable'] | ||
const sendNoContent: typeof import('../../node_modules/h3')['sendNoContent'] | ||
const sendProxy: typeof import('../../node_modules/h3')['sendProxy'] | ||
const sendRedirect: typeof import('../../node_modules/h3')['sendRedirect'] | ||
const sendStream: typeof import('../../node_modules/h3')['sendStream'] | ||
const sendWebResponse: typeof import('../../node_modules/h3')['sendWebResponse'] | ||
const serveStatic: typeof import('../../node_modules/h3')['serveStatic'] | ||
const setCookie: typeof import('../../node_modules/h3')['setCookie'] | ||
const setHeader: typeof import('../../node_modules/h3')['setHeader'] | ||
const setHeaders: typeof import('../../node_modules/h3')['setHeaders'] | ||
const setResponseHeader: typeof import('../../node_modules/h3')['setResponseHeader'] | ||
const setResponseHeaders: typeof import('../../node_modules/h3')['setResponseHeaders'] | ||
const setResponseStatus: typeof import('../../node_modules/h3')['setResponseStatus'] | ||
const splitCookiesString: typeof import('../../node_modules/h3')['splitCookiesString'] | ||
const toEventHandler: typeof import('../../node_modules/h3')['toEventHandler'] | ||
const toNodeListener: typeof import('../../node_modules/h3')['toNodeListener'] | ||
const toPlainHandler: typeof import('../../node_modules/h3')['toPlainHandler'] | ||
const toWebHandler: typeof import('../../node_modules/h3')['toWebHandler'] | ||
const toWebRequest: typeof import('../../node_modules/h3')['toWebRequest'] | ||
const unsealSession: typeof import('../../node_modules/h3')['unsealSession'] | ||
const updateSession: typeof import('../../node_modules/h3')['updateSession'] | ||
const useAppConfig: typeof import('../../../../../../nitro/dist/runtime/index')['useAppConfig'] | ||
const useBase: typeof import('../../node_modules/h3')['useBase'] | ||
const useEvent: typeof import('../../../../../../nitro/dist/runtime/index')['useEvent'] | ||
const useNitroApp: typeof import('../../../../../../nitro/dist/runtime/index')['useNitroApp'] | ||
const useRuntimeConfig: typeof import('../../../../../../nitro/dist/runtime/index')['useRuntimeConfig'] | ||
const useSession: typeof import('../../node_modules/h3')['useSession'] | ||
const useStorage: typeof import('../../../../../../nitro/dist/runtime/index')['useStorage'] | ||
const writeEarlyHints: typeof import('../../node_modules/h3')['writeEarlyHints'] | ||
} | ||
export { defineCachedFunction, defineCachedEventHandler, cachedFunction, cachedEventHandler, useRuntimeConfig, useStorage, useNitroApp, defineNitroPlugin, nitroPlugin, defineRenderHandler, defineRouteMeta, getRouteRules, useAppConfig, useEvent, defineTask, runTask, defineNitroErrorHandler } from 'nitropack/runtime'; | ||
export { appendCorsHeaders, appendCorsPreflightHeaders, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearResponseHeaders, clearSession, createApp, createAppEventHandler, createError, createEvent, createEventStream, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, defineRequestMiddleware, defineResponseMiddleware, defineWebSocket, defineWebSocketHandler, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, fromPlainHandler, fromWebHandler, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestFingerprint, getRequestHeader, getRequestHeaders, getRequestHost, getRequestIP, getRequestPath, getRequestProtocol, getRequestURL, getRequestWebStream, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, getValidatedQuery, getValidatedRouterParams, handleCacheHeaders, handleCors, isCorsOriginAllowed, isError, isEvent, isEventHandler, isMethod, isPreflightRequest, isStream, isWebResponse, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readFormData, readMultipartFormData, readRawBody, readValidatedBody, removeResponseHeader, sanitizeStatusCode, sanitizeStatusMessage, sealSession, send, sendError, sendIterable, sendNoContent, sendProxy, sendRedirect, sendStream, sendWebResponse, serveStatic, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, splitCookiesString, toEventHandler, toNodeListener, toPlainHandler, toWebHandler, toWebRequest, unsealSession, updateSession, useBase, useSession, writeEarlyHints } from 'h3'; |
11 changes: 11 additions & 0 deletions
11
examples/internal/aws-nitro/.nitro/types/nitro-routes.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Generated by nitro | ||
import type { Serialize, Simplify } from "nitropack/types"; | ||
declare module "nitropack/types" { | ||
type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T | ||
interface InternalApi { | ||
'/': { | ||
'default': Simplify<Serialize<Awaited<ReturnType<typeof import('../../server/routes/index').default>>>> | ||
} | ||
} | ||
} | ||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// <reference path="./nitro-routes.d.ts" /> | ||
/// <reference path="./nitro-config.d.ts" /> | ||
/// <reference path="./nitro-imports.d.ts" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"compilerOptions": { | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": false, | ||
"noEmit": true, | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"allowJs": true, | ||
"resolveJsonModule": true, | ||
"jsx": "preserve", | ||
"allowSyntheticDefaultImports": true, | ||
"jsxFactory": "h", | ||
"jsxFragmentFactory": "Fragment", | ||
"paths": { | ||
"#imports": [ | ||
"./nitro-imports" | ||
], | ||
"~/*": [ | ||
"../../server/*" | ||
], | ||
"@/*": [ | ||
"../../server/*" | ||
], | ||
"~~/*": [ | ||
"../../*" | ||
], | ||
"@@/*": [ | ||
"../../*" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
"./nitro.d.ts", | ||
"../../**/*", | ||
"../../server/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"date": "2024-10-11T19:58:57.867Z", | ||
"preset": "aws-lambda", | ||
"framework": { | ||
"name": "nitro", | ||
"version": "" | ||
}, | ||
"versions": { | ||
"nitro": "2.9.6" | ||
}, | ||
"commands": {} | ||
} |
116 changes: 116 additions & 0 deletions
116
examples/internal/aws-nitro/.output/server/chunks/routes/index.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
var __defProp$2 = Object.defineProperty; | ||
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField$2 = (obj, key, value) => { | ||
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
class H3Error extends Error { | ||
constructor(message, opts = {}) { | ||
super(message, opts); | ||
__publicField$2(this, "statusCode", 500); | ||
__publicField$2(this, "fatal", false); | ||
__publicField$2(this, "unhandled", false); | ||
__publicField$2(this, "statusMessage"); | ||
__publicField$2(this, "data"); | ||
__publicField$2(this, "cause"); | ||
if (opts.cause && !this.cause) { | ||
this.cause = opts.cause; | ||
} | ||
} | ||
toJSON() { | ||
const obj = { | ||
message: this.message, | ||
statusCode: sanitizeStatusCode(this.statusCode, 500) | ||
}; | ||
if (this.statusMessage) { | ||
obj.statusMessage = sanitizeStatusMessage(this.statusMessage); | ||
} | ||
if (this.data !== void 0) { | ||
obj.data = this.data; | ||
} | ||
return obj; | ||
} | ||
} | ||
__publicField$2(H3Error, "__h3_error__", true); | ||
|
||
const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g; | ||
function sanitizeStatusMessage(statusMessage = "") { | ||
return statusMessage.replace(DISALLOWED_STATUS_CHARS, ""); | ||
} | ||
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) { | ||
if (!statusCode) { | ||
return defaultStatusCode; | ||
} | ||
if (typeof statusCode === "string") { | ||
statusCode = Number.parseInt(statusCode, 10); | ||
} | ||
if (statusCode < 100 || statusCode > 999) { | ||
return defaultStatusCode; | ||
} | ||
return statusCode; | ||
} | ||
|
||
typeof setImmediate === "undefined" ? (fn) => fn() : setImmediate; | ||
|
||
function defineEventHandler(handler) { | ||
if (typeof handler === "function") { | ||
handler.__is_handler__ = true; | ||
return handler; | ||
} | ||
const _hooks = { | ||
onRequest: _normalizeArray(handler.onRequest), | ||
onBeforeResponse: _normalizeArray(handler.onBeforeResponse) | ||
}; | ||
const _handler = (event) => { | ||
return _callHandler(event, handler.handler, _hooks); | ||
}; | ||
_handler.__is_handler__ = true; | ||
_handler.__resolve__ = handler.handler.__resolve__; | ||
_handler.__websocket__ = handler.websocket; | ||
return _handler; | ||
} | ||
function _normalizeArray(input) { | ||
return input ? Array.isArray(input) ? input : [input] : void 0; | ||
} | ||
async function _callHandler(event, handler, hooks) { | ||
if (hooks.onRequest) { | ||
for (const hook of hooks.onRequest) { | ||
await hook(event); | ||
if (event.handled) { | ||
return; | ||
} | ||
} | ||
} | ||
const body = await handler(event); | ||
const response = { body }; | ||
if (hooks.onBeforeResponse) { | ||
for (const hook of hooks.onBeforeResponse) { | ||
await hook(event, response); | ||
} | ||
} | ||
return response.body; | ||
} | ||
const eventHandler = defineEventHandler; | ||
|
||
const index = eventHandler((event) => { | ||
const stream = new ReadableStream({ | ||
async start(controller) { | ||
for (let i = 1; i <= 10; i++) { | ||
const chunk = `Number: ${i} | ||
`; | ||
controller.enqueue(chunk); | ||
await new Promise((resolve) => setTimeout(resolve, 1e3)); | ||
} | ||
controller.close(); | ||
} | ||
}); | ||
return new Response(stream, { | ||
headers: { | ||
"Content-Type": "text/plain", | ||
"Transfer-Encoding": "chunked" | ||
} | ||
}); | ||
}); | ||
|
||
export { index as default }; | ||
//# sourceMappingURL=index.mjs.map |
1 change: 1 addition & 0 deletions
1
examples/internal/aws-nitro/.output/server/chunks/routes/index.mjs.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.