view weather_server/static/amd/mad.js.map @ 35:2f3473416c11

Fix format string in repr(Location).
author Paul Fisher <paul@pfish.zone>
date Fri, 02 Jul 2021 20:36:56 -0400
parents 47987502bf4c
children
line wrap: on
line source

{"version":3,"file":"mad.js","sourceRoot":"","sources":["../../typescript/amd/mad-amd.ts"],"names":[],"mappings":";AAyBA,MAAM,WAAW;IAAjB;QAEqB,SAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IAkEtD,CAAC;IApDG,MAAM,CAAC,IAAY,EAAE,IAAc,EAAE,OAAwB;QACzD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IACxD,CAAC;IAeD,OAAO,CAAC,GAAW,EAAE,MAAe;QAChC,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,OAAO,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SACzD;QACD,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,IAAI,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;YAG5D,OAAO,MAAM,CAAC,OAAQ,CAAC;SAC1B;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAE/C,IAAI,GAAG,CAAC,OAAO;YAAE,OAAO,GAAG,CAAC,OAAO,CAAC;QAEpC,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAC7D,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC,OAAO,CAAC;IACvB,CAAC;IAUD,OAAO,CAAC,EAAO;QACX,EAAE,CAAC,QAAQ,CAAC;YACR,CAAC,IAAY,EAAE,IAAc,EAAE,OAAwB,EAAE,EAAE,CACvD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;CACJ","sourcesContent":["/** Type of the AMD factory function. */\ntype FactoryFunction = (...deps: unknown[]) => void;\n\n/** An individual AMD module. */\ninterface Module {\n    /** The names of the module's dependencies. */\n    deps: string[];\n    /**\n     * The function that, when called with the module's list of dependencies,\n     * creates the module.\n     */\n    factory: FactoryFunction;\n    /**\n     * When null, an indication that the module has not yet been reified.\n     * When non-null, the members that the module has exported.\n     */\n    exports: {}|null;\n}\n\n/**\n * Minimal AMD Dumb Registry: the dumbest possible implementation of AMD,\n * to handle only the code that `tsc -m amd` produces.\n *\n * Supports `require` of absolute paths and `define`s.\n */\nclass MADRegistry {\n    /** The registry itself, mapping from name to module. */\n    private readonly mods = new Map<string, Module>();\n\n    /**\n     * The (subset of) the AMD `define` function we implement.\n     *\n     * This supports\n     *\n     * - Absolute paths\n     * - `exports`-based module construction\n     *\n     * @param name The name of the module to define.\n     * @param deps The dependencies of the module. Must be explicit.\n     * @param factory The module's factory function.\n     */\n    define(name: string, deps: string[], factory: FactoryFunction) {\n        this.mods.set(name, {deps, factory, exports: null});\n    }\n\n    /**\n     * The (subset of) the AMD `require` function we implement.\n     * Only `require(dep)` is exposed to users; `require(dep, srcMod)`\n     * is internal-only.\n     *\n     * - Does not support relative paths.\n     * - Does not define `require.amd`, because we do not fully support AMD\n     *   and don't want to give the impression that we do.\n     *\n     * @param dep The name of the dependency.\n     * @param srcMod The module whence the dependency was requested.\n     *     Used for when the name `exports` is required.\n     */\n    require(dep: string, srcMod?: Module): {} {\n        if (dep === 'require') {\n            return (child: string) => this.require(child, srcMod);\n        }\n        if (dep === 'exports') {\n            if (!srcMod) throw new Error('Internal consistency error.');\n            // We know this is safe because a module can only ever require\n            // its own exports after it is itself required.\n            return srcMod.exports!;\n        }\n        const mod = this.mods.get(dep);\n        if (!mod) throw new Error('Undefined module.');\n        // If we've required the module before, return its exports.\n        if (mod.exports) return mod.exports;\n        // Otherwise, we need to prepare the module and require its parents.\n        mod.exports = {};\n        const deps = mod.deps.map(child => this.require(child, mod));\n        mod.factory(...deps);\n        return mod.exports;\n    }\n\n    /**\n     * Installs this registry into the given object, usually `window` or `self`.\n     * For usage with a separately-compiled JS file, do:\n     *\n     * ```typescript\n     * new MADRegistry().install();\n     * ```\n     */\n    install(to: any) {\n        to['define'] =\n            (name: string, deps: string[], factory: FactoryFunction) =>\n                this.define(name, deps, factory);\n        to['require'] = (dep: string) => this.require(dep);\n    }\n}\n"]}