pxt-core 9.1.13 → 9.1.14

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/built/cli.js CHANGED
@@ -1830,10 +1830,8 @@ async function buildSemanticUIAsync(parsed) {
1830
1830
  // This is just to support the local skillmap/cra-app serve for development
1831
1831
  nodeutil.cp("built/web/react-common-skillmap.css", "node_modules/pxt-core/skillmap/public/blb");
1832
1832
  nodeutil.cp("built/web/react-common-authcode.css", "node_modules/pxt-core/authcode/public/blb");
1833
- nodeutil.cp("built/web/react-common-multiplayer.css", "node_modules/pxt-core/multiplayer/public/blb");
1834
1833
  nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/skillmap/public/blb");
1835
1834
  nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/authcode/public/blb");
1836
- nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/multiplayer/public/blb");
1837
1835
  }
1838
1836
  }
1839
1837
  async function linkFontAsync(font, semCss, sourceDir = "node_modules/semantic-ui-less/themes/default/assets/fonts/", refDir = "fonts\\/") {
@@ -1913,13 +1911,6 @@ function buildSkillMapAsync(parsed) {
1913
1911
  function buildAuthcodeAsync(parsed) {
1914
1912
  return buildReactAppAsync("authcode", parsed, { copyAssets: false });
1915
1913
  }
1916
- function buildMultiplayerAsync(parsed) {
1917
- return buildReactAppAsync("multiplayer", parsed, {
1918
- copyAssets: false,
1919
- includePxtSim: true,
1920
- expandedPxtTarget: true
1921
- });
1922
- }
1923
1914
  function updateDefaultProjects(cfg) {
1924
1915
  let defaultProjects = [
1925
1916
  pxt.BLOCKS_PROJECT_NAME,
@@ -5521,7 +5512,7 @@ function internalCacheUsedBlocksAsync() {
5521
5512
  const decompiled = pxtc.decompileSnippets(pxtc.getTSProgram(opts), opts, false);
5522
5513
  if ((decompiled === null || decompiled === void 0 ? void 0 : decompiled.length) > 0) {
5523
5514
  // scrape block IDs matching <block type="block_id">
5524
- let builtInfo = builtTututorialInfo[hash] || { usedBlocks: {}, snippetBlocks: {}, highlightBlocks: {} };
5515
+ let builtInfo = builtTututorialInfo[hash] || { usedBlocks: {}, snippetBlocks: {}, highlightBlocks: {}, validateBlocks: {} };
5525
5516
  const blockIdRegex = /<\s*block(?:[^>]*)? type="([^ ]*)"/ig;
5526
5517
  for (let i = 0; i < decompiled.length; i++) {
5527
5518
  const blocksXml = decompiled[i];
@@ -5531,7 +5522,7 @@ function internalCacheUsedBlocksAsync() {
5531
5522
  builtInfo.snippetBlocks[snippetHash] = {};
5532
5523
  builtInfo.snippetBlocks[snippetHash][m1] = 1;
5533
5524
  builtInfo.usedBlocks[m1] = 1;
5534
- //TODO: Fill builtInfo.HighlightedBlocks
5525
+ //TODO: Fill builtInfo.HighlightedBlocks and builtInfo.validateBlocks
5535
5526
  return m0;
5536
5527
  });
5537
5528
  }
@@ -6348,22 +6339,6 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
6348
6339
  }
6349
6340
  }
6350
6341
  }, buildAuthcodeAsync);
6351
- p.defineCommand({
6352
- name: "buildmultiplayer",
6353
- aliases: ["multiplayer", "mp"],
6354
- advanced: true,
6355
- help: "Serves the multiplayer webapp",
6356
- flags: {
6357
- serve: {
6358
- description: "Serve the multiplayer app locally after building (npm start)"
6359
- },
6360
- docs: {
6361
- description: "Path to local docs folder to copy into multiplayer",
6362
- type: "string",
6363
- argument: "docs"
6364
- }
6365
- }
6366
- }, buildMultiplayerAsync);
6367
6342
  advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");
6368
6343
  advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]");
6369
6344
  advancedCommand("hidlist", "list HID devices", hid.listAsync);
package/built/pxt.js CHANGED
@@ -100493,7 +100493,8 @@ var ts;
100493
100493
  hash: built.hash,
100494
100494
  usedBlocks: Object.assign({}, built.usedBlocks),
100495
100495
  snippetBlocks: Object.assign({}, built.snippetBlocks),
100496
- highlightBlocks: Object.assign({}, built.highlightBlocks)
100496
+ highlightBlocks: Object.assign({}, built.highlightBlocks),
100497
+ validateBlocks: Object.assign({}, built.validateBlocks),
100497
100498
  };
100498
100499
  }
100499
100500
  }
@@ -103383,13 +103384,13 @@ var pxt;
103383
103384
  return undefined;
103384
103385
  });
103385
103386
  }
103386
- setAsync(filename, snippets, code, highlights, branch) {
103387
+ setAsync(filename, snippets, code, highlights, codeValidationMap, branch) {
103387
103388
  pxt.perf.measureStart("tutorial info db setAsync");
103388
103389
  const key = getTutorialInfoKey(filename, branch);
103389
103390
  const hash = getTutorialCodeHash(code);
103390
- return this.setWithHashAsync(filename, snippets, hash, highlights);
103391
+ return this.setWithHashAsync(filename, snippets, hash, highlights, codeValidationMap);
103391
103392
  }
103392
- setWithHashAsync(filename, snippets, hash, highlights, branch) {
103393
+ setWithHashAsync(filename, snippets, hash, highlights, codeValidationMap, branch) {
103393
103394
  pxt.perf.measureStart("tutorial info db setAsync");
103394
103395
  const key = getTutorialInfoKey(filename, branch);
103395
103396
  const blocks = {};
@@ -103405,6 +103406,7 @@ var pxt;
103405
103406
  snippets,
103406
103407
  blocks,
103407
103408
  highlightBlocks: highlights,
103409
+ validateBlocks: codeValidationMap
103408
103410
  };
103409
103411
  return this.db.setAsync(TutorialInfoIndexedDb.TABLE, entry)
103410
103412
  .then(() => {
@@ -119281,13 +119283,13 @@ ${code}
119281
119283
  if (id && cachedInfo[id]) {
119282
119284
  const info = cachedInfo[id];
119283
119285
  if (info.usedBlocks && info.hash)
119284
- db.setWithHashAsync(id, info.snippetBlocks, info.hash, info.highlightBlocks);
119286
+ db.setWithHashAsync(id, info.snippetBlocks, info.hash, info.highlightBlocks, info.validateBlocks);
119285
119287
  }
119286
119288
  else {
119287
119289
  for (let key of Object.keys(cachedInfo)) {
119288
119290
  const info = cachedInfo[key];
119289
119291
  if (info.usedBlocks && info.hash)
119290
- db.setWithHashAsync(key, info.snippetBlocks, info.hash, info.highlightBlocks);
119292
+ db.setWithHashAsync(key, info.snippetBlocks, info.hash, info.highlightBlocks, info.validateBlocks);
119291
119293
  }
119292
119294
  }
119293
119295
  }).catch((err) => { });
@@ -119344,6 +119346,25 @@ ${code}
119344
119346
  return entry === null || entry === void 0 ? void 0 : entry.highlightBlocks;
119345
119347
  }
119346
119348
  tutorial_1.getTutorialHighlightedBlocks = getTutorialHighlightedBlocks;
119349
+ async function getTutorialValidateBlocks(tutorial) {
119350
+ const db = await pxt.BrowserUtils.tutorialInfoDbAsync();
119351
+ const entry = await db.getAsync(tutorial.tutorial, tutorial.tutorialCode);
119352
+ return entry === null || entry === void 0 ? void 0 : entry.validateBlocks;
119353
+ }
119354
+ tutorial_1.getTutorialValidateBlocks = getTutorialValidateBlocks;
119355
+ function getRequiredBlockCounts(stepBlocks) {
119356
+ if (!stepBlocks)
119357
+ return undefined;
119358
+ const requiredBlocks = {};
119359
+ const blocks = stepBlocks["validate-exists"];
119360
+ if (blocks) {
119361
+ blocks.forEach(block => {
119362
+ requiredBlocks[block] = (requiredBlocks[block] || 0) + 1;
119363
+ });
119364
+ }
119365
+ return requiredBlocks;
119366
+ }
119367
+ tutorial_1.getRequiredBlockCounts = getRequiredBlockCounts;
119347
119368
  function getTutorialStepHash(tutorial) {
119348
119369
  const { tutorialStepInfo, tutorialStep } = tutorial;
119349
119370
  const body = tutorialStepInfo[tutorialStep].hintContentMd;
@@ -162259,10 +162280,8 @@ async function buildSemanticUIAsync(parsed) {
162259
162280
  // This is just to support the local skillmap/cra-app serve for development
162260
162281
  nodeutil.cp("built/web/react-common-skillmap.css", "node_modules/pxt-core/skillmap/public/blb");
162261
162282
  nodeutil.cp("built/web/react-common-authcode.css", "node_modules/pxt-core/authcode/public/blb");
162262
- nodeutil.cp("built/web/react-common-multiplayer.css", "node_modules/pxt-core/multiplayer/public/blb");
162263
162283
  nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/skillmap/public/blb");
162264
162284
  nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/authcode/public/blb");
162265
- nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/multiplayer/public/blb");
162266
162285
  }
162267
162286
  }
162268
162287
  async function linkFontAsync(font, semCss, sourceDir = "node_modules/semantic-ui-less/themes/default/assets/fonts/", refDir = "fonts\\/") {
@@ -162342,13 +162361,6 @@ function buildSkillMapAsync(parsed) {
162342
162361
  function buildAuthcodeAsync(parsed) {
162343
162362
  return buildReactAppAsync("authcode", parsed, { copyAssets: false });
162344
162363
  }
162345
- function buildMultiplayerAsync(parsed) {
162346
- return buildReactAppAsync("multiplayer", parsed, {
162347
- copyAssets: false,
162348
- includePxtSim: true,
162349
- expandedPxtTarget: true
162350
- });
162351
- }
162352
162364
  function updateDefaultProjects(cfg) {
162353
162365
  let defaultProjects = [
162354
162366
  pxt.BLOCKS_PROJECT_NAME,
@@ -165950,7 +165962,7 @@ function internalCacheUsedBlocksAsync() {
165950
165962
  const decompiled = pxtc.decompileSnippets(pxtc.getTSProgram(opts), opts, false);
165951
165963
  if ((decompiled === null || decompiled === void 0 ? void 0 : decompiled.length) > 0) {
165952
165964
  // scrape block IDs matching <block type="block_id">
165953
- let builtInfo = builtTututorialInfo[hash] || { usedBlocks: {}, snippetBlocks: {}, highlightBlocks: {} };
165965
+ let builtInfo = builtTututorialInfo[hash] || { usedBlocks: {}, snippetBlocks: {}, highlightBlocks: {}, validateBlocks: {} };
165954
165966
  const blockIdRegex = /<\s*block(?:[^>]*)? type="([^ ]*)"/ig;
165955
165967
  for (let i = 0; i < decompiled.length; i++) {
165956
165968
  const blocksXml = decompiled[i];
@@ -165960,7 +165972,7 @@ function internalCacheUsedBlocksAsync() {
165960
165972
  builtInfo.snippetBlocks[snippetHash] = {};
165961
165973
  builtInfo.snippetBlocks[snippetHash][m1] = 1;
165962
165974
  builtInfo.usedBlocks[m1] = 1;
165963
- //TODO: Fill builtInfo.HighlightedBlocks
165975
+ //TODO: Fill builtInfo.HighlightedBlocks and builtInfo.validateBlocks
165964
165976
  return m0;
165965
165977
  });
165966
165978
  }
@@ -166777,22 +166789,6 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
166777
166789
  }
166778
166790
  }
166779
166791
  }, buildAuthcodeAsync);
166780
- p.defineCommand({
166781
- name: "buildmultiplayer",
166782
- aliases: ["multiplayer", "mp"],
166783
- advanced: true,
166784
- help: "Serves the multiplayer webapp",
166785
- flags: {
166786
- serve: {
166787
- description: "Serve the multiplayer app locally after building (npm start)"
166788
- },
166789
- docs: {
166790
- description: "Path to local docs folder to copy into multiplayer",
166791
- type: "string",
166792
- argument: "docs"
166793
- }
166794
- }
166795
- }, buildMultiplayerAsync);
166796
166792
  advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");
166797
166793
  advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]");
166798
166794
  advancedCommand("hidlist", "list HID devices", hid.listAsync);
@@ -6525,6 +6525,7 @@ var pxt;
6525
6525
  newCommentText = newCommentText.replace(/@collapsed/g, '').trim();
6526
6526
  b.setCollapsed(true);
6527
6527
  }
6528
+ newCommentText = newCommentText.replace(/@validate-\S+/g, '').trim();
6528
6529
  if (initialCommentText !== newCommentText && !(opts === null || opts === void 0 ? void 0 : opts.keepMetaComments)) {
6529
6530
  b.setCommentText(newCommentText || null);
6530
6531
  }
@@ -2963,6 +2963,7 @@ var pxt;
2963
2963
  newCommentText = newCommentText.replace(/@collapsed/g, '').trim();
2964
2964
  b.setCollapsed(true);
2965
2965
  }
2966
+ newCommentText = newCommentText.replace(/@validate-\S+/g, '').trim();
2966
2967
  if (initialCommentText !== newCommentText && !(opts === null || opts === void 0 ? void 0 : opts.keepMetaComments)) {
2967
2968
  b.setCommentText(newCommentText || null);
2968
2969
  }
package/built/pxtlib.d.ts CHANGED
@@ -826,10 +826,11 @@ declare namespace pxt.BrowserUtils {
826
826
  blocks: Map<number>;
827
827
  snippets: Map<Map<number>>;
828
828
  highlightBlocks: Map<Map<number>>;
829
+ validateBlocks: Map<Map<string[]>>;
829
830
  }
830
831
  export interface ITutorialInfoDb {
831
832
  getAsync(filename: string, code: string[], branch?: string): Promise<TutorialInfoIndexedDbEntry>;
832
- setAsync(filename: string, snippets: Map<Map<number>>, code: string[], highlights: Map<Map<number>>, branch?: string): Promise<void>;
833
+ setAsync(filename: string, snippets: Map<Map<number>>, code: string[], highlights: Map<Map<number>>, codeValidationMap: Map<Map<string[]>>, branch?: string): Promise<void>;
833
834
  clearAsync(): Promise<void>;
834
835
  }
835
836
  class TutorialInfoIndexedDb implements ITutorialInfoDb {
@@ -840,8 +841,8 @@ declare namespace pxt.BrowserUtils {
840
841
  static createAsync(): Promise<TutorialInfoIndexedDb>;
841
842
  private constructor();
842
843
  getAsync(filename: string, code: string[], branch?: string): Promise<TutorialInfoIndexedDbEntry>;
843
- setAsync(filename: string, snippets: Map<Map<number>>, code: string[], highlights: Map<Map<number>>, branch?: string): Promise<void>;
844
- setWithHashAsync(filename: string, snippets: Map<Map<number>>, hash: string, highlights: Map<Map<number>>, branch?: string): Promise<void>;
844
+ setAsync(filename: string, snippets: Map<Map<number>>, code: string[], highlights: Map<Map<number>>, codeValidationMap: Map<Map<string[]>>, branch?: string): Promise<void>;
845
+ setWithHashAsync(filename: string, snippets: Map<Map<number>>, hash: string, highlights: Map<Map<number>>, codeValidationMap: Map<Map<string[]>>, branch?: string): Promise<void>;
845
846
  clearAsync(): Promise<void>;
846
847
  }
847
848
  export function tutorialInfoDbAsync(): Promise<TutorialInfoIndexedDb>;
@@ -2986,6 +2987,8 @@ declare namespace pxt.tutorial {
2986
2987
  function parseAssetJson(json: string): pxt.Map<string>;
2987
2988
  function parseSimThemeJson(json: string): Partial<pxt.PackageConfig>;
2988
2989
  function getTutorialHighlightedBlocks(tutorial: TutorialOptions): Promise<pxt.Map<pxt.Map<number>> | undefined>;
2990
+ function getTutorialValidateBlocks(tutorial: TutorialOptions): Promise<pxt.Map<pxt.Map<string[]>> | undefined>;
2991
+ function getRequiredBlockCounts(stepBlocks: pxt.Map<string[]>): pxt.Map<number>;
2989
2992
  function getTutorialStepHash(tutorial: TutorialOptions): string;
2990
2993
  }
2991
2994
  declare namespace ts.pxtc {
package/built/pxtlib.js CHANGED
@@ -2807,7 +2807,8 @@ var ts;
2807
2807
  hash: built.hash,
2808
2808
  usedBlocks: Object.assign({}, built.usedBlocks),
2809
2809
  snippetBlocks: Object.assign({}, built.snippetBlocks),
2810
- highlightBlocks: Object.assign({}, built.highlightBlocks)
2810
+ highlightBlocks: Object.assign({}, built.highlightBlocks),
2811
+ validateBlocks: Object.assign({}, built.validateBlocks),
2811
2812
  };
2812
2813
  }
2813
2814
  }
@@ -5697,13 +5698,13 @@ var pxt;
5697
5698
  return undefined;
5698
5699
  });
5699
5700
  }
5700
- setAsync(filename, snippets, code, highlights, branch) {
5701
+ setAsync(filename, snippets, code, highlights, codeValidationMap, branch) {
5701
5702
  pxt.perf.measureStart("tutorial info db setAsync");
5702
5703
  const key = getTutorialInfoKey(filename, branch);
5703
5704
  const hash = getTutorialCodeHash(code);
5704
- return this.setWithHashAsync(filename, snippets, hash, highlights);
5705
+ return this.setWithHashAsync(filename, snippets, hash, highlights, codeValidationMap);
5705
5706
  }
5706
- setWithHashAsync(filename, snippets, hash, highlights, branch) {
5707
+ setWithHashAsync(filename, snippets, hash, highlights, codeValidationMap, branch) {
5707
5708
  pxt.perf.measureStart("tutorial info db setAsync");
5708
5709
  const key = getTutorialInfoKey(filename, branch);
5709
5710
  const blocks = {};
@@ -5719,6 +5720,7 @@ var pxt;
5719
5720
  snippets,
5720
5721
  blocks,
5721
5722
  highlightBlocks: highlights,
5723
+ validateBlocks: codeValidationMap
5722
5724
  };
5723
5725
  return this.db.setAsync(TutorialInfoIndexedDb.TABLE, entry)
5724
5726
  .then(() => {
@@ -21595,13 +21597,13 @@ ${code}
21595
21597
  if (id && cachedInfo[id]) {
21596
21598
  const info = cachedInfo[id];
21597
21599
  if (info.usedBlocks && info.hash)
21598
- db.setWithHashAsync(id, info.snippetBlocks, info.hash, info.highlightBlocks);
21600
+ db.setWithHashAsync(id, info.snippetBlocks, info.hash, info.highlightBlocks, info.validateBlocks);
21599
21601
  }
21600
21602
  else {
21601
21603
  for (let key of Object.keys(cachedInfo)) {
21602
21604
  const info = cachedInfo[key];
21603
21605
  if (info.usedBlocks && info.hash)
21604
- db.setWithHashAsync(key, info.snippetBlocks, info.hash, info.highlightBlocks);
21606
+ db.setWithHashAsync(key, info.snippetBlocks, info.hash, info.highlightBlocks, info.validateBlocks);
21605
21607
  }
21606
21608
  }
21607
21609
  }).catch((err) => { });
@@ -21658,6 +21660,25 @@ ${code}
21658
21660
  return entry === null || entry === void 0 ? void 0 : entry.highlightBlocks;
21659
21661
  }
21660
21662
  tutorial_1.getTutorialHighlightedBlocks = getTutorialHighlightedBlocks;
21663
+ async function getTutorialValidateBlocks(tutorial) {
21664
+ const db = await pxt.BrowserUtils.tutorialInfoDbAsync();
21665
+ const entry = await db.getAsync(tutorial.tutorial, tutorial.tutorialCode);
21666
+ return entry === null || entry === void 0 ? void 0 : entry.validateBlocks;
21667
+ }
21668
+ tutorial_1.getTutorialValidateBlocks = getTutorialValidateBlocks;
21669
+ function getRequiredBlockCounts(stepBlocks) {
21670
+ if (!stepBlocks)
21671
+ return undefined;
21672
+ const requiredBlocks = {};
21673
+ const blocks = stepBlocks["validate-exists"];
21674
+ if (blocks) {
21675
+ blocks.forEach(block => {
21676
+ requiredBlocks[block] = (requiredBlocks[block] || 0) + 1;
21677
+ });
21678
+ }
21679
+ return requiredBlocks;
21680
+ }
21681
+ tutorial_1.getRequiredBlockCounts = getRequiredBlockCounts;
21661
21682
  function getTutorialStepHash(tutorial) {
21662
21683
  const { tutorialStepInfo, tutorialStep } = tutorial;
21663
21684
  const body = tutorialStepInfo[tutorialStep].hintContentMd;
package/built/server.js CHANGED
@@ -23,8 +23,9 @@ let packagedDir = "";
23
23
  let localHexCacheDir = path.join("built", "hexcache");
24
24
  let serveOptions;
25
25
  const webappNames = [
26
- "kiosk"
27
- // TODO: Add other webapp names here: "multiplayer", "skillmap", "authcode"
26
+ "kiosk",
27
+ "multiplayer"
28
+ // TODO: Add other webapp names here: "skillmap", "authcode"
28
29
  ];
29
30
  function setupDocfilesdirs() {
30
31
  docfilesdirs = [