@callstack/repack-dev-server
Advanced tools
Comparing version 4.0.0 to 5.0.0-next.0
# @callstack/repack-dev-server | ||
## 5.0.0-next.0 | ||
## 4.0.0 | ||
@@ -4,0 +6,0 @@ |
@@ -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,3 +107,5 @@ notifyBuildStart: platform => { | ||
instance.use('/open-url', openURLMiddleware); | ||
instance.use('/open-stack-frame', openStackFrameInEditorMiddleware); | ||
instance.use('/open-stack-frame', openStackFrameInEditorMiddleware({ | ||
watchFolders: [config.options.rootDir] | ||
})); | ||
await instance.register(symbolicatePlugin, { | ||
@@ -109,0 +112,0 @@ delegate |
@@ -42,15 +42,4 @@ import fastifyPlugin from 'fastify-plugin'; | ||
const multipart = reply.asMultipart(); | ||
const sendProgress = ({ | ||
completed, | ||
total | ||
}) => { | ||
multipart?.writeChunk({ | ||
'Content-Type': 'application/json' | ||
}, JSON.stringify({ | ||
done: completed, | ||
total | ||
})); | ||
}; | ||
try { | ||
const asset = await delegate.compiler.getAsset(file, platform, sendProgress); | ||
const asset = await delegate.compiler.getAsset(file, platform); | ||
const mimeType = delegate.compiler.getMimeType(file, platform, asset); | ||
@@ -57,0 +46,0 @@ if (multipart) { |
/// <reference types="node" /> | ||
import type { SendProgress } from '../../types'; | ||
/** | ||
@@ -14,5 +13,4 @@ * Delegate with implementation for compiler-specific functions. | ||
* @param platform Platform of the asset to get. | ||
* @param sendProgress Function to notify the client who requested the asset about compilation progress. | ||
*/ | ||
getAsset: (filename: string, platform: string, sendProgress?: SendProgress) => Promise<string | Buffer>; | ||
getAsset: (filename: string, platform: string) => Promise<string | Buffer>; | ||
/** | ||
@@ -19,0 +17,0 @@ * Detect MIME type of the asset from `filename`, `platform` or `data` (or from combination of either). |
@@ -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 |
@@ -16,3 +16,3 @@ import type { FastifyBaseLogger } from 'fastify'; | ||
/** Function to create a delegate, which implements crucial functionalities. */ | ||
delegate: (context: DelegateContext) => Delegate; | ||
delegate: (context: DelegateContext) => Promise<Delegate>; | ||
} | ||
@@ -42,2 +42,4 @@ interface Experiments { | ||
endpoints?: Record<string, WebSocketServer>; | ||
/** Whether to enable logging requests. */ | ||
logRequests?: boolean; | ||
} | ||
@@ -142,17 +144,3 @@ /** | ||
} | ||
/** Representation of the compilation progress. */ | ||
export interface ProgressData { | ||
/** Number of modules built. */ | ||
completed: number; | ||
/** Total number of modules detect as part of compilation. */ | ||
total: number; | ||
} | ||
/** | ||
* Type representing a function to send the progress. | ||
* | ||
* Used by {@link CompilerDelegate} in `getAsset` function to send the compilation | ||
* progress to the client who requested the asset. | ||
*/ | ||
export type SendProgress = (data: ProgressData) => void; | ||
/** | ||
* Internal types. Do not use. | ||
@@ -159,0 +147,0 @@ * |
export let Server; | ||
/** Representation of the compilation progress. */ | ||
/** | ||
* Type representing a function to send the progress. | ||
* | ||
* Used by {@link CompilerDelegate} in `getAsset` function to send the compilation | ||
* progress to the client who requested the asset. | ||
*/ | ||
/** | ||
* Internal types. Do not use. | ||
@@ -11,0 +4,0 @@ * |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "4.0.0", | ||
"version": "5.0.0-next.0", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "main": "./dist/index.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
237572
2565
1