pxt-core 8.6.36 → 8.6.37

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
@@ -928,6 +928,7 @@ function uploadCoreAsync(opts) {
928
928
  "/doccdn/": opts.localDir,
929
929
  "/sim/": opts.localDir,
930
930
  "/blb/": opts.localDir,
931
+ "/trgblb/": opts.localDir,
931
932
  "@monacoworkerjs@": `${opts.localDir}monacoworker.js`,
932
933
  "@gifworkerjs@": `${opts.localDir}gifjs/gif.worker.js`,
933
934
  "@workerjs@": `${opts.localDir}worker.js`,
package/built/pxt.js CHANGED
@@ -111473,7 +111473,10 @@ var pxt;
111473
111473
  method: "GET",
111474
111474
  allowHttpErrors: true
111475
111475
  });
111476
- if (resp.json) {
111476
+ if (resp.statusCode === 204) {
111477
+ throw new Error(`Missing ${key} not available in ${container}`);
111478
+ }
111479
+ else if (resp.json) {
111477
111480
  return resp.json;
111478
111481
  }
111479
111482
  else if (resp.text) {
@@ -122477,7 +122480,7 @@ var pxt;
122477
122480
  });
122478
122481
  }
122479
122482
  Cloud.downloadScriptFilesAsync = downloadScriptFilesAsync;
122480
- async function markdownAsync(docid, locale) {
122483
+ async function markdownAsync(docid, locale, propagateExceptions) {
122481
122484
  // 1h check on markdown content if not on development server
122482
122485
  const MARKDOWN_EXPIRATION = pxt.BrowserUtils.isLocalHostDev() ? 0 : 1 * 60 * 60 * 1000;
122483
122486
  // 1w check don't use cached version and wait for new content
@@ -122496,8 +122499,13 @@ var pxt;
122496
122499
  }
122497
122500
  return entry.md;
122498
122501
  }
122499
- catch (_a) {
122500
- return ""; // no translation
122502
+ catch (e) {
122503
+ if (propagateExceptions) {
122504
+ throw e;
122505
+ }
122506
+ else {
122507
+ return ""; // no translation
122508
+ }
122501
122509
  }
122502
122510
  };
122503
122511
  if (entry) {
@@ -161445,6 +161453,7 @@ function uploadCoreAsync(opts) {
161445
161453
  "/doccdn/": opts.localDir,
161446
161454
  "/sim/": opts.localDir,
161447
161455
  "/blb/": opts.localDir,
161456
+ "/trgblb/": opts.localDir,
161448
161457
  "@monacoworkerjs@": `${opts.localDir}monacoworker.js`,
161449
161458
  "@gifworkerjs@": `${opts.localDir}gifjs/gif.worker.js`,
161450
161459
  "@workerjs@": `${opts.localDir}worker.js`,
package/built/pxtlib.d.ts CHANGED
@@ -3661,7 +3661,7 @@ declare namespace pxt.Cloud {
3661
3661
  function privateGetAsync(path: string, forceLiveEndpoint?: boolean): Promise<any>;
3662
3662
  function downloadTargetConfigAsync(): Promise<pxt.TargetConfig>;
3663
3663
  function downloadScriptFilesAsync(id: string): Promise<Map<string>>;
3664
- function markdownAsync(docid: string, locale?: string): Promise<string>;
3664
+ function markdownAsync(docid: string, locale?: string, propagateExceptions?: boolean): Promise<string>;
3665
3665
  function privateDeleteAsync(path: string): Promise<any>;
3666
3666
  function privatePostAsync(path: string, data: any, forceLiveEndpoint?: boolean): Promise<any>;
3667
3667
  function isLoggedIn(): boolean;
package/built/pxtlib.js CHANGED
@@ -13787,7 +13787,10 @@ var pxt;
13787
13787
  method: "GET",
13788
13788
  allowHttpErrors: true
13789
13789
  });
13790
- if (resp.json) {
13790
+ if (resp.statusCode === 204) {
13791
+ throw new Error(`Missing ${key} not available in ${container}`);
13792
+ }
13793
+ else if (resp.json) {
13791
13794
  return resp.json;
13792
13795
  }
13793
13796
  else if (resp.text) {
@@ -24791,7 +24794,7 @@ var pxt;
24791
24794
  });
24792
24795
  }
24793
24796
  Cloud.downloadScriptFilesAsync = downloadScriptFilesAsync;
24794
- async function markdownAsync(docid, locale) {
24797
+ async function markdownAsync(docid, locale, propagateExceptions) {
24795
24798
  // 1h check on markdown content if not on development server
24796
24799
  const MARKDOWN_EXPIRATION = pxt.BrowserUtils.isLocalHostDev() ? 0 : 1 * 60 * 60 * 1000;
24797
24800
  // 1w check don't use cached version and wait for new content
@@ -24810,8 +24813,13 @@ var pxt;
24810
24813
  }
24811
24814
  return entry.md;
24812
24815
  }
24813
- catch (_a) {
24814
- return ""; // no translation
24816
+ catch (e) {
24817
+ if (propagateExceptions) {
24818
+ throw e;
24819
+ }
24820
+ else {
24821
+ return ""; // no translation
24822
+ }
24815
24823
  }
24816
24824
  };
24817
24825
  if (entry) {
@@ -2251,10 +2251,18 @@ ${linkString}
2251
2251
  return /\.py?$/.test(filename);
2252
2252
  }
2253
2253
  }
2254
- function renderDocAsync(content, docid) {
2254
+ async function renderDocAsync(content, docid) {
2255
2255
  docid = docid.replace(/^\//, "");
2256
- return pxt.Cloud.markdownAsync(docid)
2257
- .then(md => renderMarkdownAsync(content, md, { path: docid }));
2256
+ // if it fails on requesting, propagate failed promise
2257
+ const md = await pxt.Cloud.markdownAsync(docid, undefined, true /** don't suppress exception **/);
2258
+ try {
2259
+ // just log exceptions that occur during rendering,
2260
+ // similar to how normal docs handle them.
2261
+ await renderMarkdownAsync(content, md, { path: docid });
2262
+ }
2263
+ catch (e) {
2264
+ console.warn(e);
2265
+ }
2258
2266
  }
2259
2267
  function renderBookAsync(content, summaryid) {
2260
2268
  summaryid = summaryid.replace(/^\//, "");
@@ -2266,7 +2274,7 @@ ${linkString}
2266
2274
  // start the work
2267
2275
  let toc;
2268
2276
  return pxt.U.delay(100)
2269
- .then(() => pxt.Cloud.markdownAsync(summaryid))
2277
+ .then(() => pxt.Cloud.markdownAsync(summaryid, undefined, true))
2270
2278
  .then(summary => {
2271
2279
  toc = pxt.docs.buildTOC(summary);
2272
2280
  pxt.log(`TOC: ${JSON.stringify(toc, null, 2)}`);
@@ -2277,7 +2285,7 @@ ${linkString}
2277
2285
  });
2278
2286
  return pxt.U.promisePoolAsync(4, tocsp, async (entry) => {
2279
2287
  try {
2280
- const md = await pxt.Cloud.markdownAsync(entry.path);
2288
+ const md = await pxt.Cloud.markdownAsync(entry.path, undefined, true);
2281
2289
  entry.markdown = md;
2282
2290
  }
2283
2291
  catch (e) {
package/built/server.js CHANGED
@@ -269,7 +269,7 @@ async function handleApiStoreRequestAsync(req, res, elts) {
269
269
  }
270
270
  }
271
271
  else {
272
- res.writeHead(404);
272
+ res.writeHead(204);
273
273
  res.end();
274
274
  }
275
275
  }
@@ -1088,7 +1088,7 @@ function serveAsync(options) {
1088
1088
  return;
1089
1089
  }
1090
1090
  let dd = dirs;
1091
- let mm = /^\/(cdn|parts|sim|doccdn|blb)(\/.*)/.exec(pathname);
1091
+ let mm = /^\/(cdn|parts|sim|doccdn|blb|trgblb)(\/.*)/.exec(pathname);
1092
1092
  if (mm) {
1093
1093
  pathname = mm[2];
1094
1094
  }