diff options
author | Guy Bedford <guybedford@gmail.com> | 2019-10-13 19:27:39 -0400 |
---|---|---|
committer | Guy Bedford <guybedford@gmail.com> | 2019-11-08 17:26:26 -0500 |
commit | 2367474db46136aecb87b27d82bfa597a95aeedd (patch) | |
tree | 58fd8eb4ad143677a791b00f994965d9573e562b /doc/api/modules.md | |
parent | c73ef32d355aa58672c15e89534c375dd2246f3c (diff) | |
download | android-node-v8-2367474db46136aecb87b27d82bfa597a95aeedd.tar.gz android-node-v8-2367474db46136aecb87b27d82bfa597a95aeedd.tar.bz2 android-node-v8-2367474db46136aecb87b27d82bfa597a95aeedd.zip |
module: conditional exports with flagged conditions
PR-URL: https://github.com/nodejs/node/pull/29978
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'doc/api/modules.md')
-rw-r--r-- | doc/api/modules.md | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/api/modules.md b/doc/api/modules.md index 8715218b32..d685662921 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -232,12 +232,17 @@ RESOLVE_BARE_SPECIFIER(DIR, X) 2. If X matches this pattern and DIR/name/package.json is a file: a. Parse DIR/name/package.json, and look for "exports" field. b. If "exports" is null or undefined, GOTO 3. - c. Find the longest key in "exports" that the subpath starts with. - d. If no such key can be found, throw "not found". - e. let RESOLVED_URL = + c. If "exports" is an object with some keys starting with "." and some keys + not starting with ".", throw "invalid config". + c. If "exports" is a string, or object with no keys starting with ".", treat + it as having that value as its "." object property. + d. If subpath is "." and "exports" does not have a "." entry, GOTO 3. + e. Find the longest key in "exports" that the subpath starts with. + f. If no such key can be found, throw "not found". + g. let RESOLVED_URL = PACKAGE_EXPORTS_TARGET_RESOLVE(pathToFileURL(DIR/name), exports[key], subpath.slice(key.length)), as defined in the esm resolver. - f. return fileURLToPath(RESOLVED_URL) + h. return fileURLToPath(RESOLVED_URL) 3. return DIR/X ``` |