load_options
Stable type · Document I/O
Tier: stable · Kind: type · Topic: Document I/O
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
| not exported | LoadOptions | not exported | LoadOptions | not exported |
Julia
Julia does not export this type.
TypeScript
interface LoadOptions {
canonical?: boolean;
basePath?: string | undefined;
metaparameters?: Record<string, number> | undefined;
readFile?: ((path: string) => string) | undefined;
injectedImports?: readonly unknown[] | undefined;
assumeValid?: boolean | undefined;
onUnitWarning?: ((warning: UnitWarning) => void) | undefined;
onVersionWarning?: ((message: string) => void) | undefined;
}
Options controlling how the load* entry points parse and represent an ESM file.
Properties
canonical— Whentrue, numeric literals at Expression-bearing positions are decoded to taggedNumericLiteralleaves so downstream consumers can preserve the integer-vs-float distinction required by the canonical form (discretization RFC §5.4.1 / §5.4.6). Whenfalseor absent (default), numeric literals decode to plain JS numbers.Canonical mode only takes effect on
loadStringandloadPath, which decode JSON text;loadDocumenttakes an already-decoded object and ignores it.basePath— Directory anchoring relativeexpression_template_importsrefs (esm-spec §9.7.2). Defaults to the current working directory. Callers loading from a known file path should pass that file’s directory.metaparameters— Loader-API metaparameter bindings for the root document (esm-spec §9.7.6 binding site 4): name → integer. Already-closed edge bindings win; API bindings beatdefaults. Binding a name the document does not declare raisestemplate_import_unknown_name.readFile— Synchronous file reader used to resolve template-library import refs. Defaults to Node’sfs.readFileSync(viaprocess.getBuiltinModule); browser hosts that need template imports must supply their own.injectedImports— Scope-directed template injection for a §4.7 subsystem-ref edge (esm-spec §9.7.10 form A): raw §9.7.2 import entries folded into this document’s single top-level component’s own scope BEFORE the §9.6.3 fixpoint, so a mounted discretization-agnostic PDE leaf is lowered under the assembler-chosen discretization. Threaded in byresolveSubsystemRefsfrom the subsystem edge; not part of the public authoring surface.assumeValid— Skip schema validation because the caller has already runvalidateSchemaon this input. Version checks and the removed-construct rejections still apply. Used byvalidate()to avoid validating the same document twice.onUnitWarning— Receives each dimensional-analysis warning instead of the defaultconsole.warn. Used byvalidate()to collect unit warnings into its structured result.onVersionWarning— Receives the forward-compatibility warning emitted when the file’s minor version is newer than the schema this build implements, instead of the defaultconsole.warn. ParallelsonUnitWarningso hosts can route both load-time warnings into a structured channel.
Python
Python does not export this type.
Rust
pub struct LoadOptions {
pub base_path: Option<PathBuf>,
pub metaparameters: BTreeMap<String, i64>,
}
Options controlling how load_string_with_options
/
load_document_with_options
/ load_path_with_options
parse an ESM
file (esm-spec §9.7).
Go
Go does not export this type.