@player-tools/cli 0.2.2--canary.17.363 → 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.
@@ -29,6 +29,7 @@ const customPrimitives = [
29
29
  'Binding',
30
30
  'AssetWrapper',
31
31
  'Schema.DataType',
32
+ 'ExpressionHandler',
32
33
  ];
33
34
  var Mode;
34
35
  (function (Mode) {
@@ -134,18 +135,33 @@ class XLRCompile extends base_command_1.BaseCommand {
134
135
  // if its an array process each type
135
136
  if (typescript_1.default.isTupleTypeNode(exportedCapabilities)) {
136
137
  const capabilityNames = exportedCapabilities.elements.map((element) => {
137
- var _a, _b;
138
- if (typescript_1.default.isTypeReferenceNode(element)) {
139
- const referenceSymbol = checker.getSymbolAtLocation(element.typeName);
140
- const alias = referenceSymbol
141
- ? checker.getAliasedSymbol(referenceSymbol)
138
+ var _a, _b, _c;
139
+ if (typescript_1.default.isTypeReferenceNode(element) ||
140
+ typescript_1.default.isTypeQueryNode(element)) {
141
+ let referencedSymbol;
142
+ if (typescript_1.default.isTypeReferenceNode(element)) {
143
+ referencedSymbol = checker.getSymbolAtLocation(element.typeName);
144
+ }
145
+ else {
146
+ referencedSymbol = checker.getSymbolAtLocation(element.exprName);
147
+ }
148
+ const alias = referencedSymbol
149
+ ? checker.getAliasedSymbol(referencedSymbol)
142
150
  : undefined;
143
- const varDecl = (_a = alias === null || alias === void 0 ? void 0 : alias.declarations) === null || _a === void 0 ? void 0 : _a[0];
144
- if (varDecl &&
145
- (typescript_1.default.isInterfaceDeclaration(varDecl) ||
146
- typescript_1.default.isTypeAliasDeclaration(varDecl))) {
147
- const capabilityDescription = converter.convertDeclaration(varDecl);
148
- const capabilityName = (_b = capabilityDescription === null || capabilityDescription === void 0 ? void 0 : capabilityDescription.name) !== null && _b !== void 0 ? _b : 'error';
151
+ let varDecl;
152
+ /**
153
+ * The TypeChecker will return the interface/type declaration or the variable statement
154
+ * so if we are getting a variable, we need to grab the variable declaration
155
+ */
156
+ if (typescript_1.default.isTypeReferenceNode(element)) {
157
+ varDecl = (_a = alias === null || alias === void 0 ? void 0 : alias.declarations) === null || _a === void 0 ? void 0 : _a[0];
158
+ }
159
+ else {
160
+ varDecl = (_b = alias === null || alias === void 0 ? void 0 : alias.declarations) === null || _b === void 0 ? void 0 : _b[0].parent.parent;
161
+ }
162
+ if (varDecl && (0, xlr_utils_1.isTopLevelNode)(varDecl)) {
163
+ const capabilityDescription = converter.convertTopLevelNode(varDecl);
164
+ const capabilityName = (_c = capabilityDescription === null || capabilityDescription === void 0 ? void 0 : capabilityDescription.name) !== null && _c !== void 0 ? _c : 'error';
149
165
  fs_1.default.writeFileSync(path_1.default.join(outputDir, `${capabilityName}.json`), JSON.stringify(capabilityDescription, undefined, 4));
150
166
  return capabilityName;
151
167
  }
@@ -1 +1 @@
1
- {"version":"0.2.2--canary.17.363","commands":{"dsl:compile":{"id":"dsl:compile","description":"Compile Player DSL files into JSON","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"input":{"name":"input","type":"option","char":"i","description":"An input directory to compile.\nAny jsx/ts/tsx files will be loaded via babel-require automatically.","multiple":false},"output":{"name":"output","type":"option","char":"o","description":"Output directory to write results to.","multiple":false},"skip-validation":{"name":"skip-validation","type":"boolean","description":"Option to skip validating the generated JSON","allowNo":false},"exp":{"name":"exp","type":"boolean","description":"Use experimental language features","allowNo":false}},"args":[],"_globalFlags":{}},"json:validate":{"id":"json:validate","description":"Validate Player JSON content","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"files":{"name":"files","type":"option","char":"f","description":"A list of files or globs to validate","multiple":true},"exp":{"name":"exp","type":"boolean","description":"Use experimental language features","allowNo":false}},"args":[],"_globalFlags":{}},"xlr:compile":{"id":"xlr:compile","description":"Compiles typescript files to XLRs format","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"input":{"name":"input","type":"option","char":"i","description":"An input directory to search for types to export","multiple":false,"default":"./src"},"output":{"name":"output","type":"option","char":"o","description":"Output directory to write results to.","multiple":false,"default":"./dist"},"mode":{"name":"mode","type":"option","char":"m","description":"Search strategy for types to export: plugin (default, looks for exported EnchancedPlayerPlugin classes) or type (all exported types)","helpValue":"(plugin|types)","multiple":false,"options":["plugin","types"],"default":"plugin"}},"args":[],"_globalFlags":{}},"xlr:convert":{"id":"xlr:convert","description":"Exports XLRs files to a specific language","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"input":{"name":"input","type":"option","char":"i","description":"An input directory to search for types to export","multiple":false,"default":"./dist"},"output":{"name":"output","type":"option","char":"o","description":"Output directory to write results to.","multiple":false},"lang":{"name":"lang","type":"option","char":"l","description":"Search strategy for types to export: plugin (default, looks for exported EnchancedPlayerPlugin classes) or type (all exported types)","helpValue":"(TypeScript)","multiple":false,"options":["TypeScript"]}},"args":[],"_globalFlags":{}}}}
1
+ {"version":"0.3.0-next.0","commands":{"dsl:compile":{"id":"dsl:compile","description":"Compile Player DSL files into JSON","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"input":{"name":"input","type":"option","char":"i","description":"An input directory to compile.\nAny jsx/ts/tsx files will be loaded via babel-require automatically.","multiple":false},"output":{"name":"output","type":"option","char":"o","description":"Output directory to write results to.","multiple":false},"skip-validation":{"name":"skip-validation","type":"boolean","description":"Option to skip validating the generated JSON","allowNo":false},"exp":{"name":"exp","type":"boolean","description":"Use experimental language features","allowNo":false}},"args":[],"_globalFlags":{}},"json:validate":{"id":"json:validate","description":"Validate Player JSON content","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"files":{"name":"files","type":"option","char":"f","description":"A list of files or globs to validate","multiple":true},"exp":{"name":"exp","type":"boolean","description":"Use experimental language features","allowNo":false}},"args":[],"_globalFlags":{}},"xlr:compile":{"id":"xlr:compile","description":"Compiles typescript files to XLRs format","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"input":{"name":"input","type":"option","char":"i","description":"An input directory to search for types to export","multiple":false,"default":"./src"},"output":{"name":"output","type":"option","char":"o","description":"Output directory to write results to.","multiple":false,"default":"./dist"},"mode":{"name":"mode","type":"option","char":"m","description":"Search strategy for types to export: plugin (default, looks for exported EnchancedPlayerPlugin classes) or type (all exported types)","helpValue":"(plugin|types)","multiple":false,"options":["plugin","types"],"default":"plugin"}},"args":[],"_globalFlags":{}},"xlr:convert":{"id":"xlr:convert","description":"Exports XLRs files to a specific language","strict":false,"pluginName":"@player-tools/cli","pluginAlias":"@player-tools/cli","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load","multiple":false},"input":{"name":"input","type":"option","char":"i","description":"An input directory to search for types to export","multiple":false,"default":"./dist"},"output":{"name":"output","type":"option","char":"o","description":"Output directory to write results to.","multiple":false},"lang":{"name":"lang","type":"option","char":"l","description":"Search strategy for types to export: plugin (default, looks for exported EnchancedPlayerPlugin classes) or type (all exported types)","helpValue":"(TypeScript)","multiple":false,"options":["TypeScript"]}},"args":[],"_globalFlags":{}}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-tools/cli",
3
- "version": "0.2.2--canary.17.363",
3
+ "version": "0.3.0-next.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -27,11 +27,11 @@
27
27
  "mkdirp": "^1.0.4",
28
28
  "vscode-languageserver-textdocument": "^1.0.1",
29
29
  "vscode-languageserver-types": "^3.15.1",
30
- "@player-tools/dsl": "0.2.2--canary.17.363",
31
- "@player-tools/language-service": "0.2.2--canary.17.363",
32
- "@player-tools/xlr-sdk": "0.2.2--canary.17.363",
33
- "@player-tools/xlr-utils": "0.2.2--canary.17.363",
34
- "@player-tools/xlr-converters": "0.2.2--canary.17.363"
30
+ "@player-tools/dsl": "0.3.0-next.0",
31
+ "@player-tools/language-service": "0.3.0-next.0",
32
+ "@player-tools/xlr-sdk": "0.3.0-next.0",
33
+ "@player-tools/xlr-utils": "0.3.0-next.0",
34
+ "@player-tools/xlr-converters": "0.3.0-next.0"
35
35
  },
36
36
  "main": "./dist/index.js",
37
37
  "module": "dist/index.esm.js",