@player-tools/xlr-converters 0.3.0-next.2 → 0.3.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/dist/index.cjs.js +3 -0
- package/dist/index.esm.js +3 -0
- package/package.json +3 -3
- package/src/ts-to-xlr.ts +8 -0
package/dist/index.cjs.js
CHANGED
|
@@ -120,6 +120,9 @@ class TsConverter {
|
|
|
120
120
|
} else {
|
|
121
121
|
resultingNode = this.tsLiteralToType(variable.initializer);
|
|
122
122
|
}
|
|
123
|
+
if (resultingNode.type === "function" || resultingNode.type === "ref") {
|
|
124
|
+
resultingNode = __spreadProps(__spreadValues$1({}, resultingNode), { name: variable.name.getText() });
|
|
125
|
+
}
|
|
123
126
|
return __spreadValues$1({
|
|
124
127
|
name: variable.name.getText()
|
|
125
128
|
}, resultingNode);
|
package/dist/index.esm.js
CHANGED
|
@@ -112,6 +112,9 @@ class TsConverter {
|
|
|
112
112
|
} else {
|
|
113
113
|
resultingNode = this.tsLiteralToType(variable.initializer);
|
|
114
114
|
}
|
|
115
|
+
if (resultingNode.type === "function" || resultingNode.type === "ref") {
|
|
116
|
+
resultingNode = __spreadProps(__spreadValues$1({}, resultingNode), { name: variable.name.getText() });
|
|
117
|
+
}
|
|
115
118
|
return __spreadValues$1({
|
|
116
119
|
name: variable.name.getText()
|
|
117
120
|
}, resultingNode);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-tools/xlr-converters",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"typescript": "4.8.4"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@player-tools/xlr": "0.3.0
|
|
13
|
-
"@player-tools/xlr-utils": "0.3.0
|
|
12
|
+
"@player-tools/xlr": "0.3.0",
|
|
13
|
+
"@player-tools/xlr-utils": "0.3.0",
|
|
14
14
|
"@babel/runtime": "7.15.4"
|
|
15
15
|
},
|
|
16
16
|
"main": "dist/index.cjs.js",
|
package/src/ts-to-xlr.ts
CHANGED
|
@@ -177,6 +177,7 @@ export class TsConverter {
|
|
|
177
177
|
const variableDeclarations = node.declarationList.declarations;
|
|
178
178
|
if (variableDeclarations.length === 1) {
|
|
179
179
|
const variable = variableDeclarations[0];
|
|
180
|
+
|
|
180
181
|
if (variable.initializer) {
|
|
181
182
|
let resultingNode;
|
|
182
183
|
if (
|
|
@@ -191,6 +192,13 @@ export class TsConverter {
|
|
|
191
192
|
resultingNode = this.tsLiteralToType(variable.initializer);
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
// If resultingNode is a reference to a function or custom primitive and not a concrete value
|
|
196
|
+
// we need to update the name to be the name of the exporting variable
|
|
197
|
+
// not the name of the identifier its aliasing
|
|
198
|
+
if (resultingNode.type === 'function' || resultingNode.type === 'ref') {
|
|
199
|
+
resultingNode = { ...resultingNode, name: variable.name.getText() };
|
|
200
|
+
}
|
|
201
|
+
|
|
194
202
|
return {
|
|
195
203
|
name: variable.name.getText(),
|
|
196
204
|
...resultingNode,
|