Git Product home page Git Product logo

rxdi / core Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 1.0 1.66 MB

This repository is archived and moved to Monorepo https://github.com/rxdi/rxdi-monorepo/tree/master/packages/core

TypeScript 96.27% JavaScript 3.73%
rxjs reactive-programming reactive-extension dependency-injection-container dependency-injection-framework dependency-injection typescript typescript-decorators typescript-framework observable-streams

core's Introduction

core's People

Contributors

stradivario avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tamebadger

core's Issues

bug(Plugins): when no register method is provided throws unhandled error

This error is leading to missunderstanding of what is happening with the platform in this period of time

Provided this plugin

import { Inject, Plugin } from '@rxdi/core';
import { HAPI_SERVER } from '@rxdi/hapi';
import { Server } from 'hapi';

@Plugin()
export class ServeComponents {
  constructor(@Inject(HAPI_SERVER) private server: Server) {}

}

Throws error

TypeError: plugin.register is not a function
    at BootstrapService.<anonymous> (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:147:26)
    at Generator.next (<anonymous>)
    at /home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:16:71
    at new Promise (<anonymous>)
    at __awaiter (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:12:12)
    at BootstrapService.registerPlugin (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:145:16)
    at BootstrapService.<anonymous> (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:118:94)
    at Generator.next (<anonymous>)
    at /home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:16:71
    at new Promise (<anonymous>)
    at __awaiter (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:12:12)
    at pluginService.getPlugins.filter.map (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:118:29)
    at Array.map (<anonymous>)
    at BootstrapService.asyncChainablePluginsRegister (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:118:18)
    at SwitchMapSubscriber.rxjs_1.combineLatest.pipe.operators_1.switchMap [as project] (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/@rxdi/core/dist/services/bootstrap/bootstrap.service.js:59:554)
    at SwitchMapSubscriber._next (/home/rampage/Desktop/work/repos/public/graphql-server-from-json/node_modules/rxjs/internal/operators/switchMap.js:49:27)

Correct situation

import { Inject, Plugin } from '@rxdi/core';
import { HAPI_SERVER } from '@rxdi/hapi';
import { Server } from 'hapi';

@Plugin()
export class ServeComponents {
  constructor(@Inject(HAPI_SERVER) private server: Server) {}

  async register() {
    this.server.route({
        method: 'GET',
        path: '/devtools/{param*}',
        handler: {
          directory: {
            path: `${__dirname.replace('dist/services', '')}/public`,
            index: ['index.html', 'default.html']
          }
        }
      });
  }

}

reduce core DI bundle size - ideas

Hi, i think its possible to get the core (DI only) bundle size down by about 1000% with a little effort. This will certainly have to happen in the future, so it's better to address it now imo.

check out https://github.com/jmankopf/mani-injector and replace 'reflect-metadata' with @abraham/reflection. works great. (like 300 loc vs rxdi 40k lol).

jupyter lab has a light weight DI system with similar semantics as rxdi , except without decorators. I think it uses bottlejs under the hood.

Also,
I also did a quick test without getting it actually working, removing the ipfs and systemjs stuff from rxdi and got it down to around 7k loc, which that alone could be a good start.

https://github.com/jeffijoe/awilix also is pretty great because it doesn't require any reflection polyfill, and works in the browser by dropping 2 fs methods, which could be kept and swapped for an ipfs solution.

awilix + rxjs container/di
https://github.com/mojzu/container.ts/blob/master/src/container/container.ts

Thought/solution generation and comparison only atm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.