@auscope/angular2parse 2.0.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/esm2020/auscope-angular2parse.mjs +5 -0
  2. package/esm2020/lib/angular/compiler/assertions.mjs +45 -0
  3. package/esm2020/lib/angular/compiler/ast.mjs +393 -0
  4. package/esm2020/lib/angular/compiler/chars.mjs +78 -0
  5. package/esm2020/lib/angular/compiler/interpolation-config.mjs +24 -0
  6. package/esm2020/lib/angular/compiler/lexer.mjs +344 -0
  7. package/esm2020/lib/angular/compiler/parser.mjs +721 -0
  8. package/esm2020/lib/angular/compiler.mjs +7 -0
  9. package/esm2020/lib/angular/facade/lang.mjs +85 -0
  10. package/esm2020/lib/angular/facade.mjs +2 -0
  11. package/esm2020/lib/angular.mjs +3 -0
  12. package/esm2020/lib/module.mjs +18 -0
  13. package/esm2020/lib/parse.mjs +66 -0
  14. package/esm2020/lib/util/binary-operations.mjs +18 -0
  15. package/esm2020/lib/util/lang.mjs +13 -0
  16. package/esm2020/lib/util.mjs +3 -0
  17. package/esm2020/lib/visitors/parse-visitor-compiler.mjs +96 -0
  18. package/esm2020/lib/visitors/parse-visitor-resolver.mjs +141 -0
  19. package/esm2020/lib/visitors.mjs +3 -0
  20. package/esm2020/public-api.mjs +6 -0
  21. package/fesm2015/auscope-angular2parse.mjs +2035 -0
  22. package/fesm2015/auscope-angular2parse.mjs.map +1 -0
  23. package/fesm2020/auscope-angular2parse.mjs +2033 -0
  24. package/fesm2020/auscope-angular2parse.mjs.map +1 -0
  25. package/index.d.ts +5 -0
  26. package/lib/angular/compiler/assertions.d.ts +9 -0
  27. package/lib/angular/compiler/ast.d.ts +242 -0
  28. package/lib/angular/compiler/chars.d.ts +69 -0
  29. package/lib/angular/compiler/interpolation-config.d.ts +14 -0
  30. package/lib/angular/compiler/lexer.d.ts +44 -0
  31. package/lib/angular/compiler/parser.d.ts +92 -0
  32. package/{projects/angular2parse/src/lib/angular/compiler.ts → lib/angular/compiler.d.ts} +1 -1
  33. package/lib/angular/facade/lang.d.ts +44 -0
  34. package/lib/angular/facade.d.ts +1 -0
  35. package/{projects/angular2parse/src/lib/angular.ts → lib/angular.d.ts} +1 -1
  36. package/lib/module.d.ts +9 -0
  37. package/lib/parse.d.ts +21 -0
  38. package/lib/util/binary-operations.d.ts +1 -0
  39. package/lib/util/lang.d.ts +4 -0
  40. package/{projects/angular2parse/src/lib/util.ts → lib/util.d.ts} +1 -1
  41. package/lib/visitors/parse-visitor-compiler.d.ts +23 -0
  42. package/lib/visitors/parse-visitor-resolver.d.ts +25 -0
  43. package/lib/visitors.d.ts +2 -0
  44. package/package.json +41 -38
  45. package/public-api.d.ts +2 -0
  46. package/.editorconfig +0 -13
  47. package/angular.json +0 -27
  48. package/projects/angular2parse/README.md +0 -49
  49. package/projects/angular2parse/ng-package.json +0 -7
  50. package/projects/angular2parse/package.json +0 -18
  51. package/projects/angular2parse/src/lib/angular/compiler/assertions.ts +0 -49
  52. package/projects/angular2parse/src/lib/angular/compiler/ast.ts +0 -393
  53. package/projects/angular2parse/src/lib/angular/compiler/chars.ts +0 -89
  54. package/projects/angular2parse/src/lib/angular/compiler/interpolation-config.ts +0 -25
  55. package/projects/angular2parse/src/lib/angular/compiler/lexer.ts +0 -383
  56. package/projects/angular2parse/src/lib/angular/compiler/parser.ts +0 -811
  57. package/projects/angular2parse/src/lib/angular/facade/lang.ts +0 -124
  58. package/projects/angular2parse/src/lib/angular/facade.ts +0 -1
  59. package/projects/angular2parse/src/lib/module.ts +0 -12
  60. package/projects/angular2parse/src/lib/parse.ts +0 -78
  61. package/projects/angular2parse/src/lib/util/binary-operations.ts +0 -17
  62. package/projects/angular2parse/src/lib/util/lang.ts +0 -15
  63. package/projects/angular2parse/src/lib/visitors/parse-visitor-compiler.ts +0 -149
  64. package/projects/angular2parse/src/lib/visitors/parse-visitor-resolver.ts +0 -208
  65. package/projects/angular2parse/src/lib/visitors.ts +0 -2
  66. package/projects/angular2parse/src/public-api.ts +0 -5
  67. package/projects/angular2parse/tsconfig.lib.json +0 -20
  68. package/projects/angular2parse/tsconfig.lib.prod.json +0 -9
  69. package/target/npmlist.json +0 -1
  70. package/tsconfig.json +0 -32
@@ -1,124 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google Inc. All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
-
9
- export interface BrowserNodeGlobal {
10
- Object: typeof Object;
11
- Array: typeof Array;
12
- Map: typeof Map;
13
- Set: typeof Set;
14
- Date: DateConstructor;
15
- RegExp: RegExpConstructor;
16
- JSON: typeof JSON;
17
- Math: any; // typeof Math;
18
- assert(condition: any): void;
19
- Reflect: any;
20
- getAngularTestability: Function;
21
- getAllAngularTestabilities: Function;
22
- getAllAngularRootElements: Function;
23
- frameworkStabilizers: Array<Function>;
24
- setTimeout: Function;
25
- clearTimeout: Function;
26
- setInterval: Function;
27
- clearInterval: Function;
28
- encodeURI: Function;
29
- }
30
-
31
-
32
- export function getTypeNameForDebugging(type: any): string {
33
- return type['name'] || typeof type;
34
- }
35
-
36
- export function isPresent(obj: any): boolean {
37
- return obj != null;
38
- }
39
-
40
- export function isBlank(obj: any): boolean {
41
- return obj == null;
42
- }
43
-
44
- const STRING_MAP_PROTO = Object.getPrototypeOf({});
45
- export function isStrictStringMap(obj: any): boolean {
46
- return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
47
- }
48
-
49
- export function stringify(token: any): string {
50
- if (typeof token === 'string') {
51
- return token;
52
- }
53
-
54
- if (token == null) {
55
- return '' + token;
56
- }
57
-
58
- if (token.overriddenName) {
59
- return `${token.overriddenName}`;
60
- }
61
-
62
- if (token.name) {
63
- return `${token.name}`;
64
- }
65
-
66
- const res = token.toString();
67
- const newLineIndex = res.indexOf('\n');
68
- return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
69
- }
70
-
71
- export class NumberWrapper {
72
- static parseIntAutoRadix(text: string): number {
73
- const result: number = parseInt(text);
74
- if (isNaN(result)) {
75
- throw new Error('Invalid integer literal when parsing ' + text);
76
- }
77
- return result;
78
- }
79
-
80
- static isNumeric(value: any): boolean { return !isNaN(value - parseFloat(value)); }
81
- }
82
-
83
- // JS has NaN !== NaN
84
- export function looseIdentical(a: any, b: any): boolean {
85
- return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
86
- }
87
-
88
- export function isJsObject(o: any): boolean {
89
- return o !== null && (typeof o === 'function' || typeof o === 'object');
90
- }
91
-
92
- export function print(obj: Error | Object) {
93
- // tslint:disable-next-line:no-console
94
- console.log(obj);
95
- }
96
-
97
- export function warn(obj: Error | Object) {
98
- console.warn(obj);
99
- }
100
-
101
- export function setValueOnPath(global: any, path: string, value: any) {
102
- const parts = path.split('.');
103
- let obj: any = global;
104
- while (parts.length > 1) {
105
- const name = parts.shift();
106
- if (obj.hasOwnProperty(name) && obj[name] != null) {
107
- obj = obj[name];
108
- } else {
109
- obj = obj[name] = {};
110
- }
111
- }
112
- if (obj === undefined || obj === null) {
113
- obj = {};
114
- }
115
- obj[parts.shift()] = value;
116
- }
117
-
118
- export function isPrimitive(obj: any): boolean {
119
- return !isJsObject(obj);
120
- }
121
-
122
- export function escapeRegExp(s: string): string {
123
- return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
124
- }
@@ -1 +0,0 @@
1
- export * from './facade/lang';
@@ -1,12 +0,0 @@
1
- import { ModuleWithProviders, NgModule } from '@angular/core';
2
- import { Parse, PIPES_CONFIG, PipesConfig } from './parse';
3
-
4
- @NgModule()
5
- export class Angular2ParseModule {
6
- static forRoot(pipesConfigMap: PipesConfig[]): ModuleWithProviders<any> {
7
- return {
8
- ngModule: Angular2ParseModule,
9
- providers: [{provide: PIPES_CONFIG, multi: true, useValue: pipesConfigMap || []}]
10
- };
11
- }
12
- }
@@ -1,78 +0,0 @@
1
- import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
2
- import { Parser, Lexer, ASTWithSource } from './angular';
3
- import { ParseVisitorResolver, ParseVisitorCompiler } from './visitors';
4
-
5
- export const PIPES_CONFIG = new InjectionToken('PipesConfig');
6
-
7
- export interface PipesConfig {
8
- pipeName: string;
9
- pipeInstance: any;
10
- }
11
-
12
- @Injectable({providedIn: 'root'})
13
- export class Parse {
14
- private _parser: Parser = new Parser(new Lexer());
15
- private _pipesCache: Map<string, any> = new Map<string, any>();
16
- private _evalCache: Map<string, Function> = new Map<string, Function>();
17
- private _calcCache: Map<string, Function> = new Map<string, Function>();
18
-
19
- /**
20
- * Used to dependency inject the Angular 2 parser.
21
- */
22
-
23
- constructor(@Optional() @Inject(PIPES_CONFIG) pipesConfigs: PipesConfig[][]) {
24
- if (pipesConfigs && pipesConfigs.length) {
25
- pipesConfigs
26
- .filter(pipes => pipes && pipes.length)
27
- .forEach(pipes => pipes.forEach((pipeData) => this._pipesCache.set(pipeData.pipeName, pipeData.pipeInstance)));
28
- }
29
- }
30
-
31
- eval(expression: string): Function {
32
- if (this._evalCache.has(expression)) {
33
- return this._evalCache.get(expression);
34
- }
35
-
36
- const visitor = new ParseVisitorCompiler();
37
-
38
- let ast: ASTWithSource = this._parser.parseInterpolation(expression, 'Parse');
39
-
40
- if (!ast) {
41
- ast = this._parser.parseBinding(expression, 'Parse');
42
- }
43
-
44
- const fnBody = ast.visit(visitor);
45
- const pipesCache = this._pipesCache;
46
- const getFn = new Function('context', 'pipesCache', `return ${fnBody};`);
47
-
48
- const evalParse = function evalParse(context: any): any {
49
- return getFn(context, pipesCache);
50
- };
51
-
52
- this._evalCache.set(expression, evalParse);
53
-
54
- return evalParse;
55
- }
56
-
57
- calc(expression: string): Function {
58
- if (this._calcCache.has(expression)) {
59
- return this._calcCache.get(expression);
60
- }
61
-
62
- const visitor = new ParseVisitorResolver(this._pipesCache);
63
-
64
- let ast: ASTWithSource = this._parser.parseInterpolation(expression, 'Parse');
65
-
66
- if (!ast) {
67
- ast = this._parser.parseBinding(expression, 'Parse');
68
- }
69
-
70
- const calcParse = function calcParse(context: any): any {
71
- return ast.visit(visitor, context);
72
- };
73
-
74
- this._calcCache.set(expression, calcParse);
75
-
76
- return calcParse;
77
- }
78
- }
@@ -1,17 +0,0 @@
1
- export const BinaryOperations = new Map<string, any>([
2
- ['==', (left: any, right: any) => left == right],
3
- ['===', (left: any, right: any) => left === right],
4
- ['!=', (left: any, right: any) => left != right],
5
- ['!==', (left: any, right: any) => left !== right],
6
- ['&&', (left: any, right: any) => left && right],
7
- ['||', (left: any, right: any) => left || right],
8
- ['+', (left: any, right: any) => left + right],
9
- ['-', (left: any, right: any) => left - right],
10
- ['/', (left: any, right: any) => left / right],
11
- ['*', (left: any, right: any) => left * right],
12
- ['%', (left: any, right: any) => left % right],
13
- ['<', (left: any, right: any) => left < right],
14
- ['<=', (left: any, right: any) => left <= right],
15
- ['>', (left: any, right: any) => left > right],
16
- ['>=', (left: any, right: any) => left >= right],
17
- ]);
@@ -1,15 +0,0 @@
1
- export function compileToJSON(json: any) {
2
- return JSON.stringify(json).replace(/"/g, '');
3
- }
4
-
5
- export function isPresent(obj: any) {
6
- return obj !== null && obj !== undefined;
7
- }
8
-
9
- export function isJsObject(obj: any) {
10
- return obj !== null && (typeof obj === 'function' || typeof obj === 'object');
11
- }
12
-
13
- export function isFunction(val: any) {
14
- return typeof val === 'function';
15
- }
@@ -1,149 +0,0 @@
1
- import {
2
- AST,
3
- RecursiveAstVisitor,
4
- PropertyRead,
5
- MethodCall,
6
- KeyedRead,
7
- ImplicitReceiver,
8
- LiteralPrimitive,
9
- Binary,
10
- Chain,
11
- Conditional,
12
- BindingPipe,
13
- FunctionCall,
14
- Interpolation,
15
- KeyedWrite,
16
- LiteralArray,
17
- LiteralMap,
18
- PrefixNot,
19
- PropertyWrite,
20
- SafePropertyRead,
21
- SafeMethodCall,
22
- Quote
23
- } from '../angular';
24
- import { compileToJSON } from '../util';
25
-
26
- export class ParseVisitorCompiler extends RecursiveAstVisitor {
27
-
28
- visitBinary(ast: Binary): any {
29
- const left = ast.left.visit(this);
30
- const right = ast.right.visit(this);
31
-
32
- return `${left} ${ast.operation} ${right}`;
33
- }
34
-
35
- // TODO
36
- visitChain(ast: Chain): any {
37
- return compileToJSON(this.visitAll(ast.expressions));
38
- }
39
-
40
- visitConditional(ast: Conditional): any {
41
- const condition = ast.condition.visit(this);
42
- const trueExp = ast.trueExp.visit(this);
43
- const falseExp = ast.falseExp.visit(this);
44
-
45
- return `${condition} ? ${trueExp} : ${falseExp}`;
46
- }
47
-
48
- visitPipe(ast: BindingPipe): any {
49
- const pipe = ast.name;
50
- const args = this.visitAll(ast.args);
51
- const value = ast.exp.visit(this);
52
- args.unshift(value);
53
-
54
- return `pipesCache.get('${pipe}').transform.apply(null, ${compileToJSON(args)})`;
55
- }
56
-
57
- // TODO
58
- visitFunctionCall(ast: FunctionCall): any {
59
- const target = ast.target.visit(this);
60
- const args = compileToJSON(this.visitAll(ast.args));
61
-
62
- return `${target}.apply(${target}, ${args})`;
63
- }
64
-
65
- visitImplicitReceiver(ast: ImplicitReceiver): any {
66
- return `context`;
67
- }
68
-
69
- visitInterpolation(ast: Interpolation): any {
70
- return this.visitAll(ast.expressions)[0];
71
- }
72
-
73
- visitKeyedRead(ast: KeyedRead): any {
74
- const obj = ast.obj.visit(this);
75
- const key = ast.key.visit(this);
76
-
77
- return `${obj}[${key}]`;
78
- }
79
-
80
- visitKeyedWrite(ast: KeyedWrite): any {
81
- return null;
82
- }
83
-
84
- visitLiteralArray(ast: LiteralArray): any {
85
- return compileToJSON(this.visitAll(ast.expressions));
86
- }
87
-
88
- visitLiteralMap(ast: LiteralMap): any {
89
- const result = {};
90
- const keys = ast.keys;
91
- const values = this.visitAll(ast.values);
92
-
93
- for (let i = 0, length = keys.length; i < length; i++) {
94
- result[keys[i]] = values[i];
95
- }
96
-
97
- return compileToJSON(result);
98
- }
99
-
100
- visitLiteralPrimitive(ast: LiteralPrimitive): any {
101
- return typeof ast.value === 'string' ? `'${ast.value}'` : ast.value;
102
- }
103
-
104
- visitMethodCall(ast: MethodCall): any {
105
- const methodName = ast.name;
106
- const receiver = ast.receiver.visit(this);
107
- const args = compileToJSON(this.visitAll(ast.args));
108
-
109
- return `${receiver}['${methodName}'].apply(${receiver}, ${args})`;
110
- }
111
-
112
- visitPrefixNot(ast: PrefixNot): any {
113
- return ast.expression.visit(this);
114
- }
115
-
116
- visitPropertyRead(ast: PropertyRead): any {
117
- const property = ast.name;
118
- const receiver = ast.receiver.visit(this);
119
-
120
- return `${receiver}['${property}']`;
121
- }
122
-
123
- visitPropertyWrite(ast: PropertyWrite): any {
124
- return null;
125
- }
126
-
127
- visitSafePropertyRead(ast: SafePropertyRead): any {
128
- const property = ast.name;
129
- const receiver = ast.receiver.visit(this);
130
-
131
- return `${receiver}['${property}']`;
132
- }
133
-
134
- visitSafeMethodCall(ast: SafeMethodCall): any {
135
- const methodName = ast.name;
136
- const receiver = ast.receiver.visit(this);
137
- const args = compileToJSON(this.visitAll(ast.args));
138
-
139
- return `${receiver}['${methodName}'].apply(${receiver}, ${args})`;
140
- }
141
-
142
- visitAll(asts: AST[]): any {
143
- return asts.map(ast => ast.visit(this));
144
- }
145
-
146
- visitQuote(ast: Quote): any {
147
- return null;
148
- }
149
- }
@@ -1,208 +0,0 @@
1
- import {
2
- AST,
3
- RecursiveAstVisitor,
4
- PropertyRead,
5
- MethodCall,
6
- KeyedRead,
7
- ImplicitReceiver,
8
- LiteralPrimitive,
9
- Binary,
10
- Chain,
11
- Conditional,
12
- BindingPipe,
13
- FunctionCall,
14
- Interpolation,
15
- KeyedWrite,
16
- LiteralArray,
17
- LiteralMap,
18
- PrefixNot,
19
- PropertyWrite,
20
- SafePropertyRead,
21
- SafeMethodCall,
22
- Quote
23
- } from '../angular';
24
- import * as util from '../util';
25
- import { BinaryOperations } from '../util/binary-operations';
26
-
27
- export class ParseVisitorResolver extends RecursiveAstVisitor {
28
-
29
- constructor(private pipes: Map<string, any>) {
30
- super();
31
- };
32
-
33
- visitBinary(ast: Binary, context: any): any {
34
- const execFn = BinaryOperations.get(ast.operation);
35
-
36
- if (!execFn) {
37
- throw new Error(`Parse ERROR: on visitBinary, unknown operator ${ast.operation}`);
38
- }
39
-
40
- return execFn(ast.left.visit(this, context), ast.right.visit(this, context));
41
- }
42
-
43
- // TODO
44
- visitChain(ast: Chain, context: any): any {
45
- return this.visitAll(ast.expressions, context);
46
- }
47
-
48
- visitConditional(ast: Conditional, context: any): any {
49
- if (ast.condition.visit(this, context)) {
50
- return ast.trueExp.visit(this, context);
51
- }
52
- else if (util.isPresent(ast.falseExp)) {
53
- return ast.falseExp.visit(this, context);
54
- }
55
-
56
- return null;
57
- }
58
-
59
- visitPipe(ast: BindingPipe, context: any): any {
60
- const pipe = this.pipes.get(ast.name);
61
-
62
- if (!pipe) {
63
- throw new Error(`pipe ${ast.name} not found.`);
64
- }
65
-
66
- if (!pipe.transform) {
67
- throw new Error(`Parse ERROR: on visitPipe, transform method doesn't exist on pipe ${ast.name}.`);
68
- }
69
-
70
- const value = ast.exp.visit(this, context);
71
- const pipeArgs = this.visitAll(ast.args, context);
72
-
73
- pipeArgs.unshift(value);
74
-
75
- return pipe.transform.apply(null, pipeArgs);
76
- }
77
-
78
- // TODO
79
- visitFunctionCall(ast: FunctionCall, context: any): any {
80
- const target = ast.target.visit(this, context);
81
-
82
- if (!util.isFunction(target)) {
83
- throw new Error(`Parse ERROR: on visitFunctionCall, target is not a function.`);
84
- }
85
-
86
- const args = this.visitAll(ast.args, context);
87
- return target.apply(target, args);
88
- }
89
-
90
- visitImplicitReceiver(ast: ImplicitReceiver, context: any): any {
91
- return context;
92
- }
93
-
94
- visitInterpolation(ast: Interpolation, context: any): any {
95
- return this.visitAll(ast.expressions, context)[0];
96
- }
97
-
98
- visitKeyedRead(ast: KeyedRead, context: any): any {
99
- const obj = ast.obj.visit(this, context);
100
- const key = ast.key.visit(this, context);
101
- return obj[key];
102
- }
103
-
104
- visitKeyedWrite(ast: KeyedWrite, context: any): any {
105
- const obj = ast.obj.visit(this, context);
106
- const key = ast.key.visit(this, context);
107
- const value = ast.value.visit(this, context);
108
- obj[key] = value;
109
- return null;
110
- }
111
-
112
- visitLiteralArray(ast: LiteralArray, context: any): any {
113
- return this.visitAll(ast.expressions, context);
114
- }
115
-
116
- visitLiteralMap(ast: LiteralMap, context: any): any {
117
- const result = {};
118
- const keys = ast.keys;
119
- const values = this.visitAll(ast.values, context);
120
-
121
- for (let i = 0, length = keys.length; i < length; i++) {
122
- result[keys[i]] = values[i];
123
- }
124
-
125
- return result;
126
- }
127
-
128
- visitLiteralPrimitive(ast: LiteralPrimitive, context: any): any {
129
- return ast.value;
130
- }
131
-
132
- visitMethodCall(ast: MethodCall, context: any): any {
133
- const receiver = ast.receiver.visit(this, context);
134
-
135
- if (!util.isJsObject(receiver)) {
136
- throw new Error(`Parse ERROR: on visitMethodCall, invalid method receiver.`);
137
- }
138
-
139
- const method = receiver[ast.name];
140
-
141
- if (!util.isFunction(method)) {
142
- throw new Error(`Parse ERROR: on visitMethodCall, method ${ast.name} doesn't exist on receiver.`);
143
- }
144
-
145
- const args = this.visitAll(ast.args, context);
146
- return method.apply(receiver, args);
147
- }
148
-
149
- visitPrefixNot(ast: PrefixNot, context: any): any {
150
- return ast.expression.visit(this, context);
151
- }
152
-
153
- visitPropertyRead(ast: PropertyRead, context: any): any {
154
- const receiver = ast.receiver.visit(this, context);
155
-
156
- if (!util.isJsObject(receiver)) {
157
- throw new Error(`Parse ERROR: on visitPropertyRead, invalid property receiver.`);
158
- }
159
-
160
- return receiver[ast.name];
161
- }
162
-
163
- visitPropertyWrite(ast: PropertyWrite, context: any): any {
164
- const receiver = ast.receiver.visit(this, context);
165
-
166
- if (!util.isJsObject(receiver)) {
167
- throw new Error(`Parse ERROR: on visitPropertyRead, invalid property receiver.`);
168
- }
169
-
170
- receiver[ast.name] = ast.value.visit(this, context);
171
- return null;
172
- }
173
-
174
- visitSafePropertyRead(ast: SafePropertyRead, context: any): any {
175
- const receiver = ast.receiver.visit(this, context);
176
-
177
- if (!util.isJsObject(receiver)) {
178
- throw new Error(`Parse ERROR: on visitSafePropertyRead, invalid property receiver.`);
179
- }
180
-
181
- return receiver[ast.name];
182
- }
183
-
184
- visitSafeMethodCall(ast: SafeMethodCall, context: any): any {
185
- const receiver = ast.receiver.visit(this, context);
186
-
187
- if (!util.isJsObject(receiver)) {
188
- throw new Error(`Parse ERROR: on visitSafeMethodCall, invalid method receiver.`);
189
- }
190
-
191
- const method = receiver[ast.name];
192
-
193
- if (!util.isFunction(method)) {
194
- throw new Error(`Parse ERROR: on visitSafeMethodCall, method ${ast.name} doesn't exist on receiver.`);
195
- }
196
-
197
- const args = this.visitAll(ast.args, context);
198
- return method.apply(receiver, args);
199
- }
200
-
201
- visitAll(asts: AST[], context: any): any {
202
- return asts.map(ast => ast.visit(this, context));
203
- }
204
-
205
- visitQuote(ast: Quote, context: any): any {
206
- throw new Error(`Parse ERROR: on visitQuote, quote expression not allowed.`);
207
- }
208
- }
@@ -1,2 +0,0 @@
1
- export * from './visitors/parse-visitor-compiler';
2
- export * from './visitors/parse-visitor-resolver';
@@ -1,5 +0,0 @@
1
- /*
2
- * Public API Surface of angular2parse
3
- */
4
- export * from './lib/module';
5
- export * from './lib/parse'
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../out-tsc/lib",
5
- "declarationMap": true,
6
- "target": "es2015",
7
- "declaration": true,
8
- "inlineSources": true,
9
- "types": [],
10
- "lib": [
11
- "es2018",
12
- "dom"
13
- ]
14
- },
15
- "angularCompilerOptions": {
16
- "skipTemplateCodegen": true,
17
- "strictMetadataEmit": true,
18
- "enableResourceInlining": true
19
- }
20
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.lib.json",
3
- "compilerOptions": {
4
- "declarationMap": false
5
- },
6
- "angularCompilerOptions": {
7
- "compilationMode": "partial"
8
- }
9
- }
@@ -1 +0,0 @@
1
- {"version":"2.0.3","name":"@auscope/angular2parse","dependencies":{"@angular/common":{"version":"13.3.0"},"@angular/compiler":{"version":"13.3.0"},"@angular/core":{"version":"13.3.0"},"@angular/localize":{"version":"13.3.0"},"@angular/platform-browser-dynamic":{"version":"13.3.0"},"@angular/platform-browser":{"version":"13.3.0"},"@auscope/angular2parse":{"version":"2.0.2"},"rxjs":{"version":"6.5.5"},"tslib":{"version":"2.3.1"},"zone.js":{"version":"0.11.5"}}}
package/tsconfig.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "compileOnSave": false,
3
- "compilerOptions": {
4
- "baseUrl": "./",
5
- "outDir": "./dist/out-tsc",
6
- "sourceMap": true,
7
- "declaration": false,
8
- "downlevelIteration": true,
9
- "experimentalDecorators": true,
10
- "module": "esnext",
11
- "moduleResolution": "node",
12
- "importHelpers": true,
13
- "target": "es2015",
14
- "typeRoots": [
15
- "node_modules/@types"
16
- ],
17
- "lib": [
18
- "es2018",
19
- "dom"
20
- ],
21
- "paths": {
22
- "angular2parse": [
23
- "dist/angular2parse/angular2parse",
24
- "dist/angular2parse"
25
- ]
26
- }
27
- },
28
- "angularCompilerOptions": {
29
- "fullTemplateTypeCheck": true,
30
- "strictInjectionParameters": true
31
- }
32
- }