无路径遍历或无效片段
¥No path traversal or invalid segments
导出目标不得解析到包根目录之外的位置。此外,像 .
(单点)、..
(双点)或 node_modules
(及其 URL 编码的等效项)这样的路径段通常不允许出现在初始 ./
之后的 target
字符串中,也不允许出现在替换为目标模式的任何 subpath
部分中。
¥Export targets must not resolve to a location outside the package's root
directory. Additionally, path segments like .
(single dot), ..
(double dot),
or node_modules
(and their URL-encoded equivalents) are generally disallowed
within the target
string after the initial ./
and in any subpath
part
substituted into a target pattern.
// package.json
{
"name": "my-package",
"exports": {
// ".": "./dist/../../elsewhere/file.js", // Invalid: path traversal
// ".": "././dist/main.js", // Invalid: contains "." segment
// ".": "./dist/../dist/main.js", // Invalid: contains ".." segment
// "./utils/./helper.js": "./utils/helper.js" // Key has invalid segment
}
}