DEP0084: 需要捆绑的内部依赖项


类型: 生命结束

从 Node.js 4.4.0 和 5.2.0 版本开始,一些仅供内部使用的模块被错误地通过 require() 暴露给用户代码。 这些模块是:

  • v8/tools/codemap
  • v8/tools/consarray
  • v8/tools/csvparser
  • v8/tools/logreader
  • v8/tools/profile_view
  • v8/tools/profile
  • v8/tools/SourceMap
  • v8/tools/splaytree
  • v8/tools/tickprocessor-driver
  • v8/tools/tickprocessor
  • node-inspect/lib/_inspect(从 7.6.0 开始)
  • node-inspect/lib/internal/inspect_client(从 7.6.0 开始)
  • node-inspect/lib/internal/inspect_repl(从 7.6.0 开始)

v8/* 模块没有任何导出,如果不按特定顺序导入实际上会抛出错误。 因此,几乎没有通过 require() 导入它们的合法用例。

另一方面,node-inspect 可以通过包管理器在本地安装,因为它以相同的名称发布在 npm 仓库上。 如果这样做,则无需修改源代码。

Type: End-of-Life

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

  • v8/tools/codemap
  • v8/tools/consarray
  • v8/tools/csvparser
  • v8/tools/logreader
  • v8/tools/profile_view
  • v8/tools/profile
  • v8/tools/SourceMap
  • v8/tools/splaytree
  • v8/tools/tickprocessor-driver
  • v8/tools/tickprocessor
  • node-inspect/lib/_inspect (from 7.6.0)
  • node-inspect/lib/internal/inspect_client (from 7.6.0)
  • node-inspect/lib/internal/inspect_repl (from 7.6.0)

The v8/* modules do not have any exports, and if not imported in a specific order would in fact throw errors. As such there are virtually no legitimate use cases for importing them through require().

On the other hand, node-inspect can be installed locally through a package manager, as it is published on the npm registry under the same name. No source code modification is necessary if that is done.