lib: remove unintended access to deps/
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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
b4b9e0e28c
commit
4100001624
@ -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`
|
||||
|
@ -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);
|
||||
|
@ -1,56 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
const deprecatedModules = [
|
||||
'node-inspect/lib/_inspect',
|
||||
'node-inspect/lib/internal/inspect_client',
|
||||
'node-inspect/lib/internal/inspect_repl',
|
||||
'v8/tools/SourceMap',
|
||||
'v8/tools/codemap',
|
||||
'v8/tools/consarray',
|
||||
'v8/tools/csvparser',
|
||||
'v8/tools/logreader',
|
||||
'v8/tools/profile',
|
||||
'v8/tools/profile_view',
|
||||
'v8/tools/splaytree',
|
||||
'v8/tools/tickprocessor',
|
||||
'v8/tools/tickprocessor-driver'
|
||||
];
|
||||
|
||||
// Newly added deps that do not have a deprecation wrapper around it would
|
||||
// throw an error, but no warning would be emitted.
|
||||
const deps = [
|
||||
'acorn/dist/acorn',
|
||||
'acorn/dist/walk'
|
||||
];
|
||||
|
||||
common.expectWarning('DeprecationWarning', deprecatedModules.map((m) => {
|
||||
return [`Requiring Node.js-bundled '${m}' module is deprecated. ` +
|
||||
'Please install the necessary module locally.', 'DEP0084'];
|
||||
}));
|
||||
|
||||
for (const m of deprecatedModules) {
|
||||
try {
|
||||
require(m);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// Instead of checking require, check that resolve isn't pointing toward a
|
||||
// built-in module, as user might already have node installed with acorn in
|
||||
// require.resolve range.
|
||||
// Ref: https://github.com/nodejs/node/issues/17148
|
||||
for (const m of deps) {
|
||||
let path;
|
||||
try {
|
||||
path = require.resolve(m);
|
||||
} catch (err) {
|
||||
assert.ok(err.toString().startsWith('Error: Cannot find module '));
|
||||
continue;
|
||||
}
|
||||
assert.notStrictEqual(path, m);
|
||||
}
|
||||
|
||||
// The V8 modules add the WebInspector to the globals.
|
||||
common.allowGlobals(global.WebInspector);
|
@ -214,14 +214,6 @@ source_.emplace(
|
||||
);
|
||||
"""
|
||||
|
||||
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 = {}
|
||||
@ -265,15 +257,11 @@ def JS2C(source, target):
|
||||
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:]
|
||||
@ -293,12 +281,6 @@ def JS2C(source, target):
|
||||
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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user