feat: support multiple import styles from JS and TS; add morgan types (…
…#165)
This updates the three @elastic/ecs-*-format packages to support the following
import styles from JS and TS code:
1. `const { ecsFormat } = require('@elastic/ecs-pino-format);` in JS and TS.
The preferred import style for JS code using CommonJS.
2. `import { ecsFormat } from '@elastic/ecs-pino-format';` in JS and TS.
ES module (ESM) import style. This is the preferred style for TypeScript
code and for JS developers using ESM.
3. `const ecsFormat = require('@elastic/ecs-pino-format');` in JS.
The old, deprecated import method. Still supported for backward compat.
4. `import ecsFormat from '@elastic/ecs-pino-format';` in JS and TS.
This works, but is deprecated. Prefer #2 style.
5. `import * as EcsPinoFormat from '@elastic/ecs-pino-format';` in TS.
One must then use `EcsPinoFormat.ecsFormat()`.
Note that this *excludes* support for this TS-only style:
`import escFormat = require('@elastic/ecs-pino-format');`
This also adds types for ecs-morgan-format, based on #119 and #90.
I'd had an earlier start on this in #96.
Replaces: #96
Closes: #90
Closes: #119