mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
6bdc101c63
V8 already parses the source map magic comments. Currently, only scripts and functions expose the parsed source map URLs. It is unnecessary to parse the source map magic comments again when the parsed information is available. PR-URL: https://github.com/nodejs/node/pull/44798 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
28 lines
586 B
JavaScript
28 lines
586 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const vm = require('vm');
|
|
|
|
function checkSourceMapUrl(source, expectedSourceMapURL) {
|
|
const script = new vm.Script(source);
|
|
assert.strictEqual(script.sourceMapURL, expectedSourceMapURL);
|
|
}
|
|
|
|
// No magic comment
|
|
checkSourceMapUrl(`
|
|
function myFunc() {}
|
|
`, undefined);
|
|
|
|
// Malformed magic comment
|
|
checkSourceMapUrl(`
|
|
function myFunc() {}
|
|
// sourceMappingURL=sourcemap.json
|
|
`, undefined);
|
|
|
|
// Expected magic comment
|
|
checkSourceMapUrl(`
|
|
function myFunc() {}
|
|
//# sourceMappingURL=sourcemap.json
|
|
`, 'sourcemap.json');
|