UNPKG

13.6 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../src/inversify.config.ts"],"names":["Container","getDecorators","ComponentManager","CameraComponent","CameraSystem","ComputeComponent","LayoutComputeStrategy","ParticleComputeStrategy","ComputeSystem","PassNodeComponent","ResourceHandleComponent","FrameGraphSystem","GeometryComponent","GeometrySystem","InteractionSystem","MaterialComponent","MaterialSystem","CullableComponent","MeshComponent","MeshSystem","ForwardRenderPath","SceneComponent","SceneSystem","HierarchyComponent","NameComponent","SceneGraphSystem","TransformComponent","IDENTIFIER","container","DECORATORS","lazyInject","serviceIdentifier","original","proto","key","descriptor","call","initializer","lazyMultiInject","bind","NameComponentManager","toConstantValue","HierarchyComponentManager","TransformComponentManager","CameraComponentManager","ResourceHandleComponentManager","PassNodeComponentManager","MeshComponentManager","CullableComponentManager","GeometryComponentManager","MaterialComponentManager","SceneComponentManager","ComputeComponentManager","Systems","to","whenTargetNamed","inSingletonScope","ComputeStrategy"],"mappings":"AAAA;;;;AAIA,OAAO,kBAAP;AAEA,SAASA,SAAT,QAA4D,WAA5D;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AAEA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,qCAAhC;AACA,SAASC,YAAT,QAA6B,4BAA7B;AACA,SAASC,gBAAT,QAAiC,uCAAjC;AAEA,SAASC,qBAAT,QAAsC,4CAAtC;AACA,SAASC,uBAAT,QAAwC,8CAAxC;AACA,SAASC,aAAT,QAA8B,6BAA9B;AACA,SAASC,iBAAT,QAAkC,2CAAlC;AACA,SAASC,uBAAT,QAAwC,iDAAxC;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AACA,SAASC,iBAAT,QAAkC,yCAAlC;AACA,SAASC,cAAT,QAA+B,8BAA/B;AACA,SAASC,iBAAT,QAAkC,iCAAlC;AACA,SAASC,iBAAT,QAAkC,yCAAlC;AACA,SAASC,cAAT,QAA+B,8BAA/B;AACA,SAASC,iBAAT,QAAkC,qCAAlC;A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OAD5B,EAEGC,EAFH,CAEMxC,iBAFN,EAGGyC,eAHH,CAGmB5B,UAAU,CAACb,iBAH9B;AAKAc,SAAS,CACNW,IADH,CACiBZ,UAAU,CAAC0B,OAD5B,EAEGC,EAFH,CAEM9C,aAFN,EAGG+C,eAHH,CAGmB5B,UAAU,CAACnB,aAH9B;AAKAoB,SAAS,CACNW,IADH,CACqBZ,UAAU,CAACP,iBADhC,EAEGkC,EAFH,CAEMlC,iBAFN,EAGGoC,gBAHH;AAKA;;;;AAGA5B,SAAS,CACNW,IADH,CAC0BZ,UAAU,CAAC8B,eADrC,EAEGH,EAFH,CAEM/C,uBAFN,EAGGgD,eAHH,CAGmB,UAHnB;AAIA3B,SAAS,CACNW,IADH,CAC0BZ,UAAU,CAAC8B,eADrC,EAEGH,EAFH,CAEMhD,qBAFN,EAGGiD,eAHH,CAGmB,QAHnB","sourcesContent":["/**\n * Root Container\n * @see /dev-docs/IoC 容器、依赖注入与服务说明.md\n */\nimport 'reflect-metadata';\n\nimport { Container, decorate, injectable, interfaces } from 'inversify';\nimport getDecorators from 'inversify-inject-decorators';\nimport { ISystem } from '.';\nimport { ComponentManager } from './ComponentManager';\nimport { CameraComponent } from './components/camera/CameraComponent';\nimport { CameraSystem } from './components/camera/System';\nimport { ComputeComponent } from './components/compute/ComputeComponent';\nimport { IComputeStrategy } from './components/compute/IComputeStrategy';\nimport { LayoutComputeStrategy } from './components/compute/LayoutComputeStrategy';\nimport { ParticleComputeStrategy } from './components/compute/ParticleComputeStrategy';\nimport { ComputeSystem } from './components/compute/System';\nimport { PassNodeComponent } from './components/framegraph/PassNodeComponent';\nimport { ResourceHandleComponent } from './components/framegraph/ResourceHandleComponent';\nimport { FrameGraphSystem } from './components/framegraph/System';\nimport { GeometryComponent } from './components/geometry/GeometryComponent';\nimport { GeometrySystem } from './components/geometry/System';\nimport { InteractionSystem } from './components/interaction/System';\nimport { MaterialComponent } from './components/material/MaterialComponent';\nimport { MaterialSystem } from './components/material/System';\nimport { CullableComponent } from './components/mesh/CullableComponent';\nimport { MeshComponent } from './components/mesh/MeshComponent';\nimport { MeshSystem } from './components/mesh/System';\nimport { ForwardRenderPath } from './components/renderpath/Forward';\nimport { IRenderPath } from './components/renderpath/RenderPath';\nimport { SceneComponent } from './components/scene/SceneComponent';\nimport { SceneSystem } from './components/scene/System';\nimport { HierarchyComponent } from './components/scenegraph/HierarchyComponent';\nimport { NameComponent } from './components/scenegraph/NameComponent';\nimport { SceneGraphSystem } from './components/scenegraph/System';\nimport { TransformComponent } from './components/scenegraph/TransformComponent';\nimport { IDENTIFIER } from './identifier';\nimport { IRenderEngine } from './IRenderEngine';\n\n// @see https://github.com/inversify/InversifyJS/blob/master/wiki/container_api.md#defaultscope\nexport const container = new Container();\n\n// 支持使用 new 而非容器实例化的场景,同时禁止 lazyInject cache\n// @see https://github.com/inversify/inversify-inject-decorators#caching-vs-non-caching-behaviour\nconst DECORATORS = getDecorators(container, false);\n\ninterface IBabelPropertyDescriptor extends PropertyDescriptor {\n initializer(): any;\n}\n// Add babel legacy decorators support\n// @see https://github.com/inversify/InversifyJS/issues/1050\n// @see https://github.com/inversify/InversifyJS/issues/1026#issuecomment-504936034\nexport const lazyInject = (\n serviceIdentifier: interfaces.ServiceIdentifier<any>,\n) => {\n const original = DECORATORS.lazyInject(serviceIdentifier);\n // the 'descriptor' parameter is actually always defined for class fields for Babel, but is considered undefined for TSC\n // so we just hack it with ?/! combination to avoid \"TS1240: Unable to resolve signature of property decorator when called as an expression\"\n return function(\n this: any,\n proto: any,\n key: string,\n descriptor?: IBabelPropertyDescriptor,\n ): void {\n // make it work as usual\n original.call(this, proto, key);\n // return link to proto, so own value wont be 'undefined' after component's creation\n if (descriptor) {\n descriptor.initializer = () => {\n return proto[key];\n };\n }\n };\n};\n\nexport const lazyMultiInject = (\n serviceIdentifier: interfaces.ServiceIdentifier<any>,\n) => {\n const original = DECORATORS.lazyMultiInject(serviceIdentifier);\n // the 'descriptor' parameter is actually always defined for class fields for Babel, but is considered undefined for TSC\n // so we just hack it with ?/! combination to avoid \"TS1240: Unable to resolve signature of property decorator when called as an expression\"\n return function(\n this: any,\n proto: any,\n key: string,\n descriptor?: IBabelPropertyDescriptor,\n ): void {\n // make it work as usual\n original.call(this, proto, key);\n if (descriptor) {\n // return link to proto, so own value wont be 'undefined' after component's creation\n descriptor!.initializer = () => {\n return proto[key];\n };\n }\n };\n};\n\n/**\n * bind global component managers in root container\n */\ncontainer\n .bind<ComponentManager<NameComponent>>(IDENTIFIER.NameComponentManager)\n .toConstantValue(new ComponentManager(NameComponent));\ncontainer\n .bind<ComponentManager<HierarchyComponent>>(\n IDENTIFIER.HierarchyComponentManager,\n )\n .toConstantValue(new ComponentManager(HierarchyComponent));\ncontainer\n .bind<ComponentManager<TransformComponent>>(\n IDENTIFIER.TransformComponentManager,\n )\n .toConstantValue(new ComponentManager(TransformComponent));\ncontainer\n .bind<ComponentManager<CameraComponent>>(IDENTIFIER.CameraComponentManager)\n .toConstantValue(new ComponentManager(CameraComponent));\ncontainer\n .bind<ComponentManager<ResourceHandleComponent>>(\n IDENTIFIER.ResourceHandleComponentManager,\n )\n .toConstantValue(new ComponentManager(ResourceHandleComponent));\ncontainer\n .bind<ComponentManager<PassNodeComponent>>(\n IDENTIFIER.PassNodeComponentManager,\n )\n .toConstantValue(new ComponentManager(PassNodeComponent));\ncontainer\n .bind<ComponentManager<MeshComponent>>(IDENTIFIER.MeshComponentManager)\n .toConstantValue(new ComponentManager(MeshComponent));\ncontainer\n .bind<ComponentManager<CullableComponent>>(\n IDENTIFIER.CullableComponentManager,\n )\n .toConstantValue(new ComponentManager(CullableComponent));\ncontainer\n .bind<ComponentManager<GeometryComponent>>(\n IDENTIFIER.GeometryComponentManager,\n )\n .toConstantValue(new ComponentManager(GeometryComponent));\ncontainer\n .bind<ComponentManager<MaterialComponent>>(\n IDENTIFIER.MaterialComponentManager,\n )\n .toConstantValue(new ComponentManager(MaterialComponent));\ncontainer\n .bind<ComponentManager<SceneComponent>>(IDENTIFIER.SceneComponentManager)\n .toConstantValue(new ComponentManager(SceneComponent));\ncontainer\n .bind<ComponentManager<ComputeComponent>>(IDENTIFIER.ComputeComponentManager)\n .toConstantValue(new ComponentManager(ComputeComponent));\n\n/**\n * bind systems\n */\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(SceneGraphSystem)\n .whenTargetNamed(IDENTIFIER.SceneGraphSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(SceneSystem)\n .whenTargetNamed(IDENTIFIER.SceneSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(CameraSystem)\n .whenTargetNamed(IDENTIFIER.CameraSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(FrameGraphSystem)\n .whenTargetNamed(IDENTIFIER.FrameGraphSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(MeshSystem)\n .whenTargetNamed(IDENTIFIER.MeshSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(GeometrySystem)\n .whenTargetNamed(IDENTIFIER.GeometrySystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(MaterialSystem)\n .whenTargetNamed(IDENTIFIER.MaterialSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(InteractionSystem)\n .whenTargetNamed(IDENTIFIER.InteractionSystem);\n\ncontainer\n .bind<ISystem>(IDENTIFIER.Systems)\n .to(ComputeSystem)\n .whenTargetNamed(IDENTIFIER.ComputeSystem);\n\ncontainer\n .bind<IRenderPath>(IDENTIFIER.ForwardRenderPath)\n .to(ForwardRenderPath)\n .inSingletonScope();\n\n/**\n * bind compute strategy\n */\ncontainer\n .bind<IComputeStrategy>(IDENTIFIER.ComputeStrategy)\n .to(ParticleComputeStrategy)\n .whenTargetNamed('particle');\ncontainer\n .bind<IComputeStrategy>(IDENTIFIER.ComputeStrategy)\n .to(LayoutComputeStrategy)\n .whenTargetNamed('layout');\n"],"file":"inversify.config.js"}
\No newline at end of file