Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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 5.0.0-beta.1 to 5.0.0-beta.2

test/collector_spec.d.ts

2

package.json
{
"name": "@angular/tsc-wrapped",
"version": "5.0.0-beta.1",
"version": "5.0.0-beta.2",
"description": "Wraps the tsc CLI, allowing extensions.",

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

@@ -9,7 +9,7 @@ /**

import * as ts from 'typescript';
import { ModuleMetadata } from './schema';
import { MetadataValue, ModuleMetadata } from './schema';
/**
* A set of collector options to use when collecting metadata.
*/
export declare class CollectorOptions {
export interface CollectorOptions {
/**

@@ -28,2 +28,6 @@ * Version of the metadata to collect.

verboseInvalidExpression?: boolean;
/**
* An expression substitution callback.
*/
substituteExpression?: (value: MetadataValue, node: ts.Node) => MetadataValue;
}

@@ -40,3 +44,3 @@ /**

*/
getMetadata(sourceFile: ts.SourceFile, strict?: boolean): ModuleMetadata | undefined;
getMetadata(sourceFile: ts.SourceFile, strict?: boolean, substituteExpression?: (value: MetadataValue, node: ts.Node) => MetadataValue): ModuleMetadata | undefined;
}

@@ -9,2 +9,10 @@ "use strict";

*/
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -28,11 +36,2 @@ var ts = require("typescript");

/**
* A set of collector options to use when collecting metadata.
*/
var CollectorOptions = (function () {
function CollectorOptions() {
}
return CollectorOptions;
}());
exports.CollectorOptions = CollectorOptions;
/**
* Collect decorator metadata from a TypeScript module.

@@ -49,8 +48,20 @@ */

*/
MetadataCollector.prototype.getMetadata = function (sourceFile, strict) {
MetadataCollector.prototype.getMetadata = function (sourceFile, strict, substituteExpression) {
var _this = this;
if (strict === void 0) { strict = false; }
var locals = new symbols_1.Symbols(sourceFile);
var nodeMap = new Map();
var evaluator = new evaluator_1.Evaluator(locals, nodeMap, this.options);
var composedSubstituter = substituteExpression && this.options.substituteExpression ?
function (value, node) {
return _this.options.substituteExpression(substituteExpression(value, node), node);
} :
substituteExpression;
var evaluatorOptions = substituteExpression ? __assign({}, this.options, { substituteExpression: composedSubstituter }) :
this.options;
var metadata;
var evaluator = new evaluator_1.Evaluator(locals, nodeMap, evaluatorOptions, function (name, value) {
if (!metadata)
metadata = {};
metadata[name] = value;
});
var exports = undefined;

@@ -57,0 +68,0 @@ function objFromDecorator(decoratorNode) {

@@ -34,3 +34,4 @@ /**

private options;
constructor(symbols: Symbols, nodeMap: Map<MetadataEntry, ts.Node>, options?: CollectorOptions);
private recordExport;
constructor(symbols: Symbols, nodeMap: Map<MetadataEntry, ts.Node>, options?: CollectorOptions, recordExport?: (name: string, value: MetadataValue) => void);
nameOf(node: ts.Node | undefined): string | MetadataError;

@@ -37,0 +38,0 @@ /**

@@ -78,3 +78,3 @@ "use strict";

var Evaluator = (function () {
function Evaluator(symbols, nodeMap, options) {
function Evaluator(symbols, nodeMap, options, recordExport) {
if (options === void 0) { options = {}; }

@@ -84,2 +84,3 @@ this.symbols = symbols;

this.options = options;
this.recordExport = recordExport;
}

@@ -209,2 +210,9 @@ Evaluator.prototype.nameOf = function (node) {

function recordEntry(entry, node) {
if (t.options.substituteExpression) {
var newEntry = t.options.substituteExpression(entry, node);
if (t.recordExport && newEntry != entry && schema_1.isMetadataGlobalReferenceExpression(newEntry)) {
t.recordExport(newEntry.name, entry);
}
entry = newEntry;
}
t.nodeMap.set(entry, node);

@@ -259,3 +267,3 @@ return entry;

}
return obj_1;
return recordEntry(obj_1, node);
case ts.SyntaxKind.ArrayLiteralExpression:

@@ -284,3 +292,3 @@ var arr_1 = [];

return error;
return arr_1;
return recordEntry(arr_1, node);
case spreadElementSyntaxKind:

@@ -287,0 +295,0 @@ var spreadExpression = this.evaluateNode(node.expression);

"use strict";
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __extends = (this && this.__extends) || (function () {

@@ -109,2 +116,3 @@ var extendStatics = Object.setPrototypeOf ||

__extends(MockIdentifier, _super);
// tslint:enable
function MockIdentifier(name, kind, flags, pos, end) {

@@ -156,3 +164,2 @@ if (kind === void 0) { kind = ts.SyntaxKind.Identifier; }

MockSymbol.prototype.getJsDocTags = function () { return []; };
;
MockSymbol.of = function (name) { return new MockSymbol(name); };

@@ -167,2 +174,3 @@ return MockSymbol;

var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character;
// tslint:disable-next-line:no-console
console.log(diagnostic.file.fileName + " (" + (line + 1) + "," + (character + 1) + "): " + message);

@@ -169,0 +177,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