Skip to content

Commit f9ab6e1

Browse files
authored
Hide accidentally included stuff from the documentation (pyodide#5274)
1 parent 5f76380 commit f9ab6e1

File tree

8 files changed

+66
-8
lines changed

8 files changed

+66
-8
lines changed

docs/sphinx_pyodide/sphinx_pyodide/jsdoc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def doclet_is_private(doclet: ir.TopLevel) -> bool:
101101
# this via a @private decorator in the documentation comment.
102102
return True
103103

104-
if filename in ["module.", "compat.", "types."]:
104+
if filename in ["module.", "compat."]:
105105
return True
106106

107107
if filename == "pyproxy." and toplevelname.endswith("Methods"):

docs/sphinx_pyodide/sphinx_pyodide/mdn_xrefs.py

+25-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
"TextDecoder": "$global/",
3333
"DataView": "$global/",
3434
"Uint8Array": "$global/",
35+
"Int8Array": "$global/",
36+
"Uint16Array": "$global/",
37+
"Int16Array": "$global/",
38+
"Uint32Array": "$global/",
39+
"Int32Array": "$global/",
40+
"Uint8ClampedArray": "$global/",
41+
"Float32Array": "$global/",
42+
"Float64Array": "$global/",
3543
"Map": "$global/",
3644
"Set": "$global/",
3745
# the JavaScript domain has no exception type for some reason...
@@ -156,11 +164,24 @@
156164
USE_NAME_AS_LINK_TEXT,
157165
)
158166

159-
for key, url in [
160-
("void", "https://www.typescriptlang.org/docs/handbook/2/functions.html#void"),
161-
("any", "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any"),
167+
for ty, key, url in [
168+
(
169+
"js:data",
170+
"void",
171+
"https://www.typescriptlang.org/docs/handbook/2/functions.html#void",
172+
),
173+
(
174+
"js:data",
175+
"any",
176+
"https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any",
177+
),
178+
(
179+
"js:class",
180+
"Record",
181+
"https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type",
182+
),
162183
]:
163-
INVDATA["js:data"][key] = (
184+
INVDATA[ty][key] = (
164185
"typescript docs",
165186
"",
166187
url,

src/js/api.ts

+6
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ export class PyodideAPI {
666666
return orig;
667667
}
668668

669+
/**
670+
*
671+
* @param param0
672+
* @returns
673+
*/
669674
static makeMemorySnapshot({
670675
serializer,
671676
}: {
@@ -732,6 +737,7 @@ API.bootstrapFinalizedPromise = new Promise<void>(
732737
(r) => (bootstrapFinalized = r),
733738
);
734739

740+
/** @private */
735741
export function jsFinderHook(o: object) {
736742
if ("__all__" in o) {
737743
return;

src/js/dynload.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PackageManagerAPI, PackageManagerModule } from "./types";
55
import { createLock } from "./common/lock";
66
import { LoadDynlibFS, ReadFileType, InternalPackageData } from "./types";
77

8+
/** @hidden */
89
export class DynlibLoader {
910
#api: PackageManagerAPI;
1011
#module: PackageManagerModule;

src/js/installer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { PackageManagerAPI, PackageManagerModule } from "./types";
99
* - storing metadata about the Package
1010
* - loading shared libraries
1111
* - installing data files
12+
* @hidden
1213
*/
1314
export class Installer {
1415
#api: PackageManagerAPI;

src/js/load-package.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
PackageLoadMetadata,
77
PackageManagerAPI,
88
PackageManagerModule,
9+
LoadedPackages,
910
} from "./types";
1011
import { IN_NODE } from "./environments";
1112
import type { PyProxy } from "generated/pyproxy";
@@ -118,7 +119,7 @@ export class PackageManager {
118119
*
119120
* TODO: Make this private and expose a setter
120121
*/
121-
public loadedPackages: Record<string, string> = {};
122+
public loadedPackages: LoadedPackages = {};
122123

123124
private _lock = createLock();
124125

@@ -566,7 +567,14 @@ export function toStringArray(str: string | PyProxy | string[]): string[] {
566567
}
567568

568569
export let loadPackage: typeof PackageManager.prototype.loadPackage;
569-
export let loadedPackages: typeof PackageManager.prototype.loadedPackages;
570+
/**
571+
* An object whose keys are the names of the loaded packages and whose values
572+
* are the install sources of the packages. Use
573+
* `Object.keys(pyodide.loadedPackages)` to get the list of names of loaded
574+
* packages, and `pyodide.loadedPackages[package_name]` to access the install
575+
* source for a particular `package_name`.
576+
*/
577+
export let loadedPackages: LoadedPackages;
570578

571579
if (typeof API !== "undefined" && typeof Module !== "undefined") {
572580
const singletonPackageManager = new PackageManager(API, Module);

src/js/snapshot.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { scheduleCallback } from "./scheduler";
33

44
declare var Module: any;
55

6+
/** @private */
67
export function getExpectedKeys() {
78
return [
89
null,
@@ -58,6 +59,9 @@ export function makeGlobalsProxy(
5859

5960
type SerializedHiwireValue = { path: string[] } | { serialized: any } | null;
6061

62+
/**
63+
* @hidden
64+
*/
6165
export type SnapshotConfig = {
6266
hiwireKeys: SerializedHiwireValue[];
6367
immortalKeys: string[];
@@ -245,6 +249,7 @@ API.restoreSnapshot = function (snapshot: Uint8Array): SnapshotConfig {
245249
* This code is quite sensitive to the details of our setup, so it might break
246250
* if we move stuff around far away in the code base. Ideally over time we can
247251
* structure the code to make it less brittle.
252+
* @private
248253
*/
249254
export function syncUpSnapshotLoad1() {
250255
// hiwire init puts a null at the beginning of both the mortal and immortal tables.
@@ -275,6 +280,7 @@ function tableSet(idx: number, val: any): void {
275280

276281
/**
277282
* Fill in the JsRef table.
283+
* @private
278284
*/
279285
export function syncUpSnapshotLoad2(
280286
jsglobals: any,

src/js/types.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,26 @@ declare global {
171171
export const __iscoroutinefunction: (a: number) => number;
172172
}
173173

174+
/** @hidden */
174175
export type FSNode = {
175176
timestamp: number;
176177
rdev: number;
177178
contents: Uint8Array;
178179
mode: number;
179180
};
180181

182+
/** @hidden */
181183
export type FSStream = {
182184
tty?: boolean;
183185
seekable?: boolean;
184186
stream_ops: FSStreamOps;
185187
node: FSNode;
186188
};
187189

190+
/** @hidden */
188191
export type FSStreamOps = FSStreamOpsGen<FSStream>;
189192

193+
/** @hidden */
190194
export type FSStreamOpsGen<T> = {
191195
open: (a: T) => void;
192196
close: (a: T) => void;
@@ -207,6 +211,7 @@ export type FSStreamOpsGen<T> = {
207211
) => number;
208212
};
209213

214+
/** @hidden */
210215
export interface FS {
211216
unlink: (path: string) => void;
212217
mkdirTree: (path: string, mode?: number) => void;
@@ -256,26 +261,30 @@ export interface FS {
256261
readFile(a: string): Uint8Array;
257262
}
258263

259-
/** @private */
264+
/** @hidden */
260265
export type PreRunFunc = (Module: Module) => void;
261266

267+
/** @hidden */
262268
export type ReadFileType = (path: string) => Uint8Array;
263269

264270
// File System-like type which can be passed to
265271
// Module.loadDynamicLibrary or Module.loadWebAssemblyModule
272+
/** @hidden */
266273
export type LoadDynlibFS = {
267274
readFile: ReadFileType;
268275
findObject: (path: string, dontResolveLastLink: boolean) => any;
269276
};
270277

271278
type DSO = any;
272279

280+
/** @hidden */
273281
export interface LDSO {
274282
loadedLibsByName: {
275283
[key: string]: DSO;
276284
};
277285
}
278286

287+
/** @hidden */
279288
export interface Module {
280289
API: API;
281290
locateFile: (file: string) => string;
@@ -340,11 +349,13 @@ type LockfileInfo = {
340349
python: string;
341350
};
342351

352+
/** @hidden */
343353
export type Lockfile = {
344354
info: LockfileInfo;
345355
packages: Record<string, InternalPackageData>;
346356
};
347357

358+
/** @hidden */
348359
export type PackageType =
349360
| "package"
350361
| "cpython_module"
@@ -361,6 +372,9 @@ export interface PackageData {
361372
packageType: PackageType;
362373
}
363374

375+
/** @hidden */
376+
export type LoadedPackages = Record<string, string>;
377+
364378
/**
365379
* @hidden
366380
*/
@@ -388,6 +402,7 @@ export type PackageLoadMetadata = {
388402
packageData: InternalPackageData;
389403
};
390404

405+
/** @hidden */
391406
export interface API {
392407
fatal_error: (e: any) => never;
393408
isPyProxy: (e: any) => e is PyProxy;

0 commit comments

Comments
 (0)