pxt-core 11.3.65 → 11.3.68

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 CHANGED
@@ -350,13 +350,9 @@ async function ciAsync() {
350
350
  if (!buildInfo.branch)
351
351
  buildInfo.branch = "local";
352
352
  const { tag, branch, pullRequest } = buildInfo;
353
- const atok = process.env.NPM_ACCESS_TOKEN;
354
- const npmPublish = /^v\d+\.\d+\.\d+$/.exec(tag) && atok;
353
+ const npmPublish = /^v\d+\.\d+\.\d+$/.exec(tag) && process.env.NPM_PUBLISH;
355
354
  if (npmPublish) {
356
- let npmrc = path.join(process.env.HOME, ".npmrc");
357
- pxt.log(`setting up ${npmrc}`);
358
- let cfg = "//registry.npmjs.org/:_authToken=" + atok + "\n";
359
- fs.writeFileSync(npmrc, cfg);
355
+ pxt.log(`npm publish is true`);
360
356
  }
361
357
  process.env["PXT_ENV"] = "production";
362
358
  const latest = branch == "master" ? "latest" : "git-" + branch;
@@ -379,12 +375,30 @@ async function ciAsync() {
379
375
  pxt.log(`upload docs: ${uploadDocs}`);
380
376
  lintJSONInDirectory(path.resolve("."));
381
377
  lintJSONInDirectory(path.resolve("docs"));
382
- function npmPublishAsync() {
378
+ let pkg = readJson("package.json");
379
+ async function npmPublishAsync() {
383
380
  if (!npmPublish)
384
381
  return Promise.resolve();
382
+ let latest;
383
+ try {
384
+ const version = await nodeutil.npmLatestVersionAsync(pkg["name"]);
385
+ latest = pxt.semver.parse(version);
386
+ }
387
+ catch (e) {
388
+ // no latest tag
389
+ }
390
+ let distTag;
391
+ if (latest) {
392
+ const current = pxt.semver.parse(pkg["version"]);
393
+ if (pxt.semver.cmp(current, latest) < 0) {
394
+ distTag = `stable${current.major}.${current.minor}`;
395
+ }
396
+ }
397
+ if (distTag) {
398
+ return nodeutil.runNpmAsync("publish", "--tag", distTag);
399
+ }
385
400
  return nodeutil.runNpmAsync("publish");
386
401
  }
387
- let pkg = readJson("package.json");
388
402
  if (pkg["name"] == "pxt-core") {
389
403
  pxt.log("pxt-core build");
390
404
  const isTaggedCommit = await checkIfTaggedCommitAsync();
@@ -23,6 +23,7 @@ export declare function spawnAsync(opts: SpawnOptions): Promise<void>;
23
23
  export declare function spawnWithPipeAsync(opts: SpawnOptions): Promise<Buffer>;
24
24
  export declare function addCmd(name: string): string;
25
25
  export declare function runNpmAsync(...args: string[]): Promise<void>;
26
+ export declare function npmLatestVersionAsync(packageName: string): Promise<string>;
26
27
  export interface NpmRegistry {
27
28
  _id: string;
28
29
  _name: string;
package/built/nodeutil.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringify = exports.lazyRequire = exports.lazyDependencies = exports.getBundledPackagesDocs = exports.resolveMd = exports.lastResolveMdDirs = exports.fileExistsSync = exports.openUrl = exports.writeFileSync = exports.existsDirSync = exports.allFiles = exports.cp = exports.cpR = exports.mkdirP = exports.pathToPtr = exports.getPxtTarget = exports.readPkgConfig = exports.readText = exports.readJson = exports.sanitizePath = exports.needsGitCleanAsync = exports.currGitTagAsync = exports.gitInfoAsync = exports.runGitAsync = exports.runNpmAsyncWithCwd = exports.npmRegistryAsync = exports.runNpmAsync = exports.addCmd = exports.spawnWithPipeAsync = exports.spawnAsync = exports.readResAsync = exports.setTargetDir = exports.runCliFinalizersAsync = exports.addCliFinalizer = exports.cliFinalizers = exports.pxtCoreDir = exports.targetDir = void 0;
3
+ exports.stringify = exports.lazyRequire = exports.lazyDependencies = exports.getBundledPackagesDocs = exports.resolveMd = exports.lastResolveMdDirs = exports.fileExistsSync = exports.openUrl = exports.writeFileSync = exports.existsDirSync = exports.allFiles = exports.cp = exports.cpR = exports.mkdirP = exports.pathToPtr = exports.getPxtTarget = exports.readPkgConfig = exports.readText = exports.readJson = exports.sanitizePath = exports.needsGitCleanAsync = exports.currGitTagAsync = exports.gitInfoAsync = exports.runGitAsync = exports.runNpmAsyncWithCwd = exports.npmRegistryAsync = exports.npmLatestVersionAsync = exports.runNpmAsync = exports.addCmd = exports.spawnWithPipeAsync = exports.spawnAsync = exports.readResAsync = exports.setTargetDir = exports.runCliFinalizersAsync = exports.addCliFinalizer = exports.cliFinalizers = exports.pxtCoreDir = exports.targetDir = void 0;
4
4
  const child_process = require("child_process");
5
5
  const fs = require("fs");
6
6
  const zlib = require("zlib");
@@ -100,6 +100,15 @@ function runNpmAsync(...args) {
100
100
  return runNpmAsyncWithCwd(".", ...args);
101
101
  }
102
102
  exports.runNpmAsync = runNpmAsync;
103
+ async function npmLatestVersionAsync(packageName) {
104
+ const output = await spawnWithPipeAsync({
105
+ cmd: addCmd("npm"),
106
+ args: ["view", packageName, "dist-tags.latest"],
107
+ cwd: ".",
108
+ });
109
+ return output.toString("utf8").trim();
110
+ }
111
+ exports.npmLatestVersionAsync = npmLatestVersionAsync;
103
112
  function npmRegistryAsync(pkg) {
104
113
  // TODO: use token if available
105
114
  return Util.httpGetJsonAsync(`https://registry.npmjs.org/${pkg}`);
package/built/pxt.js CHANGED
@@ -112015,6 +112015,7 @@ var pxt;
112015
112015
  let currentValue = null;
112016
112016
  let listStack = [];
112017
112017
  let currentIndent = 0;
112018
+ let currentCodeBlock = null;
112018
112019
  for (const line of lines) {
112019
112020
  if (!line.trim()) {
112020
112021
  if (currentValue) {
@@ -112022,6 +112023,33 @@ var pxt;
112022
112023
  }
112023
112024
  continue;
112024
112025
  }
112026
+ if (line.startsWith("```")) {
112027
+ if (currentCodeBlock) {
112028
+ if (currentSection) {
112029
+ if (!currentSection.codeBlocks) {
112030
+ currentSection.codeBlocks = [currentCodeBlock];
112031
+ }
112032
+ else {
112033
+ currentSection.codeBlocks.push(currentCodeBlock);
112034
+ }
112035
+ }
112036
+ currentCodeBlock = null;
112037
+ continue;
112038
+ }
112039
+ else {
112040
+ const match = /^```([a-zA-Z_\-]*)$/.exec(line);
112041
+ if (match) {
112042
+ currentCodeBlock = {
112043
+ content: "",
112044
+ languageCode: match[1]
112045
+ };
112046
+ continue;
112047
+ }
112048
+ }
112049
+ }
112050
+ else if (currentCodeBlock) {
112051
+ currentCodeBlock.content += line + "\n";
112052
+ }
112025
112053
  if (line.startsWith("#")) {
112026
112054
  const headerMatch = /^(#+)\s*(.+)$/.exec(line);
112027
112055
  if (headerMatch) {
@@ -117775,7 +117803,7 @@ var pxt;
117775
117803
  this.nextID = 0;
117776
117804
  this.nextInternalID = 0;
117777
117805
  this.committedState = {
117778
- revision: 0,
117806
+ revision: TilemapProject.nextRevision++,
117779
117807
  tilemaps: new AssetCollection(),
117780
117808
  tiles: new AssetCollection(),
117781
117809
  animations: new AssetCollection(),
@@ -117783,7 +117811,7 @@ var pxt;
117783
117811
  songs: new AssetCollection(),
117784
117812
  };
117785
117813
  this.state = {
117786
- revision: this.nextID++,
117814
+ revision: TilemapProject.nextRevision++,
117787
117815
  tilemaps: new AssetCollection(),
117788
117816
  tiles: new AssetCollection(),
117789
117817
  animations: new AssetCollection(),
@@ -117791,7 +117819,7 @@ var pxt;
117791
117819
  songs: new AssetCollection(),
117792
117820
  };
117793
117821
  this.gallery = {
117794
- revision: 0,
117822
+ revision: TilemapProject.nextRevision++,
117795
117823
  tilemaps: new AssetCollection(),
117796
117824
  tiles: new AssetCollection(),
117797
117825
  animations: new AssetCollection(),
@@ -118600,7 +118628,7 @@ var pxt;
118600
118628
  }
118601
118629
  onChange() {
118602
118630
  this.needsRebuild = true;
118603
- this.state.revision = this.nextID++;
118631
+ this.state.revision = TilemapProject.nextRevision++;
118604
118632
  }
118605
118633
  readImages(allJRes, isProjectFile = false) {
118606
118634
  const assets = [];
@@ -118640,6 +118668,7 @@ var pxt;
118640
118668
  }
118641
118669
  }
118642
118670
  }
118671
+ TilemapProject.nextRevision = 0;
118643
118672
  pxt.TilemapProject = TilemapProject;
118644
118673
  function getTilemaps(allJRes) {
118645
118674
  const res = [];
@@ -161710,13 +161739,9 @@ async function ciAsync() {
161710
161739
  if (!buildInfo.branch)
161711
161740
  buildInfo.branch = "local";
161712
161741
  const { tag, branch, pullRequest } = buildInfo;
161713
- const atok = process.env.NPM_ACCESS_TOKEN;
161714
- const npmPublish = /^v\d+\.\d+\.\d+$/.exec(tag) && atok;
161742
+ const npmPublish = /^v\d+\.\d+\.\d+$/.exec(tag) && process.env.NPM_PUBLISH;
161715
161743
  if (npmPublish) {
161716
- let npmrc = path.join(process.env.HOME, ".npmrc");
161717
- pxt.log(`setting up ${npmrc}`);
161718
- let cfg = "//registry.npmjs.org/:_authToken=" + atok + "\n";
161719
- fs.writeFileSync(npmrc, cfg);
161744
+ pxt.log(`npm publish is true`);
161720
161745
  }
161721
161746
  process.env["PXT_ENV"] = "production";
161722
161747
  const latest = branch == "master" ? "latest" : "git-" + branch;
@@ -161739,12 +161764,30 @@ async function ciAsync() {
161739
161764
  pxt.log(`upload docs: ${uploadDocs}`);
161740
161765
  lintJSONInDirectory(path.resolve("."));
161741
161766
  lintJSONInDirectory(path.resolve("docs"));
161742
- function npmPublishAsync() {
161767
+ let pkg = readJson("package.json");
161768
+ async function npmPublishAsync() {
161743
161769
  if (!npmPublish)
161744
161770
  return Promise.resolve();
161771
+ let latest;
161772
+ try {
161773
+ const version = await nodeutil.npmLatestVersionAsync(pkg["name"]);
161774
+ latest = pxt.semver.parse(version);
161775
+ }
161776
+ catch (e) {
161777
+ // no latest tag
161778
+ }
161779
+ let distTag;
161780
+ if (latest) {
161781
+ const current = pxt.semver.parse(pkg["version"]);
161782
+ if (pxt.semver.cmp(current, latest) < 0) {
161783
+ distTag = `stable${current.major}.${current.minor}`;
161784
+ }
161785
+ }
161786
+ if (distTag) {
161787
+ return nodeutil.runNpmAsync("publish", "--tag", distTag);
161788
+ }
161745
161789
  return nodeutil.runNpmAsync("publish");
161746
161790
  }
161747
- let pkg = readJson("package.json");
161748
161791
  if (pkg["name"] == "pxt-core") {
161749
161792
  pxt.log("pxt-core build");
161750
161793
  const isTaggedCommit = await checkIfTaggedCommitAsync();
@@ -13,9 +13,11 @@ export declare type TilesetDropdownOption = [ImageJSON, string, pxt.Tile];
13
13
  export declare class FieldTileset extends FieldImages implements FieldCustom {
14
14
  protected selectedOption_: TilesetDropdownOption;
15
15
  protected static referencedTiles: TilesetDropdownOption[];
16
+ protected static cachedPalette: string;
16
17
  protected static cachedRevision: number;
17
- protected static cachedWorkspaceId: string;
18
+ protected static bitmapCache: Map<string, string>;
18
19
  protected static getReferencedTiles(workspace: Blockly.Workspace): TilesetDropdownOption[];
20
+ static getTileImage(t: pxt.Tile): string;
19
21
  isFieldCustom_: boolean;
20
22
  protected selected: pxt.Tile;
21
23
  protected blocksInfo: pxtc.BlocksInfo;
package/built/pxtlib.d.ts CHANGED
@@ -1951,6 +1951,11 @@ declare namespace pxt {
1951
1951
  header: string;
1952
1952
  attributes: pxt.Map<string>;
1953
1953
  listAttributes?: pxt.Map<MarkdownList>;
1954
+ codeBlocks?: MarkdownCodeBlock[];
1955
+ }
1956
+ interface MarkdownCodeBlock {
1957
+ content: string;
1958
+ languageCode?: string;
1954
1959
  }
1955
1960
  interface MarkdownList {
1956
1961
  key: string;
@@ -2986,6 +2991,7 @@ declare namespace pxt {
2986
2991
  }
2987
2992
  export class TilemapProject {
2988
2993
  needsRebuild: boolean;
2994
+ protected static nextRevision: number;
2989
2995
  protected extensionTileSets: TileSetCollection[];
2990
2996
  protected state: AssetSnapshot;
2991
2997
  protected committedState: AssetSnapshot;
package/built/pxtlib.js CHANGED
@@ -14329,6 +14329,7 @@ var pxt;
14329
14329
  let currentValue = null;
14330
14330
  let listStack = [];
14331
14331
  let currentIndent = 0;
14332
+ let currentCodeBlock = null;
14332
14333
  for (const line of lines) {
14333
14334
  if (!line.trim()) {
14334
14335
  if (currentValue) {
@@ -14336,6 +14337,33 @@ var pxt;
14336
14337
  }
14337
14338
  continue;
14338
14339
  }
14340
+ if (line.startsWith("```")) {
14341
+ if (currentCodeBlock) {
14342
+ if (currentSection) {
14343
+ if (!currentSection.codeBlocks) {
14344
+ currentSection.codeBlocks = [currentCodeBlock];
14345
+ }
14346
+ else {
14347
+ currentSection.codeBlocks.push(currentCodeBlock);
14348
+ }
14349
+ }
14350
+ currentCodeBlock = null;
14351
+ continue;
14352
+ }
14353
+ else {
14354
+ const match = /^```([a-zA-Z_\-]*)$/.exec(line);
14355
+ if (match) {
14356
+ currentCodeBlock = {
14357
+ content: "",
14358
+ languageCode: match[1]
14359
+ };
14360
+ continue;
14361
+ }
14362
+ }
14363
+ }
14364
+ else if (currentCodeBlock) {
14365
+ currentCodeBlock.content += line + "\n";
14366
+ }
14339
14367
  if (line.startsWith("#")) {
14340
14368
  const headerMatch = /^(#+)\s*(.+)$/.exec(line);
14341
14369
  if (headerMatch) {
@@ -20089,7 +20117,7 @@ var pxt;
20089
20117
  this.nextID = 0;
20090
20118
  this.nextInternalID = 0;
20091
20119
  this.committedState = {
20092
- revision: 0,
20120
+ revision: TilemapProject.nextRevision++,
20093
20121
  tilemaps: new AssetCollection(),
20094
20122
  tiles: new AssetCollection(),
20095
20123
  animations: new AssetCollection(),
@@ -20097,7 +20125,7 @@ var pxt;
20097
20125
  songs: new AssetCollection(),
20098
20126
  };
20099
20127
  this.state = {
20100
- revision: this.nextID++,
20128
+ revision: TilemapProject.nextRevision++,
20101
20129
  tilemaps: new AssetCollection(),
20102
20130
  tiles: new AssetCollection(),
20103
20131
  animations: new AssetCollection(),
@@ -20105,7 +20133,7 @@ var pxt;
20105
20133
  songs: new AssetCollection(),
20106
20134
  };
20107
20135
  this.gallery = {
20108
- revision: 0,
20136
+ revision: TilemapProject.nextRevision++,
20109
20137
  tilemaps: new AssetCollection(),
20110
20138
  tiles: new AssetCollection(),
20111
20139
  animations: new AssetCollection(),
@@ -20914,7 +20942,7 @@ var pxt;
20914
20942
  }
20915
20943
  onChange() {
20916
20944
  this.needsRebuild = true;
20917
- this.state.revision = this.nextID++;
20945
+ this.state.revision = TilemapProject.nextRevision++;
20918
20946
  }
20919
20947
  readImages(allJRes, isProjectFile = false) {
20920
20948
  const assets = [];
@@ -20954,6 +20982,7 @@ var pxt;
20954
20982
  }
20955
20983
  }
20956
20984
  }
20985
+ TilemapProject.nextRevision = 0;
20957
20986
  pxt.TilemapProject = TilemapProject;
20958
20987
  function getTilemaps(allJRes) {
20959
20988
  const res = [];