Skip to content

Commit 163030e

Browse files
committedSep 24, 2020
doc: revise dependency redirection text in policy.md
PR-URL: #35276 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 77dd440 commit 163030e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed
 

‎doc/api/policy.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,28 @@ replaced.
137137
```
138138

139139
The dependencies are keyed by the requested specifier string and have values
140-
of either `true`, `null`, a string pointing to a module that will be resolved,
140+
of either `true`, `null`, a string pointing to a module to be resolved,
141141
or a conditions object.
142142

143143
The specifier string does not perform any searching and must match exactly
144144
what is provided to the `require()` or `import`. Therefore, multiple specifiers
145145
may be needed in the policy if it uses multiple different strings to point
146146
to the same module (such as excluding the extension).
147147

148-
If the value of the redirection is `true` the default searching algorithms will
149-
be used to find the module.
148+
If the value of the redirection is `true` the default searching algorithms are
149+
used to find the module.
150150

151-
If the value of the redirection is a string, it will be resolved relative to
152-
the manifest and then immediately be used without searching.
151+
If the value of the redirection is a string, it is resolved relative to
152+
the manifest and then immediately used without searching.
153153

154-
Any specifier string that is attempted to resolve and not listed in the
155-
dependencies will result in an error according to the policy.
154+
Any specifier string for which resolution is attempted and that is not listed in
155+
the dependencies results in an error according to the policy.
156156

157-
Redirection will not prevent access to APIs through means such as direct access
158-
to `require.cache` and/or through `module.constructor` which allow access to
157+
Redirection does not prevent access to APIs through means such as direct access
158+
to `require.cache` or through `module.constructor` which allow access to
159159
loading modules. Policy redirection only affects specifiers to `require()` and
160-
`import`. Other means such as to prevent undesired access to APIs through
161-
variables are necessary to lock down that path of loading modules.
160+
`import`. Other means, such as to prevent undesired access to APIs through
161+
variables, are necessary to lock down that path of loading modules.
162162

163163
A boolean value of `true` for the dependencies map can be specified to allow a
164164
module to load any specifier without redirection. This can be useful for local
@@ -167,14 +167,14 @@ only with care after auditing a module to ensure its behavior is valid.
167167

168168
Similar to `"exports"` in `package.json`, dependencies can also be specified to
169169
be objects containing conditions which branch how dependencies are loaded. In
170-
the preceding example, `"http"` will be allowed when the `"import"` condition is
170+
the preceding example, `"http"` is allowed when the `"import"` condition is
171171
part of loading it.
172172

173-
A value of `null` for the resolved value will cause the resolution to fail. This
173+
A value of `null` for the resolved value causes the resolution to fail. This
174174
can be used to ensure some kinds of dynamic access are explicitly prevented.
175175

176-
Unknown values for the resolved module location will cause failure but are
177-
not guaranteed to be forwards compatible.
176+
Unknown values for the resolved module location cause failures but are
177+
not guaranteed to be forward compatible.
178178

179179
#### Example: Patched dependency
180180

0 commit comments

Comments
 (0)
Please sign in to comment.