pxt-core 12.3.21 → 12.3.22
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 +73 -42
- package/built/pxtcompiler.d.ts +6 -0
- package/built/pxtcompiler.js +55 -15
- package/built/pxtlib.d.ts +0 -3
- package/built/pxtlib.js +18 -27
- package/built/target.js +1 -1
- package/built/targetlight.js +1 -1
- package/built/tests/blocksrunner.js +11 -2
- package/built/tests/blockssetup.js +11 -2
- package/built/web/main.js +2 -2
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +2 -2
- package/built/web/pxtcompiler.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/runnerembed.js +2 -2
- package/built/web/semantic.css +1 -1
- package/localtypings/pxtarget.d.ts +3 -0
- package/package.json +1 -1
- package/theme/errorList.less +38 -0
package/built/pxt.js
CHANGED
|
@@ -101958,7 +101958,6 @@ var pxt;
|
|
|
101958
101958
|
pxt.TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
|
|
101959
101959
|
pxt.TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
|
|
101960
101960
|
pxt.PACKAGED_EXTENSIONS = "_packaged-extensions.json";
|
|
101961
|
-
pxt.PACKAGED_EXT_INFO = "_packaged-ext-info.json";
|
|
101962
101961
|
pxt.BREAKPOINT_TABLET = 991; // TODO (shakao) revisit when tutorial stuff is more settled
|
|
101963
101962
|
pxt.PALETTES_FILE = "_palettes.json";
|
|
101964
101963
|
pxt.HISTORY_FILE = "_history";
|
|
@@ -105817,12 +105816,6 @@ int main() {
|
|
|
105817
105816
|
return JSON.stringify(cachedMeta);
|
|
105818
105817
|
}
|
|
105819
105818
|
hexloader.stringifyHexInfoForCache = stringifyHexInfoForCache;
|
|
105820
|
-
function storeHexInfoCacheEntryAsync(host, sha, cachedHexInfo) {
|
|
105821
|
-
if (!sha || !cachedHexInfo)
|
|
105822
|
-
return Promise.resolve();
|
|
105823
|
-
return storeWithLimitAsync(host, "hex-keys", "hex-" + sha, cachedHexInfo);
|
|
105824
|
-
}
|
|
105825
|
-
hexloader.storeHexInfoCacheEntryAsync = storeHexInfoCacheEntryAsync;
|
|
105826
105819
|
function getHexInfoAsync(host, extInfo, cloudModule) {
|
|
105827
105820
|
if (!extInfo.sha)
|
|
105828
105821
|
return Promise.resolve(null);
|
|
@@ -115092,9 +115085,6 @@ var pxt;
|
|
|
115092
115085
|
!opts.target.isNative;
|
|
115093
115086
|
if (!noFileEmbed) {
|
|
115094
115087
|
const files = await this.filesToBePublishedAsync(true, !pxt.appTarget.compile.useUF2);
|
|
115095
|
-
const packagedExtInfo = this.packagedExtensionHexInfo(opts);
|
|
115096
|
-
if (Object.keys(packagedExtInfo).length)
|
|
115097
|
-
files[pxt.PACKAGED_EXT_INFO] = JSON.stringify(packagedExtInfo);
|
|
115098
115088
|
const headerString = JSON.stringify({
|
|
115099
115089
|
name: this.config.name,
|
|
115100
115090
|
comment: this.config.description,
|
|
@@ -115222,20 +115212,6 @@ var pxt;
|
|
|
115222
115212
|
packDeps(this);
|
|
115223
115213
|
return packaged;
|
|
115224
115214
|
}
|
|
115225
|
-
packagedExtensionHexInfo(opts) {
|
|
115226
|
-
var _a;
|
|
115227
|
-
const packaged = {};
|
|
115228
|
-
const targets = [opts, ...(opts.otherMultiVariants || [])];
|
|
115229
|
-
for (const target of targets) {
|
|
115230
|
-
const extInfo = target.extinfo;
|
|
115231
|
-
if (!(extInfo === null || extInfo === void 0 ? void 0 : extInfo.sha) || !((_a = extInfo.hexinfo) === null || _a === void 0 ? void 0 : _a.hex))
|
|
115232
|
-
continue;
|
|
115233
|
-
const serialized = pxt.hexloader.stringifyHexInfoForCache(extInfo.hexinfo);
|
|
115234
|
-
if (serialized)
|
|
115235
|
-
packaged[extInfo.sha] = serialized;
|
|
115236
|
-
}
|
|
115237
|
-
return packaged;
|
|
115238
|
-
}
|
|
115239
115215
|
saveToJsonAsync() {
|
|
115240
115216
|
return this.filesToBePublishedAsync(true)
|
|
115241
115217
|
.then(files => {
|
|
@@ -116179,18 +116155,21 @@ var ts;
|
|
|
116179
116155
|
const langLower = lang.toLowerCase();
|
|
116180
116156
|
const attrJsLocsKey = langLower + "|jsdoc";
|
|
116181
116157
|
const attrBlockLocsKey = langLower + "|block";
|
|
116158
|
+
const attrAriaLabelLocsKey = langLower + "|ariaLabel";
|
|
116182
116159
|
const loc = await mainPkg.localizationStringsAsync(lang);
|
|
116183
116160
|
if (pxtc.apiLocalizationStrings)
|
|
116184
116161
|
pxtc.Util.jsonMergeFrom(loc, pxtc.apiLocalizationStrings);
|
|
116185
116162
|
const toLocalize = pxtc.Util.values(apis.byQName).filter(fn => fn.attributes._translatedLanguageCode !== lang);
|
|
116186
116163
|
await pxtc.Util.promiseMapAll(toLocalize, async (fn) => {
|
|
116187
|
-
var _a, _b, _c;
|
|
116164
|
+
var _a, _b, _c, _d;
|
|
116188
116165
|
const altLocSrc = fn.attributes.useLoc || fn.attributes.blockAliasFor;
|
|
116189
116166
|
const altLocSrcFn = altLocSrc && apis.byQName[altLocSrc];
|
|
116190
116167
|
if (fn.attributes._untranslatedJsDoc)
|
|
116191
116168
|
fn.attributes.jsDoc = fn.attributes._untranslatedJsDoc;
|
|
116192
116169
|
if (fn.attributes._untranslatedBlock)
|
|
116193
|
-
fn.attributes.
|
|
116170
|
+
fn.attributes.block = fn.attributes._untranslatedBlock;
|
|
116171
|
+
if (fn.attributes._untranslatedAriaLabel)
|
|
116172
|
+
fn.attributes.ariaLabel = fn.attributes._untranslatedAriaLabel;
|
|
116194
116173
|
if (fn.attributes._untranslatedParamDefl) {
|
|
116195
116174
|
fn.attributes.paramDefl = pxtc.U.clone(fn.attributes._untranslatedParamDefl);
|
|
116196
116175
|
syncParameterDefaults(fn);
|
|
@@ -116216,6 +116195,7 @@ var ts;
|
|
|
116216
116195
|
});
|
|
116217
116196
|
const nsDoc = loc['{id:category}' + pxtc.Util.capitalize(fn.qName)];
|
|
116218
116197
|
let locBlock = loc[`${fn.qName}|block`] || ((_b = fn.attributes.locs) === null || _b === void 0 ? void 0 : _b[attrBlockLocsKey]);
|
|
116198
|
+
const locAriaLabel = loc[`${fn.qName}|ariaLabel`] || ((_c = fn.attributes.locs) === null || _c === void 0 ? void 0 : _c[attrAriaLabelLocsKey]);
|
|
116219
116199
|
if (fn.attributes.block) {
|
|
116220
116200
|
const comp = pxt.blocks.compileInfo(fn);
|
|
116221
116201
|
if (comp.handlerArgs) {
|
|
@@ -116258,7 +116238,7 @@ var ts;
|
|
|
116258
116238
|
}
|
|
116259
116239
|
}
|
|
116260
116240
|
if (!locBlock && altLocSrcFn) {
|
|
116261
|
-
const otherTranslation = loc[`${altLocSrcFn.qName}|block`] || ((
|
|
116241
|
+
const otherTranslation = loc[`${altLocSrcFn.qName}|block`] || ((_d = altLocSrcFn.attributes.locs) === null || _d === void 0 ? void 0 : _d[attrBlockLocsKey]);
|
|
116262
116242
|
const isSameBlockDef = fn.attributes.block === (altLocSrcFn.attributes._untranslatedBlock || altLocSrcFn.attributes.block);
|
|
116263
116243
|
if (isSameBlockDef && !!otherTranslation) {
|
|
116264
116244
|
locBlock = otherTranslation;
|
|
@@ -116315,6 +116295,12 @@ var ts;
|
|
|
116315
116295
|
else {
|
|
116316
116296
|
updateBlockDef(fn.attributes);
|
|
116317
116297
|
}
|
|
116298
|
+
if (locAriaLabel) {
|
|
116299
|
+
if (!fn.attributes._untranslatedAriaLabel) {
|
|
116300
|
+
fn.attributes._untranslatedAriaLabel = fn.attributes.ariaLabel;
|
|
116301
|
+
}
|
|
116302
|
+
fn.attributes.ariaLabel = locAriaLabel;
|
|
116303
|
+
}
|
|
116318
116304
|
fn.attributes._translatedLanguageCode = lang;
|
|
116319
116305
|
});
|
|
116320
116306
|
return cleanLocalizations(apis);
|
|
@@ -116450,6 +116436,11 @@ var ts;
|
|
|
116450
116436
|
res.locs = {};
|
|
116451
116437
|
res.locs[n.slice("jsdoc.loc.".length).toLowerCase() + "|jsdoc"] = v;
|
|
116452
116438
|
}
|
|
116439
|
+
else if (pxtc.U.startsWith(n, "ariaLabel.loc.")) {
|
|
116440
|
+
if (!res.locs)
|
|
116441
|
+
res.locs = {};
|
|
116442
|
+
res.locs[n.slice("ariaLabel.loc.".length).toLowerCase() + "|ariaLabel"] = v;
|
|
116443
|
+
}
|
|
116453
116444
|
else if (pxtc.U.contains(n, ".loc.")) {
|
|
116454
116445
|
if (!res.locs)
|
|
116455
116446
|
res.locs = {};
|
|
@@ -134096,7 +134087,7 @@ var ts;
|
|
|
134096
134087
|
function inspect(n) {
|
|
134097
134088
|
pxt.log(stringKind(n));
|
|
134098
134089
|
}
|
|
134099
|
-
// next free error
|
|
134090
|
+
// next free error 9285
|
|
134100
134091
|
function userError(code, msg, secondary = false) {
|
|
134101
134092
|
let e = new Error(msg);
|
|
134102
134093
|
e.ksEmitterUserError = true;
|
|
@@ -137801,9 +137792,35 @@ ${lbl}: .short 0xffff
|
|
|
137801
137792
|
let v = emitExpr(node);
|
|
137802
137793
|
return v;
|
|
137803
137794
|
}
|
|
137795
|
+
function maybeWarnOnBareFunctionReference(node) {
|
|
137796
|
+
if (!opts.enhancedErrors)
|
|
137797
|
+
return;
|
|
137798
|
+
if (!node || node.kind !== pxtc.SK.Identifier)
|
|
137799
|
+
return;
|
|
137800
|
+
if (hasPrecedingTsIgnoreComment(node))
|
|
137801
|
+
return;
|
|
137802
|
+
const exprType = typeOf(node);
|
|
137803
|
+
const signatures = exprType && !(exprType.flags & ts.TypeFlags.Any)
|
|
137804
|
+
&& checker.getSignaturesOfType(exprType, ts.SignatureKind.Call);
|
|
137805
|
+
if (signatures && signatures.length)
|
|
137806
|
+
warning(node, 9284, lf("Function reference used as a statement; did you mean to call it with '()'?"));
|
|
137807
|
+
}
|
|
137808
|
+
function hasPrecedingTsIgnoreComment(node) {
|
|
137809
|
+
const src = node.getSourceFile();
|
|
137810
|
+
const line = ts.getLineAndCharacterOfPosition(src, node.getStart(src)).line;
|
|
137811
|
+
if (line <= 0)
|
|
137812
|
+
return false;
|
|
137813
|
+
const lineStarts = src.getLineStarts();
|
|
137814
|
+
const previousLineStart = lineStarts[line - 1];
|
|
137815
|
+
const previousLineEnd = lineStarts[line];
|
|
137816
|
+
const previousLine = src.text.slice(previousLineStart, previousLineEnd);
|
|
137817
|
+
return /^\s*\/\/\s*@ts-ignore\b/.test(previousLine);
|
|
137818
|
+
}
|
|
137804
137819
|
function emitExprAsStmt(node) {
|
|
137805
|
-
if (isNoopExpr(node))
|
|
137820
|
+
if (isNoopExpr(node)) {
|
|
137821
|
+
maybeWarnOnBareFunctionReference(node);
|
|
137806
137822
|
return;
|
|
137823
|
+
}
|
|
137807
137824
|
emitBrk(node);
|
|
137808
137825
|
let v = emitIgnored(node);
|
|
137809
137826
|
proc.emitExpr(v);
|
|
@@ -138785,6 +138802,14 @@ var ts;
|
|
|
138785
138802
|
});
|
|
138786
138803
|
}
|
|
138787
138804
|
pxtc.patchUpDiagnostics = patchUpDiagnostics;
|
|
138805
|
+
function hasErrorDiagnostics(diags) {
|
|
138806
|
+
return diags.some(d => d.category == pxtc.DiagnosticCategory.Error);
|
|
138807
|
+
}
|
|
138808
|
+
pxtc.hasErrorDiagnostics = hasErrorDiagnostics;
|
|
138809
|
+
function hasBlockingDiagnostics(opts, diags) {
|
|
138810
|
+
return opts.enhancedErrors ? hasErrorDiagnostics(diags) : diags.length > 0;
|
|
138811
|
+
}
|
|
138812
|
+
pxtc.hasBlockingDiagnostics = hasBlockingDiagnostics;
|
|
138788
138813
|
function py2tsIfNecessary(opts) {
|
|
138789
138814
|
if (opts.target.preferredEditor == pxt.PYTHON_PROJECT_NAME) {
|
|
138790
138815
|
let res = pxtc.transpile.pyToTs(opts);
|
|
@@ -138911,26 +138936,26 @@ var ts;
|
|
|
138911
138936
|
}
|
|
138912
138937
|
else {
|
|
138913
138938
|
runConversionsAndStoreResults(opts, res);
|
|
138914
|
-
if (res.diagnostics
|
|
138939
|
+
if (hasBlockingDiagnostics(opts, res.diagnostics))
|
|
138915
138940
|
return res;
|
|
138916
138941
|
program = buildProgram(opts, res);
|
|
138917
138942
|
}
|
|
138918
138943
|
const entryPoint = opts.sourceFiles.filter(f => pxtc.U.endsWith(f, ".ts")).pop().replace(/.*\//, "");
|
|
138919
138944
|
// First get and report any syntactic errors.
|
|
138920
|
-
res.diagnostics = patchUpDiagnostics(program.getSyntacticDiagnostics(), opts.ignoreFileResolutionErrors);
|
|
138921
|
-
if (res.diagnostics
|
|
138945
|
+
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(program.getSyntacticDiagnostics(), opts.ignoreFileResolutionErrors));
|
|
138946
|
+
if (hasBlockingDiagnostics(opts, res.diagnostics)) {
|
|
138922
138947
|
if (opts.forceEmit) {
|
|
138923
138948
|
pxt.debug('syntactic errors, forcing emit');
|
|
138924
138949
|
pxtc.compileBinary(program, opts, res, entryPoint);
|
|
138925
138950
|
}
|
|
138926
138951
|
return res;
|
|
138927
138952
|
}
|
|
138928
|
-
// If we didn't have any syntactic errors, then also try getting the global and
|
|
138953
|
+
// If we didn't have any blocking syntactic errors, then also try getting the global and
|
|
138929
138954
|
// semantic errors.
|
|
138930
|
-
res.diagnostics = patchUpDiagnostics(program.getOptionsDiagnostics().concat(pxtc.Util.toArray(program.getGlobalDiagnostics())), opts.ignoreFileResolutionErrors);
|
|
138955
|
+
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(program.getOptionsDiagnostics().concat(pxtc.Util.toArray(program.getGlobalDiagnostics())), opts.ignoreFileResolutionErrors));
|
|
138931
138956
|
const semStart = pxtc.U.cpuUs();
|
|
138932
|
-
if (res.diagnostics
|
|
138933
|
-
res.diagnostics = patchUpDiagnostics(program.getSemanticDiagnostics(), opts.ignoreFileResolutionErrors);
|
|
138957
|
+
if (!hasBlockingDiagnostics(opts, res.diagnostics)) {
|
|
138958
|
+
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(program.getSemanticDiagnostics(), opts.ignoreFileResolutionErrors));
|
|
138934
138959
|
}
|
|
138935
138960
|
const emitStart = pxtc.U.cpuUs();
|
|
138936
138961
|
res.times["typescript-syn"] = semStart - startTime;
|
|
@@ -138939,12 +138964,12 @@ var ts;
|
|
|
138939
138964
|
if (opts.ast) {
|
|
138940
138965
|
res.ast = program;
|
|
138941
138966
|
}
|
|
138942
|
-
if (opts.ast || opts.forceEmit || res.diagnostics
|
|
138967
|
+
if (opts.ast || opts.forceEmit || !hasBlockingDiagnostics(opts, res.diagnostics)) {
|
|
138943
138968
|
const binOutput = pxtc.compileBinary(program, opts, res, entryPoint);
|
|
138944
138969
|
res.times["compilebinary"] = pxtc.U.cpuUs() - emitStart;
|
|
138945
138970
|
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(binOutput.diagnostics));
|
|
138946
138971
|
}
|
|
138947
|
-
if (res.diagnostics
|
|
138972
|
+
if (!hasBlockingDiagnostics(opts, res.diagnostics))
|
|
138948
138973
|
res.success = true;
|
|
138949
138974
|
for (let f of opts.sourceFiles) {
|
|
138950
138975
|
if (pxtc.Util.startsWith(f, "built/"))
|
|
@@ -142737,6 +142762,9 @@ var ts;
|
|
|
142737
142762
|
}
|
|
142738
142763
|
}
|
|
142739
142764
|
}
|
|
142765
|
+
if (si.attributes.ariaLabel) {
|
|
142766
|
+
locStrings[`${si.qName}|ariaLabel`] = si.attributes.ariaLabel;
|
|
142767
|
+
}
|
|
142740
142768
|
};
|
|
142741
142769
|
const mapLocs = (m, name) => {
|
|
142742
142770
|
if (!options.locs)
|
|
@@ -142759,6 +142787,8 @@ var ts;
|
|
|
142759
142787
|
enumMembers.forEach(em => {
|
|
142760
142788
|
if (em.attributes.block)
|
|
142761
142789
|
locStrings[`${em.qName}|block`] = em.attributes.block;
|
|
142790
|
+
if (em.attributes.ariaLabel)
|
|
142791
|
+
locStrings[`${em.qName}|ariaLabel`] = em.attributes.ariaLabel;
|
|
142762
142792
|
if (em.attributes.jsDoc)
|
|
142763
142793
|
locStrings[em.qName] = em.attributes.jsDoc;
|
|
142764
142794
|
});
|
|
@@ -143669,7 +143699,8 @@ var ts;
|
|
|
143669
143699
|
for (let k of Object.keys(newFS))
|
|
143670
143700
|
service_1.host.setFile(k, newFS[k]); // update version numbers
|
|
143671
143701
|
res.fileSystem = pxtc.U.flatClone(newFS);
|
|
143672
|
-
if (res.diagnostics
|
|
143702
|
+
if (!pxtc.hasBlockingDiagnostics(service_1.host.opts, res.diagnostics)) {
|
|
143703
|
+
const conversionDiagnostics = res.diagnostics;
|
|
143673
143704
|
service_1.host.opts.skipPxtModulesEmit = false;
|
|
143674
143705
|
service_1.host.opts.skipPxtModulesTSC = false;
|
|
143675
143706
|
const currKey = service_1.host.opts.target.isNative ? "native" : "js";
|
|
@@ -143684,13 +143715,13 @@ var ts;
|
|
|
143684
143715
|
service_1.host.opts.skipPxtModulesEmit = true;
|
|
143685
143716
|
}
|
|
143686
143717
|
let ts2asm = pxtc.compile(service_1.host.opts, service_1.service);
|
|
143687
|
-
res = Object.assign({ sourceMap: res.sourceMap, fileSystem: res.fileSystem }, ts2asm);
|
|
143688
|
-
if (res.needsFullRecompile || ((!res.success || res.diagnostics
|
|
143718
|
+
res = Object.assign(Object.assign({ sourceMap: res.sourceMap, fileSystem: res.fileSystem }, ts2asm), { diagnostics: conversionDiagnostics.concat(ts2asm.diagnostics) });
|
|
143719
|
+
if (res.needsFullRecompile || ((!res.success || pxtc.hasBlockingDiagnostics(service_1.host.opts, res.diagnostics)) && service_1.host.opts.clearIncrBuildAndRetryOnError)) {
|
|
143689
143720
|
pxt.debug("triggering full recompile");
|
|
143690
143721
|
pxt.tickEvent("compile.fullrecompile");
|
|
143691
143722
|
service_1.host.opts.skipPxtModulesEmit = false;
|
|
143692
143723
|
ts2asm = pxtc.compile(service_1.host.opts, service_1.service);
|
|
143693
|
-
res = Object.assign({ sourceMap: res.sourceMap }, ts2asm);
|
|
143724
|
+
res = Object.assign(Object.assign({ sourceMap: res.sourceMap }, ts2asm), { diagnostics: conversionDiagnostics.concat(ts2asm.diagnostics) });
|
|
143694
143725
|
}
|
|
143695
143726
|
if (res.diagnostics.every(d => !pxtc.isPxtModulesFilename(d.fileName)))
|
|
143696
143727
|
service_1.host.pxtModulesOK = currKey;
|
package/built/pxtcompiler.d.ts
CHANGED
|
@@ -753,6 +753,12 @@ declare namespace ts.pxtc {
|
|
|
753
753
|
function getTsCompilerOptions(opts: CompileOptions): any;
|
|
754
754
|
function nodeLocationInfo(node: ts.Node): LocationInfo;
|
|
755
755
|
function patchUpDiagnostics(diags: ReadonlyArray<Diagnostic>, ignoreFileResolutionErorrs?: boolean): KsDiagnostic[];
|
|
756
|
+
function hasErrorDiagnostics(diags: ReadonlyArray<{
|
|
757
|
+
category: DiagnosticCategory;
|
|
758
|
+
}>): boolean;
|
|
759
|
+
function hasBlockingDiagnostics(opts: CompileOptions, diags: ReadonlyArray<{
|
|
760
|
+
category: DiagnosticCategory;
|
|
761
|
+
}>): boolean;
|
|
756
762
|
function py2tsIfNecessary(opts: CompileOptions): transpile.TranspileResult | undefined;
|
|
757
763
|
function storeGeneratedFiles(opts: CompileOptions, res: CompileResult): void;
|
|
758
764
|
function runConversionsAndStoreResults(opts: CompileOptions, res?: CompileResult): CompileResult;
|
package/built/pxtcompiler.js
CHANGED
|
@@ -9262,7 +9262,7 @@ var ts;
|
|
|
9262
9262
|
function inspect(n) {
|
|
9263
9263
|
pxt.log(stringKind(n));
|
|
9264
9264
|
}
|
|
9265
|
-
// next free error
|
|
9265
|
+
// next free error 9285
|
|
9266
9266
|
function userError(code, msg, secondary = false) {
|
|
9267
9267
|
let e = new Error(msg);
|
|
9268
9268
|
e.ksEmitterUserError = true;
|
|
@@ -12967,9 +12967,35 @@ ${lbl}: .short 0xffff
|
|
|
12967
12967
|
let v = emitExpr(node);
|
|
12968
12968
|
return v;
|
|
12969
12969
|
}
|
|
12970
|
+
function maybeWarnOnBareFunctionReference(node) {
|
|
12971
|
+
if (!opts.enhancedErrors)
|
|
12972
|
+
return;
|
|
12973
|
+
if (!node || node.kind !== pxtc.SK.Identifier)
|
|
12974
|
+
return;
|
|
12975
|
+
if (hasPrecedingTsIgnoreComment(node))
|
|
12976
|
+
return;
|
|
12977
|
+
const exprType = typeOf(node);
|
|
12978
|
+
const signatures = exprType && !(exprType.flags & ts.TypeFlags.Any)
|
|
12979
|
+
&& checker.getSignaturesOfType(exprType, ts.SignatureKind.Call);
|
|
12980
|
+
if (signatures && signatures.length)
|
|
12981
|
+
warning(node, 9284, lf("Function reference used as a statement; did you mean to call it with '()'?"));
|
|
12982
|
+
}
|
|
12983
|
+
function hasPrecedingTsIgnoreComment(node) {
|
|
12984
|
+
const src = node.getSourceFile();
|
|
12985
|
+
const line = ts.getLineAndCharacterOfPosition(src, node.getStart(src)).line;
|
|
12986
|
+
if (line <= 0)
|
|
12987
|
+
return false;
|
|
12988
|
+
const lineStarts = src.getLineStarts();
|
|
12989
|
+
const previousLineStart = lineStarts[line - 1];
|
|
12990
|
+
const previousLineEnd = lineStarts[line];
|
|
12991
|
+
const previousLine = src.text.slice(previousLineStart, previousLineEnd);
|
|
12992
|
+
return /^\s*\/\/\s*@ts-ignore\b/.test(previousLine);
|
|
12993
|
+
}
|
|
12970
12994
|
function emitExprAsStmt(node) {
|
|
12971
|
-
if (isNoopExpr(node))
|
|
12995
|
+
if (isNoopExpr(node)) {
|
|
12996
|
+
maybeWarnOnBareFunctionReference(node);
|
|
12972
12997
|
return;
|
|
12998
|
+
}
|
|
12973
12999
|
emitBrk(node);
|
|
12974
13000
|
let v = emitIgnored(node);
|
|
12975
13001
|
proc.emitExpr(v);
|
|
@@ -13951,6 +13977,14 @@ var ts;
|
|
|
13951
13977
|
});
|
|
13952
13978
|
}
|
|
13953
13979
|
pxtc.patchUpDiagnostics = patchUpDiagnostics;
|
|
13980
|
+
function hasErrorDiagnostics(diags) {
|
|
13981
|
+
return diags.some(d => d.category == pxtc.DiagnosticCategory.Error);
|
|
13982
|
+
}
|
|
13983
|
+
pxtc.hasErrorDiagnostics = hasErrorDiagnostics;
|
|
13984
|
+
function hasBlockingDiagnostics(opts, diags) {
|
|
13985
|
+
return opts.enhancedErrors ? hasErrorDiagnostics(diags) : diags.length > 0;
|
|
13986
|
+
}
|
|
13987
|
+
pxtc.hasBlockingDiagnostics = hasBlockingDiagnostics;
|
|
13954
13988
|
function py2tsIfNecessary(opts) {
|
|
13955
13989
|
if (opts.target.preferredEditor == pxt.PYTHON_PROJECT_NAME) {
|
|
13956
13990
|
let res = pxtc.transpile.pyToTs(opts);
|
|
@@ -14077,26 +14111,26 @@ var ts;
|
|
|
14077
14111
|
}
|
|
14078
14112
|
else {
|
|
14079
14113
|
runConversionsAndStoreResults(opts, res);
|
|
14080
|
-
if (res.diagnostics
|
|
14114
|
+
if (hasBlockingDiagnostics(opts, res.diagnostics))
|
|
14081
14115
|
return res;
|
|
14082
14116
|
program = buildProgram(opts, res);
|
|
14083
14117
|
}
|
|
14084
14118
|
const entryPoint = opts.sourceFiles.filter(f => pxtc.U.endsWith(f, ".ts")).pop().replace(/.*\//, "");
|
|
14085
14119
|
// First get and report any syntactic errors.
|
|
14086
|
-
res.diagnostics = patchUpDiagnostics(program.getSyntacticDiagnostics(), opts.ignoreFileResolutionErrors);
|
|
14087
|
-
if (res.diagnostics
|
|
14120
|
+
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(program.getSyntacticDiagnostics(), opts.ignoreFileResolutionErrors));
|
|
14121
|
+
if (hasBlockingDiagnostics(opts, res.diagnostics)) {
|
|
14088
14122
|
if (opts.forceEmit) {
|
|
14089
14123
|
pxt.debug('syntactic errors, forcing emit');
|
|
14090
14124
|
pxtc.compileBinary(program, opts, res, entryPoint);
|
|
14091
14125
|
}
|
|
14092
14126
|
return res;
|
|
14093
14127
|
}
|
|
14094
|
-
// If we didn't have any syntactic errors, then also try getting the global and
|
|
14128
|
+
// If we didn't have any blocking syntactic errors, then also try getting the global and
|
|
14095
14129
|
// semantic errors.
|
|
14096
|
-
res.diagnostics = patchUpDiagnostics(program.getOptionsDiagnostics().concat(pxtc.Util.toArray(program.getGlobalDiagnostics())), opts.ignoreFileResolutionErrors);
|
|
14130
|
+
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(program.getOptionsDiagnostics().concat(pxtc.Util.toArray(program.getGlobalDiagnostics())), opts.ignoreFileResolutionErrors));
|
|
14097
14131
|
const semStart = pxtc.U.cpuUs();
|
|
14098
|
-
if (res.diagnostics
|
|
14099
|
-
res.diagnostics = patchUpDiagnostics(program.getSemanticDiagnostics(), opts.ignoreFileResolutionErrors);
|
|
14132
|
+
if (!hasBlockingDiagnostics(opts, res.diagnostics)) {
|
|
14133
|
+
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(program.getSemanticDiagnostics(), opts.ignoreFileResolutionErrors));
|
|
14100
14134
|
}
|
|
14101
14135
|
const emitStart = pxtc.U.cpuUs();
|
|
14102
14136
|
res.times["typescript-syn"] = semStart - startTime;
|
|
@@ -14105,12 +14139,12 @@ var ts;
|
|
|
14105
14139
|
if (opts.ast) {
|
|
14106
14140
|
res.ast = program;
|
|
14107
14141
|
}
|
|
14108
|
-
if (opts.ast || opts.forceEmit || res.diagnostics
|
|
14142
|
+
if (opts.ast || opts.forceEmit || !hasBlockingDiagnostics(opts, res.diagnostics)) {
|
|
14109
14143
|
const binOutput = pxtc.compileBinary(program, opts, res, entryPoint);
|
|
14110
14144
|
res.times["compilebinary"] = pxtc.U.cpuUs() - emitStart;
|
|
14111
14145
|
res.diagnostics = res.diagnostics.concat(patchUpDiagnostics(binOutput.diagnostics));
|
|
14112
14146
|
}
|
|
14113
|
-
if (res.diagnostics
|
|
14147
|
+
if (!hasBlockingDiagnostics(opts, res.diagnostics))
|
|
14114
14148
|
res.success = true;
|
|
14115
14149
|
for (let f of opts.sourceFiles) {
|
|
14116
14150
|
if (pxtc.Util.startsWith(f, "built/"))
|
|
@@ -17903,6 +17937,9 @@ var ts;
|
|
|
17903
17937
|
}
|
|
17904
17938
|
}
|
|
17905
17939
|
}
|
|
17940
|
+
if (si.attributes.ariaLabel) {
|
|
17941
|
+
locStrings[`${si.qName}|ariaLabel`] = si.attributes.ariaLabel;
|
|
17942
|
+
}
|
|
17906
17943
|
};
|
|
17907
17944
|
const mapLocs = (m, name) => {
|
|
17908
17945
|
if (!options.locs)
|
|
@@ -17925,6 +17962,8 @@ var ts;
|
|
|
17925
17962
|
enumMembers.forEach(em => {
|
|
17926
17963
|
if (em.attributes.block)
|
|
17927
17964
|
locStrings[`${em.qName}|block`] = em.attributes.block;
|
|
17965
|
+
if (em.attributes.ariaLabel)
|
|
17966
|
+
locStrings[`${em.qName}|ariaLabel`] = em.attributes.ariaLabel;
|
|
17928
17967
|
if (em.attributes.jsDoc)
|
|
17929
17968
|
locStrings[em.qName] = em.attributes.jsDoc;
|
|
17930
17969
|
});
|
|
@@ -18835,7 +18874,8 @@ var ts;
|
|
|
18835
18874
|
for (let k of Object.keys(newFS))
|
|
18836
18875
|
service_1.host.setFile(k, newFS[k]); // update version numbers
|
|
18837
18876
|
res.fileSystem = pxtc.U.flatClone(newFS);
|
|
18838
|
-
if (res.diagnostics
|
|
18877
|
+
if (!pxtc.hasBlockingDiagnostics(service_1.host.opts, res.diagnostics)) {
|
|
18878
|
+
const conversionDiagnostics = res.diagnostics;
|
|
18839
18879
|
service_1.host.opts.skipPxtModulesEmit = false;
|
|
18840
18880
|
service_1.host.opts.skipPxtModulesTSC = false;
|
|
18841
18881
|
const currKey = service_1.host.opts.target.isNative ? "native" : "js";
|
|
@@ -18850,13 +18890,13 @@ var ts;
|
|
|
18850
18890
|
service_1.host.opts.skipPxtModulesEmit = true;
|
|
18851
18891
|
}
|
|
18852
18892
|
let ts2asm = pxtc.compile(service_1.host.opts, service_1.service);
|
|
18853
|
-
res = Object.assign({ sourceMap: res.sourceMap, fileSystem: res.fileSystem }, ts2asm);
|
|
18854
|
-
if (res.needsFullRecompile || ((!res.success || res.diagnostics
|
|
18893
|
+
res = Object.assign(Object.assign({ sourceMap: res.sourceMap, fileSystem: res.fileSystem }, ts2asm), { diagnostics: conversionDiagnostics.concat(ts2asm.diagnostics) });
|
|
18894
|
+
if (res.needsFullRecompile || ((!res.success || pxtc.hasBlockingDiagnostics(service_1.host.opts, res.diagnostics)) && service_1.host.opts.clearIncrBuildAndRetryOnError)) {
|
|
18855
18895
|
pxt.debug("triggering full recompile");
|
|
18856
18896
|
pxt.tickEvent("compile.fullrecompile");
|
|
18857
18897
|
service_1.host.opts.skipPxtModulesEmit = false;
|
|
18858
18898
|
ts2asm = pxtc.compile(service_1.host.opts, service_1.service);
|
|
18859
|
-
res = Object.assign({ sourceMap: res.sourceMap }, ts2asm);
|
|
18899
|
+
res = Object.assign(Object.assign({ sourceMap: res.sourceMap }, ts2asm), { diagnostics: conversionDiagnostics.concat(ts2asm.diagnostics) });
|
|
18860
18900
|
}
|
|
18861
18901
|
if (res.diagnostics.every(d => !pxtc.isPxtModulesFilename(d.fileName)))
|
|
18862
18902
|
service_1.host.pxtModulesOK = currKey;
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -734,7 +734,6 @@ declare namespace pxt {
|
|
|
734
734
|
const TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
|
|
735
735
|
const TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
|
|
736
736
|
const PACKAGED_EXTENSIONS = "_packaged-extensions.json";
|
|
737
|
-
const PACKAGED_EXT_INFO = "_packaged-ext-info.json";
|
|
738
737
|
const BREAKPOINT_TABLET = 991;
|
|
739
738
|
const PALETTES_FILE = "_palettes.json";
|
|
740
739
|
const HISTORY_FILE = "_history";
|
|
@@ -1165,7 +1164,6 @@ declare namespace pxt.hexloader {
|
|
|
1165
1164
|
function storeWithLimitAsync(host: Host, idxkey: string, newkey: string, newval: string, maxLen?: number): Promise<void>;
|
|
1166
1165
|
function recordGetAsync(host: Host, idxkey: string, newkey: string): Promise<void>;
|
|
1167
1166
|
function stringifyHexInfoForCache(hexInfo: pxtc.HexInfo): string;
|
|
1168
|
-
function storeHexInfoCacheEntryAsync(host: Host, sha: string, cachedHexInfo: string): Promise<void>;
|
|
1169
1167
|
function getHexInfoAsync(host: Host, extInfo: pxtc.ExtensionInfo, cloudModule?: any): Promise<pxtc.HexInfo>;
|
|
1170
1168
|
}
|
|
1171
1169
|
declare namespace pxt.crowdin {
|
|
@@ -2168,7 +2166,6 @@ declare namespace pxt {
|
|
|
2168
2166
|
private prepareConfigToBePublished;
|
|
2169
2167
|
filesToBePublishedAsync(allowPrivate?: boolean, packExternalExtensions?: boolean): Promise<Map<string>>;
|
|
2170
2168
|
private packagedExternalExtensions;
|
|
2171
|
-
private packagedExtensionHexInfo;
|
|
2172
2169
|
saveToJsonAsync(): Promise<pxt.cpp.HexFile>;
|
|
2173
2170
|
compressToFileAsync(): Promise<Uint8Array>;
|
|
2174
2171
|
computePartDefinitions(parts: string[]): pxt.Map<pxsim.PartDefinition>;
|
package/built/pxtlib.js
CHANGED
|
@@ -4237,7 +4237,6 @@ var pxt;
|
|
|
4237
4237
|
pxt.TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
|
|
4238
4238
|
pxt.TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
|
|
4239
4239
|
pxt.PACKAGED_EXTENSIONS = "_packaged-extensions.json";
|
|
4240
|
-
pxt.PACKAGED_EXT_INFO = "_packaged-ext-info.json";
|
|
4241
4240
|
pxt.BREAKPOINT_TABLET = 991; // TODO (shakao) revisit when tutorial stuff is more settled
|
|
4242
4241
|
pxt.PALETTES_FILE = "_palettes.json";
|
|
4243
4242
|
pxt.HISTORY_FILE = "_history";
|
|
@@ -8096,12 +8095,6 @@ int main() {
|
|
|
8096
8095
|
return JSON.stringify(cachedMeta);
|
|
8097
8096
|
}
|
|
8098
8097
|
hexloader.stringifyHexInfoForCache = stringifyHexInfoForCache;
|
|
8099
|
-
function storeHexInfoCacheEntryAsync(host, sha, cachedHexInfo) {
|
|
8100
|
-
if (!sha || !cachedHexInfo)
|
|
8101
|
-
return Promise.resolve();
|
|
8102
|
-
return storeWithLimitAsync(host, "hex-keys", "hex-" + sha, cachedHexInfo);
|
|
8103
|
-
}
|
|
8104
|
-
hexloader.storeHexInfoCacheEntryAsync = storeHexInfoCacheEntryAsync;
|
|
8105
8098
|
function getHexInfoAsync(host, extInfo, cloudModule) {
|
|
8106
8099
|
if (!extInfo.sha)
|
|
8107
8100
|
return Promise.resolve(null);
|
|
@@ -17371,9 +17364,6 @@ var pxt;
|
|
|
17371
17364
|
!opts.target.isNative;
|
|
17372
17365
|
if (!noFileEmbed) {
|
|
17373
17366
|
const files = await this.filesToBePublishedAsync(true, !pxt.appTarget.compile.useUF2);
|
|
17374
|
-
const packagedExtInfo = this.packagedExtensionHexInfo(opts);
|
|
17375
|
-
if (Object.keys(packagedExtInfo).length)
|
|
17376
|
-
files[pxt.PACKAGED_EXT_INFO] = JSON.stringify(packagedExtInfo);
|
|
17377
17367
|
const headerString = JSON.stringify({
|
|
17378
17368
|
name: this.config.name,
|
|
17379
17369
|
comment: this.config.description,
|
|
@@ -17501,20 +17491,6 @@ var pxt;
|
|
|
17501
17491
|
packDeps(this);
|
|
17502
17492
|
return packaged;
|
|
17503
17493
|
}
|
|
17504
|
-
packagedExtensionHexInfo(opts) {
|
|
17505
|
-
var _a;
|
|
17506
|
-
const packaged = {};
|
|
17507
|
-
const targets = [opts, ...(opts.otherMultiVariants || [])];
|
|
17508
|
-
for (const target of targets) {
|
|
17509
|
-
const extInfo = target.extinfo;
|
|
17510
|
-
if (!(extInfo === null || extInfo === void 0 ? void 0 : extInfo.sha) || !((_a = extInfo.hexinfo) === null || _a === void 0 ? void 0 : _a.hex))
|
|
17511
|
-
continue;
|
|
17512
|
-
const serialized = pxt.hexloader.stringifyHexInfoForCache(extInfo.hexinfo);
|
|
17513
|
-
if (serialized)
|
|
17514
|
-
packaged[extInfo.sha] = serialized;
|
|
17515
|
-
}
|
|
17516
|
-
return packaged;
|
|
17517
|
-
}
|
|
17518
17494
|
saveToJsonAsync() {
|
|
17519
17495
|
return this.filesToBePublishedAsync(true)
|
|
17520
17496
|
.then(files => {
|
|
@@ -18458,18 +18434,21 @@ var ts;
|
|
|
18458
18434
|
const langLower = lang.toLowerCase();
|
|
18459
18435
|
const attrJsLocsKey = langLower + "|jsdoc";
|
|
18460
18436
|
const attrBlockLocsKey = langLower + "|block";
|
|
18437
|
+
const attrAriaLabelLocsKey = langLower + "|ariaLabel";
|
|
18461
18438
|
const loc = await mainPkg.localizationStringsAsync(lang);
|
|
18462
18439
|
if (pxtc.apiLocalizationStrings)
|
|
18463
18440
|
pxtc.Util.jsonMergeFrom(loc, pxtc.apiLocalizationStrings);
|
|
18464
18441
|
const toLocalize = pxtc.Util.values(apis.byQName).filter(fn => fn.attributes._translatedLanguageCode !== lang);
|
|
18465
18442
|
await pxtc.Util.promiseMapAll(toLocalize, async (fn) => {
|
|
18466
|
-
var _a, _b, _c;
|
|
18443
|
+
var _a, _b, _c, _d;
|
|
18467
18444
|
const altLocSrc = fn.attributes.useLoc || fn.attributes.blockAliasFor;
|
|
18468
18445
|
const altLocSrcFn = altLocSrc && apis.byQName[altLocSrc];
|
|
18469
18446
|
if (fn.attributes._untranslatedJsDoc)
|
|
18470
18447
|
fn.attributes.jsDoc = fn.attributes._untranslatedJsDoc;
|
|
18471
18448
|
if (fn.attributes._untranslatedBlock)
|
|
18472
|
-
fn.attributes.
|
|
18449
|
+
fn.attributes.block = fn.attributes._untranslatedBlock;
|
|
18450
|
+
if (fn.attributes._untranslatedAriaLabel)
|
|
18451
|
+
fn.attributes.ariaLabel = fn.attributes._untranslatedAriaLabel;
|
|
18473
18452
|
if (fn.attributes._untranslatedParamDefl) {
|
|
18474
18453
|
fn.attributes.paramDefl = pxtc.U.clone(fn.attributes._untranslatedParamDefl);
|
|
18475
18454
|
syncParameterDefaults(fn);
|
|
@@ -18495,6 +18474,7 @@ var ts;
|
|
|
18495
18474
|
});
|
|
18496
18475
|
const nsDoc = loc['{id:category}' + pxtc.Util.capitalize(fn.qName)];
|
|
18497
18476
|
let locBlock = loc[`${fn.qName}|block`] || ((_b = fn.attributes.locs) === null || _b === void 0 ? void 0 : _b[attrBlockLocsKey]);
|
|
18477
|
+
const locAriaLabel = loc[`${fn.qName}|ariaLabel`] || ((_c = fn.attributes.locs) === null || _c === void 0 ? void 0 : _c[attrAriaLabelLocsKey]);
|
|
18498
18478
|
if (fn.attributes.block) {
|
|
18499
18479
|
const comp = pxt.blocks.compileInfo(fn);
|
|
18500
18480
|
if (comp.handlerArgs) {
|
|
@@ -18537,7 +18517,7 @@ var ts;
|
|
|
18537
18517
|
}
|
|
18538
18518
|
}
|
|
18539
18519
|
if (!locBlock && altLocSrcFn) {
|
|
18540
|
-
const otherTranslation = loc[`${altLocSrcFn.qName}|block`] || ((
|
|
18520
|
+
const otherTranslation = loc[`${altLocSrcFn.qName}|block`] || ((_d = altLocSrcFn.attributes.locs) === null || _d === void 0 ? void 0 : _d[attrBlockLocsKey]);
|
|
18541
18521
|
const isSameBlockDef = fn.attributes.block === (altLocSrcFn.attributes._untranslatedBlock || altLocSrcFn.attributes.block);
|
|
18542
18522
|
if (isSameBlockDef && !!otherTranslation) {
|
|
18543
18523
|
locBlock = otherTranslation;
|
|
@@ -18594,6 +18574,12 @@ var ts;
|
|
|
18594
18574
|
else {
|
|
18595
18575
|
updateBlockDef(fn.attributes);
|
|
18596
18576
|
}
|
|
18577
|
+
if (locAriaLabel) {
|
|
18578
|
+
if (!fn.attributes._untranslatedAriaLabel) {
|
|
18579
|
+
fn.attributes._untranslatedAriaLabel = fn.attributes.ariaLabel;
|
|
18580
|
+
}
|
|
18581
|
+
fn.attributes.ariaLabel = locAriaLabel;
|
|
18582
|
+
}
|
|
18597
18583
|
fn.attributes._translatedLanguageCode = lang;
|
|
18598
18584
|
});
|
|
18599
18585
|
return cleanLocalizations(apis);
|
|
@@ -18729,6 +18715,11 @@ var ts;
|
|
|
18729
18715
|
res.locs = {};
|
|
18730
18716
|
res.locs[n.slice("jsdoc.loc.".length).toLowerCase() + "|jsdoc"] = v;
|
|
18731
18717
|
}
|
|
18718
|
+
else if (pxtc.U.startsWith(n, "ariaLabel.loc.")) {
|
|
18719
|
+
if (!res.locs)
|
|
18720
|
+
res.locs = {};
|
|
18721
|
+
res.locs[n.slice("ariaLabel.loc.".length).toLowerCase() + "|ariaLabel"] = v;
|
|
18722
|
+
}
|
|
18732
18723
|
else if (pxtc.U.contains(n, ".loc.")) {
|
|
18733
18724
|
if (!res.locs)
|
|
18734
18725
|
res.locs = {};
|