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

lib: remove unintended access to deps/ #25138

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1670,16 +1670,19 @@ the client and is now unsupported. Use the `ciphers` parameter instead.
### DEP0084: requiring bundled internal dependencies
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/25138
description: This functionality has been removed.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/16392
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-Life

Since Node.js versions 4.4.0 and 5.2.0, several modules only intended for
internal usage are mistakenly exposed to user code through `require()`. These
modules are:
internal usage were mistakenly exposed to user code through `require()`. These
modules were:

- `v8/tools/codemap`
- `v8/tools/consarray`
Expand Down
4 changes: 1 addition & 3 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ NativeModule.isDepsModule = function(id) {
};

NativeModule.requireForDeps = function(id) {
if (!NativeModule.exists(id) ||
// TODO(TimothyGu): remove when DEP0084 reaches end of life.
NativeModule.isDepsModule(id)) {
if (!NativeModule.exists(id)) {
id = `internal/deps/${id}`;
}
return NativeModule.require(id);
Expand Down
56 changes: 0 additions & 56 deletions test/parallel/test-require-deps-deprecation.js

This file was deleted.

18 changes: 0 additions & 18 deletions tools/js2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,6 @@ def ReadMacros(lines):
);
"""

DEPRECATED_DEPS = """\
'use strict';
process.emitWarning(
'Requiring Node.js-bundled \\'{module}\\' module is deprecated. Please ' +
'install the necessary module locally.', 'DeprecationWarning', 'DEP0084');
module.exports = require('internal/deps/{module}');
"""

def JS2C(source, target):
modules = []
consts = {}
Expand Down Expand Up @@ -265,15 +257,11 @@ def AddModule(module, source):
lines = ExpandConstants(lines, consts)
lines = ExpandMacros(lines, macros)

deprecated_deps = None

# On Windows, "./foo.bar" in the .gyp file is passed as "foo.bar"
# so don't assume there is always a slash in the file path.
if '/' in name or '\\' in name:
split = re.split('/|\\\\', name)
if split[0] == 'deps':
if split[1] == 'node-inspect' or split[1] == 'v8':
deprecated_deps = split[1:]
split = ['internal'] + split
else:
split = split[1:]
Expand All @@ -293,12 +281,6 @@ def AddModule(module, source):
else:
AddModule(name.split('.', 1)[0], lines)

# Add deprecated aliases for deps without 'deps/'
if deprecated_deps is not None:
module = '/'.join(deprecated_deps).split('.', 1)[0]
source = DEPRECATED_DEPS.format(module=module)
AddModule(module, source)

# Emit result
output = open(str(target[0]), "w")
output.write(
Expand Down