pxt-core 7.5.49 → 7.5.52

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 CHANGED
@@ -111928,15 +111928,22 @@ var pxt;
111928
111928
  // this may be an issue if the user does not create releases
111929
111929
  // and pulls from master
111930
111930
  const modtag = (modid === null || modid === void 0 ? void 0 : modid.tag) || ((_a = mod.config) === null || _a === void 0 ? void 0 : _a.version);
111931
+ const vertag = verid.tag;
111932
+ // if there is no tag on the current dependency,
111933
+ // assume same as existing module version if any
111934
+ if (modtag && !vertag) {
111935
+ pxt.debug(`unversioned ${ver}, using ${modtag}`);
111936
+ return;
111937
+ }
111931
111938
  const c = pxt.semver.strcmp(modtag, verid.tag);
111932
111939
  if (c == 0) {
111933
111940
  // turns out to be the same versions
111934
111941
  pxt.debug(`resolved version are ${modtag}`);
111935
111942
  return;
111936
111943
  }
111937
- else if (c < 0) {
111938
- // already loaded version of dependencies is greater
111939
- // than current version, use it instead
111944
+ else if (c > 0) {
111945
+ // already loaded version of dependencies (modtag) is greater
111946
+ // than current version (ver), use it instead
111940
111947
  pxt.debug(`auto-upgraded ${ver} to ${modtag}`);
111941
111948
  return;
111942
111949
  }
@@ -111962,6 +111969,28 @@ var pxt;
111962
111969
  pxt.debug(`dep: load ${from.id}.${id}${isCpp ? "++" : ""}: ${ver}`);
111963
111970
  if (id == "hw" && pxt.hwVariant)
111964
111971
  id = "hw---" + pxt.hwVariant;
111972
+ // for github references, make sure the version is compatible with previously
111973
+ // loaded references, regardless of the id
111974
+ const ghver = pxt.github.parseRepoId(ver);
111975
+ if (ghver === null || ghver === void 0 ? void 0 : ghver.slug) {
111976
+ // let's start by resolving the maximum version
111977
+ // number of the parent repo already loaded
111978
+ const repoVersions = Object.values(from.parent.deps)
111979
+ .map(p => pxt.github.parseRepoId(p._verspec))
111980
+ .filter(v => (v === null || v === void 0 ? void 0 : v.slug) === ghver.slug)
111981
+ .map(v => v.tag);
111982
+ const repoVersion = repoVersions
111983
+ .reduce((v1, v2) => pxt.semver.strcmp(v1, v2) > 0 ? v1 : v2, "0.0.0");
111984
+ pxt.debug(`dep: common repo ${ghver.slug} version found ${repoVersion}`);
111985
+ if (pxt.semver.strcmp(repoVersion, "0.0.0") > 0) {
111986
+ // now let's check if we have a higher version to use
111987
+ if (!ghver.tag || pxt.semver.strcmp(repoVersion, ghver.tag) > 0) {
111988
+ pxt.debug(`dep: upgrade from ${ghver.tag} to ${repoVersion}`);
111989
+ ghver.tag = repoVersion;
111990
+ ver = pxt.github.stringifyRepo(ghver);
111991
+ }
111992
+ }
111993
+ }
111965
111994
  let mod = from.resolveDep(id);
111966
111995
  if (mod) {
111967
111996
  // check if the current dependecy matches the ones
@@ -112834,6 +112863,11 @@ var pxt;
112834
112863
  return aa.major - bb.major;
112835
112864
  }
112836
112865
  semver.majorCmp = majorCmp;
112866
+ /**
112867
+ * Compares two semver version strings and returns -1 if a < b, 1 if a > b and 0
112868
+ * if versions are equivalent. If a and b are invalid versions, classic strcmp is called.
112869
+ * If a (or b) is an invalid version, it is considered greater than any version (strmp(undefined, "0.0.0") = 1)
112870
+ */
112837
112871
  function strcmp(a, b) {
112838
112872
  let aa = tryParse(a);
112839
112873
  let bb = tryParse(b);
@@ -349,7 +349,6 @@ declare namespace pxt.editor {
349
349
  collapsed?: boolean;
350
350
  simSerialActive?: boolean;
351
351
  devSerialActive?: boolean;
352
- csvSerialActive?: boolean;
353
352
  }
354
353
  interface IFieldCustomOptions {
355
354
  selector: string;
package/built/pxtlib.d.ts CHANGED
@@ -1930,6 +1930,11 @@ declare namespace pxt.semver {
1930
1930
  function normalize(v: string): string;
1931
1931
  function stringify(v: Version): string;
1932
1932
  function majorCmp(a: string, b: string): number;
1933
+ /**
1934
+ * Compares two semver version strings and returns -1 if a < b, 1 if a > b and 0
1935
+ * if versions are equivalent. If a and b are invalid versions, classic strcmp is called.
1936
+ * If a (or b) is an invalid version, it is considered greater than any version (strmp(undefined, "0.0.0") = 1)
1937
+ */
1933
1938
  function strcmp(a: string, b: string): number;
1934
1939
  function inRange(rng: string, v: Version): boolean;
1935
1940
  /**
package/built/pxtlib.js CHANGED
@@ -14242,15 +14242,22 @@ var pxt;
14242
14242
  // this may be an issue if the user does not create releases
14243
14243
  // and pulls from master
14244
14244
  const modtag = (modid === null || modid === void 0 ? void 0 : modid.tag) || ((_a = mod.config) === null || _a === void 0 ? void 0 : _a.version);
14245
+ const vertag = verid.tag;
14246
+ // if there is no tag on the current dependency,
14247
+ // assume same as existing module version if any
14248
+ if (modtag && !vertag) {
14249
+ pxt.debug(`unversioned ${ver}, using ${modtag}`);
14250
+ return;
14251
+ }
14245
14252
  const c = pxt.semver.strcmp(modtag, verid.tag);
14246
14253
  if (c == 0) {
14247
14254
  // turns out to be the same versions
14248
14255
  pxt.debug(`resolved version are ${modtag}`);
14249
14256
  return;
14250
14257
  }
14251
- else if (c < 0) {
14252
- // already loaded version of dependencies is greater
14253
- // than current version, use it instead
14258
+ else if (c > 0) {
14259
+ // already loaded version of dependencies (modtag) is greater
14260
+ // than current version (ver), use it instead
14254
14261
  pxt.debug(`auto-upgraded ${ver} to ${modtag}`);
14255
14262
  return;
14256
14263
  }
@@ -14276,6 +14283,28 @@ var pxt;
14276
14283
  pxt.debug(`dep: load ${from.id}.${id}${isCpp ? "++" : ""}: ${ver}`);
14277
14284
  if (id == "hw" && pxt.hwVariant)
14278
14285
  id = "hw---" + pxt.hwVariant;
14286
+ // for github references, make sure the version is compatible with previously
14287
+ // loaded references, regardless of the id
14288
+ const ghver = pxt.github.parseRepoId(ver);
14289
+ if (ghver === null || ghver === void 0 ? void 0 : ghver.slug) {
14290
+ // let's start by resolving the maximum version
14291
+ // number of the parent repo already loaded
14292
+ const repoVersions = Object.values(from.parent.deps)
14293
+ .map(p => pxt.github.parseRepoId(p._verspec))
14294
+ .filter(v => (v === null || v === void 0 ? void 0 : v.slug) === ghver.slug)
14295
+ .map(v => v.tag);
14296
+ const repoVersion = repoVersions
14297
+ .reduce((v1, v2) => pxt.semver.strcmp(v1, v2) > 0 ? v1 : v2, "0.0.0");
14298
+ pxt.debug(`dep: common repo ${ghver.slug} version found ${repoVersion}`);
14299
+ if (pxt.semver.strcmp(repoVersion, "0.0.0") > 0) {
14300
+ // now let's check if we have a higher version to use
14301
+ if (!ghver.tag || pxt.semver.strcmp(repoVersion, ghver.tag) > 0) {
14302
+ pxt.debug(`dep: upgrade from ${ghver.tag} to ${repoVersion}`);
14303
+ ghver.tag = repoVersion;
14304
+ ver = pxt.github.stringifyRepo(ghver);
14305
+ }
14306
+ }
14307
+ }
14279
14308
  let mod = from.resolveDep(id);
14280
14309
  if (mod) {
14281
14310
  // check if the current dependecy matches the ones
@@ -15148,6 +15177,11 @@ var pxt;
15148
15177
  return aa.major - bb.major;
15149
15178
  }
15150
15179
  semver.majorCmp = majorCmp;
15180
+ /**
15181
+ * Compares two semver version strings and returns -1 if a < b, 1 if a > b and 0
15182
+ * if versions are equivalent. If a and b are invalid versions, classic strcmp is called.
15183
+ * If a (or b) is an invalid version, it is considered greater than any version (strmp(undefined, "0.0.0") = 1)
15184
+ */
15151
15185
  function strcmp(a, b) {
15152
15186
  let aa = tryParse(a);
15153
15187
  let bb = tryParse(b);