Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update docs
  • Loading branch information
guybedford committed Oct 22, 2020
commit dda53692c0d6cf520bf80d69e0f649af3d56018e
23 changes: 3 additions & 20 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2690,26 +2690,9 @@ changes:

Type: Runtime (supports [`--pending-deprecation`][])

Prior to [subpath patterns][] support, it was possible to define folder mappings
in the [subpath exports][] or [subpath imports][] fields using a trailing `"/"`:

```json
{
"exports": {
"./features/": "./features/"
}
}
```

This usage is deprecated for using direct [subpath patterns][]:

```json
{
"exports": {
"./features/*": "./features/*.js"
}
}
```
Prior to [subpath patterns][] support, it was possible to define
[folder mappings][] in the [subpath exports][] or [subpath imports][] fields
Comment thread
guybedford marked this conversation as resolved.
Outdated
using a trailing `"/"`.

Without `--pending-deprecation`, runtime warnings occur only for exports
resolutions not in `node_modules`. This means there will not be deprecation
Expand Down
39 changes: 39 additions & 0 deletions doc/api/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,45 @@ treating the right hand side target pattern as a `**` glob against the list of
files within the package. Because `node_modules` paths are forbidden in exports
targets, this expansion is dependent on only the files of the package itself.

### Subpath folder mappings
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/35746
description: Runtime deprecation.
- version: v14.13.0
pr-url: https://github.com/nodejs/node/pull/34718
description: Documentation-only deprecation.
-->

> Stability: 0 - Deprecated: Use subpath patterns instead.

Before subpath patterns were supported, a trailing `"/"` suffix was used to
support folder mappings:

```json
{
"exports": {
"./features/": "./features/"
}
}
```

_This feature will be removed in a future release._
Comment thread
guybedford marked this conversation as resolved.

Instead, use direct [subpath patterns][]:
Comment thread
guybedford marked this conversation as resolved.

```json
{
"exports": {
"./features/*": "./features/*.js"
}
}
```

The benefit of patterns over folder exports is that packages can always be
imported by consumers without subpath file extensions being necessary.

### Exports sugar

> Stability: 1 - Experimental
Expand Down