vscode-behavior3 2.3.0 → 2.3.3

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/build-cli.js CHANGED
@@ -212496,10 +212496,7 @@ function customAlphabet(alphabet, size = 21) {
212496
212496
 
212497
212497
  // webview/shared/stable-id.ts
212498
212498
  var UUID_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
212499
- var generateUuid = customAlphabet(
212500
- UUID_ALPHABET,
212501
- 10
212502
- );
212499
+ var generateUuid = customAlphabet(UUID_ALPHABET, 10);
212503
212500
  var hashString = (value) => {
212504
212501
  let hash = 2166136261;
212505
212502
  for (let index = 0; index < value.length; index += 1) {
@@ -212513,7 +212510,7 @@ var generateDeterministicUuid = (seed) => {
212513
212510
  let result = "";
212514
212511
  for (let index = 0; index < 10; index += 1) {
212515
212512
  state = Math.imul(state ^ state >>> 16, 2246822519) >>> 0;
212516
- state ^= hashString(`${seed}:${index}`);
212513
+ state = (state ^ hashString(`${seed}:${index}`)) >>> 0;
212517
212514
  result += UUID_ALPHABET[state % UUID_ALPHABET.length];
212518
212515
  }
212519
212516
  return result;
@@ -212559,6 +212556,12 @@ var asRequiredString = (value, label) => {
212559
212556
  }
212560
212557
  return value;
212561
212558
  };
212559
+ var normalizeTreeVersion = (value) => {
212560
+ if (value === void 0) {
212561
+ return DOCUMENT_VERSION;
212562
+ }
212563
+ return asRequiredString(value, "tree file version");
212564
+ };
212562
212565
  var asStringArray = (value, label) => {
212563
212566
  if (value === void 0) {
212564
212567
  return [];
@@ -212874,7 +212877,7 @@ var normalizeTreeData = (value, opts) => {
212874
212877
  const variablesValue = record.variables;
212875
212878
  const variablesRecord = variablesValue === void 0 ? void 0 : expectPlainRecord(variablesValue, "tree file variables");
212876
212879
  return {
212877
- version: asRequiredString(record.version, "tree file version"),
212880
+ version: normalizeTreeVersion(record.version),
212878
212881
  name: asRequiredString(record.name, "tree file name"),
212879
212882
  prefix: asOptionalString(record.prefix) ?? "",
212880
212883
  desc: asOptionalString(record.desc),
@@ -213034,10 +213037,10 @@ var collectReachableSubtreePaths = (root) => {
213034
213037
  });
213035
213038
  return Array.from(paths);
213036
213039
  };
213037
- var hasMissingStableIds = (content) => {
213040
+ var needsLegacyTreeWriteback = (content) => {
213038
213041
  try {
213039
213042
  const parsed = JSON.parse(content);
213040
- return subtreeNeedsMissingIds(parsed.root) || parsed.$override !== void 0 || parsed.import !== void 0 || parsed.vars !== void 0;
213043
+ return parsed.version === void 0 || subtreeNeedsMissingIds(parsed.root) || parsed.$override !== void 0 || parsed.import !== void 0 || parsed.vars !== void 0;
213041
213044
  } catch {
213042
213045
  return false;
213043
213046
  }
@@ -213060,7 +213063,7 @@ var loadSubtreeSourceCache = async (params) => {
213060
213063
  return;
213061
213064
  }
213062
213065
  try {
213063
- const needsWriteback = hasMissingStableIds(content);
213066
+ const needsWriteback = needsLegacyTreeWriteback(content);
213064
213067
  const tree = parsePersistedTreeContent(content, normalizedPath);
213065
213068
  cache[normalizedPath] = tree;
213066
213069
  await params.onTreeLoaded?.({
@@ -217235,6 +217238,14 @@ var validateExpressionEntries = (entries, usingVars, checkExpr) => {
217235
217238
  return null;
217236
217239
  };
217237
217240
  var getArgLabel = (arg) => arg.desc || arg.name;
217241
+ var findNodeArgOneofInputIndex = (arg, inputDefs) => {
217242
+ if (!arg.oneof || !inputDefs?.length) {
217243
+ return -1;
217244
+ }
217245
+ return inputDefs.findIndex(
217246
+ (input, index) => parseSlotDefinition(input, inputDefs, index).label === arg.oneof
217247
+ );
217248
+ };
217238
217249
  var isRequiredNodeArgValueMissing = (arg, value) => {
217239
217250
  if (isNodeArgOptional(arg)) {
217240
217251
  return false;
@@ -217349,6 +217360,28 @@ var validateNodeArgValue = (params) => {
217349
217360
  }
217350
217361
  return validateNodeArgScalarValue(arg, value, args, validateOptions);
217351
217362
  };
217363
+ var validateNodeArgOneof = (params) => {
217364
+ const { arg, argValue, inputValues, inputDefs } = params;
217365
+ if (!arg.oneof) {
217366
+ return null;
217367
+ }
217368
+ const relatedInputIndex = findNodeArgOneofInputIndex(arg, inputDefs);
217369
+ if (relatedInputIndex < 0) {
217370
+ return {
217371
+ code: "missing-oneof-input",
217372
+ argName: arg.name,
217373
+ inputLabel: arg.oneof
217374
+ };
217375
+ }
217376
+ if (checkOneof(arg, argValue, inputValues?.[relatedInputIndex])) {
217377
+ return null;
217378
+ }
217379
+ return {
217380
+ code: "oneof-conflict",
217381
+ argName: arg.name,
217382
+ inputLabel: arg.oneof
217383
+ };
217384
+ };
217352
217385
 
217353
217386
  // webview/shared/b3build-context.ts
217354
217387
  var unknownNodeDef = {
@@ -217432,6 +217465,10 @@ var formatBuildDiagnostic = (diagnostic) => {
217432
217465
  return `intput field '${diagnostic.label}' is required`;
217433
217466
  case "required-output":
217434
217467
  return `output field '${diagnostic.label}' is required`;
217468
+ case "missing-oneof-input":
217469
+ return `missing oneof input slot '${diagnostic.inputLabel}' for arg '${diagnostic.argName}'`;
217470
+ case "oneof-conflict":
217471
+ return `only one of arg '${diagnostic.argName}' and input '${diagnostic.inputLabel}' can be set`;
217435
217472
  case "invalid-arg-value": {
217436
217473
  const value = JSON.stringify(diagnostic.value);
217437
217474
  switch (diagnostic.expected) {
@@ -217472,14 +217509,15 @@ var checkNodeArg = (data, conf, i, printer) => {
217472
217509
  const diagnostics = validateNodeArgValue({ arg, value, args: data.args ?? {} });
217473
217510
  let hasError = diagnostics.length > 0;
217474
217511
  diagnostics.forEach((diagnostic) => error(formatBuildDiagnostic(diagnostic)));
217475
- if (arg.oneof !== void 0) {
217476
- const idx = conf.input?.findIndex((v) => v.startsWith(arg.oneof)) ?? -1;
217477
- if (!checkOneof(arg, data.args?.[arg.name], data.input?.[idx])) {
217478
- error(
217479
- `only one is allowed for between argument '${arg.name}' and input '${data.input?.[idx]}'`
217480
- );
217481
- hasError = true;
217482
- }
217512
+ const oneofDiagnostic = validateNodeArgOneof({
217513
+ arg,
217514
+ argValue: value,
217515
+ inputValues: data.input,
217516
+ inputDefs: conf.input
217517
+ });
217518
+ if (oneofDiagnostic) {
217519
+ error(formatBuildDiagnostic(oneofDiagnostic));
217520
+ hasError = true;
217483
217521
  }
217484
217522
  return !hasError;
217485
217523
  };
package/dist/extension.js CHANGED
@@ -215264,10 +215264,7 @@ function customAlphabet(alphabet, size = 21) {
215264
215264
 
215265
215265
  // webview/shared/stable-id.ts
215266
215266
  var UUID_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
215267
- var generateUuid = customAlphabet(
215268
- UUID_ALPHABET,
215269
- 10
215270
- );
215267
+ var generateUuid = customAlphabet(UUID_ALPHABET, 10);
215271
215268
  var hashString = (value) => {
215272
215269
  let hash = 2166136261;
215273
215270
  for (let index = 0; index < value.length; index += 1) {
@@ -215281,7 +215278,7 @@ var generateDeterministicUuid = (seed) => {
215281
215278
  let result = "";
215282
215279
  for (let index = 0; index < 10; index += 1) {
215283
215280
  state = Math.imul(state ^ state >>> 16, 2246822519) >>> 0;
215284
- state ^= hashString(`${seed}:${index}`);
215281
+ state = (state ^ hashString(`${seed}:${index}`)) >>> 0;
215285
215282
  result += UUID_ALPHABET[state % UUID_ALPHABET.length];
215286
215283
  }
215287
215284
  return result;
@@ -215375,6 +215372,12 @@ var asRequiredString = (value, label) => {
215375
215372
  }
215376
215373
  return value;
215377
215374
  };
215375
+ var normalizeTreeVersion = (value) => {
215376
+ if (value === void 0) {
215377
+ return DOCUMENT_VERSION;
215378
+ }
215379
+ return asRequiredString(value, "tree file version");
215380
+ };
215378
215381
  var asStringArray = (value, label) => {
215379
215382
  if (value === void 0) {
215380
215383
  return [];
@@ -215693,7 +215696,7 @@ var normalizeTreeData = (value, opts) => {
215693
215696
  const variablesValue = record.variables;
215694
215697
  const variablesRecord = variablesValue === void 0 ? void 0 : expectPlainRecord(variablesValue, "tree file variables");
215695
215698
  return {
215696
- version: asRequiredString(record.version, "tree file version"),
215699
+ version: normalizeTreeVersion(record.version),
215697
215700
  name: asRequiredString(record.name, "tree file name"),
215698
215701
  prefix: asOptionalString(record.prefix) ?? "",
215699
215702
  desc: asOptionalString(record.desc),
@@ -215948,10 +215951,10 @@ var applyMainTreeDisplayIds = (root, idsByStableId) => {
215948
215951
  }
215949
215952
  });
215950
215953
  };
215951
- var hasMissingStableIds = (content) => {
215954
+ var needsLegacyTreeWriteback = (content) => {
215952
215955
  try {
215953
215956
  const parsed = JSON.parse(content);
215954
- return subtreeNeedsMissingIds(parsed.root) || parsed.$override !== void 0 || parsed.import !== void 0 || parsed.vars !== void 0;
215957
+ return parsed.version === void 0 || subtreeNeedsMissingIds(parsed.root) || parsed.$override !== void 0 || parsed.import !== void 0 || parsed.vars !== void 0;
215955
215958
  } catch {
215956
215959
  return false;
215957
215960
  }
@@ -215974,7 +215977,7 @@ var loadSubtreeSourceCache = async (params) => {
215974
215977
  return;
215975
215978
  }
215976
215979
  try {
215977
- const needsWriteback = hasMissingStableIds(content);
215980
+ const needsWriteback = needsLegacyTreeWriteback(content);
215978
215981
  const tree = parsePersistedTreeContent(content, normalizedPath);
215979
215982
  cache[normalizedPath] = tree;
215980
215983
  await params.onTreeLoaded?.({
@@ -217564,6 +217567,14 @@ var validateExpressionEntries = (entries, usingVars, checkExpr) => {
217564
217567
  return null;
217565
217568
  };
217566
217569
  var getArgLabel = (arg) => arg.desc || arg.name;
217570
+ var findNodeArgOneofInputIndex = (arg, inputDefs) => {
217571
+ if (!arg.oneof || !inputDefs?.length) {
217572
+ return -1;
217573
+ }
217574
+ return inputDefs.findIndex(
217575
+ (input, index) => parseSlotDefinition(input, inputDefs, index).label === arg.oneof
217576
+ );
217577
+ };
217567
217578
  var isRequiredNodeArgValueMissing = (arg, value) => {
217568
217579
  if (isNodeArgOptional(arg)) {
217569
217580
  return false;
@@ -217678,6 +217689,28 @@ var validateNodeArgValue = (params) => {
217678
217689
  }
217679
217690
  return validateNodeArgScalarValue(arg, value, args, validateOptions);
217680
217691
  };
217692
+ var validateNodeArgOneof = (params) => {
217693
+ const { arg, argValue, inputValues, inputDefs } = params;
217694
+ if (!arg.oneof) {
217695
+ return null;
217696
+ }
217697
+ const relatedInputIndex = findNodeArgOneofInputIndex(arg, inputDefs);
217698
+ if (relatedInputIndex < 0) {
217699
+ return {
217700
+ code: "missing-oneof-input",
217701
+ argName: arg.name,
217702
+ inputLabel: arg.oneof
217703
+ };
217704
+ }
217705
+ if (checkOneof(arg, argValue, inputValues?.[relatedInputIndex])) {
217706
+ return null;
217707
+ }
217708
+ return {
217709
+ code: "oneof-conflict",
217710
+ argName: arg.name,
217711
+ inputLabel: arg.oneof
217712
+ };
217713
+ };
217681
217714
 
217682
217715
  // webview/shared/b3build-context.ts
217683
217716
  var unknownNodeDef = {
@@ -217761,6 +217794,10 @@ var formatBuildDiagnostic = (diagnostic) => {
217761
217794
  return `intput field '${diagnostic.label}' is required`;
217762
217795
  case "required-output":
217763
217796
  return `output field '${diagnostic.label}' is required`;
217797
+ case "missing-oneof-input":
217798
+ return `missing oneof input slot '${diagnostic.inputLabel}' for arg '${diagnostic.argName}'`;
217799
+ case "oneof-conflict":
217800
+ return `only one of arg '${diagnostic.argName}' and input '${diagnostic.inputLabel}' can be set`;
217764
217801
  case "invalid-arg-value": {
217765
217802
  const value = JSON.stringify(diagnostic.value);
217766
217803
  switch (diagnostic.expected) {
@@ -217801,14 +217838,15 @@ var checkNodeArg = (data, conf, i, printer) => {
217801
217838
  const diagnostics = validateNodeArgValue({ arg, value, args: data.args ?? {} });
217802
217839
  let hasError = diagnostics.length > 0;
217803
217840
  diagnostics.forEach((diagnostic) => error(formatBuildDiagnostic(diagnostic)));
217804
- if (arg.oneof !== void 0) {
217805
- const idx = conf.input?.findIndex((v) => v.startsWith(arg.oneof)) ?? -1;
217806
- if (!checkOneof(arg, data.args?.[arg.name], data.input?.[idx])) {
217807
- error(
217808
- `only one is allowed for between argument '${arg.name}' and input '${data.input?.[idx]}'`
217809
- );
217810
- hasError = true;
217811
- }
217841
+ const oneofDiagnostic = validateNodeArgOneof({
217842
+ arg,
217843
+ argValue: value,
217844
+ inputValues: data.input,
217845
+ inputDefs: conf.input
217846
+ });
217847
+ if (oneofDiagnostic) {
217848
+ error(formatBuildDiagnostic(oneofDiagnostic));
217849
+ hasError = true;
217812
217850
  }
217813
217851
  return !hasError;
217814
217852
  };