@blastlauncher/web 0.0.0-stage → 3.0.0-alpha.0

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.
Files changed (46) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +85 -2
  3. package/assets/almostnode.mjs +735 -0
  4. package/assets/blast-sources.json +1 -0
  5. package/assets/blast-web.js +35 -0
  6. package/assets/esbuild.mjs +2695 -0
  7. package/assets/esbuild.wasm +0 -0
  8. package/dist/browser-bundle.d.ts +54 -0
  9. package/dist/browser-bundle.js +441 -0
  10. package/dist/browser-install.d.ts +66 -0
  11. package/dist/browser-install.js +326 -0
  12. package/dist/bundle-config.d.ts +10 -0
  13. package/dist/bundle-config.js +31 -0
  14. package/dist/bundles.d.ts +29 -0
  15. package/dist/bundles.js +126 -0
  16. package/dist/capabilities.d.ts +66 -0
  17. package/dist/capabilities.js +288 -0
  18. package/dist/custom-element.d.ts +6 -0
  19. package/dist/custom-element.js +36 -0
  20. package/dist/default-renderer.d.ts +27 -0
  21. package/dist/default-renderer.js +145 -0
  22. package/dist/default-styles.d.ts +2 -0
  23. package/dist/default-styles.js +28 -0
  24. package/dist/extension-files.d.ts +21 -0
  25. package/dist/extension-files.js +86 -0
  26. package/dist/handlers.d.ts +18 -0
  27. package/dist/handlers.js +22 -0
  28. package/dist/index.d.ts +14 -0
  29. package/dist/index.js +17 -0
  30. package/dist/launch.d.ts +11 -0
  31. package/dist/launch.js +29 -0
  32. package/dist/prebuilt.d.ts +24 -0
  33. package/dist/prebuilt.js +112 -0
  34. package/dist/render.d.ts +62 -0
  35. package/dist/render.js +288 -0
  36. package/dist/runtime-port.d.ts +5 -0
  37. package/dist/runtime-port.js +8 -0
  38. package/dist/sandbox.d.ts +25 -0
  39. package/dist/sandbox.js +71 -0
  40. package/dist/session.d.ts +77 -0
  41. package/dist/session.js +520 -0
  42. package/dist/source.d.ts +16 -0
  43. package/dist/source.js +42 -0
  44. package/package.json +33 -4
  45. package/sandbox/almostnode-full.mjs +19713 -0
  46. package/sandbox/index.html +1 -0
Binary file
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Browser bundling has deliberately no filesystem fallback. The caller owns
3
+ * both maps, which makes this module usable with esbuild-wasm as well as the
4
+ * native esbuild used by the tests.
5
+ */
6
+ export type BrowserBundleFile = string | Uint8Array;
7
+ export type BrowserEsbuild = {
8
+ build(options: object): Promise<{
9
+ outputFiles: Array<{
10
+ text: string;
11
+ contents: Uint8Array;
12
+ }> | undefined;
13
+ warnings: Array<{
14
+ text: string;
15
+ }> | undefined;
16
+ }>;
17
+ };
18
+ export type BrowserBundleOptions = {
19
+ esbuild: BrowserEsbuild;
20
+ files: Map<string, BrowserBundleFile>;
21
+ packages: Map<string, BrowserBundleFile>;
22
+ /** In-memory path to the extension command module. */
23
+ command: string;
24
+ /** In-memory path to the runtime browser entry. */
25
+ runtimeEntry: string;
26
+ /** Explicit specifier-to-file aliases for supplied runtime modules. */
27
+ aliases?: Record<string, string>;
28
+ sharedRuntime?: boolean;
29
+ sharedModules?: string[];
30
+ entryCode?: string;
31
+ };
32
+ export type BrowserBundle = {
33
+ code: string;
34
+ warnings: string[];
35
+ bytes: number;
36
+ };
37
+ export declare class BrowserMissingFileError extends Error {
38
+ readonly code = "BROWSER_MISSING_FILE";
39
+ readonly path: string;
40
+ constructor(path: string);
41
+ }
42
+ export declare class BrowserMissingDependencyError extends Error {
43
+ readonly code = "BROWSER_MISSING_DEPENDENCY";
44
+ readonly packages: string[];
45
+ constructor(packages: Iterable<string>);
46
+ }
47
+ export declare class BrowserNativeModuleError extends Error {
48
+ readonly code = "BROWSER_NATIVE_MODULE";
49
+ readonly modules: string[];
50
+ constructor(modules: Iterable<string>);
51
+ }
52
+ export declare const browserBuiltinModules: readonly ["_http_agent", "_http_client", "_http_common", "_http_incoming", "_http_outgoing", "_http_server", "_stream_duplex", "_stream_passthrough", "_stream_readable", "_stream_transform", "_stream_wrap", "_stream_writable", "_tls_common", "_tls_wrap", "assert", "assert/strict", "async_hooks", "buffer", "child_process", "cluster", "console", "constants", "crypto", "dgram", "diagnostics_channel", "dns", "dns/promises", "domain", "events", "fs", "fs/promises", "http", "http2", "https", "inspector", "inspector/promises", "module", "net", "os", "path", "path/posix", "path/win32", "perf_hooks", "process", "punycode", "querystring", "readline", "readline/promises", "repl", "stream", "stream/consumers", "stream/promises", "stream/web", "string_decoder", "sys", "timers", "timers/promises", "tls", "trace_events", "tty", "url", "util", "util/types", "v8", "vm", "wasi", "worker_threads", "zlib", "node:sea", "node:sqlite", "node:test", "node:test/reporters"];
53
+ /** Bundle an in-memory command and browser runtime with an injected esbuild. */
54
+ export declare function bundleForBrowser(options: BrowserBundleOptions): Promise<BrowserBundle>;
@@ -0,0 +1,441 @@
1
+ /**
2
+ * Browser bundling has deliberately no filesystem fallback. The caller owns
3
+ * both maps, which makes this module usable with esbuild-wasm as well as the
4
+ * native esbuild used by the tests.
5
+ */
6
+ export class BrowserMissingFileError extends Error {
7
+ code = "BROWSER_MISSING_FILE";
8
+ path;
9
+ constructor(path) {
10
+ super(`Browser bundle file is missing: ${path}`);
11
+ this.name = "BrowserMissingFileError";
12
+ this.path = path;
13
+ }
14
+ }
15
+ export class BrowserMissingDependencyError extends Error {
16
+ code = "BROWSER_MISSING_DEPENDENCY";
17
+ packages;
18
+ constructor(packages) {
19
+ const names = [...new Set(packages)].toSorted();
20
+ super(`Browser bundle dependencies are missing: ${names.join(", ")}`);
21
+ this.name = "BrowserMissingDependencyError";
22
+ this.packages = names;
23
+ }
24
+ }
25
+ export class BrowserNativeModuleError extends Error {
26
+ code = "BROWSER_NATIVE_MODULE";
27
+ modules;
28
+ constructor(modules) {
29
+ const names = [...new Set(modules)].toSorted();
30
+ super(`Native modules are not supported in a browser bundle: ${names.join(", ")}`);
31
+ this.name = "BrowserNativeModuleError";
32
+ this.modules = names;
33
+ }
34
+ }
35
+ const extensions = [".tsx", ".ts", ".jsx", ".js", ".json"];
36
+ // Keep this list in sync with Node 24's module.builtinModules. The browser
37
+ // resolver cannot import node:module to discover it at runtime.
38
+ export const browserBuiltinModules = [
39
+ "_http_agent",
40
+ "_http_client",
41
+ "_http_common",
42
+ "_http_incoming",
43
+ "_http_outgoing",
44
+ "_http_server",
45
+ "_stream_duplex",
46
+ "_stream_passthrough",
47
+ "_stream_readable",
48
+ "_stream_transform",
49
+ "_stream_wrap",
50
+ "_stream_writable",
51
+ "_tls_common",
52
+ "_tls_wrap",
53
+ "assert",
54
+ "assert/strict",
55
+ "async_hooks",
56
+ "buffer",
57
+ "child_process",
58
+ "cluster",
59
+ "console",
60
+ "constants",
61
+ "crypto",
62
+ "dgram",
63
+ "diagnostics_channel",
64
+ "dns",
65
+ "dns/promises",
66
+ "domain",
67
+ "events",
68
+ "fs",
69
+ "fs/promises",
70
+ "http",
71
+ "http2",
72
+ "https",
73
+ "inspector",
74
+ "inspector/promises",
75
+ "module",
76
+ "net",
77
+ "os",
78
+ "path",
79
+ "path/posix",
80
+ "path/win32",
81
+ "perf_hooks",
82
+ "process",
83
+ "punycode",
84
+ "querystring",
85
+ "readline",
86
+ "readline/promises",
87
+ "repl",
88
+ "stream",
89
+ "stream/consumers",
90
+ "stream/promises",
91
+ "stream/web",
92
+ "string_decoder",
93
+ "sys",
94
+ "timers",
95
+ "timers/promises",
96
+ "tls",
97
+ "trace_events",
98
+ "tty",
99
+ "url",
100
+ "util",
101
+ "util/types",
102
+ "v8",
103
+ "vm",
104
+ "wasi",
105
+ "worker_threads",
106
+ "zlib",
107
+ "node:sea",
108
+ "node:sqlite",
109
+ "node:test",
110
+ "node:test/reporters",
111
+ ];
112
+ const builtin = new Set(browserBuiltinModules);
113
+ const nativePackages = new Set([
114
+ "better-sqlite3",
115
+ "canvas",
116
+ "fsevents",
117
+ "keytar",
118
+ "node-gyp-build",
119
+ "sharp",
120
+ "sqlite3",
121
+ ]);
122
+ function clean(path) {
123
+ const parts = [];
124
+ for (const part of path.replaceAll("\\", "/").split("/")) {
125
+ if (!part || part === ".")
126
+ continue;
127
+ if (part === "..")
128
+ parts.pop();
129
+ else
130
+ parts.push(part);
131
+ }
132
+ return `/${parts.join("/")}`;
133
+ }
134
+ function packageName(specifier) {
135
+ return specifier.startsWith("@")
136
+ ? specifier.split("/").slice(0, 2).join("/")
137
+ : specifier.split("/")[0];
138
+ }
139
+ function isBuiltin(specifier) {
140
+ return specifier.startsWith("node:") || builtin.has(specifier);
141
+ }
142
+ function loader(path) {
143
+ const extension = extensions.find((item) => path.endsWith(item));
144
+ if (extension === ".tsx")
145
+ return "tsx";
146
+ if (extension === ".ts")
147
+ return "ts";
148
+ if (extension === ".jsx")
149
+ return "jsx";
150
+ if (extension === ".json")
151
+ return "json";
152
+ return "js";
153
+ }
154
+ function asText(value) {
155
+ return value;
156
+ }
157
+ function text(value) {
158
+ return typeof value === "string" ? value : new TextDecoder().decode(value);
159
+ }
160
+ function findFile(map, path) {
161
+ const base = clean(path);
162
+ // TypeScript source is commonly imported with the emitted `.js` extension;
163
+ // try the source extensions in its place, as TypeScript's own resolver does.
164
+ const sourceBase = base.replace(/\.[cm]?jsx?$/, "");
165
+ const candidates = [
166
+ base,
167
+ ...(sourceBase === base ? [] : extensions.map((extension) => `${sourceBase}${extension}`)),
168
+ ...extensions.map((extension) => `${base}${extension}`),
169
+ `${base}/index.ts`,
170
+ `${base}/index.tsx`,
171
+ `${base}/index.js`,
172
+ `${base}/index.json`,
173
+ ];
174
+ for (const candidate of candidates) {
175
+ if (map.has(candidate))
176
+ return candidate;
177
+ const withoutLeading = candidate.slice(1);
178
+ if (map.has(withoutLeading))
179
+ return withoutLeading;
180
+ }
181
+ return undefined;
182
+ }
183
+ function packageJson(map, root) {
184
+ const key = findFile(map, `${root}/package.json`);
185
+ if (!key)
186
+ return undefined;
187
+ try {
188
+ const parsed = JSON.parse(text(map.get(key)));
189
+ return parsed && typeof parsed === "object" ? parsed : undefined;
190
+ }
191
+ catch {
192
+ return undefined;
193
+ }
194
+ }
195
+ function packageRoots(map, importer, name) {
196
+ const roots = [];
197
+ let dir = clean(importer.slice(0, importer.lastIndexOf("/")) || "/");
198
+ while (true) {
199
+ const root = clean(`${dir}/node_modules/${name}`);
200
+ if (map.has(root) ||
201
+ map.has(root.slice(1)) ||
202
+ [...map.keys()].some((key) => clean(key).startsWith(`${root}/`))) {
203
+ roots.push(root);
204
+ }
205
+ if (dir === "/")
206
+ break;
207
+ dir = clean(`${dir}/..`);
208
+ }
209
+ const direct = `/${name}`;
210
+ if (map.has(direct) ||
211
+ map.has(name) ||
212
+ [...map.keys()].some((key) => clean(key).startsWith(`${direct}/`)))
213
+ roots.push(direct);
214
+ return [...new Set(roots)];
215
+ }
216
+ function exportTarget(value, subpath) {
217
+ if (typeof value === "string")
218
+ return value;
219
+ if (value === null || value === false)
220
+ return false;
221
+ if (Array.isArray(value)) {
222
+ for (const item of value) {
223
+ const resolved = exportTarget(item, subpath);
224
+ if (resolved !== undefined && resolved !== false)
225
+ return resolved;
226
+ }
227
+ return undefined;
228
+ }
229
+ if (!value || typeof value !== "object")
230
+ return undefined;
231
+ const record = value;
232
+ const subkeys = Object.keys(record).filter((key) => key.startsWith("."));
233
+ if (subkeys.length) {
234
+ const exact = record[subpath];
235
+ if (exact !== undefined)
236
+ return exportTarget(exact, subpath);
237
+ const pattern = subkeys
238
+ .filter((key) => key.endsWith("*") && subpath.startsWith(key.slice(0, -1)))
239
+ .toSorted((a, b) => b.length - a.length)[0];
240
+ if (pattern) {
241
+ const resolved = exportTarget(record[pattern], subpath);
242
+ return typeof resolved === "string"
243
+ ? resolved.replaceAll("*", subpath.slice(pattern.length - 1))
244
+ : resolved;
245
+ }
246
+ return undefined;
247
+ }
248
+ for (const condition of ["browser", "import", "module", "require", "default"]) {
249
+ if (record[condition] !== undefined) {
250
+ const resolved = exportTarget(record[condition], subpath);
251
+ if (resolved !== undefined)
252
+ return resolved;
253
+ }
254
+ }
255
+ return undefined;
256
+ }
257
+ function packageCandidates(map, specifier, importer) {
258
+ const name = packageName(specifier);
259
+ const subpath = specifier.slice(name.length).replace(/^\//, "");
260
+ for (const root of packageRoots(map, importer, name)) {
261
+ const metadata = packageJson(map, root);
262
+ const requested = subpath ? `./${subpath}` : ".";
263
+ if (metadata?.exports !== undefined) {
264
+ const target = exportTarget(metadata.exports, requested);
265
+ // Once the nearest package has an exports map, unexported subpaths are
266
+ // blocked; Node does not fall through to a parent node_modules copy.
267
+ if (target === false || target === undefined)
268
+ return [];
269
+ const candidate = findFile(map, clean(`${root}/${target}`));
270
+ return candidate ? [candidate] : [];
271
+ }
272
+ const base = subpath ? clean(`${root}/${subpath}`) : undefined;
273
+ if (base) {
274
+ const candidate = findFile(map, base);
275
+ if (candidate)
276
+ return [candidate];
277
+ continue;
278
+ }
279
+ const browser = metadata?.browser;
280
+ if (typeof browser === "string") {
281
+ const candidate = findFile(map, clean(`${root}/${browser}`));
282
+ if (candidate)
283
+ return [candidate];
284
+ }
285
+ const candidates = [];
286
+ const main = typeof metadata?.module === "string"
287
+ ? metadata.module
288
+ : typeof metadata?.main === "string"
289
+ ? metadata.main
290
+ : "index";
291
+ if (typeof browser === "object" && browser) {
292
+ const mapped = browser[`./${main}`] ??
293
+ browser["."];
294
+ if (typeof mapped === "string")
295
+ candidates.push(clean(`${root}/${mapped}`));
296
+ }
297
+ candidates.push(clean(`${root}/${main}`));
298
+ if (typeof metadata?.main === "string" && typeof metadata?.module === "string")
299
+ candidates.push(clean(`${root}/${metadata.main}`));
300
+ candidates.push(clean(`${root}/index`));
301
+ for (const candidate of candidates) {
302
+ const found = findFile(map, candidate);
303
+ if (found)
304
+ return [found];
305
+ }
306
+ }
307
+ return [];
308
+ }
309
+ /** Bundle an in-memory command and browser runtime with an injected esbuild. */
310
+ export async function bundleForBrowser(options) {
311
+ const files = new Map([...options.files, ...options.packages]);
312
+ const command = findFile(files, options.command);
313
+ const runtimeEntry = findFile(files, options.runtimeEntry);
314
+ if (!command)
315
+ throw new BrowserMissingFileError(options.command);
316
+ if (!runtimeEntry)
317
+ throw new BrowserMissingFileError(options.runtimeEntry);
318
+ const missing = new Set();
319
+ const native = new Set();
320
+ const missingFiles = new Set();
321
+ const virtualEntry = "/__blast_browser_bundle_entry__.js";
322
+ const plugin = {
323
+ name: "blast-browser-memory",
324
+ setup(build) {
325
+ build.onResolve({ filter: /.*/ }, (args) => {
326
+ const specifier = args.path;
327
+ if (args.kind === "entry-point") {
328
+ if (specifier === virtualEntry)
329
+ return { path: virtualEntry };
330
+ const entry = findFile(files, specifier);
331
+ return entry ? { path: entry } : undefined;
332
+ }
333
+ if (options.sharedRuntime && options.sharedModules?.includes(specifier))
334
+ return { path: `/__blast_shared_${specifier.replaceAll("/", "_")}` };
335
+ const alias = options.aliases?.[specifier];
336
+ if (alias)
337
+ return { path: findFile(files, alias) ?? alias };
338
+ if (isBuiltin(specifier))
339
+ return { path: specifier, external: true };
340
+ if (specifier.endsWith(".node")) {
341
+ native.add(specifier);
342
+ return { errors: [{ text: `Native module ${specifier} is not supported` }] };
343
+ }
344
+ if (!specifier.startsWith(".") &&
345
+ !specifier.startsWith("/") &&
346
+ nativePackages.has(packageName(specifier))) {
347
+ native.add(packageName(specifier));
348
+ return {
349
+ errors: [{ text: `Native package ${packageName(specifier)} is not supported` }],
350
+ };
351
+ }
352
+ if (specifier === "@blastlauncher/command")
353
+ return { path: command };
354
+ const relative = specifier.startsWith(".") || specifier.startsWith("/");
355
+ const candidate = relative
356
+ ? findFile(files, clean(`${args.importer.slice(0, args.importer.lastIndexOf("/"))}/${specifier}`))
357
+ : alias
358
+ ? findFile(files, alias)
359
+ : packageCandidates(files, specifier, args.importer)
360
+ .map((path) => findFile(files, path))
361
+ .find(Boolean);
362
+ if (candidate)
363
+ return { path: candidate.startsWith("/") ? candidate : `/${candidate}` };
364
+ if (!relative) {
365
+ missing.add(packageName(specifier));
366
+ return { errors: [{ text: `Missing browser dependency ${packageName(specifier)}` }] };
367
+ }
368
+ missingFiles.add(specifier);
369
+ return { errors: [{ text: `Missing browser file ${specifier}` }] };
370
+ });
371
+ build.onLoad({ filter: /.*/ }, (args) => {
372
+ if (args.path === virtualEntry) {
373
+ return {
374
+ contents: options.entryCode
375
+ ? options.entryCode
376
+ : options.sharedRuntime
377
+ ? `const __blastRuntime = globalThis.__blastRuntime;\nif (typeof __blastRuntime?.start === "function") __blastRuntime.start(async () => { const __blastCommand = await import(${JSON.stringify(command)}); return { ...__blastCommand, default: __blastCommand.default ?? __blastCommand }; });`
378
+ : `import * as __blastRuntime from ${JSON.stringify(runtimeEntry)};\nif (typeof __blastRuntime.start === "function") __blastRuntime.start(async () => { const __blastCommand = await import(${JSON.stringify(command)}); return { ...__blastCommand, default: __blastCommand.default ?? __blastCommand }; });`,
379
+ loader: "js",
380
+ resolveDir: "/",
381
+ };
382
+ }
383
+ if (args.path.startsWith("/__blast_shared_")) {
384
+ const specifier = args.path.slice("/__blast_shared_".length).replaceAll("_", "/");
385
+ return {
386
+ contents: `module.exports = globalThis.__blastModules[${JSON.stringify(specifier)}];`,
387
+ loader: "js",
388
+ };
389
+ }
390
+ const key = findFile(files, args.path);
391
+ if (!key)
392
+ return { errors: [{ text: `Missing browser file ${args.path}` }] };
393
+ return {
394
+ contents: asText(files.get(key)),
395
+ loader: loader(key),
396
+ resolveDir: clean(key.slice(0, key.lastIndexOf("/"))),
397
+ };
398
+ });
399
+ },
400
+ };
401
+ const result = await options.esbuild
402
+ .build({
403
+ absWorkingDir: "/",
404
+ entryPoints: [virtualEntry],
405
+ bundle: true,
406
+ write: false,
407
+ format: "cjs",
408
+ platform: "browser",
409
+ target: "es2020",
410
+ minify: true,
411
+ legalComments: "none",
412
+ // Raycast extensions use the automatic JSX runtime, as bundleCommand does;
413
+ // esbuild's default classic transform needs React in scope.
414
+ jsx: "automatic",
415
+ plugins: [plugin],
416
+ logLevel: "silent",
417
+ })
418
+ .catch((error) => {
419
+ if (native.size)
420
+ throw new BrowserNativeModuleError(native);
421
+ if (missing.size)
422
+ throw new BrowserMissingDependencyError(missing);
423
+ if (missingFiles.size)
424
+ throw new BrowserMissingFileError([...missingFiles].toSorted()[0]);
425
+ throw error;
426
+ });
427
+ if (native.size)
428
+ throw new BrowserNativeModuleError(native);
429
+ if (missing.size)
430
+ throw new BrowserMissingDependencyError(missing);
431
+ if (missingFiles.size)
432
+ throw new BrowserMissingFileError([...missingFiles].toSorted()[0]);
433
+ const output = result.outputFiles?.[0];
434
+ if (!output)
435
+ throw new Error("esbuild returned no browser bundle");
436
+ return {
437
+ code: output.text,
438
+ warnings: (result.warnings ?? []).map((warning) => warning.text),
439
+ bytes: output.contents.byteLength,
440
+ };
441
+ }
@@ -0,0 +1,66 @@
1
+ export type BrowserFetch = (input: string, init?: RequestInit) => Promise<Response>;
2
+ export type BrowserManifest = {
3
+ name?: string;
4
+ dependencies?: Record<string, string>;
5
+ devDependencies?: Record<string, string>;
6
+ [key: string]: unknown;
7
+ };
8
+ export type BrowserLockfile = {
9
+ packages?: Record<string, {
10
+ version?: string;
11
+ dependencies?: Record<string, string>;
12
+ }>;
13
+ dependencies?: Record<string, {
14
+ version?: string;
15
+ dependencies?: Record<string, unknown>;
16
+ }>;
17
+ [key: string]: unknown;
18
+ };
19
+ export type BrowserInstallOptions = {
20
+ fetch: BrowserFetch;
21
+ manifest: BrowserManifest;
22
+ lockfile?: BrowserLockfile | string;
23
+ maxBytes?: number;
24
+ maxPackages?: number;
25
+ registry?: string;
26
+ };
27
+ export type BrowserPackageFile = string | Uint8Array;
28
+ export type BrowserInstallResult = {
29
+ packages: Map<string, BrowserPackageFile>;
30
+ versions: Map<string, string>;
31
+ bytes: number;
32
+ };
33
+ export declare class BrowserInstallError extends Error {
34
+ readonly code: string;
35
+ constructor(code: string, message: string);
36
+ }
37
+ export declare class BrowserIntegrityError extends BrowserInstallError {
38
+ readonly packageName: string;
39
+ readonly expected: string;
40
+ readonly actual: string;
41
+ constructor(packageName: string, expected: string, actual: string);
42
+ }
43
+ export declare class BrowserSizeLimitError extends BrowserInstallError {
44
+ readonly limit: number;
45
+ readonly actual: number;
46
+ constructor(limit: number, actual: number);
47
+ }
48
+ export declare class BrowserPackageLimitError extends BrowserInstallError {
49
+ readonly limit: number;
50
+ constructor(limit: number);
51
+ }
52
+ export declare class BrowserNativePackageError extends BrowserInstallError {
53
+ readonly packageName: string;
54
+ constructor(packageName: string);
55
+ }
56
+ export declare class BrowserResolutionError extends BrowserInstallError {
57
+ readonly packageName: string;
58
+ constructor(packageName: string, range: string);
59
+ }
60
+ export declare class BrowserTarPathError extends BrowserInstallError {
61
+ readonly path: string;
62
+ constructor(path: string);
63
+ }
64
+ /** Parses the small subset of POSIX tar needed for npm archives, including pax and ustar names. */
65
+ export declare function unpackTar(archive: Uint8Array): Map<string, Uint8Array>;
66
+ export declare function installForBrowser(options: BrowserInstallOptions): Promise<BrowserInstallResult>;