@web/dev-server-rollup
Advanced tools
Comparing version 0.3.4 to 0.3.5
# @web/dev-server-rollup | ||
## 0.3.5 | ||
### Patch Changes | ||
- 6222d0b4: fix(dev-server): fixes #1536, correctly handle outside-root paths | ||
## 0.3.4 | ||
@@ -4,0 +10,0 @@ |
@@ -20,2 +20,3 @@ "use strict"; | ||
const WDS_FILE_PREFIX = '/__web-dev-server__'; | ||
const OUTSIDE_ROOT_REGEXP = /\/__wds-outside-root__\/([0-9]+)\/(.*)/; | ||
/** | ||
@@ -135,2 +136,8 @@ * Wraps rollup error in a custom error for web dev server. | ||
const filename = path_1.default.basename(resolvedImportPath.replace(/\0*/g, '').split('?')[0].split('#')[0]); | ||
// if the resolve import path is outside our normal root, fully resolve the file path for rollup | ||
const matches = resolvedImportPath.match(OUTSIDE_ROOT_REGEXP); | ||
if (matches) { | ||
const upDirs = new Array(parseInt(matches[1], 10) + 1).join(`..${path_1.default.sep}`); | ||
resolvedImportPath = `\0${path_1.default.resolve(`${upDirs}${matches[2]}`)}`; | ||
} | ||
const urlParam = encodeURIComponent(resolvedImportPath); | ||
@@ -137,0 +144,0 @@ return `${VIRTUAL_FILE_PREFIX}/${filename}?${NULL_BYTE_PARAM}=${urlParam}`; |
{ | ||
"name": "@web/dev-server-rollup", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -12,3 +12,3 @@ import path from 'path'; | ||
export function createRollupPluginContextAdapter< | ||
T extends PluginContext | MinimalPluginContext | TransformPluginContext | ||
T extends PluginContext | MinimalPluginContext | TransformPluginContext, | ||
>( | ||
@@ -15,0 +15,0 @@ pluginContext: T, |
@@ -31,2 +31,3 @@ /* eslint-disable no-control-regex */ | ||
const WDS_FILE_PREFIX = '/__web-dev-server__'; | ||
const OUTSIDE_ROOT_REGEXP = /\/__wds-outside-root__\/([0-9]+)\/(.*)/; | ||
@@ -196,2 +197,8 @@ /** | ||
); | ||
// if the resolve import path is outside our normal root, fully resolve the file path for rollup | ||
const matches = resolvedImportPath.match(OUTSIDE_ROOT_REGEXP); | ||
if (matches) { | ||
const upDirs = new Array(parseInt(matches[1], 10) + 1).join(`..${path.sep}`); | ||
resolvedImportPath = `\0${path.resolve(`${upDirs}${matches[2]}`)}`; | ||
} | ||
const urlParam = encodeURIComponent(resolvedImportPath); | ||
@@ -198,0 +205,0 @@ return `${VIRTUAL_FILE_PREFIX}/${filename}?${NULL_BYTE_PARAM}=${urlParam}`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82140
1239