elastic/require-in-the-middle
### [`v7.1.0`](https://togithub.com/elastic/require-in-the-middle/blob/HEAD/CHANGELOG.md#v710)
[Compare Source](https://togithub.com/elastic/require-in-the-middle/compare/v7.0.1...v7.1.0)
- Add [TypeScript types](./types/index.d.ts).
[https://github.com/elastic/require-in-the-middle/pull/67](https://togithub.com/elastic/require-in-the-middle/pull/67)l/67)
### [`v7.0.1`](https://togithub.com/elastic/require-in-the-middle/blob/HEAD/CHANGELOG.md#v701)
[Compare Source](https://togithub.com/elastic/require-in-the-middle/compare/v7.0.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.
[https://github.com/elastic/require-in-the-middle/pull/68](https://togithub.com/elastic/require-in-the-middle/pull/68)l/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`](https://togithub.com/elastic/require-in-the-middle/blob/HEAD/CHANGELOG.md#v700)
[Compare Source](https://togithub.com/elastic/require-in-the-middle/compare/v6.0.0...v7.0.0)
- Change the suggested require usage to be a `Hook` field on the exports,
```js
const { Hook } = require('require-in-the-middle'); // the new suggested way
```
rather than the default export:
```js
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](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html#default-exports)
which can get confusing or problematic with TypeScript. [https://github.com/open-telemetry/opentelemetry-js/issues/3701](https://togithub.com/open-telemetry/opentelemetry-js/issues/3701)ues/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_requir[https://github.com/elastic/require-in-the-middle/issues/61](https://togithub.com/elastic/require-in-the-middle/issues/61)le/issues/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.
[https://github.com/elastic/require-in-the-middle/pull/59](https://togithub.com/elastic/require-in-the-middle/pull/59)l/59)
Configuration
📅 Schedule: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
^6.0.0
->^7.0.0
Release Notes
elastic/require-in-the-middle
### [`v7.1.0`](https://togithub.com/elastic/require-in-the-middle/blob/HEAD/CHANGELOG.md#v710) [Compare Source](https://togithub.com/elastic/require-in-the-middle/compare/v7.0.1...v7.1.0) - Add [TypeScript types](./types/index.d.ts). [https://github.com/elastic/require-in-the-middle/pull/67](https://togithub.com/elastic/require-in-the-middle/pull/67)l/67) ### [`v7.0.1`](https://togithub.com/elastic/require-in-the-middle/blob/HEAD/CHANGELOG.md#v701) [Compare Source](https://togithub.com/elastic/require-in-the-middle/compare/v7.0.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. [https://github.com/elastic/require-in-the-middle/pull/68](https://togithub.com/elastic/require-in-the-middle/pull/68)l/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`](https://togithub.com/elastic/require-in-the-middle/blob/HEAD/CHANGELOG.md#v700) [Compare Source](https://togithub.com/elastic/require-in-the-middle/compare/v6.0.0...v7.0.0) - Change the suggested require usage to be a `Hook` field on the exports, ```js const { Hook } = require('require-in-the-middle'); // the new suggested way ``` rather than the default export: ```js 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](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html#default-exports) which can get confusing or problematic with TypeScript. [https://github.com/open-telemetry/opentelemetry-js/issues/3701](https://togithub.com/open-telemetry/opentelemetry-js/issues/3701)ues/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_requir[https://github.com/elastic/require-in-the-middle/issues/61](https://togithub.com/elastic/require-in-the-middle/issues/61)le/issues/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. [https://github.com/elastic/require-in-the-middle/pull/59](https://togithub.com/elastic/require-in-the-middle/pull/59)l/59)Configuration
📅 Schedule: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.