@player-tools/cli 0.0.2-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.
@@ -0,0 +1,86 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const core_1 = require("@oclif/core");
16
+ const path_1 = __importDefault(require("path"));
17
+ const fs_1 = __importDefault(require("fs"));
18
+ const chalk_1 = __importDefault(require("chalk"));
19
+ const xlr_sdk_1 = require("@player-tools/xlr-sdk");
20
+ const log_symbols_1 = __importDefault(require("log-symbols"));
21
+ const base_command_1 = require("../../utils/base-command");
22
+ const PlayerImportMap = new Map([
23
+ [
24
+ '@player-ui/types',
25
+ ['Expression', 'Asset', 'Binding', 'AssetWrapper', 'Schema.DataType'],
26
+ ],
27
+ ]);
28
+ /**
29
+ * Converts XLRs into a specific language
30
+ */
31
+ class XLRConvert extends base_command_1.BaseCommand {
32
+ getOptions() {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const { flags } = yield this.parse(XLRConvert);
35
+ const { input, output } = flags;
36
+ if (!output) {
37
+ throw new Error(`Need to specify location to export to`);
38
+ }
39
+ const language = flags.lang;
40
+ if (!language) {
41
+ throw new Error(`Need to specifiy lanauge to export to`);
42
+ }
43
+ return {
44
+ inputPath: input,
45
+ outputDir: path_1.default.join(output, language),
46
+ language,
47
+ };
48
+ });
49
+ }
50
+ run() {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const { inputPath, outputDir, language } = yield this.getOptions();
53
+ try {
54
+ if (!fs_1.default.existsSync(outputDir)) {
55
+ fs_1.default.mkdirSync(outputDir, { recursive: true });
56
+ }
57
+ const sdk = new xlr_sdk_1.XLRSDK();
58
+ sdk.loadDefinitionsFromDisk(inputPath);
59
+ const files = sdk.exportRegistry(language, PlayerImportMap);
60
+ files.forEach(([filename, fileContents]) => {
61
+ fs_1.default.writeFileSync(path_1.default.join(outputDir, filename), fileContents, {});
62
+ });
63
+ }
64
+ catch (e) {
65
+ console.log('');
66
+ console.log(chalk_1.default.red(`${log_symbols_1.default.error} Error exporting XLRs: ${e.message}`));
67
+ return { exitCode: 1 };
68
+ }
69
+ return { exitCode: 0 };
70
+ });
71
+ }
72
+ }
73
+ exports.default = XLRConvert;
74
+ XLRConvert.description = 'Exports XLRs files to a specific language';
75
+ XLRConvert.flags = Object.assign(Object.assign({}, base_command_1.BaseCommand.flags), { input: core_1.Flags.string({
76
+ char: 'i',
77
+ description: 'An input directory to search for types to export',
78
+ default: './dist',
79
+ }), output: core_1.Flags.string({
80
+ char: 'o',
81
+ description: 'Output directory to write results to.',
82
+ }), lang: core_1.Flags.enum({
83
+ char: 'l',
84
+ description: 'Search strategy for types to export: plugin (default, looks for exported EnchancedPlayerPlugin classes) or type (all exported types)',
85
+ options: ['TypeScript'],
86
+ }) });
@@ -0,0 +1,37 @@
1
+ import type { PlayerCLIPlugin } from './plugins';
2
+ export interface PlayerConfigFileShape {
3
+ /** A base config to inherit defaults from */
4
+ extends?: string | PlayerConfigFileShape;
5
+ /** A list of plugins to apply */
6
+ plugins?: Array<string | [string, any] | PlayerCLIPlugin>;
7
+ /** A list of presets to apply */
8
+ presets?: Array<PlayerConfigFileShape | string>;
9
+ }
10
+ export interface PlayerConfigResolvedShape {
11
+ /** Options related to the DSL and compilation */
12
+ dsl?: {
13
+ /** An input directory for compilation */
14
+ src?: string;
15
+ /** An output directory to use */
16
+ outDir?: string;
17
+ /** Flag to omit validating the resulting JSON */
18
+ skipValidation?: boolean;
19
+ };
20
+ /** Options related to JSON and validation */
21
+ json?: {
22
+ /** An input file, directory, glob, or list of any of the above to use as inputs for validation */
23
+ src?: string | string[];
24
+ };
25
+ /** Options related to XLR compilation step */
26
+ xlr?: {
27
+ /** Path to start searching for types to import/export */
28
+ input?: string;
29
+ /** Where to write the resulting files */
30
+ output?: string;
31
+ /** When converting to XLR, what strategy to use */
32
+ mode?: 'plugin' | 'types';
33
+ };
34
+ /** Flattened list of plugins */
35
+ plugins: Array<PlayerCLIPlugin>;
36
+ }
37
+ //# sourceMappingURL=config.d.ts.map
package/dist/config.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export { run } from '@oclif/core';
2
+ export * from './config';
3
+ export * from './plugins';
4
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.run = void 0;
14
+ var core_1 = require("@oclif/core");
15
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
16
+ __exportStar(require("./config"), exports);
17
+ __exportStar(require("./plugins"), exports);
@@ -0,0 +1,29 @@
1
+ import type { PlayerLanguageService } from '@player-tools/language-service';
2
+ import type { PlayerCLIPlugin } from './index';
3
+ export interface Config {
4
+ /** the path to the asset library to load */
5
+ path: string;
6
+ /** Provides experimental language features */
7
+ exp?: boolean;
8
+ }
9
+ /**
10
+ * Handles setting the assets when loading the LSP
11
+ *
12
+ * {
13
+ * "plugins": [
14
+ * [
15
+ * "@cli/lsp-assets-plugin",
16
+ * {
17
+ * "path": "<url> or <path>"
18
+ * }
19
+ * ]
20
+ * ]
21
+ * }
22
+ *
23
+ */
24
+ export declare class LSPAssetsPlugin implements PlayerCLIPlugin {
25
+ private config;
26
+ constructor(config: Config);
27
+ onCreateLanguageService(lsp: PlayerLanguageService, exp: boolean): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=LSPAssetsPlugin.d.ts.map
@@ -0,0 +1,40 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LSPAssetsPlugin = void 0;
13
+ /**
14
+ * Handles setting the assets when loading the LSP
15
+ *
16
+ * {
17
+ * "plugins": [
18
+ * [
19
+ * "@cli/lsp-assets-plugin",
20
+ * {
21
+ * "path": "<url> or <path>"
22
+ * }
23
+ * ]
24
+ * ]
25
+ * }
26
+ *
27
+ */
28
+ class LSPAssetsPlugin {
29
+ constructor(config) {
30
+ this.config = config;
31
+ }
32
+ onCreateLanguageService(lsp, exp) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ if (exp === this.config.exp) {
35
+ yield lsp.setAssetTypes([this.config.path]);
36
+ }
37
+ });
38
+ }
39
+ }
40
+ exports.LSPAssetsPlugin = LSPAssetsPlugin;
@@ -0,0 +1,26 @@
1
+ import type { PlayerLanguageService } from '@player-tools/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
+ export * from './LSPAssetsPlugin';
6
+ export interface PlayerCLIPlugin {
7
+ /**
8
+ * Handler when an LSP instance is created
9
+ * Use this to add custom rule-sets, load asset types, etc
10
+ */
11
+ onCreateLanguageService?: (lsp: PlayerLanguageService, exp: boolean) => void | Promise<void>;
12
+ /**
13
+ * Handler when a DSL compiler is created
14
+ * Use this to change how content is generated
15
+ */
16
+ onCreateDSLCompiler?: (compiler: DSLCompiler) => void | Promise<void>;
17
+ /**
18
+ * Handler for when context is being converted from XLRs to a language specific representation
19
+ * Append the transforms to apply to the passed in array based on the provided format
20
+ */
21
+ onConvertXLR?: (format: ExportTypes, transforms: Array<TransformFunction>) => void | Promise<void>;
22
+ }
23
+ export declare type PlayerCLIClass = {
24
+ new (): PlayerCLIPlugin;
25
+ };
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./LSPAssetsPlugin"), exports);
@@ -0,0 +1,3 @@
1
+ /** Register a `require()` loader for any of the given paths */
2
+ export declare const registerForPaths: () => void;
3
+ //# sourceMappingURL=babel-register.d.ts.map
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.registerForPaths = void 0;
7
+ const register_1 = __importDefault(require("@babel/register"));
8
+ /** Register a `require()` loader for any of the given paths */
9
+ const registerForPaths = () => {
10
+ (0, register_1.default)({
11
+ extensions: ['.es6', '.es', '.jsx', '.js', '.mjs', '.tsx', '.ts'],
12
+ presets: [
13
+ ['@babel/preset-env', { modules: 'cjs' }],
14
+ '@babel/preset-typescript',
15
+ '@babel/preset-react',
16
+ ],
17
+ plugins: ['@babel/plugin-transform-react-jsx-source'],
18
+ });
19
+ };
20
+ exports.registerForPaths = registerForPaths;
@@ -0,0 +1,22 @@
1
+ import { Command } from '@oclif/core';
2
+ import { PlayerLanguageService } from '@player-tools/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
+ /** The common configs for all */
8
+ export declare abstract class BaseCommand extends Command {
9
+ static flags: {
10
+ config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
+ };
12
+ private resolvedConfig;
13
+ private loadConfig;
14
+ private resolveConfig;
15
+ private readConfig;
16
+ protected getPlayerConfig(): Promise<PlayerConfigResolvedShape>;
17
+ createLanguageService(exp: boolean): Promise<PlayerLanguageService>;
18
+ createDSLCompiler(): Promise<DSLCompiler>;
19
+ getXLRTransforms(format: ExportTypes): Promise<Array<TransformFunction>>;
20
+ exit(code?: number): void;
21
+ }
22
+ //# sourceMappingURL=base-command.d.ts.map
@@ -0,0 +1,162 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BaseCommand = void 0;
16
+ /* eslint-disable import/no-dynamic-require */
17
+ /* eslint-disable global-require */
18
+ /* eslint-disable @typescript-eslint/no-var-requires */
19
+ const core_1 = require("@oclif/core");
20
+ const path_1 = __importDefault(require("path"));
21
+ const cosmiconfig_1 = require("cosmiconfig");
22
+ const language_service_1 = require("@player-tools/language-service");
23
+ const dsl_1 = require("@player-tools/dsl");
24
+ const configLoader = (0, cosmiconfig_1.cosmiconfig)('player');
25
+ /** The common configs for all */
26
+ class BaseCommand extends core_1.Command {
27
+ loadConfig(configFilePath) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ if (configFilePath) {
30
+ try {
31
+ return yield configLoader.load(configFilePath);
32
+ }
33
+ catch (e) {
34
+ this.warn(`Error loading config file: ${configFilePath}`);
35
+ }
36
+ }
37
+ return configLoader.search();
38
+ });
39
+ }
40
+ resolveConfig(conf, relativePath) {
41
+ var _a, _b, _c, _d;
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ let config = Object.assign(Object.assign({}, (conf !== null && conf !== void 0 ? conf : {})), { plugins: [] });
44
+ // If there's an extension load it
45
+ if (conf === null || conf === void 0 ? void 0 : conf.extends) {
46
+ let normalizedExtension;
47
+ if (typeof conf.extends === 'string') {
48
+ const requiredExtendedConfig = require(conf.extends);
49
+ normalizedExtension =
50
+ (_a = requiredExtendedConfig.default) !== null && _a !== void 0 ? _a : requiredExtendedConfig;
51
+ }
52
+ else {
53
+ normalizedExtension = conf.extends;
54
+ }
55
+ config = Object.assign({}, (yield this.resolveConfig(normalizedExtension, relativePath)));
56
+ }
57
+ 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* () {
58
+ var _e;
59
+ if (typeof preset === 'string') {
60
+ const requiredExtendedConfig = require(preset);
61
+ const normalizedExtension = (_e = requiredExtendedConfig.default) !== null && _e !== void 0 ? _e : requiredExtendedConfig;
62
+ const extendedConfig = yield this.resolveConfig(normalizedExtension);
63
+ config.plugins = [...extendedConfig.plugins, ...config.plugins];
64
+ return;
65
+ }
66
+ const presetConfig = yield this.resolveConfig(preset);
67
+ config.plugins = [...presetConfig.plugins, ...config.plugins];
68
+ }))) !== null && _c !== void 0 ? _c : []);
69
+ // Go through each plugin and load/create it
70
+ (_d = conf === null || conf === void 0 ? void 0 : conf.plugins) === null || _d === void 0 ? void 0 : _d.forEach((pluginInfo) => {
71
+ var _a;
72
+ if (typeof pluginInfo === 'object' && !Array.isArray(pluginInfo)) {
73
+ config.plugins.push(pluginInfo);
74
+ return;
75
+ }
76
+ const pluginName = typeof pluginInfo === 'string' ? pluginInfo : pluginInfo[0];
77
+ const pluginArgs = typeof pluginInfo === 'string' ? undefined : pluginInfo[1];
78
+ let pluginLoadPath = pluginName;
79
+ if (pluginName.startsWith('.')) {
80
+ pluginLoadPath = path_1.default.resolve(relativePath !== null && relativePath !== void 0 ? relativePath : '', pluginName);
81
+ }
82
+ this.debug('loading plugin from %s', pluginLoadPath);
83
+ // Get the instance for the plugin
84
+ const required = require(pluginLoadPath);
85
+ const PluginExport = (_a = required.default) !== null && _a !== void 0 ? _a : required;
86
+ if (!PluginExport) {
87
+ return;
88
+ }
89
+ const pluginInstance = typeof PluginExport === 'object'
90
+ ? PluginExport
91
+ : new PluginExport(pluginArgs);
92
+ config.plugins.push(pluginInstance);
93
+ });
94
+ return config;
95
+ });
96
+ }
97
+ readConfig() {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ const { flags } = yield this.parse();
100
+ const configFile = yield this.loadConfig(flags.config);
101
+ return this.resolveConfig(configFile === null || configFile === void 0 ? void 0 : configFile.config);
102
+ });
103
+ }
104
+ getPlayerConfig() {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ if (this.resolvedConfig) {
107
+ return this.resolvedConfig;
108
+ }
109
+ const c = yield this.readConfig();
110
+ this.resolvedConfig = c;
111
+ return c;
112
+ });
113
+ }
114
+ createLanguageService(exp) {
115
+ var _a, _b;
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const lsp = new language_service_1.PlayerLanguageService();
118
+ const { plugins } = yield this.getPlayerConfig();
119
+ for (let i = 0; i < plugins.length; i++) {
120
+ // eslint-disable-next-line no-await-in-loop
121
+ yield ((_b = (_a = plugins[i]).onCreateLanguageService) === null || _b === void 0 ? void 0 : _b.call(_a, lsp, exp));
122
+ }
123
+ return lsp;
124
+ });
125
+ }
126
+ createDSLCompiler() {
127
+ var _a, _b;
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ const compiler = new dsl_1.DSLCompiler();
130
+ const { plugins } = yield this.getPlayerConfig();
131
+ for (let i = 0; i < plugins.length; i++) {
132
+ // eslint-disable-next-line no-await-in-loop
133
+ yield ((_b = (_a = plugins[i]).onCreateDSLCompiler) === null || _b === void 0 ? void 0 : _b.call(_a, compiler));
134
+ }
135
+ return compiler;
136
+ });
137
+ }
138
+ getXLRTransforms(format) {
139
+ var _a, _b;
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ const transforms = [];
142
+ const { plugins } = yield this.getPlayerConfig();
143
+ for (let i = 0; i < plugins.length; i++) {
144
+ // eslint-disable-next-line no-await-in-loop
145
+ yield ((_b = (_a = plugins[i]).onConvertXLR) === null || _b === void 0 ? void 0 : _b.call(_a, format, transforms));
146
+ }
147
+ return transforms;
148
+ });
149
+ }
150
+ exit(code) {
151
+ if (process.env.NODE_ENV !== 'test') {
152
+ super.exit(code);
153
+ }
154
+ }
155
+ }
156
+ exports.BaseCommand = BaseCommand;
157
+ BaseCommand.flags = {
158
+ config: core_1.Flags.string({
159
+ description: 'Path to a specific config file to load.\nBy default, will automatically search for an rc or config file to load',
160
+ char: 'c',
161
+ }),
162
+ };
@@ -0,0 +1,13 @@
1
+ import type { SerializeType } from '@player-tools/dsl';
2
+ import type { TaskProgressRenderer } from './task-runner';
3
+ export interface DSLCompileFileData {
4
+ /** the file name */
5
+ file: string;
6
+ /** the name of the output file */
7
+ outputFile?: string;
8
+ }
9
+ export declare const compileRenderer: TaskProgressRenderer<{
10
+ /** the type of content generated */
11
+ contentType: SerializeType;
12
+ } | undefined, DSLCompileFileData>;
13
+ //# sourceMappingURL=compile-renderer.d.ts.map
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.compileRenderer = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const figures_1 = __importDefault(require("figures"));
9
+ const diag_renderer_1 = require("./diag-renderer");
10
+ exports.compileRenderer = {
11
+ onUpdate: (ctx) => {
12
+ const output = [''];
13
+ ctx.tasks.forEach((task) => {
14
+ var _a, _b, _c;
15
+ const outputType = task.state === 'completed' && ((_a = task.output) === null || _a === void 0 ? void 0 : _a.contentType)
16
+ ? task.output.contentType
17
+ : undefined;
18
+ let titleLine = [
19
+ (0, diag_renderer_1.getTaskSymbol)(task),
20
+ outputType && `(${outputType})`,
21
+ (_b = task.data) === null || _b === void 0 ? void 0 : _b.file,
22
+ ]
23
+ .filter(Boolean)
24
+ .join(' ');
25
+ if ((_c = task.data) === null || _c === void 0 ? void 0 : _c.outputFile) {
26
+ titleLine = [
27
+ titleLine,
28
+ figures_1.default.arrowRight,
29
+ task.data.outputFile,
30
+ ].join(' ');
31
+ }
32
+ output.push(titleLine);
33
+ if (task.state === 'completed') {
34
+ if (task.error) {
35
+ output.push(` ${figures_1.default.arrowRight} ${chalk_1.default.red('bad')}`);
36
+ }
37
+ }
38
+ });
39
+ return output.join('\n');
40
+ },
41
+ onEnd: (ctx) => {
42
+ return [exports.compileRenderer.onUpdate(ctx)].join('\n');
43
+ },
44
+ };
@@ -0,0 +1,28 @@
1
+ import type { Diagnostic } from 'vscode-languageserver-types';
2
+ import type { Task, TaskProgressRenderer } from './task-runner';
3
+ /** Get the lines representing the summary of the results */
4
+ export declare function getSummary({ errors, warnings, skipped, fileCount, duration, }: {
5
+ /** Error count */
6
+ errors: number;
7
+ /** Warning count */
8
+ warnings: number;
9
+ /** number of skipped files */
10
+ skipped?: number;
11
+ /** File Count */
12
+ fileCount: number;
13
+ /** How long this took */
14
+ duration: number | undefined;
15
+ }): string;
16
+ /** Format the results for printing on the console */
17
+ export declare function formatDiagnosticResults(filePath: string, results: Diagnostic[], verbose?: boolean): {
18
+ lines: string[];
19
+ errors: number;
20
+ warnings: number;
21
+ };
22
+ /** Get the symbol for a given task */
23
+ export declare const getTaskSymbol: (task: Task<any, any>) => string;
24
+ export declare const validationRenderer: TaskProgressRenderer<Diagnostic[], {
25
+ /** the file name */
26
+ file: string;
27
+ }>;
28
+ //# sourceMappingURL=diag-renderer.d.ts.map