ModuleConfig provides module configuration capabilities for the Esmx framework, used to define module import/export rules, alias configurations, and external dependencies.
Module path type enumeration:
npm
: Represents dependencies in node_modulesroot
: Represents files under the project root directoryModule configuration interface used to define service exports, imports, and external dependency configurations.
Export configuration list that exposes specific code units (such as components, utility functions, etc.) from the service in ESM format.
Supports two types:
root:*
: Exports source files, e.g., root:src/components/button.vue
npm:*
: Exports third-party dependencies, e.g., npm:vue
Each export item contains the following properties:
name
: Original export path, e.g., npm:vue
or root:src/components
type
: Path type (npm
or root
)importName
: Import name in the format: ${serviceName}/${type}/${path}
exportName
: Export path relative to the service root directoryexportPath
: Actual file pathexternalName
: External dependency name used as an identifier when other services import this moduleService dependency configuration mapping used to configure other services (local or remote) that the current service depends on and their local paths. Each configuration item's key is the service name, and the value is the local path of that service.
Configuration varies by installation method:
External dependency mapping that configures external dependencies to be used, typically dependencies from remote modules.
Each dependency item contains the following properties:
match
: Regular expression used to match import statementsimport
: Actual module pathExample:
Parsed module configuration that converts the original module configuration into a standardized internal format:
Current service name
Current service root directory path
Export configuration list
name
: Original export path, e.g., 'npm:vue' or 'root:src/components'type
: Path type (npm or root)importName
: Import name in the format: '${serviceName}/${type}/${path}'exportName
: Export path relative to the service root directoryexportPath
: Actual file pathexternalName
: External dependency name used as an identifier when other services import this moduleImport configuration list
name
: Package nameroot
: Package root directoryExternal dependency mapping
match
: Regular expression used to match import statementsimport
: Actual module path