@player-tools/xlr-utils 0.2.2--canary.17.373 → 0.3.0-next.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 CHANGED
@@ -185,9 +185,12 @@ function isTypeReferenceGeneric(node, typeChecker) {
185
185
  }
186
186
  return false;
187
187
  }
188
- function isTopLevelNode(node) {
188
+ function isTopLevelDeclaration(node) {
189
189
  return node.kind === ts__default["default"].SyntaxKind.InterfaceDeclaration || node.kind === ts__default["default"].SyntaxKind.TypeAliasDeclaration;
190
190
  }
191
+ function isTopLevelNode(node) {
192
+ return node.kind === ts__default["default"].SyntaxKind.InterfaceDeclaration || node.kind === ts__default["default"].SyntaxKind.TypeAliasDeclaration || node.kind === ts__default["default"].SyntaxKind.VariableStatement;
193
+ }
191
194
  function isGenericNodeType(nt) {
192
195
  var _a;
193
196
  return ((_a = nt.genericTokens) == null ? void 0 : _a.length) > 0;
@@ -197,7 +200,7 @@ function isGenericNamedType(nt) {
197
200
  return ((_a = nt.genericTokens) == null ? void 0 : _a.length) > 0;
198
201
  }
199
202
  function isPrimitiveTypeNode(node) {
200
- return node.type === "string" || node.type === "number" || node.type === "boolean" || node.type === "null" || node.type === "any" || node.type === "never" || node.type === "undefined" || node.type === "unknown";
203
+ return node.type === "string" || node.type === "number" || node.type === "boolean" || node.type === "null" || node.type === "any" || node.type === "never" || node.type === "undefined" || node.type === "unknown" || node.type === "void";
201
204
  }
202
205
  function isNonNullable(a) {
203
206
  return a !== null || a !== void 0;
@@ -572,6 +575,7 @@ exports.isNodeExported = isNodeExported;
572
575
  exports.isNonNullable = isNonNullable;
573
576
  exports.isOptionalProperty = isOptionalProperty;
574
577
  exports.isPrimitiveTypeNode = isPrimitiveTypeNode;
578
+ exports.isTopLevelDeclaration = isTopLevelDeclaration;
575
579
  exports.isTopLevelNode = isTopLevelNode;
576
580
  exports.isTypeReferenceGeneric = isTypeReferenceGeneric;
577
581
  exports.makePropertyMap = makePropertyMap;
package/dist/index.d.ts CHANGED
@@ -65,7 +65,12 @@ declare type TopLevelDeclaration = ts__default.InterfaceDeclaration | ts__defaul
65
65
  /**
66
66
  * Returns if the node is an interface or a type declaration
67
67
  */
68
- declare function isTopLevelNode(node: ts__default.Node): node is TopLevelDeclaration;
68
+ declare function isTopLevelDeclaration(node: ts__default.Node): node is TopLevelDeclaration;
69
+ declare type TopLevelNode = TopLevelDeclaration | ts__default.VariableStatement;
70
+ /**
71
+ * Returns if the node is an interface or a type declaration
72
+ */
73
+ declare function isTopLevelNode(node: ts__default.Node): node is TopLevelNode;
69
74
  /**
70
75
  * Returns if the NodeType has generic tokens
71
76
  */
@@ -136,4 +141,4 @@ declare function setupTestEnv(sourceCode: string, mockFileName?: string): {
136
141
  tc: ts__default.TypeChecker;
137
142
  };
138
143
 
139
- export { PropertyNode, SetupReturnType, TopLevelDeclaration, applyPartialOrRequiredToNodeType, applyPickOrOmitToNodeType, buildTemplateRegex, computeEffectiveObject, decorateNode, fillInGenerics, getReferencedType, getStringLiteralsFromUnion, isExportedDeclaration, isGenericInterfaceDeclaration, isGenericNamedType, isGenericNodeType, isGenericTypeDeclaration, isNode, isNodeExported, isNonNullable, isOptionalProperty, isPrimitiveTypeNode, isTopLevelNode, isTypeReferenceGeneric, makePropertyMap, propertyToTuple, resolveConditional, resolveReferenceNode, setupTestEnv, tsStripOptionalType };
144
+ export { PropertyNode, SetupReturnType, TopLevelDeclaration, TopLevelNode, applyPartialOrRequiredToNodeType, applyPickOrOmitToNodeType, buildTemplateRegex, computeEffectiveObject, decorateNode, fillInGenerics, getReferencedType, getStringLiteralsFromUnion, isExportedDeclaration, isGenericInterfaceDeclaration, isGenericNamedType, isGenericNodeType, isGenericTypeDeclaration, isNode, isNodeExported, isNonNullable, isOptionalProperty, isPrimitiveTypeNode, isTopLevelDeclaration, isTopLevelNode, isTypeReferenceGeneric, makePropertyMap, propertyToTuple, resolveConditional, resolveReferenceNode, setupTestEnv, tsStripOptionalType };
package/dist/index.esm.js CHANGED
@@ -158,9 +158,12 @@ function isTypeReferenceGeneric(node, typeChecker) {
158
158
  }
159
159
  return false;
160
160
  }
161
- function isTopLevelNode(node) {
161
+ function isTopLevelDeclaration(node) {
162
162
  return node.kind === ts__default.SyntaxKind.InterfaceDeclaration || node.kind === ts__default.SyntaxKind.TypeAliasDeclaration;
163
163
  }
164
+ function isTopLevelNode(node) {
165
+ return node.kind === ts__default.SyntaxKind.InterfaceDeclaration || node.kind === ts__default.SyntaxKind.TypeAliasDeclaration || node.kind === ts__default.SyntaxKind.VariableStatement;
166
+ }
164
167
  function isGenericNodeType(nt) {
165
168
  var _a;
166
169
  return ((_a = nt.genericTokens) == null ? void 0 : _a.length) > 0;
@@ -170,7 +173,7 @@ function isGenericNamedType(nt) {
170
173
  return ((_a = nt.genericTokens) == null ? void 0 : _a.length) > 0;
171
174
  }
172
175
  function isPrimitiveTypeNode(node) {
173
- return node.type === "string" || node.type === "number" || node.type === "boolean" || node.type === "null" || node.type === "any" || node.type === "never" || node.type === "undefined" || node.type === "unknown";
176
+ return node.type === "string" || node.type === "number" || node.type === "boolean" || node.type === "null" || node.type === "any" || node.type === "never" || node.type === "undefined" || node.type === "unknown" || node.type === "void";
174
177
  }
175
178
  function isNonNullable(a) {
176
179
  return a !== null || a !== void 0;
@@ -527,5 +530,5 @@ function setupTestEnv(sourceCode, mockFileName = "filename.ts") {
527
530
  };
528
531
  }
529
532
 
530
- export { applyPartialOrRequiredToNodeType, applyPickOrOmitToNodeType, buildTemplateRegex, computeEffectiveObject, decorateNode, fillInGenerics, getReferencedType, getStringLiteralsFromUnion, isExportedDeclaration, isGenericInterfaceDeclaration, isGenericNamedType, isGenericNodeType, isGenericTypeDeclaration, isNode, isNodeExported, isNonNullable, isOptionalProperty, isPrimitiveTypeNode, isTopLevelNode, isTypeReferenceGeneric, makePropertyMap, propertyToTuple, resolveConditional, resolveReferenceNode, setupTestEnv, tsStripOptionalType };
533
+ export { applyPartialOrRequiredToNodeType, applyPickOrOmitToNodeType, buildTemplateRegex, computeEffectiveObject, decorateNode, fillInGenerics, getReferencedType, getStringLiteralsFromUnion, isExportedDeclaration, isGenericInterfaceDeclaration, isGenericNamedType, isGenericNodeType, isGenericTypeDeclaration, isNode, isNodeExported, isNonNullable, isOptionalProperty, isPrimitiveTypeNode, isTopLevelDeclaration, isTopLevelNode, isTypeReferenceGeneric, makePropertyMap, propertyToTuple, resolveConditional, resolveReferenceNode, setupTestEnv, tsStripOptionalType };
531
534
  //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-tools/xlr-utils",
3
- "version": "0.2.2--canary.17.373",
3
+ "version": "0.3.0-next.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -10,7 +10,7 @@
10
10
  "jsonc-parser": "^2.3.1"
11
11
  },
12
12
  "dependencies": {
13
- "@player-tools/xlr": "0.2.2--canary.17.373",
13
+ "@player-tools/xlr": "0.3.0-next.0",
14
14
  "@typescript/vfs": "^1.4.0",
15
15
  "@babel/runtime": "7.15.4"
16
16
  },
@@ -56,13 +56,28 @@ export type TopLevelDeclaration =
56
56
  /**
57
57
  * Returns if the node is an interface or a type declaration
58
58
  */
59
- export function isTopLevelNode(node: ts.Node): node is TopLevelDeclaration {
59
+ export function isTopLevelDeclaration(
60
+ node: ts.Node
61
+ ): node is TopLevelDeclaration {
60
62
  return (
61
63
  node.kind === ts.SyntaxKind.InterfaceDeclaration ||
62
64
  node.kind === ts.SyntaxKind.TypeAliasDeclaration
63
65
  );
64
66
  }
65
67
 
68
+ export type TopLevelNode = TopLevelDeclaration | ts.VariableStatement;
69
+
70
+ /**
71
+ * Returns if the node is an interface or a type declaration
72
+ */
73
+ export function isTopLevelNode(node: ts.Node): node is TopLevelNode {
74
+ return (
75
+ node.kind === ts.SyntaxKind.InterfaceDeclaration ||
76
+ node.kind === ts.SyntaxKind.TypeAliasDeclaration ||
77
+ node.kind === ts.SyntaxKind.VariableStatement
78
+ );
79
+ }
80
+
66
81
  /**
67
82
  * Returns if the NodeType has generic tokens
68
83
  */
@@ -93,7 +108,8 @@ export function isPrimitiveTypeNode(node: NodeType): node is PrimitiveTypes {
93
108
  node.type === 'any' ||
94
109
  node.type === 'never' ||
95
110
  node.type === 'undefined' ||
96
- node.type === 'unknown'
111
+ node.type === 'unknown' ||
112
+ node.type === 'void'
97
113
  );
98
114
  }
99
115