pxt-core 9.3.4 → 9.3.5
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 +39 -2
- package/built/pxtcompiler.d.ts +1 -0
- package/built/pxtcompiler.js +19 -0
- package/built/pxtlib.d.ts +2 -0
- package/built/pxtlib.js +20 -2
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtcompiler.js +1 -1
- package/built/web/pxtembed.js +1 -1
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/localtypings/pxtarget.d.ts +1 -0
- package/package.json +1 -1
package/built/pxt.js
CHANGED
|
@@ -114404,6 +114404,17 @@ var pxt;
|
|
|
114404
114404
|
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.patches : undefined;
|
|
114405
114405
|
if (!patches)
|
|
114406
114406
|
return undefined;
|
|
114407
|
+
return parsePatches(version, patches, kind);
|
|
114408
|
+
}
|
|
114409
|
+
patching.computePatches = computePatches;
|
|
114410
|
+
function computePyPatches(version, kind) {
|
|
114411
|
+
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.pyPatches : undefined;
|
|
114412
|
+
if (!patches)
|
|
114413
|
+
return undefined;
|
|
114414
|
+
return parsePatches(version, patches, kind);
|
|
114415
|
+
}
|
|
114416
|
+
patching.computePyPatches = computePyPatches;
|
|
114417
|
+
function parsePatches(version, patches, kind) {
|
|
114407
114418
|
const v = pxt.semver.tryParse(version || "0.0.0") || pxt.semver.tryParse("0.0.0");
|
|
114408
114419
|
let r = [];
|
|
114409
114420
|
Object.keys(patches)
|
|
@@ -114413,7 +114424,6 @@ var pxt;
|
|
|
114413
114424
|
r = r.filter(p => p.type == kind);
|
|
114414
114425
|
return r.length ? r : undefined;
|
|
114415
114426
|
}
|
|
114416
|
-
patching.computePatches = computePatches;
|
|
114417
114427
|
function upgradePackageReference(pkgTargetVersion, pkg, val) {
|
|
114418
114428
|
if (val != "*")
|
|
114419
114429
|
return pkg;
|
|
@@ -114433,6 +114443,15 @@ var pxt;
|
|
|
114433
114443
|
patching.upgradePackageReference = upgradePackageReference;
|
|
114434
114444
|
function patchJavaScript(pkgTargetVersion, fileContents) {
|
|
114435
114445
|
const upgrades = pxt.patching.computePatches(pkgTargetVersion);
|
|
114446
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
114447
|
+
}
|
|
114448
|
+
patching.patchJavaScript = patchJavaScript;
|
|
114449
|
+
function patchPython(pkgTargetVersion, fileContents) {
|
|
114450
|
+
const upgrades = pxt.patching.computePyPatches(pkgTargetVersion);
|
|
114451
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
114452
|
+
}
|
|
114453
|
+
patching.patchPython = patchPython;
|
|
114454
|
+
function patchTextCode(pkgTargetVersion, fileContents, upgrades) {
|
|
114436
114455
|
let updatedContents = fileContents;
|
|
114437
114456
|
if (upgrades) {
|
|
114438
114457
|
upgrades.filter(u => u.type === "api").forEach(rule => {
|
|
@@ -114452,7 +114471,6 @@ var pxt;
|
|
|
114452
114471
|
}
|
|
114453
114472
|
return updatedContents;
|
|
114454
114473
|
}
|
|
114455
|
-
patching.patchJavaScript = patchJavaScript;
|
|
114456
114474
|
})(patching = pxt.patching || (pxt.patching = {}));
|
|
114457
114475
|
})(pxt || (pxt = {}));
|
|
114458
114476
|
var pxt;
|
|
@@ -123226,6 +123244,9 @@ var pxt;
|
|
|
123226
123244
|
return mainPkg.getCompileOptionsAsync(target);
|
|
123227
123245
|
}).then(opts => {
|
|
123228
123246
|
patchTS(mainPkg.targetVersion(), opts);
|
|
123247
|
+
if (mainPkg.getPreferredEditor() === pxt.PYTHON_PROJECT_NAME) {
|
|
123248
|
+
patchPY(mainPkg.targetVersion(), opts);
|
|
123249
|
+
}
|
|
123229
123250
|
prepPythonOptions(opts);
|
|
123230
123251
|
return opts;
|
|
123231
123252
|
});
|
|
@@ -123259,6 +123280,22 @@ var pxt;
|
|
|
123259
123280
|
}
|
|
123260
123281
|
}
|
|
123261
123282
|
pxt.patchTS = patchTS;
|
|
123283
|
+
function patchPY(version, opts) {
|
|
123284
|
+
if (!version)
|
|
123285
|
+
return;
|
|
123286
|
+
pxt.debug(`applying PY patches relative to ${version}`);
|
|
123287
|
+
for (let fn of Object.keys(opts.fileSystem)) {
|
|
123288
|
+
if (fn.indexOf("/") == -1 && pxt.U.endsWith(fn, ".py")) {
|
|
123289
|
+
const initial = opts.fileSystem[fn];
|
|
123290
|
+
const patched = pxt.patching.patchPython(version, initial);
|
|
123291
|
+
if (initial != patched) {
|
|
123292
|
+
pxt.debug(`applying PY patch to ${fn}`);
|
|
123293
|
+
opts.fileSystem[fn] = patched;
|
|
123294
|
+
}
|
|
123295
|
+
}
|
|
123296
|
+
}
|
|
123297
|
+
}
|
|
123298
|
+
pxt.patchPY = patchPY;
|
|
123262
123299
|
function setupSimpleCompile(cfg) {
|
|
123263
123300
|
if (typeof global != "undefined" && !global.btoa) {
|
|
123264
123301
|
global.btoa = function (str) { return Buffer.from(str, "binary").toString("base64"); };
|
package/built/pxtcompiler.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare namespace pxt {
|
|
|
31
31
|
function simpleGetCompileOptionsAsync(files: pxt.Map<string>, simpleOptions: SimpleCompileOptions): Promise<pxtc.CompileOptions>;
|
|
32
32
|
function simpleCompileAsync(files: pxt.Map<string>, optionsOrNative?: SimpleCompileOptions | boolean): Promise<CompileResultWithErrors>;
|
|
33
33
|
function patchTS(version: string, opts: pxtc.CompileOptions): void;
|
|
34
|
+
function patchPY(version: string, opts: pxtc.CompileOptions): void;
|
|
34
35
|
function setupSimpleCompile(cfg?: SimpleDriverCallbacks): void;
|
|
35
36
|
}
|
|
36
37
|
declare namespace pxt {
|
package/built/pxtcompiler.js
CHANGED
|
@@ -141,6 +141,9 @@ var pxt;
|
|
|
141
141
|
return mainPkg.getCompileOptionsAsync(target);
|
|
142
142
|
}).then(opts => {
|
|
143
143
|
patchTS(mainPkg.targetVersion(), opts);
|
|
144
|
+
if (mainPkg.getPreferredEditor() === pxt.PYTHON_PROJECT_NAME) {
|
|
145
|
+
patchPY(mainPkg.targetVersion(), opts);
|
|
146
|
+
}
|
|
144
147
|
prepPythonOptions(opts);
|
|
145
148
|
return opts;
|
|
146
149
|
});
|
|
@@ -174,6 +177,22 @@ var pxt;
|
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
pxt.patchTS = patchTS;
|
|
180
|
+
function patchPY(version, opts) {
|
|
181
|
+
if (!version)
|
|
182
|
+
return;
|
|
183
|
+
pxt.debug(`applying PY patches relative to ${version}`);
|
|
184
|
+
for (let fn of Object.keys(opts.fileSystem)) {
|
|
185
|
+
if (fn.indexOf("/") == -1 && pxt.U.endsWith(fn, ".py")) {
|
|
186
|
+
const initial = opts.fileSystem[fn];
|
|
187
|
+
const patched = pxt.patching.patchPython(version, initial);
|
|
188
|
+
if (initial != patched) {
|
|
189
|
+
pxt.debug(`applying PY patch to ${fn}`);
|
|
190
|
+
opts.fileSystem[fn] = patched;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
pxt.patchPY = patchPY;
|
|
177
196
|
function setupSimpleCompile(cfg) {
|
|
178
197
|
if (typeof global != "undefined" && !global.btoa) {
|
|
179
198
|
global.btoa = function (str) { return Buffer.from(str, "binary").toString("base64"); };
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -1986,8 +1986,10 @@ declare namespace pxt.packetio {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
declare namespace pxt.patching {
|
|
1988
1988
|
function computePatches(version: string, kind?: string): ts.pxtc.UpgradePolicy[];
|
|
1989
|
+
function computePyPatches(version: string, kind?: string): ts.pxtc.UpgradePolicy[];
|
|
1989
1990
|
function upgradePackageReference(pkgTargetVersion: string, pkg: string, val: string): string;
|
|
1990
1991
|
function patchJavaScript(pkgTargetVersion: string, fileContents: string): string;
|
|
1992
|
+
function patchPython(pkgTargetVersion: string, fileContents: string): string;
|
|
1991
1993
|
}
|
|
1992
1994
|
declare namespace pxt.react {
|
|
1993
1995
|
interface FieldEditorView<U> {
|
package/built/pxtlib.js
CHANGED
|
@@ -16718,6 +16718,17 @@ var pxt;
|
|
|
16718
16718
|
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.patches : undefined;
|
|
16719
16719
|
if (!patches)
|
|
16720
16720
|
return undefined;
|
|
16721
|
+
return parsePatches(version, patches, kind);
|
|
16722
|
+
}
|
|
16723
|
+
patching.computePatches = computePatches;
|
|
16724
|
+
function computePyPatches(version, kind) {
|
|
16725
|
+
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.pyPatches : undefined;
|
|
16726
|
+
if (!patches)
|
|
16727
|
+
return undefined;
|
|
16728
|
+
return parsePatches(version, patches, kind);
|
|
16729
|
+
}
|
|
16730
|
+
patching.computePyPatches = computePyPatches;
|
|
16731
|
+
function parsePatches(version, patches, kind) {
|
|
16721
16732
|
const v = pxt.semver.tryParse(version || "0.0.0") || pxt.semver.tryParse("0.0.0");
|
|
16722
16733
|
let r = [];
|
|
16723
16734
|
Object.keys(patches)
|
|
@@ -16727,7 +16738,6 @@ var pxt;
|
|
|
16727
16738
|
r = r.filter(p => p.type == kind);
|
|
16728
16739
|
return r.length ? r : undefined;
|
|
16729
16740
|
}
|
|
16730
|
-
patching.computePatches = computePatches;
|
|
16731
16741
|
function upgradePackageReference(pkgTargetVersion, pkg, val) {
|
|
16732
16742
|
if (val != "*")
|
|
16733
16743
|
return pkg;
|
|
@@ -16747,6 +16757,15 @@ var pxt;
|
|
|
16747
16757
|
patching.upgradePackageReference = upgradePackageReference;
|
|
16748
16758
|
function patchJavaScript(pkgTargetVersion, fileContents) {
|
|
16749
16759
|
const upgrades = pxt.patching.computePatches(pkgTargetVersion);
|
|
16760
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
16761
|
+
}
|
|
16762
|
+
patching.patchJavaScript = patchJavaScript;
|
|
16763
|
+
function patchPython(pkgTargetVersion, fileContents) {
|
|
16764
|
+
const upgrades = pxt.patching.computePyPatches(pkgTargetVersion);
|
|
16765
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
16766
|
+
}
|
|
16767
|
+
patching.patchPython = patchPython;
|
|
16768
|
+
function patchTextCode(pkgTargetVersion, fileContents, upgrades) {
|
|
16750
16769
|
let updatedContents = fileContents;
|
|
16751
16770
|
if (upgrades) {
|
|
16752
16771
|
upgrades.filter(u => u.type === "api").forEach(rule => {
|
|
@@ -16766,7 +16785,6 @@ var pxt;
|
|
|
16766
16785
|
}
|
|
16767
16786
|
return updatedContents;
|
|
16768
16787
|
}
|
|
16769
|
-
patching.patchJavaScript = patchJavaScript;
|
|
16770
16788
|
})(patching = pxt.patching || (pxt.patching = {}));
|
|
16771
16789
|
})(pxt || (pxt = {}));
|
|
16772
16790
|
var pxt;
|