@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
package/package.json CHANGED
@@ -1,27 +1,67 @@
1
1
  {
2
2
  "name": "@playcanvas/attribute-parser",
3
+ "version": "1.7.0",
4
+ "author": "PlayCanvas <support@playcanvas.com>",
5
+ "homepage": "https://github.com/playcanvas/attribute-parser#readme",
6
+ "description": "The PlayCanvas Attribute Parser",
7
+ "keywords": [
8
+ "playcanvas",
9
+ "attribute",
10
+ "parser"
11
+ ],
12
+ "license": "MIT",
3
13
  "type": "module",
4
14
  "main": "src/index.js",
5
- "engines": {
6
- "node": ">=18.0.0"
15
+ "types": "types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ },
21
+ "./libs": "./dist/libs.d.ts"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/playcanvas/attribute-parser/issues"
7
25
  },
8
- "version": "1.6.1",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/playcanvas/attribute-parser.git"
29
+ },
30
+ "files": [
31
+ "dist/index.js",
32
+ "dist/libs.d.ts",
33
+ "types",
34
+ "README.md",
35
+ "LICENSE.md"
36
+ ],
9
37
  "dependencies": {
10
- "@playcanvas/eslint-config": "^1.7.4 || ^2.0.0",
38
+ "@playcanvas/eslint-config": "^2.0.0",
11
39
  "@typescript/vfs": "^1.6.0",
12
- "eslint": "^8.56.0 || ^9.0.0",
40
+ "eslint": "^9.0.0",
13
41
  "typescript": "^5.5.3"
14
42
  },
15
43
  "devDependencies": {
44
+ "@rollup/plugin-commonjs": "28.0.1",
45
+ "@rollup/plugin-node-resolve": "15.3.0",
46
+ "@rollup/plugin-swc": "0.4.0",
47
+ "@swc/core": "1.9.2",
16
48
  "chai": "5.1.2",
17
49
  "globals": "15.14.0",
18
- "mocha": "11.1.0"
50
+ "mocha": "11.1.0",
51
+ "rollup": "4.25.0",
52
+ "publint": "^0.3.2"
19
53
  },
20
54
  "scripts": {
21
55
  "test": "mocha test/**/*.test.js --timeout 10000",
22
- "lint": "eslint ."
56
+ "build": "rollup -c",
57
+ "build:types": "tsc -p tsconfig.build.json",
58
+ "watch": "rollup -c -w",
59
+ "lint": "eslint src rollup.config.mjs",
60
+ "lint:fix": "eslint src rollup.config.mjs --fix",
61
+ "type:check": "tsc --noEmit",
62
+ "publint": "publint"
23
63
  },
24
- "publishConfig": {
25
- "access": "public"
64
+ "engines": {
65
+ "node": ">=18.0.0"
26
66
  }
27
67
  }
@@ -0,0 +1,55 @@
1
+ export class JSDocParser {
2
+ /**
3
+ * @type {import('@typescript/vfs').VirtualTypeScriptEnvironment}
4
+ * @private
5
+ */
6
+ private _env;
7
+ /**
8
+ * An internal array of program errors
9
+ * @private
10
+ */
11
+ private _errors;
12
+ /**
13
+ * Initializes the JSDocParser with the standard library files
14
+ *
15
+ * @param {string} libPath - A path to a directory of library types, or a path to the '.d.ts' file itself
16
+ * @returns {Promise<JSDocParser>} - The initialized JSDocParser
17
+ */
18
+ init(libPath: string): Promise<JSDocParser>;
19
+ /**
20
+ * Creates program from fileName and scriptsContents
21
+ *
22
+ * @param {[string, string][]} newFiles - An array of {[path]: [content]} which represent the files in the program
23
+ * @param {string[]} removedFiles - An array of file paths that should be removed from the program
24
+ * @returns {{ parser: ScriptParser, program: ts.Program,
25
+ * errors: import('./parsers/script-parser.js').ValidationError[]}} - The extracted attributes
26
+ */
27
+ updateProgram(newFiles?: [string, string][], removedFiles?: string[]): {
28
+ parser: ScriptParser;
29
+ program: ts.Program;
30
+ errors: import("./parsers/script-parser.js").ValidationError[];
31
+ };
32
+ parser: ScriptParser;
33
+ program: ts.Program;
34
+ /**
35
+ * Returns all the valid ESM Scripts within a file
36
+ * @param {string} fileName - The file name in the program to check
37
+ * @returns {Map<string, import('typescript').Node>} - A map of valid ESM Script <names, nodes> within the file
38
+ */
39
+ getAllEsmScripts(fileName: string): Map<string, import("typescript").Node>;
40
+ /**
41
+ * Analyzes the specified TypeScript file and extracts metadata from JSDoc comments.
42
+ *
43
+ * @param {string} fileName - The name of the file in the program to run
44
+ * @returns {[results: object, errors: import('./parsers/script-parser.js').ValidationError[]]} - The extracted attributes
45
+ */
46
+ parseAttributes(fileName: string): [results: object, errors: import("./parsers/script-parser.js").ValidationError[]];
47
+ /**
48
+ * Analyzes the specified TypeScript file and extracts metadata from JSDoc comments.
49
+ * @param {string} fileName - The name of the file to run
50
+ * @returns {[results: object, errors: import('./parsers/script-parser.js').ValidationError[]]} - The extracted attributes
51
+ */
52
+ getAttributes(fileName: string): [results: object, errors: import("./parsers/script-parser.js").ValidationError[]];
53
+ }
54
+ import { ScriptParser } from './parsers/script-parser.js';
55
+ import * as ts from 'typescript';
@@ -0,0 +1,55 @@
1
+ /**
2
+ * A class to parse JSDoc comments and extract attribute metadata.
3
+ */
4
+ export class AttributeParser {
5
+ /**
6
+ * Creates a new instance of the ScriptParser class.
7
+ *
8
+ * @param {Map<string, string>} tags - An set of tag definitions and their validators to add to the parser
9
+ * @param {object} env - The TypeScript environment to use
10
+ * @param {Map<string, Function>} typeSerializerMap - A map of custom serializers
11
+ */
12
+ constructor(tags: Map<string, string>, env: object, typeSerializerMap: Map<string, Function>);
13
+ env: any;
14
+ tagTypeAnnotations: Map<string, string>;
15
+ typeSerializerMap: Map<string, Function>;
16
+ program: any;
17
+ typeChecker: any;
18
+ /**
19
+ * Parses a JSdoc comment and extracts any associated metadata if the `@attribute`
20
+ * modifier is used. Returns null if this is not an attribute comment.
21
+ *
22
+ * @param {ts.Node} node - The node to parse
23
+ * @param {ParsingError[]} errors - An array to store any parsing errors
24
+ * @param {boolean} requiresAttributeTag - Whether the comment must have an attribute tag
25
+ * @returns {*} - The extracted metadata or null if no metadata was found
26
+ */
27
+ parseAttributeComment(node: ts.Node, errors?: ParsingError[], requiresAttributeTag?: boolean): any;
28
+ /**
29
+ * Extract the public members and their values from a TypeScript node.
30
+ *
31
+ * @param {ts.Node} node - The node to parse
32
+ * @param {ParsingError[]} errors - An array to store any parsing errors
33
+ * @returns {*} - The extracted members
34
+ */
35
+ getNodeAsAttribute(node: ts.Node, errors?: ParsingError[]): any;
36
+ /**
37
+ * Extracts the members of an enum from a TypeScript node.
38
+ *
39
+ * @param {import('typescript').Node} node - The TypeScript node to analyze
40
+ * @param {ParsingError[]} errors - An array to store any parsing errors
41
+ * @returns {Object<string, *>[]} - An array of enum members
42
+ */
43
+ getEnumMembers(node: import("typescript").Node, errors: ParsingError[]): {
44
+ [x: string]: any;
45
+ }[];
46
+ /**
47
+ * Extract the public members and their values from a TypeScript node.
48
+ *
49
+ * @param {ts.Node} node - The node to parse
50
+ * @returns {any[]} - The extracted members
51
+ */
52
+ getMembers(node: ts.Node): any[];
53
+ }
54
+ import * as ts from 'typescript';
55
+ import { ParsingError } from './parsing-error.js';
@@ -0,0 +1,6 @@
1
+ export class ParsingError {
2
+ constructor(node: any, message: any);
3
+ node: any;
4
+ message: any;
5
+ toString(): string;
6
+ }
@@ -0,0 +1,124 @@
1
+ /**
2
+ * A class to parse ESM Scripts and extract attribute metadata from JSDoc comments.
3
+ * This class uses the TypeScript compiler API to parse the script and extract the metadata.
4
+ */
5
+ export class ScriptParser {
6
+ /**
7
+ * @param {import('@typescript/vfs').VirtualTypeScriptEnvironment} env - The TypeScript virtual environment
8
+ * @param {number} [maxDepth] - The maximum recursion depth
9
+ */
10
+ constructor(env: import("@typescript/vfs").VirtualTypeScriptEnvironment, maxDepth?: number);
11
+ env: import("@typescript/vfs").VirtualTypeScriptEnvironment;
12
+ program: ts.Program;
13
+ typeChecker: ts.TypeChecker;
14
+ maxDepth: number;
15
+ typeSerializerMap: Map<any, any>;
16
+ allSupportedTypesSet: Set<ts.Type>;
17
+ attributeParser: AttributeParser;
18
+ /**
19
+ * Checks a program for compile errors and returns a list of formatted error messages.
20
+ * @param {ValidationError[]} errors - The array to store error messages
21
+ * @returns {boolean} - True if the program has no errors, false otherwise
22
+ */
23
+ validateProgram(errors?: ValidationError[]): boolean;
24
+ /**
25
+ * @typedef {Object} ParserOptions
26
+ * @property {object} [attributes] - The attributes object to add to
27
+ * @property {ParsingError[]} [errors] - The array to store parsing errors
28
+ * @property {boolean} [requiresAttributeTag] - Whether the attribute requires an @attribute tag
29
+ * @property {number} [depth] - The current recursion depth
30
+ */
31
+ /**
32
+ * Extracts Script Attributes from JSDoc style tag from a AST node
33
+ *
34
+ * @param {import('typescript').Node} node - The TypeScript node to analyze
35
+ * @param {ParserOptions} [opts] - The input options
36
+ * @returns {Attribute[]} - The extracted attributes;
37
+ */
38
+ extractAttributes(node: import("typescript").Node, opts?: {
39
+ /**
40
+ * - The attributes object to add to
41
+ */
42
+ attributes?: object;
43
+ /**
44
+ * - The array to store parsing errors
45
+ */
46
+ errors?: ParsingError[];
47
+ /**
48
+ * - Whether the attribute requires an
49
+ */
50
+ requiresAttributeTag?: boolean;
51
+ }): Attribute[];
52
+ }
53
+ export type Attribute = {
54
+ /**
55
+ * - The type of the attribute
56
+ */
57
+ type: string;
58
+ /**
59
+ * - Whether the attribute is an array type of not
60
+ */
61
+ array: boolean;
62
+ /**
63
+ * - The description of the attribute
64
+ */
65
+ description?: string;
66
+ /**
67
+ * - Placeholder for Editor's for field UI.
68
+ */
69
+ placeholder?: string;
70
+ /**
71
+ * - The default value of the attribute
72
+ */
73
+ defaultValue?: any;
74
+ /**
75
+ * - An array of possible values for the attribute
76
+ */
77
+ enum?: {
78
+ [x: string]: number | boolean | string;
79
+ }[];
80
+ /**
81
+ * - Numerical constraints for the attribute
82
+ */
83
+ range?: {
84
+ min: number;
85
+ max: number;
86
+ };
87
+ /**
88
+ * - Numerical constraints for the attribute
89
+ */
90
+ precision?: number;
91
+ /**
92
+ * - Numerical constraints for the attribute
93
+ */
94
+ step?: number;
95
+ /**
96
+ * - Name of asset type to be used in 'asset' type attribute
97
+ */
98
+ resource?: string;
99
+ };
100
+ export type ValidationError = {
101
+ /**
102
+ * - The error message
103
+ */
104
+ message: string;
105
+ /**
106
+ * - The file the error occurred in
107
+ */
108
+ file?: string;
109
+ /**
110
+ * - The line the error occurred on
111
+ */
112
+ line?: number;
113
+ /**
114
+ * - The column the error occurred on
115
+ */
116
+ column?: number;
117
+ /**
118
+ * - The length of the error
119
+ */
120
+ length?: number;
121
+ };
122
+ import * as ts from 'typescript';
123
+ import { AttributeParser } from './attribute-parser.js';
124
+ import { ParsingError } from './parsing-error.js';
@@ -0,0 +1,5 @@
1
+ export function getTagFromJsdoc(tag: string, doc: import("typescript").Node): import("typescript").Node;
2
+ export function getTag(tag: string, node: import("typescript").Node): import("typescript").Node;
3
+ export function hasTag(tag: string, node: import("typescript").Node): boolean;
4
+ export function isInterface(node: import("typescript").Node): boolean;
5
+ export function isStaticMember(member: import("typescript").Node): boolean;
@@ -6,13 +6,4 @@
6
6
  * @param {array} b - The second array
7
7
  * @returns {array} - The merged array
8
8
  */
9
- export function zipArrays(a, b) {
10
- const length = Math.max(a.length, b.length);
11
- const result = new Array(length);
12
-
13
- for (let i = 0; i < length; i++) {
14
- result[i] = i < a.length ? a[i] : b[i];
15
- }
16
-
17
- return result;
18
- }
9
+ export function zipArrays(a: any[], b: any[]): any[];
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Parses a tag value into a boolean, number, array or string
3
+ * @param {string} input - The tag value to parse
4
+ * @returns {boolean|number|string|Array<any>} - The parsed value
5
+ */
6
+ export function parseTag(input?: string): boolean | number | string | Array<any>;
7
+ /**
8
+ * Validates that a tag value matches the expected type
9
+ *
10
+ * @param {String} value - The value to be validated.
11
+ * @param {String} typeAnnotation - The TypeScript type annotation as a string.
12
+ * @param {import('@typescript/vfs').VirtualTypeScriptEnvironment} env - The environment containing the language service and file creation utilities.
13
+ * @throws Will throw an error if the value does not conform to the typeAnnotation.
14
+ * @returns {true} if validation passes without type errors.
15
+ */
16
+ export function validateTag(value: string, typeAnnotation: string, env: import("@typescript/vfs").VirtualTypeScriptEnvironment): true;
@@ -0,0 +1,103 @@
1
+ export function createDefaultMapFromCDN(options: any, prefix: any, ts: any): Promise<Map<any, any>>;
2
+ /**
3
+ * Returns an array of exported nodes from a TypeScript source file.
4
+ * @param {import('typescript').Program} program - The TypeScript program
5
+ * @param {import('typescript').SourceFile} sourceFile - The TypeScript source file
6
+ * @returns {let map: Map<string, Set<import('typescript').Node>>} - A Map of exported nodes
7
+ */
8
+ export function getExportedNodes(program: import("typescript").Program, sourceFile: import("typescript").SourceFile): let;
9
+ /**
10
+ * Checks if the node or its aliased symbol is a class declaration.
11
+ *
12
+ * @param {import('typescript').Node} node - The TypeScript node
13
+ * @param {import('typescript').TypeChecker} typeChecker - The TypeScript type checker
14
+ * @returns {boolean} - True if the node or its original declaration is a class declaration, false otherwise
15
+ */
16
+ export function isAliasedClassDeclaration(node: import("typescript").Node, typeChecker: import("typescript").TypeChecker): boolean;
17
+ /**
18
+ * Determines if a TypeScript node inherits from a specific base class.
19
+ * @param {ts.ClassDeclaration} node - The TypeScript node to analyze
20
+ * @param {ts.TypeChecker} typeChecker - The TypeScript type checker
21
+ * @param {ts.Symbol} baseClassSymbol - The base class symbol to check inheritance against
22
+ * @returns {boolean} - True if the node inherits from the base class
23
+ */
24
+ export function inheritsFrom(node: ts.ClassDeclaration, typeChecker: ts.TypeChecker, baseClassSymbol: ts.Symbol): boolean;
25
+ /**
26
+ * Recursively gathers and flat maps and nodes that meet a specific filter.
27
+ * @param {import('typescript').Node} node - The TypeScript node to analyze
28
+ * @param {function} filter - A function to filter the nodes
29
+ * @returns {import('typescript').Node[]} - An array of exported class declarations
30
+ */
31
+ export function flatMapAnyNodes(node: import("typescript").Node, filter?: Function): import("typescript").Node[];
32
+ /**
33
+ * Retrieves the JSDoc-style comments associated with a specific AST node.
34
+ *
35
+ * @param {import('typescript').Node} node - The TypeScript node to analyze
36
+ * @param {string} text - The full text content of the source file
37
+ * @param {import('typescript').TypeChecker} typeChecker - The TypeScript type checker
38
+ * @returns {{ memberName: string, member: Node, range: import('typescript').CommentRange}[]} - An array of comment ranges
39
+ */
40
+ export function getJSDocTags(node: import("typescript").Node, typeChecker: import("typescript").TypeChecker): {
41
+ memberName: string;
42
+ member: Node;
43
+ range: import("typescript").CommentRange;
44
+ }[];
45
+ /**
46
+ * Determines if a TypeScript node is an enum.
47
+ * @param {import('typescript').Node} node - The TypeScript node to analyze
48
+ * @returns {boolean} - True if the node is an enum
49
+ */
50
+ export function isEnum(node: import("typescript").Node): boolean;
51
+ /**
52
+ * Determines the primitive type for enums, or falls back to the actual type name.
53
+ *
54
+ * @param {ts.Type} type - The type to inspect.
55
+ * @param {ts.TypeChecker} typeChecker - The TypeScript type checker.
56
+ * @returns {'string' | 'boolean' | 'number' | null} - The primitive type of the enum or the type's name.
57
+ */
58
+ export function getPrimitiveEnumType(type: ts.Type, typeChecker: ts.TypeChecker): "string" | "boolean" | "number" | null;
59
+ /**
60
+ * Gets the inferred type of a TypeScript node.
61
+ *
62
+ * @param {ts.Node} node - The TypeScript node to analyze
63
+ * @param {ts.TypeChecker} typeChecker - The TypeScript type checker
64
+ * @returns {{ array: boolean, name: string | undefined, type: Type | null }} - The inferred type of the node
65
+ */
66
+ export function getType(node: ts.Node, typeChecker: ts.TypeChecker): {
67
+ array: boolean;
68
+ name: string | undefined;
69
+ type: Type | null;
70
+ };
71
+ /**
72
+ * Parses a numerical string into a number. Handles hexadecimal, binary,
73
+ * octal, exponential notation and underscore notation
74
+ *
75
+ * @param {string} input - The string to parse
76
+ * @returns {number} The parsed number, or NaN if the input is not a number
77
+ */
78
+ export function parseNumber(input: string): number;
79
+ /**
80
+ * Parses a string representation of a numerical array into an array of numbers.
81
+ *
82
+ * @param {string} input - The string to parse
83
+ * @returns {number[]} - The parsed array of numbers
84
+ * @throws {Error} - If the input contains invalid characters or is not a valid array
85
+ */
86
+ export function parseStringToNumericalArray(input: string): number[];
87
+ /**
88
+ * Attempts to extract a literal value from a TypeScript node. This function
89
+ * supports various types of literals and expressions, including object literals,
90
+ * array literals, identifiers, and unary expressions.
91
+ *
92
+ * @param {import('typescript').Node} node - The AST node to evaluate
93
+ * @param {import('typescript').TypeChecker} typeChecker - The TypeScript type checker
94
+ * @returns {any} - The extracted literal value
95
+ */
96
+ export function getLiteralValue(node: import("typescript").Node, typeChecker: import("typescript").TypeChecker): any;
97
+ export function isNumericLiteral(node: import("typescript").Node): boolean;
98
+ export function parseFloatNode(node: import("typescript").Node, isArgument?: boolean): number;
99
+ export function parseBooleanNode(node: import("typescript").Node): boolean;
100
+ export function parseStringNode(node: import("typescript").Node): string;
101
+ export function parseArrayLiteralNode(node: any, isArgument?: boolean): any;
102
+ export function parseArrayLiteral(args: ts.Node[]): number[];
103
+ import * as ts from 'typescript';
@@ -1,49 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
-
9
- jobs:
10
- lint:
11
- name: Lint Code
12
- runs-on: ubuntu-latest
13
- timeout-minutes: 10
14
- steps:
15
- - name: Checkout code
16
- uses: actions/checkout@v4
17
-
18
- - name: Setup Node.js 18.x
19
- uses: actions/setup-node@v4
20
- with:
21
- node-version: 22.x
22
- cache: 'npm'
23
-
24
- - name: Install dependencies
25
- run: npm clean-install --progress=false --no-fund
26
-
27
- - name: Run ESLint
28
- run: npm run lint
29
-
30
- unit-test-node:
31
- name: Unit Test
32
- runs-on: ubuntu-latest
33
- timeout-minutes: 10
34
- needs: lint # Ensure linting completes successfully first
35
- steps:
36
- - name: Checkout code
37
- uses: actions/checkout@v4
38
-
39
- - name: Setup Node.js 18.x
40
- uses: actions/setup-node@v4
41
- with:
42
- node-version: 22.x
43
- cache: 'npm'
44
-
45
- - name: Install dependencies
46
- run: npm clean-install --progress=false --no-fund
47
-
48
- - name: Run unit tests
49
- run: npm test
package/eslint.config.mjs DELETED
@@ -1,35 +0,0 @@
1
- import playcanvasConfig from '@playcanvas/eslint-config';
2
- import globals from 'globals';
3
-
4
- export default [
5
- ...playcanvasConfig,
6
- {
7
- ignores: ['**/program.invalid.js'] // Exclude specific files
8
- },
9
- {
10
- languageOptions: {
11
- ecmaVersion: 2022,
12
- sourceType: 'module',
13
- globals: {
14
- ...globals.browser,
15
- ...globals.mocha,
16
- ...globals.node
17
- }
18
- }
19
- },
20
- {
21
- rules: {
22
- 'no-unused-expressions': 'off',
23
- 'jsdoc/check-tag-names': 'off',
24
- 'import/no-unresolved': 'off'
25
- }
26
- },
27
- {
28
- // Configuration specific to test files
29
- files: ['**/*.test.js'], // Match test files
30
-
31
- rules: {
32
- 'prefer-arrow-callback': 'off' // Allow function expressions in test files
33
- }
34
- }
35
- ];
package/renovate.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:recommended"
5
- ],
6
- "packageRules": [
7
- {
8
- "matchManagers": [
9
- "npm"
10
- ],
11
- "groupName": "all npm dependencies",
12
- "schedule": [
13
- "on monday at 10:00am"
14
- ]
15
- },
16
- {
17
- "matchDepTypes": ["devDependencies"],
18
- "rangeStrategy": "pin"
19
- },
20
- {
21
- "matchDepTypes": ["dependencies"],
22
- "rangeStrategy": "widen"
23
- }
24
- ],
25
- }