-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
BREAKING: deprecate loading files with unknown or missing extensions #15365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -684,6 +684,13 @@ difference is that `querystring.parse()` does url encoding: | |
| { '%E5%A5%BD': '1' } | ||
| ``` | ||
|
|
||
| <a id="DEP0077"></a> | ||
| ### DEP0077: Loading files without a known file extension | ||
|
|
||
| Type: Runtime | ||
|
|
||
| Files without file extensions, or unknown file extensions will not be loaded. | ||
|
||
|
|
||
| [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size | ||
| [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array | ||
| [`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| const NativeModule = require('native_module'); | ||
| const util = require('util'); | ||
| const internalModule = require('internal/module'); | ||
| const internalUtil = require('internal/util'); | ||
| const { getURLFromFilePath } = require('internal/url'); | ||
| const vm = require('vm'); | ||
| const assert = require('assert').ok; | ||
|
|
@@ -516,8 +517,12 @@ Module.prototype.load = function(filename) { | |
| this.filename = filename; | ||
| this.paths = Module._nodeModulePaths(path.dirname(filename)); | ||
|
|
||
| var extension = path.extname(filename) || '.js'; | ||
| if (!Module._extensions[extension]) extension = '.js'; | ||
| var extension = path.extname(filename); | ||
| if (!extension || !Module._extensions[extension]) { | ||
| internalUtil.deprecate(() => { | ||
|
||
| extension = '.js'; | ||
| }, 'Loading files without an extension or unknown extension is deprecated', 'DEP0077')(); | ||
| }; | ||
| Module._extensions[extension](this, filename); | ||
| this.loaded = true; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The numbers should be assigned only during the commit landing process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We landed one with
XXalready, unsure how to ensure that gets done? Who assigns these/when?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmeck Whoever is landing the commit, they will assign the latest available number usually.