build(bazel): use bazel managed node_modules for downstream angular from source build support (#24663)
PR Close #24663
This commit is contained in:
@ -21,7 +21,7 @@ ts_library(
|
||||
],
|
||||
),
|
||||
module_name = "@angular/compiler-cli",
|
||||
node_modules = "@//:node_modules",
|
||||
node_modules = "@angular_deps//:node_modules",
|
||||
tsconfig = ":tsconfig",
|
||||
deps = [
|
||||
"//packages/compiler",
|
||||
|
@ -124,7 +124,8 @@ export function setupBazelTo(basePath: string) {
|
||||
}
|
||||
|
||||
// Link typescript
|
||||
const typescriptSource = path.join(sources, 'angular/node_modules/typescript');
|
||||
const typescriptSource =
|
||||
path.join(sources, 'angular/external/angular_deps/node_modules/typescript');
|
||||
const typescriptDest = path.join(nodeModulesPath, 'typescript');
|
||||
if (fs.existsSync(typescriptSource)) {
|
||||
fs.symlinkSync(typescriptSource, typescriptDest);
|
||||
|
@ -8,12 +8,13 @@
|
||||
|
||||
import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '@angular/compiler';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {MappingItem, RawSourceMap, SourceMapConsumer} from 'source-map';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {TypeScriptNodeEmitter} from '../../src/transformers/node_emitter';
|
||||
import {Directory, MockAotContext, MockCompilerHost} from '../mocks';
|
||||
|
||||
const sourceMap = require('source-map');
|
||||
|
||||
const someGenFilePath = '/somePackage/someGenFile';
|
||||
const someGenFileName = someGenFilePath + '.ts';
|
||||
const someSourceFilePath = '/somePackage/someSourceFile';
|
||||
@ -469,16 +470,16 @@ describe('TypeScriptNodeEmitter', () => {
|
||||
return result;
|
||||
}
|
||||
|
||||
function mappingItemsOf(text: string): MappingItem[] {
|
||||
function mappingItemsOf(text: string) {
|
||||
// find the source map:
|
||||
const sourceMapMatch = /sourceMappingURL\=data\:application\/json;base64,(.*)$/.exec(text);
|
||||
const sourceMapBase64 = sourceMapMatch ![1];
|
||||
const sourceMapBuffer = Buffer.from(sourceMapBase64, 'base64');
|
||||
const sourceMapText = sourceMapBuffer.toString('utf8');
|
||||
const sourceMap: RawSourceMap = JSON.parse(sourceMapText);
|
||||
const consumer = new SourceMapConsumer(sourceMap);
|
||||
const mappings: MappingItem[] = [];
|
||||
consumer.eachMapping(mapping => { mappings.push(mapping); });
|
||||
const sourceMapParsed = JSON.parse(sourceMapText);
|
||||
const consumer = new sourceMap.SourceMapConsumer(sourceMapParsed);
|
||||
const mappings: any[] = [];
|
||||
consumer.eachMapping((mapping: any) => { mappings.push(mapping); });
|
||||
return mappings;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user