pxt-core 7.5.37 → 7.5.40
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/cli.js +9 -1
- package/built/pxt.js +52 -35
- package/built/pxtlib.js +42 -33
- package/built/pxtsim.js +1 -1
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtsim.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common-authcode.css +140 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/localtypings/pxtarget.d.ts +5 -7
- package/package.json +1 -1
- package/react-common/components/controls/Card.tsx +48 -0
- package/react-common/components/controls/LazyImage.tsx +82 -0
- package/react-common/components/extensions/ExtensionCard.tsx +70 -0
- package/react-common/styles/controls/Button.less +6 -0
- package/react-common/styles/controls/Card.less +53 -0
- package/react-common/styles/controls/LazyImage.less +29 -0
- package/react-common/styles/extensions/ExtensionCard.less +82 -0
- package/react-common/styles/react-common.less +3 -0
- package/theme/common.less +35 -1
package/built/cli.js
CHANGED
|
@@ -5053,6 +5053,7 @@ function checkFileSize(files) {
|
|
|
5053
5053
|
return maxSize;
|
|
5054
5054
|
}
|
|
5055
5055
|
function internalCheckDocsAsync(compileSnippets, re, fix, pycheck) {
|
|
5056
|
+
var _a;
|
|
5056
5057
|
if (!nodeutil.existsDirSync("docs"))
|
|
5057
5058
|
return Promise.resolve();
|
|
5058
5059
|
const docsRoot = nodeutil.targetDir;
|
|
@@ -5230,6 +5231,13 @@ function internalCheckDocsAsync(compileSnippets, re, fix, pycheck) {
|
|
|
5230
5231
|
// test targetconfig
|
|
5231
5232
|
if (nodeutil.fileExistsSync("targetconfig.json")) {
|
|
5232
5233
|
const targetConfig = nodeutil.readJson("targetconfig.json");
|
|
5234
|
+
if ((_a = targetConfig === null || targetConfig === void 0 ? void 0 : targetConfig.packages) === null || _a === void 0 ? void 0 : _a.approvedRepoLib) {
|
|
5235
|
+
for (const repoSlug of Object.keys(targetConfig.packages.approvedRepoLib)) {
|
|
5236
|
+
if (repoSlug !== repoSlug.toLocaleLowerCase()) {
|
|
5237
|
+
U.userError(`targetconfig.json: repo slugs in approvedRepoLib must be lowercased.\n\tError: ${repoSlug}`);
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
}
|
|
5233
5241
|
if (targetConfig && targetConfig.galleries) {
|
|
5234
5242
|
Object.keys(targetConfig.galleries).forEach(k => {
|
|
5235
5243
|
pxt.log(`gallery ${k}`);
|
|
@@ -5741,7 +5749,7 @@ function testGithubPackagesAsync(parsed) {
|
|
|
5741
5749
|
.then(() => nodeutil.mkdirP(pkgsroot))
|
|
5742
5750
|
.then(() => pxt.github.searchAsync("", packages))
|
|
5743
5751
|
.then(ghrepos => ghrepos.filter(ghrepo => ghrepo.status == pxt.github.GitRepoStatus.Approved)
|
|
5744
|
-
.map(ghrepo => ghrepo.fullName).concat(packages.
|
|
5752
|
+
.map(ghrepo => ghrepo.fullName).concat(Object.keys(packages.approvedRepoLib || {})))
|
|
5745
5753
|
.then(fullnames => {
|
|
5746
5754
|
// remove dups
|
|
5747
5755
|
fullnames = U.unique(fullnames, f => f.toLowerCase());
|
package/built/pxt.js
CHANGED
|
@@ -108170,13 +108170,13 @@ var pxt;
|
|
|
108170
108170
|
return false;
|
|
108171
108171
|
}
|
|
108172
108172
|
function isRepoApproved(repo, config) {
|
|
108173
|
+
var _a;
|
|
108173
108174
|
if (isOrgApproved(repo, config))
|
|
108174
108175
|
return true;
|
|
108175
108176
|
if (!repo || !config)
|
|
108176
108177
|
return false;
|
|
108177
108178
|
if (repo.fullName
|
|
108178
|
-
&& config.
|
|
108179
|
-
&& config.approvedRepos.some(fn => fn.toLowerCase() == repo.fullName.toLowerCase()))
|
|
108179
|
+
&& ((_a = config.approvedRepoLib) === null || _a === void 0 ? void 0 : _a[repo.fullName.toLowerCase()]))
|
|
108180
108180
|
return true;
|
|
108181
108181
|
return false;
|
|
108182
108182
|
}
|
|
@@ -108309,50 +108309,59 @@ var pxt;
|
|
|
108309
108309
|
return parts.filter(p => !!p).join('/');
|
|
108310
108310
|
}
|
|
108311
108311
|
github.join = join;
|
|
108312
|
-
function
|
|
108313
|
-
if (!cfg
|
|
108312
|
+
function upgradeRules(cfg, id) {
|
|
108313
|
+
if (!cfg)
|
|
108314
108314
|
return null;
|
|
108315
108315
|
const parsed = parseRepoId(id);
|
|
108316
108316
|
if (!parsed)
|
|
108317
108317
|
return null;
|
|
108318
|
-
|
|
108318
|
+
const repoData = cfg.approvedRepoLib;
|
|
108319
|
+
// lookup base repo for upgrade rules
|
|
108320
|
+
// (since nested repoes share the same version number)
|
|
108321
|
+
return cfg.approvedRepoLib && pxt.U.lookup(cfg.approvedRepoLib, parsed.slug.toLowerCase()).upgrades;
|
|
108319
108322
|
}
|
|
108320
108323
|
function upgradedDisablesVariants(cfg, id) {
|
|
108321
|
-
const
|
|
108322
|
-
|
|
108323
|
-
|
|
108324
|
-
|
|
108325
|
-
|
|
108326
|
-
|
|
108327
|
-
|
|
108324
|
+
const rules = upgradeRules(cfg, id) || [];
|
|
108325
|
+
if (!rules)
|
|
108326
|
+
return null;
|
|
108327
|
+
for (const upgr of rules) {
|
|
108328
|
+
const m = /^dv:(.*)/.exec(upgr);
|
|
108329
|
+
if (m) {
|
|
108330
|
+
const disabled = m[1].split(/,/);
|
|
108331
|
+
if (disabled.some(d => !/^\w+$/.test(d)))
|
|
108332
|
+
return null;
|
|
108333
|
+
return disabled;
|
|
108334
|
+
}
|
|
108328
108335
|
}
|
|
108329
108336
|
return null;
|
|
108330
108337
|
}
|
|
108331
108338
|
function upgradedPackageReference(cfg, id) {
|
|
108332
|
-
const
|
|
108333
|
-
if (!
|
|
108339
|
+
const rules = upgradeRules(cfg, id);
|
|
108340
|
+
if (!rules)
|
|
108334
108341
|
return null;
|
|
108335
|
-
const
|
|
108336
|
-
|
|
108337
|
-
|
|
108338
|
-
|
|
108339
|
-
|
|
108340
|
-
|
|
108341
|
-
|
|
108342
|
-
|
|
108343
|
-
|
|
108342
|
+
for (const upgr of rules) {
|
|
108343
|
+
const m = /^min:(.*)/.exec(upgr);
|
|
108344
|
+
const minV = m && pxt.semver.tryParse(m[1]);
|
|
108345
|
+
if (minV) {
|
|
108346
|
+
const parsed = parseRepoId(id);
|
|
108347
|
+
const currV = pxt.semver.tryParse(parsed.tag);
|
|
108348
|
+
if (currV && pxt.semver.cmp(currV, minV) < 0) {
|
|
108349
|
+
parsed.tag = m[1];
|
|
108350
|
+
pxt.debug(`upgrading ${id} to ${m[1]}`);
|
|
108351
|
+
return stringifyRepo(parsed);
|
|
108352
|
+
}
|
|
108353
|
+
else {
|
|
108354
|
+
if (!currV)
|
|
108355
|
+
pxt.log(`not upgrading ${id} - cannot parse version`);
|
|
108356
|
+
return null;
|
|
108357
|
+
}
|
|
108344
108358
|
}
|
|
108345
108359
|
else {
|
|
108346
|
-
if
|
|
108347
|
-
|
|
108348
|
-
|
|
108360
|
+
// check if the rule looks valid at all
|
|
108361
|
+
if (!upgradedDisablesVariants(cfg, id))
|
|
108362
|
+
pxt.log(`invalid upgrade rule: ${id} -> ${upgr}`);
|
|
108349
108363
|
}
|
|
108350
108364
|
}
|
|
108351
|
-
else {
|
|
108352
|
-
// check if the rule looks valid at all
|
|
108353
|
-
if (!upgradedDisablesVariants(cfg, id))
|
|
108354
|
-
pxt.log(`invalid upgrade rule: ${id} -> ${upgr}`);
|
|
108355
|
-
}
|
|
108356
108365
|
return id;
|
|
108357
108366
|
}
|
|
108358
108367
|
github.upgradedPackageReference = upgradedPackageReference;
|
|
@@ -111676,7 +111685,7 @@ var pxt;
|
|
|
111676
111685
|
// if newversion does not have tag, it's ok
|
|
111677
111686
|
// note: we are upgrade major versions as well
|
|
111678
111687
|
|| (ghNew.tag && pxt.semver.strcmp(ghCurrent.tag, ghNew.tag) < 0)) {
|
|
111679
|
-
const conflict = new pxt.cpp.PkgConflictError(lf("version mismatch for extension {0} (
|
|
111688
|
+
const conflict = new pxt.cpp.PkgConflictError(lf("version mismatch for extension {0} (added: {1}, adding: {2})", depPkg.id, depPkg._verspec, version));
|
|
111680
111689
|
conflict.pkg0 = depPkg;
|
|
111681
111690
|
conflict.isVersionConflict = true;
|
|
111682
111691
|
conflicts.push(conflict);
|
|
@@ -111709,7 +111718,7 @@ var pxt;
|
|
|
111709
111718
|
conflicts.forEach((c) => {
|
|
111710
111719
|
additionalConflicts.push.apply(additionalConflicts, allAncestors(c.pkg0).map((anc) => {
|
|
111711
111720
|
const confl = new pxt.cpp.PkgConflictError(c.isVersionConflict ?
|
|
111712
|
-
lf("a dependency of {0} has a version mismatch with extension {1} (
|
|
111721
|
+
lf("a dependency of {0} has a version mismatch with extension {1} (added: {1}, adding: {2})", anc.id, pkgCfg.name, c.pkg0._verspec, version) :
|
|
111713
111722
|
lf("conflict on yotta setting {0} between extensions {1} and {2}", c.settingName, pkgCfg.name, c.pkg0.id));
|
|
111714
111723
|
confl.pkg0 = anc;
|
|
111715
111724
|
return confl;
|
|
@@ -155114,7 +155123,7 @@ var pxsim;
|
|
|
155114
155123
|
soundQueue.push({
|
|
155115
155124
|
notes,
|
|
155116
155125
|
onFinished: resolve,
|
|
155117
|
-
onCancelled:
|
|
155126
|
+
onCancelled: resolve
|
|
155118
155127
|
});
|
|
155119
155128
|
});
|
|
155120
155129
|
if (!playing) {
|
|
@@ -162200,6 +162209,7 @@ function checkFileSize(files) {
|
|
|
162200
162209
|
return maxSize;
|
|
162201
162210
|
}
|
|
162202
162211
|
function internalCheckDocsAsync(compileSnippets, re, fix, pycheck) {
|
|
162212
|
+
var _a;
|
|
162203
162213
|
if (!nodeutil.existsDirSync("docs"))
|
|
162204
162214
|
return Promise.resolve();
|
|
162205
162215
|
const docsRoot = nodeutil.targetDir;
|
|
@@ -162377,6 +162387,13 @@ function internalCheckDocsAsync(compileSnippets, re, fix, pycheck) {
|
|
|
162377
162387
|
// test targetconfig
|
|
162378
162388
|
if (nodeutil.fileExistsSync("targetconfig.json")) {
|
|
162379
162389
|
const targetConfig = nodeutil.readJson("targetconfig.json");
|
|
162390
|
+
if ((_a = targetConfig === null || targetConfig === void 0 ? void 0 : targetConfig.packages) === null || _a === void 0 ? void 0 : _a.approvedRepoLib) {
|
|
162391
|
+
for (const repoSlug of Object.keys(targetConfig.packages.approvedRepoLib)) {
|
|
162392
|
+
if (repoSlug !== repoSlug.toLocaleLowerCase()) {
|
|
162393
|
+
U.userError(`targetconfig.json: repo slugs in approvedRepoLib must be lowercased.\n\tError: ${repoSlug}`);
|
|
162394
|
+
}
|
|
162395
|
+
}
|
|
162396
|
+
}
|
|
162380
162397
|
if (targetConfig && targetConfig.galleries) {
|
|
162381
162398
|
Object.keys(targetConfig.galleries).forEach(k => {
|
|
162382
162399
|
pxt.log(`gallery ${k}`);
|
|
@@ -162888,7 +162905,7 @@ function testGithubPackagesAsync(parsed) {
|
|
|
162888
162905
|
.then(() => nodeutil.mkdirP(pkgsroot))
|
|
162889
162906
|
.then(() => pxt.github.searchAsync("", packages))
|
|
162890
162907
|
.then(ghrepos => ghrepos.filter(ghrepo => ghrepo.status == pxt.github.GitRepoStatus.Approved)
|
|
162891
|
-
.map(ghrepo => ghrepo.fullName).concat(packages.
|
|
162908
|
+
.map(ghrepo => ghrepo.fullName).concat(Object.keys(packages.approvedRepoLib || {})))
|
|
162892
162909
|
.then(fullnames => {
|
|
162893
162910
|
// remove dups
|
|
162894
162911
|
fullnames = U.unique(fullnames, f => f.toLowerCase());
|
package/built/pxtlib.js
CHANGED
|
@@ -10484,13 +10484,13 @@ var pxt;
|
|
|
10484
10484
|
return false;
|
|
10485
10485
|
}
|
|
10486
10486
|
function isRepoApproved(repo, config) {
|
|
10487
|
+
var _a;
|
|
10487
10488
|
if (isOrgApproved(repo, config))
|
|
10488
10489
|
return true;
|
|
10489
10490
|
if (!repo || !config)
|
|
10490
10491
|
return false;
|
|
10491
10492
|
if (repo.fullName
|
|
10492
|
-
&& config.
|
|
10493
|
-
&& config.approvedRepos.some(fn => fn.toLowerCase() == repo.fullName.toLowerCase()))
|
|
10493
|
+
&& ((_a = config.approvedRepoLib) === null || _a === void 0 ? void 0 : _a[repo.fullName.toLowerCase()]))
|
|
10494
10494
|
return true;
|
|
10495
10495
|
return false;
|
|
10496
10496
|
}
|
|
@@ -10623,50 +10623,59 @@ var pxt;
|
|
|
10623
10623
|
return parts.filter(p => !!p).join('/');
|
|
10624
10624
|
}
|
|
10625
10625
|
github.join = join;
|
|
10626
|
-
function
|
|
10627
|
-
if (!cfg
|
|
10626
|
+
function upgradeRules(cfg, id) {
|
|
10627
|
+
if (!cfg)
|
|
10628
10628
|
return null;
|
|
10629
10629
|
const parsed = parseRepoId(id);
|
|
10630
10630
|
if (!parsed)
|
|
10631
10631
|
return null;
|
|
10632
|
-
|
|
10632
|
+
const repoData = cfg.approvedRepoLib;
|
|
10633
|
+
// lookup base repo for upgrade rules
|
|
10634
|
+
// (since nested repoes share the same version number)
|
|
10635
|
+
return cfg.approvedRepoLib && pxt.U.lookup(cfg.approvedRepoLib, parsed.slug.toLowerCase()).upgrades;
|
|
10633
10636
|
}
|
|
10634
10637
|
function upgradedDisablesVariants(cfg, id) {
|
|
10635
|
-
const
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10638
|
+
const rules = upgradeRules(cfg, id) || [];
|
|
10639
|
+
if (!rules)
|
|
10640
|
+
return null;
|
|
10641
|
+
for (const upgr of rules) {
|
|
10642
|
+
const m = /^dv:(.*)/.exec(upgr);
|
|
10643
|
+
if (m) {
|
|
10644
|
+
const disabled = m[1].split(/,/);
|
|
10645
|
+
if (disabled.some(d => !/^\w+$/.test(d)))
|
|
10646
|
+
return null;
|
|
10647
|
+
return disabled;
|
|
10648
|
+
}
|
|
10642
10649
|
}
|
|
10643
10650
|
return null;
|
|
10644
10651
|
}
|
|
10645
10652
|
function upgradedPackageReference(cfg, id) {
|
|
10646
|
-
const
|
|
10647
|
-
if (!
|
|
10653
|
+
const rules = upgradeRules(cfg, id);
|
|
10654
|
+
if (!rules)
|
|
10648
10655
|
return null;
|
|
10649
|
-
const
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10656
|
+
for (const upgr of rules) {
|
|
10657
|
+
const m = /^min:(.*)/.exec(upgr);
|
|
10658
|
+
const minV = m && pxt.semver.tryParse(m[1]);
|
|
10659
|
+
if (minV) {
|
|
10660
|
+
const parsed = parseRepoId(id);
|
|
10661
|
+
const currV = pxt.semver.tryParse(parsed.tag);
|
|
10662
|
+
if (currV && pxt.semver.cmp(currV, minV) < 0) {
|
|
10663
|
+
parsed.tag = m[1];
|
|
10664
|
+
pxt.debug(`upgrading ${id} to ${m[1]}`);
|
|
10665
|
+
return stringifyRepo(parsed);
|
|
10666
|
+
}
|
|
10667
|
+
else {
|
|
10668
|
+
if (!currV)
|
|
10669
|
+
pxt.log(`not upgrading ${id} - cannot parse version`);
|
|
10670
|
+
return null;
|
|
10671
|
+
}
|
|
10658
10672
|
}
|
|
10659
10673
|
else {
|
|
10660
|
-
if
|
|
10661
|
-
|
|
10662
|
-
|
|
10674
|
+
// check if the rule looks valid at all
|
|
10675
|
+
if (!upgradedDisablesVariants(cfg, id))
|
|
10676
|
+
pxt.log(`invalid upgrade rule: ${id} -> ${upgr}`);
|
|
10663
10677
|
}
|
|
10664
10678
|
}
|
|
10665
|
-
else {
|
|
10666
|
-
// check if the rule looks valid at all
|
|
10667
|
-
if (!upgradedDisablesVariants(cfg, id))
|
|
10668
|
-
pxt.log(`invalid upgrade rule: ${id} -> ${upgr}`);
|
|
10669
|
-
}
|
|
10670
10679
|
return id;
|
|
10671
10680
|
}
|
|
10672
10681
|
github.upgradedPackageReference = upgradedPackageReference;
|
|
@@ -13990,7 +13999,7 @@ var pxt;
|
|
|
13990
13999
|
// if newversion does not have tag, it's ok
|
|
13991
14000
|
// note: we are upgrade major versions as well
|
|
13992
14001
|
|| (ghNew.tag && pxt.semver.strcmp(ghCurrent.tag, ghNew.tag) < 0)) {
|
|
13993
|
-
const conflict = new pxt.cpp.PkgConflictError(lf("version mismatch for extension {0} (
|
|
14002
|
+
const conflict = new pxt.cpp.PkgConflictError(lf("version mismatch for extension {0} (added: {1}, adding: {2})", depPkg.id, depPkg._verspec, version));
|
|
13994
14003
|
conflict.pkg0 = depPkg;
|
|
13995
14004
|
conflict.isVersionConflict = true;
|
|
13996
14005
|
conflicts.push(conflict);
|
|
@@ -14023,7 +14032,7 @@ var pxt;
|
|
|
14023
14032
|
conflicts.forEach((c) => {
|
|
14024
14033
|
additionalConflicts.push.apply(additionalConflicts, allAncestors(c.pkg0).map((anc) => {
|
|
14025
14034
|
const confl = new pxt.cpp.PkgConflictError(c.isVersionConflict ?
|
|
14026
|
-
lf("a dependency of {0} has a version mismatch with extension {1} (
|
|
14035
|
+
lf("a dependency of {0} has a version mismatch with extension {1} (added: {1}, adding: {2})", anc.id, pkgCfg.name, c.pkg0._verspec, version) :
|
|
14027
14036
|
lf("conflict on yotta setting {0} between extensions {1} and {2}", c.settingName, pkgCfg.name, c.pkg0.id));
|
|
14028
14037
|
confl.pkg0 = anc;
|
|
14029
14038
|
return confl;
|