Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @koa/router #110

Open
feelform opened this issue Feb 15, 2022 · 0 comments
Open

Support @koa/router #110

feelform opened this issue Feb 15, 2022 · 0 comments

Comments

@feelform
Copy link
Collaborator

feelform commented Feb 15, 2022

ref: https://github.com/elastic/require-in-the-middle/blob/master/README.md#api

## API

The require-in-the-middle module exposes a single function:

### `hook = Hook([modules][, options], onrequire)`

When called a `hook` object is returned.

Arguments:

- `modules` <string[]> An optional array of module names to limit which modules
  trigger a call of the `onrequire` callback. If specified, this must be the
  first argument. Both regular modules (e.g. `react-dom`) and
  sub-modules (e.g. `react-dom/server`) can be specified in the array.
- `options` <Object> An optional object containing fields that change when the
  `onrequire` callback is called. If specified, this must be the second
  argument.
  - `options.internals` <boolean> Specifies whether `onrequire` should be called
    when module-internal files are loaded; defaults to `false`.
- `onrequire` <Function> The function to call when a module is required.

The `onrequire` callback will be called the first time a module is
required. The function is called with three arguments:

- `exports` <Object> The value of the `module.exports` property that would
  normally be exposed by the required module.
- `name` <string> The name of the module being required. If `options.internals`
  was set to `true`, the path of module-internal files that are loaded
  (relative to `basedir`) will be appended to the module name, separated by
  `path.sep`.
- `basedir` <string> The directory where the module is located, or `undefined`
  for core modules.

Return the value you want the module to expose (normally the `exports`
argument).

We need to support koa-router and @koa/router.

feelform added a commit to feelform/pinpoint-node-agent that referenced this issue Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant