| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 80098e6 commit 76a073b
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2350,12 +2350,15 @@ with no performance impact since Node.js 10. | |||
| 2350 | 2350 | ### DEP0128: modules with an invalid `main` entry and an `index.js` file | |
| 2351 | 2351 | <!-- YAML | |
| 2352 | 2352 | changes: | |
| 2353 | + - version: REPLACEME | ||
| 2354 | + pr-url: https://github.com/nodejs/node/pull/37204 | ||
| 2355 | + description: Runtime deprecation. | ||
| 2353 | 2356 | - version: v12.0.0 | |
| 2354 | 2357 | pr-url: https://github.com/nodejs/node/pull/26823 | |
| 2355 | 2358 | description: Documentation-only. | |
| 2356 | 2359 | --> | |
| 2357 | 2360 | ||
| 2358 | - Type: Documentation-only (supports [`--pending-deprecation`][]) | ||
| 2361 | + Type: Runtime | ||
| 2359 | 2362 | ||
| 2360 | 2363 | Modules that have an invalid `main` entry (e.g., `./does-not-exist.js`) and | |
| 2361 | 2364 | also have an `index.js` file in the top level directory will resolve the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -352,7 +352,7 @@ function tryPackage(requestPath, exts, isMain, originalPath) { | |||
| 352 | 352 | err.requestPath = originalPath; | |
| 353 | 353 | // TODO(BridgeAR): Add the requireStack as well. | |
| 354 | 354 | throw err; | |
| 355 | - } else if (pendingDeprecation) { | ||
| 355 | + } else { | ||
| 356 | 356 | const jsonPath = path.resolve(requestPath, 'package.json'); | |
| 357 | 357 | process.emitWarning( | |
| 358 | 358 | `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - // Flags: --pending-deprecation | ||
| 2 | - | ||
| 3 | 1 | 'use strict'; | |
| 4 | 2 | ||
| 5 | 3 | const common = require('../common'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,8 +29,7 @@ const path = require('path'); | |||
| 29 | 29 | ||
| 30 | 30 | const backslash = /\\/g; | |
| 31 | 31 | ||
| 32 | - if (!process.env.NODE_PENDING_DEPRECATION) | ||
| 33 | - process.on('warning', common.mustNotCall()); | ||
| 32 | + process.on('warning', common.mustCall()); | ||
| 34 | 33 | ||
| 35 | 34 | console.error('load test-module-loading.js'); | |
| 36 | 35 | ||
@@ -107,7 +106,16 @@ const d2 = require('../fixtures/b/d'); | |||
| 107 | 106 | assert.strictEqual(require('../fixtures/packages/index').ok, 'ok'); | |
| 108 | 107 | assert.strictEqual(require('../fixtures/packages/main').ok, 'ok'); | |
| 109 | 108 | assert.strictEqual(require('../fixtures/packages/main-index').ok, 'ok'); | |
| 109 | + | ||
| 110 | + common.expectWarning( | ||
| 111 | + 'DeprecationWarning', | ||
| 112 | + "Invalid 'main' field in '" + | ||
| 113 | + require.resolve('../fixtures/packages/missing-main/package.json') + | ||
| 114 | + "' of 'doesnotexist.js'. Please either fix that or report it to the" + | ||
| 115 | + ' module author', | ||
| 116 | + 'DEP0128'); | ||
| 110 | 117 | assert.strictEqual(require('../fixtures/packages/missing-main').ok, 'ok'); | |
| 118 | + | ||
| 111 | 119 | assert.throws( | |
| 112 | 120 | () => require('../fixtures/packages/missing-main-no-index'), | |
| 113 | 121 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments