@endo/module-source
Version:
Ponyfill for the SES ModuleSource and module-to-program transformer
81 lines • 2.35 kB
TypeScript
/**
* @typedef {object} SourceMapHookDetails
* @property {string} compartment
* @property {string} module
* @property {string} location
* @property {string} sha512
*/
/**
* @callback SourceMapHook
* @param {string} sourceMap
* @param {SourceMapHookDetails} details
*/
/**
* @typedef {object} Options
* @property {string} [sourceUrl]
* @property {string} [sourceMap]
* @property {string} [sourceMapUrl]
* @property {SourceMapHook} [sourceMapHook]
*/
/**
* ModuleSource captures the effort of parsing and analyzing module text
* so a cache of ModuleSources may be shared by multiple Compartments.
*
* @class
* @param {string} source
* @param {string | Options} [opts]
*/
export function ModuleSource(source: string, opts?: string | Options): void;
export class ModuleSource {
/**
* @typedef {object} SourceMapHookDetails
* @property {string} compartment
* @property {string} module
* @property {string} location
* @property {string} sha512
*/
/**
* @callback SourceMapHook
* @param {string} sourceMap
* @param {SourceMapHookDetails} details
*/
/**
* @typedef {object} Options
* @property {string} [sourceUrl]
* @property {string} [sourceMap]
* @property {string} [sourceMapUrl]
* @property {SourceMapHook} [sourceMapHook]
*/
/**
* ModuleSource captures the effort of parsing and analyzing module text
* so a cache of ModuleSources may be shared by multiple Compartments.
*
* @class
* @param {string} source
* @param {string | Options} [opts]
*/
constructor(source: string, opts?: string | Options);
imports: string[];
exports: any[];
reexports: never[];
__syncModuleProgram__: string;
__liveExportMap__: any;
__reexportMap__: any;
__fixedExportMap__: any;
__needsImport__: boolean;
__needsImportMeta__: boolean;
}
export type SourceMapHookDetails = {
compartment: string;
module: string;
location: string;
sha512: string;
};
export type SourceMapHook = (sourceMap: string, details: SourceMapHookDetails) => any;
export type Options = {
sourceUrl?: string | undefined;
sourceMap?: string | undefined;
sourceMapUrl?: string | undefined;
sourceMapHook?: SourceMapHook | undefined;
};
//# sourceMappingURL=module-source.d.ts.map