Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@expo/server

Package Overview
Dependencies
Maintainers
25
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/server - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5-canary-20240719-83ee47b

3

build/environment.js

@@ -12,3 +12,4 @@ "use strict";

function installGlobals() {
(0, node_1.installGlobals)();
// Use global polyfills from Undici
(0, node_1.installGlobals)({ nativeFetch: true });
global.ExpoRequest = Request;

@@ -15,0 +16,0 @@ global.ExpoResponse = Response;

@@ -8,9 +8,10 @@ "use strict";

require("@expo/server/install");
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const url_1 = require("url");
const debug = require('debug')('expo:server');
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
const debug = process.env.NODE_ENV === 'development'
? require('debug')('expo:server')
: () => { };
function getProcessedManifest(path) {
// TODO: JSON Schema for validation
const routesManifest = JSON.parse(fs_1.default.readFileSync(path, 'utf-8'));
const routesManifest = JSON.parse(node_fs_1.default.readFileSync(path, 'utf-8'));
const parsed = {

@@ -40,3 +41,3 @@ ...routesManifest,

function getRoutesManifest(distFolder) {
return getProcessedManifest(path_1.default.join(distFolder, '_expo/routes.json'));
return getProcessedManifest(node_path_1.default.join(distFolder, '_expo/routes.json'));
}

@@ -47,5 +48,5 @@ exports.getRoutesManifest = getRoutesManifest;

// 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 fs_1.default.readFileSync(filePath, 'utf-8');
const filePath = node_path_1.default.join(distFolder, route.page + '.html');
if (node_fs_1.default.existsSync(filePath)) {
return node_fs_1.default.readFileSync(filePath, 'utf-8');
}

@@ -55,13 +56,13 @@ // Serve a static file by route name with hoisted index

const hoistedFilePath = route.page.match(/\/index$/)
? path_1.default.join(distFolder, route.page.replace(/\/index$/, '') + '.html')
? node_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');
if (hoistedFilePath && node_fs_1.default.existsSync(hoistedFilePath)) {
return node_fs_1.default.readFileSync(hoistedFilePath, 'utf-8');
}
return null;
}, getApiRoute = async (route) => {
const filePath = path_1.default.join(distFolder, route.file);
const filePath = node_path_1.default.join(distFolder, route.file);
debug(`Handling API route: ${route.page}: ${filePath}`);
// TODO: What's the standard behavior for malformed projects?
if (!fs_1.default.existsSync(filePath)) {
if (!node_fs_1.default.existsSync(filePath)) {
return null;

@@ -79,3 +80,3 @@ }

const params = {};
const url = new url_1.URL(request.url);
const url = new URL(request.url);
const match = config.namedRegex.exec(url.pathname);

@@ -109,3 +110,3 @@ if (match?.groups) {

}
const url = new url_1.URL(request.url, 'http://expo.dev');
const url = new URL(request.url, 'http://expo.dev');
const sanitizedPathname = url.pathname;

@@ -112,0 +113,0 @@ debug('Request', sanitizedPathname);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.respond = exports.convertRequest = exports.convertHeaders = exports.createRequestHandler = void 0;
const node_1 = require("@remix-run/node");
const stream_1 = require("@remix-run/node/dist/stream");
const __1 = require("..");

@@ -58,4 +58,3 @@ /**

if (req.method !== 'GET' && req.method !== 'HEAD') {
init.body = (0, node_1.createReadableStreamFromReadable)(req);
// @ts-expect-error
init.body = (0, stream_1.createReadableStreamFromReadable)(req);
init.duplex = 'half';

@@ -73,3 +72,3 @@ }

if (expoRes.body) {
await (0, node_1.writeReadableStreamToWritable)(expoRes.body, res);
await (0, stream_1.writeReadableStreamToWritable)(expoRes.body, res);
}

@@ -76,0 +75,0 @@ else {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.respond = exports.convertHeaders = exports.convertRequest = exports.createRequestHandler = void 0;
const node_1 = require("@remix-run/node");
const stream_1 = require("@remix-run/node/dist/stream");
const __1 = require("..");

@@ -42,4 +42,3 @@ /**

if (req.method !== 'GET' && req.method !== 'HEAD') {
init.body = (0, node_1.createReadableStreamFromReadable)(req);
// @ts-expect-error
init.body = (0, stream_1.createReadableStreamFromReadable)(req);
init.duplex = 'half';

@@ -74,3 +73,3 @@ }

if (expoRes.body) {
await (0, node_1.writeReadableStreamToWritable)(expoRes.body, res);
await (0, stream_1.writeReadableStreamToWritable)(expoRes.body, res);
}

@@ -77,0 +76,0 @@ else {

@@ -99,3 +99,2 @@ "use strict";

: event.body;
// @ts-expect-error
init.duplex = 'half';

@@ -102,0 +101,0 @@ }

@@ -54,3 +54,2 @@ "use strict";

init.body = (0, node_1.createReadableStreamFromReadable)(req);
// @ts-expect-error
init.duplex = 'half';

@@ -63,3 +62,3 @@ }

res.statusMessage = expoRes.statusText;
res.writeHead(expoRes.status, expoRes.statusText, [...expoRes.headers.entries()]);
res.writeHead(expoRes.status, expoRes.statusText, [...expoRes.headers.entries()].flat());
if (expoRes.body) {

@@ -66,0 +65,0 @@ await (0, node_1.writeReadableStreamToWritable)(expoRes.body, res);

{
"name": "@expo/server",
"version": "0.4.4",
"version": "0.4.5-canary-20240719-83ee47b",
"description": "Server API for Expo Router projects",

@@ -33,3 +33,3 @@ "main": "build/index.js",

"dependencies": {
"@remix-run/node": "^2.7.2",
"@remix-run/node": "^2.10.0",
"abort-controller": "^3.0.0",

@@ -46,3 +46,3 @@ "debug": "^4.3.4",

},
"gitHead": "f83423bebc947ad7e328daaa56b2e327912ae580"
"gitHead": "83ee47b5c89c7f1b1a5101189580eaf3555f5962"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc