@player-tools/cli 0.4.0-next.1 → 0.4.0-next.3

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.
@@ -59,9 +59,9 @@ class DSLCompile extends base_command_1.BaseCommand {
59
59
  const results = {
60
60
  exitCode: 0,
61
61
  };
62
+ const compiler = yield this.createDSLCompiler();
62
63
  /** Compile a file from the DSL format into JSON */
63
64
  const compileFile = (file) => __awaiter(this, void 0, void 0, function* () {
64
- const compiler = yield this.createDSLCompiler();
65
65
  const requiredModule = require(path_1.default.resolve(file));
66
66
  const defaultExport = requiredModule.default;
67
67
  if (!defaultExport) {
@@ -106,6 +106,7 @@ class DSLCompile extends base_command_1.BaseCommand {
106
106
  });
107
107
  }
108
108
  }
109
+ yield compiler.hooks.onEnd.call({ output });
109
110
  if (!skipValidation) {
110
111
  console.log('');
111
112
  const hasOutput = compilerResults.some((r) => { var _a; return ((_a = r.output) === null || _a === void 0 ? void 0 : _a.contentType) === 'flow'; });
@@ -72,7 +72,7 @@ class XLRCompile extends base_command_1.BaseCommand {
72
72
  }
73
73
  /** Generate extension manifest/description files from an Enhanced Player Plugin */
74
74
  processTypes(fileNames, outputDirectory, options, mode = consts_1.Mode.PLUGIN) {
75
- var _a, _b, _c, _d;
75
+ var _a, _b, _c, _d, _e, _f;
76
76
  // Build a program using the set of root file names in fileNames
77
77
  const program = typescript_1.default.createProgram(fileNames, options);
78
78
  fs_1.default.mkdirSync(outputDirectory, { recursive: true });
@@ -105,6 +105,10 @@ class XLRCompile extends base_command_1.BaseCommand {
105
105
  throw new Error(`Error: Option ${mode} not recognized. Valid options are: plugin or type`);
106
106
  }
107
107
  if (generatedCapabilites) {
108
+ generatedCapabilites = Object.assign({}, generatedCapabilites);
109
+ if (consts_1.customPrimitives) {
110
+ generatedCapabilites = Object.assign(Object.assign({}, generatedCapabilites), { customPrimitives: consts_1.customPrimitives });
111
+ }
108
112
  capabilities = generatedCapabilites;
109
113
  }
110
114
  }
@@ -122,16 +126,19 @@ class XLRCompile extends base_command_1.BaseCommand {
122
126
  })
123
127
  .join('\n')}
124
128
 
125
- module.exports = {
126
- "pluginName": "${capabilities.pluginName}",
127
- "capabilities": {
128
- ${[...((_d = (_c = capabilities.capabilities) === null || _c === void 0 ? void 0 : _c.entries()) !== null && _d !== void 0 ? _d : [])]
129
+ module.exports = {
130
+ "pluginName": "${capabilities.pluginName}",
131
+ "capabilities": {
132
+ ${[...((_d = (_c = capabilities.capabilities) === null || _c === void 0 ? void 0 : _c.entries()) !== null && _d !== void 0 ? _d : [])]
129
133
  .map(([capabilityName, provides]) => {
130
134
  return `"${capabilityName}":[${provides.join(',')}],`;
131
135
  })
132
136
  .join('\n\t\t')}
133
- }
134
- }
137
+ },
138
+ "customPrimitives": [
139
+ ${[(_f = (_e = capabilities.customPrimitives) === null || _e === void 0 ? void 0 : _e.map((i) => `'${i}'`).join(',')) !== null && _f !== void 0 ? _f : '']}
140
+ ]
141
+ }
135
142
  `;
136
143
  fs_1.default.writeFileSync(path_1.default.join(outputDirectory, 'manifest.js'), tsManifestFile);
137
144
  }
package/dist/config.d.ts CHANGED
@@ -33,5 +33,7 @@ export interface PlayerConfigResolvedShape {
33
33
  };
34
34
  /** Flattened list of plugins */
35
35
  plugins: Array<PlayerCLIPlugin>;
36
+ /** Catch for any other things that may be in the config for plugged in functionality */
37
+ [key: string]: any;
36
38
  }
37
39
  //# sourceMappingURL=config.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { run } from '@oclif/core';
2
2
  export * from './config';
3
3
  export * from './plugins';
4
+ export * from './utils/base-command';
4
5
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -19,3 +19,4 @@ var core_1 = require("@oclif/core");
19
19
  Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
20
20
  __exportStar(require("./config"), exports);
21
21
  __exportStar(require("./plugins"), exports);
22
+ __exportStar(require("./utils/base-command"), exports);
@@ -10,9 +10,9 @@ const registerForPaths = () => {
10
10
  (0, register_1.default)({
11
11
  extensions: ['.es6', '.es', '.jsx', '.js', '.mjs', '.tsx', '.ts'],
12
12
  presets: [
13
- ['@babel/preset-env', { modules: 'cjs' }],
14
- '@babel/preset-typescript',
15
- '@babel/preset-react',
13
+ [require.resolve('@babel/preset-env'), { modules: 'cjs' }],
14
+ require.resolve('@babel/preset-typescript'),
15
+ require.resolve('@babel/preset-react'),
16
16
  ],
17
17
  plugins: ['@babel/plugin-transform-react-jsx-source'],
18
18
  });
@@ -126,7 +126,11 @@ class BaseCommand extends core_1.Command {
126
126
  createDSLCompiler() {
127
127
  var _a, _b;
128
128
  return __awaiter(this, void 0, void 0, function* () {
129
- const compiler = new dsl_1.DSLCompiler();
129
+ const compiler = new dsl_1.DSLCompiler({
130
+ error: this.error.bind(this),
131
+ warn: this.warn.bind(this),
132
+ log: this.log.bind(this),
133
+ });
130
134
  const { plugins } = yield this.getPlayerConfig();
131
135
  for (let i = 0; i < plugins.length; i++) {
132
136
  // eslint-disable-next-line no-await-in-loop
@@ -1 +1 @@
1
- {"version":"0.4.0-next.1","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.4.0-next.3","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.4.0-next.1",
3
+ "version": "0.4.0-next.3",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -28,11 +28,11 @@
28
28
  "vscode-languageserver-textdocument": "^1.0.1",
29
29
  "vscode-languageserver-types": "^3.15.1",
30
30
  "typescript": "4.8.4",
31
- "@player-tools/dsl": "0.4.0-next.1",
32
- "@player-tools/json-language-service": "0.4.0-next.1",
33
- "@player-tools/xlr-sdk": "0.4.0-next.1",
34
- "@player-tools/xlr-utils": "0.4.0-next.1",
35
- "@player-tools/xlr-converters": "0.4.0-next.1"
31
+ "@player-tools/dsl": "0.4.0-next.3",
32
+ "@player-tools/json-language-service": "0.4.0-next.3",
33
+ "@player-tools/xlr-sdk": "0.4.0-next.3",
34
+ "@player-tools/xlr-utils": "0.4.0-next.3",
35
+ "@player-tools/xlr-converters": "0.4.0-next.3"
36
36
  },
37
37
  "main": "./dist/index.js",
38
38
  "module": "dist/index.esm.js",
@@ -50,5 +50,8 @@
50
50
  },
51
51
  "bin": {
52
52
  "player": "bin/run"
53
- }
53
+ },
54
+ "plugins": [
55
+ "@oclif/plugin-plugins"
56
+ ]
54
57
  }