Skip to content

Latest commit

 

History

History
113 lines (77 loc) · 4.11 KB

CHANGELOG.md

File metadata and controls

113 lines (77 loc) · 4.11 KB

require-in-the-middle changelog

v7.3.0

v7.2.1

  • Fix a limitation so that a single Hook can hook a module and a sub-module, e.g. new Hook(['example', 'example/some-sub-module'], ...). (#84)

v7.2.0

  • Improve performance (possibly significantly) when using the Hook without a modules argument, e.g. new Hook(null, onrequire), by caching exports in more cases. Contributed by @nwalters512. (#75)

v7.1.1

  • Fallback to caching hooked module exports internally if the required module does not appear in require.cache. This can only happen if there is some other require hook in play -- e.g. @babel/register which is used by @babel/cli, aka the babel-node command. (#72)

v7.1.0

v7.0.1

  • Fix hooking of 'http2' with Node.js versions [8.0, 8.8) where the 'http2' built-in module was behind the --expose-http2 flag. (#68) Release v7.0.0 introduced a bug with this case where the process would crash with:

    AssertionError [ERR_ASSERTION]: unexpected that there is no Module entry for "http2" in require.cache
      at ExportsCache.set (.../require-in-the-middle4/index.js:72:7)
    

v7.0.0

  • Change the suggested require usage to be a Hook field on the exports,

    const { Hook } = require('require-in-the-middle');  // the new suggested way

    rather than the default export:

    const Hook = require('require-in-the-middle');  // deprecated, still supported for backward compat

    This is to avoid the need for users to use a default export which can get confusing or problematic with TypeScript. See open-telemetry/opentelemetry-js#3701 for some details.

  • Change the suggested usage to new Hook(...) instead of Hook(...), but both are supported.

  • Use the Node.js require.cache for caching the exports returned from a Hook's onrequire. This allows users to delete entries from require.cache to trigger a re-load (and re-run of the hook's onrequire) of a module the next time it is required -- as mentioned at https://nodejs.org/docs/latest/api/all.html#all_modules_requirecache (#61)

  • (SEMVER-MAJOR) Remove the hook.cache field. In earlier versions this was available and some tests used it. However it was never a documented field.

  • If resolving the filename for a require(...) fails, defer to the wrapped require implementation rather than failing right away. This allows a possibly-monkey-patched require to do its own special thing. (#59)

v6.0.0

  • Drop Node.js 6 support. New minimum supported Node.js version is 8.6.0. (This is the minimum supported Node.js version for elastic-apm-node@3 that uses this module.)
  • Add testing of Node.js 19.
  • Rename default branch from master to main.
  • Should there be a need to do 5.x maintenance releases there is a 5.x branch.

v5.2.0

v5.1.0

  • Add support for hooking into require of absolute paths. (#43)

earlier versions

Use the source, Luke.