@playcanvas/attribute-parser 1.6.1 → 1.7.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 (77) hide show
  1. package/LICENSE.md +19 -0
  2. package/dist/index.js +194566 -0
  3. package/dist/libs.d.ts +50978 -0
  4. package/package.json +49 -9
  5. package/types/index.d.ts +55 -0
  6. package/types/parsers/attribute-parser.d.ts +55 -0
  7. package/types/parsers/parsing-error.d.ts +6 -0
  8. package/types/parsers/script-parser.d.ts +124 -0
  9. package/types/utils/attribute-utils.d.ts +5 -0
  10. package/{src/utils/generic-utils.js → types/utils/generic-utils.d.ts} +1 -10
  11. package/types/utils/tag-utils.d.ts +16 -0
  12. package/types/utils/ts-utils.d.ts +103 -0
  13. package/.github/workflows/ci.yml +0 -49
  14. package/eslint.config.mjs +0 -35
  15. package/renovate.json +0 -25
  16. package/src/parsers/attribute-parser.js +0 -197
  17. package/src/parsers/parsing-error.js +0 -14
  18. package/src/parsers/script-parser.js +0 -432
  19. package/src/utils/attribute-utils.js +0 -53
  20. package/src/utils/tag-utils.js +0 -73
  21. package/src/utils/ts-utils.js +0 -634
  22. package/test/fixtures/asset.invalid.js +0 -27
  23. package/test/fixtures/asset.invalid.ts +0 -24
  24. package/test/fixtures/asset.valid.js +0 -26
  25. package/test/fixtures/asset.valid.ts +0 -21
  26. package/test/fixtures/checkbox.valid.js +0 -23
  27. package/test/fixtures/color.valid.js +0 -23
  28. package/test/fixtures/conditional.valid.js +0 -22
  29. package/test/fixtures/curve.invalid.js +0 -29
  30. package/test/fixtures/curve.valid.js +0 -49
  31. package/test/fixtures/empty.valid.js +0 -0
  32. package/test/fixtures/entity.valid.js +0 -23
  33. package/test/fixtures/enum.valid.js +0 -66
  34. package/test/fixtures/enum.valid.ts +0 -50
  35. package/test/fixtures/example.dep.js +0 -9
  36. package/test/fixtures/export.import.js +0 -8
  37. package/test/fixtures/export.valid.js +0 -26
  38. package/test/fixtures/inherit.valid.js +0 -45
  39. package/test/fixtures/intellisense.valid.js +0 -40
  40. package/test/fixtures/json.invalid.js +0 -23
  41. package/test/fixtures/json.valid.js +0 -115
  42. package/test/fixtures/json.valid.ts +0 -81
  43. package/test/fixtures/misc.invalid.js +0 -24
  44. package/test/fixtures/misc.valid.js +0 -51
  45. package/test/fixtures/numeric.invalid.js +0 -38
  46. package/test/fixtures/numeric.valid.js +0 -63
  47. package/test/fixtures/playcanvas.d.ts +0 -47963
  48. package/test/fixtures/program.invalid.js +0 -12
  49. package/test/fixtures/program.valid.js +0 -27
  50. package/test/fixtures/text.valid.js +0 -31
  51. package/test/fixtures/vector.invalid.js +0 -14
  52. package/test/fixtures/vector.valid.js +0 -24
  53. package/test/tests/invalid/asset.test.js +0 -47
  54. package/test/tests/invalid/curve.test.js +0 -23
  55. package/test/tests/invalid/json.test.js +0 -27
  56. package/test/tests/invalid/misc.test.js +0 -41
  57. package/test/tests/invalid/numeric.test.js +0 -55
  58. package/test/tests/invalid/program.test.js +0 -17
  59. package/test/tests/invalid/vector.test.js +0 -28
  60. package/test/tests/valid/asset.test.js +0 -59
  61. package/test/tests/valid/checkbox.test.js +0 -57
  62. package/test/tests/valid/color.test.js +0 -49
  63. package/test/tests/valid/conditional.test.js +0 -45
  64. package/test/tests/valid/curve.test.js +0 -76
  65. package/test/tests/valid/empty.test.js +0 -17
  66. package/test/tests/valid/entity.test.js +0 -49
  67. package/test/tests/valid/enum.test.js +0 -79
  68. package/test/tests/valid/export.test.js +0 -67
  69. package/test/tests/valid/inherit.test.js +0 -110
  70. package/test/tests/valid/intellisense.test.js +0 -39
  71. package/test/tests/valid/json.test.js +0 -315
  72. package/test/tests/valid/misc.test.js +0 -54
  73. package/test/tests/valid/numeric.test.js +0 -103
  74. package/test/tests/valid/program.test.js +0 -23
  75. package/test/tests/valid/text.test.js +0 -58
  76. package/test/tests/valid/vector.test.js +0 -53
  77. package/test/utils.js +0 -54
@@ -1,81 +0,0 @@
1
- import { Script, Vec3 } from 'playcanvas';
2
-
3
- interface Folder {
4
- /**
5
- * This is some description of the attribute.
6
- * @attribute
7
- */
8
- a: boolean;
9
-
10
- /**
11
- * @attribute
12
- * @default 10
13
- * @range [10, 20]
14
- */
15
- b: number;
16
-
17
- /**
18
- * @attribute
19
- * @default hello
20
- */
21
- c : string;
22
-
23
- /**
24
- * @attribute
25
- */
26
- d : Vec3[];
27
- }
28
-
29
- interface NestedFolder {
30
- /**
31
- * @attribute
32
- */
33
- x : Folder;
34
- }
35
-
36
- /**
37
- * @interface
38
- */
39
- class Example extends Script {
40
- /**
41
- * @attribute
42
- */
43
- f : Folder;
44
-
45
- /**
46
- * @attribute
47
- * @size 2
48
- */
49
- g : Folder[];
50
-
51
- /**
52
- * @attribute
53
- */
54
- h : NestedFolder;
55
-
56
- /**
57
- * @attribute
58
- */
59
- i = {
60
- /** description of a */
61
- a: true,
62
- /** @range [10, 20] */
63
- b: 10,
64
- c: 'hello',
65
- d: [new Vec3(1, 2, 3)]
66
- };
67
-
68
- /**
69
- * @attribute
70
- */
71
- l : { x: number, y: number };
72
-
73
- /**
74
- * @attribute
75
- */
76
- m : Example;
77
-
78
- n = 10;
79
- }
80
-
81
- export { Example };
@@ -1,24 +0,0 @@
1
- import { Script, GraphNode } from 'playcanvas';
2
-
3
- class Vec3 {}
4
-
5
- class Example extends Script {
6
- /**
7
- * @attribute
8
- */
9
- e = new GraphNode();
10
-
11
- /**
12
- * @attribute
13
- */
14
- f = new Vec3(); // Vec3 is not from playcanvas. It's type cannot be inferred
15
-
16
- /**
17
- * @attribute
18
- * @type {number[]}
19
- * @size a
20
- */
21
- g;
22
- }
23
-
24
- export { Example };
@@ -1,51 +0,0 @@
1
- import { Script } from 'playcanvas';
2
-
3
- class Example extends Script {
4
- /**
5
- * This is a description of the attribute. It can be multi-sentence.
6
- *
7
- * And multi-line too
8
- *
9
- * @attribute
10
- * @type {number}
11
- * @title A number
12
- */
13
- a;
14
-
15
- _b = 10;
16
-
17
- _d = 10;
18
-
19
- /**
20
- * @attribute
21
- * @type {number}
22
- */
23
- set b(v) {
24
- this._b = v;
25
- }
26
-
27
- get b() {
28
- return this._b;
29
- }
30
-
31
- /**
32
- * @type {number}
33
- */
34
- c;
35
-
36
- /**
37
- * Reverse order gett/setter accessor
38
- * @attribute
39
- * @type {number}
40
- */
41
- get d() {
42
- return this._d;
43
- }
44
-
45
- // eslint-disable-next-line grouped-accessor-pairs
46
- set d(v) {
47
- this._d = v;
48
- }
49
- }
50
-
51
- export { Example };
@@ -1,38 +0,0 @@
1
- import { Script } from 'playcanvas';
2
-
3
- class Example extends Script {
4
- /**
5
- * @attribute
6
- * @range ['a', 'b']
7
- */
8
- a = 0;
9
-
10
- /**
11
- * @attribute
12
- * @step 0.1
13
- */
14
- b;
15
-
16
- /**
17
- * @attribute
18
- * @precision 2
19
- */
20
- c;
21
-
22
- /**
23
- * @attribute
24
- * @type {number}
25
- * @step a
26
- * @precision b
27
- */
28
- d;
29
-
30
- /**
31
- * @attribute
32
- * @type {number}
33
- * @step
34
- */
35
- e;
36
- }
37
-
38
- export { Example };
@@ -1,63 +0,0 @@
1
- import { Script } from 'playcanvas';
2
-
3
- class Example extends Script {
4
- /**
5
- * @attribute
6
- * @type {number}
7
- */
8
- a;
9
-
10
- /**
11
- * @attribute
12
- */
13
- b = 1;
14
-
15
- /**
16
- * @attribute
17
- * @type {number}
18
- * @precision 2
19
- * @step 0.01
20
- */
21
- c;
22
-
23
- /**
24
- * @attribute
25
- * @type {number}
26
- * @range [0, 1]
27
- * @precision 2
28
- * @step 0.01
29
- */
30
- d;
31
-
32
- /**
33
- * @attribute
34
- * @type {number[]}
35
- * @size 2
36
- */
37
- e;
38
-
39
- /**
40
- * @attribute
41
- * @type {number}
42
- * @range [ - 0xFF, 0o0 ]
43
- * @precision 0b10
44
- * @step 1e-2
45
- */
46
- f;
47
-
48
- /**
49
- * @attribute
50
- * @type {number}
51
- * @range [1]
52
- */
53
- g;
54
-
55
- /**
56
- * @attribute
57
- * @type {number}
58
- * @range []
59
- */
60
- h;
61
- }
62
-
63
- export { Example };