pxt-core 9.2.4 → 9.2.6
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 +40 -3
- package/built/pxtcompiler.d.ts +1 -0
- package/built/pxtcompiler.js +20 -1
- 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
|
@@ -114388,6 +114388,17 @@ var pxt;
|
|
|
114388
114388
|
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.patches : undefined;
|
|
114389
114389
|
if (!patches)
|
|
114390
114390
|
return undefined;
|
|
114391
|
+
return parsePatches(version, patches, kind);
|
|
114392
|
+
}
|
|
114393
|
+
patching.computePatches = computePatches;
|
|
114394
|
+
function computePyPatches(version, kind) {
|
|
114395
|
+
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.pyPatches : undefined;
|
|
114396
|
+
if (!patches)
|
|
114397
|
+
return undefined;
|
|
114398
|
+
return parsePatches(version, patches, kind);
|
|
114399
|
+
}
|
|
114400
|
+
patching.computePyPatches = computePyPatches;
|
|
114401
|
+
function parsePatches(version, patches, kind) {
|
|
114391
114402
|
const v = pxt.semver.tryParse(version || "0.0.0") || pxt.semver.tryParse("0.0.0");
|
|
114392
114403
|
let r = [];
|
|
114393
114404
|
Object.keys(patches)
|
|
@@ -114397,7 +114408,6 @@ var pxt;
|
|
|
114397
114408
|
r = r.filter(p => p.type == kind);
|
|
114398
114409
|
return r.length ? r : undefined;
|
|
114399
114410
|
}
|
|
114400
|
-
patching.computePatches = computePatches;
|
|
114401
114411
|
function upgradePackageReference(pkgTargetVersion, pkg, val) {
|
|
114402
114412
|
if (val != "*")
|
|
114403
114413
|
return pkg;
|
|
@@ -114417,6 +114427,15 @@ var pxt;
|
|
|
114417
114427
|
patching.upgradePackageReference = upgradePackageReference;
|
|
114418
114428
|
function patchJavaScript(pkgTargetVersion, fileContents) {
|
|
114419
114429
|
const upgrades = pxt.patching.computePatches(pkgTargetVersion);
|
|
114430
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
114431
|
+
}
|
|
114432
|
+
patching.patchJavaScript = patchJavaScript;
|
|
114433
|
+
function patchPython(pkgTargetVersion, fileContents) {
|
|
114434
|
+
const upgrades = pxt.patching.computePyPatches(pkgTargetVersion);
|
|
114435
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
114436
|
+
}
|
|
114437
|
+
patching.patchPython = patchPython;
|
|
114438
|
+
function patchTextCode(pkgTargetVersion, fileContents, upgrades) {
|
|
114420
114439
|
let updatedContents = fileContents;
|
|
114421
114440
|
if (upgrades) {
|
|
114422
114441
|
upgrades.filter(u => u.type === "api").forEach(rule => {
|
|
@@ -114436,7 +114455,6 @@ var pxt;
|
|
|
114436
114455
|
}
|
|
114437
114456
|
return updatedContents;
|
|
114438
114457
|
}
|
|
114439
|
-
patching.patchJavaScript = patchJavaScript;
|
|
114440
114458
|
})(patching = pxt.patching || (pxt.patching = {}));
|
|
114441
114459
|
})(pxt || (pxt = {}));
|
|
114442
114460
|
var pxt;
|
|
@@ -123210,6 +123228,9 @@ var pxt;
|
|
|
123210
123228
|
return mainPkg.getCompileOptionsAsync(target);
|
|
123211
123229
|
}).then(opts => {
|
|
123212
123230
|
patchTS(mainPkg.targetVersion(), opts);
|
|
123231
|
+
if (mainPkg.getPreferredEditor() === pxt.PYTHON_PROJECT_NAME) {
|
|
123232
|
+
patchPY(mainPkg.targetVersion(), opts);
|
|
123233
|
+
}
|
|
123213
123234
|
prepPythonOptions(opts);
|
|
123214
123235
|
return opts;
|
|
123215
123236
|
});
|
|
@@ -123243,6 +123264,22 @@ var pxt;
|
|
|
123243
123264
|
}
|
|
123244
123265
|
}
|
|
123245
123266
|
pxt.patchTS = patchTS;
|
|
123267
|
+
function patchPY(version, opts) {
|
|
123268
|
+
if (!version)
|
|
123269
|
+
return;
|
|
123270
|
+
pxt.debug(`applying PY patches relative to ${version}`);
|
|
123271
|
+
for (let fn of Object.keys(opts.fileSystem)) {
|
|
123272
|
+
if (fn.indexOf("/") == -1 && pxt.U.endsWith(fn, ".py")) {
|
|
123273
|
+
const initial = opts.fileSystem[fn];
|
|
123274
|
+
const patched = pxt.patching.patchPython(version, initial);
|
|
123275
|
+
if (initial != patched) {
|
|
123276
|
+
pxt.debug(`applying PY patch to ${fn}`);
|
|
123277
|
+
opts.fileSystem[fn] = patched;
|
|
123278
|
+
}
|
|
123279
|
+
}
|
|
123280
|
+
}
|
|
123281
|
+
}
|
|
123282
|
+
pxt.patchPY = patchPY;
|
|
123246
123283
|
function setupSimpleCompile(cfg) {
|
|
123247
123284
|
if (typeof global != "undefined" && !global.btoa) {
|
|
123248
123285
|
global.btoa = function (str) { return Buffer.from(str, "binary").toString("base64"); };
|
|
@@ -141718,7 +141755,7 @@ var ts;
|
|
|
141718
141755
|
}
|
|
141719
141756
|
const type = checker === null || checker === void 0 ? void 0 : checker.getTypeAtLocation(param);
|
|
141720
141757
|
const typeSymbol = service.getPxtSymbolFromTsSymbol(type === null || type === void 0 ? void 0 : type.symbol, apis, checker);
|
|
141721
|
-
if ((
|
|
141758
|
+
if ((typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.fixedInstances) && python) {
|
|
141722
141759
|
return pxt.Util.snakify(paramDefl);
|
|
141723
141760
|
}
|
|
141724
141761
|
if (python) {
|
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"); };
|
|
@@ -18649,7 +18668,7 @@ var ts;
|
|
|
18649
18668
|
}
|
|
18650
18669
|
const type = checker === null || checker === void 0 ? void 0 : checker.getTypeAtLocation(param);
|
|
18651
18670
|
const typeSymbol = service.getPxtSymbolFromTsSymbol(type === null || type === void 0 ? void 0 : type.symbol, apis, checker);
|
|
18652
|
-
if ((
|
|
18671
|
+
if ((typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.fixedInstances) && python) {
|
|
18653
18672
|
return pxt.Util.snakify(paramDefl);
|
|
18654
18673
|
}
|
|
18655
18674
|
if (python) {
|
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
|
@@ -16702,6 +16702,17 @@ var pxt;
|
|
|
16702
16702
|
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.patches : undefined;
|
|
16703
16703
|
if (!patches)
|
|
16704
16704
|
return undefined;
|
|
16705
|
+
return parsePatches(version, patches, kind);
|
|
16706
|
+
}
|
|
16707
|
+
patching.computePatches = computePatches;
|
|
16708
|
+
function computePyPatches(version, kind) {
|
|
16709
|
+
const patches = pxt.appTarget.compile ? pxt.appTarget.compile.pyPatches : undefined;
|
|
16710
|
+
if (!patches)
|
|
16711
|
+
return undefined;
|
|
16712
|
+
return parsePatches(version, patches, kind);
|
|
16713
|
+
}
|
|
16714
|
+
patching.computePyPatches = computePyPatches;
|
|
16715
|
+
function parsePatches(version, patches, kind) {
|
|
16705
16716
|
const v = pxt.semver.tryParse(version || "0.0.0") || pxt.semver.tryParse("0.0.0");
|
|
16706
16717
|
let r = [];
|
|
16707
16718
|
Object.keys(patches)
|
|
@@ -16711,7 +16722,6 @@ var pxt;
|
|
|
16711
16722
|
r = r.filter(p => p.type == kind);
|
|
16712
16723
|
return r.length ? r : undefined;
|
|
16713
16724
|
}
|
|
16714
|
-
patching.computePatches = computePatches;
|
|
16715
16725
|
function upgradePackageReference(pkgTargetVersion, pkg, val) {
|
|
16716
16726
|
if (val != "*")
|
|
16717
16727
|
return pkg;
|
|
@@ -16731,6 +16741,15 @@ var pxt;
|
|
|
16731
16741
|
patching.upgradePackageReference = upgradePackageReference;
|
|
16732
16742
|
function patchJavaScript(pkgTargetVersion, fileContents) {
|
|
16733
16743
|
const upgrades = pxt.patching.computePatches(pkgTargetVersion);
|
|
16744
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
16745
|
+
}
|
|
16746
|
+
patching.patchJavaScript = patchJavaScript;
|
|
16747
|
+
function patchPython(pkgTargetVersion, fileContents) {
|
|
16748
|
+
const upgrades = pxt.patching.computePyPatches(pkgTargetVersion);
|
|
16749
|
+
return patchTextCode(pkgTargetVersion, fileContents, upgrades);
|
|
16750
|
+
}
|
|
16751
|
+
patching.patchPython = patchPython;
|
|
16752
|
+
function patchTextCode(pkgTargetVersion, fileContents, upgrades) {
|
|
16734
16753
|
let updatedContents = fileContents;
|
|
16735
16754
|
if (upgrades) {
|
|
16736
16755
|
upgrades.filter(u => u.type === "api").forEach(rule => {
|
|
@@ -16750,7 +16769,6 @@ var pxt;
|
|
|
16750
16769
|
}
|
|
16751
16770
|
return updatedContents;
|
|
16752
16771
|
}
|
|
16753
|
-
patching.patchJavaScript = patchJavaScript;
|
|
16754
16772
|
})(patching = pxt.patching || (pxt.patching = {}));
|
|
16755
16773
|
})(pxt || (pxt = {}));
|
|
16756
16774
|
var pxt;
|