@medusajs/modules-sdk
Advanced tools
Comparing version 1.8.8-snapshot-20230605145452 to 1.8.8-snapshot-20230605161303
@@ -1,3 +0,3 @@ | ||
import { ExternalModuleDeclaration, InternalModuleDeclaration, ModuleResolution } from "@medusajs/types"; | ||
import { ExternalModuleDeclaration, InternalModuleDeclaration, ModuleExports, ModuleResolution } from "@medusajs/types"; | ||
export declare const registerModules: (modules?: Record<string, false | string | Partial<InternalModuleDeclaration | ExternalModuleDeclaration>>) => Record<string, ModuleResolution>; | ||
export declare const registerMedusaModule: (moduleKey: string, moduleDeclaration: InternalModuleDeclaration | ExternalModuleDeclaration) => Record<string, ModuleResolution>; | ||
export declare const registerMedusaModule: (moduleKey: string, moduleDeclaration: InternalModuleDeclaration | ExternalModuleDeclaration, moduleExports?: ModuleExports) => Record<string, ModuleResolution>; |
@@ -25,3 +25,3 @@ "use strict"; | ||
exports.registerModules = registerModules; | ||
const registerMedusaModule = (moduleKey, moduleDeclaration) => { | ||
const registerMedusaModule = (moduleKey, moduleDeclaration, moduleExports) => { | ||
const moduleResolutions = {}; | ||
@@ -36,3 +36,3 @@ for (const definition of definitions_1.default) { | ||
} | ||
moduleResolutions[definition.key] = getInternalModuleResolution(definition, moduleDeclaration); | ||
moduleResolutions[definition.key] = getInternalModuleResolution(definition, moduleDeclaration, moduleExports); | ||
} | ||
@@ -42,3 +42,3 @@ return moduleResolutions; | ||
exports.registerMedusaModule = registerMedusaModule; | ||
function getInternalModuleResolution(definition, moduleConfig) { | ||
function getInternalModuleResolution(definition, moduleConfig, moduleExports) { | ||
if (typeof moduleConfig === "boolean") { | ||
@@ -61,3 +61,5 @@ if (!moduleConfig && definition.isRequired) { | ||
const isString = typeof moduleConfig === "string"; | ||
if (definition.canOverride && (isString || (isObj && moduleConfig.resolve))) { | ||
if (!moduleExports && | ||
definition.canOverride && | ||
(isString || (isObj && moduleConfig.resolve))) { | ||
resolutionPath = (0, resolve_cwd_1.default)(isString ? moduleConfig : moduleConfig.resolve); | ||
@@ -77,2 +79,3 @@ } | ||
}, | ||
moduleExports, | ||
options: isObj ? moduleConfig.options ?? {} : {}, | ||
@@ -79,0 +82,0 @@ }; |
@@ -36,6 +36,3 @@ "use strict"; | ||
} | ||
const moduleResolutions = (0, loaders_1.registerMedusaModule)(moduleKey, modDeclaration); | ||
if (moduleResolutions[moduleKey]) { | ||
moduleResolutions[moduleKey].moduleExports = moduleExports; | ||
} | ||
const moduleResolutions = (0, loaders_1.registerMedusaModule)(moduleKey, modDeclaration, moduleExports); | ||
await (0, loaders_1.moduleLoader)({ | ||
@@ -42,0 +39,0 @@ container, |
{ | ||
"name": "@medusajs/modules-sdk", | ||
"version": "1.8.8-snapshot-20230605145452", | ||
"version": "1.8.8-snapshot-20230605161303", | ||
"description": "SDK for medusa modules", | ||
@@ -26,4 +26,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@medusajs/types": "1.8.8-snapshot-20230605145452", | ||
"@medusajs/utils": "1.9.1-snapshot-20230605145452", | ||
"@medusajs/types": "1.8.8-snapshot-20230605161303", | ||
"@medusajs/utils": "1.9.1-snapshot-20230605161303", | ||
"awilix": "^8.0.0", | ||
@@ -30,0 +30,0 @@ "resolve-cwd": "^3.0.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37067
+ Added@medusajs/types@1.8.8-snapshot-20230605161303(transitive)
+ Added@medusajs/utils@1.9.1-snapshot-20230605161303(transitive)
- Removed@medusajs/types@1.8.8-snapshot-20230605145452(transitive)
- Removed@medusajs/utils@1.9.1-snapshot-20230605145452(transitive)