@playcanvas/attribute-parser 1.10.2 → 1.11.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.
package/README.md CHANGED
@@ -19,52 +19,51 @@ Given a script like this:
19
19
 
20
20
  ```javascript
21
21
  class Rotator extends ScriptType {
22
- /**
23
- * @attribute
24
- * Speed determines how fast to rotate things
25
- */
26
- speed = new Vec3();
27
-
28
- /**
29
- * @attribute
30
- * An array of Entities to rotate
31
- *
32
- * @type {Entity[]}
33
- */
34
- thingsToRotate;
22
+ /**
23
+ * @attribute
24
+ * Speed determines how fast to rotate things
25
+ */
26
+ speed = new Vec3();
27
+
28
+ /**
29
+ * @attribute
30
+ * An array of Entities to rotate
31
+ *
32
+ * @type {Entity[]}
33
+ */
34
+ thingsToRotate;
35
35
  }
36
36
  ```
37
37
 
38
38
  The parser outputs:
39
39
 
40
-
41
40
  ```json
42
41
  {
43
- "rotator": {
44
- "attributes": {
45
- "speed": {
46
- "type": "vec3",
47
- "name": "speed",
48
- "array": false,
49
- "description": "Speed determines how fast to rotate things",
50
- "default": [0, 0, 0]
51
- },
52
- "thingsToRotate": {
53
- "type": "entity",
54
- "name": "thingsToRotate",
55
- "array": true,
56
- "description": "An array of Entities to rotate",
57
- "default": null
58
- }
59
- },
60
- "errors": []
61
- }
42
+ "rotator": {
43
+ "attributes": {
44
+ "speed": {
45
+ "type": "vec3",
46
+ "name": "speed",
47
+ "array": false,
48
+ "description": "Speed determines how fast to rotate things",
49
+ "default": [0, 0, 0]
50
+ },
51
+ "thingsToRotate": {
52
+ "type": "entity",
53
+ "name": "thingsToRotate",
54
+ "array": true,
55
+ "description": "An array of Entities to rotate",
56
+ "default": null
57
+ }
58
+ },
59
+ "errors": []
60
+ }
62
61
  }
63
62
  ```
64
63
 
65
64
  JSDocs tags are parsed and values and outputs the metadata in a serializable format.
66
65
 
67
- ### Usage
66
+ ### Usage
68
67
 
69
68
  ```javascript
70
69
  // Initialise the parser
@@ -79,7 +78,7 @@ const scripts = await fetchScripts([...paths, './playcanvas.d.ts']);
79
78
  parser.updateProgram(scripts);
80
79
 
81
80
  // Parse attributes from the entry point
82
- const [attributes, errors] = parser.parseAttributes("./index.js");
81
+ const [attributes, errors] = parser.parseAttributes('./index.js');
83
82
  ```
84
83
 
85
84
  ### Attribute structure
@@ -89,5 +88,3 @@ See the [test fixtures](https://github.com/playcanvas/attribute-parser/tree/main
89
88
  ### Tests
90
89
 
91
90
  This project includes good test coverage for all supported tag formats and edge cases.
92
-
93
-