Skip to content

Commit 1c660aa

Browse files
committed
fix code blocks per linter
1 parent b9a97ab commit 1c660aa

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

doc/api/module.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ either:
340340
341341
Loader code:
342342
343-
```js
343+
```mjs
344344
// In the below example this file is referenced as
345345
// '/path-to-my-loader.js'
346346

@@ -352,7 +352,7 @@ export async function initialize({ number, port }) {
352352
353353
Caller code:
354354
355-
```js
355+
```mjs
356356
import assert from 'node:assert';
357357
import { register } from 'node:module';
358358
import { MessageChannel } from 'node:worker_threads';
@@ -444,7 +444,7 @@ Node.js module specifier resolution behavior_ when calling `defaultResolve`, the
444444
`context.conditions` array passed to it _must_ include _all_ elements of the
445445
`context.conditions` array originally passed into the `resolve` hook.
446446
447-
```js
447+
```mjs
448448
export function resolve(specifier, context, nextResolve) {
449449
const { parentURL = null } = context;
450450

@@ -544,7 +544,7 @@ loader in the `load` chain, returns `null` for `source` when `format` is
544544
`'commonjs'` for backward compatibility. Here is an example loader that would
545545
opt-in to using the non-default behavior:
546546
547-
```js
547+
```mjs
548548
import { readFile } from 'node:fs/promises';
549549

550550
export async function load(url, context, nextLoad) {
@@ -573,7 +573,7 @@ source code of an ES module specifier. This would allow a loader to potentially
573573
avoid reading files from disk. It could also be used to map an unrecognized
574574
format to a supported one, for example `yaml` to `module`.
575575
576-
```js
576+
```mjs
577577
export async function load(url, context, nextLoad) {
578578
const { format } = context;
579579

@@ -632,7 +632,7 @@ builtins like "fs": `getBuiltin(request: string)`.
632632
If the code needs more advanced `require` features, it has to construct
633633
its own `require` using `module.createRequire()`.
634634
635-
```js
635+
```mjs
636636
export function globalPreload(context) {
637637
return `\
638638
globalThis.someInjectedProperty = 42;
@@ -654,7 +654,7 @@ Some care must be taken in order to properly call [`port.ref()`][] and
654654
[`port.unref()`][] to prevent a process from being in a state where it won't
655655
close normally.
656656
657-
```js
657+
```mjs
658658
/**
659659
* This example has the application context send a message to the loader
660660
* and sends the message back to the application context
@@ -688,7 +688,7 @@ functionality, there are substantial downsides to actually using this loader:
688688
performance is much slower than loading files from disk, there is no caching,
689689
and there is no security.
690690

691-
```js
691+
```mjs
692692
// https-loader.mjs
693693
import { get } from 'node:https';
694694
@@ -717,7 +717,7 @@ export function load(url, context, nextLoad) {
717717
}
718718
```
719719

720-
```js
720+
```mjs
721721
// main.mjs
722722
import { VERSION } from 'https://coffeescript.org/browser-compiler-modern/coffeescript.js';
723723
@@ -738,7 +738,7 @@ This is less performant than transpiling source files before running
738738
Node.js; a transpiler loader should only be used for development and testing
739739
purposes.
740740
741-
```js
741+
```mjs
742742
// coffeescript-loader.mjs
743743
import { readFile } from 'node:fs/promises';
744744
import { dirname, extname, resolve as resolvePath } from 'node:path';
@@ -848,7 +848,7 @@ that does its work via the `resolve` hook. This loader reads an
848848
URL (this is a very simplistic implemenation of a small subset of the
849849
"import maps" specification).
850850
851-
```js
851+
```mjs
852852
// import-map-loader.js
853853
import fs from 'node:fs/promises';
854854

@@ -865,7 +865,7 @@ export async function resolve(specifier, context, nextResolve) {
865865
866866
Let's assume we have these files:
867867
868-
```js
868+
```mjs
869869
// main.js
870870
import 'a-module';
871871
```
@@ -879,7 +879,7 @@ import 'a-module';
879879
}
880880
```
881881
882-
```js
882+
```mjs
883883
// some-module.js
884884
console.log('some module!');
885885
```

0 commit comments

Comments
 (0)