fix(@angular-devkit/build-angular): allow third-party sourcemaps to b… · angular/angular-cli@b3a14d0 (original) (raw)

`@@ -116,7 +116,12 @@ function convertTypeScriptDiagnostic(

`

116

116

`` // This is a non-watch version of the compiler code from @ngtools/webpack augmented for esbuild

``

117

117

`// eslint-disable-next-line max-lines-per-function

`

118

118

`export function createCompilerPlugin(

`

119

``

`-

pluginOptions: { sourcemap: boolean; tsconfig: string; advancedOptimizations?: boolean },

`

``

119

`+

pluginOptions: {

`

``

120

`+

sourcemap: boolean;

`

``

121

`+

tsconfig: string;

`

``

122

`+

advancedOptimizations?: boolean;

`

``

123

`+

thirdPartySourcemaps?: boolean;

`

``

124

`+

},

`

120

125

`styleOptions: BundleStylesheetOptions,

`

121

126

`): Plugin {

`

122

127

`return {

`

`@@ -318,10 +323,14 @@ export function createCompilerPlugin(

`

318

323

`};

`

319

324

`}

`

320

325

``

``

326

`+

const useInputSourcemap =

`

``

327

`+

pluginOptions.sourcemap &&

`

``

328

`+

(!!pluginOptions.thirdPartySourcemaps || !/[\/]node_modules[\/]/.test(args.path));

`

``

329

+

321

330

`const data = typescriptResult.content ?? '';

`

322

331

`const babelResult = await transformAsync(data, {

`

323

332

`filename: args.path,

`

324

``

`-

inputSourceMap: (pluginOptions.sourcemap ? undefined : false) as undefined,

`

``

333

`+

inputSourceMap: (useInputSourcemap ? undefined : false) as undefined,

`

325

334

`sourceMaps: pluginOptions.sourcemap ? 'inline' : false,

`

326

335

`compact: false,

`

327

336

`configFile: false,

`

`@@ -355,10 +364,14 @@ export function createCompilerPlugin(

`

355

364

`)

`

356

365

`).createEs2015LinkerPlugin;

`

357

366

``

``

367

`+

const useInputSourcemap =

`

``

368

`+

pluginOptions.sourcemap &&

`

``

369

`+

(!!pluginOptions.thirdPartySourcemaps || !/[\/]node_modules[\/]/.test(args.path));

`

``

370

+

358

371

`const data = await fs.readFile(args.path, 'utf-8');

`

359

372

`const result = await transformAsync(data, {

`

360

373

`filename: args.path,

`

361

``

`-

inputSourceMap: (pluginOptions.sourcemap ? undefined : false) as undefined,

`

``

374

`+

inputSourceMap: (useInputSourcemap ? undefined : false) as undefined,

`

362

375

`sourceMaps: pluginOptions.sourcemap ? 'inline' : false,

`

363

376

`compact: false,

`

364

377

`configFile: false,

`