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

@expo/server

Package Overview
Dependencies
Maintainers
0
Versions
56
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.3 to 0.4.4-canary-20240625-2333e70

33

build/index.js

@@ -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,3 +58,3 @@ /**

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

@@ -73,3 +73,3 @@ init.duplex = 'half';

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

@@ -76,0 +76,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,3 +42,3 @@ /**

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

@@ -74,3 +74,3 @@ init.duplex = 'half';

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

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

@@ -62,3 +62,3 @@ "use strict";

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) {

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

{
"name": "@expo/server",
"version": "0.4.3",
"version": "0.4.4-canary-20240625-2333e70",
"description": "Server API for Expo Router projects",

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

},
"gitHead": "2893e9cba95261919532de0675468c601b87b017"
"gitHead": "2333e70a4bd3ac91895402dac77ae8ae0ed25995"
}

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