0.0.1-mono • Published 3 years ago

@builder.io/monorepo v0.0.1-mono

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

@builder.io/monorepo

Contains utility function which allows requiring code from modules compiled as mono-repo. For example @builder.io/qwik is compiled from repos/@builder.io/qwik but we want to require it from @builder.io/qwik. The utility allows requiring code from @builder.io/qwik and it rewrites node_modules so that even thought @builder.io/qwik source is not in the node_module it can still see other items in the node_module.

Usage

Note: example uses jsx-lite/core as an example of a facade package

  1. create a @jsx-lite/core facade in repos folder.
  2. create package.json which contains index.js like so:
    const monorepoRequire = require('../../monorepo-require');
    module.exports = monorepoRequire('jsx-lite/packages/core/src/index.js', module.parent);
  3. Result is that one can import @jsx/lite-core directly from facade, but will receive implementation from mono-repo.
  4. The tricky part is that the implementation of @jsx/lite-core will have visibility to the importing node_modules making it look like as if the code was actualy in the node_modules

What would happen without this package.

imagine:

- packages
  - api
    - node_modules
      - @jsx-lite/core => ../../jsx-lite/packages/jsx-lite_core.js
      - bar_pkg
- jsx-lite
  - packages
    - jsx-lite_core.js

Without the @builder.io/monorepo importing @jsx-lite/core would result in import from jsx-lite_core.js. So far so good. However, if the would try to import bar_pkg from jsx-lite_core.js it would fail because jsx-lite_core.js does not have a node_module nearby with bar_pkg. The whole purpos of @builder.io/monorepo is to make it look like the cod of jsx-lite_core.js is actually in packages/api/node_modules.

0.0.1-mono.8

3 years ago

0.0.1-mono.7

3 years ago

0.0.1-mono.9

3 years ago

0.0.1-mono.14

3 years ago

0.0.1-mono.15

3 years ago

0.0.1-mono.12

3 years ago

0.0.1-mono.13

3 years ago

0.0.1-mono.10

3 years ago

0.0.1-mono.11

3 years ago

0.0.1-mono.4

3 years ago

0.0.1-mono.6

3 years ago

0.0.1-mono.5

3 years ago

0.0.1-mono.3

3 years ago

0.0.1-mono.2

3 years ago

0.0.1-mono

3 years ago