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
4 changes: 2 additions & 2 deletions .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"build/globals.js",
"build/deno.js"
],
"limit": "881.40 kB",
"limit": "881.42 kB",
"brotli": false,
"gzip": false
},
Expand Down Expand Up @@ -66,7 +66,7 @@
"README.md",
"LICENSE"
],
"limit": "944.14 kB",
"limit": "944.17 kB",
"brotli": false,
"gzip": false
}
Expand Down
2 changes: 1 addition & 1 deletion build/deps.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function parseDeps(content: string): Record<string, string> {
}

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
Expand Down
6 changes: 6 additions & 0 deletions test/deps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
Loading