DEP0084:需要打包的内部依赖


【DEP0084: requiring bundled internal dependencies】

类型:寿命终止

【Type: End-of-Life】

自 Node.js 版本 4.4.0 和 5.2.0 起,一些仅用于内部的模块被错误地通过 require() 暴露给用户代码。这些模块包括:

【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(来自 7.6.0)
  • node-inspect/lib/internal/inspect_client(从 7.6.0 开始)
  • node-inspect/lib/internal/inspect_repl(来自 7.6.0)

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

【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().】

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

【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.】