diff --git a/ts/core/index.ts b/ts/core/index.ts new file mode 100644 index 0000000..2b16807 --- /dev/null +++ b/ts/core/index.ts @@ -0,0 +1,15 @@ +import * as smartenv from '@push.rocks/smartenv'; + +let usedImplementation: typeof import('../core_base/index.js'); + +const smartenvInstance = new smartenv.Smartenv(); + +export const getImplementation = async () => { + if (smartenvInstance.isNode) { + usedImplementation = await smartenvInstance.getSafeNodeModule< + typeof import('../core_node/index.js') + >('../core_node/index.js'); + } else { + usedImplementation = await import('../core_fetch/index.js'); + } +};