pxt-core 11.4.18 → 11.4.21
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/nodeutil.js +8 -2
- package/built/pxt.js +43 -13
- package/built/pxtlib.d.ts +1 -1
- package/built/pxtlib.js +43 -13
- package/built/target.js +1 -1
- package/built/targetlight.js +1 -1
- package/built/web/pxtapp.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/package.json +4 -1
package/built/nodeutil.js
CHANGED
|
@@ -260,7 +260,7 @@ exports.getLocalTagPointingAtHeadAsync = getLocalTagPointingAtHeadAsync;
|
|
|
260
260
|
async function npmVersionBumpAsync(bumpType, tagCommit = true) {
|
|
261
261
|
const output = await spawnWithPipeAsync({
|
|
262
262
|
cmd: addCmd("npm"),
|
|
263
|
-
args: ["version", bumpType, "--message", `
|
|
263
|
+
args: ["version", bumpType, "--message", quoteIfNeeded(`[pxt-cli] bump version to %s`), "--git-tag-version", tagCommit ? "true" : "false"],
|
|
264
264
|
cwd: ".",
|
|
265
265
|
silent: true,
|
|
266
266
|
});
|
|
@@ -275,7 +275,7 @@ async function npmVersionBumpAsync(bumpType, tagCommit = true) {
|
|
|
275
275
|
});
|
|
276
276
|
await spawnAsync({
|
|
277
277
|
cmd: "git",
|
|
278
|
-
args: ["commit", "-m", `
|
|
278
|
+
args: ["commit", "-m", quoteIfNeeded(`[pxt-cli] bump version to ${ver}`)],
|
|
279
279
|
cwd: ".",
|
|
280
280
|
silent: true,
|
|
281
281
|
});
|
|
@@ -283,6 +283,12 @@ async function npmVersionBumpAsync(bumpType, tagCommit = true) {
|
|
|
283
283
|
return ver;
|
|
284
284
|
}
|
|
285
285
|
exports.npmVersionBumpAsync = npmVersionBumpAsync;
|
|
286
|
+
function quoteIfNeeded(arg) {
|
|
287
|
+
if (os.platform() === "win32") {
|
|
288
|
+
return `"${arg}"`;
|
|
289
|
+
}
|
|
290
|
+
return arg;
|
|
291
|
+
}
|
|
286
292
|
function gitPushAsync(followTags = true) {
|
|
287
293
|
const args = ["push"];
|
|
288
294
|
if (followTags)
|
package/built/pxt.js
CHANGED
|
@@ -108978,11 +108978,35 @@ var pxt;
|
|
|
108978
108978
|
}
|
|
108979
108979
|
return null;
|
|
108980
108980
|
}
|
|
108981
|
-
function
|
|
108981
|
+
async function upgradedPackageReferenceAsync(cfg, id) {
|
|
108982
108982
|
const rules = upgradeRules(cfg, id);
|
|
108983
108983
|
if (!rules)
|
|
108984
108984
|
return null;
|
|
108985
108985
|
for (const upgr of rules) {
|
|
108986
|
+
const mv = /^move:(.*)$/.exec(upgr);
|
|
108987
|
+
if (mv) {
|
|
108988
|
+
const new_repo = parseRepoId(mv[1]);
|
|
108989
|
+
if (new_repo) {
|
|
108990
|
+
if (!new_repo.tag) {
|
|
108991
|
+
new_repo.tag = await latestVersionAsync(mv[1], cfg);
|
|
108992
|
+
}
|
|
108993
|
+
const repo = parseRepoId(id);
|
|
108994
|
+
if (!new_repo.fileName && repo.fileName) {
|
|
108995
|
+
new_repo.fileName = repo.fileName;
|
|
108996
|
+
new_repo.fullName = join(new_repo.owner, new_repo.project, new_repo.fileName);
|
|
108997
|
+
}
|
|
108998
|
+
const new_repo_s = stringifyRepo(new_repo);
|
|
108999
|
+
pxt.debug(`upgrading ${id} to ${new_repo_s}}`);
|
|
109000
|
+
const np = await upgradedPackageReferenceAsync(cfg, new_repo_s);
|
|
109001
|
+
if (np)
|
|
109002
|
+
return np;
|
|
109003
|
+
else
|
|
109004
|
+
return new_repo_s;
|
|
109005
|
+
}
|
|
109006
|
+
else {
|
|
109007
|
+
pxt.log(`cannot parse move target: ${mv[1]}`);
|
|
109008
|
+
}
|
|
109009
|
+
}
|
|
108986
109010
|
const m = /^min:(.*)/.exec(upgr);
|
|
108987
109011
|
const minV = m && pxt.semver.tryParse(m[1]);
|
|
108988
109012
|
if (minV) {
|
|
@@ -109007,7 +109031,7 @@ var pxt;
|
|
|
109007
109031
|
}
|
|
109008
109032
|
return id;
|
|
109009
109033
|
}
|
|
109010
|
-
github.
|
|
109034
|
+
github.upgradedPackageReferenceAsync = upgradedPackageReferenceAsync;
|
|
109011
109035
|
function upgradedPackageId(cfg, id) {
|
|
109012
109036
|
const dv = upgradedDisablesVariants(cfg, id);
|
|
109013
109037
|
if (dv)
|
|
@@ -113738,20 +113762,25 @@ var pxt;
|
|
|
113738
113762
|
if (!this.config)
|
|
113739
113763
|
this.loadConfig();
|
|
113740
113764
|
return pxt.packagesConfigAsync()
|
|
113741
|
-
.then(packagesConfig => {
|
|
113765
|
+
.then(async (packagesConfig) => {
|
|
113742
113766
|
let numfixes = 0;
|
|
113743
113767
|
let fixes = {};
|
|
113768
|
+
const promises = [];
|
|
113744
113769
|
pxt.U.iterMap(this.config.dependencies, (pkg, ver) => {
|
|
113745
|
-
|
|
113746
|
-
|
|
113747
|
-
|
|
113748
|
-
|
|
113749
|
-
|
|
113750
|
-
|
|
113751
|
-
|
|
113770
|
+
const doit = async () => {
|
|
113771
|
+
if (pxt.github.isGithubId(ver)) {
|
|
113772
|
+
const upgraded = await pxt.github.upgradedPackageReferenceAsync(packagesConfig, ver);
|
|
113773
|
+
if (upgraded && upgraded != ver) {
|
|
113774
|
+
pxt.log(`upgrading dep ${pkg}: ${ver} -> ${upgraded}`);
|
|
113775
|
+
fixes[ver] = upgraded;
|
|
113776
|
+
this.config.dependencies[pkg] = upgraded;
|
|
113777
|
+
numfixes++;
|
|
113778
|
+
}
|
|
113752
113779
|
}
|
|
113753
|
-
}
|
|
113780
|
+
};
|
|
113781
|
+
promises.push(doit());
|
|
113754
113782
|
});
|
|
113783
|
+
await Promise.all(promises);
|
|
113755
113784
|
if (numfixes)
|
|
113756
113785
|
this.saveConfig();
|
|
113757
113786
|
return numfixes && fixes;
|
|
@@ -113993,7 +114022,7 @@ var pxt;
|
|
|
113993
114022
|
}
|
|
113994
114023
|
// if we are installing this script, we haven't yet downloaded the config
|
|
113995
114024
|
// do upgrade later
|
|
113996
|
-
if (
|
|
114025
|
+
if (!isInstall) {
|
|
113997
114026
|
await this.upgradePackagesAsync();
|
|
113998
114027
|
}
|
|
113999
114028
|
if (isInstall) {
|
|
@@ -114009,13 +114038,14 @@ var pxt;
|
|
|
114009
114038
|
}
|
|
114010
114039
|
// we are installing the script, and we've download the original version and we haven't upgraded it yet
|
|
114011
114040
|
// do upgrade and reload as needed
|
|
114012
|
-
if (
|
|
114041
|
+
if (isInstall) {
|
|
114013
114042
|
const fixes = await this.upgradePackagesAsync();
|
|
114014
114043
|
if (fixes) {
|
|
114015
114044
|
// worst case scenario with double load
|
|
114016
114045
|
Object.keys(fixes).forEach(key => pxt.tickEvent("package.doubleload", { "extension": key }));
|
|
114017
114046
|
pxt.log(`upgraded, downloading again`);
|
|
114018
114047
|
pxt.debug(fixes);
|
|
114048
|
+
// TODO: we should cache
|
|
114019
114049
|
await this.downloadAsync();
|
|
114020
114050
|
}
|
|
114021
114051
|
}
|
package/built/pxtlib.d.ts
CHANGED
|
@@ -1506,7 +1506,7 @@ declare namespace pxt.github {
|
|
|
1506
1506
|
function stringifyRepo(p: ParsedRepo, ignoreCase?: boolean): string;
|
|
1507
1507
|
function normalizeRepoId(id: string, defaultTag?: string): string;
|
|
1508
1508
|
function join(...parts: string[]): string;
|
|
1509
|
-
function
|
|
1509
|
+
function upgradedPackageReferenceAsync(cfg: PackagesConfig, id: string): Promise<string>;
|
|
1510
1510
|
function upgradedPackageId(cfg: PackagesConfig, id: string): string;
|
|
1511
1511
|
function latestVersionAsync(repopath: string, config: PackagesConfig, useProxy?: boolean, noCache?: boolean): Promise<string>;
|
|
1512
1512
|
function resolveMonoRepoVersions(deps: pxt.Map<string>): pxt.Map<string>;
|
package/built/pxtlib.js
CHANGED
|
@@ -11292,11 +11292,35 @@ var pxt;
|
|
|
11292
11292
|
}
|
|
11293
11293
|
return null;
|
|
11294
11294
|
}
|
|
11295
|
-
function
|
|
11295
|
+
async function upgradedPackageReferenceAsync(cfg, id) {
|
|
11296
11296
|
const rules = upgradeRules(cfg, id);
|
|
11297
11297
|
if (!rules)
|
|
11298
11298
|
return null;
|
|
11299
11299
|
for (const upgr of rules) {
|
|
11300
|
+
const mv = /^move:(.*)$/.exec(upgr);
|
|
11301
|
+
if (mv) {
|
|
11302
|
+
const new_repo = parseRepoId(mv[1]);
|
|
11303
|
+
if (new_repo) {
|
|
11304
|
+
if (!new_repo.tag) {
|
|
11305
|
+
new_repo.tag = await latestVersionAsync(mv[1], cfg);
|
|
11306
|
+
}
|
|
11307
|
+
const repo = parseRepoId(id);
|
|
11308
|
+
if (!new_repo.fileName && repo.fileName) {
|
|
11309
|
+
new_repo.fileName = repo.fileName;
|
|
11310
|
+
new_repo.fullName = join(new_repo.owner, new_repo.project, new_repo.fileName);
|
|
11311
|
+
}
|
|
11312
|
+
const new_repo_s = stringifyRepo(new_repo);
|
|
11313
|
+
pxt.debug(`upgrading ${id} to ${new_repo_s}}`);
|
|
11314
|
+
const np = await upgradedPackageReferenceAsync(cfg, new_repo_s);
|
|
11315
|
+
if (np)
|
|
11316
|
+
return np;
|
|
11317
|
+
else
|
|
11318
|
+
return new_repo_s;
|
|
11319
|
+
}
|
|
11320
|
+
else {
|
|
11321
|
+
pxt.log(`cannot parse move target: ${mv[1]}`);
|
|
11322
|
+
}
|
|
11323
|
+
}
|
|
11300
11324
|
const m = /^min:(.*)/.exec(upgr);
|
|
11301
11325
|
const minV = m && pxt.semver.tryParse(m[1]);
|
|
11302
11326
|
if (minV) {
|
|
@@ -11321,7 +11345,7 @@ var pxt;
|
|
|
11321
11345
|
}
|
|
11322
11346
|
return id;
|
|
11323
11347
|
}
|
|
11324
|
-
github.
|
|
11348
|
+
github.upgradedPackageReferenceAsync = upgradedPackageReferenceAsync;
|
|
11325
11349
|
function upgradedPackageId(cfg, id) {
|
|
11326
11350
|
const dv = upgradedDisablesVariants(cfg, id);
|
|
11327
11351
|
if (dv)
|
|
@@ -16052,20 +16076,25 @@ var pxt;
|
|
|
16052
16076
|
if (!this.config)
|
|
16053
16077
|
this.loadConfig();
|
|
16054
16078
|
return pxt.packagesConfigAsync()
|
|
16055
|
-
.then(packagesConfig => {
|
|
16079
|
+
.then(async (packagesConfig) => {
|
|
16056
16080
|
let numfixes = 0;
|
|
16057
16081
|
let fixes = {};
|
|
16082
|
+
const promises = [];
|
|
16058
16083
|
pxt.U.iterMap(this.config.dependencies, (pkg, ver) => {
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16084
|
+
const doit = async () => {
|
|
16085
|
+
if (pxt.github.isGithubId(ver)) {
|
|
16086
|
+
const upgraded = await pxt.github.upgradedPackageReferenceAsync(packagesConfig, ver);
|
|
16087
|
+
if (upgraded && upgraded != ver) {
|
|
16088
|
+
pxt.log(`upgrading dep ${pkg}: ${ver} -> ${upgraded}`);
|
|
16089
|
+
fixes[ver] = upgraded;
|
|
16090
|
+
this.config.dependencies[pkg] = upgraded;
|
|
16091
|
+
numfixes++;
|
|
16092
|
+
}
|
|
16066
16093
|
}
|
|
16067
|
-
}
|
|
16094
|
+
};
|
|
16095
|
+
promises.push(doit());
|
|
16068
16096
|
});
|
|
16097
|
+
await Promise.all(promises);
|
|
16069
16098
|
if (numfixes)
|
|
16070
16099
|
this.saveConfig();
|
|
16071
16100
|
return numfixes && fixes;
|
|
@@ -16307,7 +16336,7 @@ var pxt;
|
|
|
16307
16336
|
}
|
|
16308
16337
|
// if we are installing this script, we haven't yet downloaded the config
|
|
16309
16338
|
// do upgrade later
|
|
16310
|
-
if (
|
|
16339
|
+
if (!isInstall) {
|
|
16311
16340
|
await this.upgradePackagesAsync();
|
|
16312
16341
|
}
|
|
16313
16342
|
if (isInstall) {
|
|
@@ -16323,13 +16352,14 @@ var pxt;
|
|
|
16323
16352
|
}
|
|
16324
16353
|
// we are installing the script, and we've download the original version and we haven't upgraded it yet
|
|
16325
16354
|
// do upgrade and reload as needed
|
|
16326
|
-
if (
|
|
16355
|
+
if (isInstall) {
|
|
16327
16356
|
const fixes = await this.upgradePackagesAsync();
|
|
16328
16357
|
if (fixes) {
|
|
16329
16358
|
// worst case scenario with double load
|
|
16330
16359
|
Object.keys(fixes).forEach(key => pxt.tickEvent("package.doubleload", { "extension": key }));
|
|
16331
16360
|
pxt.log(`upgraded, downloading again`);
|
|
16332
16361
|
pxt.debug(fixes);
|
|
16362
|
+
// TODO: we should cache
|
|
16333
16363
|
await this.downloadAsync();
|
|
16334
16364
|
}
|
|
16335
16365
|
}
|