chore: delete unused source-map-support code (#33306)
This commit is contained in:
parent
0ace47e7cf
commit
88c42f7887
|
@ -16,35 +16,14 @@
|
||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
|
||||||
const esbuild = require('esbuild');
|
const esbuild = require('esbuild');
|
||||||
|
|
||||||
// Can be removed once source-map-support was is fixed.
|
|
||||||
/** @type{import('esbuild').Plugin} */
|
|
||||||
let patchSource = {
|
|
||||||
name: 'patch-source-map-support-deprecation',
|
|
||||||
setup(build) {
|
|
||||||
build.onResolve({ filter: /^source-map-support$/ }, () => {
|
|
||||||
const originalPath = require.resolve('source-map-support');
|
|
||||||
const patchedPath = path.join(path.dirname(originalPath), path.basename(originalPath, '.js') + '.pw-patched.js');
|
|
||||||
let sourceFileContent = fs.readFileSync(originalPath, 'utf8');
|
|
||||||
// source-map-support is overwriting __PW_ZONE__ with func in core if source maps are present.
|
|
||||||
const original = `return state.nextPosition.name || originalFunctionName();`;
|
|
||||||
const insertedLine = `if (state.nextPosition.name === 'func') return originalFunctionName() || 'func';`;
|
|
||||||
sourceFileContent = sourceFileContent.replace(original, insertedLine + original);
|
|
||||||
fs.writeFileSync(patchedPath, sourceFileContent);
|
|
||||||
return { path: patchedPath }
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const ctx = await esbuild.context({
|
const ctx = await esbuild.context({
|
||||||
entryPoints: [path.join(__dirname, 'src/utilsBundleImpl.ts')],
|
entryPoints: [path.join(__dirname, 'src/utilsBundleImpl.ts')],
|
||||||
external: ['fsevents'],
|
external: ['fsevents'],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
outdir: path.join(__dirname, '../../lib'),
|
outdir: path.join(__dirname, '../../lib'),
|
||||||
plugins: [patchSource],
|
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
platform: 'node',
|
platform: 'node',
|
||||||
target: 'ES2019',
|
target: 'ES2019',
|
||||||
|
|
Loading…
Reference in New Issue