Socket
Socket
Sign inDemoInstall

@angular/bazel

Package Overview
Dependencies
Maintainers
1
Versions
566
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/bazel - npm Package Compare versions

Comparing version 5.0.0-beta.7 to 5.0.0-rc.0

src/ngc-wrapped/extract_i18n.ts

9

package.json
{
"name": "@angular/bazel",
"version": "5.0.0-beta.7",
"version": "5.0.0-rc.0",
"description": "Angular - bazel build rules",

@@ -8,7 +8,8 @@ "author": "angular",

"peerDependencies": {
"@angular/compiler-cli": "5.0.0-beta.7",
"@angular/compiler-cli": "5.0.0-rc.0",
"typescript": "^2.4.2"
},
"dependencies": {
"@bazel/typescript": "0.1.x"
"@bazel/typescript": "0.2.x",
"@types/node": "6.0.84"
},

@@ -19,2 +20,2 @@ "repository": {

}
}
}

@@ -8,4 +8,6 @@ /**

*/
// TODO(tbosch): figure out why we need this as it breaks node code within ngc-wrapped
/// <reference types="node" />
import * as ng from '@angular/compiler-cli';
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, fixUmdModuleDeclarations, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
import * as fs from 'fs';

@@ -42,14 +44,2 @@ import * as path from 'path';

const project = args[0].replace(/^@+/, '');
let fileLoader: FileLoader;
if (inputs) {
fileLoader = new CachedFileLoader(fileCache, ALLOW_NON_HERMETIC_READS);
// Resolve the inputs to absolute paths to match TypeScript internals
const resolvedInputs: {[path: string]: string} = {};
for (const key of Object.keys(inputs)) {
resolvedInputs[path.resolve(key)] = inputs[key];
}
fileCache.updateCache(resolvedInputs);
} else {
fileLoader = new UncachedFileLoader();
}
const [{options: tsOptions, bazelOpts, files, config}] = parseTsconfig(project);

@@ -60,3 +50,12 @@ const expectedOuts = config['angularCompilerOptions']['expectedOut'];

const compilerOpts = ng.createNgCompilerOptions(basePath, config, tsOptions);
const {diagnostics} = compile({fileLoader, compilerOpts, bazelOpts, files, expectedOuts});
const tsHost = ts.createCompilerHost(compilerOpts, true);
const {diagnostics} = compile({
allowNonHermeticReads: ALLOW_NON_HERMETIC_READS,
compilerOpts,
tsHost,
bazelOpts,
files,
inputs,
expectedOuts
});
return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error);

@@ -75,10 +74,24 @@ }

export function compile(
{fileLoader, compilerOpts, bazelOpts, files, expectedOuts, gatherDiagnostics}: {
fileLoader: FileLoader,
compilerOpts: ng.CompilerOptions,
bazelOpts: BazelOptions,
files: string[],
expectedOuts: string[], gatherDiagnostics?: (program: ng.Program) => ng.Diagnostics
}): {diagnostics: ng.Diagnostics, program: ng.Program} {
export function compile({allowNonHermeticReads, compilerOpts, tsHost, bazelOpts, files, inputs,
expectedOuts, gatherDiagnostics}: {
allowNonHermeticReads: boolean,
compilerOpts: ng.CompilerOptions,
tsHost: ts.CompilerHost, inputs?: {[path: string]: string},
bazelOpts: BazelOptions,
files: string[],
expectedOuts: string[], gatherDiagnostics?: (program: ng.Program) => ng.Diagnostics
}): {diagnostics: ng.Diagnostics, program: ng.Program} {
let fileLoader: FileLoader;
if (inputs) {
fileLoader = new CachedFileLoader(fileCache, ALLOW_NON_HERMETIC_READS);
// Resolve the inputs to absolute paths to match TypeScript internals
const resolvedInputs: {[path: string]: string} = {};
for (const key of Object.keys(inputs)) {
resolvedInputs[path.resolve(key)] = inputs[key];
}
fileCache.updateCache(resolvedInputs);
} else {
fileLoader = new UncachedFileLoader();
}
if (!bazelOpts.es5Mode) {

@@ -94,3 +107,2 @@ compilerOpts.annotateForClosureCompiler = true;

const writtenExpectedOuts = [...expectedOuts];
const tsHost = ts.createCompilerHost(compilerOpts, true);

@@ -109,3 +121,3 @@ const originalWriteFile = tsHost.writeFile.bind(tsHost);

// Patch fileExists when resolving modules, so that ngc can ask TypeScript to
// Patch fileExists when resolving modules, so that CompilerHost can ask TypeScript to
// resolve non-existing generated files that don't exist on disk, but are

@@ -150,8 +162,2 @@ // synthetic and added to the `programWithStubs` based on real inputs.

};
// TODO(tbosch): fix tsickle to still run regular transformers even
// if tsickle is not processing a file, and then remove this override,
// as this is only required to keep the ng transformer running,
// but produces e.g. too many externs.
bazelHost.shouldSkipTsickleProcessing = (fileName: string): boolean =>
bazelOpts.compilationTargetSrc.indexOf(fileName) === -1 && !NGC_GEN_FILES.test(fileName);

@@ -177,3 +183,6 @@ const ngHost = ng.createCompilerHost({options: compilerOpts, tsHost: bazelHost});

beforeTs: customTransformers.before,
afterTs: customTransformers.after,
afterTs: [
...(customTransformers.after || []),
fixUmdModuleDeclarations((sf: ts.SourceFile) => bazelHost.amdModuleName(sf)),
],
});

@@ -180,0 +189,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc