esm-sync 3.3.3-beta.1 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,31 +1,30 @@
1
- # @nktnet1/esm
2
-
3
- > _Part of [HTTP Toolkit](https://nktnet1.com): powerful tools for building, testing & debugging HTTP(S)_
1
+ # esm-sync
4
2
 
5
3
  **This is a forked version of the [esm package](https://www.npmjs.com/package/esm)**: the brilliantly simple, babel-less, bundle-less ECMAScript module loader (which is now unmaintained). This fork includes:
6
4
 
7
- * Assorted updates from the [esm-wallaby fork](https://www.npmjs.com/package/esm-wallaby) adding support for ES modules containing new ES syntax, supporting modern Node versions (at least up to v21), and supporting `node:*` imports.
5
+ * Assorted updates from [@httptoolkit/esm](https://github.com/httptoolkit/esm) and [esm-wallaby fork](https://www.npmjs.com/package/esm-wallaby), adding support for ES modules containing new ES syntax, supporting modern Node versions (at least up to v22), and supporting `node:*` imports.
8
6
  * Support for modules that use the `const require = createRequire(...)` pattern (or declare any other global `require` variable) which are otherwise unusable with `esm`.
9
7
  * Support for modules that use only an `exports` map in their package.json, without a `main` field, which are otherwise unresolveable (reporting "Cannot find module", even though `import()` works correctly).
8
+ * Built-in types for use in TypeScript projects
10
9
 
11
10
  Install
12
11
  ---
13
12
 
14
- Run `npm i @nktnet1/esm` or `yarn add @nktnet1/esm`.
13
+ Run `npm i esm-sync` or `yarn add esm-sync`.
15
14
 
16
15
  Getting started
17
16
  ---
18
17
 
19
- There are two ways to enable `@nktnet1/esm`.
18
+ There are two ways to enable `esm-sync`.
20
19
 
21
- 1. Enable `@nktnet1/esm` for packages:
20
+ 1. Enable `esm-sync` for packages:
22
21
 
23
- Use `@nktnet1/esm` to load the main ES module and export it as CommonJS.
22
+ Use `esm-sync` to load the main ES module and export it as CommonJS.
24
23
 
25
24
  __index.js__
26
25
  ```js
27
26
  // Set options as a parameter, environment variable, or rc file.
28
- require = require("@nktnet1/esm")(module/*, options*/)
27
+ require = require("esm-sync")(module/*, options*/)
29
28
  module.exports = require("./main.js")
30
29
  ```
31
30
  __main.js__
@@ -34,20 +33,20 @@ There are two ways to enable `@nktnet1/esm`.
34
33
  export {}
35
34
  ```
36
35
 
37
- 2. Enable `@nktnet1/esm` for local runs:
36
+ 2. Enable `esm-sync` for local runs:
38
37
 
39
38
  ```shell
40
- node -r @nktnet1/esm main.js
39
+ node -r esm-sync main.js
41
40
  ```
42
- :bulb: Omit the filename to enable `@nktnet1/esm` in the REPL.
41
+ :bulb: Omit the filename to enable `esm-sync` in the REPL.
43
42
 
44
43
  Features
45
44
  ---
46
45
 
47
46
  :clap: By default, :100: percent CJS interoperability is enabled so you can get stuff done.<br>
48
- :lock: `.mjs` files are limited to basic functionality without support for `@nktnet1/esm` options.
47
+ :lock: `.mjs` files are limited to basic functionality without support for `esm-sync` options.
49
48
 
50
- Out of the box `@nktnet1/esm` just works, no configuration necessary, and supports:
49
+ Out of the box `esm-sync` just works, no configuration necessary, and supports:
51
50
 
52
51
  * Passing all applicable [test262](https://github.com/tc39/test262) compliance tests
53
52
  * [`import`](https://ponyfoo.com/articles/es6-modules-in-depth#import)/[`export`](https://ponyfoo.com/articles/es6-modules-in-depth#export)
@@ -225,30 +224,30 @@ Tips
225
224
 
226
225
  ### Extensions
227
226
 
228
- * Enable `@nktnet1/esm` for [`wallaby.js`](https://wallabyjs.com/) following their
227
+ * Enable `esm-sync` for [`wallaby.js`](https://wallabyjs.com/) following their
229
228
  [integration example](https://wallabyjs.com/docs/integration/node.html#es-modules).
230
229
 
231
230
  ### Loading
232
231
 
233
- * Load `@nktnet1/esm` before loaders/monitors like
232
+ * Load `esm-sync` before loaders/monitors like
234
233
  [`@babel/register`](https://babeljs.io/docs/en/next/babel-register.html),
235
234
  [`newrelic`](https://github.com/newrelic/node-newrelic),
236
235
  [`sqreen`](https://docs.sqreen.io/sqreen-for-nodejs/getting-started-2/), and
237
236
  [`ts-node`](https://github.com/TypeStrong/ts-node#programmatic).
238
237
 
239
- * Load `@nktnet1/esm` for [`jasmine`](https://jasmine.github.io/) using the
238
+ * Load `esm-sync` for [`jasmine`](https://jasmine.github.io/) using the
240
239
  [`"helpers"`](https://jasmine.github.io/setup/nodejs.html#configuration)
241
240
  field in `jasmine.json`:
242
241
  ```json
243
242
  "helpers": [
244
- "node_modules/@nktnet1/esm"
243
+ "node_modules/esm-sync"
245
244
  ]
246
245
  ```
247
246
 
248
- * Load `@nktnet1/esm` with “node-args" options of:<br>
249
- - [`pm2`](https://pm2.io/doc/en/runtime/reference/pm2-cli/#pm2-flags): `--node-args="-r @nktnet1/esm"`
247
+ * Load `esm-sync` with “node-args" options of:<br>
248
+ - [`pm2`](https://pm2.io/doc/en/runtime/reference/pm2-cli/#pm2-flags): `--node-args="-r esm-sync"`
250
249
 
251
- * Load `@nktnet1/esm` with “require” options of
250
+ * Load `esm-sync` with “require” options of
252
251
  [`ava`](https://github.com/avajs/ava/blob/master/docs/recipes/es-modules.md),
253
252
  [`mocha`](https://mochajs.org/#-require-module-r-module),
254
253
  [`nodemon`](https://nodemon.io/),