@player-tools/cli 0.4.0-next.0 → 0.4.0-next.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.
|
@@ -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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlayerLanguageService } from '@player-tools/language-service';
|
|
1
|
+
import type { PlayerLanguageService } from '@player-tools/json-language-service';
|
|
2
2
|
import type { PlayerCLIPlugin } from './index';
|
|
3
3
|
export interface Config {
|
|
4
4
|
/** the path to the asset library to load */
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlayerLanguageService } from '@player-tools/language-service';
|
|
1
|
+
import type { PlayerLanguageService } from '@player-tools/json-language-service';
|
|
2
2
|
import type { DSLCompiler } from '@player-tools/dsl';
|
|
3
3
|
import type { ExportTypes } from '@player-tools/xlr-sdk';
|
|
4
4
|
import type { TransformFunction } from '@player-tools/xlr';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
import { PlayerLanguageService } from '@player-tools/language-service';
|
|
2
|
+
import { PlayerLanguageService } from '@player-tools/json-language-service';
|
|
3
3
|
import { DSLCompiler } from '@player-tools/dsl';
|
|
4
4
|
import type { ExportTypes } from '@player-tools/xlr-sdk';
|
|
5
5
|
import type { TransformFunction } from '@player-tools/xlr';
|
|
@@ -19,7 +19,7 @@ exports.BaseCommand = void 0;
|
|
|
19
19
|
const core_1 = require("@oclif/core");
|
|
20
20
|
const path_1 = __importDefault(require("path"));
|
|
21
21
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
22
|
-
const
|
|
22
|
+
const json_language_service_1 = require("@player-tools/json-language-service");
|
|
23
23
|
const dsl_1 = require("@player-tools/dsl");
|
|
24
24
|
const configLoader = (0, cosmiconfig_1.cosmiconfig)('player');
|
|
25
25
|
/** The common configs for all */
|
|
@@ -114,7 +114,7 @@ class BaseCommand extends core_1.Command {
|
|
|
114
114
|
createLanguageService(exp) {
|
|
115
115
|
var _a, _b;
|
|
116
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
const lsp = new
|
|
117
|
+
const lsp = new json_language_service_1.PlayerLanguageService();
|
|
118
118
|
const { plugins } = yield this.getPlayerConfig();
|
|
119
119
|
for (let i = 0; i < plugins.length; i++) {
|
|
120
120
|
// eslint-disable-next-line no-await-in-loop
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.4.0-next.
|
|
1
|
+
{"version":"0.4.0-next.2","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.
|
|
3
|
+
"version": "0.4.0-next.2",
|
|
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.
|
|
32
|
-
"@player-tools/language-service": "0.4.0-next.
|
|
33
|
-
"@player-tools/xlr-sdk": "0.4.0-next.
|
|
34
|
-
"@player-tools/xlr-utils": "0.4.0-next.
|
|
35
|
-
"@player-tools/xlr-converters": "0.4.0-next.
|
|
31
|
+
"@player-tools/dsl": "0.4.0-next.2",
|
|
32
|
+
"@player-tools/json-language-service": "0.4.0-next.2",
|
|
33
|
+
"@player-tools/xlr-sdk": "0.4.0-next.2",
|
|
34
|
+
"@player-tools/xlr-utils": "0.4.0-next.2",
|
|
35
|
+
"@player-tools/xlr-converters": "0.4.0-next.2"
|
|
36
36
|
},
|
|
37
37
|
"main": "./dist/index.js",
|
|
38
38
|
"module": "dist/index.esm.js",
|