pxt-core 13.2.16 → 13.2.18
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/backendutils.d.ts +13 -0
- package/built/backendutils.js +66 -16
- package/built/cli.js +14 -9
- package/built/nodeutil.js +3 -7
- package/built/pxt.js +67 -25
- package/built/pxtblocks/backpack.d.ts +1 -1
- package/built/pxtblocks/clipboard.d.ts +1 -1
- package/built/pxtblocks/plugins/duplicateOnDrag/dragStrategy.d.ts +2 -0
- package/built/pxtlib.js +53 -16
- package/built/pxtservices/editorDriver.d.ts +1 -0
- package/built/target.js +1 -1
- package/built/targetlight.js +1 -1
- package/built/tests/blocksrunner.js +38 -18
- package/built/tests/blockssetup.js +38 -18
- package/built/tests/cli-test/cli/commandparser.d.ts +49 -0
- package/built/tests/cli-test/cli/nodeutil.d.ts +95 -0
- package/built/tests/cli-test/tests/cli-test/bump.d.ts +1 -0
- package/built/tests/cli-test/tests/cli-test/clirunner.d.ts +1 -0
- package/built/web/blockly.css +1 -1
- package/built/web/main.js +2 -2
- package/built/web/pxtapp.js +2 -2
- package/built/web/pxtasseteditor.js +2 -2
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/runnerembed.js +2 -2
- package/built/web/semantic.css +1 -1
- package/built/web/teachertool/js/{main.9894b09b.js → main.c8f9e9a1.js} +2 -2
- package/built/web/tutorialtool/js/{main.347d6451.js → main.86239049.js} +2 -2
- package/localtypings/pxteditor.d.ts +1 -0
- package/package.json +1 -1
- package/theme/blockly-core.less +5 -0
- package/theme/home.less +1 -0
- package/theme/themes/pxt/globals/zindex.variables +1 -1
- package/webapp/public/controller.html +1 -0
- package/webapp/public/teachertool.html +1 -1
- package/webapp/public/tutorialtool.html +1 -1
package/built/backendutils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Git commit: 3eb9726c022d4edebbee9c874347f2b4f69ff679
|
|
2
|
+
// Local untracked files or uncommitted changes at build time: yes
|
|
1
3
|
/// <reference path="../localtypings/pxtarget.d.ts" />
|
|
2
4
|
/// <reference path="../localtypings/dompurify.d.ts" />
|
|
3
5
|
/// <reference path="../localtypings/pxtpackage.d.ts" />
|
|
@@ -308,3 +310,14 @@ declare namespace pxt.cpp {
|
|
|
308
310
|
*/
|
|
309
311
|
function getExtensionInfo(files: Map<string>, target: TargetBundle, variant: string, host: ExtensionInfoHost): pxtc.ExtensionInfo;
|
|
310
312
|
}
|
|
313
|
+
declare namespace pxt {
|
|
314
|
+
interface BackendutilsVersion {
|
|
315
|
+
hash: string;
|
|
316
|
+
hasLocalChanges: boolean;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The git revision information is injected into this function at build time.
|
|
320
|
+
* See backendutils in gulpfile.js
|
|
321
|
+
*/
|
|
322
|
+
function backendutilsVersion(): BackendutilsVersion;
|
|
323
|
+
}
|
package/built/backendutils.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Git commit: 3eb9726c022d4edebbee9c874347f2b4f69ff679
|
|
2
|
+
// Local untracked files or uncommitted changes at build time: yes
|
|
1
3
|
// Needs to be in its own file to avoid a circular dependency: util.ts -> main.ts -> util.ts
|
|
2
4
|
var pxt;
|
|
3
5
|
(function (pxt) {
|
|
@@ -572,6 +574,8 @@ const lf = ts.pxtc.Util.lf;
|
|
|
572
574
|
let parts = k.split(".");
|
|
573
575
|
for (let i = 0; i < parts.length; ++i) {
|
|
574
576
|
let part = parts[i];
|
|
577
|
+
if (part === "__proto__" || part === "constructor" || part === "prototype")
|
|
578
|
+
Util.userError("Invalid configuration key: " + k);
|
|
575
579
|
if (i == parts.length - 1)
|
|
576
580
|
ptr[part] = v[k];
|
|
577
581
|
else {
|
|
@@ -1416,12 +1420,20 @@ ${opts.repo.name.replace(/^pxt-/, '')}=github:${opts.repo.fullName}#${opts.repo.
|
|
|
1416
1420
|
strong: 1,
|
|
1417
1421
|
em: 1,
|
|
1418
1422
|
};
|
|
1423
|
+
/** Keeps metadata and token-only HTML out of the translation catalog. */
|
|
1424
|
+
function isNonTranslatable(text) {
|
|
1425
|
+
if (text.startsWith("IE=edge,") || text.startsWith("width=device-width"))
|
|
1426
|
+
return true;
|
|
1427
|
+
// Remove URLs, template placeholders, and spacing entities to look for prose.
|
|
1428
|
+
const prose = text.replace(/(?:https?:\/\/|\/)[\w@\/.]+|@[-\w]+@|\{[^{}]+\}| /g, "");
|
|
1429
|
+
return !/[a-zA-Z]/.test(prose);
|
|
1430
|
+
}
|
|
1419
1431
|
function translate(html, locale) {
|
|
1420
1432
|
const missing = {};
|
|
1421
1433
|
function translateOne(toTranslate) {
|
|
1422
1434
|
let spm = /^(\s*)([^]*?)(\s*)$/.exec(toTranslate);
|
|
1423
1435
|
let text = spm[2].replace(/\s+/g, " ");
|
|
1424
|
-
if (
|
|
1436
|
+
if (isNonTranslatable(text))
|
|
1425
1437
|
return null;
|
|
1426
1438
|
let v = U.lookup(locale, text);
|
|
1427
1439
|
if (v)
|
|
@@ -3056,10 +3068,11 @@ var pxt;
|
|
|
3056
3068
|
if (!inEnum)
|
|
3057
3069
|
return;
|
|
3058
3070
|
// parse the enum case, with lots of optional stuff (?)
|
|
3059
|
-
|
|
3071
|
+
const enumLine = lnNC.trim().replace(/,$/, "").trim();
|
|
3072
|
+
let mm = /^(\w+)(?:\s*=(.*))?$/.exec(enumLine);
|
|
3060
3073
|
if (mm) {
|
|
3061
3074
|
let nm = mm[1];
|
|
3062
|
-
let v = mm[
|
|
3075
|
+
let v = mm[2] && mm[2].trim();
|
|
3063
3076
|
let opt = "";
|
|
3064
3077
|
if (v) {
|
|
3065
3078
|
// user-supplied value
|
|
@@ -3097,23 +3110,26 @@ var pxt;
|
|
|
3097
3110
|
}
|
|
3098
3111
|
function parseArg(parsedAttrs, s) {
|
|
3099
3112
|
s = s.trim();
|
|
3100
|
-
|
|
3113
|
+
const equals = s.lastIndexOf("=");
|
|
3114
|
+
const m = equals < 0 ? null : /^\s*(-?\w+)$/.exec(s.slice(equals + 1));
|
|
3101
3115
|
let defl = "";
|
|
3102
3116
|
let qm = "";
|
|
3103
3117
|
if (m) {
|
|
3104
|
-
defl = m[
|
|
3118
|
+
defl = m[1];
|
|
3105
3119
|
qm = "?";
|
|
3106
|
-
s =
|
|
3120
|
+
s = s.slice(0, equals).trim();
|
|
3107
3121
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3122
|
+
let nameStart = s.length;
|
|
3123
|
+
while (nameStart > 0 && /\w/.test(s.charAt(nameStart - 1)))
|
|
3124
|
+
--nameStart;
|
|
3125
|
+
if (nameStart == s.length || /[\r\n\u2028\u2029]/.test(s.slice(0, nameStart))) {
|
|
3110
3126
|
err("invalid argument: " + s);
|
|
3111
3127
|
return {
|
|
3112
3128
|
name: "???",
|
|
3113
3129
|
type: "int"
|
|
3114
3130
|
};
|
|
3115
3131
|
}
|
|
3116
|
-
let argName =
|
|
3132
|
+
let argName = s.slice(nameStart);
|
|
3117
3133
|
if (parsedAttrs.paramDefl[argName]) {
|
|
3118
3134
|
defl = parsedAttrs.paramDefl[argName];
|
|
3119
3135
|
qm = "?";
|
|
@@ -3128,7 +3144,7 @@ var pxt;
|
|
|
3128
3144
|
}
|
|
3129
3145
|
return {
|
|
3130
3146
|
name: argName + qm,
|
|
3131
|
-
type:
|
|
3147
|
+
type: s.slice(0, nameStart)
|
|
3132
3148
|
};
|
|
3133
3149
|
}
|
|
3134
3150
|
function parseCpp(src, isHeader) {
|
|
@@ -3138,9 +3154,28 @@ var pxt;
|
|
|
3138
3154
|
inDocComment = false;
|
|
3139
3155
|
let indexedInstanceAttrs;
|
|
3140
3156
|
let indexedInstanceIdx = -1;
|
|
3141
|
-
//
|
|
3142
|
-
|
|
3143
|
-
|
|
3157
|
+
// Match directives one line at a time so unterminated blocks cannot rescan the source.
|
|
3158
|
+
const lines = src.split(/\r?\n/);
|
|
3159
|
+
let ifStart = -1;
|
|
3160
|
+
let ifArg = "";
|
|
3161
|
+
lines.forEach((ln, i) => {
|
|
3162
|
+
const directive = /^#\s*(?:if\s+(\w+)|(elif|else|endif))$/.exec(ln.trim());
|
|
3163
|
+
if (!directive)
|
|
3164
|
+
return;
|
|
3165
|
+
if (ifStart < 0) {
|
|
3166
|
+
if (directive[1]) {
|
|
3167
|
+
ifStart = i;
|
|
3168
|
+
ifArg = directive[1];
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
else if (directive[2]) {
|
|
3172
|
+
if (hash_if_options.indexOf(ifArg) >= 0 && !cpp_options[ifArg]) {
|
|
3173
|
+
for (let j = ifStart + 1; j < i; ++j)
|
|
3174
|
+
lines[j] = "";
|
|
3175
|
+
}
|
|
3176
|
+
ifStart = -1;
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
3144
3179
|
// special handling of C++ namespace that ends with Methods (e.g. FooMethods)
|
|
3145
3180
|
// such a namespace will be converted into a TypeScript interface
|
|
3146
3181
|
// this enables simple objects with methods to be defined. See, for example:
|
|
@@ -3218,10 +3253,14 @@ var pxt;
|
|
|
3218
3253
|
return "T";
|
|
3219
3254
|
case "String":
|
|
3220
3255
|
return "S";
|
|
3221
|
-
default:
|
|
3256
|
+
default: {
|
|
3222
3257
|
if (U.lookup(knownEnums, tp))
|
|
3223
3258
|
return "I";
|
|
3224
|
-
|
|
3259
|
+
let typeEnd = tp.length;
|
|
3260
|
+
while (typeEnd > 0 && /[\*_]/.test(tp.charAt(typeEnd - 1)))
|
|
3261
|
+
--typeEnd;
|
|
3262
|
+
return "_" + tp.slice(0, typeEnd);
|
|
3263
|
+
}
|
|
3225
3264
|
}
|
|
3226
3265
|
}
|
|
3227
3266
|
function generateVMWrapper(fi, argTypes) {
|
|
@@ -3303,7 +3342,7 @@ var pxt;
|
|
|
3303
3342
|
enumVal = 0;
|
|
3304
3343
|
enumsDTS.setNs("");
|
|
3305
3344
|
shimsDTS.setNs("");
|
|
3306
|
-
|
|
3345
|
+
lines.forEach(ln => {
|
|
3307
3346
|
++lineNo;
|
|
3308
3347
|
// remove comments (NC = no comments)
|
|
3309
3348
|
let lnNC = stripComments(ln);
|
|
@@ -3784,4 +3823,15 @@ int main() {
|
|
|
3784
3823
|
})(pxt || (pxt = {}));
|
|
3785
3824
|
/// <reference path="../pxtlib/shared/docsrender.ts"/>
|
|
3786
3825
|
/// <reference path="../pxtlib/shared/extensioninfo.ts"/>
|
|
3826
|
+
var pxt;
|
|
3827
|
+
(function (pxt) {
|
|
3828
|
+
/**
|
|
3829
|
+
* The git revision information is injected into this function at build time.
|
|
3830
|
+
* See backendutils in gulpfile.js
|
|
3831
|
+
*/
|
|
3832
|
+
function backendutilsVersion() {
|
|
3833
|
+
return JSON.parse("{\"hash\":\"3eb9726c022d4edebbee9c874347f2b4f69ff679\",\"hasLocalChanges\":true}");
|
|
3834
|
+
}
|
|
3835
|
+
pxt.backendutilsVersion = backendutilsVersion;
|
|
3836
|
+
})(pxt || (pxt = {}));
|
|
3787
3837
|
global.pxt = pxt;
|
package/built/cli.js
CHANGED
|
@@ -618,10 +618,14 @@ async function bumpAsync(parsed) {
|
|
|
618
618
|
}
|
|
619
619
|
catch (e) {
|
|
620
620
|
console.warn(chalk.yellow("Unable to determine branch protection status."), e.message);
|
|
621
|
+
pr = true;
|
|
621
622
|
}
|
|
622
623
|
if (nopr) {
|
|
623
624
|
pr = false;
|
|
624
625
|
}
|
|
626
|
+
if (pr && (!currBranchName || !token || !user || !owner || !repo)) {
|
|
627
|
+
U.userError("Unable to prepare a bump pull request. Check GitHub credentials and the origin URL, or explicitly use --nopr for a direct push.");
|
|
628
|
+
}
|
|
625
629
|
if (fs.existsSync(pxt.CONFIG_NAME)) {
|
|
626
630
|
if (upload) {
|
|
627
631
|
U.userError("upload only supported on targets");
|
|
@@ -634,7 +638,7 @@ async function bumpAsync(parsed) {
|
|
|
634
638
|
.then(() => nodeutil.runGitAsync("pull"))
|
|
635
639
|
.then(() => nodeutil.createBranchAsync(newBranchName))
|
|
636
640
|
.then(() => justBumpPkgAsync(bumpType, false)) // don't tag when creating a PR
|
|
637
|
-
.then((version) => nodeutil.gitPushAsync().then(() => version))
|
|
641
|
+
.then((version) => nodeutil.gitPushAsync(false).then(() => version))
|
|
638
642
|
.then((version) => nodeutil.createPullRequestAsync({
|
|
639
643
|
title: `[pxt-cli] bump version to ${version}`,
|
|
640
644
|
body: "__Do not edit the PR title.__\n" +
|
|
@@ -654,8 +658,7 @@ async function bumpAsync(parsed) {
|
|
|
654
658
|
return Promise.resolve()
|
|
655
659
|
.then(() => nodeutil.runGitAsync("pull"))
|
|
656
660
|
.then(() => justBumpPkgAsync(bumpType))
|
|
657
|
-
.then(() => nodeutil.runGitAsync("push", "--follow-tags"))
|
|
658
|
-
.then(() => nodeutil.runGitAsync("push"));
|
|
661
|
+
.then(() => nodeutil.runGitAsync("push", "--atomic", "--follow-tags"));
|
|
659
662
|
}
|
|
660
663
|
}
|
|
661
664
|
else if (fs.existsSync("pxtarget.json"))
|
|
@@ -668,7 +671,7 @@ async function bumpAsync(parsed) {
|
|
|
668
671
|
.then(() => nodeutil.createBranchAsync(newBranchName))
|
|
669
672
|
.then(() => bumpPxt ? bumpPxtCoreDepAsync() : Promise.resolve())
|
|
670
673
|
.then(() => nodeutil.npmVersionBumpAsync(bumpType, false)) // don't tag when creating a PR
|
|
671
|
-
.then((version) => nodeutil.gitPushAsync().then(() => version))
|
|
674
|
+
.then((version) => nodeutil.gitPushAsync(false).then(() => version))
|
|
672
675
|
.then((version) => nodeutil.createPullRequestAsync({
|
|
673
676
|
title: `[pxt-cli] bump version to ${version}`,
|
|
674
677
|
body: "__Do not edit the PR title.__\n" +
|
|
@@ -687,10 +690,9 @@ async function bumpAsync(parsed) {
|
|
|
687
690
|
console.log("Bumping via direct push.");
|
|
688
691
|
return Promise.resolve()
|
|
689
692
|
.then(() => nodeutil.runGitAsync("pull"))
|
|
690
|
-
.then(() => bumpPxt ? bumpPxtCoreDepAsync().then(() => nodeutil.runGitAsync("push")) : Promise.resolve())
|
|
693
|
+
.then(() => bumpPxt ? bumpPxtCoreDepAsync().then(() => nodeutil.runGitAsync("push", "--atomic", "--no-follow-tags")) : Promise.resolve())
|
|
691
694
|
.then(() => nodeutil.runNpmAsync("version", bumpType))
|
|
692
|
-
.then(() => nodeutil.runGitAsync("push", "--follow-tags"))
|
|
693
|
-
.then(() => nodeutil.runGitAsync("push"))
|
|
695
|
+
.then(() => nodeutil.runGitAsync("push", "--atomic", "--follow-tags"))
|
|
694
696
|
.then(() => upload ? uploadTaggedTargetAsync() : Promise.resolve());
|
|
695
697
|
}
|
|
696
698
|
else {
|
|
@@ -4701,7 +4703,7 @@ async function staticpkgAsync(parsed) {
|
|
|
4701
4703
|
pxt.log(`packaging editor to ${builtPackaged}`);
|
|
4702
4704
|
await rimrafAsync(builtPackaged, {});
|
|
4703
4705
|
if (bump) {
|
|
4704
|
-
await bumpAsync();
|
|
4706
|
+
await bumpAsync(parsed);
|
|
4705
4707
|
}
|
|
4706
4708
|
if (locs) {
|
|
4707
4709
|
await internalGenDocsAsync(false, true);
|
|
@@ -6552,7 +6554,7 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
|
|
|
6552
6554
|
update: { description: "(package only) Updates pxt-core reference to the latest release" },
|
|
6553
6555
|
upload: { description: "(package only) Upload after bumping" },
|
|
6554
6556
|
pr: { description: "Bump via pull request rather than direct push" },
|
|
6555
|
-
nopr: { description: "
|
|
6557
|
+
nopr: { description: "Force a direct bump (overrides --pr and protection detection)" },
|
|
6556
6558
|
version: {
|
|
6557
6559
|
description: "Which part of the version to bump, or a complete version number to assign. Defaults to 'patch'",
|
|
6558
6560
|
argument: "version",
|
|
@@ -6670,6 +6672,9 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
|
|
|
6670
6672
|
bump: {
|
|
6671
6673
|
description: "bump version number prior to package"
|
|
6672
6674
|
},
|
|
6675
|
+
nopr: {
|
|
6676
|
+
description: "With --bump, force a direct bump rather than a pull request"
|
|
6677
|
+
},
|
|
6673
6678
|
cloudbuild: {
|
|
6674
6679
|
description: "(deprecated) forces build to happen in the cloud",
|
|
6675
6680
|
aliases: ["cloud", "cloud-build", "cb"]
|
package/built/nodeutil.js
CHANGED
|
@@ -219,7 +219,7 @@ async function getGitHubOwnerAndRepoAsync() {
|
|
|
219
219
|
if (!remoteUrl) {
|
|
220
220
|
Util.userError("No remote origin URL found");
|
|
221
221
|
}
|
|
222
|
-
const match = remoteUrl.match(/github\.com[:\/](.+?)\/(.+?)(\.git)?$/);
|
|
222
|
+
const match = remoteUrl.replace(/\/+$/, "").match(/github\.com[:\/](.+?)\/(.+?)(\.git)?$/);
|
|
223
223
|
if (!match) {
|
|
224
224
|
Util.userError("Invalid remote origin URL: " + remoteUrl);
|
|
225
225
|
}
|
|
@@ -236,7 +236,7 @@ async function createBranchAsync(branchName) {
|
|
|
236
236
|
});
|
|
237
237
|
await spawnAsync({
|
|
238
238
|
cmd: "git",
|
|
239
|
-
args: ["push", "--set-upstream", "origin", branchName],
|
|
239
|
+
args: ["push", "--no-follow-tags", "--set-upstream", "origin", branchName],
|
|
240
240
|
silent: true,
|
|
241
241
|
});
|
|
242
242
|
}
|
|
@@ -299,13 +299,9 @@ function quoteIfNeeded(arg) {
|
|
|
299
299
|
return arg;
|
|
300
300
|
}
|
|
301
301
|
function gitPushAsync(followTags = true) {
|
|
302
|
-
const args = ["push"];
|
|
303
|
-
if (followTags)
|
|
304
|
-
args.push("--follow-tags");
|
|
305
|
-
args.push("origin", "HEAD");
|
|
306
302
|
return spawnAsync({
|
|
307
303
|
cmd: "git",
|
|
308
|
-
args,
|
|
304
|
+
args: ["push", "--atomic", followTags ? "--follow-tags" : "--no-follow-tags", "origin", "HEAD"],
|
|
309
305
|
cwd: ".",
|
|
310
306
|
silent: true,
|
|
311
307
|
});
|
package/built/pxt.js
CHANGED
|
@@ -99231,6 +99231,8 @@ const lf = ts.pxtc.Util.lf;
|
|
|
99231
99231
|
let parts = k.split(".");
|
|
99232
99232
|
for (let i = 0; i < parts.length; ++i) {
|
|
99233
99233
|
let part = parts[i];
|
|
99234
|
+
if (part === "__proto__" || part === "constructor" || part === "prototype")
|
|
99235
|
+
Util.userError("Invalid configuration key: " + k);
|
|
99234
99236
|
if (i == parts.length - 1)
|
|
99235
99237
|
ptr[part] = v[k];
|
|
99236
99238
|
else {
|
|
@@ -105525,10 +105527,11 @@ var pxt;
|
|
|
105525
105527
|
if (!inEnum)
|
|
105526
105528
|
return;
|
|
105527
105529
|
// parse the enum case, with lots of optional stuff (?)
|
|
105528
|
-
|
|
105530
|
+
const enumLine = lnNC.trim().replace(/,$/, "").trim();
|
|
105531
|
+
let mm = /^(\w+)(?:\s*=(.*))?$/.exec(enumLine);
|
|
105529
105532
|
if (mm) {
|
|
105530
105533
|
let nm = mm[1];
|
|
105531
|
-
let v = mm[
|
|
105534
|
+
let v = mm[2] && mm[2].trim();
|
|
105532
105535
|
let opt = "";
|
|
105533
105536
|
if (v) {
|
|
105534
105537
|
// user-supplied value
|
|
@@ -105566,23 +105569,26 @@ var pxt;
|
|
|
105566
105569
|
}
|
|
105567
105570
|
function parseArg(parsedAttrs, s) {
|
|
105568
105571
|
s = s.trim();
|
|
105569
|
-
|
|
105572
|
+
const equals = s.lastIndexOf("=");
|
|
105573
|
+
const m = equals < 0 ? null : /^\s*(-?\w+)$/.exec(s.slice(equals + 1));
|
|
105570
105574
|
let defl = "";
|
|
105571
105575
|
let qm = "";
|
|
105572
105576
|
if (m) {
|
|
105573
|
-
defl = m[
|
|
105577
|
+
defl = m[1];
|
|
105574
105578
|
qm = "?";
|
|
105575
|
-
s =
|
|
105579
|
+
s = s.slice(0, equals).trim();
|
|
105576
105580
|
}
|
|
105577
|
-
|
|
105578
|
-
|
|
105581
|
+
let nameStart = s.length;
|
|
105582
|
+
while (nameStart > 0 && /\w/.test(s.charAt(nameStart - 1)))
|
|
105583
|
+
--nameStart;
|
|
105584
|
+
if (nameStart == s.length || /[\r\n\u2028\u2029]/.test(s.slice(0, nameStart))) {
|
|
105579
105585
|
err("invalid argument: " + s);
|
|
105580
105586
|
return {
|
|
105581
105587
|
name: "???",
|
|
105582
105588
|
type: "int"
|
|
105583
105589
|
};
|
|
105584
105590
|
}
|
|
105585
|
-
let argName =
|
|
105591
|
+
let argName = s.slice(nameStart);
|
|
105586
105592
|
if (parsedAttrs.paramDefl[argName]) {
|
|
105587
105593
|
defl = parsedAttrs.paramDefl[argName];
|
|
105588
105594
|
qm = "?";
|
|
@@ -105597,7 +105603,7 @@ var pxt;
|
|
|
105597
105603
|
}
|
|
105598
105604
|
return {
|
|
105599
105605
|
name: argName + qm,
|
|
105600
|
-
type:
|
|
105606
|
+
type: s.slice(0, nameStart)
|
|
105601
105607
|
};
|
|
105602
105608
|
}
|
|
105603
105609
|
function parseCpp(src, isHeader) {
|
|
@@ -105607,9 +105613,28 @@ var pxt;
|
|
|
105607
105613
|
inDocComment = false;
|
|
105608
105614
|
let indexedInstanceAttrs;
|
|
105609
105615
|
let indexedInstanceIdx = -1;
|
|
105610
|
-
//
|
|
105611
|
-
|
|
105612
|
-
|
|
105616
|
+
// Match directives one line at a time so unterminated blocks cannot rescan the source.
|
|
105617
|
+
const lines = src.split(/\r?\n/);
|
|
105618
|
+
let ifStart = -1;
|
|
105619
|
+
let ifArg = "";
|
|
105620
|
+
lines.forEach((ln, i) => {
|
|
105621
|
+
const directive = /^#\s*(?:if\s+(\w+)|(elif|else|endif))$/.exec(ln.trim());
|
|
105622
|
+
if (!directive)
|
|
105623
|
+
return;
|
|
105624
|
+
if (ifStart < 0) {
|
|
105625
|
+
if (directive[1]) {
|
|
105626
|
+
ifStart = i;
|
|
105627
|
+
ifArg = directive[1];
|
|
105628
|
+
}
|
|
105629
|
+
}
|
|
105630
|
+
else if (directive[2]) {
|
|
105631
|
+
if (hash_if_options.indexOf(ifArg) >= 0 && !cpp_options[ifArg]) {
|
|
105632
|
+
for (let j = ifStart + 1; j < i; ++j)
|
|
105633
|
+
lines[j] = "";
|
|
105634
|
+
}
|
|
105635
|
+
ifStart = -1;
|
|
105636
|
+
}
|
|
105637
|
+
});
|
|
105613
105638
|
// special handling of C++ namespace that ends with Methods (e.g. FooMethods)
|
|
105614
105639
|
// such a namespace will be converted into a TypeScript interface
|
|
105615
105640
|
// this enables simple objects with methods to be defined. See, for example:
|
|
@@ -105687,10 +105712,14 @@ var pxt;
|
|
|
105687
105712
|
return "T";
|
|
105688
105713
|
case "String":
|
|
105689
105714
|
return "S";
|
|
105690
|
-
default:
|
|
105715
|
+
default: {
|
|
105691
105716
|
if (U.lookup(knownEnums, tp))
|
|
105692
105717
|
return "I";
|
|
105693
|
-
|
|
105718
|
+
let typeEnd = tp.length;
|
|
105719
|
+
while (typeEnd > 0 && /[\*_]/.test(tp.charAt(typeEnd - 1)))
|
|
105720
|
+
--typeEnd;
|
|
105721
|
+
return "_" + tp.slice(0, typeEnd);
|
|
105722
|
+
}
|
|
105694
105723
|
}
|
|
105695
105724
|
}
|
|
105696
105725
|
function generateVMWrapper(fi, argTypes) {
|
|
@@ -105772,7 +105801,7 @@ var pxt;
|
|
|
105772
105801
|
enumVal = 0;
|
|
105773
105802
|
enumsDTS.setNs("");
|
|
105774
105803
|
shimsDTS.setNs("");
|
|
105775
|
-
|
|
105804
|
+
lines.forEach(ln => {
|
|
105776
105805
|
++lineNo;
|
|
105777
105806
|
// remove comments (NC = no comments)
|
|
105778
105807
|
let lnNC = stripComments(ln);
|
|
@@ -124958,12 +124987,20 @@ ${opts.repo.name.replace(/^pxt-/, '')}=github:${opts.repo.fullName}#${opts.repo.
|
|
|
124958
124987
|
strong: 1,
|
|
124959
124988
|
em: 1,
|
|
124960
124989
|
};
|
|
124990
|
+
/** Keeps metadata and token-only HTML out of the translation catalog. */
|
|
124991
|
+
function isNonTranslatable(text) {
|
|
124992
|
+
if (text.startsWith("IE=edge,") || text.startsWith("width=device-width"))
|
|
124993
|
+
return true;
|
|
124994
|
+
// Remove URLs, template placeholders, and spacing entities to look for prose.
|
|
124995
|
+
const prose = text.replace(/(?:https?:\/\/|\/)[\w@\/.]+|@[-\w]+@|\{[^{}]+\}| /g, "");
|
|
124996
|
+
return !/[a-zA-Z]/.test(prose);
|
|
124997
|
+
}
|
|
124961
124998
|
function translate(html, locale) {
|
|
124962
124999
|
const missing = {};
|
|
124963
125000
|
function translateOne(toTranslate) {
|
|
124964
125001
|
let spm = /^(\s*)([^]*?)(\s*)$/.exec(toTranslate);
|
|
124965
125002
|
let text = spm[2].replace(/\s+/g, " ");
|
|
124966
|
-
if (
|
|
125003
|
+
if (isNonTranslatable(text))
|
|
124967
125004
|
return null;
|
|
124968
125005
|
let v = U.lookup(locale, text);
|
|
124969
125006
|
if (v)
|
|
@@ -165904,10 +165941,14 @@ async function bumpAsync(parsed) {
|
|
|
165904
165941
|
}
|
|
165905
165942
|
catch (e) {
|
|
165906
165943
|
console.warn(chalk.yellow("Unable to determine branch protection status."), e.message);
|
|
165944
|
+
pr = true;
|
|
165907
165945
|
}
|
|
165908
165946
|
if (nopr) {
|
|
165909
165947
|
pr = false;
|
|
165910
165948
|
}
|
|
165949
|
+
if (pr && (!currBranchName || !token || !user || !owner || !repo)) {
|
|
165950
|
+
U.userError("Unable to prepare a bump pull request. Check GitHub credentials and the origin URL, or explicitly use --nopr for a direct push.");
|
|
165951
|
+
}
|
|
165911
165952
|
if (fs.existsSync(pxt.CONFIG_NAME)) {
|
|
165912
165953
|
if (upload) {
|
|
165913
165954
|
U.userError("upload only supported on targets");
|
|
@@ -165920,7 +165961,7 @@ async function bumpAsync(parsed) {
|
|
|
165920
165961
|
.then(() => nodeutil.runGitAsync("pull"))
|
|
165921
165962
|
.then(() => nodeutil.createBranchAsync(newBranchName))
|
|
165922
165963
|
.then(() => justBumpPkgAsync(bumpType, false)) // don't tag when creating a PR
|
|
165923
|
-
.then((version) => nodeutil.gitPushAsync().then(() => version))
|
|
165964
|
+
.then((version) => nodeutil.gitPushAsync(false).then(() => version))
|
|
165924
165965
|
.then((version) => nodeutil.createPullRequestAsync({
|
|
165925
165966
|
title: `[pxt-cli] bump version to ${version}`,
|
|
165926
165967
|
body: "__Do not edit the PR title.__\n" +
|
|
@@ -165940,8 +165981,7 @@ async function bumpAsync(parsed) {
|
|
|
165940
165981
|
return Promise.resolve()
|
|
165941
165982
|
.then(() => nodeutil.runGitAsync("pull"))
|
|
165942
165983
|
.then(() => justBumpPkgAsync(bumpType))
|
|
165943
|
-
.then(() => nodeutil.runGitAsync("push", "--follow-tags"))
|
|
165944
|
-
.then(() => nodeutil.runGitAsync("push"));
|
|
165984
|
+
.then(() => nodeutil.runGitAsync("push", "--atomic", "--follow-tags"));
|
|
165945
165985
|
}
|
|
165946
165986
|
}
|
|
165947
165987
|
else if (fs.existsSync("pxtarget.json"))
|
|
@@ -165954,7 +165994,7 @@ async function bumpAsync(parsed) {
|
|
|
165954
165994
|
.then(() => nodeutil.createBranchAsync(newBranchName))
|
|
165955
165995
|
.then(() => bumpPxt ? bumpPxtCoreDepAsync() : Promise.resolve())
|
|
165956
165996
|
.then(() => nodeutil.npmVersionBumpAsync(bumpType, false)) // don't tag when creating a PR
|
|
165957
|
-
.then((version) => nodeutil.gitPushAsync().then(() => version))
|
|
165997
|
+
.then((version) => nodeutil.gitPushAsync(false).then(() => version))
|
|
165958
165998
|
.then((version) => nodeutil.createPullRequestAsync({
|
|
165959
165999
|
title: `[pxt-cli] bump version to ${version}`,
|
|
165960
166000
|
body: "__Do not edit the PR title.__\n" +
|
|
@@ -165973,10 +166013,9 @@ async function bumpAsync(parsed) {
|
|
|
165973
166013
|
console.log("Bumping via direct push.");
|
|
165974
166014
|
return Promise.resolve()
|
|
165975
166015
|
.then(() => nodeutil.runGitAsync("pull"))
|
|
165976
|
-
.then(() => bumpPxt ? bumpPxtCoreDepAsync().then(() => nodeutil.runGitAsync("push")) : Promise.resolve())
|
|
166016
|
+
.then(() => bumpPxt ? bumpPxtCoreDepAsync().then(() => nodeutil.runGitAsync("push", "--atomic", "--no-follow-tags")) : Promise.resolve())
|
|
165977
166017
|
.then(() => nodeutil.runNpmAsync("version", bumpType))
|
|
165978
|
-
.then(() => nodeutil.runGitAsync("push", "--follow-tags"))
|
|
165979
|
-
.then(() => nodeutil.runGitAsync("push"))
|
|
166018
|
+
.then(() => nodeutil.runGitAsync("push", "--atomic", "--follow-tags"))
|
|
165980
166019
|
.then(() => upload ? uploadTaggedTargetAsync() : Promise.resolve());
|
|
165981
166020
|
}
|
|
165982
166021
|
else {
|
|
@@ -169987,7 +170026,7 @@ async function staticpkgAsync(parsed) {
|
|
|
169987
170026
|
pxt.log(`packaging editor to ${builtPackaged}`);
|
|
169988
170027
|
await rimrafAsync(builtPackaged, {});
|
|
169989
170028
|
if (bump) {
|
|
169990
|
-
await bumpAsync();
|
|
170029
|
+
await bumpAsync(parsed);
|
|
169991
170030
|
}
|
|
169992
170031
|
if (locs) {
|
|
169993
170032
|
await internalGenDocsAsync(false, true);
|
|
@@ -171838,7 +171877,7 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
|
|
|
171838
171877
|
update: { description: "(package only) Updates pxt-core reference to the latest release" },
|
|
171839
171878
|
upload: { description: "(package only) Upload after bumping" },
|
|
171840
171879
|
pr: { description: "Bump via pull request rather than direct push" },
|
|
171841
|
-
nopr: { description: "
|
|
171880
|
+
nopr: { description: "Force a direct bump (overrides --pr and protection detection)" },
|
|
171842
171881
|
version: {
|
|
171843
171882
|
description: "Which part of the version to bump, or a complete version number to assign. Defaults to 'patch'",
|
|
171844
171883
|
argument: "version",
|
|
@@ -171956,6 +171995,9 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
|
|
|
171956
171995
|
bump: {
|
|
171957
171996
|
description: "bump version number prior to package"
|
|
171958
171997
|
},
|
|
171998
|
+
nopr: {
|
|
171999
|
+
description: "With --bump, force a direct bump rather than a pull request"
|
|
172000
|
+
},
|
|
171959
172001
|
cloudbuild: {
|
|
171960
172002
|
description: "(deprecated) forces build to happen in the cloud",
|
|
171961
172003
|
aliases: ["cloud", "cloud-build", "cb"]
|
|
@@ -18,7 +18,7 @@ export interface BackpackAssetCapture {
|
|
|
18
18
|
/** Save a field in its matching standalone asset block, without copying its parent. */
|
|
19
19
|
export declare function captureBackpackAsset(field: Blockly.Field, info: pxtc.BlocksInfo): BackpackAssetCapture;
|
|
20
20
|
export declare function parseBackpackCode(code: string): BackpackCode;
|
|
21
|
-
/** Include
|
|
21
|
+
/** Include the selected block, its following stack, and referenced function definitions. */
|
|
22
22
|
export declare function captureBackpackBlock(block: Blockly.Block): {
|
|
23
23
|
code: string;
|
|
24
24
|
blockText: string;
|
|
@@ -5,7 +5,7 @@ export declare function visitBlockStates(states: BlockState[], visit: (state: Bl
|
|
|
5
5
|
/** Excludes hidden shadows from Blockly's block-type counts. */
|
|
6
6
|
export declare function blockCopyData(blockState: BlockState): Blockly.clipboard.BlockCopyData;
|
|
7
7
|
/** Copy a live block or a block in a headless asset editor. */
|
|
8
|
-
export declare function copyBlock(block: Blockly.Block): Blockly.clipboard.BlockCopyData;
|
|
8
|
+
export declare function copyBlock(block: Blockly.Block, addNextBlocks?: boolean): Blockly.clipboard.BlockCopyData;
|
|
9
9
|
export interface ClipboardPasteOptions {
|
|
10
10
|
originalPosition?: Blockly.utils.Coordinate;
|
|
11
11
|
screenPosition?: {
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as Blockly from "blockly";
|
|
7
7
|
export declare class DuplicateOnDragStrategy extends Blockly.dragging.BlockDragStrategy {
|
|
8
|
+
private startedAsShadow;
|
|
8
9
|
protected getTargetBlock(): Blockly.BlockSvg;
|
|
10
|
+
revertDrag(): void;
|
|
9
11
|
drag(newLoc: Blockly.utils.Coordinate, e?: PointerEvent | KeyboardEvent): void;
|
|
10
12
|
private disconnectBlock;
|
|
11
13
|
}
|