mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update minify
This commit is contained in:
36
node_modules/source-map-support/source-map-support.js
generated
vendored
36
node_modules/source-map-support/source-map-support.js
generated
vendored
@@ -137,7 +137,7 @@ function retrieveSourceMapURL(source) {
|
||||
|
||||
// Get the URL of the source map
|
||||
fileData = retrieveFile(source);
|
||||
var re = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg;
|
||||
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
|
||||
// Keep executing the search to find the *last* sourceMappingURL to avoid
|
||||
// picking up sourceMappingURLs from comments, strings, etc.
|
||||
var lastMatch, match;
|
||||
@@ -335,8 +335,13 @@ function cloneCallSite(frame) {
|
||||
return object;
|
||||
}
|
||||
|
||||
function wrapCallSite(frame) {
|
||||
function wrapCallSite(frame, state) {
|
||||
// provides interface backward compatibility
|
||||
if (state === undefined) {
|
||||
state = { nextPosition: null, curPosition: null }
|
||||
}
|
||||
if(frame.isNative()) {
|
||||
state.curPosition = null;
|
||||
return frame;
|
||||
}
|
||||
|
||||
@@ -350,7 +355,11 @@ function wrapCallSite(frame) {
|
||||
|
||||
// Fix position in Node where some (internal) code is prepended.
|
||||
// See https://github.com/evanw/node-source-map-support/issues/36
|
||||
var headerLength = 62;
|
||||
// Header removed in node at ^10.16 || >=11.11.0
|
||||
// v11 is not an LTS candidate, we can just test the one version with it.
|
||||
// Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
|
||||
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
|
||||
var headerLength = noHeader.test(process.version) ? 0 : 62;
|
||||
if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
|
||||
column -= headerLength;
|
||||
}
|
||||
@@ -360,9 +369,15 @@ function wrapCallSite(frame) {
|
||||
line: line,
|
||||
column: column
|
||||
});
|
||||
state.curPosition = position;
|
||||
frame = cloneCallSite(frame);
|
||||
var originalFunctionName = frame.getFunctionName;
|
||||
frame.getFunctionName = function() { return position.name || originalFunctionName(); };
|
||||
frame.getFunctionName = function() {
|
||||
if (state.nextPosition == null) {
|
||||
return originalFunctionName();
|
||||
}
|
||||
return state.nextPosition.name || originalFunctionName();
|
||||
};
|
||||
frame.getFileName = function() { return position.source; };
|
||||
frame.getLineNumber = function() { return position.line; };
|
||||
frame.getColumnNumber = function() { return position.column + 1; };
|
||||
@@ -395,9 +410,14 @@ function prepareStackTrace(error, stack) {
|
||||
var message = error.message || '';
|
||||
var errorString = name + ": " + message;
|
||||
|
||||
return errorString + stack.map(function(frame) {
|
||||
return '\n at ' + wrapCallSite(frame);
|
||||
}).join('');
|
||||
var state = { nextPosition: null, curPosition: null };
|
||||
var processedStack = [];
|
||||
for (var i = stack.length - 1; i >= 0; i--) {
|
||||
processedStack.push('\n at ' + wrapCallSite(stack[i], state));
|
||||
state.nextPosition = state.curPosition;
|
||||
}
|
||||
state.curPosition = state.nextPosition = null;
|
||||
return errorString + processedStack.reverse().join('');
|
||||
}
|
||||
|
||||
// Generate position and snippet of original source with pointer
|
||||
@@ -561,7 +581,7 @@ exports.resetRetrieveHandlers = function() {
|
||||
|
||||
retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
|
||||
retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
|
||||
|
||||
|
||||
retrieveSourceMap = handlerExec(retrieveMapHandlers);
|
||||
retrieveFile = handlerExec(retrieveFileHandlers);
|
||||
}
|
||||
|
Reference in New Issue
Block a user