| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,9 @@ changes: | |||
| 8 | 8 | - v14.13.0 | |
| 9 | 9 | pr-url: https://github.com/nodejs/node/pull/34718 | |
| 10 | 10 | description: Add support for `"exports"` patterns. | |
| 11 | - - version: v14.6.0 | ||
| 11 | + - version: | ||
| 12 | + - v14.6.0 | ||
| 13 | + - v12.19.0 | ||
| 12 | 14 | pr-url: https://github.com/nodejs/node/pull/34117 | |
| 13 | 15 | description: Add package `"imports"` field. | |
| 14 | 16 | - version: | |
@@ -135,6 +137,9 @@ package: | |||
| 135 | 137 | `"commonjs"` package). | |
| 136 | 138 | ||
| 137 | 139 | ### `--input-type` flag | |
| 140 | + <!-- YAML | ||
| 141 | + added: v12.0.0 | ||
| 142 | + --> | ||
| 138 | 143 | ||
| 139 | 144 | Strings passed in as an argument to `--eval` (or `-e`), or piped to `node` via | |
| 140 | 145 | `STDIN`, are treated as [ES modules][] when the `--input-type=module` flag | |
@@ -252,6 +257,9 @@ absolute subpath of the package such as | |||
| 252 | 257 | `require('/path/to/node_modules/pkg/subpath.js')` will still load `subpath.js`. | |
| 253 | 258 | ||
| 254 | 259 | ### Subpath exports | |
| 260 | + <!-- YAML | ||
| 261 | + added: v12.7.0 | ||
| 262 | + --> | ||
| 255 | 263 | ||
| 256 | 264 | When using the [`"exports"`][] field, custom subpaths can be defined along | |
| 257 | 265 | with the main entry point by treating the main entry point as the | |
@@ -282,6 +290,11 @@ import submodule from 'es-module-package/private-module.js'; | |||
| 282 | 290 | ``` | |
| 283 | 291 | ||
| 284 | 292 | ### Subpath imports | |
| 293 | + <!--YAML | ||
| 294 | + added: | ||
| 295 | + - v14.6.0 | ||
| 296 | + - v12.19.0 | ||
| 297 | + --> | ||
| 285 | 298 | ||
| 286 | 299 | In addition to the [`"exports"`][] field, it is possible to define internal | |
| 287 | 300 | package import maps that only apply to import specifiers from within the package | |
@@ -319,6 +332,11 @@ The resolution rules for the imports field are otherwise | |||
| 319 | 332 | analogous to the exports field. | |
| 320 | 333 | ||
| 321 | 334 | ### Subpath patterns | |
| 335 | + <!--YAML | ||
| 336 | + added: | ||
| 337 | + - v14.13.0 | ||
| 338 | + - v12.19.0 | ||
| 339 | + --> | ||
| 322 | 340 | ||
| 323 | 341 | For packages with a small number of exports or imports, we recommend | |
| 324 | 342 | explicitly listing each exports subpath entry. But for packages that have | |
@@ -365,6 +383,9 @@ files within the package. Because `node_modules` paths are forbidden in exports | |||
| 365 | 383 | targets, this expansion is dependent on only the files of the package itself. | |
| 366 | 384 | ||
| 367 | 385 | ### Exports sugar | |
| 386 | + <!--YAML | ||
| 387 | + added: v12.11.0 | ||
| 388 | + --> | ||
| 368 | 389 | ||
| 369 | 390 | If the `"."` export is the only export, the [`"exports"`][] field provides sugar | |
| 370 | 391 | for this case being the direct [`"exports"`][] field value. | |
@@ -389,6 +410,17 @@ can be written: | |||
| 389 | 410 | ``` | |
| 390 | 411 | ||
| 391 | 412 | ### Conditional exports | |
| 413 | + <!--YAML | ||
| 414 | + added: | ||
| 415 | + - v13.2.0 | ||
| 416 | + - v12.16.0 | ||
| 417 | + changes: | ||
| 418 | + - version: | ||
| 419 | + - v13.7.0 | ||
| 420 | + - v12.16.0 | ||
| 421 | + pr-url: https://github.com/nodejs/node/pull/31001 | ||
| 422 | + description: Unflag conditional exports. | ||
| 423 | + --> | ||
| 392 | 424 | ||
| 393 | 425 | Conditional exports provide a way to map to different paths depending on | |
| 394 | 426 | certain conditions. They are supported for both CommonJS and ES module imports. | |
@@ -487,6 +519,11 @@ the remaining conditions of the parent condition. In this way nested | |||
| 487 | 519 | conditions behave analogously to nested JavaScript `if` statements. | |
| 488 | 520 | ||
| 489 | 521 | ### Resolving user conditions | |
| 522 | + <!-- YAML | ||
| 523 | + added: | ||
| 524 | + - v14.9.0 | ||
| 525 | + - v12.19.0 | ||
| 526 | + --> | ||
| 490 | 527 | ||
| 491 | 528 | When running Node.js, custom user conditions can be added with the | |
| 492 | 529 | `--conditions` flag: | |
@@ -548,6 +585,17 @@ The above definitions may be moved to a dedicated conditions registry in due | |||
| 548 | 585 | course. | |
| 549 | 586 | ||
| 550 | 587 | ### Self-referencing a package using its name | |
| 588 | + <!--YAML | ||
| 589 | + added: | ||
| 590 | + - v13.1.0 | ||
| 591 | + - v12.16.0 | ||
| 592 | + changes: | ||
| 593 | + - version: | ||
| 594 | + - v13.6.0 | ||
| 595 | + - v12.16.0 | ||
| 596 | + pr-url: https://github.com/nodejs/node/pull/31002 | ||
| 597 | + description: Unflag self-referencing a package using its name. | ||
| 598 | + --> | ||
| 551 | 599 | ||
| 552 | 600 | Within a package, the values defined in the package’s | |
| 553 | 601 | `package.json` [`"exports"`][] field can be referenced via the package’s name. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments