@zudojs/core 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +141 -7
- package/dist/application/application.d.ts +43 -2
- package/dist/application/application.js +111 -13
- package/dist/application/applicationContext.context.d.ts +15 -0
- package/dist/application/applicationContext.context.js +12 -0
- package/dist/application/createApplication.d.ts +78 -0
- package/dist/application/createApplication.js +104 -0
- package/dist/application/index.d.ts +2 -1
- package/dist/application/index.js +2 -1
- package/dist/configuration/configurationManager.manager.d.ts +32 -0
- package/dist/configuration/configurationManager.manager.js +86 -7
- package/dist/configuration/core/configuration.d.ts +60 -15
- package/dist/configuration/core/configuration.js +248 -51
- package/dist/configuration/core/configurationKey.key.d.ts +4 -2
- package/dist/configuration/core/configurationKey.key.js +2 -13
- package/dist/configuration/core/configurationPath.path.d.ts +17 -0
- package/dist/configuration/core/configurationPath.path.js +33 -0
- package/dist/configuration/core/index.d.ts +7 -1
- package/dist/configuration/core/index.js +1 -0
- package/dist/configuration/error/configurationError.error.d.ts +11 -0
- package/dist/configuration/error/configurationError.error.js +29 -1
- package/dist/configuration/error/configurationRedactor.redactor.d.ts +16 -0
- package/dist/configuration/error/configurationRedactor.redactor.js +83 -5
- package/dist/configuration/error/index.d.ts +2 -1
- package/dist/configuration/error/index.js +2 -1
- package/dist/configuration/index.d.ts +1 -1
- package/dist/configuration/loader/configurationLoader.loader.d.ts +47 -9
- package/dist/configuration/loader/configurationLoader.loader.js +107 -26
- package/dist/configuration/loader/index.d.ts +1 -1
- package/dist/configuration/loader/index.js +1 -1
- package/dist/configuration/registry/configurationProvider.provider.d.ts +26 -1
- package/dist/configuration/registry/configurationProvider.provider.js +33 -7
- package/dist/configuration/registry/configurationRegistry.registry.js +2 -1
- package/dist/configuration/schema/configurationSchema.schema.d.ts +0 -4
- package/dist/configuration/schema/configurationSchema.schema.js +11 -32
- package/dist/configuration/schema/configurationValidation.validator.d.ts +14 -2
- package/dist/configuration/schema/configurationValidation.validator.js +55 -7
- package/dist/configuration/schema/index.d.ts +1 -1
- package/dist/configuration/schema/index.js +1 -1
- package/dist/container/container.d.ts +52 -5
- package/dist/container/container.js +110 -33
- package/dist/container/index.d.ts +1 -1
- package/dist/container/index.js +1 -1
- package/dist/container/scope.d.ts +7 -6
- package/dist/context/core/contextAliases.deprecated.d.ts +32 -0
- package/dist/context/core/contextAliases.deprecated.js +6 -0
- package/dist/context/core/executionContext.context.d.ts +8 -0
- package/dist/context/core/executionContext.context.js +38 -15
- package/dist/context/core/index.d.ts +2 -2
- package/dist/context/core/index.js +2 -2
- package/dist/context/index.d.ts +20 -0
- package/dist/context/index.js +20 -0
- package/dist/context/provider/contextProvider.provider.d.ts +7 -4
- package/dist/context/provider/contextProvider.provider.js +9 -6
- package/dist/context/provider/contextStorage.storage.d.ts +47 -7
- package/dist/context/provider/contextStorage.storage.js +54 -12
- package/dist/context/provider/defaultContextStorage.storage.d.ts +18 -0
- package/dist/context/provider/defaultContextStorage.storage.js +20 -0
- package/dist/context/provider/index.d.ts +2 -1
- package/dist/context/provider/index.js +1 -0
- package/dist/errors/exceptions.d.ts +22 -0
- package/dist/errors/exceptions.js +38 -1
- package/dist/errors/frameworkError.error.d.ts +6 -9
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -0
- package/dist/lifecycle/core/index.d.ts +1 -1
- package/dist/lifecycle/core/index.js +1 -1
- package/dist/lifecycle/core/lifecycle.d.ts +47 -2
- package/dist/lifecycle/core/lifecycle.js +251 -85
- package/dist/lifecycle/core/lifecycleRegistry.registry.d.ts +8 -0
- package/dist/lifecycle/core/lifecycleRegistry.registry.js +20 -1
- package/dist/lifecycle/manager/lifecycleManager.manager.d.ts +21 -2
- package/dist/lifecycle/manager/lifecycleManager.manager.js +62 -99
- package/dist/lifecycle/scope/lifecycleScope.scope.d.ts +22 -1
- package/dist/lifecycle/scope/lifecycleScope.scope.js +85 -17
- package/dist/logging/console/consoleLogger.logger.d.ts +20 -1
- package/dist/logging/console/consoleLogger.logger.js +77 -11
- package/dist/logging/console/loggerFactory.factory.d.ts +6 -5
- package/dist/logging/console/loggerFactory.factory.js +1 -7
- package/dist/logging/core/index.d.ts +4 -3
- package/dist/logging/core/index.js +4 -3
- package/dist/logging/core/logEntry.entry.d.ts +41 -3
- package/dist/logging/core/logEntry.entry.js +114 -4
- package/dist/logging/core/logLevel.level.d.ts +18 -0
- package/dist/logging/core/logLevel.level.js +25 -1
- package/dist/logging/core/logRedaction.redaction.d.ts +38 -0
- package/dist/logging/core/logRedaction.redaction.js +19 -0
- package/dist/logging/core/logger.d.ts +14 -11
- package/dist/logging/core/logger.js +31 -6
- package/dist/logging/core/loggerContext.context.d.ts +12 -0
- package/dist/logging/core/loggerContext.context.js +19 -0
- package/dist/logging/core/loggerOptions.options.d.ts +17 -0
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -6
- package/dist/modules/module.d.ts +7 -1
- package/dist/modules/moduleContext.context.d.ts +41 -7
- package/dist/modules/moduleContext.context.js +31 -8
- package/dist/modules/moduleDefinition.definition.d.ts +11 -7
- package/dist/modules/moduleDefinition.definition.js +41 -8
- package/dist/modules/moduleDependency/index.d.ts +2 -2
- package/dist/modules/moduleDependency/index.js +1 -1
- package/dist/modules/moduleDependency/moduleDependency.graph.d.ts +19 -2
- package/dist/modules/moduleDependency/moduleDependency.graph.js +122 -8
- package/dist/modules/moduleDependency/moduleDependency.ordering.d.ts +8 -0
- package/dist/modules/moduleDependency/moduleDependency.ordering.js +85 -57
- package/dist/modules/moduleDependency/moduleDependency.type.d.ts +28 -1
- package/dist/modules/moduleError/index.d.ts +1 -1
- package/dist/modules/moduleError/index.js +1 -1
- package/dist/modules/moduleError/moduleError.dependency.d.ts +11 -0
- package/dist/modules/moduleError/moduleError.dependency.js +15 -0
- package/dist/modules/moduleLifecycle/index.d.ts +5 -2
- package/dist/modules/moduleLifecycle/index.js +4 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.d.ts +44 -6
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.js +153 -9
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.d.ts +30 -5
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.js +130 -10
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.d.ts +65 -28
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.js +15 -4
- package/dist/modules/moduleLoader/moduleLoader.loader.d.ts +39 -5
- package/dist/modules/moduleLoader/moduleLoader.loader.js +123 -50
- package/dist/modules/moduleLoader/moduleLoader.type.d.ts +4 -2
- package/dist/modules/moduleLoader/moduleLoader.type.js +10 -3
- package/dist/modules/moduleMetadata.metadata.js +15 -5
- package/dist/modules/moduleRegistry/index.d.ts +1 -1
- package/dist/modules/moduleRegistry/moduleRegistry.registry.d.ts +2 -2
- package/dist/modules/moduleRegistry/moduleRegistry.registry.js +38 -6
- package/dist/modules/moduleRegistry/moduleRegistry.type.d.ts +18 -1
- package/dist/runtime/index.d.ts +17 -15
- package/dist/runtime/index.js +14 -10
- package/dist/runtime/runtime.d.ts +135 -33
- package/dist/runtime/runtime.js +344 -114
- package/dist/runtime/runtimeBootstrap/index.d.ts +2 -1
- package/dist/runtime/runtimeBootstrap/index.js +1 -1
- package/dist/runtime/runtimeBootstrap/pipeline/index.d.ts +2 -2
- package/dist/runtime/runtimeBootstrap/pipeline/index.js +1 -2
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.d.ts +41 -15
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.js +98 -76
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.d.ts +7 -4
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.js +87 -59
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.d.ts +10 -4
- package/dist/runtime/runtimeContext/index.d.ts +3 -5
- package/dist/runtime/runtimeContext/index.js +2 -4
- package/dist/runtime/runtimeContext/runtimeContext.factory.d.ts +10 -4
- package/dist/runtime/runtimeContext/runtimeContext.factory.js +30 -7
- package/dist/runtime/runtimeContext/runtimeContext.type.d.ts +36 -47
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.d.ts +5 -0
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.js +6 -4
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.d.ts +4 -0
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.js +7 -9
- package/dist/runtime/runtimeEnvironment/index.d.ts +2 -2
- package/dist/runtime/runtimeEnvironment/index.js +1 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.d.ts +20 -17
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.js +20 -13
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.d.ts +12 -1
- package/dist/runtime/runtimeError/index.d.ts +3 -3
- package/dist/runtime/runtimeError/index.js +1 -1
- package/dist/runtime/runtimeError/runtimeError.base.d.ts +15 -18
- package/dist/runtime/runtimeError/runtimeError.base.js +38 -36
- package/dist/runtime/runtimeError/runtimeError.lifecycle.d.ts +23 -8
- package/dist/runtime/runtimeError/runtimeError.lifecycle.js +31 -7
- package/dist/runtime/runtimeError/runtimeError.specialized.d.ts +1 -1
- package/dist/runtime/runtimeError/runtimeError.specialized.js +1 -1
- package/dist/runtime/runtimeError/runtimeError.type.d.ts +5 -9
- package/dist/runtime/runtimeLogger.d.ts +2 -2
- package/dist/runtime/runtimeLogger.js +3 -3
- package/dist/runtime/runtimeOptions/index.d.ts +1 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.d.ts +1 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.js +2 -0
- package/dist/runtime/runtimeOptions/runtimeOptions.resolver.js +5 -2
- package/dist/runtime/runtimeOptions/runtimeOptions.type.d.ts +45 -16
- package/dist/runtime/runtimeOptions/runtimeOptions.validation.js +0 -1
- package/dist/runtime/runtimeShutdown/index.d.ts +3 -2
- package/dist/runtime/runtimeShutdown/index.js +2 -2
- package/dist/runtime/runtimeShutdown/pipeline/index.d.ts +2 -1
- package/dist/runtime/runtimeShutdown/pipeline/index.js +1 -1
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.d.ts +37 -7
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.js +77 -51
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.d.ts +8 -16
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.js +85 -87
- package/dist/runtime/runtimeShutdown/runtimeShutdown.type.d.ts +9 -5
- package/dist/runtime/runtimeSignals/index.d.ts +8 -0
- package/dist/runtime/runtimeSignals/index.js +7 -0
- package/dist/runtime/runtimeSignals/runtimeSignals.d.ts +93 -0
- package/dist/runtime/runtimeSignals/runtimeSignals.js +149 -0
- package/dist/runtime/runtimeState.state.d.ts +32 -14
- package/dist/runtime/runtimeState.state.js +34 -27
- package/dist/runtime/runtimeTimeout.d.ts +40 -0
- package/dist/runtime/runtimeTimeout.js +42 -0
- package/package.json +21 -15
- package/dist/.tsbuildinfo +0 -1
- package/dist/application/application.d.ts.map +0 -1
- package/dist/application/application.js.map +0 -1
- package/dist/application/applicationContext.context.d.ts.map +0 -1
- package/dist/application/applicationContext.context.js.map +0 -1
- package/dist/application/applicationState.state.d.ts.map +0 -1
- package/dist/application/applicationState.state.js.map +0 -1
- package/dist/application/index.d.ts.map +0 -1
- package/dist/application/index.js.map +0 -1
- package/dist/configuration/configurationManager.manager.d.ts.map +0 -1
- package/dist/configuration/configurationManager.manager.js.map +0 -1
- package/dist/configuration/core/configuration.d.ts.map +0 -1
- package/dist/configuration/core/configuration.js.map +0 -1
- package/dist/configuration/core/configurationKey.key.d.ts.map +0 -1
- package/dist/configuration/core/configurationKey.key.js.map +0 -1
- package/dist/configuration/core/configurationSource.source.d.ts.map +0 -1
- package/dist/configuration/core/configurationSource.source.js.map +0 -1
- package/dist/configuration/core/index.d.ts.map +0 -1
- package/dist/configuration/core/index.js.map +0 -1
- package/dist/configuration/error/configurationError.error.d.ts.map +0 -1
- package/dist/configuration/error/configurationError.error.js.map +0 -1
- package/dist/configuration/error/configurationRedactor.redactor.d.ts.map +0 -1
- package/dist/configuration/error/configurationRedactor.redactor.js.map +0 -1
- package/dist/configuration/error/index.d.ts.map +0 -1
- package/dist/configuration/error/index.js.map +0 -1
- package/dist/configuration/events/configurationEvents.events.d.ts.map +0 -1
- package/dist/configuration/events/configurationEvents.events.js.map +0 -1
- package/dist/configuration/events/index.d.ts.map +0 -1
- package/dist/configuration/events/index.js.map +0 -1
- package/dist/configuration/index.d.ts.map +0 -1
- package/dist/configuration/index.js.map +0 -1
- package/dist/configuration/loader/configurationLoader.loader.d.ts.map +0 -1
- package/dist/configuration/loader/configurationLoader.loader.js.map +0 -1
- package/dist/configuration/loader/index.d.ts.map +0 -1
- package/dist/configuration/loader/index.js.map +0 -1
- package/dist/configuration/registry/configurationProvider.provider.d.ts.map +0 -1
- package/dist/configuration/registry/configurationProvider.provider.js.map +0 -1
- package/dist/configuration/registry/configurationRegistry.registry.d.ts.map +0 -1
- package/dist/configuration/registry/configurationRegistry.registry.js.map +0 -1
- package/dist/configuration/registry/index.d.ts.map +0 -1
- package/dist/configuration/registry/index.js.map +0 -1
- package/dist/configuration/schema/configurationSchema.schema.d.ts.map +0 -1
- package/dist/configuration/schema/configurationSchema.schema.js.map +0 -1
- package/dist/configuration/schema/configurationValidation.validator.d.ts.map +0 -1
- package/dist/configuration/schema/configurationValidation.validator.js.map +0 -1
- package/dist/configuration/schema/index.d.ts.map +0 -1
- package/dist/configuration/schema/index.js.map +0 -1
- package/dist/container/container.d.ts.map +0 -1
- package/dist/container/container.js.map +0 -1
- package/dist/container/index.d.ts.map +0 -1
- package/dist/container/index.js.map +0 -1
- package/dist/container/provider.d.ts.map +0 -1
- package/dist/container/provider.js.map +0 -1
- package/dist/container/scope.d.ts.map +0 -1
- package/dist/container/scope.js.map +0 -1
- package/dist/container/token.d.ts.map +0 -1
- package/dist/container/token.js.map +0 -1
- package/dist/context/core/context.d.ts +0 -95
- package/dist/context/core/context.d.ts.map +0 -1
- package/dist/context/core/context.js +0 -103
- package/dist/context/core/context.js.map +0 -1
- package/dist/context/core/contextKey.key.d.ts.map +0 -1
- package/dist/context/core/contextKey.key.js.map +0 -1
- package/dist/context/core/executionContext.context.d.ts.map +0 -1
- package/dist/context/core/executionContext.context.js.map +0 -1
- package/dist/context/core/index.d.ts.map +0 -1
- package/dist/context/core/index.js.map +0 -1
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js.map +0 -1
- package/dist/context/provider/contextProvider.provider.d.ts.map +0 -1
- package/dist/context/provider/contextProvider.provider.js.map +0 -1
- package/dist/context/provider/contextStorage.storage.d.ts.map +0 -1
- package/dist/context/provider/contextStorage.storage.js.map +0 -1
- package/dist/context/provider/index.d.ts.map +0 -1
- package/dist/context/provider/index.js.map +0 -1
- package/dist/context/snapshot/contextSnapshot.snapshot.d.ts.map +0 -1
- package/dist/context/snapshot/contextSnapshot.snapshot.js.map +0 -1
- package/dist/context/snapshot/index.d.ts.map +0 -1
- package/dist/context/snapshot/index.js.map +0 -1
- package/dist/context/values/contextValues.values.d.ts.map +0 -1
- package/dist/context/values/contextValues.values.js.map +0 -1
- package/dist/context/values/index.d.ts.map +0 -1
- package/dist/context/values/index.js.map +0 -1
- package/dist/contracts/adapter.d.ts.map +0 -1
- package/dist/contracts/adapter.js.map +0 -1
- package/dist/contracts/disposable.d.ts.map +0 -1
- package/dist/contracts/disposable.js.map +0 -1
- package/dist/contracts/handler.d.ts.map +0 -1
- package/dist/contracts/handler.js.map +0 -1
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/errors/errorCode.code.d.ts.map +0 -1
- package/dist/errors/errorCode.code.js.map +0 -1
- package/dist/errors/exceptions.d.ts.map +0 -1
- package/dist/errors/exceptions.js.map +0 -1
- package/dist/errors/frameworkError.error.d.ts.map +0 -1
- package/dist/errors/frameworkError.error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lifecycle/core/index.d.ts.map +0 -1
- package/dist/lifecycle/core/index.js.map +0 -1
- package/dist/lifecycle/core/lifecycle.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycle.js.map +0 -1
- package/dist/lifecycle/core/lifecycleHook.hook.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycleHook.hook.js.map +0 -1
- package/dist/lifecycle/core/lifecycleRegistry.registry.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycleRegistry.registry.js.map +0 -1
- package/dist/lifecycle/core/lifecycleState.state.d.ts +0 -2
- package/dist/lifecycle/core/lifecycleState.state.d.ts.map +0 -1
- package/dist/lifecycle/core/lifecycleState.state.js +0 -2
- package/dist/lifecycle/core/lifecycleState.state.js.map +0 -1
- package/dist/lifecycle/index.d.ts.map +0 -1
- package/dist/lifecycle/index.js.map +0 -1
- package/dist/lifecycle/manager/index.d.ts.map +0 -1
- package/dist/lifecycle/manager/index.js.map +0 -1
- package/dist/lifecycle/manager/lifecycleManager.manager.d.ts.map +0 -1
- package/dist/lifecycle/manager/lifecycleManager.manager.js.map +0 -1
- package/dist/lifecycle/scope/index.d.ts.map +0 -1
- package/dist/lifecycle/scope/index.js.map +0 -1
- package/dist/lifecycle/scope/lifecycleScope.scope.d.ts.map +0 -1
- package/dist/lifecycle/scope/lifecycleScope.scope.js.map +0 -1
- package/dist/logging/console/consoleLogger.logger.d.ts.map +0 -1
- package/dist/logging/console/consoleLogger.logger.js.map +0 -1
- package/dist/logging/console/index.d.ts.map +0 -1
- package/dist/logging/console/index.js.map +0 -1
- package/dist/logging/console/loggerFactory.factory.d.ts.map +0 -1
- package/dist/logging/console/loggerFactory.factory.js.map +0 -1
- package/dist/logging/core/index.d.ts.map +0 -1
- package/dist/logging/core/index.js.map +0 -1
- package/dist/logging/core/logEntry.entry.d.ts.map +0 -1
- package/dist/logging/core/logEntry.entry.js.map +0 -1
- package/dist/logging/core/logLevel.level.d.ts.map +0 -1
- package/dist/logging/core/logLevel.level.js.map +0 -1
- package/dist/logging/core/logger.d.ts.map +0 -1
- package/dist/logging/core/logger.js.map +0 -1
- package/dist/logging/core/loggerContext.context.d.ts.map +0 -1
- package/dist/logging/core/loggerContext.context.js.map +0 -1
- package/dist/logging/core/loggerOptions.options.d.ts.map +0 -1
- package/dist/logging/core/loggerOptions.options.js.map +0 -1
- package/dist/logging/index.d.ts.map +0 -1
- package/dist/logging/index.js.map +0 -1
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/modules/index.js.map +0 -1
- package/dist/modules/module.d.ts.map +0 -1
- package/dist/modules/module.js.map +0 -1
- package/dist/modules/moduleContext.context.d.ts.map +0 -1
- package/dist/modules/moduleContext.context.js.map +0 -1
- package/dist/modules/moduleDefinition.definition.d.ts.map +0 -1
- package/dist/modules/moduleDefinition.definition.js.map +0 -1
- package/dist/modules/moduleDependency/index.d.ts.map +0 -1
- package/dist/modules/moduleDependency/index.js.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.graph.d.ts.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.graph.js.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.ordering.d.ts.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.ordering.js.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.type.d.ts.map +0 -1
- package/dist/modules/moduleDependency/moduleDependency.type.js.map +0 -1
- package/dist/modules/moduleError/index.d.ts.map +0 -1
- package/dist/modules/moduleError/index.js.map +0 -1
- package/dist/modules/moduleError/moduleError.base.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.base.js.map +0 -1
- package/dist/modules/moduleError/moduleError.dependency.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.dependency.js.map +0 -1
- package/dist/modules/moduleError/moduleError.helpers.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.helpers.js.map +0 -1
- package/dist/modules/moduleError/moduleError.lifecycle.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.lifecycle.js.map +0 -1
- package/dist/modules/moduleError/moduleError.registration.d.ts.map +0 -1
- package/dist/modules/moduleError/moduleError.registration.js.map +0 -1
- package/dist/modules/moduleLifecycle/index.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/index.js.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.lifecycle.js.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.stateMachine.js.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.d.ts.map +0 -1
- package/dist/modules/moduleLifecycle/moduleLifecycle.type.js.map +0 -1
- package/dist/modules/moduleLoader/index.d.ts.map +0 -1
- package/dist/modules/moduleLoader/index.js.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.loader.d.ts.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.loader.js.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.type.d.ts.map +0 -1
- package/dist/modules/moduleLoader/moduleLoader.type.js.map +0 -1
- package/dist/modules/moduleMetadata.metadata.d.ts.map +0 -1
- package/dist/modules/moduleMetadata.metadata.js.map +0 -1
- package/dist/modules/moduleRegistry/index.d.ts.map +0 -1
- package/dist/modules/moduleRegistry/index.js.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.registry.d.ts.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.registry.js.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.type.d.ts.map +0 -1
- package/dist/modules/moduleRegistry/moduleRegistry.type.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/runtime.d.ts.map +0 -1
- package/dist/runtime/runtime.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/index.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/index.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/index.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/index.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.d.ts +0 -6
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.js +0 -27
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.invoke.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/pipeline/runtimeBootstrap.pipeline.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.core.js.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.d.ts.map +0 -1
- package/dist/runtime/runtimeBootstrap/runtimeBootstrap.type.js.map +0 -1
- package/dist/runtime/runtimeContext/index.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/index.js.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.core.d.ts +0 -38
- package/dist/runtime/runtimeContext/runtimeContext.core.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.core.js +0 -99
- package/dist/runtime/runtimeContext/runtimeContext.core.js.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.factory.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.factory.js.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.type.d.ts.map +0 -1
- package/dist/runtime/runtimeContext/runtimeContext.type.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/index.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/index.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.detection.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.detection.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.env.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/detection/runtimeEnvironment.os.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/index.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/index.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.core.js.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.d.ts.map +0 -1
- package/dist/runtime/runtimeEnvironment/runtimeEnvironment.type.js.map +0 -1
- package/dist/runtime/runtimeError/index.d.ts.map +0 -1
- package/dist/runtime/runtimeError/index.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.base.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.base.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.lifecycle.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.lifecycle.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.specialized.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.specialized.js.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.type.d.ts.map +0 -1
- package/dist/runtime/runtimeError/runtimeError.type.js.map +0 -1
- package/dist/runtime/runtimeLogger.d.ts.map +0 -1
- package/dist/runtime/runtimeLogger.js.map +0 -1
- package/dist/runtime/runtimeManager/index.d.ts +0 -12
- package/dist/runtime/runtimeManager/index.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/index.js +0 -11
- package/dist/runtime/runtimeManager/index.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.core.d.ts +0 -31
- package/dist/runtime/runtimeManager/runtimeManager.core.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.core.js +0 -136
- package/dist/runtime/runtimeManager/runtimeManager.core.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.error.d.ts +0 -14
- package/dist/runtime/runtimeManager/runtimeManager.error.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.error.js +0 -21
- package/dist/runtime/runtimeManager/runtimeManager.error.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.factory.d.ts +0 -7
- package/dist/runtime/runtimeManager/runtimeManager.factory.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.factory.js +0 -8
- package/dist/runtime/runtimeManager/runtimeManager.factory.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.d.ts +0 -16
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.js +0 -49
- package/dist/runtime/runtimeManager/runtimeManager.lifecycle.js.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.type.d.ts +0 -54
- package/dist/runtime/runtimeManager/runtimeManager.type.d.ts.map +0 -1
- package/dist/runtime/runtimeManager/runtimeManager.type.js +0 -2
- package/dist/runtime/runtimeManager/runtimeManager.type.js.map +0 -1
- package/dist/runtime/runtimeOptions/index.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/index.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.defaults.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.resolver.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.resolver.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.type.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.type.js.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.validation.d.ts.map +0 -1
- package/dist/runtime/runtimeOptions/runtimeOptions.validation.js.map +0 -1
- package/dist/runtime/runtimeShutdown/index.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/index.js.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/index.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/index.js.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/pipeline/runtimeShutdown.pipeline.js.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.core.js.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.type.d.ts.map +0 -1
- package/dist/runtime/runtimeShutdown/runtimeShutdown.type.js.map +0 -1
- package/dist/runtime/runtimeState.state.d.ts.map +0 -1
- package/dist/runtime/runtimeState.state.js.map +0 -1
|
@@ -91,14 +91,30 @@ export interface ModuleContext extends ModuleContextInfo {
|
|
|
91
91
|
/**
|
|
92
92
|
* Returns another module's context.
|
|
93
93
|
*
|
|
94
|
-
*
|
|
94
|
+
* Access is restricted to declared module dependencies: when
|
|
95
|
+
* the requested module is not declared as a dependency of the
|
|
96
|
+
* current module, MissingModuleDependencyError is thrown.
|
|
97
|
+
* Declared dependencies that have not been loaded yet resolve
|
|
98
|
+
* to undefined.
|
|
95
99
|
*/
|
|
96
100
|
getModuleContext(moduleId: ModuleId): ModuleContext | undefined;
|
|
97
101
|
/**
|
|
98
|
-
* Returns whether another module is available.
|
|
102
|
+
* Returns whether another module is available to this module.
|
|
103
|
+
*
|
|
104
|
+
* Only declared dependencies can be observed: undeclared modules
|
|
105
|
+
* always report false, so a module cannot discover modules it
|
|
106
|
+
* does not depend on.
|
|
99
107
|
*/
|
|
100
108
|
hasModule(moduleId: ModuleId): boolean;
|
|
101
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Resolves the context of another module by id.
|
|
112
|
+
*
|
|
113
|
+
* The loader hands each module a resolver instead of its live
|
|
114
|
+
* context map, so modules never hold a reference to shared
|
|
115
|
+
* runtime state.
|
|
116
|
+
*/
|
|
117
|
+
export type ModuleContextResolver = (moduleId: ModuleId) => ModuleContext | undefined;
|
|
102
118
|
/**
|
|
103
119
|
* Internal implementation of ModuleContext.
|
|
104
120
|
*
|
|
@@ -115,8 +131,15 @@ export declare class DefaultModuleContext implements ModuleContext {
|
|
|
115
131
|
readonly application: ApplicationContext;
|
|
116
132
|
readonly configuration: ConfigurationManager;
|
|
117
133
|
readonly logger: Logger;
|
|
118
|
-
private readonly
|
|
119
|
-
|
|
134
|
+
private readonly resolveModuleContext;
|
|
135
|
+
/**
|
|
136
|
+
* Ids of the modules this module declares as dependencies.
|
|
137
|
+
*
|
|
138
|
+
* When undefined, dependency access is not enforced (legacy
|
|
139
|
+
* construction path).
|
|
140
|
+
*/
|
|
141
|
+
private readonly declaredDependencies?;
|
|
142
|
+
constructor(module: Module, dependencies: ModuleContextDependencies, metadata?: ModuleMetadata, moduleContexts?: ReadonlyMap<ModuleId, ModuleContext> | ModuleContextResolver, declaredDependencies?: readonly ModuleId[]);
|
|
120
143
|
/**
|
|
121
144
|
* Returns the current configuration.
|
|
122
145
|
*/
|
|
@@ -131,10 +154,13 @@ export declare class DefaultModuleContext implements ModuleContext {
|
|
|
131
154
|
requireConfig<T = unknown>(path: string): T;
|
|
132
155
|
/**
|
|
133
156
|
* Gets the context of another module.
|
|
157
|
+
*
|
|
158
|
+
* Only declared dependencies are accessible; requesting an
|
|
159
|
+
* undeclared module throws MissingModuleDependencyError.
|
|
134
160
|
*/
|
|
135
161
|
getModuleContext(moduleId: ModuleId): ModuleContext | undefined;
|
|
136
162
|
/**
|
|
137
|
-
* Checks whether
|
|
163
|
+
* Checks whether a declared dependency is available.
|
|
138
164
|
*/
|
|
139
165
|
hasModule(moduleId: ModuleId): boolean;
|
|
140
166
|
}
|
|
@@ -155,9 +181,17 @@ export interface CreateModuleContextOptions {
|
|
|
155
181
|
*/
|
|
156
182
|
readonly metadata?: ModuleMetadata;
|
|
157
183
|
/**
|
|
158
|
-
* Contexts of modules that have already been resolved
|
|
184
|
+
* Contexts of modules that have already been resolved, either
|
|
185
|
+
* as a map or as a resolver function. The loader supplies a
|
|
186
|
+
* resolver so the module never receives the live context map.
|
|
187
|
+
*/
|
|
188
|
+
readonly moduleContexts?: ReadonlyMap<ModuleId, ModuleContext> | ModuleContextResolver;
|
|
189
|
+
/**
|
|
190
|
+
* Ids of the modules the current module declares as
|
|
191
|
+
* dependencies. When supplied, getModuleContext enforces
|
|
192
|
+
* declared-dependency access.
|
|
159
193
|
*/
|
|
160
|
-
readonly
|
|
194
|
+
readonly declaredDependencies?: readonly ModuleId[];
|
|
161
195
|
}
|
|
162
196
|
/**
|
|
163
197
|
* Creates a module context.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { deepFreezeModuleOptions } from "./moduleDefinition.definition.js";
|
|
2
|
+
import { MissingModuleDependencyError } from "./moduleError/moduleError.dependency.js";
|
|
1
3
|
/**
|
|
2
4
|
* Internal implementation of ModuleContext.
|
|
3
5
|
*
|
|
@@ -14,20 +16,33 @@ export class DefaultModuleContext {
|
|
|
14
16
|
application;
|
|
15
17
|
configuration;
|
|
16
18
|
logger;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
resolveModuleContext;
|
|
20
|
+
/**
|
|
21
|
+
* Ids of the modules this module declares as dependencies.
|
|
22
|
+
*
|
|
23
|
+
* When undefined, dependency access is not enforced (legacy
|
|
24
|
+
* construction path).
|
|
25
|
+
*/
|
|
26
|
+
declaredDependencies;
|
|
27
|
+
constructor(module, dependencies, metadata, moduleContexts = new Map(), declaredDependencies) {
|
|
19
28
|
this.id = module.id;
|
|
20
29
|
this.name = module.name;
|
|
21
30
|
this.version = module.version;
|
|
22
31
|
this.metadata = metadata;
|
|
23
|
-
this.options =
|
|
32
|
+
this.options = deepFreezeModuleOptions({
|
|
24
33
|
...(module.options ?? {}),
|
|
25
34
|
});
|
|
26
35
|
this.scope = module.scope;
|
|
27
36
|
this.application = dependencies.application;
|
|
28
37
|
this.configuration = dependencies.configuration;
|
|
29
38
|
this.logger = dependencies.logger;
|
|
30
|
-
this.
|
|
39
|
+
this.resolveModuleContext =
|
|
40
|
+
typeof moduleContexts === "function"
|
|
41
|
+
? moduleContexts
|
|
42
|
+
: (moduleId) => moduleContexts.get(moduleId);
|
|
43
|
+
this.declaredDependencies = declaredDependencies
|
|
44
|
+
? new Set(declaredDependencies)
|
|
45
|
+
: undefined;
|
|
31
46
|
}
|
|
32
47
|
/**
|
|
33
48
|
* Returns the current configuration.
|
|
@@ -49,22 +64,30 @@ export class DefaultModuleContext {
|
|
|
49
64
|
}
|
|
50
65
|
/**
|
|
51
66
|
* Gets the context of another module.
|
|
67
|
+
*
|
|
68
|
+
* Only declared dependencies are accessible; requesting an
|
|
69
|
+
* undeclared module throws MissingModuleDependencyError.
|
|
52
70
|
*/
|
|
53
71
|
getModuleContext(moduleId) {
|
|
54
|
-
|
|
72
|
+
if (this.declaredDependencies && !this.declaredDependencies.has(moduleId)) {
|
|
73
|
+
throw new MissingModuleDependencyError(this.id, moduleId);
|
|
74
|
+
}
|
|
75
|
+
return this.resolveModuleContext(moduleId);
|
|
55
76
|
}
|
|
56
77
|
/**
|
|
57
|
-
* Checks whether
|
|
78
|
+
* Checks whether a declared dependency is available.
|
|
58
79
|
*/
|
|
59
80
|
hasModule(moduleId) {
|
|
60
|
-
|
|
81
|
+
if (this.declaredDependencies && !this.declaredDependencies.has(moduleId))
|
|
82
|
+
return false;
|
|
83
|
+
return this.resolveModuleContext(moduleId) !== undefined;
|
|
61
84
|
}
|
|
62
85
|
}
|
|
63
86
|
/**
|
|
64
87
|
* Creates a module context.
|
|
65
88
|
*/
|
|
66
89
|
export function createModuleContext(options) {
|
|
67
|
-
return new DefaultModuleContext(options.module, options.dependencies, options.metadata, options.moduleContexts);
|
|
90
|
+
return new DefaultModuleContext(options.module, options.dependencies, options.metadata, options.moduleContexts, options.declaredDependencies);
|
|
68
91
|
}
|
|
69
92
|
/**
|
|
70
93
|
* Type guard for ModuleContext.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { Module, ModuleId, ModuleOptions } from "./module.js";
|
|
2
2
|
import type { ModuleMetadata } from "./moduleMetadata.metadata.js";
|
|
3
|
+
/**
|
|
4
|
+
* Recursively freezes a module options tree.
|
|
5
|
+
*
|
|
6
|
+
* Already frozen nodes are skipped. Only plain objects and
|
|
7
|
+
* arrays are traversed; class instances are frozen shallowly.
|
|
8
|
+
*/
|
|
9
|
+
export declare function deepFreezeModuleOptions<T>(value: T): T;
|
|
3
10
|
/**
|
|
4
11
|
* Factory used to create a module instance.
|
|
5
12
|
*
|
|
@@ -65,14 +72,12 @@ export interface ModuleDefinition<TModule extends Module = Module> {
|
|
|
65
72
|
* Whether the module should be automatically loaded.
|
|
66
73
|
*
|
|
67
74
|
* Defaults to true.
|
|
68
|
-
*/
|
|
69
|
-
readonly autoLoad?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Whether multiple instances of this module are allowed.
|
|
72
75
|
*
|
|
73
|
-
*
|
|
76
|
+
* A module with autoLoad disabled is still loaded when it is
|
|
77
|
+
* requested explicitly or when another loading module requires
|
|
78
|
+
* it as a dependency.
|
|
74
79
|
*/
|
|
75
|
-
readonly
|
|
80
|
+
readonly autoLoad?: boolean;
|
|
76
81
|
}
|
|
77
82
|
/**
|
|
78
83
|
* Options used when creating a module definition.
|
|
@@ -86,7 +91,6 @@ export interface DefineModuleOptions<TModule extends Module = Module> {
|
|
|
86
91
|
readonly metadata?: ModuleMetadata;
|
|
87
92
|
readonly options?: ModuleOptions;
|
|
88
93
|
readonly autoLoad?: boolean;
|
|
89
|
-
readonly multiInstance?: boolean;
|
|
90
94
|
}
|
|
91
95
|
/**
|
|
92
96
|
* Creates an immutable module definition.
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
import { InvalidModuleDefinitionError } from "./moduleError/moduleError.registration.js";
|
|
2
|
+
/**
|
|
3
|
+
* Recursively freezes a module options tree.
|
|
4
|
+
*
|
|
5
|
+
* Already frozen nodes are skipped. Only plain objects and
|
|
6
|
+
* arrays are traversed; class instances are frozen shallowly.
|
|
7
|
+
*/
|
|
8
|
+
export function deepFreezeModuleOptions(value) {
|
|
9
|
+
if (value === null || typeof value !== "object")
|
|
10
|
+
return value;
|
|
11
|
+
if (Object.isFrozen(value))
|
|
12
|
+
return value;
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
for (const item of value)
|
|
15
|
+
deepFreezeModuleOptions(item);
|
|
16
|
+
return Object.freeze(value);
|
|
17
|
+
}
|
|
18
|
+
const prototype = Object.getPrototypeOf(value);
|
|
19
|
+
if (prototype === Object.prototype || prototype === null) {
|
|
20
|
+
for (const child of Object.values(value))
|
|
21
|
+
deepFreezeModuleOptions(child);
|
|
22
|
+
}
|
|
23
|
+
return Object.freeze(value);
|
|
24
|
+
}
|
|
1
25
|
/**
|
|
2
26
|
* Creates an immutable module definition.
|
|
3
27
|
*
|
|
@@ -12,9 +36,10 @@ export function defineModule(options) {
|
|
|
12
36
|
factory: options.factory,
|
|
13
37
|
dependencies: normalizeDependencies(options.dependencies),
|
|
14
38
|
metadata: options.metadata,
|
|
15
|
-
options: options.options
|
|
39
|
+
options: options.options
|
|
40
|
+
? deepFreezeModuleOptions({ ...options.options })
|
|
41
|
+
: undefined,
|
|
16
42
|
autoLoad: options.autoLoad ?? true,
|
|
17
|
-
multiInstance: options.multiInstance ?? false,
|
|
18
43
|
});
|
|
19
44
|
}
|
|
20
45
|
/**
|
|
@@ -74,26 +99,34 @@ export function isModuleDefinition(value) {
|
|
|
74
99
|
*/
|
|
75
100
|
function validateModuleDefinition(definition) {
|
|
76
101
|
if (!definition.id || definition.id.trim().length === 0) {
|
|
77
|
-
throw new
|
|
102
|
+
throw new InvalidModuleDefinitionError("Module definition requires a non-empty id.");
|
|
103
|
+
}
|
|
104
|
+
/*
|
|
105
|
+
* Ids are canonicalized once here: a definition whose id would
|
|
106
|
+
* change under trim() is rejected so the registry, loader, and
|
|
107
|
+
* lifecycle can use definition.id directly everywhere.
|
|
108
|
+
*/
|
|
109
|
+
if (definition.id !== definition.id.trim()) {
|
|
110
|
+
throw new InvalidModuleDefinitionError(`Module id "${definition.id}" must not contain leading or trailing whitespace.`, definition.id);
|
|
78
111
|
}
|
|
79
112
|
if (!definition.name || definition.name.trim().length === 0) {
|
|
80
|
-
throw new
|
|
113
|
+
throw new InvalidModuleDefinitionError(`Module "${definition.id}" requires a non-empty name.`, definition.id);
|
|
81
114
|
}
|
|
82
115
|
if (typeof definition.factory !== "function") {
|
|
83
|
-
throw new
|
|
116
|
+
throw new InvalidModuleDefinitionError(`Module "${definition.id}" requires a factory function.`, definition.id);
|
|
84
117
|
}
|
|
85
118
|
const dependencies = definition.dependencies ?? [];
|
|
86
119
|
const dependencyIds = new Set();
|
|
87
120
|
for (const dependency of dependencies) {
|
|
88
121
|
const id = typeof dependency === "string" ? dependency : dependency.id;
|
|
89
122
|
if (!id || id.trim().length === 0) {
|
|
90
|
-
throw new
|
|
123
|
+
throw new InvalidModuleDefinitionError(`Module "${definition.id}" contains an invalid dependency.`, definition.id);
|
|
91
124
|
}
|
|
92
125
|
if (id === definition.id) {
|
|
93
|
-
throw new
|
|
126
|
+
throw new InvalidModuleDefinitionError(`Module "${definition.id}" cannot depend on itself.`, definition.id);
|
|
94
127
|
}
|
|
95
128
|
if (dependencyIds.has(id)) {
|
|
96
|
-
throw new
|
|
129
|
+
throw new InvalidModuleDefinitionError(`Module "${definition.id}" declares dependency "${id}" more than once.`, definition.id);
|
|
97
130
|
}
|
|
98
131
|
dependencyIds.add(id);
|
|
99
132
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Dependency graph types, validation, and topological ordering
|
|
5
5
|
* for module dependency resolution.
|
|
6
6
|
*/
|
|
7
|
-
export { type ModuleDependency, type ModuleDependencies, type ModuleDependencyNode, type ModuleDependencyGraph, type ModuleDependencyInput, } from "./moduleDependency.type.js";
|
|
8
|
-
export { normalizeModuleDependency, normalizeModuleDependencies, validateModuleDependencies, validateModuleDependencyGraph, createModuleDependencyGraph, createModuleDependency, isOptionalModuleDependency, hasModuleVersionConstraint, } from "./moduleDependency.graph.js";
|
|
7
|
+
export { type ModuleDependency, type ModuleDependencies, type ModuleDependencyNode, type ModuleDependencyGraph, type ModuleDependencyInput, type ModuleDependencyNodeInput, } from "./moduleDependency.type.js";
|
|
8
|
+
export { normalizeModuleDependency, normalizeModuleDependencies, validateModuleDependencies, validateModuleDependencyGraph, createModuleDependencyGraph, createModuleDependency, isOptionalModuleDependency, hasModuleVersionConstraint, satisfiesModuleVersionConstraint, } from "./moduleDependency.graph.js";
|
|
9
9
|
export { findModuleDependencyCycle, hasModuleDependencyCycle, resolveModuleStartupOrder, resolveModuleShutdownOrder, } from "./moduleDependency.ordering.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* for module dependency resolution.
|
|
6
6
|
*/
|
|
7
7
|
export {} from "./moduleDependency.type.js";
|
|
8
|
-
export { normalizeModuleDependency, normalizeModuleDependencies, validateModuleDependencies, validateModuleDependencyGraph, createModuleDependencyGraph, createModuleDependency, isOptionalModuleDependency, hasModuleVersionConstraint, } from "./moduleDependency.graph.js";
|
|
8
|
+
export { normalizeModuleDependency, normalizeModuleDependencies, validateModuleDependencies, validateModuleDependencyGraph, createModuleDependencyGraph, createModuleDependency, isOptionalModuleDependency, hasModuleVersionConstraint, satisfiesModuleVersionConstraint, } from "./moduleDependency.graph.js";
|
|
9
9
|
export { findModuleDependencyCycle, hasModuleDependencyCycle, resolveModuleStartupOrder, resolveModuleShutdownOrder, } from "./moduleDependency.ordering.js";
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModuleId } from "../module.js";
|
|
2
|
-
import type { ModuleDependency, ModuleDependencies,
|
|
2
|
+
import type { ModuleDependency, ModuleDependencies, ModuleDependencyGraph, ModuleDependencyInput, ModuleDependencyNodeInput } from "./moduleDependency.type.js";
|
|
3
3
|
/**
|
|
4
4
|
* Normalizes a dependency declaration.
|
|
5
5
|
*/
|
|
@@ -18,7 +18,7 @@ export declare function validateModuleDependencies(moduleId: ModuleId, dependenc
|
|
|
18
18
|
* This function validates duplicate nodes and self-dependencies,
|
|
19
19
|
* but deliberately does not perform topological sorting.
|
|
20
20
|
*/
|
|
21
|
-
export declare function createModuleDependencyGraph(nodes: readonly
|
|
21
|
+
export declare function createModuleDependencyGraph(nodes: readonly ModuleDependencyNodeInput[]): ModuleDependencyGraph;
|
|
22
22
|
/**
|
|
23
23
|
* Validates that all required dependencies exist.
|
|
24
24
|
*
|
|
@@ -40,4 +40,21 @@ export declare function isOptionalModuleDependency(dependency: ModuleDependency)
|
|
|
40
40
|
* Checks whether a dependency has a version constraint.
|
|
41
41
|
*/
|
|
42
42
|
export declare function hasModuleVersionConstraint(dependency: ModuleDependency): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether a module version satisfies a constraint.
|
|
45
|
+
*
|
|
46
|
+
* Supported constraint forms:
|
|
47
|
+
*
|
|
48
|
+
* 1.2.3 exact match
|
|
49
|
+
* ^1.2.3 compatible within the same major (same minor for 0.x)
|
|
50
|
+
* ~1.2.3 compatible within the same minor
|
|
51
|
+
* >=1.2.3 at least
|
|
52
|
+
* >1.2.3 greater than
|
|
53
|
+
* <=1.2.3 at most
|
|
54
|
+
* <1.2.3 less than
|
|
55
|
+
*
|
|
56
|
+
* A dependency with a declared constraint is NOT satisfied when
|
|
57
|
+
* the dependency module declares no version at all.
|
|
58
|
+
*/
|
|
59
|
+
export declare function satisfiesModuleVersionConstraint(constraint: string, version: string | undefined): boolean;
|
|
43
60
|
//# sourceMappingURL=moduleDependency.graph.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { InvalidModuleDependencyError, ModuleVersionMismatchError, } from "../moduleError/moduleError.dependency.js";
|
|
2
|
+
import { InvalidModuleDefinitionError } from "../moduleError/moduleError.registration.js";
|
|
1
3
|
/**
|
|
2
4
|
* Normalizes a dependency declaration.
|
|
3
5
|
*/
|
|
@@ -5,7 +7,7 @@ export function normalizeModuleDependency(dependency) {
|
|
|
5
7
|
if (typeof dependency === "string") {
|
|
6
8
|
const id = dependency.trim();
|
|
7
9
|
if (!id) {
|
|
8
|
-
throw new
|
|
10
|
+
throw new InvalidModuleDependencyError("Module dependency id cannot be empty.");
|
|
9
11
|
}
|
|
10
12
|
return Object.freeze({
|
|
11
13
|
id,
|
|
@@ -14,7 +16,7 @@ export function normalizeModuleDependency(dependency) {
|
|
|
14
16
|
}
|
|
15
17
|
const id = dependency.id?.trim();
|
|
16
18
|
if (!id) {
|
|
17
|
-
throw new
|
|
19
|
+
throw new InvalidModuleDependencyError("Module dependency id cannot be empty.");
|
|
18
20
|
}
|
|
19
21
|
return Object.freeze({
|
|
20
22
|
id,
|
|
@@ -34,7 +36,7 @@ export function normalizeModuleDependencies(dependencies) {
|
|
|
34
36
|
for (const dependency of dependencies) {
|
|
35
37
|
const item = normalizeModuleDependency(dependency);
|
|
36
38
|
if (seen.has(item.id)) {
|
|
37
|
-
throw new
|
|
39
|
+
throw new InvalidModuleDependencyError(`Module dependency "${item.id}" is declared more than once.`, { dependencyId: item.id });
|
|
38
40
|
}
|
|
39
41
|
seen.add(item.id);
|
|
40
42
|
normalized.push(item);
|
|
@@ -47,15 +49,15 @@ export function normalizeModuleDependencies(dependencies) {
|
|
|
47
49
|
export function validateModuleDependencies(moduleId, dependencies) {
|
|
48
50
|
const normalizedModuleId = moduleId.trim();
|
|
49
51
|
if (!normalizedModuleId) {
|
|
50
|
-
throw new
|
|
52
|
+
throw new InvalidModuleDefinitionError("Module id cannot be empty.");
|
|
51
53
|
}
|
|
52
54
|
for (const dependency of dependencies) {
|
|
53
55
|
if (dependency.id === normalizedModuleId) {
|
|
54
|
-
throw new
|
|
56
|
+
throw new InvalidModuleDependencyError(`Module "${normalizedModuleId}" cannot depend on itself.`, { moduleId: normalizedModuleId, dependencyId: dependency.id });
|
|
55
57
|
}
|
|
56
58
|
if (dependency.version !== undefined &&
|
|
57
59
|
!isValidVersionConstraint(dependency.version)) {
|
|
58
|
-
throw new
|
|
60
|
+
throw new InvalidModuleDependencyError(`Invalid version constraint "${dependency.version}" for module dependency "${dependency.id}".`, { moduleId: normalizedModuleId, dependencyId: dependency.id });
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -70,18 +72,36 @@ export function createModuleDependencyGraph(nodes) {
|
|
|
70
72
|
for (const node of nodes) {
|
|
71
73
|
const id = node.id.trim();
|
|
72
74
|
if (!id) {
|
|
73
|
-
throw new
|
|
75
|
+
throw new InvalidModuleDefinitionError("Module dependency graph nodes require a non-empty id.");
|
|
74
76
|
}
|
|
75
77
|
if (nodeMap.has(id)) {
|
|
76
|
-
throw new
|
|
78
|
+
throw new InvalidModuleDefinitionError(`Module "${id}" appears more than once in the dependency graph.`, id);
|
|
77
79
|
}
|
|
78
80
|
const dependencies = normalizeModuleDependencies(node.dependencies);
|
|
79
81
|
validateModuleDependencies(id, dependencies);
|
|
80
82
|
nodeMap.set(id, Object.freeze({
|
|
81
83
|
id,
|
|
82
84
|
dependencies,
|
|
85
|
+
version: node.version,
|
|
83
86
|
}));
|
|
84
87
|
}
|
|
88
|
+
/*
|
|
89
|
+
* Version constraints are enforced while building the graph:
|
|
90
|
+
* every dependency with a declared constraint must be satisfied
|
|
91
|
+
* by the dependency module's declared version.
|
|
92
|
+
*/
|
|
93
|
+
for (const node of nodeMap.values()) {
|
|
94
|
+
for (const dependency of node.dependencies) {
|
|
95
|
+
if (dependency.version === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
const target = nodeMap.get(dependency.id);
|
|
98
|
+
if (!target)
|
|
99
|
+
continue;
|
|
100
|
+
if (!satisfiesModuleVersionConstraint(dependency.version, target.version)) {
|
|
101
|
+
throw new ModuleVersionMismatchError(dependency.id, dependency.version, target.version);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
85
105
|
const readonlyNodes = new Map(nodeMap);
|
|
86
106
|
return {
|
|
87
107
|
nodes: readonlyNodes,
|
|
@@ -172,4 +192,98 @@ function normalizeVersionConstraint(value) {
|
|
|
172
192
|
function isValidVersionConstraint(value) {
|
|
173
193
|
return /^(?:[<>=~^]*\s*)?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\s*)$/.test(value);
|
|
174
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Parses a semantic version string.
|
|
197
|
+
*/
|
|
198
|
+
function parseSemanticVersion(value) {
|
|
199
|
+
const match = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(value.trim());
|
|
200
|
+
if (!match) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
major: Number(match[1]),
|
|
205
|
+
minor: Number(match[2]),
|
|
206
|
+
patch: Number(match[3]),
|
|
207
|
+
prerelease: match[4],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Compares two parsed semantic versions.
|
|
212
|
+
*
|
|
213
|
+
* Returns a negative value when a < b, zero when equal, and a
|
|
214
|
+
* positive value when a > b. Prerelease identifiers sort below
|
|
215
|
+
* their release version but are not compared to each other in
|
|
216
|
+
* detail; this is a deliberately simple comparison.
|
|
217
|
+
*/
|
|
218
|
+
function compareSemanticVersions(a, b) {
|
|
219
|
+
if (a.major !== b.major)
|
|
220
|
+
return a.major - b.major;
|
|
221
|
+
if (a.minor !== b.minor)
|
|
222
|
+
return a.minor - b.minor;
|
|
223
|
+
if (a.patch !== b.patch)
|
|
224
|
+
return a.patch - b.patch;
|
|
225
|
+
if (a.prerelease && !b.prerelease)
|
|
226
|
+
return -1;
|
|
227
|
+
if (!a.prerelease && b.prerelease)
|
|
228
|
+
return 1;
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Checks whether a module version satisfies a constraint.
|
|
233
|
+
*
|
|
234
|
+
* Supported constraint forms:
|
|
235
|
+
*
|
|
236
|
+
* 1.2.3 exact match
|
|
237
|
+
* ^1.2.3 compatible within the same major (same minor for 0.x)
|
|
238
|
+
* ~1.2.3 compatible within the same minor
|
|
239
|
+
* >=1.2.3 at least
|
|
240
|
+
* >1.2.3 greater than
|
|
241
|
+
* <=1.2.3 at most
|
|
242
|
+
* <1.2.3 less than
|
|
243
|
+
*
|
|
244
|
+
* A dependency with a declared constraint is NOT satisfied when
|
|
245
|
+
* the dependency module declares no version at all.
|
|
246
|
+
*/
|
|
247
|
+
export function satisfiesModuleVersionConstraint(constraint, version) {
|
|
248
|
+
const trimmedConstraint = constraint.trim();
|
|
249
|
+
// `(\S.*)` rather than `(.+)`: `.` matches spaces too, so `\s*(.+)` lets the
|
|
250
|
+
// engine split a whitespace run at every position before giving up.
|
|
251
|
+
const operatorMatch = /^(\^|~|>=|<=|>|<)?\s*(\S.*)$/.exec(trimmedConstraint);
|
|
252
|
+
if (!operatorMatch)
|
|
253
|
+
return false;
|
|
254
|
+
const operator = operatorMatch[1] ?? "";
|
|
255
|
+
const base = parseSemanticVersion(operatorMatch[2] ?? "");
|
|
256
|
+
if (!base)
|
|
257
|
+
return false;
|
|
258
|
+
if (version === undefined)
|
|
259
|
+
return false;
|
|
260
|
+
const actual = parseSemanticVersion(version);
|
|
261
|
+
if (!actual)
|
|
262
|
+
return false;
|
|
263
|
+
const comparison = compareSemanticVersions(actual, base);
|
|
264
|
+
switch (operator) {
|
|
265
|
+
case "":
|
|
266
|
+
return comparison === 0;
|
|
267
|
+
case "^":
|
|
268
|
+
if (actual.major !== base.major)
|
|
269
|
+
return false;
|
|
270
|
+
if (base.major === 0 && actual.minor !== base.minor)
|
|
271
|
+
return false;
|
|
272
|
+
return comparison >= 0;
|
|
273
|
+
case "~":
|
|
274
|
+
return (actual.major === base.major &&
|
|
275
|
+
actual.minor === base.minor &&
|
|
276
|
+
comparison >= 0);
|
|
277
|
+
case ">=":
|
|
278
|
+
return comparison >= 0;
|
|
279
|
+
case ">":
|
|
280
|
+
return comparison > 0;
|
|
281
|
+
case "<=":
|
|
282
|
+
return comparison <= 0;
|
|
283
|
+
case "<":
|
|
284
|
+
return comparison < 0;
|
|
285
|
+
default:
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
175
289
|
//# sourceMappingURL=moduleDependency.graph.js.map
|
|
@@ -4,6 +4,10 @@ import type { ModuleDependencyGraph } from "./moduleDependency.type.js";
|
|
|
4
4
|
* Detects circular dependencies in a module graph.
|
|
5
5
|
*
|
|
6
6
|
* Returns the dependency cycle when one exists.
|
|
7
|
+
*
|
|
8
|
+
* This is the single cycle-detection mechanism used by the
|
|
9
|
+
* dependency subsystem. The implementation is iterative so very
|
|
10
|
+
* deep graphs cannot overflow the call stack.
|
|
7
11
|
*/
|
|
8
12
|
export declare function findModuleDependencyCycle(graph: ModuleDependencyGraph): readonly ModuleId[] | undefined;
|
|
9
13
|
/**
|
|
@@ -26,6 +30,10 @@ export declare function hasModuleDependencyCycle(graph: ModuleDependencyGraph):
|
|
|
26
30
|
* produces:
|
|
27
31
|
*
|
|
28
32
|
* users → orders → payments
|
|
33
|
+
*
|
|
34
|
+
* The sort is implemented iteratively (Kahn's algorithm). When
|
|
35
|
+
* not every module can be ordered, the cycle is located with
|
|
36
|
+
* findModuleDependencyCycle and reported.
|
|
29
37
|
*/
|
|
30
38
|
export declare function resolveModuleStartupOrder(graph: ModuleDependencyGraph): readonly ModuleId[];
|
|
31
39
|
/**
|