@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.
- package/dist/commands/dependency-versions/check.d.ts +18 -0
- package/dist/commands/dependency-versions/check.js +271 -0
- package/dist/commands/dsl/compile.d.ts +2 -2
- package/dist/commands/dsl/compile.js +136 -141
- package/dist/commands/dsl/validate.d.ts +12 -0
- package/dist/commands/dsl/validate.js +76 -0
- package/dist/commands/json/validate.d.ts +1 -1
- package/dist/commands/json/validate.js +62 -73
- package/dist/commands/xlr/compile.d.ts +1 -1
- package/dist/commands/xlr/compile.js +73 -79
- package/dist/commands/xlr/convert.d.ts +1 -1
- package/dist/commands/xlr/convert.js +59 -68
- package/dist/config.d.ts +2 -2
- package/dist/config.js +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -18
- package/dist/plugins/LSPAssetsPlugin.d.ts +2 -2
- package/dist/plugins/LSPAssetsPlugin.js +3 -13
- package/dist/plugins/LSPPluginPlugin.d.ts +2 -2
- package/dist/plugins/LSPPluginPlugin.js +3 -13
- package/dist/plugins/LSPTransformsPlugin.d.ts +3 -3
- package/dist/plugins/LSPTransformsPlugin.js +3 -13
- package/dist/plugins/index.d.ts +9 -9
- package/dist/plugins/index.js +5 -17
- package/dist/utils/babel-register.js +8 -9
- package/dist/utils/base-command.d.ts +7 -7
- package/dist/utils/base-command.js +107 -136
- package/dist/utils/compilation-context.d.ts +2 -2
- package/dist/utils/compilation-context.js +3 -11
- package/dist/utils/compile-renderer.d.ts +2 -2
- package/dist/utils/compile-renderer.js +14 -16
- package/dist/utils/compiler-options.d.ts +3 -0
- package/dist/utils/compiler-options.js +16 -0
- package/dist/utils/diag-renderer.d.ts +2 -2
- package/dist/utils/diag-renderer.js +35 -36
- package/dist/utils/fs.js +4 -5
- package/dist/utils/task-runner.d.ts +4 -4
- package/dist/utils/task-runner.js +15 -22
- package/dist/utils/xlr/consts.js +9 -8
- package/dist/utils/xlr/visitors/file.d.ts +2 -2
- package/dist/utils/xlr/visitors/file.js +6 -7
- package/dist/utils/xlr/visitors/index.d.ts +3 -3
- package/dist/utils/xlr/visitors/index.js +5 -17
- package/dist/utils/xlr/visitors/plugin.d.ts +2 -2
- package/dist/utils/xlr/visitors/plugin.js +29 -37
- package/dist/utils/xlr/visitors/types.d.ts +2 -2
- package/dist/utils/xlr/visitors/types.js +1 -0
- package/package.json +46 -36
- 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
|
|
2
|
-
import type { PlayerCLIPlugin } from
|
|
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
|
-
|
|
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
|
|
2
|
-
import type { PlayerCLIPlugin } from
|
|
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
|
-
|
|
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
|
|
2
|
-
import type { TransformFunction } from
|
|
3
|
-
import type { PlayerCLIPlugin } from
|
|
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
|
-
|
|
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
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { PlayerLanguageService } from
|
|
2
|
-
import type { DSLCompiler } from
|
|
3
|
-
import type { ExportTypes } from
|
|
4
|
-
import type { TransformFunction } from
|
|
5
|
-
import type { CompilationContext } from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
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
|
|
30
|
+
export type PlayerCLIClass = {
|
|
31
31
|
new (): PlayerCLIPlugin;
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/plugins/index.js
CHANGED
|
@@ -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
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
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
|
|
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: [
|
|
9
|
+
extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".tsx", ".ts"],
|
|
12
10
|
presets: [
|
|
13
|
-
[require.resolve(
|
|
14
|
-
require.resolve(
|
|
15
|
-
require.resolve(
|
|
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(
|
|
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
|
|
2
|
-
import { PlayerLanguageService } from
|
|
3
|
-
import { DSLCompiler } from
|
|
4
|
-
import type { ExportTypes } from
|
|
5
|
-
import type { TransformFunction } from
|
|
6
|
-
import type { PlayerConfigResolvedShape } from
|
|
7
|
-
import { CompilationContext } from
|
|
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
|
-
|
|
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)(
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 ===
|
|
78
|
-
const pluginArgs = typeof pluginInfo ===
|
|
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
|
|
66
|
+
if (pluginName.startsWith(".")) {
|
|
67
|
+
pluginLoadPath = path_1.default.resolve(relativePath ?? "", pluginName);
|
|
82
68
|
}
|
|
83
|
-
this.debug(
|
|
69
|
+
this.debug("loading plugin from %s", pluginLoadPath);
|
|
84
70
|
// Get the instance for the plugin
|
|
85
|
-
const required =
|
|
86
|
-
const PluginExport =
|
|
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 ===
|
|
76
|
+
const pluginInstance = typeof PluginExport === "object"
|
|
91
77
|
? PluginExport
|
|
92
78
|
: new PluginExport(pluginArgs);
|
|
93
79
|
config.plugins.push(pluginInstance);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
return config;
|
|
97
83
|
}
|
|
98
|
-
readConfig() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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 !==
|
|
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:
|
|
177
|
-
char:
|
|
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
|
|
2
|
-
import { AsyncSeriesBailHook } from
|
|
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(
|
|
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
|
|
2
|
-
import type { TaskProgressRenderer } from
|
|
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;
|