Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ogre-tools/linkable

ogre-works2.1kMIT17.11.1TypeScript support: included

Like 'npm link', but doesn't trip over with symlinks and local node_modules of linking target.

readme

Linkable

A substitute for $ npm link which extends library yalc with ability to link to multiple modules using wildcard-paths.

Reinventing $ npm link is necessary, because it stumbles when symlinks created by it lead to places which have their local node_modules, which will unnaturally take precedence over peerDependencies causing poisonous multiple instances in runtime.

The downside of linkable is that, unlike npm link, linkable requires linkable-push to "refresh" the targets of linking to those linking.

Usage

  1. In linking source:
    1. $ npm install --save-dev @ogre-tools/linkable
    2. Add scripts: { "postinstall": "linkable" } to package.json.
    3. Add lines to .gitignore for new stuff related only for local development:
      1. .linkable.json
      2. .yalc
      3. yalc.lock
    4. Create a configuration file: .linkable.json to project root with your preference of paths to local module directories under development, eg.:
      [
      "../some-module",
      "/some-monorepo/packages/**"
      ]
  2. In linking target:

    1. Also $ npm install --save-dev @ogre-tools/linkable
    2. Add scripts: { "postbuild": "linkable-push" } to package.json.
    3. $ npm build
  3. $ npm install in linking source will now create "live" yalc-links to packages defined in .linkable.json. When the target packages are linkable-push:ed as result from being built, the source(s) will pick up the changes.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

17.11.1 (2023-11-29)

Note: Version bump only for package ogre-tools

17.11.0 (2023-10-26)

Features

  • Expose typing of getKeyedSingletonCompositeKey (f516342)
  • Introduce DeepMap, being like Map, but with composite keys instead of singular ones (8969d27)
  • Make ComputedInjectMany support instantiation parameters (b8b0dc1)
  • Make keys of keyedSingleton able to be composed of multiple reference values (19fb547)

Bug Fixes

  • Fix bad imports and remove dead comment (1cad69f)

17.10.0 (2023-10-19)

Features

  • Introduce proper typing for pipelineBreak (6a78b40)
  • Introduce safePipeline which is like pipeline, but considers "undefined" as pipelineBreak (db82b7c)

17.9.0 (2023-10-17)

Features

  • Introduce early-override to permit override of injectable before registered (6e7f5ea)
  • Introduce way to get return-value of first of many functions that matches an input-value (c939461)

17.8.0 (2023-10-09)

Features

  • Make public a way to break/abort flow of a pipeline (30b58d9)

17.7.0 (2023-09-12)

Features

  • Make linkable throw when a glob in .linkable.json leads to no package.json (be952b6)

17.6.0 (2023-09-06)

Features

  • Introduce the injectable bunch, ie. a registrable object of multiple injectables (e115dde)
  • Make auto-register support same injectable being exported multiple times (a1527e3)

Bug Fixes

  • Enforce code coverage yet again (08dde1f)

17.5.1 (2023-06-22)

Bug Fixes

  • Expose InjectWithMeta in DI during instantiate (816e57a)

17.5.0 (2023-06-21)

Features

  • Introduce InjectWithMeta (24e9bf0)

17.4.0 (2023-06-21)

Features

  • Introduce InjectWithMeta (24e9bf0)

17.3.0 (2023-06-19)

Features

  • Make injectable-mobx not require MobX-transaction (45a2712)

17.2.0 (2023-06-01)

Features

  • Make permitting side effects work properly with injection tokens (f3dea3b)

17.1.1 (2023-05-31)

Bug Fixes

  • Handle all permutations of ill-formatted paths (3e3bd6b)
  • Make linkable push throw when encountering file paths incompatible with yalc (be75a7e)

17.1.0 (2023-05-30)

Features

  • Make linkable able to automatically attempt fixing corrupted yalc.lock files (a574e19)
  • Make linkable able to link from monorepo (2de597b)

17.0.0 (2023-05-17)

⚠ BREAKING CHANGES

  • Adapt to changes in typing of asyncComputed.

Bug Fixes

  • Make types of asyncComputed describe the value for pending more (b6719f5)

16.1.2 (2023-05-17)

Bug Fixes

  • Revert a patch release contents that was actually breaking (22628a3)

16.1.1 (2023-05-17)

Bug Fixes

  • Make types of asyncComputed describe the value for pending more accurately (e4d6325)

16.1.0 (2023-05-16)

Features

  • Implement access to source namespace to permit eg. "scope specific" keyedSingletons (a3a0326)

16.0.0 (2023-05-15)

⚠ BREAKING CHANGES

  • Make sure previous usages of injectable id of meta do not break with the new addition of namespace. Eg. what previously was di.injectManyWithMeta(someInjectionToken) -> { id: 'some-id', instance: ... } ...will now become: { id: 'some-scope:some-id', instance: ... } ...when a scope is present.

Features

  • Implement computedInjectManyWithMeta, and add missing type tests to computedInjectMany (a8527c1)
  • Make the injectable id for "meta" namespaced to avoid collisions (baa52a9)

15.9.0 (2023-05-08)

Features

  • Permit also programmatic access to functionalities of linkable (8e51894)
  • Permit unoverride of injectionToken with exactly one implementation (4346c92)

15.8.1 (2023-05-02)

Bug Fixes

  • Use correct kind of npm-dependencies (5039d1f)

15.8.0 (2023-05-02)

Features

  • Allow isInjectable and isInjectionToken to be used for type narrowing (b82c1c9)

15.7.0 (2023-04-27)

Features

  • Add "linkable-push" as counterpart of "linkable" (240ea84)
  • Add support for globs in the linkable configuration (62144eb)

Bug Fixes

  • Make local node_modules of linked packages not break runtime when in non-bundled context (a9bfcae)

15.6.1 (2023-04-24)

Note: Version bump only for package ogre-tools

15.6.0 (2023-04-24)

Features

  • Indicate lack of support for missing "files" in package.jsons used by linkable (e0d14e6)
  • Introduce "linkable", ie. like "npm link", but mimicking "npm pack" as symlinks (1955082)
  • Make built linkable runnable as npm bin script (410a78e)

Bug Fixes

  • Avoid destructuring to not make brittle this-context of "fs" not break (5db7984)
  • Fix "path"-specific typing error (b670b36)
  • Fixup (6284ca4)
  • Make existence of static linked files work by using absolute path (50fa2d6)
  • Use correct build script for a ts-package (d80a233)

15.5.1 (2023-04-17)

Bug Fixes

  • Implement also nested di.injectFactory() (4db761b)

15.5.0 (2023-04-17)

Features

  • Introduce di.injectFactory() (c21a5fa)

15.4.0 (2023-04-11)

Features

  • Introduce access to already injected instances (a8ecc66)

15.3.1 (2023-04-06)

Bug Fixes

  • Clarify typing of injectionDecoratorToken and instantiationDecoratorToken (cea796b)

15.3.0 (2023-04-04)

Features

  • Allow disabling cycle detection (661f346)

15.2.1 (2023-03-31)

Bug Fixes

  • Change the typing of injectionDecoratorToken (e0b8871)

15.2.0 (2023-03-30)

Features

  • Restore cycle detection (f603234)

Bug Fixes

  • Fix injectable-utils entrypoint (84cf9de)
  • Fix type decl to fix test (ab00ef9)
  • Improve typing of injectionDecoratorToken and instantiationDecoratorToken (b204cf1)

15.1.2 (2023-03-02)

Bug Fixes

  • Fix injectable-utils entrypoint (6a668b5)

15.1.1 (2023-02-27)

Note: Version bump only for package ogre-tools

15.1.0 (2023-02-22)

Features

  • Make placeholder of withInjectables able to be more specialized by passing props to it (d3fa8aa)

15.0.1 (2023-02-21)

Bug Fixes

15.0.0 (2023-02-20)

⚠ BREAKING CHANGES

  • injectable-react now requires registerInjectableReact(di) to work.
  • Identify injectables and tokens by reference instead of id to permit namespaces later
  • Make flow not automatically await for promises in arrays

Features

  • Identify injectables and tokens by reference instead of id to permit namespaces later (72487e2)
  • Include "scope" of injectable in typing (6a81e7c)
  • Introduce "di.injectManyWithMeta()" to permit reuse of injectable id in implementation code (94fed1e)
  • Introduce "generable" (ie. generator library X) as package (bd1b8c7)
  • Introduce combinations in fp (88f0617)
  • Introduce matchAll in fp (000b23e)
  • Introduce movingWindow in fp (1f212c0)
  • Introduce relationJoin in fp (09ee015)
  • Introduce replaceTagsWithValues in fp (235be79)
  • Introduce scopes for injectables to initially serve as namespaces (d773e34)
  • Make flow not automatically await for promises in arrays (9752ef4)
  • Remove too complex concept of "ad-hoc"-injectables (ie. injectable without registration) (3baaf04)

14.0.3 (2022-11-23)

Note: Version bump only for package ogre-tools

14.0.2 (2022-11-23)

Note: Version bump only for package ogre-tools

14.0.1 (2022-11-23)

Note: Version bump only for package ogre-tools

14.0.0 (2022-11-22)

⚠ BREAKING CHANGES

  • Make properties of an injectable read-only to prevent misuse

Features

  • Make properties of an injectable read-only to prevent misuse (abf402a)
  • Permit override of single injectable using injection token (f6ae117)

13.2.1 (2022-11-17)

Bug Fixes

  • Make auto-register work in already built packages (35ed955)

13.2.0 (2022-11-17)

Features

  • Duplicate asyncComputed in proper, new package (5e83f5f)

13.1.0 (2022-11-15)

Features

  • Expose typing for test utils (5c0d408)

13.0.0 (2022-11-14)

⚠ BREAKING CHANGES

  • autoRegister() now requires targetModule and getRequireContexts instead of requireContexts.
  • Prevent overriding already injected injectables

Features

  • Make auto-register work within jest without hacks (7ef90d1)
  • Make getSafeFrom list existing properties as part of error for none found (8eef13c)
  • Prevent overriding already injected injectables (3a611bc)

Bug Fixes

  • Export fp-functions present in typing: "getFrom" and "getSafeFrom" (f9e85a4)
  • Fix TypeScript compilation (0bdcd5b)

Reverts

  • Revert "chore: Make CI NPM install in non-CI way to try fix build in CI" (f5aeefd)

12.0.1 (2022-10-25)

Bug Fixes

  • Manually update versions of peerDependencies as Lerna doesn't do it for some reason (0b46667)

12.0.0 (2022-10-25)

⚠ BREAKING CHANGES

  • Make asyncComputed receive parameters as value object instead of many arguments
  • Make bundle sizes a lot smaller by not bundling from node_modules

Features

  • Make asyncComputed able to show latest value (instead of pending value) between updates (d543053)
  • Make asyncComputed receive parameters as value object instead of many arguments (7cf0035)
  • Make bundle sizes a lot smaller by not bundling from node_modules (d47acbe)

Bug Fixes

  • Enable "npm workspaces" to make peerDependencies work in build and development (628c37b)

11.0.0 (2022-10-04)

⚠ BREAKING CHANGES

  • Stop exposing technicalities

Bug Fixes

  • Replace symbols with magic strings, as external libs may bundle multiple instances (ce79b25)

Miscellaneous Chores

  • Stop exposing technicalities (e06d77c)

10.3.2 (2022-09-26)

Bug Fixes

  • Export missing types from Runnable (05f48b4)

10.3.1 (2022-09-26)

Note: Version bump only for package ogre-tools

10.3.0 (2022-09-26)

Features

  • Introduce "runnable" in injectable-utils (80eb213)
  • Make build of a ts-package include type information (d174431)

10.2.0 (2022-09-23)

Features

  • Make auto-register also register named exports, and not just the default export (6af7f4c)

10.1.0 (2022-09-02)

Features

  • Make error message for attempt to inject a side-effect contain context (b474146)

Bug Fixes

  • Make decorator injectables behave consistently with cycles (b6481b5)

10.0.0 (2022-09-01)

⚠ BREAKING CHANGES

  • Make sure all registrations happen before injections
  • Make registrations in presence of computedInjectMany require explicit MobX-transaction

Features

  • Expose id of injectionToken in typing (09284f3)
  • Expose typings for decorability, tags and di.context (fb49104)
  • Make registrations in presence of computedInjectMany require explicit MobX-transaction (dcbf551)
  • Permit registrations without MobX transaction when injectable has no token (c65a529)

Bug Fixes

  • Add unit tests to prove and document the injection context in di.context (3126248)
  • Make computedInjectMany not blow up when unrelated decorators are present (888f76f)
  • Make sure all registrations happen before injections (e551e70)

9.0.3 (2022-08-25)

Bug Fixes

  • Make injectable-react not break React reconciliation when using async dependencies (049c84a)

Reverts

  • Revert "chore: Change to using v8 coverage provider for babel misbehaving" (4fb612b)

9.0.2 (2022-08-10)

Note: Version bump only for package ogre-tools

9.0.1 (2022-06-29)

Note: Version bump only for package ogre-tools

9.0.0 (2022-06-20)

⚠ BREAKING CHANGES

  • Make containers have ID for better error messages

Features

  • Make containers have ID for better error messages (ea3ac4c)

Bug Fixes

  • Prevent nested computedInjectMany's from appearing as cycles (24cfa1f)

8.0.0 (2022-06-15)

⚠ BREAKING CHANGES

  • Expose function for injecting reactively many instead of using instantiation parameter

Features

  • Add shorthands for decorating to make addition of e.g. jest.spy easier (350a957)
  • Expose deregistering in types (6823839)
  • Expose function for injecting reactively many instead of using instantiation parameter (b572b32)

Bug Fixes

  • Return same computed when injecting reactively many multiple times for same injection token (75d8f51)

Reverts

  • Revert "chore: Consolidate to relying of peer dependencies in injectable extensions" (8f9b9b2)

7.1.0 (2022-06-09)

Features

  • Expose way to decorate instantiations (8f4b39a)

7.0.0 (2022-04-27)

⚠ BREAKING CHANGES

  • Extract auto-registration as extension

Features

  • Add decorator for deregistration of injectables (1192484)
  • Expose deregister to instantiate (eea8bcc)
  • Expose di.unoverride() for TypeScript (293b3ac)
  • Introduce "reactive injectMany" which reacts to "late registrations" of injection tokens (da932a6)
  • Introduce automated testing for typings (19b2d45)
  • Introduce decorator for registration to later permit reactive injectMany (34d2667)
  • Introduce deregistration of injectables (d5ee408)
  • Make all reactive registrations happen together in one transaction (3acf508)
  • Make async injectMany react also to deregistrations (be2f193)
  • Make deregistration of injectables variadic (8681a6e)
  • Make late registered branches deregister together (41304db)
  • Make registration of injectables variadic (eea1c0a)

Bug Fixes

  • Make MobX peer-dependency for injectable-extension-for-mobx (924b4f6)

Miscellaneous Chores

  • Extract auto-registration as extension (8395a7a)

6.0.1 (2022-03-30)

Bug Fixes

  • Fix error in typing of a lifecycle (3b4b3cd)

6.0.0 (2022-03-29)

⚠ BREAKING CHANGES

  • Remove concept of setuppable
  • Extract dependency graphing from core as extensions
  • Extract error monitoring from core as extensions

Miscellaneous Chores

  • Extract dependency graphing from core as extensions (4ab3eeb)
  • Extract error monitoring from core as extensions (d255f06)
  • Remove concept of setuppable (51affc5)

5.2.0 (2022-03-23)

Features

  • Expose permitting of side-effects to TypeScript (a69daea)

5.1.3 (2022-03-18)

Note: Version bump only for package ogre-tools

5.1.2 (2022-03-14)

Bug Fixes

  • Report misconfigured *.injectable.{js|ts} files (8117f16)
  • Unit tests (435690e)
  • Uppercase for errors (8b48b69)

5.1.1 (2022-03-11)

Bug Fixes

  • Make all reports directories excludes from NPM (a7b71ce)

5.1.0 (2022-03-11)

Features

  • Add "setup" to branch-tags of dependency graphing (da315b2)
  • Add branch tags for dependency graphing (9e43197)
  • Add injection context for withInjectables (d69a57d)
  • Expose instantiation parameters to error monitoring for better messages (7b13267)
  • Expose naive, synchronous types for pipeline (b909e72)
  • graphing: Add appearance for sync/async (a1523cf)
  • graphing: Introduce graph customizers to eg. make reactive dependencies stick out (8877020)
  • graphing: Make graph more eye-ballable by adding colors and symbols (d31bc57)
  • graphing: Make injection tokens stand out (17796b5)
  • graphing: Make link and link info text color customizable separately (aa42120)
  • graphing: Make link and link info text colors customizable (2057001)
  • Hide irrelevant data in dependency graphing (7e38ac3)
  • injectable: Make setups able to inject many (1dfca82)
  • Introduce ad-hoc injectables that do not require registration (82c7a43)
  • Introduce error monitoring for all injectables that return a function (6f458f2)
  • Introduce injectable extension for dependency graphing using Plant UML (a32d206)
  • Introduce late registration (5524f0e)
  • Introduce variation point for error handling of instantiation (481b4d5)
  • Introduce variation point for global decoration of "instantiate" (fe5e1a9)
  • Introduce variation point for targeted decoration of "instantiate" (70b8918)
  • Introduce way to get property value from dictionary and throw if it does not exist (3707c78)
  • Make error monitoring possible for TypeScript (d0fd4ef)
  • Make injection tokens display more pretty in dependency graphing (dc55d12)
  • Make setuppables display more pretty in dependency graphing (1fbdf74)
  • Permit instance key of any type (0a68f24)
  • Show lifecycle names in dependency graphing (9c0cf20)

Bug Fixes

  • Add missing export for error monitoring in JS (55fd4d2)
  • complete fix (2bba4f3)
  • Define nodes before links in dependency graphing for human-readability (af2c0d3)
  • Faulty type parameter value (17cfa76)
  • Fix bad import (16f06ce)
  • Fix typing of getting injectable for injection token (53ca8ad)
  • lifecycleEnum.keyedSingleton not working (06a86dc)
  • Make also injectMany comply to error monitoring for instantiation (eb8baf7)
  • Make setuppables display correctly in dependency graphing (30425e4)
  • Present dependency graph in correct order and with tokens (17a5b6c)
  • Resolve PR comments (bb2e1de)
  • typings: Improve typings to work with arbitrary injection params (c1d900a)

5.0.0 (2022-02-09)

⚠ BREAKING CHANGES

  • Consolidate typing of injectable and injectable-react

Bug Fixes

  • Consolidate typing of injectable and injectable-react (a52180d)

4.1.0 (2022-02-08)

Features

  • Expose keyed singleton as lifecycle in types (282762e)
  • introduce keyedSingleton as lifecycle (174472c)
  • Permit primitive instantiation parameters (b10dd82)

4.0.0 (2022-02-07)

⚠ BREAKING CHANGES

  • force breaking change to cause major version bump in Lerna
  • add NPM-script for opening github in browser

Bug Fixes

  • drop another old version of node for breaking build (d5cfaf7)
  • fix build by using webpack made available to a package by lerna (5b08e24)
  • force breaking change to cause major version bump in Lerna (f0c1def)
  • make breaking changes in git cause major version bump in Lerna (be13e14)
  • make publish not time out by watching tests (be4aba6)
  • stop using workspaces for not being supported in CI (3858ee2)

Reverts

  • Revert "Revert "Enhance error for injecting non-registered injectable"" (8e24a0c)
  • Revert "Revert "Implement di.injectMany() as way to inject multiple registered injectables for an injection token"" (f5d0e01)
  • Revert "Revert "Permit injection using only injectable or injection token. Replace "id" with "module" for better error messages."" (fc67c38)
  • Revert "Revert "Remove concept of "injectable viability" for being YAGNI"" (e4979c6)
  • Revert "Revert "Prevent public access to injection context"" (4c88b4a)

Miscellaneous Chores

  • add NPM-script for opening github in browser (c94284f)