Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
run: |
npx ggcp target/coverage/lcov.info target/coverage/${{ github.sha }}.lcov.info
npx ggcp target/coverage/*.info https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/coverage/ --message='chore: add coverage for ${{ github.sha }}'
npx ggcp target/coverage/*.info https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/coverage/./ --message='chore: add coverage for ${{ github.sha }}'
npx ggcp target/docs https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/gh-pages --message='chore: update docs'

smoke-node:
Expand Down
2 changes: 1 addition & 1 deletion .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"LICENSE",
"package-main.json"
],
"limit": "18.32 kB",
"limit": "18.30 kB",
"gzip": true
},
{
Expand Down
188 changes: 168 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"test": "concurrently 'npm:test:*'",
"test:target": "git diff --exit-code --quiet || (echo 'Uncommitted changes' && exit 1)",
"test:size": "size-limit",
"_test:lint": "eslint -c src/test/lint/.eslintrc.json src",
"test:lint": "oxlint",
"test:unit": "vitest run --coverage --config ./vitest.config.js",
"test:jsr": "jsr publish --dry-run",
"test:audit": "npm audit",
Expand All @@ -65,7 +65,7 @@
},
"devDependencies": {
"@size-limit/file": "^11.2.0",
"@types/node": "^24.5.2",
"@types/node": "^24.7.1",
"@vitest/browser": "^3.2.4",
"@vitest/coverage-v8": "^3.2.4",
"concurrently": "^9.2.1",
Expand All @@ -78,10 +78,11 @@
"fast-glob": "^3.3.3",
"jsr": "^0.13.5",
"minimist": "^1.2.8",
"playwright": "^1.55.0",
"oxlint": "^1.22.0",
"playwright": "^1.56.0",
"size-limit": "^11.2.0",
"typedoc": "^0.28.13",
"typescript": "^5.9.2",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/main/ts/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ export const isV6Format: Checker = (addr: string): boolean => {

try {
return Address.from(addr).family === 6
} catch (e) {
} catch {
return false
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/ts/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const addresses = (kind?: string, family: FamilyAlias = 4): string[] => {
const nic = interfaces[kind]
if (!nic) return []
const match = nic.find(details => normalizeFamily(details.family) === fam)
return [match?.address!]
if (!match) return []
return [match.address]
}

// scan all NICs
Expand Down
2 changes: 1 addition & 1 deletion src/main/ts/polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface BufferLike extends Omit<Uint8Array, 'slice'> {
export const FakeBuffer = {
alloc: (size: number, fill: number = 0): BufferLike => {
if (size < 0)
throw new RangeError('The value of \"size\" is out of range.')
throw new RangeError('The value of "size" is out of range.')

const arr = new Uint8Array(size)
if (fill !== 0)
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { nodeExternalsPlugin } from 'esbuild-node-externals'
import { entryChunksPlugin } from 'esbuild-plugin-entry-chunks'
import { transformHookPlugin } from 'esbuild-plugin-transform-hook'
import { extractHelpersPlugin } from 'esbuild-plugin-extract-helpers'
import { injectFile } from 'esbuild-plugin-utils'
import minimist from 'minimist'
import glob from 'fast-glob'
import path from "node:path";
Expand Down Expand Up @@ -59,7 +58,7 @@ const cjsPlugins = [
{
on: 'end',
pattern: entryPointsToRegexp(entryPoints),
transform(contents, p) {
transform(contents) {
return contents
.toString()
.replaceAll('"node:', '"')
Expand Down
2 changes: 1 addition & 1 deletion src/test/ts/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ describe('extra', () => {

// buffer inputs
[Buffer.from([0, 0, 0, 1]), {big: 1n, family: 4}],
[Buffer.from(new Array(16).fill(0)), {big: 0n, family: 6}],
[Buffer.from(Array(16).fill(0)), {big: 0n, family: 6}],
[Buffer.alloc(5), /Invalid buffer length/],

// Array inputs
Expand Down
3 changes: 2 additions & 1 deletion target/cjs/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ var addresses = (kind, family = 4) => {
const nic = interfaces[kind];
if (!nic) return [];
const match = nic.find((details) => normalizeFamily(details.family) === fam);
return [match == null ? void 0 : match.address];
if (!match) return [];
return [match.address];
}
const all = Object.values(interfaces).reduce((acc, nic) => {
for (const { family: family2, address: address2 } of nic != null ? nic : []) {
Expand Down
2 changes: 1 addition & 1 deletion target/esm/core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ var isV6Format = (addr) => {
if (!`${addr}`.includes(":")) return false;
try {
return Address.from(addr).family === 6;
} catch (e) {
} catch {
return false;
}
};
Expand Down
3 changes: 2 additions & 1 deletion target/esm/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ var addresses = (kind, family = 4) => {
const nic = interfaces[kind];
if (!nic) return [];
const match = nic.find((details) => normalizeFamily(details.family) === fam);
return [match == null ? void 0 : match.address];
if (!match) return [];
return [match.address];
}
const all = Object.values(interfaces).reduce((acc, nic) => {
for (const { family: family2, address: address2 } of nic != null ? nic : []) {
Expand Down