@playcanvas/attribute-parser 1.3.1 → 1.3.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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -123,10 +123,18 @@ export class JSDocParser {
|
|
|
123
123
|
throw new Error('PlayCanvas Types must be supplied');
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
const esmScripts = new Map();
|
|
127
|
+
|
|
126
128
|
// Parse the source file and pc types
|
|
127
129
|
const sourceFile = this.program.getSourceFile(fileName);
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
// In a special edge case where the files contents are empty, the sourcefile will be undefined
|
|
132
|
+
// So we should early out
|
|
133
|
+
if (sourceFile === undefined) {
|
|
134
|
+
return esmScripts;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (sourceFile === null) {
|
|
130
138
|
throw new Error(`Source file ${fileName} not found`);
|
|
131
139
|
}
|
|
132
140
|
|
|
@@ -135,7 +143,6 @@ export class JSDocParser {
|
|
|
135
143
|
|
|
136
144
|
const esmScriptClass = pcTypes.statements.find(node => node.kind === ts.SyntaxKind.ClassDeclaration && node.name.text === 'Script')?.symbol;
|
|
137
145
|
|
|
138
|
-
const esmScripts = new Map();
|
|
139
146
|
// Check if the file exports a class that inherits from `Script`
|
|
140
147
|
nodes.forEach((node, name) => {
|
|
141
148
|
if (isAliasedClassDeclaration(node, typeChecker) && inheritsFrom(node, typeChecker, esmScriptClass)) {
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { describe, it, before } from 'mocha';
|
|
3
|
+
|
|
4
|
+
import { parseAttributes } from '../../utils.js';
|
|
5
|
+
|
|
6
|
+
describe('VALID: Program ', function () {
|
|
7
|
+
let data;
|
|
8
|
+
before(async function () {
|
|
9
|
+
data = await parseAttributes('./empty.valid.js');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('only results should exist', function () {
|
|
13
|
+
expect(data).to.exist;
|
|
14
|
+
expect(data[0]).to.be.empty;
|
|
15
|
+
expect(data[1]).to.be.empty;
|
|
16
|
+
});
|
|
17
|
+
});
|