0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 07:00:59 +01:00
nodejs/doc/api
Derek Lewis c17d2f9901 esm: fix loader hooks doc annotations
Prior to this commit, the type annotations on the ESM loader hooks
were invalid. This has been corrected and is ensured to be compatible
with both the TypeScript and Closure type systems.

Notes:
    https://www.typescriptlang.org/play/index.html?useJavaScript=true#code/PQKhCgAIUgBAHAhgJ0QW0gbwM4BdkCWAdgOYC+kArsgDZQwIrpYDyARgFYCmAxrhTwD2RXFwAeuSAAoe1ZFxE0AnpC5p4uJQEp6cJKgyYAYpSJ8CwigBMuAM0SUauAOJdcRwcjSJcu2PNxqImwsAAVkQTQCbC4AHkxIW09vXAAuSDxCUkgyAD4yemBwcXhPSURsJTNE03NhSBI3Dy8fKWoaABpIIRFxXC6be0cXJuSfLSwoSAJbaQBZHwALADpUIitIqQncyAAGZYBWCYTgYEgAZUiubuErAlwLImWpyEhTyGaMq8hPSEQaGiQACqACUADLYAaCL5oa6yPCRSA0QQkAg8RK-GyiLzEYgkDEtXDPV6vd4AQRoAHdEEoQgEgn8iD9OLxJIJZrhFtckl4sDyUulYpk8fkupSufJIJyuC83md+T5piFhNd2VKuRl8HiQsR1ddcIg2DRrobBAA3LjEkn05BMzCy14KtKQADkaEEVkcXBdHVlZAA3FMCqSzgAROxcZBS6EAOQ9lo4IR5fwBP2lUdBEKtNqZgwcTlc7jGuDatC6PVEEgGdnzIyLhK0gbIQA
    https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540warning_level%2520VERBOSE%250A%252F%252F%2520%2540jscomp_error%2520strictCheckTypes%250A%252F%252F%2520%2540language_out%2520ECMASCRIPT_NEXT%250A%252F%252F%2520%2540checks_only%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A%252F**%250A%2520*%2520%2540param%2520%257Bstring%257D%2520url%250A%2520*%2520%2540param%2520%257BObject%257D%2520context%2520(currently%2520empty)%250A%2520*%2520%2540param%2520%257BFunction%257D%2520defaultGetFormat%250A%2520*%2520%2540returns%2520%257BPromise%253C%257B%2520format%253A%2520string%2520%257D%253E%257D%250A%2520*%252F%250Aexport%2520async%2520function%2520getFormat(url%252C%2520context%252C%2520defaultGetFormat)%2520%257B%250A%2520%2520if%2520(Math.random()%2520%253E%25200.5)%2520%257B%2520%252F%252F%2520Some%2520condition.%250A%2520%2520%2520%2520%252F%252F%2520For%2520some%2520or%2520all%2520URLs%252C%2520do%2520some%2520custom%2520logic%2520for%2520determining%2520format.%250A%2520%2520%2520%2520%252F%252F%2520Always%2520return%2520an%2520object%2520of%2520the%2520form%2520%257Bformat%253A%2520%253Cstring%253E%257D%252C%2520where%2520the%250A%2520%2520%2520%2520%252F%252F%2520format%2520is%2520one%2520of%2520the%2520strings%2520in%2520the%2520table%2520above.%250A%2520%2520%2520%2520return%2520%257B%250A%2520%2520%2520%2520%2520%2520format%253A%2520'module'%252C%250A%2520%2520%2520%2520%257D%253B%250A%2520%2520%257D%250A%2520%2520%252F%252F%2520Defer%2520to%2520Node.js%2520for%2520all%2520other%2520URLs.%250A%2520%2520return%2520defaultGetFormat(url%252C%2520context%252C%2520defaultGetFormat)%253B%250A%257D

    https://www.typescriptlang.org/play/?useJavaScript=true#code/PQKhCgAIUgBAHAhgJ0QW0gbwM4BdkCWAdgOYC+k28ApgMYEBmB1yUMCK6WmbkfSyakVwBVAEoAZAFyQAhAAo8hUpAA+kAK5EAJtSZFq2gJQAaXn1oB7HQVwFr2GQoCCyVAE8APEuIkAfKa8ZBRWwtQAHri8HKgYmABiWrR21hS6DIgaADa4YtTYllkAbtTRgrgayETYWAoACsiWaATY1J6YmshZMj4qZAFkbMDgEfCWyLiQiNjuRLSQDEkpRJCCBcXUijT0TCwmkKG4Ebj76Zk5eeslRlhQBw6THQJCopKQALyQRNlZkBSfh2OAG47oxIPIALKIXAACwAdKgdE15Dc-JAAAxwgCsNw6wGAkAAyk1qPcbMs4Xc+PjIPFxpQSZB6Ygsr8qHRGMxkNhTpYGWhSbQNHgmpAspYSAR5gx6WtCkVfJS+NSCc4sgB3RDuGrlSorRArSwAIwAVnRJpYGJBYaSZcg4pVupBvPhfH4yErlbqqrdlcrHTJnsJxBJIAB+Kl+r7UdWQENbDm7ZD7IOvCRGOEwwRWqSRv0GWPx9k7LkZrN6Mx+sggviDPhgyHQ+GI7TIm6eDHY3GQGnOIiWG3IMnaWz2IielWQADqMKEBxZWV8kAABmdsrl8vLqMv9japsgSBoBcIarQDZAjaS0JYR7ttHDIABJFawlqRmln1qQWwAchqiG0EcVANAdZyHIoWQ0W16TQaFaBhJdQhHZYWUgUZxlwbAJ1WagKh9NcLk3DYExLPZfSjOFKMBSJKyjJDRwcGQAG1KLhajcDY6xkLHHlIB-EDBwAWno5YfwAXVo2sjBrP47hpAARPQWGtPkADkb2oOETRqO0plZJlB0obZORYLC7m9FYCI3K5NmLEzkzJI4aMgKzLi3aTwDIIA
    https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540warning_level%2520VERBOSE%250A%252F%252F%2520%2540jscomp_error%2520strictCheckTypes%250A%252F%252F%2520%2540language_out%2520ECMASCRIPT_NEXT%250A%252F%252F%2520%2540checks_only%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A%252F**%250A%2520*%2520%2540param%2520%257Bstring%257D%2520specifier%250A%2520*%2520%2540param%2520%257B%257B%250A%2520*%2520%2520%2520parentURL%253A%2520!(string%2520%257C%2520undefined)%252C%250A%2520*%2520%2520%2520conditions%253A%2520!(Array%253Cstring%253E)%252C%250A%2520*%2520%257D%257D%2520context%250A%2520*%2520%2540param%2520%257BFunction%257D%2520defaultResolve%250A%2520*%2520%2540returns%2520%257B!(Promise%253C%257B%2520url%253A%2520string%2520%257D%253E)%257D%250A%2520*%252F%250Aexport%2520async%2520function%2520resolve(specifier%252C%2520context%252C%2520defaultResolve)%2520%257B%250A%2520%2520const%2520%257B%2520parentURL%2520%253D%2520null%2520%257D%2520%253D%2520context%253B%250A%2520%2520if%2520(Math.random()%2520%253E%25200.5)%2520%257B%2520%252F%252F%2520Some%2520condition.%250A%2520%2520%2520%2520%252F%252F%2520For%2520some%2520or%2520all%2520specifiers%252C%2520do%2520some%2520custom%2520logic%2520for%2520resolving.%250A%2520%2520%2520%2520%252F%252F%2520Always%2520return%2520an%2520object%2520of%2520the%2520form%2520%257Burl%253A%2520%253Cstring%253E%257D.%250A%2520%2520%2520%2520return%2520%257B%250A%2520%2520%2520%2520%2520%2520url%253A%2520parentURL%2520%253F%250A%2520%2520%2520%2520%2520%2520%2520%2520new%2520URL(specifier%252C%2520parentURL).href%2520%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520new%2520URL(specifier).href%252C%250A%2520%2520%2520%2520%257D%253B%250A%2520%2520%257D%250A%2520%2520if%2520(Math.random()%2520%253C%25200.5)%2520%257B%2520%252F%252F%2520Another%2520condition.%250A%2520%2520%2520%2520%252F%252F%2520When%2520calling%2520%2560defaultResolve%2560%252C%2520the%2520arguments%2520can%2520be%2520modified.%2520In%2520this%250A%2520%2520%2520%2520%252F%252F%2520case%2520it's%2520adding%2520another%2520value%2520for%2520matching%2520conditional%2520exports.%250A%2520%2520%2520%2520return%2520defaultResolve(specifier%252C%2520%257B%250A%2520%2520%2520%2520%2520%2520...context%252C%250A%2520%2520%2520%2520%2520%2520conditions%253A%2520%255B...context.conditions%252C%2520'another-condition'%255D%252C%250A%2520%2520%2520%2520%257D)%253B%250A%2520%2520%257D%250A%2520%2520%252F%252F%2520Defer%2520to%2520Node.js%2520for%2520all%2520other%2520specifiers.%250A%2520%2520return%2520defaultResolve(specifier%252C%2520context%252C%2520defaultResolve)%253B%250A%257D

    https://www.typescriptlang.org/play/?useJavaScript=true#code/PQKhCgAIUgBAHAhgJ0QW0gbwM4BdkCWAdgOYC+kArsgDZQwIrpaaQBmA9smorgFyQ8hUpDIUAxhyK4ApgA9c9OElQZMAMUpFxuAlIoATGW0SUauAOIzcAZQ7VxMpbGTXqRbFgAKyDmgLYMgA8rNj2yI4CAIQAFDYAFigyBgCCyKgAngBClGxsMsiQAD6C+MQkxZAAqsS4ABxpmQCUogB8ZPTA4PLwXLiQiNgZ2uxaOnpEkCTWdg4yMdQ0ADSQktLyuCtGJmaWM+GOLZhQq1J4WOxcPP0UALyn6woA3CcEbJAxALK88QB0qEQDH4Yi1WpAAAy-ACsR0gwGAkDsaBkDwMBF0Ul+J0gcIR6i4gj8KIJiBoNGqACUADLYLYcQnI1aUPB+SA0DgkAjiS6FVxlGQAN3KkFw8RRYTmWJxOPhkBSNAA7ogMp4+e4BpMOAAjABWMh0kA471FKM43CwEoiMgEQSE5SKWty+WQ7Sl0rVyEmx2l0stkUgAHJfsGA0tsaIXjiOjKEQARYwFEX0gByHCMvx1njNAzJhpNhSq1Owbo9k22pnMVlsB3mixWa1kCi2xgre2rcyaLzIQA
    https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540warning_level%2520VERBOSE%250A%252F%252F%2520%2540jscomp_error%2520strictCheckTypes%250A%252F%252F%2520%2540language_out%2520ECMASCRIPT_NEXT%250A%252F%252F%2520%2540checks_only%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A%252F**%250A%2520*%2520%2540param%2520%257Bstring%257D%2520url%250A%2520*%2520%2540param%2520%257B%257B%2520format%253A%2520string%2520%257D%257D%2520context%250A%2520*%2520%2540param%2520%257BFunction%257D%2520defaultGetSource%250A%2520*%2520%2540returns%2520%257BPromise%253C%257B%2520source%253A%2520!(SharedArrayBuffer%2520%257C%2520string%2520%257C%2520Uint8Array)%2520%257D%253E%257D%250A%2520*%252F%250Aexport%2520async%2520function%2520getSource(url%252C%2520context%252C%2520defaultGetSource)%2520%257B%250A%2520%2520const%2520%257B%2520format%2520%257D%2520%253D%2520context%253B%250A%2520%2520if%2520(Math.random()%2520%253E%25200.5)%2520%257B%2520%252F%252F%2520Some%2520condition.%250A%2520%2520%2520%2520%252F%252F%2520For%2520some%2520or%2520all%2520URLs%252C%2520do%2520some%2520custom%2520logic%2520for%2520retrieving%2520the%2520source.%250A%2520%2520%2520%2520%252F%252F%2520Always%2520return%2520an%2520object%2520of%2520the%2520form%2520%257Bsource%253A%2520%253Cstring%257Cbuffer%253E%257D.%250A%2520%2520%2520%2520return%2520%257B%250A%2520%2520%2520%2520%2520%2520source%253A%2520'...'%252C%250A%2520%2520%2520%2520%257D%253B%250A%2520%2520%257D%250A%2520%2520%252F%252F%2520Defer%2520to%2520Node.js%2520for%2520all%2520other%2520URLs.%250A%2520%2520return%2520defaultGetSource(url%252C%2520context%252C%2520defaultGetSource)%253B%250A%257D

    https://www.typescriptlang.org/play/?useJavaScript=true#code/PQKhCgAIUgBAHAhgJ0QW0gbwIQAoDKAFigKYAmAgsqgJ4BCArgGZMnKQA+kAzgC7IBLAHYBzTpACqw3gA4qtAJQBfHgHsGyAMYkoMBCnRZMuyKY0AbAFw9+wkQBoTppquRpEva30GjH0SEoqmqpCvCQAHrwm+qgYmABiDEKavAIhKmQkTIgM5rwAKqhC3C5u+OpaOv6wyCS8GsVYAArIqmgC3CQAPJhqGtrWeESklNSI9Mys7FzeduJSoXJjNAoBAHxKusDgEfCuvJCI3DTJkExJKWlCkPyIxaVo5f0kuNwV2vaQwaERvJ+Z2VyBSKJVcj3eJFWxlM3z4WEgFk+Dw8AUgAF4viEwpEANxQSACJiQXAAWQ8hAAdEUyG1cKs1pAAAwUgCsUMgwGAkHKaBImKEZAEqRCFPxpk5kHirjUvMg0sQ5nMkgASgAZbj-VQyvmaBh8NqQcyqEQCTRnaVoVSCpg0Oa8Qh8t7PUWmcVcijmADu424kFq9WQ1zucoARgArEgpOVE+18h5YJ2VaxdWaiDghyZsDYu13+hpYMWuxMDSAAcgpFdLfldSjxpk2bsgABEsmwblqAHJWkgUsO+0qHRVy2PsYskbg5vOByAAnJ5Qp3UFlCGvCGfb7Yv4zrJz4GLh5PSoKPFKIA
    https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540warning_level%2520VERBOSE%250A%252F%252F%2520%2540jscomp_error%2520strictCheckTypes%250A%252F%252F%2520%2540language_out%2520ECMASCRIPT_NEXT%250A%252F%252F%2520%2540checks_only%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A%252F**%250A%2520*%2520%2540param%2520%257B!(SharedArrayBuffer%2520%257C%2520string%2520%257C%2520Uint8Array)%257D%2520source%250A%2520*%2520%2540param%2520%257B%257B%250A%2520*%2520%2520%2520url%253A%2520string%252C%250A%2520*%2520%2520%2520format%253A%2520string%252C%250A%2520*%2520%257D%257D%2520context%250A%2520*%2520%2540param%2520%257BFunction%257D%2520defaultTransformSource%250A%2520*%2520%2540returns%2520%257BPromise%253C%257B%2520source%253A%2520!(SharedArrayBuffer%2520%257C%2520string%2520%257C%2520Uint8Array)%2520%257D%253E%257D%250A%2520*%252F%250Aexport%2520async%2520function%2520transformSource(source%252C%2520context%252C%2520defaultTransformSource)%2520%257B%250A%2520%2520const%2520%257B%2520url%252C%2520format%2520%257D%2520%253D%2520context%253B%250A%2520%2520if%2520(Math.random()%2520%253E%25200.5)%2520%257B%2520%252F%252F%2520Some%2520condition.%250A%2520%2520%2520%2520%252F%252F%2520For%2520some%2520or%2520all%2520URLs%252C%2520do%2520some%2520custom%2520logic%2520for%2520modifying%2520the%2520source.%250A%2520%2520%2520%2520%252F%252F%2520Always%2520return%2520an%2520object%2520of%2520the%2520form%2520%257Bsource%253A%2520%253Cstring%257Cbuffer%253E%257D.%250A%2520%2520%2520%2520return%2520%257B%250A%2520%2520%2520%2520%2520%2520source%253A%2520'...'%252C%250A%2520%2520%2520%2520%257D%253B%250A%2520%2520%257D%250A%2520%2520%252F%252F%2520Defer%2520to%2520Node.js%2520for%2520all%2520other%2520sources.%250A%2520%2520return%2520defaultTransformSource(source%252C%2520context%252C%2520defaultTransformSource)%253B%250A%257D

PR-URL: https://github.com/nodejs/node/pull/33563
Co-authored-by: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2020-06-13 20:48:40 -07:00
..
addons.md doc: remove "currently" from addons.md 2020-06-07 12:36:37 -07:00
assert.md 2020-05-05, Version 14.2.0 (Current) 2020-05-05 20:24:37 +02:00
async_hooks.md doc: add snippet for AsyncResource and EE integration 2020-06-11 12:16:55 +03:00
buffer.md doc: improve buffer.md a tiny bit 2020-05-30 04:28:53 +02:00
child_process.md net: remove long deprecated server.connections property 2020-06-01 08:38:00 -07:00
cli.md lib: unflag AbortController 2020-06-05 12:21:49 -07:00
cluster.md doc: remove default parameter value from header 2020-06-07 11:10:45 -07:00
console.md 2020-05-26, Version 12.17.0 'Erbium' (LTS) 2020-05-26 15:55:39 +02:00
crypto.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
debugger.md doc: update V8 inspector example 2020-06-08 21:31:28 -04:00
deprecations.md doc: fix deprecation "End-of-Life" capitalization 2020-06-02 17:19:42 -04:00
dgram.md doc: fix LTS replaceme tags 2020-04-28 15:23:46 +02:00
dns.md dns: make dns.Resolver timeout configurable 2020-06-01 08:07:59 -07:00
documentation.md doc: add link to sem-ver info 2020-03-02 04:07:33 +00:00
domain.md doc,domain: use code markup/markdown in headers 2019-12-26 21:39:24 -08:00
embedding.md doc: normalize C++ code block info strings 2020-05-23 17:21:20 +02:00
errors.md src: remove unused ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER 2020-06-11 21:46:34 +02:00
esm.md esm: fix loader hooks doc annotations 2020-06-13 20:48:40 -07:00
events.md doc: make events Extends usage consistent 2020-06-08 21:25:25 -04:00
fs.md fs: support util.promisify for fs.readv 2020-05-30 10:17:31 -07:00
globals.md doc: make globals Extends usage consistent 2020-06-08 21:25:26 -04:00
http2.md 2020-06-02, Version 10.21.0 'Dubnium' (LTS) 2020-06-02 20:35:52 +02:00
http.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
https.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
index.md doc: add basic embedding example documentation 2020-03-21 10:58:25 +01:00
inspector.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
intl.md doc: normalize shell code block info strings 2020-05-25 19:12:38 +02:00
modules.md doc: update ``txt `fandamental and ``raw code blocks 2020-05-30 03:43:39 +02:00
n-api.md 2020-05-26, Version 12.17.0 'Erbium' (LTS) 2020-05-26 15:55:39 +02:00
net.md net: remove long deprecated server.connections property 2020-06-01 08:38:00 -07:00
os.md 2020-05-26, Version 12.17.0 'Erbium' (LTS) 2020-05-26 15:55:39 +02:00
path.md doc: fixed a grammatical error in path.md 2020-05-23 17:13:28 +02:00
perf_hooks.md doc: make perf_hooks Extends usage consistent 2020-06-08 21:25:25 -04:00
policy.md doc: normalize Bash code block info strings 2020-05-25 19:08:45 +02:00
process.md doc: outline when origin is set to unhandledRejection 2020-05-30 04:21:21 +02:00
punycode.md doc,punycode: use code markup/markdown in headers 2019-12-26 21:39:30 -08:00
querystring.md doc,querystring: use code markup/markdown in headers 2019-12-26 21:39:30 -08:00
readline.md doc: fix readline key binding documentation 2020-05-20 17:05:01 +02:00
repl.md doc: remove "currently" from repl.md 2020-06-07 12:36:43 -07:00
report.md doc: update ``txt `fandamental and ``raw code blocks 2020-05-30 03:43:39 +02:00
stream.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
string_decoder.md doc: add support encoding link on string_decoder.md 2020-03-11 17:06:13 +01:00
synopsis.md doc: move Usage and Example to same header level 2019-07-09 19:45:20 -07:00
timers.md doc,timers: use code markup/markdown in headers 2019-12-26 21:39:32 -08:00
tls.md doc: use single quotes in --tls-cipher-list 2020-06-11 09:54:15 +02:00
tracing.md doc: update ``txt `fandamental and ``raw code blocks 2020-05-30 03:43:39 +02:00
tty.md doc: normalize Bash code block info strings 2020-05-25 19:08:45 +02:00
url.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
util.md util: restrict custom inspect function + vm.Context interaction 2020-06-11 21:44:34 +02:00
v8.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
vm.md doc: standardize constructor doc header layout 2020-06-10 05:31:21 -07:00
wasi.md wasi: allow WASI stdio to be configured 2020-05-30 04:28:02 +02:00
worker_threads.md 2020-05-26, Version 12.17.0 'Erbium' (LTS) 2020-05-26 15:55:39 +02:00
zlib.md zlib: add maxOutputLength option 2020-06-09 17:26:10 +02:00