如何获得 jupyterlab 的 javascript 依赖项的最终列表

How can I get a definitive list of the javascript dependencies for jupyterlab

我正在尝试获取与 jupyterlab v1.1.4 打包在一起的所有依赖项的列表。我认为我可以通过

获得 python 依赖项
python3 -m venv .env
pip install jupyterlab==1.1.4
pip freeze

但我不知道如何为 javascript 依赖项执行此操作。我对js了解不多

似乎此信息可能在 yarn.lock 文件之一中。但是我不确定我是想要主目录中的 yarn.lock 文件还是 /jupyterlab/staging/ 中的文件。我认为它可能是分期的原因,它要短得多,因为 CONTRIBUTING.md 说:

By default, the application will load from the JupyterLab staging directory (default is <sys-prefix>/share/jupyter/lab/build. If you wish to run the core application in <git root>/jupyterlab/build, run jupyter lab --core-mode. This is the core application that will be shipped.

但接下来的问题是,一旦我确定了正确的 yarn.lock 文件,我该如何删除开发依赖项?我看到 /jupyterlab/staging/package.json 里面有一个开发依赖项的部分,这些似乎包含在 yarn.lock 文件中。 package.json 的依赖部分中的所有内容都以 @jupyterlab 为前缀。这是否意味着我可以过滤 yarn.lock 以仅保留该部分中的块?所以我会保留所有这些依赖项

"@jupyterlab/coreutils@^3.1.0", "@jupyterlab/coreutils@~3.1.0":
  version "3.1.0"
  resolved "https://registry.yarnpkg.com/@jupyterlab/coreutils/-/coreutils-3.1.0.tgz#b307569462c468d6a09dfa06f32fed03e55dd811"
  integrity sha512-ZqgzDUyanyvc86gtCrIbc1M6iniKHYmWNWHvWOcnq3KIP3wk3grchsTYPTfQDxcUS6F04baPGp/KohEU2ml40Q==
  dependencies:
    "@phosphor/commands" "^1.6.3"
    "@phosphor/coreutils" "^1.3.1"
    "@phosphor/disposable" "^1.2.0"
    "@phosphor/properties" "^1.1.3"
    "@phosphor/signaling" "^1.2.3"
    ajv "^6.5.5"
    json5 "^2.1.0"
    minimist "~1.2.0"
    moment "^2.24.0"
    path-posix "~1.0.0"
    url-parse "~1.4.3"

因为 (@jupyterlab/coreutils)[https://github.com/jupyterlab/jupyterlab/blob/v1.1.4/jupyterlab/staging/package.json#L24] 在 dependencies 部分,但我可以排除

glob@^7.1.3, glob@^7.1.4, glob@~7.1.2:
  version "7.1.4"
  resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
  integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
  dependencies:
    fs.realpath "^1.0.0"
    inflight "^1.0.4"
    inherits "2"
    minimatch "^3.0.4"
    once "^1.3.0"
    path-is-absolute "^1.0.0"

因为 glob 仅在开发依赖项中?但是,如果 glob 是非开发依赖项之一的依赖项,会发生什么情况?在那种情况下,我仍然想保留 glob 和所有 iot 的依赖项。

最后,resolutions 部分是否暗示我可能需要将同一库的多个版本视为打包的最终依赖项?

他们是否为 yarn list 提供了一些过滤器,也许可以为我提供我想要的列表?

yarn list --prod 只会为您提供 JupyterLab 附带的生产依赖项。 resolutions 部分实际上 覆盖 包版本 - 它用于确保只安装给定包的一个版本。用于列出依赖项的 Yarn 实用程序会理解这一点,所以只要你正在使用 Yarn,你就不必担心它。

请注意,JupyterLab 附带许多通常被视为开发依赖项的依赖项 - 这是因为它需要在最终用户计算机上包含 Webpack 和相关工具以支持扩展。