Skip to content

Commit

Permalink
more docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Dec 23, 2024
1 parent 90a1c45 commit d17ae61
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/sphinx_pyodide/sphinx_pyodide/jsdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def doclet_is_private(doclet: ir.TopLevel) -> bool:
# this via a @private decorator in the documentation comment.
return True

if filename in ["module.", "compat.", "types."]:
if filename in ["module.", "compat."]:
return True

if filename == "pyproxy." and toplevelname.endswith("Methods"):
Expand Down
17 changes: 13 additions & 4 deletions docs/sphinx_pyodide/sphinx_pyodide/mdn_xrefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
"TextDecoder": "$global/",
"DataView": "$global/",
"Uint8Array": "$global/",
"Int8Array": "$global/",
"Uint16Array": "$global/",
"Int16Array": "$global/",
"Uint32Array": "$global/",
"Int32Array": "$global/",
"Uint8ClampedArray": "$global/",
"Float32Array": "$global/",
"Float64Array": "$global/",
"Map": "$global/",
"Set": "$global/",
# the JavaScript domain has no exception type for some reason...
Expand Down Expand Up @@ -156,11 +164,12 @@
USE_NAME_AS_LINK_TEXT,
)

for key, url in [
("void", "https://www.typescriptlang.org/docs/handbook/2/functions.html#void"),
("any", "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any"),
for ty, key, url in [
("js:data", "void", "https://www.typescriptlang.org/docs/handbook/2/functions.html#void"),
("js:data", "any", "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any"),
("js:class", "Record", "https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type")
]:
INVDATA["js:data"][key] = (
INVDATA[ty][key] = (
"typescript docs",
"",
url,
Expand Down
5 changes: 5 additions & 0 deletions src/js/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,11 @@ export class PyodideAPI {
return orig;
}

/**
*
* @param param0
* @returns
*/
static makeMemorySnapshot({
serializer,
}: {
Expand Down
2 changes: 1 addition & 1 deletion src/js/dynload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PackageManagerAPI, PackageManagerModule } from "./types";
import { createLock } from "./common/lock";
import { LoadDynlibFS, ReadFileType, InternalPackageData } from "./types";

/** @private */
/** @hidden */
export class DynlibLoader {
#api: PackageManagerAPI;
#module: PackageManagerModule;
Expand Down
2 changes: 1 addition & 1 deletion src/js/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { PackageManagerAPI, PackageManagerModule } from "./types";
* - storing metadata about the Package
* - loading shared libraries
* - installing data files
* @private
* @hidden
*/
export class Installer {
#api: PackageManagerAPI;
Expand Down
12 changes: 10 additions & 2 deletions src/js/load-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PackageLoadMetadata,
PackageManagerAPI,
PackageManagerModule,
LoadedPackages,
} from "./types";
import { IN_NODE } from "./environments";
import type { PyProxy } from "generated/pyproxy";
Expand Down Expand Up @@ -118,7 +119,7 @@ export class PackageManager {
*
* TODO: Make this private and expose a setter
*/
public loadedPackages: Record<string, string> = {};
public loadedPackages: LoadedPackages = {};

private _lock = createLock();

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

export let loadPackage: typeof PackageManager.prototype.loadPackage;
export let loadedPackages: typeof PackageManager.prototype.loadedPackages;
/**
* An object whose keys are the names of the loaded packages and whose values
* are the install sources of the packages. Use
* `Object.keys(pyodide.loadedPackages)` to get the list of names of loaded
* packages, and `pyodide.loadedPackages[package_name]` to access the install
* source for a particular `package_name`.
*/
export let loadedPackages: LoadedPackages;

if (typeof API !== "undefined" && typeof Module !== "undefined") {
const singletonPackageManager = new PackageManager(API, Module);
Expand Down
2 changes: 1 addition & 1 deletion src/js/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function makeGlobalsProxy(
type SerializedHiwireValue = { path: string[] } | { serialized: any } | null;

/**
* @private
* @hidden
*/
export type SnapshotConfig = {
hiwireKeys: SerializedHiwireValue[];
Expand Down
18 changes: 16 additions & 2 deletions src/js/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,26 @@ declare global {
export const __iscoroutinefunction: (a: number) => number;
}

/** @hidden */
export type FSNode = {
timestamp: number;
rdev: number;
contents: Uint8Array;
mode: number;
};

/** @hidden */
export type FSStream = {
tty?: boolean;
seekable?: boolean;
stream_ops: FSStreamOps;
node: FSNode;
};

/** @hidden */
export type FSStreamOps = FSStreamOpsGen<FSStream>;

/** @hidden */
export type FSStreamOpsGen<T> = {
open: (a: T) => void;
close: (a: T) => void;
Expand All @@ -207,6 +211,7 @@ export type FSStreamOpsGen<T> = {
) => number;
};

/** @hidden */
export interface FS {
unlink: (path: string) => void;
mkdirTree: (path: string, mode?: number) => void;
Expand Down Expand Up @@ -256,26 +261,30 @@ export interface FS {
readFile(a: string): Uint8Array;
}

/** @private */
/** @hidden */
export type PreRunFunc = (Module: Module) => void;

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

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

type DSO = any;

/** @hidden */
export interface LDSO {
loadedLibsByName: {
[key: string]: DSO;
};
}

/** @hidden */
export interface Module {
API: API;
locateFile: (file: string) => string;
Expand Down Expand Up @@ -340,12 +349,13 @@ type LockfileInfo = {
python: string;
};

/** @hidden */
export type Lockfile = {
info: LockfileInfo;
packages: Record<string, InternalPackageData>;
};

/** @private */
/** @hidden */
export type PackageType =
| "package"
| "cpython_module"
Expand All @@ -362,6 +372,9 @@ export interface PackageData {
packageType: PackageType;
}

/** @hidden */
export type LoadedPackages = Record<string, string>;

/**
* @hidden
*/
Expand Down Expand Up @@ -389,6 +402,7 @@ export type PackageLoadMetadata = {
packageData: InternalPackageData;
};

/** @hidden */
export interface API {
fatal_error: (e: any) => never;
isPyProxy: (e: any) => e is PyProxy;
Expand Down

0 comments on commit d17ae61

Please sign in to comment.