@expo/server
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -19,3 +19,3 @@ declare const Response: { | ||
export declare const ExpoRequest: { | ||
new (input: RequestInfo | URL, init?: RequestInit): Request; | ||
new (input: URL | RequestInfo, init?: RequestInit | undefined): Request; | ||
prototype: Request; | ||
@@ -25,3 +25,3 @@ }; | ||
export declare const ExpoResponse: { | ||
new (input: RequestInfo | URL, init?: RequestInit): Request; | ||
new (input: URL | RequestInfo, init?: RequestInit | undefined): Request; | ||
prototype: Request; | ||
@@ -28,0 +28,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ExpoResponse = exports.ExpoRequest = void 0; | ||
exports.installGlobals = installGlobals; | ||
exports.installGlobals = exports.ExpoResponse = exports.ExpoRequest = void 0; | ||
/* eslint-disable no-var */ | ||
@@ -45,2 +44,3 @@ const node_1 = require("@remix-run/node"); | ||
} | ||
exports.installGlobals = installGlobals; | ||
//# sourceMappingURL=environment.js.map |
@@ -6,4 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRoutesManifest = getRoutesManifest; | ||
exports.createRequestHandler = createRequestHandler; | ||
exports.createRequestHandler = exports.getRoutesManifest = void 0; | ||
require("@expo/server/install"); | ||
@@ -43,10 +42,19 @@ const fs_1 = __importDefault(require("fs")); | ||
} | ||
exports.getRoutesManifest = getRoutesManifest; | ||
// TODO: Reuse this for dev as well | ||
function createRequestHandler(distFolder, { getRoutesManifest: getInternalRoutesManifest, getHtml = async (_request, route) => { | ||
// serve a static file | ||
// Serve a static file by exact route name | ||
const filePath = path_1.default.join(distFolder, route.page + '.html'); | ||
if (!fs_1.default.existsSync(filePath)) { | ||
return null; | ||
if (fs_1.default.existsSync(filePath)) { | ||
return fs_1.default.readFileSync(filePath, 'utf-8'); | ||
} | ||
return fs_1.default.readFileSync(filePath, 'utf-8'); | ||
// Serve a static file by route name with hoisted index | ||
// See: https://github.com/expo/expo/pull/27935 | ||
const hoistedFilePath = route.page.match(/\/index$/) | ||
? path_1.default.join(distFolder, route.page.replace(/\/index$/, '') + '.html') | ||
: null; | ||
if (hoistedFilePath && fs_1.default.existsSync(hoistedFilePath)) { | ||
return fs_1.default.readFileSync(hoistedFilePath, 'utf-8'); | ||
} | ||
return null; | ||
}, getApiRoute = async (route) => { | ||
@@ -205,2 +213,3 @@ const filePath = path_1.default.join(distFolder, route.file); | ||
} | ||
exports.createRequestHandler = createRequestHandler; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRequestHandler = createRequestHandler; | ||
exports.convertHeaders = convertHeaders; | ||
exports.convertRequest = convertRequest; | ||
exports.respond = respond; | ||
exports.respond = exports.convertRequest = exports.convertHeaders = exports.createRequestHandler = void 0; | ||
const node_1 = require("@remix-run/node"); | ||
@@ -30,2 +27,3 @@ const __1 = require(".."); | ||
} | ||
exports.createRequestHandler = createRequestHandler; | ||
function convertHeaders(requestHeaders) { | ||
@@ -47,2 +45,3 @@ const headers = new Headers(); | ||
} | ||
exports.convertHeaders = convertHeaders; | ||
function convertRequest(req, res) { | ||
@@ -67,2 +66,3 @@ const url = new URL(`${req.protocol}://${req.get('host')}${req.url}`); | ||
} | ||
exports.convertRequest = convertRequest; | ||
async function respond(res, expoRes) { | ||
@@ -81,2 +81,3 @@ res.statusMessage = expoRes.statusText; | ||
} | ||
exports.respond = respond; | ||
//# sourceMappingURL=express.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import * as http from 'http'; | ||
@@ -2,0 +3,0 @@ import { createRequestHandler as createExpoHandler } from '..'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRequestHandler = createRequestHandler; | ||
exports.convertRequest = convertRequest; | ||
exports.convertHeaders = convertHeaders; | ||
exports.respond = respond; | ||
exports.respond = exports.convertHeaders = exports.convertRequest = exports.createRequestHandler = void 0; | ||
const node_1 = require("@remix-run/node"); | ||
@@ -30,2 +27,3 @@ const __1 = require(".."); | ||
} | ||
exports.createRequestHandler = createRequestHandler; | ||
// Convert an http request to an expo request | ||
@@ -51,2 +49,3 @@ function convertRequest(req, res) { | ||
} | ||
exports.convertRequest = convertRequest; | ||
function convertHeaders(requestHeaders) { | ||
@@ -68,2 +67,3 @@ const headers = new Headers(); | ||
} | ||
exports.convertHeaders = convertHeaders; | ||
async function respond(res, expoRes) { | ||
@@ -82,2 +82,3 @@ res.statusMessage = expoRes.statusText; | ||
} | ||
exports.respond = respond; | ||
//# sourceMappingURL=http.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRequestHandler = createRequestHandler; | ||
exports.respond = respond; | ||
exports.createHeaders = createHeaders; | ||
exports.convertRequest = convertRequest; | ||
exports.isBinaryType = isBinaryType; | ||
exports.isBinaryType = exports.convertRequest = exports.createHeaders = exports.respond = exports.createRequestHandler = void 0; | ||
const node_1 = require("@remix-run/node"); | ||
@@ -18,2 +14,3 @@ const abort_controller_1 = require("abort-controller"); | ||
} | ||
exports.createRequestHandler = createRequestHandler; | ||
async function respond(res) { | ||
@@ -42,2 +39,3 @@ const contentType = res.headers.get('Content-Type'); | ||
} | ||
exports.respond = respond; | ||
function createHeaders(requestHeaders) { | ||
@@ -54,2 +52,3 @@ const headers = new Headers(); | ||
} | ||
exports.createHeaders = createHeaders; | ||
// `netlify dev` doesn't return the full url in the event.rawUrl, so we need to create it ourselves | ||
@@ -108,2 +107,3 @@ function getRawPath(event) { | ||
} | ||
exports.convertRequest = convertRequest; | ||
/** | ||
@@ -178,2 +178,3 @@ * Common binary MIME types | ||
} | ||
exports.isBinaryType = isBinaryType; | ||
//# sourceMappingURL=netlify.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import * as http from 'http'; | ||
@@ -2,0 +3,0 @@ export type RequestHandler = (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRequestHandler = createRequestHandler; | ||
exports.convertHeaders = convertHeaders; | ||
exports.convertRequest = convertRequest; | ||
exports.respond = respond; | ||
exports.respond = exports.convertRequest = exports.convertHeaders = exports.createRequestHandler = void 0; | ||
// NOTE: VercelRequest/VercelResponse wrap http primitives in Node | ||
@@ -22,2 +19,3 @@ // plus some helper inputs and outputs, which we don't need to define | ||
} | ||
exports.createRequestHandler = createRequestHandler; | ||
function convertHeaders(requestHeaders) { | ||
@@ -39,2 +37,3 @@ const headers = new Headers(); | ||
} | ||
exports.convertHeaders = convertHeaders; | ||
function convertRequest(req, res) { | ||
@@ -62,2 +61,3 @@ const host = req.headers['x-forwarded-host'] || req.headers['host']; | ||
} | ||
exports.convertRequest = convertRequest; | ||
async function respond(res, expoRes) { | ||
@@ -73,2 +73,3 @@ res.statusMessage = expoRes.statusText; | ||
} | ||
exports.respond = respond; | ||
//# sourceMappingURL=vercel.js.map |
{ | ||
"name": "@expo/server", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Server API for Expo Router projects", | ||
@@ -45,3 +45,3 @@ "main": "build/index.js", | ||
}, | ||
"gitHead": "4165b8d72e1b9a1889c2767534cc619e21468110" | ||
"gitHead": "0897aeadb926491a457bcd67d83360956994ee82" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48225
786