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gBACE,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,CAAC,EACD,UAAC,KAAK;gBACJ,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAC1B,MAAM,KAAK,CAAC;YACd,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"@dojo/loader/interfaces\"/>\n\n/**\n * A loader script for setting up the Dojo loader.\n *\n * Note that loader scripts must be simple scripts, not modules.\n */\nintern.registerLoader((options) => {\n const globalObj: any = typeof window !== 'undefined' ? window : global;\n const {\n internLoaderPath = 'node_modules/@dojo/loader/loader.js',\n ...loaderConfig\n } = options;\n\n return intern.loadScript(internLoaderPath).then(() => {\n const require: DojoLoader.RootRequire = globalObj.require;\n intern.log('Using Dojo 2 loader');\n\n loaderConfig.baseUrl = loaderConfig.baseUrl || intern.config.basePath;\n intern.log('Configuring loader with:', loaderConfig);\n require.config(loaderConfig);\n\n return (modules: string[]) => {\n let handle: { remove(): void };\n\n return new Promise<void>((resolve, reject) => {\n handle = require.on('error', (error: Error) => {\n intern.emit('error', error);\n reject(error);\n });\n\n intern.log('Loading modules:', modules);\n require(modules, () => {\n resolve();\n });\n }).then<void>(\n () => {\n handle.remove();\n },\n (error) => {\n handle && handle.remove();\n throw error;\n }\n );\n };\n });\n});\n"]}
\No newline at end of file