@@ -751,7 +751,8 @@ changes:
751751* ` specifier` {string}
752752* ` context` {Object}
753753 * ` conditions` {string\[ ]} Export conditions of the relevant ` package .json `
754- * ` importAssertions` {Object}
754+ * ` importAssertions` {Object} An object whose key-value pairs represent the
755+ assertions for the module to import
755756 * ` parentURL` {string|undefined} The module importing this one, or undefined
756757 if this is the Node.js entry point
757758* ` nextResolve` {Function} The subsequent ` resolve` hook in the chain, or the
@@ -762,23 +763,24 @@ changes:
762763 * ` format` {string|null|undefined} A hint to the load hook (it might be
763764 ignored)
764765 ` ' builtin' | ' commonjs' | ' json' | ' module' | ' wasm' `
766+ * ` importAssertions` {Object|undefined} The import assertions to use when
767+ caching the module (optional; if excluded the input will be used)
765768 * ` shortCircuit` {undefined|boolean} A signal that this hook intends to
766769 terminate the chain of ` resolve` hooks. **Default:** ` false `
767770 * ` url` {string} The absolute URL to which this input resolves
768771
769- The ` resolve` hook chain is responsible for resolving file URL for a given
770- module specifier and parent URL, and optionally its format (such as ` ' module' ` )
771- as a hint to the ` load` hook. If a format is specified, the ` load` hook is
772- ultimately responsible for providing the final ` format` value (and it is free to
773- ignore the hint provided by ` resolve` ); if ` resolve` provides a ` format` , a
774- custom ` load` hook is required even if only to pass the value to the Node.js
775- default ` load` hook.
776-
777- The module specifier is the string in an ` import ` statement or
778- ` import()` expression.
779-
780- The parent URL is the URL of the module that imported this one, or ` undefined`
781- if this is the main entry point for the application.
772+ The ` resolve` hook chain is responsible for telling Node.js where to find and
773+ how to cache a given ` import ` statement or expression. It can optionally return
774+ its format (such as ` ' module' ` ) as a hint to the ` load` hook. If a format is
775+ specified, the ` load` hook is ultimately responsible for providing the final
776+ ` format` value (and it is free to ignore the hint provided by ` resolve` ); if
777+ ` resolve` provides a ` format` , a custom ` load` hook is required even if only to
778+ pass the value to the Node.js default ` load` hook.
779+
780+ Import type assertions are part of the cache key for saving loaded modules into
781+ the internal module cache. The ` resolve` hook is responsible for
782+ returning an ` importAssertions` object if the module should be cached with
783+ different assertions than were present in the source code.
782784
783785The ` conditions` property in ` context` is an array of conditions for
784786[package exports conditions][Conditional Exports] that apply to this resolution
0 commit comments