@player-tools/json-language-service 0.8.1 → 0.8.2--canary.169.3835

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.
@@ -1270,146 +1270,8 @@ var DuplicateIDPlugin = class {
1270
1270
  }
1271
1271
  };
1272
1272
 
1273
- // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/legacy-action-plugin.ts
1274
- import { DiagnosticSeverity as DiagnosticSeverity5 } from "vscode-languageserver-types";
1275
- function createRuleVisitor(context) {
1276
- const checkForLegacyAction = (node) => {
1277
- if (node.type === "asset") {
1278
- return;
1279
- }
1280
- if (node.type === "object" && !node.properties.some(
1281
- (p) => p.keyNode.value === "asset" || p.keyNode.value === "dynamicSwitch" || p.keyNode.value === "staticSwitch"
1282
- )) {
1283
- context.addViolation({
1284
- message: "Migrate to an action-asset",
1285
- node,
1286
- severity: DiagnosticSeverity5.Warning,
1287
- fix: () => {
1288
- const newActionAsset = {
1289
- asset: {
1290
- type: "action",
1291
- ...getNodeValue(node)
1292
- }
1293
- };
1294
- return {
1295
- name: "Convert to Asset",
1296
- edit: {
1297
- type: "replace",
1298
- node,
1299
- value: JSON.stringify(newActionAsset, null, 2)
1300
- }
1301
- };
1302
- }
1303
- });
1304
- }
1305
- };
1306
- return {
1307
- ViewNode: (viewNode) => {
1308
- const actionsProp = viewNode.properties.find(
1309
- (p) => p.keyNode.value === "actions"
1310
- );
1311
- if (!actionsProp || actionsProp.valueNode?.type !== "array") {
1312
- return;
1313
- }
1314
- actionsProp.valueNode.children.forEach((action) => {
1315
- checkForLegacyAction(action);
1316
- });
1317
- }
1318
- };
1319
- }
1320
- var LegacyActionPlugin = class {
1321
- name = "legacy-action";
1322
- apply(service) {
1323
- service.hooks.validate.tap(this.name, async (ctx, validationContext) => {
1324
- validationContext.useASTVisitor(createRuleVisitor(validationContext));
1325
- });
1326
- }
1327
- };
1328
-
1329
- // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/legacy-template-plugin.ts
1330
- import { addLast, omit, set } from "timm";
1331
- import { DiagnosticSeverity as DiagnosticSeverity6 } from "vscode-languageserver-types";
1332
- function createRuleVisitor2(context, docInfo) {
1333
- const checkForLegacyTemplate = (node) => {
1334
- const templateDataProp = node.properties.find(
1335
- (p) => p.keyNode.value === "templateData"
1336
- );
1337
- const templateValueProp = node.properties.find(
1338
- (p) => p.keyNode.value === "template"
1339
- );
1340
- const templateOutputProp = node.properties.find(
1341
- (p) => p.keyNode.value === "templateOutput"
1342
- );
1343
- if (!templateDataProp && !templateOutputProp && (!templateValueProp || templateValueProp.valueNode?.type === "array")) {
1344
- return;
1345
- }
1346
- const templateViolation = {
1347
- severity: DiagnosticSeverity6.Error,
1348
- message: `Migrate to the template[] syntax.`,
1349
- fix: () => {
1350
- const path = [
1351
- "template",
1352
- templateValueProp?.valueNode?.type === "array" ? templateValueProp.valueNode.children.length : 0
1353
- ];
1354
- const newTemplateObj = {
1355
- value: templateValueProp?.valueNode?.type !== "array" && templateValueProp?.valueNode ? getNodeValue(templateValueProp?.valueNode) : {},
1356
- output: templateOutputProp?.valueNode?.jsonNode.value ?? "",
1357
- data: templateDataProp?.valueNode?.jsonNode.value ?? ""
1358
- };
1359
- const oldValue = getNodeValue(node);
1360
- let newValue = omit(oldValue, "templateData");
1361
- newValue = omit(newValue, "templateOutput");
1362
- if (templateValueProp?.valueNode?.type !== "array") {
1363
- newValue = omit(newValue, "template");
1364
- }
1365
- newValue = set(
1366
- newValue,
1367
- "template",
1368
- addLast(newValue.template ?? [], newTemplateObj)
1369
- );
1370
- return {
1371
- edit: {
1372
- type: "replace",
1373
- path,
1374
- node,
1375
- value: formatLikeNode(docInfo.document, node, newValue)
1376
- },
1377
- name: "Convert to template[]"
1378
- };
1379
- }
1380
- };
1381
- if (templateDataProp) {
1382
- context.addViolation({
1383
- ...templateViolation,
1384
- node: templateDataProp
1385
- });
1386
- }
1387
- if (templateOutputProp) {
1388
- context.addViolation({
1389
- ...templateViolation,
1390
- node: templateOutputProp
1391
- });
1392
- }
1393
- };
1394
- return {
1395
- ViewNode: checkForLegacyTemplate,
1396
- AssetNode: checkForLegacyTemplate,
1397
- ObjectNode: checkForLegacyTemplate
1398
- };
1399
- }
1400
- var LegacyTemplatePlugin = class {
1401
- name = "legacy-template";
1402
- apply(service) {
1403
- service.hooks.validate.tap(this.name, async (ctx, validationContext) => {
1404
- validationContext.useASTVisitor(
1405
- createRuleVisitor2(validationContext, ctx)
1406
- );
1407
- });
1408
- }
1409
- };
1410
-
1411
1273
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/missing-asset-wrapper-plugin.ts
1412
- import { DiagnosticSeverity as DiagnosticSeverity7 } from "vscode-languageserver-types";
1274
+ import { DiagnosticSeverity as DiagnosticSeverity5 } from "vscode-languageserver-types";
1413
1275
  var getObjectTarget = (node) => {
1414
1276
  if (isObjectNode(node)) {
1415
1277
  return node;
@@ -1445,7 +1307,7 @@ var MissingAssetWrapperPlugin = class {
1445
1307
  addFixableViolation(d, {
1446
1308
  node: originalNode,
1447
1309
  message: d.message,
1448
- severity: d.severity ?? DiagnosticSeverity7.Error,
1310
+ severity: d.severity ?? DiagnosticSeverity5.Error,
1449
1311
  fix: () => ({
1450
1312
  name: `Wrap in "asset"`,
1451
1313
  edit: {
@@ -1471,7 +1333,7 @@ var MissingAssetWrapperPlugin = class {
1471
1333
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/nav-state-plugin.ts
1472
1334
  import {
1473
1335
  CompletionItemKind as CompletionItemKind3,
1474
- DiagnosticSeverity as DiagnosticSeverity8
1336
+ DiagnosticSeverity as DiagnosticSeverity6
1475
1337
  } from "vscode-languageserver-types";
1476
1338
  var createValidationVisitor3 = (ctx) => {
1477
1339
  const validTransitions = /* @__PURE__ */ new Map();
@@ -1499,7 +1361,7 @@ var createValidationVisitor3 = (ctx) => {
1499
1361
  if (!validTransitions.get(flowNodeId)?.has(transitionObjects.valueNode.value)) {
1500
1362
  ctx.addViolation({
1501
1363
  node: transitionObjects.valueNode,
1502
- severity: DiagnosticSeverity8.Error,
1364
+ severity: DiagnosticSeverity6.Error,
1503
1365
  message: `Node "${transitionObjects.valueNode.value}" not found`
1504
1366
  });
1505
1367
  }
@@ -1560,7 +1422,7 @@ var NavStatePlugin = class {
1560
1422
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/view-node-plugin.ts
1561
1423
  import {
1562
1424
  CompletionItemKind as CompletionItemKind4,
1563
- DiagnosticSeverity as DiagnosticSeverity9
1425
+ DiagnosticSeverity as DiagnosticSeverity7
1564
1426
  } from "vscode-languageserver-types";
1565
1427
  var createValidationVisitor4 = (ctx, viewInfo) => {
1566
1428
  return {
@@ -1577,7 +1439,7 @@ var createValidationVisitor4 = (ctx, viewInfo) => {
1577
1439
  ctx.addViolation({
1578
1440
  node: refNode.valueNode,
1579
1441
  message: `View with id: ${refID} does not exist.`,
1580
- severity: DiagnosticSeverity9.Error
1442
+ severity: DiagnosticSeverity7.Error
1581
1443
  });
1582
1444
  }
1583
1445
  },
@@ -1587,7 +1449,7 @@ var createValidationVisitor4 = (ctx, viewInfo) => {
1587
1449
  ctx.addViolation({
1588
1450
  node: viewNode.id.valueNode,
1589
1451
  message: `View is not reachable`,
1590
- severity: DiagnosticSeverity9.Warning
1452
+ severity: DiagnosticSeverity7.Warning
1591
1453
  });
1592
1454
  }
1593
1455
  }
@@ -1816,8 +1678,6 @@ var PLUGINS = [
1816
1678
  new DuplicateIDPlugin(),
1817
1679
  new ViewNodePlugin(),
1818
1680
  new SchemaInfoPlugin(),
1819
- new LegacyTemplatePlugin(),
1820
- new LegacyActionPlugin(),
1821
1681
  new AssetWrapperArrayPlugin(),
1822
1682
  new NavStatePlugin(),
1823
1683
  new MissingAssetWrapperPlugin(),
@@ -2271,17 +2131,19 @@ var PlayerLanguageService = class {
2271
2131
  });
2272
2132
  }
2273
2133
  async setAssetTypesFromModule(manifest) {
2274
- manifest.forEach((m) => {
2275
- if (m.capabilities["Types"]?.length) {
2276
- this.XLRService.XLRSDK.loadDefinitionsFromModule(m);
2277
- } else {
2278
- this.XLRService.XLRSDK.loadDefinitionsFromModule(
2279
- m,
2280
- DEFAULT_FILTERS,
2281
- TRANSFORM_FUNCTIONS
2282
- );
2283
- }
2284
- });
2134
+ await Promise.allSettled(
2135
+ manifest.map((m) => {
2136
+ if (m.capabilities["Types"]?.length) {
2137
+ return this.XLRService.XLRSDK.loadDefinitionsFromModule(m);
2138
+ } else {
2139
+ return this.XLRService.XLRSDK.loadDefinitionsFromModule(
2140
+ m,
2141
+ DEFAULT_FILTERS,
2142
+ TRANSFORM_FUNCTIONS
2143
+ );
2144
+ }
2145
+ })
2146
+ );
2285
2147
  }
2286
2148
  };
2287
2149
  export {
package/dist/index.mjs CHANGED
@@ -1270,146 +1270,8 @@ var DuplicateIDPlugin = class {
1270
1270
  }
1271
1271
  };
1272
1272
 
1273
- // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/legacy-action-plugin.ts
1274
- import { DiagnosticSeverity as DiagnosticSeverity5 } from "vscode-languageserver-types";
1275
- function createRuleVisitor(context) {
1276
- const checkForLegacyAction = (node) => {
1277
- if (node.type === "asset") {
1278
- return;
1279
- }
1280
- if (node.type === "object" && !node.properties.some(
1281
- (p) => p.keyNode.value === "asset" || p.keyNode.value === "dynamicSwitch" || p.keyNode.value === "staticSwitch"
1282
- )) {
1283
- context.addViolation({
1284
- message: "Migrate to an action-asset",
1285
- node,
1286
- severity: DiagnosticSeverity5.Warning,
1287
- fix: () => {
1288
- const newActionAsset = {
1289
- asset: {
1290
- type: "action",
1291
- ...getNodeValue(node)
1292
- }
1293
- };
1294
- return {
1295
- name: "Convert to Asset",
1296
- edit: {
1297
- type: "replace",
1298
- node,
1299
- value: JSON.stringify(newActionAsset, null, 2)
1300
- }
1301
- };
1302
- }
1303
- });
1304
- }
1305
- };
1306
- return {
1307
- ViewNode: (viewNode) => {
1308
- const actionsProp = viewNode.properties.find(
1309
- (p) => p.keyNode.value === "actions"
1310
- );
1311
- if (!actionsProp || actionsProp.valueNode?.type !== "array") {
1312
- return;
1313
- }
1314
- actionsProp.valueNode.children.forEach((action) => {
1315
- checkForLegacyAction(action);
1316
- });
1317
- }
1318
- };
1319
- }
1320
- var LegacyActionPlugin = class {
1321
- name = "legacy-action";
1322
- apply(service) {
1323
- service.hooks.validate.tap(this.name, async (ctx, validationContext) => {
1324
- validationContext.useASTVisitor(createRuleVisitor(validationContext));
1325
- });
1326
- }
1327
- };
1328
-
1329
- // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/legacy-template-plugin.ts
1330
- import { addLast, omit, set } from "timm";
1331
- import { DiagnosticSeverity as DiagnosticSeverity6 } from "vscode-languageserver-types";
1332
- function createRuleVisitor2(context, docInfo) {
1333
- const checkForLegacyTemplate = (node) => {
1334
- const templateDataProp = node.properties.find(
1335
- (p) => p.keyNode.value === "templateData"
1336
- );
1337
- const templateValueProp = node.properties.find(
1338
- (p) => p.keyNode.value === "template"
1339
- );
1340
- const templateOutputProp = node.properties.find(
1341
- (p) => p.keyNode.value === "templateOutput"
1342
- );
1343
- if (!templateDataProp && !templateOutputProp && (!templateValueProp || templateValueProp.valueNode?.type === "array")) {
1344
- return;
1345
- }
1346
- const templateViolation = {
1347
- severity: DiagnosticSeverity6.Error,
1348
- message: `Migrate to the template[] syntax.`,
1349
- fix: () => {
1350
- const path = [
1351
- "template",
1352
- templateValueProp?.valueNode?.type === "array" ? templateValueProp.valueNode.children.length : 0
1353
- ];
1354
- const newTemplateObj = {
1355
- value: templateValueProp?.valueNode?.type !== "array" && templateValueProp?.valueNode ? getNodeValue(templateValueProp?.valueNode) : {},
1356
- output: templateOutputProp?.valueNode?.jsonNode.value ?? "",
1357
- data: templateDataProp?.valueNode?.jsonNode.value ?? ""
1358
- };
1359
- const oldValue = getNodeValue(node);
1360
- let newValue = omit(oldValue, "templateData");
1361
- newValue = omit(newValue, "templateOutput");
1362
- if (templateValueProp?.valueNode?.type !== "array") {
1363
- newValue = omit(newValue, "template");
1364
- }
1365
- newValue = set(
1366
- newValue,
1367
- "template",
1368
- addLast(newValue.template ?? [], newTemplateObj)
1369
- );
1370
- return {
1371
- edit: {
1372
- type: "replace",
1373
- path,
1374
- node,
1375
- value: formatLikeNode(docInfo.document, node, newValue)
1376
- },
1377
- name: "Convert to template[]"
1378
- };
1379
- }
1380
- };
1381
- if (templateDataProp) {
1382
- context.addViolation({
1383
- ...templateViolation,
1384
- node: templateDataProp
1385
- });
1386
- }
1387
- if (templateOutputProp) {
1388
- context.addViolation({
1389
- ...templateViolation,
1390
- node: templateOutputProp
1391
- });
1392
- }
1393
- };
1394
- return {
1395
- ViewNode: checkForLegacyTemplate,
1396
- AssetNode: checkForLegacyTemplate,
1397
- ObjectNode: checkForLegacyTemplate
1398
- };
1399
- }
1400
- var LegacyTemplatePlugin = class {
1401
- name = "legacy-template";
1402
- apply(service) {
1403
- service.hooks.validate.tap(this.name, async (ctx, validationContext) => {
1404
- validationContext.useASTVisitor(
1405
- createRuleVisitor2(validationContext, ctx)
1406
- );
1407
- });
1408
- }
1409
- };
1410
-
1411
1273
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/missing-asset-wrapper-plugin.ts
1412
- import { DiagnosticSeverity as DiagnosticSeverity7 } from "vscode-languageserver-types";
1274
+ import { DiagnosticSeverity as DiagnosticSeverity5 } from "vscode-languageserver-types";
1413
1275
  var getObjectTarget = (node) => {
1414
1276
  if (isObjectNode(node)) {
1415
1277
  return node;
@@ -1445,7 +1307,7 @@ var MissingAssetWrapperPlugin = class {
1445
1307
  addFixableViolation(d, {
1446
1308
  node: originalNode,
1447
1309
  message: d.message,
1448
- severity: d.severity ?? DiagnosticSeverity7.Error,
1310
+ severity: d.severity ?? DiagnosticSeverity5.Error,
1449
1311
  fix: () => ({
1450
1312
  name: `Wrap in "asset"`,
1451
1313
  edit: {
@@ -1471,7 +1333,7 @@ var MissingAssetWrapperPlugin = class {
1471
1333
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/nav-state-plugin.ts
1472
1334
  import {
1473
1335
  CompletionItemKind as CompletionItemKind3,
1474
- DiagnosticSeverity as DiagnosticSeverity8
1336
+ DiagnosticSeverity as DiagnosticSeverity6
1475
1337
  } from "vscode-languageserver-types";
1476
1338
  var createValidationVisitor3 = (ctx) => {
1477
1339
  const validTransitions = /* @__PURE__ */ new Map();
@@ -1499,7 +1361,7 @@ var createValidationVisitor3 = (ctx) => {
1499
1361
  if (!validTransitions.get(flowNodeId)?.has(transitionObjects.valueNode.value)) {
1500
1362
  ctx.addViolation({
1501
1363
  node: transitionObjects.valueNode,
1502
- severity: DiagnosticSeverity8.Error,
1364
+ severity: DiagnosticSeverity6.Error,
1503
1365
  message: `Node "${transitionObjects.valueNode.value}" not found`
1504
1366
  });
1505
1367
  }
@@ -1560,7 +1422,7 @@ var NavStatePlugin = class {
1560
1422
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/language/json-language-service/src/plugins/view-node-plugin.ts
1561
1423
  import {
1562
1424
  CompletionItemKind as CompletionItemKind4,
1563
- DiagnosticSeverity as DiagnosticSeverity9
1425
+ DiagnosticSeverity as DiagnosticSeverity7
1564
1426
  } from "vscode-languageserver-types";
1565
1427
  var createValidationVisitor4 = (ctx, viewInfo) => {
1566
1428
  return {
@@ -1577,7 +1439,7 @@ var createValidationVisitor4 = (ctx, viewInfo) => {
1577
1439
  ctx.addViolation({
1578
1440
  node: refNode.valueNode,
1579
1441
  message: `View with id: ${refID} does not exist.`,
1580
- severity: DiagnosticSeverity9.Error
1442
+ severity: DiagnosticSeverity7.Error
1581
1443
  });
1582
1444
  }
1583
1445
  },
@@ -1587,7 +1449,7 @@ var createValidationVisitor4 = (ctx, viewInfo) => {
1587
1449
  ctx.addViolation({
1588
1450
  node: viewNode.id.valueNode,
1589
1451
  message: `View is not reachable`,
1590
- severity: DiagnosticSeverity9.Warning
1452
+ severity: DiagnosticSeverity7.Warning
1591
1453
  });
1592
1454
  }
1593
1455
  }
@@ -1816,8 +1678,6 @@ var PLUGINS = [
1816
1678
  new DuplicateIDPlugin(),
1817
1679
  new ViewNodePlugin(),
1818
1680
  new SchemaInfoPlugin(),
1819
- new LegacyTemplatePlugin(),
1820
- new LegacyActionPlugin(),
1821
1681
  new AssetWrapperArrayPlugin(),
1822
1682
  new NavStatePlugin(),
1823
1683
  new MissingAssetWrapperPlugin(),
@@ -2271,17 +2131,19 @@ var PlayerLanguageService = class {
2271
2131
  });
2272
2132
  }
2273
2133
  async setAssetTypesFromModule(manifest) {
2274
- manifest.forEach((m) => {
2275
- if (m.capabilities["Types"]?.length) {
2276
- this.XLRService.XLRSDK.loadDefinitionsFromModule(m);
2277
- } else {
2278
- this.XLRService.XLRSDK.loadDefinitionsFromModule(
2279
- m,
2280
- DEFAULT_FILTERS,
2281
- TRANSFORM_FUNCTIONS
2282
- );
2283
- }
2284
- });
2134
+ await Promise.allSettled(
2135
+ manifest.map((m) => {
2136
+ if (m.capabilities["Types"]?.length) {
2137
+ return this.XLRService.XLRSDK.loadDefinitionsFromModule(m);
2138
+ } else {
2139
+ return this.XLRService.XLRSDK.loadDefinitionsFromModule(
2140
+ m,
2141
+ DEFAULT_FILTERS,
2142
+ TRANSFORM_FUNCTIONS
2143
+ );
2144
+ }
2145
+ })
2146
+ );
2285
2147
  }
2286
2148
  };
2287
2149
  export {