pxt-core 13.0.7 → 13.0.8

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/pxt.js CHANGED
@@ -105538,7 +105538,7 @@ int main() {
105538
105538
  let m = /^:10....0[0E]41140E2FB82FA2BB(....)(....)(....)(....)(..)/.exec(ln);
105539
105539
  if (m) {
105540
105540
  metaLen = parseInt(swapBytes(m[1]), 16);
105541
- textLen = parseInt(swapBytes(m[2]), 16);
105541
+ textLen = parseInt(swapBytes(m[2]), 16) + parseInt(swapBytes(m[3]), 16) * 0x10000;
105542
105542
  toGo = metaLen + textLen;
105543
105543
  buf = new Uint8Array(toGo);
105544
105544
  }
@@ -140921,6 +140921,7 @@ var ts;
140921
140921
  addr += 256;
140922
140922
  }
140923
140923
  }
140924
+ pxtc.saveSourceToUF2 = saveSourceToUF2;
140924
140925
  function hexDump(bytes, startOffset = 0) {
140925
140926
  function toHex(n, len = 8) {
140926
140927
  let r = n.toString(16);
@@ -141310,10 +141311,13 @@ _stored_program: .hex ${res}
141310
141311
  let metablob = pxtc.Util.toUTF8(meta);
141311
141312
  let totallen = metablob.length + binstring.length;
141312
141313
  let res = "\x41\x14\x0E\x2F\xB8\x2F\xA2\xBB";
141314
+ // Binary header as specified in docs/source-embedding.md: 2-byte meta
141315
+ // length, 4-byte text length, 2 reserved bytes, all little endian.
141313
141316
  res += pxtc.U.uint8ArrayToString([
141314
141317
  metablob.length & 0xff, metablob.length >> 8,
141315
- binstring.length & 0xff, binstring.length >> 8,
141316
- 0, 0, 0, 0
141318
+ binstring.length & 0xff, (binstring.length >> 8) & 0xff,
141319
+ (binstring.length >> 16) & 0xff, (binstring.length >> 24) & 0xff,
141320
+ 0, 0
141317
141321
  ]);
141318
141322
  res += metablob;
141319
141323
  res += binstring;
@@ -141321,6 +141325,7 @@ _stored_program: .hex ${res}
141321
141325
  res += "\x00";
141322
141326
  return res;
141323
141327
  }
141328
+ pxtc.packSource = packSource;
141324
141329
  function assembleAndPatch(src, bin, opts, cres) {
141325
141330
  const dummy = opts.extinfo.disabledDeps;
141326
141331
  if (dummy) {
@@ -158222,10 +158227,16 @@ var pxsim;
158222
158227
  // not found, spin a new one
158223
158228
  if (!messageFrame) {
158224
158229
  const url = new URL(simulatorExtension.url);
158225
- if (this.options.parentOrigin)
158226
- url.searchParams.set("parentOrigin", encodeURIComponent(this.options.parentOrigin));
158230
+ // The extension's parent window is this editor, so the origin it
158231
+ // should trust is the editor's own. options.parentOrigin is the
158232
+ // editor's *embedder* origin (controller mode) - the extension's
158233
+ // grandparent - so an extension that validates messages against
158234
+ // it rejects everything the editor sends when the editor is
158235
+ // embedded cross-origin.
158236
+ // searchParams.set() encodes, so don't encode the values here.
158237
+ url.searchParams.set("parentOrigin", window.location.origin);
158227
158238
  if (this.options.userLanguage)
158228
- url.searchParams.set("language", encodeURIComponent(this.options.userLanguage));
158239
+ url.searchParams.set("language", this.options.userLanguage);
158229
158240
  startSimulatorExtension(url.toString(), simulatorExtension.permanent, simulatorExtension.aspectRatio);
158230
158241
  }
158231
158242
  // not running the current run, restart
@@ -834,6 +834,7 @@ declare namespace ts.pxtc {
834
834
  function hexBytes(bytes: number[]): string;
835
835
  function patchHex(bin: Binary, buf: number[], shortForm: boolean, useuf2: boolean): string[];
836
836
  }
837
+ function saveSourceToUF2(uf2: UF2.BlockFile, bin: Binary): void;
837
838
  function hexDump(bytes: ArrayLike<number>, startOffset?: number): string;
838
839
  function asmline(s: string): string;
839
840
  function firstMethodOffset(): number;
@@ -850,6 +851,7 @@ declare namespace ts.pxtc {
850
851
  buf: number[];
851
852
  thumbFile: assembler.File;
852
853
  };
854
+ function packSource(meta: string, binstring: string): string;
853
855
  function processorEmit(bin: Binary, opts: CompileOptions, cres: CompileResult): void;
854
856
  let validateShim: typeof hexfile.validateShim;
855
857
  }
@@ -16064,6 +16064,7 @@ var ts;
16064
16064
  addr += 256;
16065
16065
  }
16066
16066
  }
16067
+ pxtc.saveSourceToUF2 = saveSourceToUF2;
16067
16068
  function hexDump(bytes, startOffset = 0) {
16068
16069
  function toHex(n, len = 8) {
16069
16070
  let r = n.toString(16);
@@ -16453,10 +16454,13 @@ _stored_program: .hex ${res}
16453
16454
  let metablob = pxtc.Util.toUTF8(meta);
16454
16455
  let totallen = metablob.length + binstring.length;
16455
16456
  let res = "\x41\x14\x0E\x2F\xB8\x2F\xA2\xBB";
16457
+ // Binary header as specified in docs/source-embedding.md: 2-byte meta
16458
+ // length, 4-byte text length, 2 reserved bytes, all little endian.
16456
16459
  res += pxtc.U.uint8ArrayToString([
16457
16460
  metablob.length & 0xff, metablob.length >> 8,
16458
- binstring.length & 0xff, binstring.length >> 8,
16459
- 0, 0, 0, 0
16461
+ binstring.length & 0xff, (binstring.length >> 8) & 0xff,
16462
+ (binstring.length >> 16) & 0xff, (binstring.length >> 24) & 0xff,
16463
+ 0, 0
16460
16464
  ]);
16461
16465
  res += metablob;
16462
16466
  res += binstring;
@@ -16464,6 +16468,7 @@ _stored_program: .hex ${res}
16464
16468
  res += "\x00";
16465
16469
  return res;
16466
16470
  }
16471
+ pxtc.packSource = packSource;
16467
16472
  function assembleAndPatch(src, bin, opts, cres) {
16468
16473
  const dummy = opts.extinfo.disabledDeps;
16469
16474
  if (dummy) {
package/built/pxtlib.js CHANGED
@@ -7817,7 +7817,7 @@ int main() {
7817
7817
  let m = /^:10....0[0E]41140E2FB82FA2BB(....)(....)(....)(....)(..)/.exec(ln);
7818
7818
  if (m) {
7819
7819
  metaLen = parseInt(swapBytes(m[1]), 16);
7820
- textLen = parseInt(swapBytes(m[2]), 16);
7820
+ textLen = parseInt(swapBytes(m[2]), 16) + parseInt(swapBytes(m[3]), 16) * 0x10000;
7821
7821
  toGo = metaLen + textLen;
7822
7822
  buf = new Uint8Array(toGo);
7823
7823
  }
package/built/pxtsim.js CHANGED
@@ -6721,10 +6721,16 @@ var pxsim;
6721
6721
  // not found, spin a new one
6722
6722
  if (!messageFrame) {
6723
6723
  const url = new URL(simulatorExtension.url);
6724
- if (this.options.parentOrigin)
6725
- url.searchParams.set("parentOrigin", encodeURIComponent(this.options.parentOrigin));
6724
+ // The extension's parent window is this editor, so the origin it
6725
+ // should trust is the editor's own. options.parentOrigin is the
6726
+ // editor's *embedder* origin (controller mode) - the extension's
6727
+ // grandparent - so an extension that validates messages against
6728
+ // it rejects everything the editor sends when the editor is
6729
+ // embedded cross-origin.
6730
+ // searchParams.set() encodes, so don't encode the values here.
6731
+ url.searchParams.set("parentOrigin", window.location.origin);
6726
6732
  if (this.options.userLanguage)
6727
- url.searchParams.set("language", encodeURIComponent(this.options.userLanguage));
6733
+ url.searchParams.set("language", this.options.userLanguage);
6728
6734
  startSimulatorExtension(url.toString(), simulatorExtension.permanent, simulatorExtension.aspectRatio);
6729
6735
  }
6730
6736
  // not running the current run, restart