@angular-wave/angular.ts 0.4.0 → 0.4.2
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.
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-queue.js +5 -4
- package/src/animations/shared.js +3 -3
- package/src/core/compile/compile.js +1 -1
- package/src/core/interpolate/interpolate.js +35 -28
- package/src/core/{parser/lexer.html → parse/ast/ast.html} +1 -1
- package/src/core/{parser → parse/ast}/ast.js +43 -29
- package/src/core/parse/ast/ast.spec.js +1462 -0
- package/src/core/parse/ast/ast.test.js +10 -0
- package/src/core/{parser → parse}/interpreter.js +10 -10
- package/src/core/parse/lexer/lexer.html +18 -0
- package/src/core/{parser → parse/lexer}/lexer.js +1 -1
- package/src/core/{parser → parse/lexer}/lexer.spec.js +2 -2
- package/src/core/parse/lexer/lexer.test.js +10 -0
- package/src/core/{parser → parse}/parse.html +1 -1
- package/src/core/{parser → parse}/parse.js +5 -5
- package/src/core/{parser → parse}/parse.spec.js +6 -1725
- package/src/core/parse/parse.test.js +10 -0
- package/src/core/parse/parser/parser.html +18 -0
- package/src/core/{parser → parse/parser}/parser.js +6 -6
- package/src/core/parse/parser/parser.spec.js +8 -0
- package/src/core/parse/parser/parser.test.js +10 -0
- package/src/core/scope/scope.js +5 -6
- package/src/directive/class/class.js +1 -1
- package/src/directive/model/model.js +2 -2
- package/src/directive/validators/validators.js +3 -3
- package/src/public.js +1 -1
- package/types/animations/shared.d.ts +1 -1
- package/types/core/compile/compile.d.ts +1 -1
- package/types/core/interpolate/interpolate.d.ts +7 -4
- package/types/core/{parser → parse/ast}/ast.d.ts +17 -17
- package/types/core/{parser → parse}/interpreter.d.ts +7 -7
- package/types/core/{parser → parse/parser}/parser.d.ts +8 -8
- package/types/core/scope/scope.d.ts +3 -3
- package/types/directive/class/class.d.ts +3 -3
- package/types/directive/model/model.d.ts +6 -6
- package/types/directive/validators/validators.d.ts +3 -3
- package/src/core/parser/parser.test.js +0 -19
- /package/src/core/{parser → parse}/ast-type.js +0 -0
- /package/src/core/{parser → parse}/parse.md +0 -0
- /package/types/core/{parser → parse}/ast-type.d.ts +0 -0
- /package/types/core/{parser → parse/lexer}/lexer.d.ts +0 -0
- /package/types/core/{parser → parse}/parse.d.ts +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("lexer unit tests contain no errors", async ({ page }) => {
|
|
4
|
+
await page.goto("src/core/parse/ast/ast.html");
|
|
5
|
+
await page.content();
|
|
6
|
+
await page.waitForTimeout(100);
|
|
7
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
8
|
+
/0 failures/,
|
|
9
|
+
);
|
|
10
|
+
});
|
|
@@ -14,12 +14,12 @@ export class ASTInterpreter {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Compiles the AST into a function.
|
|
17
|
-
* @param {import("./ast").ASTNode} ast - The AST to compile.
|
|
17
|
+
* @param {import("./ast/ast").ASTNode} ast - The AST to compile.
|
|
18
18
|
* @returns {import("./parse").CompiledExpression}
|
|
19
19
|
*/
|
|
20
20
|
compile(ast) {
|
|
21
21
|
let decoratedNode = findConstantAndWatchExpressions(ast, this.$filter);
|
|
22
|
-
/** @type {import("./ast").ASTNode} */
|
|
22
|
+
/** @type {import("./ast/ast").ASTNode} */
|
|
23
23
|
let assignable;
|
|
24
24
|
/** @type {import("./parse").CompiledExpression} */
|
|
25
25
|
let assign;
|
|
@@ -71,7 +71,7 @@ export class ASTInterpreter {
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Recurses the AST nodes.
|
|
74
|
-
* @param {import("./ast").ASTNode} ast - The AST node.
|
|
74
|
+
* @param {import("./ast/ast").ASTNode} ast - The AST node.
|
|
75
75
|
* @param {Object} [context] - The context.
|
|
76
76
|
* @param {boolean|1} [create] - The create flag.
|
|
77
77
|
* @returns {import("./parse").CompiledExpressionFunction} The recursive function.
|
|
@@ -585,7 +585,7 @@ export class ASTInterpreter {
|
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
/**
|
|
588
|
-
* @typedef {import("./ast").ASTNode & {
|
|
588
|
+
* @typedef {import("./ast/ast").ASTNode & {
|
|
589
589
|
* isPure: boolean|number,
|
|
590
590
|
* constant: boolean,
|
|
591
591
|
* toWatch: Array,
|
|
@@ -594,7 +594,7 @@ export class ASTInterpreter {
|
|
|
594
594
|
|
|
595
595
|
/**
|
|
596
596
|
* Decorates AST with constant, toWatch, and isPure properties
|
|
597
|
-
* @param {import("./ast").ASTNode} ast
|
|
597
|
+
* @param {import("./ast/ast").ASTNode} ast
|
|
598
598
|
* @param {function(any):any} $filter
|
|
599
599
|
* @param {boolean|1|2} [parentIsPure]
|
|
600
600
|
* @returns {DecoratedASTNode}
|
|
@@ -795,8 +795,8 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
|
|
|
795
795
|
/**
|
|
796
796
|
* Converts a single expression AST node into an assignment expression if the expression is assignable.
|
|
797
797
|
*
|
|
798
|
-
* @param {import("./ast").ASTNode} ast
|
|
799
|
-
* @returns {import("./ast").ASTNode}
|
|
798
|
+
* @param {import("./ast/ast").ASTNode} ast
|
|
799
|
+
* @returns {import("./ast/ast").ASTNode}
|
|
800
800
|
*/
|
|
801
801
|
function assignableAST(ast) {
|
|
802
802
|
if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
|
|
@@ -817,7 +817,7 @@ function plusFn(l, r) {
|
|
|
817
817
|
|
|
818
818
|
/**
|
|
819
819
|
*
|
|
820
|
-
* @param {import("./ast").ASTNode[]} body
|
|
820
|
+
* @param {import("./ast/ast").ASTNode[]} body
|
|
821
821
|
* @returns {any}
|
|
822
822
|
*/
|
|
823
823
|
function getInputs(body) {
|
|
@@ -830,7 +830,7 @@ function getInputs(body) {
|
|
|
830
830
|
|
|
831
831
|
/**
|
|
832
832
|
* Detect nodes which could depend on non-shallow state of objects
|
|
833
|
-
* @param {import("./ast").ASTNode} node
|
|
833
|
+
* @param {import("./ast/ast").ASTNode} node
|
|
834
834
|
* @param {boolean|PURITY_ABSOLUTE|PURITY_RELATIVE} parentIsPure
|
|
835
835
|
* @returns {boolean|PURITY_ABSOLUTE|PURITY_RELATIVE}
|
|
836
836
|
*/
|
|
@@ -877,7 +877,7 @@ function getStringValue(name) {
|
|
|
877
877
|
}
|
|
878
878
|
|
|
879
879
|
/**
|
|
880
|
-
* @param {import("./ast").ASTNode} ast
|
|
880
|
+
* @param {import("./ast/ast").ASTNode} ast
|
|
881
881
|
* @returns {boolean}
|
|
882
882
|
*/
|
|
883
883
|
export function isAssignable(ast) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS Test Runner</title>
|
|
6
|
+
|
|
7
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
|
+
<link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
|
|
9
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
|
|
10
|
+
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
|
+
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
|
+
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
+
<script type="module" src="/src/core/parse/lexer/lexer.spec.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="dummy"></div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Lexer } from "./lexer";
|
|
2
|
-
import { Angular } from "
|
|
3
|
-
import { createInjector } from "
|
|
2
|
+
import { Angular } from "../../../loader";
|
|
3
|
+
import { createInjector } from "../../di/injector";
|
|
4
4
|
|
|
5
5
|
describe("lexer", () => {
|
|
6
6
|
let $rootScope;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { test, expect } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("lexer unit tests contain no errors", async ({ page }) => {
|
|
4
|
+
await page.goto("src/core/parse/lexer/lexer.html");
|
|
5
|
+
await page.content();
|
|
6
|
+
await page.waitForTimeout(100);
|
|
7
|
+
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
8
|
+
/0 failures/,
|
|
9
|
+
);
|
|
10
|
+
});
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
11
|
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
-
<script type="module" src="/src/core/
|
|
13
|
+
<script type="module" src="/src/core/parse/parse.spec.js"></script>
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="dummy"></div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { forEach, isDefined, isFunction } from "../../shared/utils";
|
|
2
|
-
import { PURITY_RELATIVE } from "./interpreter";
|
|
3
|
-
import { Lexer } from "./lexer";
|
|
4
|
-
import { Parser } from "./parser";
|
|
1
|
+
import { forEach, isDefined, isFunction } from "../../shared/utils.js";
|
|
2
|
+
import { PURITY_RELATIVE } from "./interpreter.js";
|
|
3
|
+
import { Lexer } from "./lexer/lexer.js";
|
|
4
|
+
import { Parser } from "./parser/parser.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} CompiledExpressionProps
|
|
@@ -76,7 +76,7 @@ export function ParseProvider() {
|
|
|
76
76
|
* @returns {ParseService}
|
|
77
77
|
*/
|
|
78
78
|
function ($filter) {
|
|
79
|
-
/** @type {import("./lexer").LexerOptions} */
|
|
79
|
+
/** @type {import("./lexer/lexer.js").LexerOptions} */
|
|
80
80
|
var $lexerOptions = {
|
|
81
81
|
isIdentifierStart: isFunction(identStart) && identStart,
|
|
82
82
|
isIdentifierContinue: isFunction(identContinue) && identContinue,
|