Skip to content

Commit

Permalink
lib: remove unintended access to deps/
Browse files Browse the repository at this point in the history
This brings DEP0084 to End-of-Life. It is unlikely that this
has received much public usage in the first place, so removing
should be okay.

PR-URL: nodejs#25138
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Anna Henningsen authored and refack committed Jan 10, 2019
1 parent 172f11f commit 56e4180
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 80 deletions.
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 @@ -220,9 +220,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

0 comments on commit 56e4180

Please sign in to comment.