Skip to content

Commit fddfea2

Browse files
authored
remove hex info packaging (#11425)
* save using full 32 bits instead of seeing out upper 16 * cull the hex info, only keep the packaged extension content * Revert "save using full 32 bits instead of seeing out upper 16" This reverts commit 58a3866.
1 parent e205e60 commit fddfea2

4 files changed

Lines changed: 0 additions & 58 deletions

File tree

pxtlib/cpp.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,11 +1526,6 @@ namespace pxt.hexloader {
15261526
return JSON.stringify(cachedMeta);
15271527
}
15281528

1529-
export function storeHexInfoCacheEntryAsync(host: Host, sha: string, cachedHexInfo: string) {
1530-
if (!sha || !cachedHexInfo) return Promise.resolve();
1531-
return storeWithLimitAsync(host, "hex-keys", "hex-" + sha, cachedHexInfo);
1532-
}
1533-
15341529
export function getHexInfoAsync(host: Host, extInfo: pxtc.ExtensionInfo, cloudModule?: any): Promise<pxtc.HexInfo> {
15351530
if (!extInfo.sha)
15361531
return Promise.resolve<any>(null)

pxtlib/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ namespace pxt {
542542
export const TUTORIAL_INFO_FILE = "tutorial-info-cache.json";
543543
export const TUTORIAL_CUSTOM_TS = "tutorial.custom.ts";
544544
export const PACKAGED_EXTENSIONS = "_packaged-extensions.json";
545-
export const PACKAGED_EXT_INFO = "_packaged-ext-info.json";
546545
export const BREAKPOINT_TABLET = 991; // TODO (shakao) revisit when tutorial stuff is more settled
547546
export const PALETTES_FILE = "_palettes.json";
548547
export const HISTORY_FILE = "_history";

pxtlib/package.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,9 +1282,6 @@ namespace pxt {
12821282

12831283
if (!noFileEmbed) {
12841284
const files = await this.filesToBePublishedAsync(true, !appTarget.compile.useUF2)
1285-
const packagedExtInfo = this.packagedExtensionHexInfo(opts);
1286-
if (Object.keys(packagedExtInfo).length)
1287-
files[pxt.PACKAGED_EXT_INFO] = JSON.stringify(packagedExtInfo);
12881285
const headerString = JSON.stringify({
12891286
name: this.config.name,
12901287
comment: this.config.description,
@@ -1422,21 +1419,6 @@ namespace pxt {
14221419
return packaged;
14231420
}
14241421

1425-
private packagedExtensionHexInfo(opts: pxtc.CompileOptions): pxt.Map<string> {
1426-
const packaged: pxt.Map<string> = {};
1427-
const targets = [opts, ...(opts.otherMultiVariants || [])];
1428-
1429-
for (const target of targets) {
1430-
const extInfo = target.extinfo;
1431-
if (!extInfo?.sha || !extInfo.hexinfo?.hex) continue;
1432-
1433-
const serialized = pxt.hexloader.stringifyHexInfoForCache(extInfo.hexinfo);
1434-
if (serialized) packaged[extInfo.sha] = serialized;
1435-
}
1436-
1437-
return packaged;
1438-
}
1439-
14401422
saveToJsonAsync(): Promise<pxt.cpp.HexFile> {
14411423
return this.filesToBePublishedAsync(true)
14421424
.then(files => {

webapp/src/workspace.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -775,13 +775,7 @@ export async function installAsync(h0: InstallHeader, text: ScriptText, dontOver
775775
packagedExtensionFiles = pxt.Util.jsonTryParse(text[pxt.PACKAGED_EXTENSIONS]);
776776
delete text[pxt.PACKAGED_EXTENSIONS];
777777
}
778-
let packagedExtInfo: pxt.Map<string>;
779-
if (text[pxt.PACKAGED_EXT_INFO]) {
780-
packagedExtInfo = pxt.Util.jsonTryParse(text[pxt.PACKAGED_EXT_INFO]);
781-
delete text[pxt.PACKAGED_EXT_INFO];
782-
}
783778

784-
await cachePackagedExtInfoAsync(packagedExtInfo);
785779
await cachePackagedScriptExtensionsAsync(packagedExtensionFiles);
786780
await pxt.github.cacheProjectDependenciesAsync(cfg, packagedExtensionFiles)
787781
await importAsync(h, text);
@@ -815,34 +809,6 @@ async function cachePackagedScriptExtensionsAsync(packagedExtensionFiles?: pxt.M
815809
}));
816810
}
817811

818-
async function cachePackagedExtInfoAsync(packagedExtInfo?: pxt.Map<string>) {
819-
if (!packagedExtInfo) return;
820-
821-
const hostCache = await indexedDBWorkspace.getObjectStoreAsync<{ id: string, val: string }>(indexedDBWorkspace.HOSTCACHE_TABLE);
822-
const cacheHost = {
823-
cacheStoreAsync: async (id: string, val: string) => {
824-
await hostCache.setAsync({ id, val });
825-
},
826-
cacheGetAsync: async (id: string) => {
827-
try {
828-
return (await hostCache.getAsync(id)).val;
829-
}
830-
catch (e) {
831-
return null;
832-
}
833-
}
834-
} as pxt.Host;
835-
836-
await Promise.all(Object.keys(packagedExtInfo).map(async sha => {
837-
try {
838-
await pxt.hexloader.storeHexInfoCacheEntryAsync(cacheHost, sha, packagedExtInfo[sha]);
839-
}
840-
catch (e) {
841-
pxt.log("Unable to cache packaged extension hex info in DB");
842-
}
843-
}));
844-
}
845-
846812
export async function renameAsync(h: Header, newName: string): Promise<Header> {
847813
const text = await getTextAsync(h.id);
848814

0 commit comments

Comments
 (0)