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
module: remove unnecessary property and method #2922
Conversation
`require.path` property and `require.registerExtension` function have been throwing errors when used. They both are like this for years now. This patch removes them from the system.
Bump! |
LGTM |
I'll land this tomorrow if there are no objections. cc @nodejs/collaborators |
cc @rvagg what does our deprecation policy says on this? |
LGTM |
Why semver-major though? It was already removed. It's not like any application will break because of this change. |
@thefourtheye It was |
@@ -127,10 +127,6 @@ assert.equal(require('../fixtures/registerExt2').custom, 'passed'); | |||
assert.equal(require('../fixtures/foo').foo, 'ok', | |||
'require module with no extension'); | |||
|
|||
assert.throws(function() { |
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.
Nit: Can you add a test to confirm that require.paths
returns undefined
or whatever the expected value is?
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.
Nit: Probably good to do the same for require.registerExtension()
.
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.
@Trott Do we really need that? There will be no reference to that in code, but there will be a test which will check if paths
is undefined
.
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.
My thinking is this PR changes the behavior of the code and there ought to be a test for that change. So a test that the property has, in fact, been successfully removed seems appropriate. But if you think it's overkill, I'm OK without it. (I'll edit my comments above to indicate they are nits.)
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.
@Trott Hmmm, whenever we remove something from the system we don't add tests to make sure that they are really removed, right? So, I feel that it is not necessary. Let's see what others feel.
@ChALkeR Ah, thanks for pointing out. I edited the PR description. I'll update the commit log when I am landing this. |
@seishun It changes the behavior by removing a throw. If anyone did a feature detection checking whenether |
amdify-0.0.26.tgz/jam/ejs/lib/ejs.js:350: require.registerExtension('.ejs', function(src) {
backbone-revisited-0.1.2.tgz/node_mods/ejs.js:353: require.registerExtension('.ejs', function(src) {
blitzLib-0.1.0.tgz/Lib/coffee-script-debug.js:14330: }: require.registerExtension && require.registerExtension(".coffee",
bluebutton-0.4.2.tgz/_site/spec/javascripts/helpers/ejs.js:411: require.registerExtension('.ejs', function(src) {
clientexpress-0.7.7.tgz/lib/ejs.js:301: require.registerExtension('.ejs', function(src) {
coffeete-0.0.4.tgz/src/coffeete.js:22: require.registerExtension('.coffeete', function (content) {
contracts.coffee-0.3.4.tgz/lib/coffee-script/coffee-script.js:24: require.registerExtension('.coffee', function(content) {
ejs-harmony-1.0.1.tgz/lib/ejs.js:413: require.registerExtension('.ejs', function(src) {
ejs-i-1.2.3.tgz/ejs.js:417: require.registerExtension('.ejs', function (src) {
ejs-i-1.2.3.tgz/lib/ejs.js:399: require.registerExtension('.ejs', function (src) {
ejs-remix-0.1.1.tgz/ejs.js:346: require.registerExtension('.ejs', function(src) {
ejs-remix-0.1.1.tgz/lib/ejs.js:504: require.registerExtension('.ejs', function(src) {
ejs-template-0.1.0.tgz/ejs/ejs.js:376: require.registerExtension('.ejs', function(src) {
ejs-var-1.0.0.tgz/ejs.js:411: require.registerExtension('.ejs', function(src) {
ejs-var-1.0.0.tgz/lib/ejs.js:374: require.registerExtension('.ejs', function(src) {
ender-ejs-0.6.1.tgz/ejs.js:334: require.registerExtension('.ejs', function(src) {
funtang.compiler-0.0.1.tgz/reference/jashkenas-coffee-script-60c9b94/lib/coffee-script/coffee-script.js:25: require.registerExtension('.coffee', function(content) {
gorillascript-0.9.10.tgz/extras/gorillascript.js:30580: require.registerExtension(".gs", function (content) {
gorillascript-0.9.10.tgz/lib/gorilla.js:435: require.registerExtension(".gs", function (content) {
imba-0.13.0.tgz/register.js:39: require.registerExtension('.imba',function (content){
logmonger-0.1.0.tgz/contrib/coffee-script/coffee-script.js:14: require.registerExtension('.coffee', function(content) {
mochiscript-0.6.16.tgz/lib/mochiscript/mochiscript.js:1280: require.registerExtension('.ms', function(content, filename) {
neode-0.0.0.tgz/coffee-script/lib/coffee-script/coffee-script.js:25: require.registerExtension('.coffee', function(content) {
ngine-0.0.2.tgz/lib/ejs.js:387: require.registerExtension('.ejs', function(src) {
periodic.component.list-view-scroll-0.1.1.tgz/example/scripts/example.js:2827: require.registerExtension('.ejs', function(src) {
sdejs-0.0.2.tgz/lib/sdejs.js:376: require.registerExtension('.ejs', function(src) {
sdejs-0.0.2.tgz/sdejs.js:420: require.registerExtension('.ejs', function(src) {
springbokejs-0.0.1.tgz/ejs.js:346: require.registerExtension('.ejs', function(src) {
springbokejs-0.0.1.tgz/lib/ejs.js:378: require.registerExtension('.ejs', function(src) {
tinyliquid-0.2.29.tgz/other/ejs.js:411: require.registerExtension('.ejs', function(src) {
toffee-0.1.12.tgz/lib/coffee-script/coffee-script.js:25: require.registerExtension('.coffee', function(content) {
TwigJS-0.0.2.tgz/support/coffee-script/lib/coffee-script/coffee-script.js:17: require.registerExtension('.coffee', function(content) {
twigjs-0.0.4.tgz/support/coffee-script/lib/coffee-script/coffee-script.js:17: require.registerExtension('.coffee', function(content) {
utml-0.2.0.tgz/utml.js:224: require.registerExtension('.utml', function(src){
vork-0.0.12.tgz/exampleApp/app/requirejsBuilder/plugins/ejs.js:333: require.registerExtension('.ejs', function(src) {
wsi-ejs-1.2.0.tgz/ejs.js:413: require.registerExtension('.ejs', function(src) {
wsi-ejs-1.2.0.tgz/lib/ejs.js:361: require.registerExtension('.ejs', function(src) {
yerbascript-0.0.1.tgz/lib/coffee-script/coffee-script.js:31: require.registerExtension('.yerba', function(content) {
yerbascript-0.0.1.tgz/lib/coffee-script/coffee-script.js:34: require.registerExtension('.coffee', function(content) { Most of them do an |
IMHO I would just remove them both, they have been deprecated for a long time now, at least since 2011. It's not like it was a soft deprecation either. |
|
@ChALkeR Are all those packages latest? |
@thefourtheye For 2015-09-21, yes. |
hmmm, I wonder how they are really working. |
There could be a lot of false positives for Also some modules are not used by anybody. |
@thefourtheye Also note that those are only 1100 lines in 442 modules for |
Not sure we have coverage of this kind of situation because it's not even deprecated, it's flat-out broken. I could imagine a situation where you're using the exception in some upstream workflow but you'd have to be more than a little crazy to be doing that I think.. I bet lot of those packages are either not attempting to use that functionality (notice how many have ejs.js or coffee-script.js in a lib directory?) or are simply abandonware. I'm +0.5 on this as long as it's only for v5+. |
@ChALkeR LGTY? |
@thefourtheye Also, most of those |
LGTM for v5 |
LGTM |
`require.paths` property and `require.registerExtension` function have been throwing errors when used. They both are like this for years now. This patch removes them from the system. PR-URL: #2922 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Thanks for the review people :-) Landed at 6ad458b |
Notable changes: * buffer: (Breaking) Removed both 'raw' and 'raws' encoding types from Buffer, these have been deprecated for a long time (Sakthipriyan Vairamani) nodejs#2859. * console: (Breaking) Values reported by console.time() now have 3 decimals of accuracy added (Michaël Zasso) nodejs#3166. * fs: - fs.readFile*(), fs.writeFile*(), and fs.appendFile*() now also accept a file descriptor as their first argument (Johannes Wüller) nodejs#3163. - (Breaking) In fs.readFile(), if an encoding is specified and the internal toString() fails the error is no longer thrown but is passed to the callback (Evan Lucas) nodejs#3485. - (Breaking) In fs.read() (using the fs.read(fd, length, position, encoding, callback) form), if the internal toString() fails the error is no longer thrown but is passed to the callback (Evan Lucas) nodejs#3503. * http: - Fixed a bug where pipelined http requests would stall (Fedor Indutny) nodejs#3342. - (Breaking) When parsing HTTP, don't add duplicates of the following headers: Retry-After, ETag, Last-Modified, Server, Age, Expires. This is in addition to the following headers which already block duplicates: Content-Type, Content-Length, User-Agent, Referer, Host, Authorization, Proxy-Authorization, If-Modified-Since, If-Unmodified-Since, From, Location, Max-Forwards (James M Snell) nodejs#3090. - (Breaking) The callback argument to OutgoingMessage#setTimeout() must be a function or a TypeError is thrown (James M Snell) nodejs#3090. - (Breaking) HTTP methods and header names must now conform to the RFC 2616 "token" rule, a list of allowed characters that excludes control characters and a number of separator characters. Specifically, methods and header names must now match /^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$/ or a TypeError will be thrown (James M Snell) nodejs#2526. * node: - (Breaking) Deprecated the _linklist module (Rich Trott) nodejs#3078. - (Breaking) Removed require.paths and require.registerExtension(), both had been previously set to throw Error when accessed (Sakthipriyan Vairamani) nodejs#2922. * npm: Upgraded to version 3.3.6 from 2.14.7, see https://github.com/npm/npm/releases/tag/v3.3.6 for more details. This is a major version bump for npm and it has seen a significant amount of change. Please see the original npm v3.0.0 release notes for a list of major changes (Rebecca Turner) nodejs#3310. * src: (Breaking) Bumped NODE_MODULE_VERSION to 47 from 46, this is necessary due to the V8 upgrade. Native add-ons will need to be recompiled (Rod Vagg) nodejs#3400. * timers: Attempt to reuse the timer handle for setTimeout().unref(). This fixes a long-standing known issue where unrefed timers would perviously hold beforeExit open (Fedor Indutny) nodejs#3407. * tls: - Added ALPN Support (Shigeki Ohtsu) nodejs#2564. - TLS options can now be passed in an object to createSecurePair() (Коренберг Марк) nodejs#2441. - (Breaking) The default minimum DH key size for tls.connect() is now 1024 bits and a warning is shown when DH key size is less than 2048 bits. This a security consideration to prevent "logjam" attacks. A new minDHSize TLS option can be used to override the default. (Shigeki Ohtsu) nodejs#1831. * util: - (Breaking) util.p() was deprecated for years, and has now been removed (Wyatt Preul) nodejs#3432. - (Breaking) util.inherits() can now work with ES6 classes. This is considered a breaking change because of potential subtle side-effects caused by a change from directly reassigning the prototype of the constructor using `ctor.prototype = Object.create(superCtor.prototype, { constructor: { ... } })` to using `Object.setPrototypeOf(ctor.prototype, superCtor.prototype)` (Michaël Zasso) nodejs#3455. * v8: (Breaking) Upgraded to 4.6.85.25 from 4.5.103.35 (Ali Ijaz Sheikh) nodejs#3351. - Implements the spread operator, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator for further information. - Implements new.target, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target for further information. * zlib: Decompression now throws on truncated input (e.g. unexpected end of file) (Yuval Brik) nodejs#2595. PR-URL: nodejs#3466
Notable changes: * buffer: (Breaking) Removed both 'raw' and 'raws' encoding types from Buffer, these have been deprecated for a long time (Sakthipriyan Vairamani) #2859. * console: (Breaking) Values reported by console.time() now have 3 decimals of accuracy added (Michaël Zasso) #3166. * fs: - fs.readFile*(), fs.writeFile*(), and fs.appendFile*() now also accept a file descriptor as their first argument (Johannes Wüller) #3163. - (Breaking) In fs.readFile(), if an encoding is specified and the internal toString() fails the error is no longer thrown but is passed to the callback (Evan Lucas) #3485. - (Breaking) In fs.read() (using the fs.read(fd, length, position, encoding, callback) form), if the internal toString() fails the error is no longer thrown but is passed to the callback (Evan Lucas) #3503. * http: - Fixed a bug where pipelined http requests would stall (Fedor Indutny) #3342. - (Breaking) When parsing HTTP, don't add duplicates of the following headers: Retry-After, ETag, Last-Modified, Server, Age, Expires. This is in addition to the following headers which already block duplicates: Content-Type, Content-Length, User-Agent, Referer, Host, Authorization, Proxy-Authorization, If-Modified-Since, If-Unmodified-Since, From, Location, Max-Forwards (James M Snell) #3090. - (Breaking) The callback argument to OutgoingMessage#setTimeout() must be a function or a TypeError is thrown (James M Snell) #3090. - (Breaking) HTTP methods and header names must now conform to the RFC 2616 "token" rule, a list of allowed characters that excludes control characters and a number of separator characters. Specifically, methods and header names must now match /^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$/ or a TypeError will be thrown (James M Snell) #2526. * node: - (Breaking) Deprecated the _linklist module (Rich Trott) #3078. - (Breaking) Removed require.paths and require.registerExtension(), both had been previously set to throw Error when accessed (Sakthipriyan Vairamani) #2922. * npm: Upgraded to version 3.3.6 from 2.14.7, see https://github.com/npm/npm/releases/tag/v3.3.6 for more details. This is a major version bump for npm and it has seen a significant amount of change. Please see the original npm v3.0.0 release notes for a list of major changes (Rebecca Turner) #3310. * src: (Breaking) Bumped NODE_MODULE_VERSION to 47 from 46, this is necessary due to the V8 upgrade. Native add-ons will need to be recompiled (Rod Vagg) #3400. * timers: Attempt to reuse the timer handle for setTimeout().unref(). This fixes a long-standing known issue where unrefed timers would perviously hold beforeExit open (Fedor Indutny) #3407. * tls: - Added ALPN Support (Shigeki Ohtsu) #2564. - TLS options can now be passed in an object to createSecurePair() (Коренберг Марк) #2441. - (Breaking) The default minimum DH key size for tls.connect() is now 1024 bits and a warning is shown when DH key size is less than 2048 bits. This a security consideration to prevent "logjam" attacks. A new minDHSize TLS option can be used to override the default. (Shigeki Ohtsu) #1831. * util: - (Breaking) util.p() was deprecated for years, and has now been removed (Wyatt Preul) #3432. - (Breaking) util.inherits() can now work with ES6 classes. This is considered a breaking change because of potential subtle side-effects caused by a change from directly reassigning the prototype of the constructor using `ctor.prototype = Object.create(superCtor.prototype, { constructor: { ... } })` to using `Object.setPrototypeOf(ctor.prototype, superCtor.prototype)` (Michaël Zasso) #3455. * v8: (Breaking) Upgraded to 4.6.85.25 from 4.5.103.35 (Ali Ijaz Sheikh) #3351. - Implements the spread operator, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator for further information. - Implements new.target, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target for further information. * zlib: Decompression now throws on truncated input (e.g. unexpected end of file) (Yuval Brik) #2595. PR-URL: #3466
require.paths
property andrequire.registerExtension
function havebeen throwing errors when used. They both are like this for years now.
This patch removes them from the system.
require.paths
: 7f0047c#diff-d1234a869b3d648ebfcdce5a76747d71R359require.registerExtension
was removed even before that.