Skip to content

Commit b2672d9

Browse files
committed
Fix build
1 parent f907f6e commit b2672d9

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

.config/rollup.base.config.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import commonjs from '@rollup/plugin-commonjs'
66
import json from '@rollup/plugin-json'
77
import replace from '@rollup/plugin-replace'
88
import { nodeResolve } from '@rollup/plugin-node-resolve'
9+
import { isRelative } from '@socketsecurity/registry/lib/path'
910
import { escapeRegExp } from '@socketsecurity/registry/lib/regexps'
1011
import rangesIntersect from 'semver/ranges/intersects.js'
1112
import { readPackageUpSync } from 'read-package-up'
@@ -89,6 +90,9 @@ export default (extendConfig = {}) => {
8990
return true
9091
}
9192
const id = normalizeId(id_)
93+
if (isRelative(id)) {
94+
return false
95+
}
9296
if (id.endsWith('.cjs')) {
9397
return true
9498
}
@@ -100,10 +104,10 @@ export default (extendConfig = {}) => {
100104
if (resolvedId.endsWith('.json')) {
101105
return isAncestorsCjs(resolvedId, parentId)
102106
}
103-
if (!isPackageName(id)) {
107+
const name = getPackageName(id)
108+
if (!isPackageName(name) || name === '@babel/runtime') {
104109
return false
105110
}
106-
const name = getPackageName(id)
107111
if (isEsmId(resolvedId, parentId)) {
108112
const parentPkg = parentId
109113
? readPackageUpSync({ cwd: path.dirname(parentId) })?.packageJson
@@ -126,7 +130,8 @@ export default (extendConfig = {}) => {
126130
if (isAncestorsCjs(resolvedId, parentId)) {
127131
return true
128132
}
129-
const parentNameStart = parentNodeModulesIndex + 14
133+
const parentNameStart =
134+
parentNodeModulesIndex + SLASH_NODE_MODULES_SLASH.length
130135
const parentNameEnd = getPackageNameEnd(parentId, parentNameStart)
131136
const {
132137
version,

.dep-stats.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,26 @@
7272
"blessed-contrib": "^4.11.0",
7373
"browserslist": "4.24.2",
7474
"chalk-table": "^1.0.2",
75+
"cli-spinners": "^2.9.2",
76+
"emoji-regex": "^10.3.0",
7577
"hpagent": "^1.2.0",
7678
"ignore": "^6.0.2",
7779
"micromatch": "^4.0.8",
7880
"npm-package-arg": "^12.0.0",
7981
"pony-cause": "^2.1.11",
8082
"semver": "^7.6.3",
83+
"signal-exit": "^4.1.0",
84+
"supports-hyperlinks": "^2.2.0",
8185
"synp": "^1.9.13",
8286
"tinyglobby": "^0.2.10",
8387
"which": "^5.0.0",
8488
"yaml": "^2.6.0",
8589
"yargs-parser": "^21.1.1"
8690
},
87-
"transitives": {}
91+
"transitives": {
92+
"cli-spinners": "^2.9.2",
93+
"emoji-regex": "^10.3.0",
94+
"signal-exit": "^4.1.0",
95+
"supports-hyperlinks": "^2.2.0"
96+
}
8897
}

package-lock.json

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,16 @@
5252
"blessed-contrib": "^4.11.0",
5353
"browserslist": "4.24.2",
5454
"chalk-table": "^1.0.2",
55+
"cli-spinners": "^2.9.2",
56+
"emoji-regex": "^10.3.0",
5557
"hpagent": "^1.2.0",
5658
"ignore": "^6.0.2",
5759
"micromatch": "^4.0.8",
5860
"npm-package-arg": "^12.0.0",
5961
"pony-cause": "^2.1.11",
6062
"semver": "^7.6.3",
63+
"signal-exit": "^4.1.0",
64+
"supports-hyperlinks": "^2.2.0",
6165
"synp": "^1.9.13",
6266
"tinyglobby": "^0.2.10",
6367
"which": "^5.0.0",

scripts/utils/packages.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@ function getPackageName(string, start = 0) {
2929
}
3030

3131
function getPackageNameEnd(string, start = 0) {
32+
if (isRelative(string)) {
33+
return 0
34+
}
3235
const firstSlashIndex = string.indexOf('/', start)
33-
if (firstSlashIndex === -1) return string.length
34-
if (string.charCodeAt(start) !== 64 /*'@'*/) return firstSlashIndex
36+
if (firstSlashIndex === -1) {
37+
return string.length
38+
}
39+
if (string.charCodeAt(start) !== 64 /*'@'*/) {
40+
return firstSlashIndex
41+
}
3542
const secondSlashIndex = string.indexOf('/', firstSlashIndex + 1)
3643
return secondSlashIndex === -1 ? string.length : secondSlashIndex
3744
}

0 commit comments

Comments
 (0)