@callstack/repack-dev-server
Advanced tools
Comparing version 4.4.0-canary-20240909082848 to 4.4.0
# @callstack/repack-dev-server | ||
## 4.4.0-canary-20240909082848 | ||
## 4.4.0 | ||
## 4.3.3 | ||
## 4.3.2 | ||
@@ -6,0 +8,0 @@ |
@@ -104,3 +104,2 @@ import { Writable } from 'stream'; | ||
instance.use('/open-url', openURLMiddleware); | ||
// @ts-ignore | ||
instance.use('/open-stack-frame', openStackFrameInEditorMiddleware); | ||
@@ -107,0 +106,0 @@ await instance.register(symbolicatePlugin, { |
@@ -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. |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "4.4.0-canary-20240909082848", | ||
"version": "4.4.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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
238712
2572
0