@player-tools/cli 0.9.0-next.0 → 0.9.0-next.1

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.
@@ -1,11 +1,31 @@
1
1
  import type { PlayerLanguageService } from "@player-tools/json-language-service";
2
2
  import type { PlayerCLIPlugin } from "./index";
3
- export interface LSPAssetsPluginConfig {
4
- /** the path to the asset library to load */
3
+ import { TSManifest } from "@player-tools/xlr";
4
+ /** Loads XLRs into the LSP via the manifest.js file */
5
+ export interface LSPAssetsPluginModuleConfig {
6
+ type: "module";
7
+ /** Result of module import/require of xlr manifest.js file */
8
+ manifest: TSManifest;
9
+ }
10
+ /** Loads XLRs to the LSP by specifying a filesystem location */
11
+ export interface LSPAssetsPluginManifestConfig {
12
+ type: "manifest";
13
+ /** Path to dist folder for XLR enabled plugins */
14
+ path: string;
15
+ }
16
+ /**
17
+ * Legacy type for providing XLR manifest paths that assumes its a manifest
18
+ * @deprecated
19
+ * */
20
+ export interface LSPAssetsPluginLegacyConfig {
21
+ type?: undefined;
5
22
  path: string;
23
+ }
24
+ export type LSPAssetPluginConfigTypes = LSPAssetsPluginModuleConfig | LSPAssetsPluginManifestConfig | LSPAssetsPluginLegacyConfig;
25
+ export type LSPAssetsPluginConfig = LSPAssetPluginConfigTypes & {
6
26
  /** Provides experimental language features */
7
27
  exp?: boolean;
8
- }
28
+ };
9
29
  /**
10
30
  * Handles setting the assets when loading the LSP
11
31
  *
@@ -25,5 +45,6 @@ export declare class LSPAssetsPlugin implements PlayerCLIPlugin {
25
45
  private config;
26
46
  constructor(config: LSPAssetsPluginConfig | Array<LSPAssetsPluginConfig>);
27
47
  onCreateLanguageService(lsp: PlayerLanguageService, exp: boolean): Promise<void>;
48
+ loadConfig(config: LSPAssetPluginConfigTypes, lsp: PlayerLanguageService): Promise<void>;
28
49
  }
29
50
  //# sourceMappingURL=LSPAssetsPlugin.d.ts.map
@@ -23,10 +23,23 @@ class LSPAssetsPlugin {
23
23
  }
24
24
  async onCreateLanguageService(lsp, exp) {
25
25
  if (Array.isArray(this.config)) {
26
- await lsp.setAssetTypes(this.config.map((c) => c.path));
26
+ await Promise.all(this.config.map((c) => {
27
+ this.loadConfig(c, lsp);
28
+ }));
27
29
  }
28
30
  else {
29
- await lsp.setAssetTypes([this.config.path]);
31
+ await this.loadConfig(this.config, lsp);
32
+ }
33
+ }
34
+ async loadConfig(config, lsp) {
35
+ if (config.type === "manifest" || config.type === undefined) {
36
+ await lsp.setAssetTypes([config.path]);
37
+ }
38
+ else if (config.type === "module") {
39
+ await lsp.setAssetTypesFromModule([config.manifest]);
40
+ }
41
+ else {
42
+ throw Error(`Unknown config type: ${config.type}`);
30
43
  }
31
44
  }
32
45
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "dist"
6
6
  ],
7
7
  "name": "@player-tools/cli",
8
- "version": "0.9.0-next.0",
8
+ "version": "0.9.0-next.1",
9
9
  "main": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
11
  "oclif": {
@@ -21,12 +21,12 @@
21
21
  "player": "bin/run"
22
22
  },
23
23
  "dependencies": {
24
- "@player-tools/dsl": "0.9.0-next.0",
25
- "@player-tools/json-language-service": "0.9.0-next.0",
26
- "@player-tools/xlr": "0.9.0-next.0",
27
- "@player-tools/xlr-converters": "0.9.0-next.0",
28
- "@player-tools/xlr-sdk": "0.9.0-next.0",
29
- "@player-tools/xlr-utils": "0.9.0-next.0",
24
+ "@player-tools/dsl": "0.9.0-next.1",
25
+ "@player-tools/json-language-service": "0.9.0-next.1",
26
+ "@player-tools/xlr": "0.9.0-next.1",
27
+ "@player-tools/xlr-converters": "0.9.0-next.1",
28
+ "@player-tools/xlr-sdk": "0.9.0-next.1",
29
+ "@player-tools/xlr-utils": "0.9.0-next.1",
30
30
  "@babel/plugin-transform-react-jsx-source": "^7.23.3",
31
31
  "@babel/preset-env": "^7.23.3",
32
32
  "@babel/preset-react": "^7.23.3",