pxt-core 9.0.7 → 9.0.9

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
@@ -2077,7 +2077,7 @@ async function buildTargetCoreAsync(options = {}) {
2077
2077
  if (pxt.appTarget.cacheusedblocksdirs)
2078
2078
  cfg.tutorialInfo = await internalCacheUsedBlocksAsync();
2079
2079
  await forEachBundledPkgAsync(async (pkg, dirname) => {
2080
- var _a, _b;
2080
+ var _a, _b, _c;
2081
2081
  pxt.log(`building bundled ${dirname}`);
2082
2082
  let isPrj = /prj$/.test(dirname);
2083
2083
  const isHw = /hw---/.test(dirname);
@@ -2111,12 +2111,12 @@ async function buildTargetCoreAsync(options = {}) {
2111
2111
  }
2112
2112
  }
2113
2113
  // For the projects, we need to save the base HEX file to the offline HEX cache
2114
- if (isPrj && pxt.appTarget.compile && pxt.appTarget.compile.hasHex) {
2114
+ if (isPrj && ((_a = pxt.appTarget.compile) === null || _a === void 0 ? void 0 : _a.hasHex)) {
2115
2115
  if (!pkgOptions) {
2116
2116
  pxt.debug(`Failed to extract native image for project ${dirname}`);
2117
2117
  return;
2118
2118
  }
2119
- const hexFileExtInfo = [pkgOptions.extinfo, ...(((_a = pkgOptions.otherMultiVariants) === null || _a === void 0 ? void 0 : _a.map(el => el.extinfo)) || [])];
2119
+ const hexFileExtInfo = [pkgOptions.extinfo, ...(((_b = pkgOptions.otherMultiVariants) === null || _b === void 0 ? void 0 : _b.map(el => el.extinfo)) || [])];
2120
2120
  for (const extinfo of hexFileExtInfo) {
2121
2121
  // Place the base HEX image in the hex cache if necessary
2122
2122
  let sha = extinfo.sha;
@@ -2137,24 +2137,25 @@ async function buildTargetCoreAsync(options = {}) {
2137
2137
  // We want to cache a hex file for each of the native packages in case they are added to a project.
2138
2138
  // This won't cover the whole matrix, but handles the common case of projects that add one extra
2139
2139
  // extension in the offline app.
2140
- const allDeps = pkg.sortedDeps(true).map(dep => path.resolve(path.join(dirname, dep.verArgument())))
2140
+ const allDeps = pkg.sortedDeps(true)
2141
+ .map(dep => path.resolve(path.join(dirname, dep.verArgument())))
2141
2142
  .map(dep => path.resolve(dep).replace(/---.*/, "")); // keep path format (/ vs \\) consistent, trim --- suffix to avoid duplicate imports.
2142
2143
  const config = nodeutil.readPkgConfig(dirname);
2143
2144
  const host = pkg.host();
2144
2145
  const pkgsToBuildWith = packageDirs.filter(dirname => !allDeps.some(el => el.indexOf(dirname.replace(/---.*/, "")) !== -1));
2145
- pxt.log(`Dependencies of pkg: ${allDeps}`);
2146
- pxt.log(`Attemping to bundle necessary hexfiles to compile with: ${pkgsToBuildWith}`);
2146
+ pxt.log(`Dependencies of base pkgs: ${allDeps.map(el => path.basename(el)).join(", ")}`);
2147
2147
  for (const extraPackage of pkgsToBuildWith) {
2148
+ const extraPathBaseName = path.basename(extraPackage);
2148
2149
  process.chdir(path.join(rootDir, dirname));
2149
- const deps = Object.assign(Object.assign({}, config.dependencies), { extra: "file:" + path.relative(path.resolve("."), extraPackage) });
2150
+ const deps = Object.assign(Object.assign({}, config.dependencies), { [extraPathBaseName]: "file:" + path.relative(path.resolve("."), extraPackage) });
2150
2151
  host.fileOverrides["pxt.json"] = JSON.stringify(Object.assign(Object.assign({}, config), { dependencies: deps }));
2151
- pxt.log(`Building hex cache for ${pkg.config.name} with dependencies:`);
2152
+ pxt.log(`Building hex cache for ${extraPathBaseName} with dependencies:`);
2152
2153
  console.dir(deps);
2153
2154
  mainPkg = new pxt.MainPackage(host);
2154
2155
  try {
2155
2156
  const extraRes = await testForBuildTargetAsync(true, null);
2156
2157
  if (extraRes) {
2157
- const hexFileExtInfo = [extraRes.options.extinfo, ...(((_b = extraRes.options.otherMultiVariants) === null || _b === void 0 ? void 0 : _b.map(el => el.extinfo)) || [])];
2158
+ const hexFileExtInfo = [extraRes.options.extinfo, ...(((_c = extraRes.options.otherMultiVariants) === null || _c === void 0 ? void 0 : _c.map(el => el.extinfo)) || [])];
2158
2159
  for (const extinfo of hexFileExtInfo) {
2159
2160
  // Place the base HEX image in the hex cache if necessary
2160
2161
  let sha = extinfo.sha;
@@ -2165,7 +2166,7 @@ async function buildTargetCoreAsync(options = {}) {
2165
2166
  }
2166
2167
  else {
2167
2168
  nodeutil.writeFileSync(hexFile, hex.join(os.EOL));
2168
- pxt.debug(`created native image in offline cache for project ${dirname}: ${hexFile}`);
2169
+ pxt.log(`created native image in offline cache for project ${dirname}: ${hexFile}`);
2169
2170
  }
2170
2171
  }
2171
2172
  }
package/built/pxt.js CHANGED
@@ -162729,7 +162729,7 @@ async function buildTargetCoreAsync(options = {}) {
162729
162729
  if (pxt.appTarget.cacheusedblocksdirs)
162730
162730
  cfg.tutorialInfo = await internalCacheUsedBlocksAsync();
162731
162731
  await forEachBundledPkgAsync(async (pkg, dirname) => {
162732
- var _a, _b;
162732
+ var _a, _b, _c;
162733
162733
  pxt.log(`building bundled ${dirname}`);
162734
162734
  let isPrj = /prj$/.test(dirname);
162735
162735
  const isHw = /hw---/.test(dirname);
@@ -162763,12 +162763,12 @@ async function buildTargetCoreAsync(options = {}) {
162763
162763
  }
162764
162764
  }
162765
162765
  // For the projects, we need to save the base HEX file to the offline HEX cache
162766
- if (isPrj && pxt.appTarget.compile && pxt.appTarget.compile.hasHex) {
162766
+ if (isPrj && ((_a = pxt.appTarget.compile) === null || _a === void 0 ? void 0 : _a.hasHex)) {
162767
162767
  if (!pkgOptions) {
162768
162768
  pxt.debug(`Failed to extract native image for project ${dirname}`);
162769
162769
  return;
162770
162770
  }
162771
- const hexFileExtInfo = [pkgOptions.extinfo, ...(((_a = pkgOptions.otherMultiVariants) === null || _a === void 0 ? void 0 : _a.map(el => el.extinfo)) || [])];
162771
+ const hexFileExtInfo = [pkgOptions.extinfo, ...(((_b = pkgOptions.otherMultiVariants) === null || _b === void 0 ? void 0 : _b.map(el => el.extinfo)) || [])];
162772
162772
  for (const extinfo of hexFileExtInfo) {
162773
162773
  // Place the base HEX image in the hex cache if necessary
162774
162774
  let sha = extinfo.sha;
@@ -162789,24 +162789,25 @@ async function buildTargetCoreAsync(options = {}) {
162789
162789
  // We want to cache a hex file for each of the native packages in case they are added to a project.
162790
162790
  // This won't cover the whole matrix, but handles the common case of projects that add one extra
162791
162791
  // extension in the offline app.
162792
- const allDeps = pkg.sortedDeps(true).map(dep => path.resolve(path.join(dirname, dep.verArgument())))
162792
+ const allDeps = pkg.sortedDeps(true)
162793
+ .map(dep => path.resolve(path.join(dirname, dep.verArgument())))
162793
162794
  .map(dep => path.resolve(dep).replace(/---.*/, "")); // keep path format (/ vs \\) consistent, trim --- suffix to avoid duplicate imports.
162794
162795
  const config = nodeutil.readPkgConfig(dirname);
162795
162796
  const host = pkg.host();
162796
162797
  const pkgsToBuildWith = packageDirs.filter(dirname => !allDeps.some(el => el.indexOf(dirname.replace(/---.*/, "")) !== -1));
162797
- pxt.log(`Dependencies of pkg: ${allDeps}`);
162798
- pxt.log(`Attemping to bundle necessary hexfiles to compile with: ${pkgsToBuildWith}`);
162798
+ pxt.log(`Dependencies of base pkgs: ${allDeps.map(el => path.basename(el)).join(", ")}`);
162799
162799
  for (const extraPackage of pkgsToBuildWith) {
162800
+ const extraPathBaseName = path.basename(extraPackage);
162800
162801
  process.chdir(path.join(rootDir, dirname));
162801
- const deps = Object.assign(Object.assign({}, config.dependencies), { extra: "file:" + path.relative(path.resolve("."), extraPackage) });
162802
+ const deps = Object.assign(Object.assign({}, config.dependencies), { [extraPathBaseName]: "file:" + path.relative(path.resolve("."), extraPackage) });
162802
162803
  host.fileOverrides["pxt.json"] = JSON.stringify(Object.assign(Object.assign({}, config), { dependencies: deps }));
162803
- pxt.log(`Building hex cache for ${pkg.config.name} with dependencies:`);
162804
+ pxt.log(`Building hex cache for ${extraPathBaseName} with dependencies:`);
162804
162805
  console.dir(deps);
162805
162806
  mainPkg = new pxt.MainPackage(host);
162806
162807
  try {
162807
162808
  const extraRes = await testForBuildTargetAsync(true, null);
162808
162809
  if (extraRes) {
162809
- const hexFileExtInfo = [extraRes.options.extinfo, ...(((_b = extraRes.options.otherMultiVariants) === null || _b === void 0 ? void 0 : _b.map(el => el.extinfo)) || [])];
162810
+ const hexFileExtInfo = [extraRes.options.extinfo, ...(((_c = extraRes.options.otherMultiVariants) === null || _c === void 0 ? void 0 : _c.map(el => el.extinfo)) || [])];
162810
162811
  for (const extinfo of hexFileExtInfo) {
162811
162812
  // Place the base HEX image in the hex cache if necessary
162812
162813
  let sha = extinfo.sha;
@@ -162817,7 +162818,7 @@ async function buildTargetCoreAsync(options = {}) {
162817
162818
  }
162818
162819
  else {
162819
162820
  nodeutil.writeFileSync(hexFile, hex.join(os.EOL));
162820
- pxt.debug(`created native image in offline cache for project ${dirname}: ${hexFile}`);
162821
+ pxt.log(`created native image in offline cache for project ${dirname}: ${hexFile}`);
162821
162822
  }
162822
162823
  }
162823
162824
  }