Skip to content
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: deprecate require('module').Module #4550

Closed
wants to merge 2 commits into from

Conversation

JacksonTian
Copy link
Contributor

recommend developers to use require('module').

@mscdex
Copy link
Contributor

mscdex commented Jan 6, 2016

That's not true, require('module').Module definitely is accessible outside of core. However, we would need to run some checks against npm modules to see if they use that or not before removing it. At the very least we'd need to add a deprecation warning. Keeping it around doesn't add any burden though.

@mscdex mscdex added the module Issues and PRs related to the module subsystem. label Jan 6, 2016
@jasnell
Copy link
Member

jasnell commented Jan 6, 2016

+1 to @mscdex's comments. We cannot simply remove it like this. There is a required deprecated cycle we'd need to go through and even then, once marked deprecated it could end up sticking around for quite a while (even if it's a bit silly having it there)

@JacksonTian
Copy link
Contributor Author

Thanks, I will update it.

@JacksonTian JacksonTian changed the title module: remove unnecessary backwards compatibility module: deprecte require('module').Module Jan 7, 2016
@jasnell jasnell added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jan 7, 2016
@jasnell
Copy link
Member

jasnell commented Jan 7, 2016

LGTM

@mscdex
Copy link
Contributor

mscdex commented Jan 7, 2016

After this week's CTC meeting discussion about the meaning of "deprecation", should this PR be changed to more accurately reflect the status/intention? Or are we going to commit it now and change the messaging later? Or something else?

/cc @nodejs/ctc

get: internalUtil.deprecate(function() {
return Module;
},
'require(\'module\').Module is deprecated. Use require(\'module\') instead.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use a template string to avoid escaping the quotes.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 7, 2016

@mscdex did you have something specific in mind?

@jasnell
Copy link
Member

jasnell commented Jan 7, 2016

Given that the deprecation message doesn't say anything about it being removed and is consistent with the other deprecation messages we have, I'd say it's likely safe to land as is now and work out the revised messaging around deprecation later

@mscdex
Copy link
Contributor

mscdex commented Jan 7, 2016

@cjihrig I mean if our intention is to remove it, we should be using "stronger" wording?

@cjihrig
Copy link
Contributor

cjihrig commented Jan 7, 2016

I think this is fine for now. We could do one sweeping PR later to update all the deprecation messages once we know what we want to say (maybe add "and will be removed" to the message).

@silverwind silverwind changed the title module: deprecte require('module').Module module: deprecate require('module').Module Jan 9, 2016
@trevnorris
Copy link
Contributor

Just curious, why this and not include others like require('events').EventEmitter?

@JacksonTian
Copy link
Contributor Author

@trevnorris If this patch can be accepted, I will do that.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 12, 2016

LGTM for v6.

@evanlucas
Copy link
Contributor

looks like npm init will be affected by this (https://github.com/npm/promzard/blob/master/promzard.js#L12).

There are more than just that, waiting on grep to finish...

EDIT: Here is the first batch https://gist.github.com/evanlucas/07e4771bbf7a83ca3b16

These are a little bit old, btw

@ChALkeR
Copy link
Member

ChALkeR commented Jan 13, 2016

Quick and dirty grep results: https://gist.github.com/ChALkeR/b13b22e813157b4b49d6

@ChALkeR
Copy link
Member

ChALkeR commented Jan 13, 2016

@evanlucas You can use my dataset for finding those, it's uploaded long ago to http://oserv.org/npm/Gzemnid/, takes up less than 3 GiB, and an average grep time is about 60-70 seconds.

It ignores dependencies though, and searches for the match only in the topmost module sources (node_modules is excluded).

@ChALkeR
Copy link
Member

ChALkeR commented Jan 13, 2016

Modules API has Stability: 3 - Locked per doc.
While this PR is unlikely to break anything or affect many modules (the usage seems low), the documentation states that this PR should be rejected.

If Modules API was not Locked, I would vote +1 for this PR.

@evanlucas
Copy link
Contributor

Along with the module system being locked, this affects the package manager that is bundled with node. -1 from me as it doesn't really gain us anything...

recommend developers to use `require('module')`.
recommend developers to use `require('events')`.
@jasnell
Copy link
Member

jasnell commented Mar 22, 2016

Any updates on this one?

@jasnell
Copy link
Member

jasnell commented Mar 22, 2016

@nodejs/ctc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants