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

Deprecate forEach* and map* methods #6367

Merged
merged 1 commit into from Jan 24, 2018
Merged

Deprecate forEach* and map* methods #6367

merged 1 commit into from Jan 24, 2018

Conversation

ooflorent
Copy link
Member

What kind of change does this PR introduce?

refactoring

Did you add tests for your changes?

no

If relevant, link to documentation update:

TODO

Summary

forEach* and map* methods are not needed and add complexity to webpack. Since these modules could be replaced by Array.from(), there are safe to deprecate.

Does this PR introduce a breaking change?

no

lib/Chunk.js Outdated
configurable: false,
value: util.deprecate(function(fn) {
this._modules.forEach(fn);
}, "Chunk.forEachModule: Use chunk.modulesIterable.forEach(fn) instead")
Copy link
Member

Choose a reason for hiding this comment

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

Use for(const module of chunk.modulesIterable) instead

An iterable has no forEach method. Here a Set is returned but you can't rely on that. The official return type is Iterable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I’ll update the wording.

lib/Module.js Outdated
configurable: false,
value: util.deprecate(function(fn) {
this._chunks.forEach(fn);
}, "Module.forEachChunk: Use module.chunksIterable.forEach(fn) instead")
Copy link
Member

Choose a reason for hiding this comment

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

same

@ooflorent ooflorent closed this Jan 23, 2018
@ooflorent ooflorent reopened this Jan 23, 2018
@sokra sokra added this to the webpack 4 milestone Jan 23, 2018
@webpack-bot
Copy link
Contributor

@ooflorent Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@sokra Please review the new changes.

@TheLarkInn
Copy link
Member

Outdated uglify plugin or stuck test?

@ooflorent
Copy link
Member Author

ooflorent commented Jan 23, 2018

@TheLarkInn CI fails at least one to 3 times on node 6 (😡 ) with timeouts or UglifyJS glitches. CI is not stable for node 6 on next.

@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@sokra sokra merged commit 7de03f2 into next Jan 24, 2018
@sokra
Copy link
Member

sokra commented Jan 24, 2018

Thanks

@sokra sokra deleted the deprecate_forEach_map branch January 24, 2018 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants