@player-tools/cli 0.4.2-next.1 → 0.5.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.
Files changed (49) hide show
  1. package/dist/commands/dependency-versions/check.d.ts +18 -0
  2. package/dist/commands/dependency-versions/check.js +271 -0
  3. package/dist/commands/dsl/compile.d.ts +2 -2
  4. package/dist/commands/dsl/compile.js +136 -141
  5. package/dist/commands/dsl/validate.d.ts +12 -0
  6. package/dist/commands/dsl/validate.js +76 -0
  7. package/dist/commands/json/validate.d.ts +1 -1
  8. package/dist/commands/json/validate.js +62 -73
  9. package/dist/commands/xlr/compile.d.ts +1 -1
  10. package/dist/commands/xlr/compile.js +73 -79
  11. package/dist/commands/xlr/convert.d.ts +1 -1
  12. package/dist/commands/xlr/convert.js +59 -68
  13. package/dist/config.d.ts +2 -2
  14. package/dist/config.js +1 -0
  15. package/dist/index.d.ts +5 -5
  16. package/dist/index.js +6 -18
  17. package/dist/plugins/LSPAssetsPlugin.d.ts +2 -2
  18. package/dist/plugins/LSPAssetsPlugin.js +3 -13
  19. package/dist/plugins/LSPPluginPlugin.d.ts +2 -2
  20. package/dist/plugins/LSPPluginPlugin.js +3 -13
  21. package/dist/plugins/LSPTransformsPlugin.d.ts +3 -3
  22. package/dist/plugins/LSPTransformsPlugin.js +3 -13
  23. package/dist/plugins/index.d.ts +9 -9
  24. package/dist/plugins/index.js +5 -17
  25. package/dist/utils/babel-register.js +8 -9
  26. package/dist/utils/base-command.d.ts +7 -7
  27. package/dist/utils/base-command.js +107 -136
  28. package/dist/utils/compilation-context.d.ts +2 -2
  29. package/dist/utils/compilation-context.js +3 -11
  30. package/dist/utils/compile-renderer.d.ts +2 -2
  31. package/dist/utils/compile-renderer.js +14 -16
  32. package/dist/utils/compiler-options.d.ts +3 -0
  33. package/dist/utils/compiler-options.js +16 -0
  34. package/dist/utils/diag-renderer.d.ts +2 -2
  35. package/dist/utils/diag-renderer.js +35 -36
  36. package/dist/utils/fs.js +4 -5
  37. package/dist/utils/task-runner.d.ts +4 -4
  38. package/dist/utils/task-runner.js +15 -22
  39. package/dist/utils/xlr/consts.js +9 -8
  40. package/dist/utils/xlr/visitors/file.d.ts +2 -2
  41. package/dist/utils/xlr/visitors/file.js +6 -7
  42. package/dist/utils/xlr/visitors/index.d.ts +3 -3
  43. package/dist/utils/xlr/visitors/index.js +5 -17
  44. package/dist/utils/xlr/visitors/plugin.d.ts +2 -2
  45. package/dist/utils/xlr/visitors/plugin.js +29 -37
  46. package/dist/utils/xlr/visitors/types.d.ts +2 -2
  47. package/dist/utils/xlr/visitors/types.js +1 -0
  48. package/package.json +46 -36
  49. package/oclif.manifest.json +0 -1
package/dist/index.js CHANGED
@@ -1,23 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.run = void 0;
4
+ const tslib_1 = require("tslib");
18
5
  var core_1 = require("@oclif/core");
19
6
  Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
20
- __exportStar(require("./config"), exports);
21
- __exportStar(require("./plugins"), exports);
22
- __exportStar(require("./utils/base-command"), exports);
23
- __exportStar(require("./utils/compilation-context"), exports);
7
+ tslib_1.__exportStar(require("./config"), exports);
8
+ tslib_1.__exportStar(require("./plugins"), exports);
9
+ tslib_1.__exportStar(require("./utils/base-command"), exports);
10
+ tslib_1.__exportStar(require("./utils/compilation-context"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import type { PlayerLanguageService } from '@player-tools/json-language-service';
2
- import type { PlayerCLIPlugin } from './index';
1
+ import type { PlayerLanguageService } from "@player-tools/json-language-service";
2
+ import type { PlayerCLIPlugin } from "./index";
3
3
  export interface LSPAssetsPluginConfig {
4
4
  /** the path to the asset library to load */
5
5
  path: string;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.LSPAssetsPlugin = void 0;
13
4
  /**
@@ -29,10 +20,9 @@ class LSPAssetsPlugin {
29
20
  constructor(config) {
30
21
  this.config = config;
31
22
  }
32
- onCreateLanguageService(lsp, exp) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- yield lsp.setAssetTypes([this.config.path]);
35
- });
23
+ async onCreateLanguageService(lsp, exp) {
24
+ await lsp.setAssetTypes([this.config.path]);
36
25
  }
37
26
  }
38
27
  exports.LSPAssetsPlugin = LSPAssetsPlugin;
28
+ //# sourceMappingURL=LSPAssetsPlugin.js.map
@@ -1,5 +1,5 @@
1
- import type { PlayerLanguageService, PlayerLanguageServicePlugin } from '@player-tools/json-language-service';
2
- import type { PlayerCLIPlugin } from './index';
1
+ import type { PlayerLanguageService, PlayerLanguageServicePlugin } from "@player-tools/json-language-service";
2
+ import type { PlayerCLIPlugin } from "./index";
3
3
  /**
4
4
  * Handles adding a LSP Plugin to the LSP
5
5
  */
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.LSPPluginPlugin = void 0;
13
4
  /**
@@ -17,10 +8,9 @@ class LSPPluginPlugin {
17
8
  constructor(plugin) {
18
9
  this.plugin = plugin;
19
10
  }
20
- onCreateLanguageService(lsp, exp) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- lsp.addLSPPlugin(this.plugin);
23
- });
11
+ async onCreateLanguageService(lsp, exp) {
12
+ lsp.addLSPPlugin(this.plugin);
24
13
  }
25
14
  }
26
15
  exports.LSPPluginPlugin = LSPPluginPlugin;
16
+ //# sourceMappingURL=LSPPluginPlugin.js.map
@@ -1,6 +1,6 @@
1
- import type { PlayerLanguageService } from '@player-tools/json-language-service';
2
- import type { TransformFunction } from '@player-tools/xlr';
3
- import type { PlayerCLIPlugin } from './index';
1
+ import type { PlayerLanguageService } from "@player-tools/json-language-service";
2
+ import type { TransformFunction } from "@player-tools/xlr";
3
+ import type { PlayerCLIPlugin } from "./index";
4
4
  /**
5
5
  * Handles adding XLR transforms to the LSP's XLR SDK
6
6
  */
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.LSPTransformsPlugin = void 0;
13
4
  /**
@@ -17,10 +8,9 @@ class LSPTransformsPlugin {
17
8
  constructor(functionsToLoad) {
18
9
  this.functionsToLoad = functionsToLoad;
19
10
  }
20
- onCreateLanguageService(lsp, exp) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- lsp.addXLRTransforms(this.functionsToLoad);
23
- });
11
+ async onCreateLanguageService(lsp, exp) {
12
+ lsp.addXLRTransforms(this.functionsToLoad);
24
13
  }
25
14
  }
26
15
  exports.LSPTransformsPlugin = LSPTransformsPlugin;
16
+ //# sourceMappingURL=LSPTransformsPlugin.js.map
@@ -1,11 +1,11 @@
1
- import type { PlayerLanguageService } from '@player-tools/json-language-service';
2
- import type { DSLCompiler } from '@player-tools/dsl';
3
- import type { ExportTypes } from '@player-tools/xlr-sdk';
4
- import type { TransformFunction } from '@player-tools/xlr';
5
- import type { CompilationContext } from '../utils/compilation-context';
6
- export * from './LSPAssetsPlugin';
7
- export * from './LSPPluginPlugin';
8
- export * from './LSPTransformsPlugin';
1
+ import type { PlayerLanguageService } from "@player-tools/json-language-service";
2
+ import type { DSLCompiler } from "@player-tools/dsl";
3
+ import type { ExportTypes } from "@player-tools/xlr-sdk";
4
+ import type { TransformFunction } from "@player-tools/xlr";
5
+ import type { CompilationContext } from "../utils/compilation-context";
6
+ export * from "./LSPAssetsPlugin";
7
+ export * from "./LSPPluginPlugin";
8
+ export * from "./LSPTransformsPlugin";
9
9
  export interface PlayerCLIPlugin {
10
10
  /**
11
11
  * Handler when an LSP instance is created
@@ -27,7 +27,7 @@ export interface PlayerCLIPlugin {
27
27
  */
28
28
  createCompilerContext?: (context: CompilationContext) => void | Promise<void>;
29
29
  }
30
- export declare type PlayerCLIClass = {
30
+ export type PlayerCLIClass = {
31
31
  new (): PlayerCLIPlugin;
32
32
  };
33
33
  //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./LSPAssetsPlugin"), exports);
18
- __exportStar(require("./LSPPluginPlugin"), exports);
19
- __exportStar(require("./LSPTransformsPlugin"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./LSPAssetsPlugin"), exports);
5
+ tslib_1.__exportStar(require("./LSPPluginPlugin"), exports);
6
+ tslib_1.__exportStar(require("./LSPTransformsPlugin"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -1,20 +1,19 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.registerForPaths = void 0;
7
- const register_1 = __importDefault(require("@babel/register"));
4
+ const tslib_1 = require("tslib");
5
+ const register_1 = tslib_1.__importDefault(require("@babel/register"));
8
6
  /** Register a `require()` loader for any of the given paths */
9
7
  const registerForPaths = () => {
10
8
  (0, register_1.default)({
11
- extensions: ['.es6', '.es', '.jsx', '.js', '.mjs', '.tsx', '.ts'],
9
+ extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".tsx", ".ts"],
12
10
  presets: [
13
- [require.resolve('@babel/preset-env'), { modules: 'cjs' }],
14
- require.resolve('@babel/preset-typescript'),
15
- require.resolve('@babel/preset-react'),
11
+ [require.resolve("@babel/preset-env"), { modules: "cjs" }],
12
+ require.resolve("@babel/preset-typescript"),
13
+ require.resolve("@babel/preset-react"),
16
14
  ],
17
- plugins: [require.resolve('@babel/plugin-transform-react-jsx-source')],
15
+ plugins: [require.resolve("@babel/plugin-transform-react-jsx-source")],
18
16
  });
19
17
  };
20
18
  exports.registerForPaths = registerForPaths;
19
+ //# sourceMappingURL=babel-register.js.map
@@ -1,10 +1,10 @@
1
- import { Command } from '@oclif/core';
2
- import { PlayerLanguageService } from '@player-tools/json-language-service';
3
- import { DSLCompiler } from '@player-tools/dsl';
4
- import type { ExportTypes } from '@player-tools/xlr-sdk';
5
- import type { TransformFunction } from '@player-tools/xlr';
6
- import type { PlayerConfigResolvedShape } from '../config';
7
- import { CompilationContext } from './compilation-context';
1
+ import { Command } from "@oclif/core";
2
+ import { PlayerLanguageService } from "@player-tools/json-language-service";
3
+ import { DSLCompiler } from "@player-tools/dsl";
4
+ import type { ExportTypes } from "@player-tools/xlr-sdk";
5
+ import type { TransformFunction } from "@player-tools/xlr";
6
+ import type { PlayerConfigResolvedShape } from "../config";
7
+ import { CompilationContext } from "./compilation-context";
8
8
  /** The common configs for all */
9
9
  export declare abstract class BaseCommand extends Command {
10
10
  static flags: {
@@ -1,171 +1,141 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.BaseCommand = void 0;
16
- /* eslint-disable import/no-dynamic-require */
17
- /* eslint-disable global-require */
18
- /* eslint-disable @typescript-eslint/no-var-requires */
4
+ const tslib_1 = require("tslib");
19
5
  const core_1 = require("@oclif/core");
20
- const path_1 = __importDefault(require("path"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
21
7
  const cosmiconfig_1 = require("cosmiconfig");
22
8
  const json_language_service_1 = require("@player-tools/json-language-service");
23
9
  const dsl_1 = require("@player-tools/dsl");
24
10
  const compilation_context_1 = require("./compilation-context");
25
- const configLoader = (0, cosmiconfig_1.cosmiconfig)('player');
11
+ const configLoader = (0, cosmiconfig_1.cosmiconfig)("player");
26
12
  /** The common configs for all */
27
13
  class BaseCommand extends core_1.Command {
28
- loadConfig(configFilePath) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- if (configFilePath) {
31
- try {
32
- return yield configLoader.load(configFilePath);
33
- }
34
- catch (e) {
35
- this.warn(`Error loading config file: ${configFilePath}`);
36
- }
14
+ async loadConfig(configFilePath) {
15
+ if (configFilePath) {
16
+ try {
17
+ return await configLoader.load(configFilePath);
37
18
  }
38
- return configLoader.search();
39
- });
19
+ catch (e) {
20
+ this.warn(`Error loading config file: ${configFilePath}`);
21
+ }
22
+ }
23
+ return configLoader.search();
40
24
  }
41
- resolveConfig(conf, relativePath) {
42
- var _a, _b, _c, _d;
43
- return __awaiter(this, void 0, void 0, function* () {
44
- let config = Object.assign(Object.assign({}, (conf !== null && conf !== void 0 ? conf : {})), { plugins: [] });
45
- // If there's an extension load it
46
- if (conf === null || conf === void 0 ? void 0 : conf.extends) {
47
- let normalizedExtension;
48
- if (typeof conf.extends === 'string') {
49
- const requiredExtendedConfig = require(conf.extends);
50
- normalizedExtension =
51
- (_a = requiredExtendedConfig.default) !== null && _a !== void 0 ? _a : requiredExtendedConfig;
52
- }
53
- else {
54
- normalizedExtension = conf.extends;
55
- }
56
- config = Object.assign({}, (yield this.resolveConfig(normalizedExtension, relativePath)));
25
+ async resolveConfig(conf, relativePath) {
26
+ let config = {
27
+ ...(conf ?? {}),
28
+ plugins: [],
29
+ };
30
+ // If there's an extension load it
31
+ if (conf?.extends) {
32
+ let normalizedExtension;
33
+ if (typeof conf.extends === "string") {
34
+ const requiredExtendedConfig = await Promise.resolve(`${conf.extends}`).then(s => tslib_1.__importStar(require(s)));
35
+ normalizedExtension =
36
+ requiredExtendedConfig.default ?? requiredExtendedConfig;
57
37
  }
58
- yield Promise.all((_c = (_b = conf === null || conf === void 0 ? void 0 : conf.presets) === null || _b === void 0 ? void 0 : _b.map((preset) => __awaiter(this, void 0, void 0, function* () {
59
- var _e;
60
- if (typeof preset === 'string') {
61
- const requiredExtendedConfig = require(preset);
62
- const normalizedExtension = (_e = requiredExtendedConfig.default) !== null && _e !== void 0 ? _e : requiredExtendedConfig;
63
- const extendedConfig = yield this.resolveConfig(normalizedExtension);
64
- config.plugins = [...extendedConfig.plugins, ...config.plugins];
65
- return;
66
- }
67
- const presetConfig = yield this.resolveConfig(preset);
68
- config.plugins = [...presetConfig.plugins, ...config.plugins];
69
- }))) !== null && _c !== void 0 ? _c : []);
70
- // Go through each plugin and load/create it
71
- (_d = conf === null || conf === void 0 ? void 0 : conf.plugins) === null || _d === void 0 ? void 0 : _d.forEach((pluginInfo) => {
72
- var _a;
73
- if (typeof pluginInfo === 'object' && !Array.isArray(pluginInfo)) {
38
+ else {
39
+ normalizedExtension = conf.extends;
40
+ }
41
+ config = {
42
+ ...(await this.resolveConfig(normalizedExtension, relativePath)),
43
+ };
44
+ }
45
+ await Promise.all(conf?.presets?.map(async (preset) => {
46
+ if (typeof preset === "string") {
47
+ const requiredExtendedConfig = await Promise.resolve(`${preset}`).then(s => tslib_1.__importStar(require(s)));
48
+ const normalizedExtension = requiredExtendedConfig.default ?? requiredExtendedConfig;
49
+ const extendedConfig = await this.resolveConfig(normalizedExtension);
50
+ config.plugins = [...extendedConfig.plugins, ...config.plugins];
51
+ return;
52
+ }
53
+ const presetConfig = await this.resolveConfig(preset);
54
+ config.plugins = [...presetConfig.plugins, ...config.plugins];
55
+ }) ?? []);
56
+ // Go through each plugin and load/create it
57
+ if (conf?.plugins) {
58
+ await Promise.all(conf?.plugins?.map(async (pluginInfo) => {
59
+ if (typeof pluginInfo === "object" && !Array.isArray(pluginInfo)) {
74
60
  config.plugins.push(pluginInfo);
75
61
  return;
76
62
  }
77
- const pluginName = typeof pluginInfo === 'string' ? pluginInfo : pluginInfo[0];
78
- const pluginArgs = typeof pluginInfo === 'string' ? undefined : pluginInfo[1];
63
+ const pluginName = typeof pluginInfo === "string" ? pluginInfo : pluginInfo[0];
64
+ const pluginArgs = typeof pluginInfo === "string" ? undefined : pluginInfo[1];
79
65
  let pluginLoadPath = pluginName;
80
- if (pluginName.startsWith('.')) {
81
- pluginLoadPath = path_1.default.resolve(relativePath !== null && relativePath !== void 0 ? relativePath : '', pluginName);
66
+ if (pluginName.startsWith(".")) {
67
+ pluginLoadPath = path_1.default.resolve(relativePath ?? "", pluginName);
82
68
  }
83
- this.debug('loading plugin from %s', pluginLoadPath);
69
+ this.debug("loading plugin from %s", pluginLoadPath);
84
70
  // Get the instance for the plugin
85
- const required = require(pluginLoadPath);
86
- const PluginExport = (_a = required.default) !== null && _a !== void 0 ? _a : required;
71
+ const required = await Promise.resolve(`${pluginLoadPath}`).then(s => tslib_1.__importStar(require(s)));
72
+ const PluginExport = required.default ?? required;
87
73
  if (!PluginExport) {
88
74
  return;
89
75
  }
90
- const pluginInstance = typeof PluginExport === 'object'
76
+ const pluginInstance = typeof PluginExport === "object"
91
77
  ? PluginExport
92
78
  : new PluginExport(pluginArgs);
93
79
  config.plugins.push(pluginInstance);
94
- });
95
- return config;
96
- });
80
+ }));
81
+ }
82
+ return config;
97
83
  }
98
- readConfig() {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- const { flags } = yield this.parse(BaseCommand);
101
- const configFile = yield this.loadConfig(flags.config);
102
- return this.resolveConfig(configFile === null || configFile === void 0 ? void 0 : configFile.config);
103
- });
84
+ async readConfig() {
85
+ const { flags } = await this.parse(BaseCommand);
86
+ const configFile = await this.loadConfig(flags.config);
87
+ return this.resolveConfig(configFile?.config);
104
88
  }
105
- getPlayerConfig() {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- if (this.resolvedConfig) {
108
- return this.resolvedConfig;
109
- }
110
- const c = yield this.readConfig();
111
- this.resolvedConfig = c;
112
- return c;
113
- });
89
+ async getPlayerConfig() {
90
+ if (this.resolvedConfig) {
91
+ return this.resolvedConfig;
92
+ }
93
+ const c = await this.readConfig();
94
+ this.resolvedConfig = c;
95
+ return c;
114
96
  }
115
- createLanguageService(exp) {
116
- var _a, _b;
117
- return __awaiter(this, void 0, void 0, function* () {
118
- const lsp = new json_language_service_1.PlayerLanguageService();
119
- const { plugins } = yield this.getPlayerConfig();
120
- for (let i = 0; i < plugins.length; i++) {
121
- // eslint-disable-next-line no-await-in-loop
122
- yield ((_b = (_a = plugins[i]).onCreateLanguageService) === null || _b === void 0 ? void 0 : _b.call(_a, lsp, exp));
123
- }
124
- return lsp;
125
- });
97
+ async createLanguageService(exp) {
98
+ const lsp = new json_language_service_1.PlayerLanguageService();
99
+ const { plugins } = await this.getPlayerConfig();
100
+ for (let i = 0; i < plugins.length; i++) {
101
+ // eslint-disable-next-line no-await-in-loop
102
+ await plugins[i].onCreateLanguageService?.(lsp, exp);
103
+ }
104
+ return lsp;
126
105
  }
127
- createDSLCompiler() {
128
- var _a, _b;
129
- return __awaiter(this, void 0, void 0, function* () {
130
- const compiler = new dsl_1.DSLCompiler({
131
- error: this.error.bind(this),
132
- warn: this.warn.bind(this),
133
- log: this.log.bind(this),
134
- });
135
- const { plugins } = yield this.getPlayerConfig();
136
- for (let i = 0; i < plugins.length; i++) {
137
- // eslint-disable-next-line no-await-in-loop
138
- yield ((_b = (_a = plugins[i]).onCreateDSLCompiler) === null || _b === void 0 ? void 0 : _b.call(_a, compiler));
139
- }
140
- return compiler;
106
+ async createDSLCompiler() {
107
+ const compiler = new dsl_1.DSLCompiler({
108
+ error: this.error.bind(this),
109
+ warn: this.warn.bind(this),
110
+ log: this.log.bind(this),
141
111
  });
112
+ const { plugins } = await this.getPlayerConfig();
113
+ for (let i = 0; i < plugins.length; i++) {
114
+ // eslint-disable-next-line no-await-in-loop
115
+ await plugins[i].onCreateDSLCompiler?.(compiler);
116
+ }
117
+ return compiler;
142
118
  }
143
- getXLRTransforms(format) {
144
- var _a, _b;
145
- return __awaiter(this, void 0, void 0, function* () {
146
- const transforms = [];
147
- const { plugins } = yield this.getPlayerConfig();
148
- for (let i = 0; i < plugins.length; i++) {
149
- // eslint-disable-next-line no-await-in-loop
150
- yield ((_b = (_a = plugins[i]).onConvertXLR) === null || _b === void 0 ? void 0 : _b.call(_a, format, transforms));
151
- }
152
- return transforms;
153
- });
119
+ async getXLRTransforms(format) {
120
+ const transforms = [];
121
+ const { plugins } = await this.getPlayerConfig();
122
+ for (let i = 0; i < plugins.length; i++) {
123
+ // eslint-disable-next-line no-await-in-loop
124
+ await plugins[i].onConvertXLR?.(format, transforms);
125
+ }
126
+ return transforms;
154
127
  }
155
- createCompilerContext() {
156
- var _a, _b;
157
- return __awaiter(this, void 0, void 0, function* () {
158
- const compilerContext = new compilation_context_1.CompilationContext(yield this.createDSLCompiler());
159
- const { plugins } = yield this.getPlayerConfig();
160
- for (let i = 0; i < plugins.length; i++) {
161
- // eslint-disable-next-line no-await-in-loop
162
- yield ((_b = (_a = plugins[i]).createCompilerContext) === null || _b === void 0 ? void 0 : _b.call(_a, compilerContext));
163
- }
164
- return compilerContext;
165
- });
128
+ async createCompilerContext() {
129
+ const compilerContext = new compilation_context_1.CompilationContext(await this.createDSLCompiler());
130
+ const { plugins } = await this.getPlayerConfig();
131
+ for (let i = 0; i < plugins.length; i++) {
132
+ // eslint-disable-next-line no-await-in-loop
133
+ await plugins[i].createCompilerContext?.(compilerContext);
134
+ }
135
+ return compilerContext;
166
136
  }
167
137
  exit(code) {
168
- if (process.env.NODE_ENV !== 'test') {
138
+ if (process.env.NODE_ENV !== "test") {
169
139
  super.exit(code);
170
140
  }
171
141
  }
@@ -173,8 +143,9 @@ class BaseCommand extends core_1.Command {
173
143
  exports.BaseCommand = BaseCommand;
174
144
  BaseCommand.flags = {
175
145
  config: core_1.Flags.string({
176
- description: 'Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load',
177
- char: 'c',
146
+ description: "Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load",
147
+ char: "c",
178
148
  }),
179
149
  };
180
150
  BaseCommand.strict = false;
151
+ //# sourceMappingURL=base-command.js.map
@@ -1,5 +1,5 @@
1
- import type { DSLCompiler, CompilerReturn, SerializeContext } from '@player-tools/dsl';
2
- import { AsyncSeriesBailHook } from 'tapable-ts';
1
+ import type { DSLCompiler, CompilerReturn, SerializeContext } from "@player-tools/dsl";
2
+ import { AsyncSeriesBailHook } from "tapable-ts";
3
3
  /**
4
4
  *
5
5
  */
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.CompilationContext = void 0;
13
4
  const dsl_1 = require("@player-tools/dsl");
@@ -38,11 +29,12 @@ class CompilationContext {
38
29
  compileContent: new tapable_ts_1.AsyncSeriesBailHook(),
39
30
  };
40
31
  this.dslCompiler = dslCompiler;
41
- this.hooks.compileContent.tap('default', ({ type }, content) => __awaiter(this, void 0, void 0, function* () {
32
+ this.hooks.compileContent.tap("default", async ({ type }, content) => {
42
33
  if ((0, dsl_1.isDefaultCompilerContentType)(type)) {
43
34
  return this.dslCompiler.serialize(content, { type });
44
35
  }
45
- }));
36
+ });
46
37
  }
47
38
  }
48
39
  exports.CompilationContext = CompilationContext;
40
+ //# sourceMappingURL=compilation-context.js.map
@@ -1,5 +1,5 @@
1
- import type { SerializeType } from '@player-tools/dsl';
2
- import type { TaskProgressRenderer } from './task-runner';
1
+ import type { SerializeType } from "@player-tools/dsl";
2
+ import type { TaskProgressRenderer } from "./task-runner";
3
3
  export interface DSLCompileFileData {
4
4
  /** the file name */
5
5
  file: string;