Socket
Socket
Sign inDemoInstall

@angular/tsc-wrapped

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/tsc-wrapped - npm Package Compare versions

Comparing version 4.0.0-beta.7 to 4.0.0-beta.8

src/bundler.d.ts

2

index.d.ts

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

export { default as AngularCompilerOptions } from './src/options';
export * from './src/bundler';
export * from './src/cli_options';
export * from './src/collector';
export * from './src/index_writer';
export * from './src/schema';

@@ -17,5 +17,7 @@ /**

exports.main = main_1.main;
__export(require("./src/bundler"));
__export(require("./src/cli_options"));
__export(require("./src/collector"));
__export(require("./src/index_writer"));
__export(require("./src/schema"));
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@angular/tsc-wrapped",
"version": "4.0.0-beta.7",
"version": "4.0.0-beta.8",
"description": "Wraps the tsc CLI, allowing extensions.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/angular/angular/tree/master/tools/tsc-wrapped",

@@ -34,1 +34,13 @@ import * as ts from 'typescript';

}
export declare class SyntheticIndexHost extends DelegatingHost {
private syntheticIndex;
constructor(delegate: ts.CompilerHost, syntheticIndex: {
name: string;
content: string;
metadata: string;
});
fileExists: (fileName: string) => boolean;
readFile: (fileName: string) => string;
getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void) => ts.SourceFile;
writeFile: ts.WriteFileCallback;
}

@@ -59,2 +59,3 @@ /**

var IGNORED_FILES = /\.ngfactory\.js$|\.ngstyle\.js$/;
var DTS = /\.d\.ts$/;
var MetadataWriterHost = (function (_super) {

@@ -86,3 +87,5 @@ __extends(MetadataWriterHost, _super);

}
_this.writeMetadata(fileName, sourceFiles[0]);
if (!_this.ngOptions.skipMetadataEmit && !_this.ngOptions.bundleIndex) {
_this.writeMetadata(fileName, sourceFiles[0]);
}
};

@@ -116,2 +119,34 @@ return _this;

exports.MetadataWriterHost = MetadataWriterHost;
var SyntheticIndexHost = (function (_super) {
__extends(SyntheticIndexHost, _super);
function SyntheticIndexHost(delegate, syntheticIndex) {
var _this = _super.call(this, delegate) || this;
_this.syntheticIndex = syntheticIndex;
_this.fileExists = function (fileName) {
return fileName == _this.syntheticIndex.name || _this.delegate.fileExists(fileName);
};
_this.readFile = function (fileName) {
return fileName == _this.syntheticIndex.name ? _this.syntheticIndex.content :
_this.delegate.readFile(fileName);
};
_this.getSourceFile = function (fileName, languageVersion, onError) {
if (fileName == _this.syntheticIndex.name) {
return ts.createSourceFile(fileName, _this.syntheticIndex.content, languageVersion, true);
}
return _this.delegate.getSourceFile(fileName, languageVersion, onError);
};
_this.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
_this.delegate.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);
if (fileName.match(DTS) && sourceFiles && sourceFiles.length == 1 &&
sourceFiles[0].fileName == _this.syntheticIndex.name) {
// If we are writing the synthetic index, write the metadata along side.
var metadataName = fileName.replace(DTS, '.metadata.json');
fs_1.writeFileSync(metadataName, _this.syntheticIndex.metadata, 'utf8');
}
};
return _this;
}
return SyntheticIndexHost;
}(DelegatingHost));
exports.SyntheticIndexHost = SyntheticIndexHost;
//# sourceMappingURL=compiler_host.js.map

@@ -17,4 +17,7 @@ /**

var vinyl_file_1 = require("./vinyl_file");
var bundler_1 = require("./bundler");
var index_writer_1 = require("./index_writer");
var tsc_2 = require("./tsc");
exports.UserError = tsc_2.UserError;
var DTS = /\.d\.ts$/;
function main(project, cliOptions, codegen, options) {

@@ -46,2 +49,34 @@ try {

host_1.realpath = function (path) { return path; };
// If the comilation is a bundle index then produce the bundle index metadata and
// the synthetic bundle index.
if (ngOptions_1.bundleIndex && !ngOptions_1.skipMetadataEmit) {
var files = parsed_1.fileNames.filter(function (f) { return !DTS.test(f); });
if (files.length != 1 && (!ngOptions_1.libraryIndex || files.length < 1)) {
tsc_1.check([{
file: null,
start: null,
length: null,
messageText: 'Angular compiler option "bundleIndex" requires one and only one .ts file in the "files" field or "libraryIndex" to also be specified in order to select which module to use as the library index',
category: ts.DiagnosticCategory.Error,
code: 0
}]);
}
var file = files[0];
var indexModule = file.replace(/\.ts$/, '');
var libraryIndexModule = ngOptions_1.libraryIndex ?
bundler_1.MetadataBundler.resolveModule(ngOptions_1.libraryIndex, indexModule) :
indexModule;
var bundler = new bundler_1.MetadataBundler(indexModule, ngOptions_1.importAs, new bundler_1.CompilerHostAdapter(host_1));
if (diagnostics_1)
console.time('NG bundle index');
var metadataBundle = bundler.getMetadataBundle();
if (diagnostics_1)
console.timeEnd('NG bundle index');
var metadata = JSON.stringify(metadataBundle.metadata);
var name_1 = path.join(path.dirname(libraryIndexModule), ngOptions_1.bundleIndex + '.ts');
var libraryIndex = ngOptions_1.libraryIndex || "./" + path.basename(indexModule);
var content = index_writer_1.privateEntriesToIndex(libraryIndex, metadataBundle.privates);
host_1 = new compiler_host_1.SyntheticIndexHost(host_1, { name: name_1, content: content, metadata: metadata });
parsed_1.fileNames.push(name_1);
}
var program_1 = createProgram_1(host_1);

@@ -48,0 +83,0 @@ var errors = program_1.getOptionsDiagnostics();

@@ -15,2 +15,5 @@ /**

skipTemplateCodegen?: boolean;
bundleIndex?: string;
libraryIndex?: string;
importAs?: string;
generateCodeForLibraries?: boolean;

@@ -17,0 +20,0 @@ annotateForClosureCompiler?: boolean;

@@ -14,2 +14,3 @@ /**

exports?: ModuleExportMetadata[];
importAs?: string;
metadata: {

@@ -162,2 +163,6 @@ [name: string]: MetadataEntry;

/**
* The module of the error (only used in bundled metadata)
*/
module?: string;
/**
* Context information that can be used to generate a more descriptive error message. The content

@@ -164,0 +169,0 @@ * of the context is dependent on the error message.

@@ -21,2 +21,3 @@ import * as ts from 'typescript';

}
export declare function open(directory: Directory, fileName: string): Directory | string | undefined;
export declare class MockNode implements ts.Node {

@@ -23,0 +24,0 @@ kind: ts.SyntaxKind;

@@ -44,15 +44,6 @@ "use strict";

}
var names = fileName.split('/');
if (names[names.length - 1] === 'lib.d.ts') {
if (fileName.endsWith('lib.d.ts')) {
return fs.readFileSync(ts.getDefaultLibFilePath(this.getCompilationSettings()), 'utf8');
}
var current = this.directory;
if (names.length && names[0] === '')
names.shift();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
var name_1 = names_1[_i];
if (!current || typeof current === 'string')
return undefined;
current = current[name_1];
}
var current = open(this.directory, fileName);
if (typeof current === 'string')

@@ -64,2 +55,16 @@ return current;

exports.Host = Host;
function open(directory, fileName) {
var names = fileName.split('/');
var current = directory;
if (names.length && names[0] === '')
names.shift();
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
var name_1 = names_1[_i];
if (!current || typeof current === 'string')
return undefined;
current = current[name_1];
}
return current;
}
exports.open = open;
var MockNode = (function () {

@@ -66,0 +71,0 @@ function MockNode(kind, flags, pos, end) {

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

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