mini-css-extract-plugin
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -10,4 +10,2 @@ "use strict"; | ||
var _identifier = require("webpack/lib/util/identifier"); | ||
var _pluginOptions = _interopRequireDefault(require("./plugin-options.json")); | ||
@@ -760,3 +758,3 @@ | ||
} = compilation.getPathWithInfo(filenameTemplate, pathData); | ||
const undoPath = (0, _identifier.getUndoPath)(filename, compiler.outputPath, false); | ||
const undoPath = (0, _utils.getUndoPath)(filename, compiler.outputPath, false); | ||
content = content.replace(new RegExp(_utils.ABSOLUTE_PUBLIC_PATH, "g"), ""); | ||
@@ -763,0 +761,0 @@ content = content.replace(new RegExp(_utils.SINGLE_DOT_PATH_SEGMENT, "g"), "."); |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.stringifyRequest = stringifyRequest; | ||
exports.getUndoPath = getUndoPath; | ||
exports.SINGLE_DOT_PATH_SEGMENT = exports.ABSOLUTE_PUBLIC_PATH = exports.AUTO_PUBLIC_PATH = exports.MODULE_TYPE = void 0; | ||
@@ -121,2 +122,35 @@ | ||
}).join("!")); | ||
} | ||
function getUndoPath(filename, outputPath, enforceRelative) { | ||
let depth = -1; | ||
let append = ""; // eslint-disable-next-line no-param-reassign | ||
outputPath = outputPath.replace(/[\\/]$/, ""); | ||
for (const part of filename.split(/[/\\]+/)) { | ||
if (part === "..") { | ||
if (depth > -1) { | ||
// eslint-disable-next-line no-plusplus | ||
depth--; | ||
} else { | ||
const i = outputPath.lastIndexOf("/"); | ||
const j = outputPath.lastIndexOf("\\"); | ||
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j); | ||
if (pos < 0) { | ||
return `${outputPath}/`; | ||
} | ||
append = `${outputPath.slice(pos + 1)}/${append}`; // eslint-disable-next-line no-param-reassign | ||
outputPath = outputPath.slice(0, pos); | ||
} | ||
} else if (part !== ".") { | ||
// eslint-disable-next-line no-plusplus | ||
depth++; | ||
} | ||
} | ||
return depth > 0 ? `${"../".repeat(depth)}${append}` : enforceRelative ? `./${append}` : append; | ||
} |
{ | ||
"name": "mini-css-extract-plugin", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "extracts CSS into separate files", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
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
90445
1361