diff --git a/.size-limit.json b/.size-limit.json index 7c2a17d4df..258fd6c908 100644 --- a/.size-limit.json +++ b/.size-limit.json @@ -33,7 +33,7 @@ "build/globals.js", "build/deno.js" ], - "limit": "881.40 kB", + "limit": "881.42 kB", "brotli": false, "gzip": false }, @@ -66,7 +66,7 @@ "README.md", "LICENSE" ], - "limit": "944.14 kB", + "limit": "944.17 kB", "brotli": false, "gzip": false } diff --git a/build/deps.cjs b/build/deps.cjs index 74d7f3f390..29318f167b 100644 --- a/build/deps.cjs +++ b/build/deps.cjs @@ -62,7 +62,7 @@ function parseDeps(content) { } function parsePackageName(path) { var _a, _b; - if (!path) return; + if (!path || path.includes(":")) return; const name = (_b = (_a = nameRe.exec(path)) == null ? void 0 : _a.groups) == null ? void 0 : _b.name; if (name && !builtins.has(name)) return name; } diff --git a/src/deps.ts b/src/deps.ts index 50ad61cd96..c07498024f 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -86,7 +86,7 @@ export function parseDeps(content: string): Record { } function parsePackageName(path?: string): string | undefined { - if (!path) return + if (!path || path.includes(':')) return const name = nameRe.exec(path)?.groups?.name if (name && !builtins.has(name)) return name diff --git a/test/deps.test.js b/test/deps.test.js index 3d59ac6039..1443867114 100644 --- a/test/deps.test.js +++ b/test/deps.test.js @@ -120,6 +120,12 @@ describe('deps', () => { [`require('@')`, {}], [`require('@/_foo')`, {}], [`require('@foo')`, {}], + // ignores protocol specifiers + [`import fs from 'node:fs'`, {}], + [`require('node:path')`, {}], + [`import('node:crypto')`, {}], + [`import { promises } from 'node:fs/promises'`, {}], + [`import * as assert from 'node:assert/strict'`, {}], ].forEach(([input, result]) => { assert.deepEqual(parseDeps(input), result) })