load-plugin 6.0.3 → 6.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type LoadOptions = import('./lib/index.js').LoadOptions;
2
- export type ResolveOptions = import('./lib/index.js').ResolveOptions;
1
+ export type LoadOptions = import("./lib/index.js").LoadOptions;
2
+ export type ResolveOptions = import("./lib/index.js").ResolveOptions;
3
3
  export { loadPlugin, resolvePlugin } from "./lib/index.js";
4
4
  //# sourceMappingURL=index.d.ts.map
package/lib/index.d.ts CHANGED
@@ -1,14 +1,7 @@
1
1
  /**
2
- * Import `name` from `from` (and optionally the global `node_modules` directory).
2
+ * Import `name` from `from` (and optionally the global `node_modules` folder).
3
3
  *
4
- * Uses the Node.js resolution algorithm (through `import-meta-resolve`) to
5
- * resolve CJS and ESM packages and files.
6
- *
7
- * If a `prefix` is given and `name` is not a path,
8
- * `$prefix-$name` is also searched (preferring these over non-prefixed
9
- * modules).
10
- * If `name` starts with a scope (`@scope/name`),
11
- * the prefix is applied after it: `@scope/$prefix-name`.
4
+ * See Algorithm in the readme for how `name` is resolved.
12
5
  *
13
6
  * @param {string} name
14
7
  * Specifier.
@@ -19,7 +12,10 @@
19
12
  */
20
13
  export function loadPlugin(name: string, options?: Readonly<LoadOptions> | null | undefined): Promise<unknown>;
21
14
  /**
22
- * Resolve `name` from `from`.
15
+ * Resolve `name` from `from` (and optionally the global `node_modules`
16
+ * folder).
17
+ *
18
+ * See Algorithm in the readme for how `name` is resolved.
23
19
  *
24
20
  * @param {string} name
25
21
  * Specifier.
@@ -31,6 +27,8 @@ export function loadPlugin(name: string, options?: Readonly<LoadOptions> | null
31
27
  export function resolvePlugin(name: string, options?: Readonly<ResolveOptions> | null | undefined): Promise<string>;
32
28
  /**
33
29
  * Configuration for `loadPlugin`.
30
+ *
31
+ * Includes the fields of `ResolveOptions`.
34
32
  */
35
33
  export type LoadOptions = LoadOptionsExtraFields & ResolveOptions;
36
34
  /**
@@ -40,10 +38,11 @@ export type LoadOptionsExtraFields = {
40
38
  /**
41
39
  * Identifier to take from the exports (default: `'default'`);
42
40
  * for example when given `'x'`,
43
- * the value of `export const x = 1` will be returned;
41
+ * the value of `export const x = 1` is returned;
44
42
  * when given `'default'`,
45
- * the value of `export default …` is used,
46
- * and when `false` the whole module object is returned.
43
+ * the value of `export default …` is returned;
44
+ * when `false`,
45
+ * the whole module object is returned.
47
46
  */
48
47
  key?: boolean | string | null | undefined;
49
48
  };
@@ -57,17 +56,15 @@ export type ResolveOptions = {
57
56
  */
58
57
  from?: ReadonlyArray<Readonly<URL> | string> | Readonly<URL> | string | null | undefined;
59
58
  /**
60
- * Whether to look for `name` in global places (default: whether global is
59
+ * Whether to also search global `node_modules` (default: whether global is
61
60
  * detected);
62
- * if this is nullish,
63
- * `load-plugin` will detect if it’s currently running in global mode: either
64
- * because it’s in Electron or because a globally installed package is
65
- * running it;
66
- * note that Electron runs its own version of Node instead of your system
67
- * Node,
68
- * meaning global packages cannot be found,
69
- * unless you’ve set-up a `prefix` in your `.npmrc` or are using nvm to
70
- * manage your system node.
61
+ * when nullish,
62
+ * global mode is detected:
63
+ * it is on when running in Electron or from a globally installed package;
64
+ * note that Electron runs its own Node instead of your system Node,
65
+ * so global packages cannot be found,
66
+ * unless you set a `prefix` in your `.npmrc` or use nvm to manage your
67
+ * system Node.
71
68
  */
72
69
  global?: boolean | null | undefined;
73
70
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA4DA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iCAPW,MAAM,YAEN,SAAS,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAEtC,QAAQ,OAAO,CAAC,CAY5B;AAED;;;;;;;;;GASG;AACH,oCAPW,MAAM,YAEN,SAAS,cAAc,CAAC,GAAG,IAAI,GAAG,SAAS,GAEzC,QAAQ,MAAM,CAAC,CA8F3B;;;;0BA9LY,sBAAsB,GAAG,cAAc;;;;;;;;;;;;;UAKtC,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;WAUnC,cAAc,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;aAGjF,OAAO,GAAG,IAAI,GAAG,SAAS;;;;aAY1B,MAAM,GAAG,IAAI,GAAG,SAAS"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAiEA;;;;;;;;;;;GAWG;AACH,iCAPW,MAAM,YAEN,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAEtC,OAAO,CAAC,OAAO,CAAC,CAY5B;AAED;;;;;;;;;;;;GAYG;AACH,oCAPW,MAAM,YAEN,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,GAAG,SAAS,GAEzC,OAAO,CAAC,MAAM,CAAC,CA8F3B;;;;;;0BA/LY,sBAAsB,GAAG,cAAc;;;;;;;;;;;;;;UAStC,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;WAanC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;aAGjF,OAAO,GAAG,IAAI,GAAG,SAAS;;;;aAU1B,MAAM,GAAG,IAAI,GAAG,SAAS"}
package/lib/index.js CHANGED
@@ -2,33 +2,38 @@
2
2
  * @typedef {LoadOptionsExtraFields & ResolveOptions} LoadOptions
3
3
  * Configuration for `loadPlugin`.
4
4
  *
5
+ * Includes the fields of `ResolveOptions`.
6
+ */
7
+
8
+ /**
5
9
  * @typedef LoadOptionsExtraFields
6
10
  * Extra configuration for `loadPlugin`.
7
- * @property {boolean | string | null | undefined} [key]
11
+ * @property {boolean | string | null | undefined} [key='default']
8
12
  * Identifier to take from the exports (default: `'default'`);
9
13
  * for example when given `'x'`,
10
- * the value of `export const x = 1` will be returned;
14
+ * the value of `export const x = 1` is returned;
11
15
  * when given `'default'`,
12
- * the value of `export default …` is used,
13
- * and when `false` the whole module object is returned.
14
- *
16
+ * the value of `export default …` is returned;
17
+ * when `false`,
18
+ * the whole module object is returned.
19
+ */
20
+
21
+ /**
15
22
  * @typedef ResolveOptions
16
23
  * Configuration for `resolvePlugin`.
17
24
  * @property {ReadonlyArray<Readonly<URL> | string> | Readonly<URL> | string | null | undefined} [from]
18
25
  * Place or places to search from (optional);
19
26
  * defaults to the current working directory.
20
- * @property {boolean | null | undefined} [global=boolean]
21
- * Whether to look for `name` in global places (default: whether global is
27
+ * @property {boolean | null | undefined} [global]
28
+ * Whether to also search global `node_modules` (default: whether global is
22
29
  * detected);
23
- * if this is nullish,
24
- * `load-plugin` will detect if it’s currently running in global mode: either
25
- * because it’s in Electron or because a globally installed package is
26
- * running it;
27
- * note that Electron runs its own version of Node instead of your system
28
- * Node,
29
- * meaning global packages cannot be found,
30
- * unless you’ve set-up a `prefix` in your `.npmrc` or are using nvm to
31
- * manage your system node.
30
+ * when nullish,
31
+ * global mode is detected:
32
+ * it is on when running in Electron or from a globally installed package;
33
+ * note that Electron runs its own Node instead of your system Node,
34
+ * so global packages cannot be found,
35
+ * unless you set a `prefix` in your `.npmrc` or use nvm to manage your
36
+ * system Node.
32
37
  * @property {string | null | undefined} [prefix]
33
38
  * Prefix to search for (optional).
34
39
  */
@@ -59,16 +64,9 @@ const defaultResolveOptions = {}
59
64
  let npmPrefix
60
65
 
61
66
  /**
62
- * Import `name` from `from` (and optionally the global `node_modules` directory).
63
- *
64
- * Uses the Node.js resolution algorithm (through `import-meta-resolve`) to
65
- * resolve CJS and ESM packages and files.
67
+ * Import `name` from `from` (and optionally the global `node_modules` folder).
66
68
  *
67
- * If a `prefix` is given and `name` is not a path,
68
- * `$prefix-$name` is also searched (preferring these over non-prefixed
69
- * modules).
70
- * If `name` starts with a scope (`@scope/name`),
71
- * the prefix is applied after it: `@scope/$prefix-name`.
69
+ * See Algorithm in the readme for how `name` is resolved.
72
70
  *
73
71
  * @param {string} name
74
72
  * Specifier.
@@ -89,7 +87,10 @@ export async function loadPlugin(name, options) {
89
87
  }
90
88
 
91
89
  /**
92
- * Resolve `name` from `from`.
90
+ * Resolve `name` from `from` (and optionally the global `node_modules`
91
+ * folder).
92
+ *
93
+ * See Algorithm in the readme for how `name` is resolved.
93
94
  *
94
95
  * @param {string} name
95
96
  * Specifier.
@@ -142,10 +143,10 @@ export async function resolvePlugin(name, options) {
142
143
  }
143
144
  }
144
145
 
145
- let scope = ''
146
-
147
146
  // Unprefix module.
148
147
  if (prefix) {
148
+ let scope = ''
149
+
149
150
  // Scope?
150
151
  if (name.charAt(0) === '@') {
151
152
  const slash = name.indexOf('/')
@@ -195,11 +196,14 @@ export async function resolvePlugin(name, options) {
195
196
  * Find npm prefix.
196
197
  *
197
198
  * @returns {Promise<string>}
199
+ * Folder where npm installs global packages.
198
200
  */
199
201
  async function inferNpmPrefix() {
200
202
  const config = new NpmConfig({
201
203
  argv: [],
202
204
  definitions,
205
+ // `env` is mutated.
206
+ env: {...process.env},
203
207
  npmPath: ''
204
208
  })
205
209
 
package/license CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
3
+ Copyright (c) Titus Wormer <tituswormer@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,61 +1,49 @@
1
1
  {
2
- "name": "load-plugin",
3
- "version": "6.0.3",
4
- "description": "Load a submodule, plugin, or file",
5
- "license": "MIT",
6
- "keywords": [
7
- "load",
8
- "package",
9
- "plugin",
10
- "submodule"
11
- ],
12
- "repository": "wooorm/load-plugin",
13
- "bugs": "https://github.com/wooorm/load-plugin/issues",
14
- "funding": {
15
- "type": "github",
16
- "url": "https://github.com/sponsors/wooorm"
17
- },
18
2
  "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
3
+ "bugs": "https://github.com/wooorm/load-plugin/issues",
19
4
  "contributors": [
20
5
  "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
21
6
  ],
22
- "sideEffects": false,
23
- "type": "module",
24
- "exports": "./index.js",
25
- "files": [
26
- "lib/",
27
- "index.d.ts.map",
28
- "index.d.ts",
29
- "index.js"
30
- ],
31
7
  "dependencies": {
32
8
  "@npmcli/config": "^8.0.0",
33
9
  "import-meta-resolve": "^4.0.0"
34
10
  },
11
+ "description": "Load a submodule, plugin, or file",
35
12
  "devDependencies": {
36
- "@types/node": "^20.0.0",
37
- "c8": "^9.0.0",
13
+ "@types/node": "^26.0.0",
14
+ "c8": "^12.0.0",
38
15
  "github-slugger": "^2.0.0",
39
16
  "prettier": "^3.0.0",
40
17
  "remark-cli": "^12.0.0",
41
18
  "remark-lint": "^10.0.0",
42
- "remark-preset-wooorm": "^10.0.0",
19
+ "remark-preset-wooorm": "^11.0.0",
43
20
  "type-coverage": "^2.0.0",
44
- "typescript": "^5.0.0",
45
- "xo": "^0.58.0"
21
+ "typescript": "^6.0.0",
22
+ "xo": "^5.0.0"
46
23
  },
47
- "scripts": {
48
- "build": "tsc --build --clean && tsc --build && type-coverage",
49
- "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix",
50
- "prepack": "npm run build && npm run format",
51
- "test": "npm run build && npm run format && npm run test-coverage",
52
- "test-api": "node --conditions development test/index.js",
53
- "test-coverage": "c8 --100 --reporter lcov npm run test-api"
24
+ "exports": "./index.js",
25
+ "files": [
26
+ "lib/",
27
+ "index.d.ts.map",
28
+ "index.d.ts",
29
+ "index.js"
30
+ ],
31
+ "funding": {
32
+ "type": "github",
33
+ "url": "https://github.com/sponsors/wooorm"
54
34
  },
35
+ "keywords": [
36
+ "load",
37
+ "package",
38
+ "plugin",
39
+ "submodule"
40
+ ],
41
+ "license": "MIT",
42
+ "name": "load-plugin",
55
43
  "prettier": {
56
44
  "bracketSpacing": false,
57
- "singleQuote": true,
58
45
  "semi": false,
46
+ "singleQuote": true,
59
47
  "tabWidth": 2,
60
48
  "trailingComma": "none",
61
49
  "useTabs": false
@@ -65,17 +53,20 @@
65
53
  "remark-preset-wooorm"
66
54
  ]
67
55
  },
56
+ "repository": "wooorm/load-plugin",
57
+ "scripts": {
58
+ "build": "tsc --build --clean && tsc --build && type-coverage",
59
+ "format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix",
60
+ "prepack": "npm run build && npm run format",
61
+ "test-api": "node --conditions development test/index.js",
62
+ "test-coverage": "c8 --100 --reporter lcov -- npm run test-api",
63
+ "test": "npm run build && npm run format && npm run test-coverage"
64
+ },
65
+ "sideEffects": false,
68
66
  "typeCoverage": {
69
67
  "atLeast": 100,
70
- "detail": true,
71
- "ignoreCatch": true,
72
68
  "strict": true
73
69
  },
74
- "xo": {
75
- "prettier": true,
76
- "rules": {
77
- "complexity": "off",
78
- "logical-assignment-operators": "off"
79
- }
80
- }
70
+ "type": "module",
71
+ "version": "6.0.4"
81
72
  }
package/readme.md CHANGED
@@ -9,40 +9,43 @@ Load a submodule, plugin, or file.
9
9
  ## Contents
10
10
 
11
11
  * [What is this?](#what-is-this)
12
- * [When to use this?](#when-to-use-this)
12
+ * [When should I use this?](#when-should-i-use-this)
13
13
  * [Install](#install)
14
14
  * [Use](#use)
15
15
  * [API](#api)
16
- * [`loadPlugin(name[, options])`](#loadpluginname-options)
17
- * [`resolvePlugin(name[, options])`](#resolvepluginname-options)
18
16
  * [`LoadOptions`](#loadoptions)
19
17
  * [`ResolveOptions`](#resolveoptions)
18
+ * [`loadPlugin(name[, options])`](#loadpluginname-options)
19
+ * [`resolvePlugin(name[, options])`](#resolvepluginname-options)
20
+ * [Algorithm](#algorithm)
20
21
  * [Compatibility](#compatibility)
21
22
  * [Security](#security)
23
+ * [Related](#related)
22
24
  * [Contribute](#contribute)
23
25
  * [License](#license)
24
26
 
25
27
  ## What is this?
26
28
 
27
29
  This package is useful when you want to load plugins.
28
- It resolves things like Node.js does,
29
- but supports a prefix (when given a prefix `remark` and the user provided value
30
- `gfm` it can find `remark-gfm`),
31
- can load from several places,
32
- and optionally global too.
30
+ It resolves and imports modules like Node.js does with some extras.
31
+ For example,
32
+ it can add a prefix to names
33
+ (when given a prefix `remark` and the user-provided value `gfm`,
34
+ it finds `remark-gfm`),
35
+ search from several places,
36
+ and search global `node_modules` folders.
33
37
 
34
- ## When to use this?
38
+ ## When should I use this?
35
39
 
36
- This package is particularly useful when you want users to configure something
37
- with plugins.
38
- One example is `remark-cli` which can load remark plugins from configuration
39
- files.
40
+ You can use this when users configure your tool with plugins.
41
+ For example,
42
+ `remark-cli` uses it to load remark plugins named in configuration files.
40
43
 
41
44
  ## Install
42
45
 
43
46
  This package is [ESM only][github-gist-esm].
44
47
  In Node.js (version 16+),
45
- install with [npm][npm-install]:
48
+ install with [npm][npmjs-install]:
46
49
 
47
50
  ```sh
48
51
  npm install load-plugin
@@ -73,29 +76,61 @@ console.log(await loadPlugin('lint', {prefix: 'remark'}))
73
76
  ## API
74
77
 
75
78
  This package exports the identifiers
76
- [`loadPlugin`][api-load-plugin] and [`resolvePlugin`][api-resolve-plugin].
79
+ [`loadPlugin`][api-load-plugin] and
80
+ [`resolvePlugin`][api-resolve-plugin].
77
81
  There is no default export.
82
+ It exports the additional [TypeScript][] types
83
+ [`LoadOptions`][api-load-options] and
84
+ [`ResolveOptions`][api-resolve-options].
78
85
 
79
- It exports the [TypeScript][] types
80
- [`LoadOptions`][api-load-options] and [`ResolveOptions`][api-resolve-options].
86
+ ### `LoadOptions`
81
87
 
82
- ### `loadPlugin(name[, options])`
88
+ Configuration for [`loadPlugin`][api-load-plugin] (TypeScript type).
89
+
90
+ Includes the fields of [`ResolveOptions`][api-resolve-options].
91
+
92
+ ###### Fields
93
+
94
+ * `key` (`boolean` or `string`, default: `'default'`)
95
+ — identifier to take from the exports;
96
+ for example when given `'x'`,
97
+ the value of `export const x = 1` is returned;
98
+ when given `'default'`,
99
+ the value of `export default …` is returned;
100
+ when `false`,
101
+ the whole module object is returned
83
102
 
84
- Import `name` from `from` (and optionally the global `node_modules` directory).
103
+ ### `ResolveOptions`
104
+
105
+ Configuration for [`resolvePlugin`][api-resolve-plugin] (TypeScript type).
106
+
107
+ ###### Fields
108
+
109
+ * `from` (`Array<URL | string> | URL | string`, optional)
110
+ — place or places to search from;
111
+ defaults to the current working directory
112
+ * `global` (`boolean`, default: whether global is detected)
113
+ — whether to also search [global `node_modules`][npmjs-node-modules];
114
+ when nullish,
115
+ global mode is detected:
116
+ it is on when running in Electron or from a globally installed package;
117
+ note that Electron runs its own Node instead of your system Node,
118
+ so global packages cannot be found,
119
+ unless you set a [`prefix`][npmjs-prefix] in your `.npmrc` or use
120
+ [nvm][github-nvm] to manage your system Node
121
+ * `prefix` (`string`, optional)
122
+ — prefix to search for
85
123
 
86
- Uses the Node.js [resolution algorithm][nodejs-resolution-algo] (through
87
- [`import-meta-resolve`][github-import-meta-resolve]) to resolve CJS and ESM
88
- packages and files.
124
+ ### `loadPlugin(name[, options])`
125
+
126
+ Import `name` from `from` (and optionally the global `node_modules`
127
+ folder).
89
128
 
90
- If a `prefix` is given and `name` is not a path,
91
- `$prefix-$name` is also searched (preferring these over non-prefixed
92
- modules).
93
- If `name` starts with a scope (`@scope/name`),
94
- the prefix is applied after it: `@scope/$prefix-name`.
129
+ See [Algorithm][] for how `name` is resolved.
95
130
 
96
131
  ###### Parameters
97
132
 
98
- * `name` (`string`)
133
+ * `name` (`string`, required)
99
134
  — specifier
100
135
  * `options` ([`LoadOptions`][api-load-options], optional)
101
136
  — configuration
@@ -106,11 +141,14 @@ Promise to a whole module or specific export (`Promise<unknown>`).
106
141
 
107
142
  ### `resolvePlugin(name[, options])`
108
143
 
109
- Resolve `name` from `from`.
144
+ Resolve `name` from `from` (and optionally the global `node_modules`
145
+ folder).
146
+
147
+ See [Algorithm][] for how `name` is resolved.
110
148
 
111
149
  ###### Parameters
112
150
 
113
- * `name` (`string`)
151
+ * `name` (`string`, required)
114
152
  — specifier
115
153
  * `options` ([`ResolveOptions`][api-resolve-options], optional)
116
154
  — configuration
@@ -119,47 +157,26 @@ Resolve `name` from `from`.
119
157
 
120
158
  Promise to a file URL (`Promise<string>`).
121
159
 
122
- ### `LoadOptions`
123
-
124
- Configuration for `loadPlugin` (TypeScript type).
125
-
126
- This type extends `ResolveOptions` and adds:
127
-
128
- ###### Fields
129
-
130
- * `key` (`boolean` or `string`, default: `'default'`)
131
- — identifier to take from the exports;
132
- for example when given `'x'`,
133
- the value of `export const x = 1` will be returned;
134
- when given `'default'`,
135
- the value of `export default …` is used,
136
- and when `false` the whole module object is returned
160
+ ## Algorithm
137
161
 
138
- ### `ResolveOptions`
162
+ Names are resolved with the Node.js
163
+ [resolution algorithm][nodejs-esm-resolution]
164
+ (through [`import-meta-resolve`][github-import-meta-resolve])
165
+ to CJS and ESM packages and files.
166
+ Each place in `from` is tried in order.
167
+ When `global` is on and `name` is not a path,
168
+ the global `node_modules` folder is tried last.
139
169
 
140
- Configuration for `resolvePlugin` (TypeScript type).
141
-
142
- ###### Fields
143
-
144
- * `from` (`Array<URL | string> | URL | string`, optional)
145
- — place or places to search from;
146
- defaults to the current working directory
147
- * `global` (`boolean`, default: whether global is detected)
148
- — whether to look for `name` in [global places][npm-node-modules];
149
- if this is nullish,
150
- `load-plugin` will detect if it’s currently running in global mode: either
151
- because it’s in Electron or because a globally installed package is running
152
- it;
153
- note that Electron runs its own version of Node instead of your system Node,
154
- meaning global packages cannot be found,
155
- unless you’ve set-up a [`prefix`][npm-prefix] in your `.npmrc` or are using
156
- [nvm][github-nvm] to manage your system node
157
- * `prefix` (`string`, optional)
158
- — prefix to search for
170
+ When a `prefix` is given and `name` is not a path,
171
+ `$prefix-$name` is also searched,
172
+ and preferred over `name` in each place.
173
+ When `name` starts with a scope (`@scope/name`),
174
+ the prefix is added after it: `@scope/$prefix-name`.
175
+ A `name` that already starts with the prefix is not prefixed again.
159
176
 
160
177
  ## Compatibility
161
178
 
162
- This projects is compatible with maintained versions of Node.js.
179
+ This package is compatible with maintained versions of Node.js.
163
180
 
164
181
  When we cut a new major release,
165
182
  we drop support for unmaintained versions of Node.
@@ -169,12 +186,18 @@ compatible with Node.js 16.
169
186
 
170
187
  ## Security
171
188
 
172
- This package reads the file system and imports things into Node.js.
189
+ This package reads the file system and imports modules,
190
+ which runs that code.
191
+
192
+ ## Related
193
+
194
+ * [`wooorm/import-meta-resolve`][github-import-meta-resolve]
195
+ — resolve things like Node.js does
173
196
 
174
197
  ## Contribute
175
198
 
176
199
  Yes please!
177
- See [How to Contribute to Open Source][open-source-guide-contribute].
200
+ See [How to Contribute to Open Source][opensource-guide-contribute].
178
201
 
179
202
  ## License
180
203
 
@@ -182,14 +205,16 @@ See [How to Contribute to Open Source][open-source-guide-contribute].
182
205
 
183
206
  <!-- Definitions -->
184
207
 
185
- [api-load-plugin]: #loadpluginname-options
208
+ [algorithm]: #algorithm
186
209
 
187
210
  [api-load-options]: #loadoptions
188
211
 
189
- [api-resolve-plugin]: #resolvepluginname-options
212
+ [api-load-plugin]: #loadpluginname-options
190
213
 
191
214
  [api-resolve-options]: #resolveoptions
192
215
 
216
+ [api-resolve-plugin]: #resolvepluginname-options
217
+
193
218
  [badge-build-image]: https://github.com/wooorm/load-plugin/workflows/main/badge.svg
194
219
 
195
220
  [badge-build-url]: https://github.com/wooorm/load-plugin/actions
@@ -210,15 +235,15 @@ See [How to Contribute to Open Source][open-source-guide-contribute].
210
235
 
211
236
  [github-nvm]: https://github.com/nvm-sh/nvm
212
237
 
213
- [nodejs-resolution-algo]: https://nodejs.org/api/esm.html#esm_resolution_algorithm
238
+ [nodejs-esm-resolution]: https://nodejs.org/api/esm.html#esm_resolution_algorithm
214
239
 
215
- [npm-install]: https://docs.npmjs.com/cli/install
240
+ [npmjs-install]: https://docs.npmjs.com/cli/install
216
241
 
217
- [npm-node-modules]: https://docs.npmjs.com/cli/v10/configuring-npm/folders#node-modules
242
+ [npmjs-node-modules]: https://docs.npmjs.com/cli/configuring-npm/folders#node-modules
218
243
 
219
- [npm-prefix]: https://docs.npmjs.com/cli/v10/using-npm/config
244
+ [npmjs-prefix]: https://docs.npmjs.com/cli/using-npm/config
220
245
 
221
- [open-source-guide-contribute]: https://opensource.guide/how-to-contribute/
246
+ [opensource-guide-contribute]: https://opensource.guide/how-to-contribute/
222
247
 
223
248
  [typescript]: https://www.typescriptlang.org
224
249