@web/dev-server-rollup
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -208,4 +208,4 @@ "use strict"; | ||
// of the normalized path within the rootDir folder | ||
const checkRootDir = rootDir.endsWith(path_1.default.sep) ? rootDir : rootDir + path_1.default.sep; | ||
if (!normalizedPath.startsWith(checkRootDir)) { | ||
const normalizedRootDir = rootDir.endsWith(path_1.default.sep) ? rootDir : rootDir + path_1.default.sep; | ||
if (!normalizedPath.startsWith(normalizedRootDir)) { | ||
const relativePath = path_1.default.relative(rootDir, normalizedPath); | ||
@@ -232,4 +232,12 @@ const dirUp = `..${path_1.default.sep}`; | ||
else { | ||
const resolveRelativeTo = path_1.default.dirname(filePath); | ||
const relativeImportFilePath = path_1.default.relative(resolveRelativeTo, resolvedImportPath); | ||
let relativeImportFilePath = ''; | ||
if (context.url.match(OUTSIDE_ROOT_REGEXP)) { | ||
const pathInsideRootDir = `/${normalizedPath.replace(normalizedRootDir, '')}`; | ||
const resolveRelativeTo = path_1.default.dirname(context.url); | ||
relativeImportFilePath = path_1.default.relative(resolveRelativeTo, pathInsideRootDir); | ||
} | ||
else { | ||
const resolveRelativeTo = path_1.default.dirname(filePath); | ||
relativeImportFilePath = path_1.default.relative(resolveRelativeTo, resolvedImportPath); | ||
} | ||
resolvedImportPath = `./${(0, utils_js_1.toBrowserPath)(relativeImportFilePath)}`; | ||
@@ -236,0 +244,0 @@ } |
{ | ||
"name": "@web/dev-server-rollup", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"publishConfig": { | ||
@@ -28,3 +28,3 @@ "access": "public" | ||
"scripts": { | ||
"test": "mocha \"test/node/**/*.test.ts\" --require ts-node/register", | ||
"test:node": "mocha \"test/node/**/*.test.ts\" --require ts-node/register --exit --reporter dot", | ||
"test:watch": "mocha \"test/node/**/*.test.ts\" --require ts-node/register --watch --watch-files src,test" | ||
@@ -67,3 +67,3 @@ }, | ||
"@types/whatwg-url": "^11.0.0", | ||
"@web/test-runner-chrome": "^0.15.0", | ||
"@web/test-runner-chrome": "^0.16.0", | ||
"@web/test-runner-core": "^0.13.0", | ||
@@ -70,0 +70,0 @@ "chai": "^4.2.0", |
@@ -292,5 +292,5 @@ /* eslint-disable no-control-regex */ | ||
// of the normalized path within the rootDir folder | ||
const checkRootDir = rootDir.endsWith(path.sep) ? rootDir : rootDir + path.sep; | ||
const normalizedRootDir = rootDir.endsWith(path.sep) ? rootDir : rootDir + path.sep; | ||
if (!normalizedPath.startsWith(checkRootDir)) { | ||
if (!normalizedPath.startsWith(normalizedRootDir)) { | ||
const relativePath = path.relative(rootDir, normalizedPath); | ||
@@ -321,4 +321,13 @@ const dirUp = `..${path.sep}`; | ||
} else { | ||
const resolveRelativeTo = path.dirname(filePath); | ||
const relativeImportFilePath = path.relative(resolveRelativeTo, resolvedImportPath); | ||
let relativeImportFilePath = ''; | ||
if (context.url.match(OUTSIDE_ROOT_REGEXP)) { | ||
const pathInsideRootDir = `/${normalizedPath.replace(normalizedRootDir, '')}`; | ||
const resolveRelativeTo = path.dirname(context.url); | ||
relativeImportFilePath = path.relative(resolveRelativeTo, pathInsideRootDir); | ||
} else { | ||
const resolveRelativeTo = path.dirname(filePath); | ||
relativeImportFilePath = path.relative(resolveRelativeTo, resolvedImportPath); | ||
} | ||
resolvedImportPath = `./${toBrowserPath(relativeImportFilePath)}`; | ||
@@ -325,0 +334,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
89591
1440