repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 3.12 kB
JSON
{"ast":null,"code":"import { ensureNativeModulesAreInstalled } from \"./ensureNativeModulesAreInstalled\";\nexport function registerWebModule(moduleImplementation, moduleName) {\n ensureNativeModulesAreInstalled();\n moduleName = moduleName ?? moduleImplementation.name;\n if (!moduleName) {\n throw new Error('Web module implementation is missing a name - it is either not a class or has been minified. Pass the name as a second argument to the `registerWebModule` function.');\n }\n if (!globalThis?.expo?.modules) {\n globalThis.expo.modules = {};\n }\n if (globalThis.expo.modules[moduleName]) {\n return globalThis.expo.modules[moduleName];\n }\n globalThis.expo.modules[moduleName] = new moduleImplementation();\n return globalThis.expo.modules[moduleName];\n}","map":{"version":3,"names":["ensureNativeModulesAreInstalled","registerWebModule","moduleImplementation","moduleName","name","Error","globalThis","expo","modules"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/expo-modules-core/src/registerWebModule.ts"],"sourcesContent":["import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';\nimport type { NativeModule } from './ts-declarations/NativeModule';\n\n/**\n * Registers a web module.\n * @param moduleImplementation A class that extends `NativeModule`. The class is registered under `globalThis.expo.modules[className]`.\n * @param moduleName – a name to register the module under `globalThis.expo.modules[className]`.\n * @returns A singleton instance of the class passed into arguments.\n */\n\nexport function registerWebModule<\n EventsMap extends Record<never, never>,\n ModuleType extends typeof NativeModule<EventsMap>,\n>(moduleImplementation: ModuleType, moduleName: string): ModuleType {\n ensureNativeModulesAreInstalled();\n\n moduleName = moduleName ?? moduleImplementation.name;\n if (!moduleName) {\n throw new Error(\n 'Web module implementation is missing a name - it is either not a class or has been minified. Pass the name as a second argument to the `registerWebModule` function.'\n );\n }\n if (!globalThis?.expo?.modules) {\n globalThis.expo.modules = {};\n }\n if (globalThis.expo.modules[moduleName]) {\n return globalThis.expo.modules[moduleName];\n }\n globalThis.expo.modules[moduleName] = new moduleImplementation();\n return globalThis.expo.modules[moduleName];\n}\n"],"mappings":"AAAA,SAASA,+BAA+B;AAUxC,OAAO,SAASC,iBAAiBA,CAG/BC,oBAAgC,EAAEC,UAAkB,EAAc;EAClEH,+BAA+B,CAAC,CAAC;EAEjCG,UAAU,GAAGA,UAAU,IAAID,oBAAoB,CAACE,IAAI;EACpD,IAAI,CAACD,UAAU,EAAE;IACf,MAAM,IAAIE,KAAK,CACb,sKACF,CAAC;EACH;EACA,IAAI,CAACC,UAAU,EAAEC,IAAI,EAAEC,OAAO,EAAE;IAC9BF,UAAU,CAACC,IAAI,CAACC,OAAO,GAAG,CAAC,CAAC;EAC9B;EACA,IAAIF,UAAU,CAACC,IAAI,CAACC,OAAO,CAACL,UAAU,CAAC,EAAE;IACvC,OAAOG,UAAU,CAACC,IAAI,CAACC,OAAO,CAACL,UAAU,CAAC;EAC5C;EACAG,UAAU,CAACC,IAAI,CAACC,OAAO,CAACL,UAAU,CAAC,GAAG,IAAID,oBAAoB,CAAC,CAAC;EAChE,OAAOI,UAAU,CAACC,IAAI,CAACC,OAAO,CAACL,UAAU,CAAC;AAC5C","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}