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 for ECMAScript Modules #156

Closed
wants to merge 2 commits into from
Closed

Conversation

laverdet
Copy link

@laverdet laverdet commented Jul 4, 2022

This implements the changes discussed in #153. Feel free to accept or to use this PR as a starting point for your own work.


This adds support to import this package from ECMAScript Modules. The
changes are fairly broad since some non-compliant tooling and
experimental features were relied on.

laverdet added 2 commits July 4, 2022 16:56
This adds support to import this package from ECMAScript Modules. The
changes are fairly broad since some non-compliant tooling and
experimental features were relied on.

- Add `"type": "module"` to top-level package.json. Remove nested
  package.json generation. See: https://nodejs.org/api/packages.html#dual-commonjses-module-packages
- Add file extensions to relative file imports. This also updates the
  eslint configuration to enforce the practice. See: https://nodejs.org/api/packages.html#extensions-in-subpaths
- Remove `source-map-support` since this was now failing to load, and
  nodejs has supported `--enable-source-maps` since v12.
- Remove `ts-node` since this module has lousy module support
  [TypeStrong/ts-node#935 and
  TypeStrong/ts-node#1007]. This was only used
  for testing, so instead tests are run from the transpiled .js files
  created by TypeScript. .npmignore has been updated to ignore these
  files.
- Add JSON import assertions to import test files. JSON import has
  been an experimental nodejs feature but ts-node was letting the
  imports work against specification. These imports now require an
  import assertion, which has been added. This required a TypeScript
  version bump, and now the tests can only run under nodejs v18. The
  Travis-CI configuration has been updated with this in mind. These are
  workarounds to get this running under older versions of nodejs but I
  don't think it's worth the engineering time.
- Re-adds nested package.json generation
- Fix npm `files` publishing glob
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

Successfully merging this pull request may close these issues.

2 participants