New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@callstack/repack-dev-server

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@callstack/repack-dev-server - npm Package Compare versions

Comparing version 4.4.0-canary-20240909082848 to 5.0.0-canary-20240912110701

# @callstack/repack-dev-server
## 4.4.0-canary-20240909082848
## 5.0.0-canary-20240912110701

@@ -5,0 +5,0 @@ ## 4.3.2

@@ -28,2 +28,3 @@ import { Writable } from 'stream';

const instance = Fastify({
disableRequestLogging: !config.options.logRequests,
logger: {

@@ -44,3 +45,3 @@ level: 'trace',

});
delegate = config.delegate({
delegate = await config.delegate({
log: instance.log,

@@ -106,4 +107,5 @@ notifyBuildStart: platform => {

instance.use('/open-url', openURLMiddleware);
// @ts-ignore
instance.use('/open-stack-frame', openStackFrameInEditorMiddleware);
instance.use('/open-stack-frame', openStackFrameInEditorMiddleware({
watchFolders: [config.options.rootDir]
}));
await instance.register(symbolicatePlugin, {

@@ -110,0 +112,0 @@ delegate

@@ -19,7 +19,7 @@ import fastifyPlugin from 'fastify-plugin';

handler: async (request, reply) => {
const filename = request.params['*'];
let file = request.params['*'];
let {
platform
} = request.query;
if (!filename) {
if (!file) {
// This technically should never happen - this route should not be called if file is missing.

@@ -33,2 +33,11 @@ request.log.error(`File was not provided`);

platform = delegate.compiler.inferPlatform?.(request.url) ?? platform;
if (!platform) {
request.log.error('Cannot detect platform');
return reply.badRequest('Cannot detect platform');
}
// If platform happens to be in front of an asset remove it.
if (file.startsWith(`${platform}/`)) {
file = file.replace(`${platform}/`, '');
}
const multipart = reply.asMultipart();

@@ -47,4 +56,4 @@ const sendProgress = ({

try {
const asset = await delegate.compiler.getAsset(filename, platform, sendProgress);
const mimeType = delegate.compiler.getMimeType(filename, platform, asset);
const asset = await delegate.compiler.getAsset(file, platform, sendProgress);
const mimeType = delegate.compiler.getMimeType(file, platform, asset);
if (multipart) {

@@ -51,0 +60,0 @@ const buffer = Buffer.isBuffer(asset) ? asset : Buffer.from(asset);

@@ -15,3 +15,3 @@ import type { SendProgress } from '../../types';

*/
getAsset: (filename: string, platform: string | undefined, sendProgress?: SendProgress) => Promise<string | Buffer>;
getAsset: (filename: string, platform: string, sendProgress?: SendProgress) => Promise<string | Buffer>;
/**

@@ -24,3 +24,3 @@ * Detect MIME type of the asset from `filename`, `platform` or `data` (or from combination of either).

*/
getMimeType: (filename: string, platform: string | undefined, data: string | Buffer) => string;
getMimeType: (filename: string, platform: string, data: string | Buffer) => string;
/**

@@ -27,0 +27,0 @@ * Detect the platform from the URI - either from filename, query params or both.

@@ -22,3 +22,3 @@ import { URL } from 'url';

if (!frame.file) {
return;
continue;
}

@@ -150,3 +150,4 @@ const {

line: frame.lineNumber,
column: frame.column
column: frame.column,
bias: SourceMapConsumer.LEAST_UPPER_BOUND
});

@@ -153,0 +154,0 @@

@@ -46,3 +46,3 @@ import { WebSocketServer } from "../WebSocketServer.js";

this.clients.set(clientId, socket);
this.fastify.log.info({
this.fastify.log.debug({
msg: 'API client connected',

@@ -53,3 +53,3 @@ clientId

const onClose = () => {
this.fastify.log.info({
this.fastify.log.debug({
msg: 'API client disconnected',

@@ -56,0 +56,0 @@ clientId

@@ -44,3 +44,3 @@ import { WebSocketServer } from "../WebSocketServer.js";

});
} else {
} else if (body.level === 'info' || body.level === 'log') {
this.fastify.log.info({

@@ -50,2 +50,8 @@ issuer: 'Console',

});
} else {
// body.level === 'debug' || body.level === 'trace'
this.fastify.log.debug({
issuer: 'Console',
msg: body.data
});
}

@@ -69,9 +75,8 @@ break;

this.clients.set(clientId, socket);
this.fastify.log.info({
this.fastify.log.debug({
msg: 'React Native client connected',
clientId
});
this.clients.set(clientId, socket);
const onClose = () => {
this.fastify.log.info({
this.fastify.log.debug({
msg: 'React Native client disconnected',

@@ -78,0 +83,0 @@ clientId

@@ -61,3 +61,3 @@ import { URL } from 'url';

if (!platform) {
this.fastify.log.info({
this.fastify.log.debug({
msg: 'HMR connection disconnected - missing platform'

@@ -74,3 +74,3 @@ });

this.clients.set(client, socket);
this.fastify.log.info({
this.fastify.log.debug({
msg: 'HMR client connected',

@@ -80,3 +80,3 @@ ...client

const onClose = () => {
this.fastify.log.info({
this.fastify.log.debug({
msg: 'HMR client disconnected',

@@ -83,0 +83,0 @@ ...client

@@ -86,3 +86,3 @@ import { URL } from 'url';

});
} catch (e) {
} catch {
this.fastify.log.error({

@@ -89,0 +89,0 @@ msg: 'Failed to parse the message as JSON',

@@ -41,2 +41,4 @@ import type { FastifyBaseLogger } from 'fastify';

endpoints?: Record<string, WebSocketServer>;
/** Whether to enable logging requests. */
logRequests?: boolean;
}

@@ -43,0 +45,0 @@ /**

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "4.4.0-canary-20240909082848",
"version": "5.0.0-canary-20240912110701",
"type": "module",

@@ -78,3 +78,3 @@ "main": "./dist/index.js",

"build": "pnpm run \"/^build:.*/\"",
"lint": "eslint --ext \".js,.ts\" src",
"lint": "eslint --ext .ts src",
"typecheck": "tsc --noEmit",

@@ -81,0 +81,0 @@ "archive": "pnpm build && pnpm pack"

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

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