Skip to content

Commit 3d2ad26

Browse files
committed
Update dev-dependencies
1 parent 2514cb5 commit 3d2ad26

File tree

7 files changed

+79
-58
lines changed

7 files changed

+79
-58
lines changed

lib/errors.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
// Last checked on: Apr 29, 2024.
1919
import v8 from 'node:v8'
2020
import assert from 'node:assert'
21-
// Needed for types.
22-
// eslint-disable-next-line no-unused-vars
23-
import {URL} from 'node:url'
2421
import {format, inspect} from 'node:util'
2522

2623
const own = {}.hasOwnProperty
@@ -73,7 +70,7 @@ codes.ERR_INVALID_ARG_TYPE = createError(
7370
* @param {unknown} actual
7471
*/
7572
(name, expected, actual) => {
76-
assert(typeof name === 'string', "'name' must be a string")
73+
assert.ok(typeof name === 'string', "'name' must be a string")
7774
if (!Array.isArray(expected)) {
7875
expected = [expected]
7976
}
@@ -97,15 +94,15 @@ codes.ERR_INVALID_ARG_TYPE = createError(
9794
const other = []
9895

9996
for (const value of expected) {
100-
assert(
97+
assert.ok(
10198
typeof value === 'string',
10299
'All expected entries have to be of type string'
103100
)
104101

105102
if (kTypes.has(value)) {
106103
types.push(value.toLowerCase())
107104
} else if (classRegExp.exec(value) === null) {
108-
assert(
105+
assert.ok(
109106
value !== 'object',
110107
'The value "object" should be written as "Object"'
111108
)
@@ -200,7 +197,7 @@ codes.ERR_INVALID_PACKAGE_TARGET = createError(
200197
target.length > 0 &&
201198
!target.startsWith('./')
202199
if (key === '.') {
203-
assert(isImport === false)
200+
assert.ok(isImport === false)
204201
return (
205202
`Invalid "exports" main target ${JSON.stringify(target)} defined ` +
206203
`in the package config ${packagePath}package.json${
@@ -450,10 +447,10 @@ const captureLargerStackTrace = hideStackFrames(
450447
*/
451448
function getMessage(key, parameters, self) {
452449
const message = messages.get(key)
453-
assert(message !== undefined, 'expected `message` to be found')
450+
assert.ok(message !== undefined, 'expected `message` to be found')
454451

455452
if (typeof message === 'function') {
456-
assert(
453+
assert.ok(
457454
message.length <= parameters.length, // Default options do not count.
458455
`Code: ${key}; The provided arguments length (${parameters.length}) does not ` +
459456
`match the required ones (${message.length}).`
@@ -464,7 +461,7 @@ function getMessage(key, parameters, self) {
464461
const regex = /%[dfijoOs]/g
465462
let expectedLength = 0
466463
while (regex.exec(message) !== null) expectedLength++
467-
assert(
464+
assert.ok(
468465
expectedLength === parameters.length,
469466
`Code: ${key}; The provided arguments length (${parameters.length}) does not ` +
470467
`match the required ones (${expectedLength}).`

lib/resolve.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import assert from 'node:assert'
1212
import {statSync, realpathSync} from 'node:fs'
1313
import process from 'node:process'
14-
import {URL, fileURLToPath, pathToFileURL} from 'node:url'
14+
import {fileURLToPath, pathToFileURL} from 'node:url'
1515
import path from 'node:path'
1616
import {builtinModules} from 'node:module'
1717
import {defaultGetFormatWithoutErrors} from './get-format.js'
@@ -1084,6 +1084,7 @@ export function moduleResolve(specifier, base, conditions, preserveSymlinks) {
10841084
if (conditions === undefined) {
10851085
conditions = getConditionsSet()
10861086
}
1087+
10871088
const protocol = base.protocol
10881089
const isData = protocol === 'data:'
10891090
const isRemote = isData || protocol === 'http:' || protocol === 'https:'
@@ -1117,7 +1118,7 @@ export function moduleResolve(specifier, base, conditions, preserveSymlinks) {
11171118
}
11181119
}
11191120

1120-
assert(resolved !== undefined, 'expected to be defined')
1121+
assert.ok(resolved !== undefined, 'expected to be defined')
11211122

11221123
if (resolved.protocol !== 'file:') {
11231124
return resolved
@@ -1231,7 +1232,7 @@ function throwIfInvalidParentURL(parentURL) {
12311232
*/
12321233
export function defaultResolve(specifier, context = {}) {
12331234
const {parentURL} = context
1234-
assert(parentURL !== undefined, 'expected `parentURL` to be defined')
1235+
assert.ok(parentURL !== undefined, 'expected `parentURL` to be defined')
12351236
throwIfInvalidParentURL(parentURL)
12361237

12371238
/** @type {URL | undefined} */

package.json

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
"index.js"
3030
],
3131
"devDependencies": {
32-
"@types/node": "^20.0.0",
32+
"@types/node": "^24.0.0",
3333
"@types/semver": "^7.0.0",
34-
"c8": "^9.0.0",
34+
"c8": "^10.0.0",
3535
"f-ck": "^2.0.0",
3636
"prettier": "^3.0.0",
3737
"remark-cli": "^12.0.0",
38-
"remark-preset-wooorm": "^10.0.0",
38+
"remark-preset-wooorm": "^11.0.0",
3939
"semver": "^7.0.0",
4040
"type-coverage": "^2.0.0",
4141
"typescript": "^5.0.0",
42-
"xo": "^0.58.0"
42+
"xo": "^1.0.0"
4343
},
4444
"scripts": {
4545
"prepack": "npm run generate && npm run build && npm run format",
@@ -58,22 +58,6 @@
5858
"semi": false,
5959
"trailingComma": "none"
6060
},
61-
"xo": {
62-
"prettier": true,
63-
"rules": {
64-
"complexity": "off",
65-
"max-depth": "off",
66-
"max-params": "off",
67-
"no-constant-condition": "off",
68-
"no-new": "off",
69-
"prefer-arrow-callback": "off",
70-
"unicorn/prefer-at": "off",
71-
"unicorn/prefer-string-replace-all": "off"
72-
},
73-
"ignore": [
74-
"test/node_modules/"
75-
]
76-
},
7761
"remarkConfig": {
7862
"plugins": [
7963
"preset-wooorm",

readme.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,36 +217,36 @@ See [How to Contribute to Open Source][contribute].
217217
218218
<!-- Definitions -->
219219
220-
[build-badge]: https://github.com/wooorm/import-meta-resolve/workflows/main/badge.svg
220+
[algo]: https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_resolver_algorithm
221+
222+
[author]: https://wooorm.com
221223
222224
[build]: https://github.com/wooorm/import-meta-resolve/actions
223225
224-
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/import-meta-resolve.svg
226+
[build-badge]: https://github.com/wooorm/import-meta-resolve/workflows/main/badge.svg
227+
228+
[contribute]: https://opensource.guide/how-to-contribute/
225229
226230
[coverage]: https://codecov.io/github/wooorm/import-meta-resolve
227231
228-
[downloads-badge]: https://img.shields.io/npm/dm/import-meta-resolve.svg
232+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/import-meta-resolve.svg
229233
230234
[downloads]: https://www.npmjs.com/package/import-meta-resolve
231235
232-
[npm]: https://docs.npmjs.com/cli/install
233-
234-
[license]: license
236+
[downloads-badge]: https://img.shields.io/npm/dm/import-meta-resolve.svg
235237
236-
[author]: https://wooorm.com
238+
[errnoexception]: #errnoexception
237239
238240
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
239241
240-
[typescript]: https://www.typescriptlang.org
241-
242-
[contribute]: https://opensource.guide/how-to-contribute/
242+
[license]: license
243243
244-
[algo]: https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_resolver_algorithm
244+
[moduleresolve]: #moduleResolvespecifier-parent-conditions-preserveSymlinks
245245
246246
[native-resolve]: https://nodejs.org/api/esm.html#esm_import_meta_resolve_specifier_parent
247247
248-
[resolve]: #resolvespecifier-parent
248+
[npm]: https://docs.npmjs.com/cli/install
249249
250-
[moduleresolve]: #moduleResolvespecifier-parent-conditions-preserveSymlinks
250+
[resolve]: #resolvespecifier-parent
251251
252-
[errnoexception]: #errnoexception
252+
[typescript]: https://www.typescriptlang.org

test/core.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import assert from 'node:assert/strict'
66
import {promises as fs, renameSync} from 'node:fs'
77
import process from 'node:process'
8-
import {URL, pathToFileURL} from 'node:url'
8+
import {pathToFileURL} from 'node:url'
99
import test from 'node:test'
1010
import semver from 'semver'
1111
import {moduleResolve, resolve} from '../index.js'
@@ -33,7 +33,10 @@ test(
3333
// // Note: this is toggled by the `baseline*.js` tests (see `script.js` for details on why and how)
3434
{skip: false},
3535
async function () {
36-
assert(resolve, 'expected `resolve` to exist (needed for TS in baseline)')
36+
assert.ok(
37+
resolve,
38+
'expected `resolve` to exist (needed for TS in baseline)'
39+
)
3740

3841
await fs.rename('package.json', 'package.json.bak')
3942

@@ -147,7 +150,7 @@ test(
147150
assert.equal(
148151
resolve('@bcoe/v8-coverage', import.meta.url),
149152
new URL(
150-
'../node_modules/@bcoe/v8-coverage/dist/lib/index.js',
153+
'../node_modules/@bcoe/v8-coverage/src/lib/index.js',
151154
import.meta.url
152155
).href,
153156
'should resolve a bare specifier w/ scope to a package'
@@ -258,7 +261,7 @@ test(
258261
assert.fail()
259262
} catch (error) {
260263
const exception = /** @type {ErrnoException} */ (error)
261-
assert(
264+
assert.ok(
262265
[
263266
// Node 22+
264267
'ERR_ASSERTION',
@@ -288,7 +291,7 @@ test(
288291
} catch (error) {
289292
const exception = /** @type {ErrnoException} */ (error)
290293
if (!nodeBefore18) {
291-
assert(exception.code)
294+
assert.ok(exception.code)
292295
// To do: when pulling in new Node changes, the code is now
293296
// `ERR_UNSUPPORTED_RESOLVE_REQUEST` (from around Node 21.7).
294297
// Earlier was `ERR_INVALID_URL`.
@@ -368,7 +371,10 @@ test(
368371
)
369372

370373
run(() => {
371-
assert(resolve, 'expected `resolve` to exist (needed for TS in baseline)')
374+
assert.ok(
375+
resolve,
376+
'expected `resolve` to exist (needed for TS in baseline)'
377+
)
372378

373379
const oldEmitWarning = process.emitWarning
374380
/** @type {string | undefined} */
@@ -406,7 +412,10 @@ test(
406412
})
407413

408414
run(() => {
409-
assert(resolve, 'expected `resolve` to exist (needed for TS in baseline)')
415+
assert.ok(
416+
resolve,
417+
'expected `resolve` to exist (needed for TS in baseline)'
418+
)
410419

411420
const oldEmitWarning = process.emitWarning
412421
/** @type {string | undefined} */
@@ -500,7 +509,10 @@ test(
500509
}
501510

502511
run(() => {
503-
assert(resolve, 'expected `resolve` to exist (needed for TS in baseline)')
512+
assert.ok(
513+
resolve,
514+
'expected `resolve` to exist (needed for TS in baseline)'
515+
)
504516

505517
const oldEmitWarning = process.emitWarning
506518
/** @type {string} */
@@ -609,7 +621,10 @@ test(
609621
}
610622

611623
run(() => {
612-
assert(resolve, 'expected `resolve` to exist (needed for TS in baseline)')
624+
assert.ok(
625+
resolve,
626+
'expected `resolve` to exist (needed for TS in baseline)'
627+
)
613628

614629
const oldEmitWarning = process.emitWarning
615630
/** @type {string | undefined} */

test/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable import/no-unassigned-import */
1+
/* eslint-disable import-x/no-unassigned-import */
22
import './core.js'
33
import './ponyfill.js'
4-
/* eslint-enable import/no-unassigned-import */
4+
/* eslint-enable import-x/no-unassigned-import */

xo.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/** @type {import('xo').FlatXoConfig} */
2+
const xoConfig = [
3+
{
4+
ignores: ['test/node_modules/'],
5+
name: 'default',
6+
prettier: true,
7+
rules: {
8+
complexity: 'off',
9+
'import-x/no-extraneous-dependencies': 'off',
10+
'max-depth': 'off',
11+
'max-params': 'off',
12+
'no-constant-condition': 'off',
13+
'no-new': 'off',
14+
'prefer-arrow-callback': 'off',
15+
'prefer-destructuring': 'off',
16+
'unicorn/prefer-at': 'off',
17+
'unicorn/prefer-string-raw': 'off',
18+
'unicorn/prefer-string-replace-all': 'off'
19+
},
20+
space: true
21+
}
22+
]
23+
24+
export default xoConfig

0 commit comments

Comments
 (0)