@playcanvas/attribute-parser 1.6.1 → 1.7.1

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 (78) hide show
  1. package/LICENSE.md +19 -0
  2. package/dist/index.js +445 -0
  3. package/dist/libs.d.ts +50978 -0
  4. package/package.json +50 -10
  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/index.js +0 -273
  17. package/src/parsers/attribute-parser.js +0 -197
  18. package/src/parsers/parsing-error.js +0 -14
  19. package/src/parsers/script-parser.js +0 -432
  20. package/src/utils/attribute-utils.js +0 -53
  21. package/src/utils/tag-utils.js +0 -73
  22. package/src/utils/ts-utils.js +0 -634
  23. package/test/fixtures/asset.invalid.js +0 -27
  24. package/test/fixtures/asset.invalid.ts +0 -24
  25. package/test/fixtures/asset.valid.js +0 -26
  26. package/test/fixtures/asset.valid.ts +0 -21
  27. package/test/fixtures/checkbox.valid.js +0 -23
  28. package/test/fixtures/color.valid.js +0 -23
  29. package/test/fixtures/conditional.valid.js +0 -22
  30. package/test/fixtures/curve.invalid.js +0 -29
  31. package/test/fixtures/curve.valid.js +0 -49
  32. package/test/fixtures/empty.valid.js +0 -0
  33. package/test/fixtures/entity.valid.js +0 -23
  34. package/test/fixtures/enum.valid.js +0 -66
  35. package/test/fixtures/enum.valid.ts +0 -50
  36. package/test/fixtures/example.dep.js +0 -9
  37. package/test/fixtures/export.import.js +0 -8
  38. package/test/fixtures/export.valid.js +0 -26
  39. package/test/fixtures/inherit.valid.js +0 -45
  40. package/test/fixtures/intellisense.valid.js +0 -40
  41. package/test/fixtures/json.invalid.js +0 -23
  42. package/test/fixtures/json.valid.js +0 -115
  43. package/test/fixtures/json.valid.ts +0 -81
  44. package/test/fixtures/misc.invalid.js +0 -24
  45. package/test/fixtures/misc.valid.js +0 -51
  46. package/test/fixtures/numeric.invalid.js +0 -38
  47. package/test/fixtures/numeric.valid.js +0 -63
  48. package/test/fixtures/playcanvas.d.ts +0 -47963
  49. package/test/fixtures/program.invalid.js +0 -12
  50. package/test/fixtures/program.valid.js +0 -27
  51. package/test/fixtures/text.valid.js +0 -31
  52. package/test/fixtures/vector.invalid.js +0 -14
  53. package/test/fixtures/vector.valid.js +0 -24
  54. package/test/tests/invalid/asset.test.js +0 -47
  55. package/test/tests/invalid/curve.test.js +0 -23
  56. package/test/tests/invalid/json.test.js +0 -27
  57. package/test/tests/invalid/misc.test.js +0 -41
  58. package/test/tests/invalid/numeric.test.js +0 -55
  59. package/test/tests/invalid/program.test.js +0 -17
  60. package/test/tests/invalid/vector.test.js +0 -28
  61. package/test/tests/valid/asset.test.js +0 -59
  62. package/test/tests/valid/checkbox.test.js +0 -57
  63. package/test/tests/valid/color.test.js +0 -49
  64. package/test/tests/valid/conditional.test.js +0 -45
  65. package/test/tests/valid/curve.test.js +0 -76
  66. package/test/tests/valid/empty.test.js +0 -17
  67. package/test/tests/valid/entity.test.js +0 -49
  68. package/test/tests/valid/enum.test.js +0 -79
  69. package/test/tests/valid/export.test.js +0 -67
  70. package/test/tests/valid/inherit.test.js +0 -110
  71. package/test/tests/valid/intellisense.test.js +0 -39
  72. package/test/tests/valid/json.test.js +0 -315
  73. package/test/tests/valid/misc.test.js +0 -54
  74. package/test/tests/valid/numeric.test.js +0 -103
  75. package/test/tests/valid/program.test.js +0 -23
  76. package/test/tests/valid/text.test.js +0 -58
  77. package/test/tests/valid/vector.test.js +0 -53
  78. package/test/utils.js +0 -54
@@ -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 };