makecode-core
Version:
MakeCode (PXT) - web-cached build tool
81 lines (80 loc) • 2.81 kB
TypeScript
/// <reference path="../external/pxtpackage.d.ts" />
export import downloader = require("./downloader");
export import files = require("./files");
export import service = require("./service");
export import loader = require("./loader");
export interface MkcJson {
targetWebsite: string;
hwVariant?: string;
links?: pxt.Map<string>;
overrides?: Partial<pxt.PackageConfig>;
include?: string[];
}
export interface Cache {
getAsync(key: string): Promise<Uint8Array>;
setAsync(key: string, val: Uint8Array): Promise<void>;
expandKey?(key: string): string;
rootPath?: string;
}
export interface DownloadedEditor {
cache: Cache;
versionNumber: number;
cdnUrl: string;
simUrl: string;
website: string;
pxtWorkerJs: string;
targetJson: any;
webConfig: downloader.WebConfig;
targetConfig: any;
}
export interface Package {
config: pxt.PackageConfig;
mkcConfig: MkcJson;
files: pxt.Map<string>;
fromTargetJson?: boolean;
}
export interface Workspace {
packages: pxt.Map<Package>;
}
export declare let cloudRoot: string;
export declare class Project {
directory: string;
protected cache: Cache;
editor: DownloadedEditor;
service: service.Ctx;
mainPkg: Package;
lastPxtJson: string;
private _hwVariant;
writePxtModules: boolean;
linkPxtModules: boolean;
symlinkPxtModules: boolean;
outputPrefix: string;
mkcConfig: MkcJson;
constructor(directory: string, cache?: Cache);
get hwVariant(): string;
set hwVariant(value: string);
guessHwVariantAsync(): Promise<void>;
protected readFileAsync(filename: string): Promise<string>;
protected saveBuiltFilesAsync(res: service.CompileResult): Promise<void>;
protected savePxtModulesAsync(filesmap0: pxt.Map<string>): Promise<void>;
readPxtConfig(): Promise<pxt.PackageConfig>;
protected readPackageAsync(): Promise<Package>;
loadPkgAsync(): Promise<void>;
updateEditorAsync(): Promise<boolean>;
loadEditorAsync(forceUpdate?: boolean): Promise<boolean>;
getCacheAsync(): Promise<Cache>;
maybeWritePxtModulesAsync(): Promise<void>;
linkedPackage(id: string): Promise<pxt.Map<string>>;
buildAsync(simpleOpts?: {}): Promise<service.CompileResult>;
buildSimJsInfoAsync(result: service.CompileResult): Promise<service.BuiltSimJsInfo>;
mkChildProjectAsync(folder: string): Promise<Project>;
}
export declare let log: (msg: string) => void;
export declare let error: (msg: string) => void;
export declare let debug: (msg: string) => void;
export declare function setLogging(fns: {
log: (msg: string) => void;
error: (msg: string) => void;
debug: (msg: string) => void;
}): void;
export declare function stringifyConfig(cfg: pxt.PackageConfig | MkcJson): string;