Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tags: mikeal/ipjs

Tags

v5.2.0

Toggle v5.2.0's commit message
feat: windows support + add 16.x in CI

v5.1.2

Toggle v5.1.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix: require regular version in stubs (#20)

When we stub files for environments that do not handle export maps very well, we `require` a transpiled CJS implementation and re-export it in a stub file that should be immediately overridden by the `browser` or `exports` fields in `package.json`.

At the moment we use the value from the `browser` overrides to work out which file we should `require` the stub. The change here is to `require` the transpiled regular CJS version in the stub instead of the browser override.

Turns out when Jest has `testEnvironment: 'node'` set it resolves `require`s to the stubs, ignoring `exports` which loads browser-specific code into node with predictably incendiary results.

v5.1.1

Toggle v5.1.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
docs: add note about instanceof gotcha (#19)

Turns out dual publishing esm/cjs can make `instanceof` have some surprising results for the unwary.

v5.1.0

Toggle v5.1.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
feat: support single exports (#18)

The following are all valid values for the `"exports"` map (https://nodejs.org/api/packages.html#packages_exports_sugar):

```
"exports": {
  ".": {
    "import": "./index.js"
  }
}
```

```
"exports": {
  "import": "./index.js"
}
```

```
"exports": "./index.js"
```

Currently ipjs only supports the first version, this PR adds support for the other two as well.

v5.0.5

Toggle v5.0.5's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix: windows build (#17)

v5.0.4

Toggle v5.0.4's commit message
docs: update readme to require named exports

Unless I've missed some clever hack, default exports are basically incompatible with the (common?) combination of cjs/jsdoc/node/browsers and tsc, I think because `typesVersions` only ever follows the `import` path and not the `require` path.

v5.0.3

Toggle v5.0.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix: work with jest (#14)

Jest [doesn't support package exports](jestjs/jest#9771),
nor does it support `browser` overrides out of the box (though it
[can be configured](https://jestjs.io/docs/configuration#resolver-string)).

This means it parses the stubbed files introduced in #13 as javascript,
so let's just require and export the file that the stub is stubbing.

This has the added bonus of also supporting old nodes that don't
understand package exports.

Fixes achingbrain/uint8arrays#21

v5.0.2

Toggle v5.0.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix: work with browserify (#13)

Browserify [does not support](browserify/resolve#224) `"exports"`
in a `package.json`, and nor can you use `"browser"` in `package.json`
[as a hint to Browserify to look in a certain place for a file](browserify/resolve#250 (comment)).

This means the output of `ipjs` is not compatible with Browserify since
it expects the runtime/bundler to use the `"exports"` field to look up
files paths.

If Browserify finds a file path, it will then use the `"browser"` values
to apply any overrides, which `ipjs` uses to direct it to the `/cjs` folder.

The problem is if it can't find the file in the first place it won't use
the `"browser"` map to get the overrides.

Handily we're generating the `"browser"` field values from the `"exports"`
values so we know we have the complete set of files that the user wants to
expose to the outside world, and the paths we want people to use to access
them.

The change in this PR is to use the `"browser"` field values to [mimc the `"exports"` structure in a CJS-compatible directory structure](browserify/resolve#250 (comment))
as per @ljharb's suggestion.

For any file that we are overriding with `"browser"` values, we create an
empty file (where a resolvable file does not already exist) a the path
Browserify expects it to be at, then it'll dutifully use the `"browser"`
field to pull the actual file in.

v5.0.1

Toggle v5.0.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix: add esm and cjs paths to browser map for overriden files (#12)

* fix: add esm and cjs paths to browser map for overriden files

See evanw/esbuild#1443 for discussion.

In brief if you have a project that is built by ipjs and you have
file A that imports file B, esbuild (maybe others?) resolves file B
using it's full path within the module (e.g. including `esm` or `cjs`),
which it then uses as a key to look up overrides in the `browser` map
in your `package.json`.

If there is an override it'll fail to be found because ipjs doesn't
add paths prefixed with `esm` or `cjs` to the browser map where
overrides have been delcared in the `exports` map, so the change here
is to add files with their full path prefix to the `browser` map.

* fix: browser overrides in webpack

v5.0.0

Toggle v5.0.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
feat!: add optional --main for `build` to include "main" (#8)

Don't include "main" in package.json by default, but include it if --main is
passed.