pxt-core 13.2.14 → 13.2.15

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../localtypings/pxtarget.d.ts" />
2
2
  /// <reference path="../localtypings/dompurify.d.ts" />
3
+ /// <reference path="../localtypings/pxtpackage.d.ts" />
3
4
  declare namespace pxt {
4
5
  interface TelemetryEventOptions {
5
6
  interactiveConsent: boolean;
@@ -57,6 +58,7 @@ declare namespace ts.pxtc {
57
58
  }
58
59
  import pxtc = ts.pxtc;
59
60
  declare namespace ts.pxtc.Util {
61
+ function contains(str: string, contains: string): boolean;
60
62
  function assert(cond: boolean, msg?: string): void;
61
63
  function flatClone<T extends Object>(obj: T): T;
62
64
  function clone<T>(v: T): T;
@@ -107,6 +109,38 @@ declare namespace ts.pxtc.Util {
107
109
  function deepEqual(a: any, b: any): boolean;
108
110
  }
109
111
  declare const lf: typeof pxtc.Util.lf;
112
+ declare namespace ts.pxtc {
113
+ /**
114
+ * atob replacement
115
+ * @param s
116
+ */
117
+ let decodeBase64: (s: string) => string;
118
+ /**
119
+ * bota replacement
120
+ * @param s
121
+ */
122
+ let encodeBase64: (s: string) => string;
123
+ }
124
+ declare namespace ts.pxtc.Util {
125
+ function iterMap<T>(m: pxt.Map<T>, f: (k: string, v: T) => void): void;
126
+ function values<T>(m: pxt.Map<T>): T[];
127
+ function pushRange<T>(trg: T[], src: ArrayLike<T>): void;
128
+ function concatArrayLike<T>(arrays: ArrayLike<ArrayLike<T>>): T[];
129
+ function concat<T>(arrays: T[][]): T[];
130
+ function jsonMergeFrom(trg: any, src: any): void;
131
+ function jsonCopyFrom<T>(trg: T, src: T): void;
132
+ function jsonFlatten(v: any): pxt.Map<any>;
133
+ function jsonUnFlatten(v: pxt.Map<any>): any;
134
+ function strcmp(a: string, b: string): 1 | -1 | 0;
135
+ function endsWith(str: string, suffix: string): boolean;
136
+ function startsWith(str: string, prefix: string): boolean;
137
+ function toUTF8(str: string, cesu8?: boolean): string;
138
+ function toUTF8Array(s: string): Uint8Array;
139
+ }
140
+ declare namespace pxt {
141
+ export import U = pxtc.Util;
142
+ export import Util = pxtc.Util;
143
+ }
110
144
  declare namespace pxt.docs {
111
145
  type MarkedRenderFunction = (src: string, options?: any) => string;
112
146
  interface MarkedRenderer {
@@ -188,3 +222,89 @@ declare namespace pxt.docs {
188
222
  export function hydrateYouTubeEmbeds(content: HTMLElement, tickEvent: boolean): void;
189
223
  export {};
190
224
  }
225
+ declare namespace ts.pxtc.BrowserImpl {
226
+ function sha256buffer(buf: Uint8Array): string;
227
+ }
228
+ declare namespace Measurements {
229
+ const TutorialInfoDbSetAsync = "tutorial info db setAsync";
230
+ const ReloadAppTargetVariant = "reloadAppTargetVariant";
231
+ const Sha256Buffer = "sha256buffer";
232
+ const WebworkerRecvHandler = "webworker recvHandler";
233
+ const NetworkRequest = "network.request";
234
+ }
235
+ declare namespace pxt.packageUtils {
236
+ function getVersionProtocol(version: string): string;
237
+ function isVariantDisabled(config: PackageConfig, variant: string): boolean;
238
+ function getConfigDependencies(config: PackageConfig, includeTests: boolean, includeCpp: boolean, isTestDependencyAvailable: (id: string, version: string) => boolean): Map<string>;
239
+ /** Evaluates fileDependencies with && taking precedence over ||, without reading target or package globals. */
240
+ function evaluateDependencyCondition(condition: string, target: Pick<AppTarget, "id" | "platformid">, hasDependency: (id: string) => boolean, onInvalidCondition: (condition: string) => void): boolean;
241
+ function getConfigFiles(config: PackageConfig, includeTests: boolean, target: Pick<AppTarget, "id" | "platformid">, hasDependency: (id: string) => boolean, onInvalidCondition: (condition: string, filename: string) => void): string[];
242
+ }
243
+ declare namespace pxt {
244
+ /** Resolves compile defaults and a variant without modifying the supplied target. */
245
+ function getAppTargetVariant(target: TargetBundle, variant: string): TargetBundle;
246
+ function patchCompileTarget(target: AppTarget): void;
247
+ }
248
+ declare namespace ts.pxtc.Util {
249
+ function cloneTargetBundle(target: pxt.TargetBundle): pxt.TargetBundle;
250
+ function cloneApis(byQName: pxt.Map<pxtc.SymbolInfo>): pxt.Map<SymbolInfo>;
251
+ function cloneSymbolInfo(sym: pxtc.SymbolInfo): pxtc.SymbolInfo;
252
+ }
253
+ declare namespace ts.pxtc {
254
+ function parseCommentString(cmt: string): CommentAttrs;
255
+ function updateBlockDef(attrs: CommentAttrs): void;
256
+ function parseBlockDefinition(def: string): ParsedBlockDef;
257
+ }
258
+ declare namespace pxt.github {
259
+ interface ParsedRepo {
260
+ owner?: string;
261
+ project?: string;
262
+ slug: string;
263
+ fullName: string;
264
+ tag?: string;
265
+ fileName?: string;
266
+ }
267
+ function parseRepoId(repo: string): ParsedRepo;
268
+ function stringifyRepo(p: ParsedRepo, ignoreCase?: boolean): string;
269
+ function join(...parts: string[]): string;
270
+ }
271
+ declare namespace ts.pxtc {
272
+ const NATIVE_TYPE_THUMB = "thumb";
273
+ const NATIVE_TYPE_VM = "vm";
274
+ function emptyExtInfo(compileService: pxt.TargetCompileService): ExtensionInfo;
275
+ }
276
+ declare namespace pxt.cpp {
277
+ function nsWriter(nskw?: string): {
278
+ setNs: (ns: string, over?: string) => void;
279
+ clear: () => void;
280
+ write: (s: string) => void;
281
+ incrIndent: () => void;
282
+ decrIndent: () => void;
283
+ finish: () => string;
284
+ };
285
+ function parseCppInt(v: string): number;
286
+ class PkgConflictError extends Error {
287
+ pkg0Id: string;
288
+ pkg1Id: string;
289
+ settingName: string;
290
+ isUserError: boolean;
291
+ isVersionConflict: boolean;
292
+ constructor(msg: string);
293
+ }
294
+ interface ExtensionInfoHost {
295
+ cache: Map<pxtc.ExtensionInfo>;
296
+ logger: Pick<Logger, "debug" | "log">;
297
+ perf: {
298
+ measureStart(name: string): void;
299
+ measureEnd(name: string): void;
300
+ };
301
+ }
302
+ /**
303
+ * Generates native extension files from pxt.json and project files, with dependencies
304
+ * under pxt_modules/<directory>/. Dependencies resolve by directory, pxt.json name,
305
+ * or their prefix before "---".
306
+ * The target must not have variant overrides applied.
307
+ * @example getExtensionInfo({ "pxt.json": config, "main.cpp": source }, target, "v2", host)
308
+ */
309
+ function getExtensionInfo(files: Map<string>, target: TargetBundle, variant: string, host: ExtensionInfoHost): pxtc.ExtensionInfo;
310
+ }