mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Unifies the CJS and ESM source map cache map with SourceMapCacheMap and allows the CJS cache entries to be queried more efficiently with a source url without iteration on an IterableWeakMap. Add a test to verify that the CJS source map cache entry can be reclaimed. PR-URL: https://github.com/nodejs/node/pull/51711 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
33 lines
803 B
JavaScript
33 lines
803 B
JavaScript
// Flags: --enable-source-maps
|
|
|
|
'use strict';
|
|
require('../../../common');
|
|
const assert = require('assert');
|
|
Error.stackTraceLimit = 5;
|
|
|
|
assert.strictEqual(typeof Error.prepareStackTrace, 'function');
|
|
const defaultPrepareStackTrace = Error.prepareStackTrace;
|
|
Error.prepareStackTrace = (error, trace) => {
|
|
trace = trace.filter(it => {
|
|
return it.getFunctionName() !== 'functionC';
|
|
});
|
|
return defaultPrepareStackTrace(error, trace);
|
|
};
|
|
|
|
try {
|
|
require('../enclosing-call-site-min.js');
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|
|
|
|
// Source maps support is disabled programmatically even without deleting the
|
|
// CJS module cache.
|
|
process.setSourceMapsEnabled(false);
|
|
assert.strictEqual(process.sourceMapsEnabled, false);
|
|
|
|
try {
|
|
require('../enclosing-call-site-min.js');
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|