Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import remapping, { type DecodedSourceMap, type EncodedSourceMap } from '@ampproject/remapping';
import { type PluginItem, transformAsync } from '@babel/core';
import type { PluginItem } from '@babel/core';
import { createRequire } from 'node:module';
import { workerData } from 'node:worker_threads';
import Piscina from 'piscina';
Comment thread
clydin marked this conversation as resolved.
Expand Down Expand Up @@ -42,6 +42,16 @@ const {
jit = false,
} = (workerData || {}) as Partial<JavaScriptTransformerOptions>;

let babelLinkerDeps:
| Promise<
[
typeof import('@angular/compiler-cli/linker/babel'),
typeof import('@angular/compiler-cli'),
typeof import('@babel/core'),
]
>
| undefined;

const textDecoder = new TextDecoder();
const textEncoder = new TextEncoder();

Expand Down Expand Up @@ -170,8 +180,13 @@ async function transformJavaScriptImpl(
}

if (shouldLink && useBabelLinker) {
const { createEs2015LinkerPlugin } = await import('@angular/compiler-cli/linker/babel');
const { ConsoleLogger, LogLevel } = await import('@angular/compiler-cli');
babelLinkerDeps ??= Promise.all([
import('@angular/compiler-cli/linker/babel'),
import('@angular/compiler-cli'),
import('@babel/core'),
]);
const [{ createEs2015LinkerPlugin }, { ConsoleLogger, LogLevel }, { transformAsync }] =
await babelLinkerDeps;

const result = await transformAsync(code, {
filename,
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/build/src/tools/oxc/oxc-transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ export function transform(filename: string, code: string, options: OxcTransformO

let map: DecodedSourceMap | undefined;
if (options.sourcemap) {
const rawMap = source.generateDecodedMap({ hires: true, source: filename });
const rawMap = source.generateDecodedMap({ hires: 'boundary', source: filename });
map = { ...rawMap, version: 3 };
}

Expand Down