npm-pkg-lint 5.1.10 → 5.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +159 -90
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7802,7 +7802,7 @@ var _ = /* @__PURE__ */ Symbol("bufferLength");
|
|
|
7802
7802
|
var bi = /* @__PURE__ */ Symbol("bufferPush");
|
|
7803
7803
|
var Ie = /* @__PURE__ */ Symbol("bufferShift");
|
|
7804
7804
|
var L = /* @__PURE__ */ Symbol("objectMode");
|
|
7805
|
-
var
|
|
7805
|
+
var S = /* @__PURE__ */ Symbol("destroyed");
|
|
7806
7806
|
var _i = /* @__PURE__ */ Symbol("error");
|
|
7807
7807
|
var Oi = /* @__PURE__ */ Symbol("emitData");
|
|
7808
7808
|
var Is = /* @__PURE__ */ Symbol("emitEnd");
|
|
@@ -7860,7 +7860,7 @@ var A = class extends Di {
|
|
|
7860
7860
|
[Ne] = false;
|
|
7861
7861
|
[qt] = null;
|
|
7862
7862
|
[_] = 0;
|
|
7863
|
-
[
|
|
7863
|
+
[S] = false;
|
|
7864
7864
|
[Jt];
|
|
7865
7865
|
[Ce] = false;
|
|
7866
7866
|
[Rt] = 0;
|
|
@@ -7909,7 +7909,7 @@ var A = class extends Di {
|
|
|
7909
7909
|
write(t, e, i) {
|
|
7910
7910
|
if (this[Ce]) return false;
|
|
7911
7911
|
if (this[Q]) throw new Error("write after end");
|
|
7912
|
-
if (this[
|
|
7912
|
+
if (this[S]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
|
|
7913
7913
|
typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
|
|
7914
7914
|
let r = this[Z] ? jt : Yr;
|
|
7915
7915
|
if (!this[L] && !Buffer.isBuffer(t)) {
|
|
@@ -7920,7 +7920,7 @@ var A = class extends Di {
|
|
|
7920
7920
|
return this[L] ? (this[g] && this[_] !== 0 && this[Ae](true), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : t.length ? (typeof t == "string" && !(e === this[z] && !this[Mt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z] && (t = this[Mt].write(t)), this[g] && this[_] !== 0 && this[Ae](true), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : (this[_] !== 0 && this.emit("readable"), i && r(i), this[g]);
|
|
7921
7921
|
}
|
|
7922
7922
|
read(t) {
|
|
7923
|
-
if (this[
|
|
7923
|
+
if (this[S]) return null;
|
|
7924
7924
|
if (this[C] = false, this[_] === 0 || t === 0 || t && t > this[_]) return this[J](), null;
|
|
7925
7925
|
this[L] && (t = null), this[b].length > 1 && !this[L] && (this[b] = [this[z] ? this[b].join("") : Buffer.concat(this[b], this[_])]);
|
|
7926
7926
|
let e = this[Ns](t || null, this[b][0]);
|
|
@@ -7938,7 +7938,7 @@ var A = class extends Di {
|
|
|
7938
7938
|
return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = "utf8"), t !== void 0 && this.write(t, e), i && this.once("end", i), this[Q] = true, this.writable = false, (this[g] || !this[Qt]) && this[J](), this;
|
|
7939
7939
|
}
|
|
7940
7940
|
[Bt]() {
|
|
7941
|
-
this[
|
|
7941
|
+
this[S] || (!this[Rt] && !this[N].length && (this[C] = true), this[Qt] = false, this[g] = true, this.emit("resume"), this[b].length ? this[Ae]() : this[Q] ? this[J]() : this.emit("drain"));
|
|
7942
7942
|
}
|
|
7943
7943
|
resume() {
|
|
7944
7944
|
return this[Bt]();
|
|
@@ -7947,7 +7947,7 @@ var A = class extends Di {
|
|
|
7947
7947
|
this[g] = false, this[Qt] = true, this[C] = false;
|
|
7948
7948
|
}
|
|
7949
7949
|
get destroyed() {
|
|
7950
|
-
return this[
|
|
7950
|
+
return this[S];
|
|
7951
7951
|
}
|
|
7952
7952
|
get flowing() {
|
|
7953
7953
|
return this[g];
|
|
@@ -7971,7 +7971,7 @@ var A = class extends Di {
|
|
|
7971
7971
|
return this.emit("data", t), this[g];
|
|
7972
7972
|
}
|
|
7973
7973
|
pipe(t, e) {
|
|
7974
|
-
if (this[
|
|
7974
|
+
if (this[S]) return t;
|
|
7975
7975
|
this[C] = false;
|
|
7976
7976
|
let i = this[nt];
|
|
7977
7977
|
return e = e || {}, t === Ds.stdout || t === Ds.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this[N].push(e.proxyErrors ? new Li(this, t, e) : new Fe(this, t, e)), this[Z] ? jt(() => this[Bt]()) : this[Bt]()), t;
|
|
@@ -8009,15 +8009,15 @@ var A = class extends Di {
|
|
|
8009
8009
|
return this[nt];
|
|
8010
8010
|
}
|
|
8011
8011
|
[J]() {
|
|
8012
|
-
!this[De] && !this[nt] && !this[
|
|
8012
|
+
!this[De] && !this[nt] && !this[S] && this[b].length === 0 && this[Q] && (this[De] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Ne] && this.emit("close"), this[De] = false);
|
|
8013
8013
|
}
|
|
8014
8014
|
emit(t, ...e) {
|
|
8015
8015
|
let i = e[0];
|
|
8016
|
-
if (t !== "error" && t !== "close" && t !==
|
|
8016
|
+
if (t !== "error" && t !== "close" && t !== S && this[S]) return false;
|
|
8017
8017
|
if (t === "data") return !this[L] && !i ? false : this[Z] ? (jt(() => this[Oi](i)), true) : this[Oi](i);
|
|
8018
8018
|
if (t === "end") return this[Is]();
|
|
8019
8019
|
if (t === "close") {
|
|
8020
|
-
if (this[Ne] = true, !this[nt] && !this[
|
|
8020
|
+
if (this[Ne] = true, !this[nt] && !this[S]) return false;
|
|
8021
8021
|
let n = super.emit("close");
|
|
8022
8022
|
return this.removeAllListeners("close"), n;
|
|
8023
8023
|
} else if (t === "error") {
|
|
@@ -8069,7 +8069,7 @@ var A = class extends Di {
|
|
|
8069
8069
|
}
|
|
8070
8070
|
async promise() {
|
|
8071
8071
|
return new Promise((t, e) => {
|
|
8072
|
-
this.on(
|
|
8072
|
+
this.on(S, () => e(new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
|
|
8073
8073
|
});
|
|
8074
8074
|
}
|
|
8075
8075
|
[Symbol.asyncIterator]() {
|
|
@@ -8081,14 +8081,14 @@ var A = class extends Di {
|
|
|
8081
8081
|
if (r !== null) return Promise.resolve({ done: false, value: r });
|
|
8082
8082
|
if (this[Q]) return e();
|
|
8083
8083
|
let n, o, h = (d) => {
|
|
8084
|
-
this.off("data", a), this.off("end", l), this.off(
|
|
8084
|
+
this.off("data", a), this.off("end", l), this.off(S, c), e(), o(d);
|
|
8085
8085
|
}, a = (d) => {
|
|
8086
|
-
this.off("error", h), this.off("end", l), this.off(
|
|
8086
|
+
this.off("error", h), this.off("end", l), this.off(S, c), this.pause(), n({ value: d, done: !!this[Q] });
|
|
8087
8087
|
}, l = () => {
|
|
8088
|
-
this.off("error", h), this.off("data", a), this.off(
|
|
8088
|
+
this.off("error", h), this.off("data", a), this.off(S, c), e(), n({ done: true, value: void 0 });
|
|
8089
8089
|
}, c = () => h(new Error("stream destroyed"));
|
|
8090
|
-
return new Promise((d,
|
|
8091
|
-
o =
|
|
8090
|
+
return new Promise((d, y) => {
|
|
8091
|
+
o = y, n = d, this.once(S, c), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
8092
8092
|
});
|
|
8093
8093
|
}, throw: e, return: e, [Symbol.asyncIterator]() {
|
|
8094
8094
|
return this;
|
|
@@ -8097,21 +8097,21 @@ var A = class extends Di {
|
|
|
8097
8097
|
}
|
|
8098
8098
|
[Symbol.iterator]() {
|
|
8099
8099
|
this[C] = false;
|
|
8100
|
-
let t = false, e = () => (this.pause(), this.off(_i, e), this.off(
|
|
8100
|
+
let t = false, e = () => (this.pause(), this.off(_i, e), this.off(S, e), this.off("end", e), t = true, { done: true, value: void 0 }), i = () => {
|
|
8101
8101
|
if (t) return e();
|
|
8102
8102
|
let r = this.read();
|
|
8103
8103
|
return r === null ? e() : { done: false, value: r };
|
|
8104
8104
|
};
|
|
8105
|
-
return this.once("end", e), this.once(_i, e), this.once(
|
|
8105
|
+
return this.once("end", e), this.once(_i, e), this.once(S, e), { next: i, throw: e, return: e, [Symbol.iterator]() {
|
|
8106
8106
|
return this;
|
|
8107
8107
|
}, [Symbol.dispose]: () => {
|
|
8108
8108
|
} };
|
|
8109
8109
|
}
|
|
8110
8110
|
destroy(t) {
|
|
8111
|
-
if (this[
|
|
8112
|
-
this[
|
|
8111
|
+
if (this[S]) return t ? this.emit("error", t) : this.emit(S), this;
|
|
8112
|
+
this[S] = true, this[C] = true, this[b].length = 0, this[_] = 0;
|
|
8113
8113
|
let e = this;
|
|
8114
|
-
return typeof e.close == "function" && !this[Ne] && e.close(), t ? this.emit("error", t) : this.emit(
|
|
8114
|
+
return typeof e.close == "function" && !this[Ne] && e.close(), t ? this.emit("error", t) : this.emit(S), this;
|
|
8115
8115
|
}
|
|
8116
8116
|
static get isStream() {
|
|
8117
8117
|
return Wr;
|
|
@@ -8862,7 +8862,7 @@ var st = /* @__PURE__ */ Symbol("queue");
|
|
|
8862
8862
|
var mt = /* @__PURE__ */ Symbol("ended");
|
|
8863
8863
|
var Yi = /* @__PURE__ */ Symbol("emittedEnd");
|
|
8864
8864
|
var At = /* @__PURE__ */ Symbol("emit");
|
|
8865
|
-
var
|
|
8865
|
+
var w = /* @__PURE__ */ Symbol("unzip");
|
|
8866
8866
|
var Xe = /* @__PURE__ */ Symbol("consumeChunk");
|
|
8867
8867
|
var qe = /* @__PURE__ */ Symbol("consumeChunkSub");
|
|
8868
8868
|
var Ki = /* @__PURE__ */ Symbol("consumeBody");
|
|
@@ -8902,7 +8902,7 @@ var rt = class extends Dn {
|
|
|
8902
8902
|
[V];
|
|
8903
8903
|
[he];
|
|
8904
8904
|
[mt] = false;
|
|
8905
|
-
[
|
|
8905
|
+
[w];
|
|
8906
8906
|
[$] = false;
|
|
8907
8907
|
[It];
|
|
8908
8908
|
[je] = false;
|
|
@@ -9012,7 +9012,13 @@ var rt = class extends Dn {
|
|
|
9012
9012
|
}
|
|
9013
9013
|
}
|
|
9014
9014
|
abort(t) {
|
|
9015
|
-
|
|
9015
|
+
if (!this[$]) {
|
|
9016
|
+
if (this[w]) {
|
|
9017
|
+
let e = this[w];
|
|
9018
|
+
e.write = () => true, e.end = () => e, e.emit = () => false, e.destroy?.();
|
|
9019
|
+
}
|
|
9020
|
+
this[$] = true, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: false });
|
|
9021
|
+
}
|
|
9016
9022
|
}
|
|
9017
9023
|
[Xs](t) {
|
|
9018
9024
|
this[$i] += t.length;
|
|
@@ -9021,11 +9027,11 @@ var rt = class extends Dn {
|
|
|
9021
9027
|
}
|
|
9022
9028
|
write(t, e, i) {
|
|
9023
9029
|
if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this[$]) return i?.(), false;
|
|
9024
|
-
if ((this[
|
|
9030
|
+
if ((this[w] === void 0 || this.brotli === void 0 && this[w] === false) && t) {
|
|
9025
9031
|
if (this[p] && (t = Buffer.concat([this[p], t]), this[p] = void 0), t.length < An) return this[p] = t, i?.(), true;
|
|
9026
|
-
for (let a = 0; this[
|
|
9032
|
+
for (let a = 0; this[w] === void 0 && a < Xi.length; a++) t[a] !== Xi[a] && (this[w] = false);
|
|
9027
9033
|
let o = false;
|
|
9028
|
-
if (this[
|
|
9034
|
+
if (this[w] === false && this.zstd !== false) {
|
|
9029
9035
|
o = true;
|
|
9030
9036
|
for (let a = 0; a < qi.length; a++) if (t[a] !== qi[a]) {
|
|
9031
9037
|
o = false;
|
|
@@ -9033,27 +9039,27 @@ var rt = class extends Dn {
|
|
|
9033
9039
|
}
|
|
9034
9040
|
}
|
|
9035
9041
|
let h = this.brotli === void 0 && !o;
|
|
9036
|
-
if (this[
|
|
9042
|
+
if (this[w] === false && h) if (t.length < 512) if (this[mt]) this.brotli = true;
|
|
9037
9043
|
else return this[p] = t, i?.(), true;
|
|
9038
9044
|
else try {
|
|
9039
9045
|
new F(t.subarray(0, 512)), this.brotli = false;
|
|
9040
9046
|
} catch {
|
|
9041
9047
|
this.brotli = true;
|
|
9042
9048
|
}
|
|
9043
|
-
if (this[
|
|
9049
|
+
if (this[w] === void 0 || this[w] === false && (this.brotli || o)) {
|
|
9044
9050
|
let a = this[mt];
|
|
9045
|
-
this[mt] = false, this[
|
|
9051
|
+
this[mt] = false, this[w] = this[w] === void 0 ? new Ue({}) : o ? new Ke({}) : new Ge({}), this[w].on("data", (c) => {
|
|
9046
9052
|
this[Xs](c) && this[Xe](c);
|
|
9047
|
-
}), this[
|
|
9053
|
+
}), this[w].on("error", (c) => {
|
|
9048
9054
|
this[$] || this.abort(c);
|
|
9049
|
-
}), this[
|
|
9055
|
+
}), this[w].on("end", () => {
|
|
9050
9056
|
this[mt] = true, this[Xe]();
|
|
9051
9057
|
}), this[Yt] = true, this[le] += t.length;
|
|
9052
|
-
let l = !!this[
|
|
9058
|
+
let l = !!this[w][a ? "end" : "write"](t);
|
|
9053
9059
|
return this[Yt] = false, i?.(), l;
|
|
9054
9060
|
}
|
|
9055
9061
|
}
|
|
9056
|
-
this[Yt] = true, this[
|
|
9062
|
+
this[Yt] = true, this[w] ? (this[le] += t.length, this[w].write(t)) : this[Xe](t), this[Yt] = false;
|
|
9057
9063
|
let n = this[st].length > 0 ? false : this[it] ? this[it].flowing : true;
|
|
9058
9064
|
return !n && this[st].length === 0 && this[it]?.once("drain", () => this.emit("drain")), i?.(), n;
|
|
9059
9065
|
}
|
|
@@ -9108,7 +9114,7 @@ var rt = class extends Dn {
|
|
|
9108
9114
|
e < i && (this[p] = this[p] ? Buffer.concat([t.subarray(e), this[p]]) : t.subarray(e));
|
|
9109
9115
|
}
|
|
9110
9116
|
end(t, e, i) {
|
|
9111
|
-
return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[$] || (this[
|
|
9117
|
+
return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[$] || (this[w] ? (t && (this[le] += t.length, this[w].write(t)), this[w].end()) : (this[mt] = true, (this.brotli === void 0 || this.zstd === void 0) && (t = t || Buffer.alloc(0)), t && this.write(t), this[Qe]())), this;
|
|
9112
9118
|
}
|
|
9113
9119
|
};
|
|
9114
9120
|
var ut = (s3) => {
|
|
@@ -9997,13 +10003,13 @@ var no = (s3, t) => {
|
|
|
9997
10003
|
};
|
|
9998
10004
|
var gr = (s3, t, e) => {
|
|
9999
10005
|
s3 = f(s3);
|
|
10000
|
-
let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd),
|
|
10001
|
-
E ? e(E) : x && a ? Es(x, o, h, (Le) =>
|
|
10006
|
+
let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), y = (E, x) => {
|
|
10007
|
+
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? k.chmod(s3, r, e) : e();
|
|
10002
10008
|
};
|
|
10003
|
-
if (s3 === d) return no(s3,
|
|
10004
|
-
if (l) return ro.mkdir(s3, { mode: r, recursive: true }).then((E) =>
|
|
10009
|
+
if (s3 === d) return no(s3, y);
|
|
10010
|
+
if (l) return ro.mkdir(s3, { mode: r, recursive: true }).then((E) => y(null, E ?? void 0), y);
|
|
10005
10011
|
let D = f(Si.relative(d, s3)).split("/");
|
|
10006
|
-
Ss(d, D, r, c, d, void 0,
|
|
10012
|
+
Ss(d, D, r, c, d, void 0, y);
|
|
10007
10013
|
};
|
|
10008
10014
|
var Ss = (s3, t, e, i, r, n, o) => {
|
|
10009
10015
|
if (t.length === 0) return o(null, n);
|
|
@@ -10313,12 +10319,12 @@ var Xt = class extends rt {
|
|
|
10313
10319
|
if (typeof l == "number" && t.mtime && !this.noMtime) {
|
|
10314
10320
|
n++;
|
|
10315
10321
|
let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
|
|
10316
|
-
m.futimes(l, c, d, (
|
|
10322
|
+
m.futimes(l, c, d, (y) => y ? m.utimes(a, c, d, (T) => o(T && y)) : o());
|
|
10317
10323
|
}
|
|
10318
10324
|
if (typeof l == "number" && this[ge](t)) {
|
|
10319
10325
|
n++;
|
|
10320
10326
|
let c = this[be](t), d = this[_e](t);
|
|
10321
|
-
typeof c == "number" && typeof d == "number" && m.fchown(l, c, d, (
|
|
10327
|
+
typeof c == "number" && typeof d == "number" && m.fchown(l, c, d, (y) => y ? m.chown(a, c, d, (T) => o(T && y)) : o());
|
|
10322
10328
|
}
|
|
10323
10329
|
o();
|
|
10324
10330
|
});
|
|
@@ -10645,27 +10651,27 @@ var go = (s3, t) => {
|
|
|
10645
10651
|
T ? v.close(n, (E) => h(T)) : h(null, D);
|
|
10646
10652
|
}, l = 0;
|
|
10647
10653
|
if (o === 0) return a(null, 0);
|
|
10648
|
-
let c = 0, d = Buffer.alloc(512),
|
|
10654
|
+
let c = 0, d = Buffer.alloc(512), y = (T, D) => {
|
|
10649
10655
|
if (T || D === void 0) return a(T);
|
|
10650
|
-
if (c += D, c < 512 && D) return v.read(n, d, c, d.length - c, l + c,
|
|
10656
|
+
if (c += D, c < 512 && D) return v.read(n, d, c, d.length - c, l + c, y);
|
|
10651
10657
|
if (l === 0 && d[0] === 31 && d[1] === 139) return a(new Error("cannot append to compressed archives"));
|
|
10652
10658
|
if (c < 512) return a(null, l);
|
|
10653
10659
|
let E = new F(d);
|
|
10654
10660
|
if (!E.cksumValid) return a(null, l);
|
|
10655
10661
|
let x = 512 * Math.ceil((E.size ?? 0) / 512);
|
|
10656
10662
|
if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
|
|
10657
|
-
s3.mtimeCache && E.mtime && s3.mtimeCache.set(String(E.path), E.mtime), c = 0, v.read(n, d, 0, 512, l,
|
|
10663
|
+
s3.mtimeCache && E.mtime && s3.mtimeCache.set(String(E.path), E.mtime), c = 0, v.read(n, d, 0, 512, l, y);
|
|
10658
10664
|
};
|
|
10659
|
-
v.read(n, d, 0, 512, l,
|
|
10665
|
+
v.read(n, d, 0, 512, l, y);
|
|
10660
10666
|
};
|
|
10661
10667
|
return new Promise((n, o) => {
|
|
10662
10668
|
e.on("error", o);
|
|
10663
10669
|
let h = "r+", a = (l, c) => {
|
|
10664
10670
|
if (l && l.code === "ENOENT" && h === "r+") return h = "w+", v.open(s3.file, h, a);
|
|
10665
10671
|
if (l || !c) return o(l);
|
|
10666
|
-
v.fstat(c, (d,
|
|
10672
|
+
v.fstat(c, (d, y) => {
|
|
10667
10673
|
if (d) return v.close(c, () => o(d));
|
|
10668
|
-
i(c,
|
|
10674
|
+
i(c, y.size, (T, D) => {
|
|
10669
10675
|
if (T) return o(T);
|
|
10670
10676
|
let E = new et(s3.file, { fd: c, start: D });
|
|
10671
10677
|
e.pipe(E), E.on("error", o), E.on("close", n), _o(e, t);
|
|
@@ -10950,6 +10956,20 @@ function jsonLocation(ast, pick, ...datapath) {
|
|
|
10950
10956
|
}
|
|
10951
10957
|
}
|
|
10952
10958
|
|
|
10959
|
+
// src/utils/normalize-dependency.ts
|
|
10960
|
+
function normalizeDependency(key, value) {
|
|
10961
|
+
if (value.startsWith("npm:")) {
|
|
10962
|
+
const spec = value.slice("npm:".length);
|
|
10963
|
+
const [name, version2 = ""] = spec.split(/(?<=.)@/, 2);
|
|
10964
|
+
return { key, name, version: version2 };
|
|
10965
|
+
}
|
|
10966
|
+
return {
|
|
10967
|
+
key,
|
|
10968
|
+
name: key,
|
|
10969
|
+
version: value
|
|
10970
|
+
};
|
|
10971
|
+
}
|
|
10972
|
+
|
|
10953
10973
|
// node_modules/nano-spawn/source/context.js
|
|
10954
10974
|
import process3 from "node:process";
|
|
10955
10975
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -11320,19 +11340,19 @@ function createEntry(key, version2, source) {
|
|
|
11320
11340
|
if (version2.startsWith("file:")) {
|
|
11321
11341
|
return null;
|
|
11322
11342
|
}
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
version2 = newVersion;
|
|
11343
|
+
const { name, version: normalizedVersion } = normalizeDependency(key, version2);
|
|
11344
|
+
if (normalizedVersion === "") {
|
|
11345
|
+
return null;
|
|
11327
11346
|
}
|
|
11328
|
-
if (
|
|
11347
|
+
if (name === "@types/node") {
|
|
11329
11348
|
return null;
|
|
11330
11349
|
}
|
|
11331
|
-
const minVersion = import_semver.default.minVersion(
|
|
11350
|
+
const minVersion = import_semver.default.minVersion(normalizedVersion);
|
|
11332
11351
|
return {
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11352
|
+
key,
|
|
11353
|
+
name,
|
|
11354
|
+
version: normalizedVersion,
|
|
11355
|
+
spec: `${name}@${minVersion ? minVersion.version : normalizedVersion}`,
|
|
11336
11356
|
source
|
|
11337
11357
|
};
|
|
11338
11358
|
}
|
|
@@ -11369,7 +11389,7 @@ async function deprecatedDependency(pkg, pkgAst, options) {
|
|
|
11369
11389
|
if (!deprecated) {
|
|
11370
11390
|
continue;
|
|
11371
11391
|
}
|
|
11372
|
-
const { line, column } = jsonLocation(pkgAst, "member", dependency.source, dependency.
|
|
11392
|
+
const { line, column } = jsonLocation(pkgAst, "member", dependency.source, dependency.key);
|
|
11373
11393
|
messages.push({
|
|
11374
11394
|
ruleId: ruleId3,
|
|
11375
11395
|
severity: 2,
|
|
@@ -11382,7 +11402,7 @@ async function deprecatedDependency(pkg, pkgAst, options) {
|
|
|
11382
11402
|
if (dependency.source === "devDependencies") {
|
|
11383
11403
|
continue;
|
|
11384
11404
|
}
|
|
11385
|
-
const { line, column } = jsonLocation(pkgAst, "member", dependency.source, dependency.
|
|
11405
|
+
const { line, column } = jsonLocation(pkgAst, "member", dependency.source, dependency.key);
|
|
11386
11406
|
messages.push({
|
|
11387
11407
|
ruleId: ruleId3,
|
|
11388
11408
|
severity: 1,
|
|
@@ -11884,10 +11904,59 @@ function* shadowedTypes(pkg, pkgAst) {
|
|
|
11884
11904
|
}
|
|
11885
11905
|
}
|
|
11886
11906
|
|
|
11887
|
-
// src/rules/
|
|
11907
|
+
// src/rules/tsconfig-base-matching-engine.ts
|
|
11888
11908
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
11889
|
-
var ruleId12 = "
|
|
11909
|
+
var ruleId12 = "tsconfig-base-matching-engine";
|
|
11890
11910
|
var severity10 = Severity.ERROR;
|
|
11911
|
+
var matchDependency = /^@tsconfig\/node(\d+)$/;
|
|
11912
|
+
function* tsconfigBaseMatchingEngine(pkg, pkgAst) {
|
|
11913
|
+
if (!pkg.engines?.node) {
|
|
11914
|
+
return;
|
|
11915
|
+
}
|
|
11916
|
+
const nodeVersion = import_semver3.default.validRange(pkg.engines.node) ? import_semver3.default.minVersion(pkg.engines.node, {}) : null;
|
|
11917
|
+
if (!nodeVersion) {
|
|
11918
|
+
return;
|
|
11919
|
+
}
|
|
11920
|
+
for (const source of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
11921
|
+
const dependencies = pkg[source] ?? {};
|
|
11922
|
+
const tsconfig = Object.keys(dependencies).filter((it2) => matchDependency.test(it2));
|
|
11923
|
+
if (tsconfig.length === 0) {
|
|
11924
|
+
continue;
|
|
11925
|
+
}
|
|
11926
|
+
const [first, ...duplicates] = tsconfig;
|
|
11927
|
+
if (duplicates.length > 0) {
|
|
11928
|
+
for (const dup of duplicates) {
|
|
11929
|
+
const { line, column } = jsonLocation(pkgAst, "member", source, dup);
|
|
11930
|
+
yield {
|
|
11931
|
+
ruleId: ruleId12,
|
|
11932
|
+
severity: severity10,
|
|
11933
|
+
message: `${dup} and ${first} cannot be used at the same time`,
|
|
11934
|
+
line,
|
|
11935
|
+
column
|
|
11936
|
+
};
|
|
11937
|
+
}
|
|
11938
|
+
continue;
|
|
11939
|
+
}
|
|
11940
|
+
const match2 = matchDependency.exec(first);
|
|
11941
|
+
const baseVersion = Number(match2[1]);
|
|
11942
|
+
if (baseVersion !== nodeVersion.major) {
|
|
11943
|
+
const { line, column } = jsonLocation(pkgAst, "member", source, first);
|
|
11944
|
+
const expectedVersion = `v${String(nodeVersion.major)}`;
|
|
11945
|
+
yield {
|
|
11946
|
+
ruleId: ruleId12,
|
|
11947
|
+
severity: severity10,
|
|
11948
|
+
message: `${first} does not match engines.node ${expectedVersion}`,
|
|
11949
|
+
line,
|
|
11950
|
+
column
|
|
11951
|
+
};
|
|
11952
|
+
}
|
|
11953
|
+
}
|
|
11954
|
+
}
|
|
11955
|
+
|
|
11956
|
+
// src/rules/types-node-matching-engine.ts
|
|
11957
|
+
var import_semver4 = __toESM(require_semver2(), 1);
|
|
11958
|
+
var ruleId13 = "types-node-matching-engine";
|
|
11959
|
+
var severity11 = Severity.ERROR;
|
|
11891
11960
|
function* typesNodeMatchingEngine(pkg, pkgAst) {
|
|
11892
11961
|
if (!pkg.engines?.node) {
|
|
11893
11962
|
return;
|
|
@@ -11901,8 +11970,8 @@ function* typesNodeMatchingEngine(pkg, pkgAst) {
|
|
|
11901
11970
|
if (declaredVersion === "latest") {
|
|
11902
11971
|
continue;
|
|
11903
11972
|
}
|
|
11904
|
-
const nodeVersion =
|
|
11905
|
-
const typesVersion =
|
|
11973
|
+
const nodeVersion = import_semver4.default.minVersion(pkg.engines.node);
|
|
11974
|
+
const typesVersion = import_semver4.default.minVersion(declaredVersion);
|
|
11906
11975
|
if (!nodeVersion || !typesVersion) {
|
|
11907
11976
|
continue;
|
|
11908
11977
|
}
|
|
@@ -11911,8 +11980,8 @@ function* typesNodeMatchingEngine(pkg, pkgAst) {
|
|
|
11911
11980
|
const actualVersion = `v${String(typesVersion.major)}`;
|
|
11912
11981
|
const expectedVersion = `v${String(nodeVersion.major)}`;
|
|
11913
11982
|
yield {
|
|
11914
|
-
ruleId:
|
|
11915
|
-
severity:
|
|
11983
|
+
ruleId: ruleId13,
|
|
11984
|
+
severity: severity11,
|
|
11916
11985
|
message: `@types/node ${actualVersion} does not equal engines.node ${expectedVersion}`,
|
|
11917
11986
|
line,
|
|
11918
11987
|
column
|
|
@@ -11922,8 +11991,8 @@ function* typesNodeMatchingEngine(pkg, pkgAst) {
|
|
|
11922
11991
|
}
|
|
11923
11992
|
|
|
11924
11993
|
// src/rules/verify-engine-constraint.ts
|
|
11925
|
-
var
|
|
11926
|
-
var
|
|
11994
|
+
var import_semver5 = __toESM(require_semver2(), 1);
|
|
11995
|
+
var ruleId14 = "invalid-engine-constraint";
|
|
11927
11996
|
async function* getDeepDependencies(pkg, visited, dependency) {
|
|
11928
11997
|
if (dependency) {
|
|
11929
11998
|
if (visited.has(dependency)) {
|
|
@@ -11937,15 +12006,16 @@ async function* getDeepDependencies(pkg, visited, dependency) {
|
|
|
11937
12006
|
}
|
|
11938
12007
|
const { dependencies = {} } = pkgData;
|
|
11939
12008
|
for (let [key, version2] of Object.entries(dependencies)) {
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
12009
|
+
const normalized = normalizeDependency(key, version2);
|
|
12010
|
+
key = normalized.name;
|
|
12011
|
+
version2 = normalized.version;
|
|
12012
|
+
if (version2 === "") {
|
|
12013
|
+
continue;
|
|
11944
12014
|
}
|
|
11945
12015
|
if (key === "@types/node") {
|
|
11946
12016
|
continue;
|
|
11947
12017
|
}
|
|
11948
|
-
const minVersion =
|
|
12018
|
+
const minVersion = import_semver5.default.minVersion(version2);
|
|
11949
12019
|
const deep = `${key}@${minVersion ? minVersion.version : version2}`;
|
|
11950
12020
|
yield deep;
|
|
11951
12021
|
yield* getDeepDependencies(pkg, visited, deep);
|
|
@@ -11960,9 +12030,9 @@ async function verifyDependency(dependency, minDeclared, declaredConstraint) {
|
|
|
11960
12030
|
if (!constraint) {
|
|
11961
12031
|
return null;
|
|
11962
12032
|
}
|
|
11963
|
-
if (!
|
|
12033
|
+
if (!import_semver5.default.satisfies(minDeclared, constraint)) {
|
|
11964
12034
|
return {
|
|
11965
|
-
ruleId:
|
|
12035
|
+
ruleId: ruleId14,
|
|
11966
12036
|
severity: 2,
|
|
11967
12037
|
message: `the transitive dependency "${dependency}" (node ${constraint}) does not satisfy the declared node engine "${declaredConstraint}"`,
|
|
11968
12038
|
line: 1,
|
|
@@ -11976,7 +12046,7 @@ async function verifyEngineConstraint(pkg) {
|
|
|
11976
12046
|
if (!declaredConstraint) {
|
|
11977
12047
|
return [];
|
|
11978
12048
|
}
|
|
11979
|
-
const minDeclared =
|
|
12049
|
+
const minDeclared = import_semver5.default.minVersion(declaredConstraint);
|
|
11980
12050
|
if (!minDeclared) {
|
|
11981
12051
|
throw new Error(`Failed to parse engine constraint "${declaredConstraint}"`);
|
|
11982
12052
|
}
|
|
@@ -11991,7 +12061,7 @@ async function verifyEngineConstraint(pkg) {
|
|
|
11991
12061
|
} catch (err) {
|
|
11992
12062
|
if (isNpmInfoError(err) && err.code === "E404") {
|
|
11993
12063
|
messages.push({
|
|
11994
|
-
ruleId:
|
|
12064
|
+
ruleId: ruleId14,
|
|
11995
12065
|
severity: 1,
|
|
11996
12066
|
message: `the transitive dependency "${dependency}" is not published to the NPM registry`,
|
|
11997
12067
|
line: 1,
|
|
@@ -12194,11 +12264,7 @@ function verifyFields(pkg, pkgAst, options) {
|
|
|
12194
12264
|
return messages;
|
|
12195
12265
|
}
|
|
12196
12266
|
function getActualDependency(key, version2) {
|
|
12197
|
-
|
|
12198
|
-
const [name] = version2.slice("npm:".length).split("@", 2);
|
|
12199
|
-
return name;
|
|
12200
|
-
}
|
|
12201
|
-
return key;
|
|
12267
|
+
return normalizeDependency(key, version2).name;
|
|
12202
12268
|
}
|
|
12203
12269
|
function verifyDependencies(pkg, pkgAst, options) {
|
|
12204
12270
|
const messages = [];
|
|
@@ -12223,27 +12289,29 @@ function verifyDependencies(pkg, pkgAst, options) {
|
|
|
12223
12289
|
});
|
|
12224
12290
|
}
|
|
12225
12291
|
}
|
|
12226
|
-
function verifyObsolete(
|
|
12292
|
+
function verifyObsolete(key, version2, source) {
|
|
12293
|
+
const { name: dependency } = normalizeDependency(key, version2);
|
|
12227
12294
|
const obsolete2 = isObsoleteDependency(dependency);
|
|
12228
12295
|
if (obsolete2) {
|
|
12229
|
-
const { line, column } = jsonLocation(pkgAst, "member", source,
|
|
12296
|
+
const { line, column } = jsonLocation(pkgAst, "member", source, key);
|
|
12297
|
+
const name = key === dependency ? `"${dependency}"` : `"${key}" ("npm:${dependency}")`;
|
|
12230
12298
|
messages.push({
|
|
12231
12299
|
ruleId: "obsolete-dependency",
|
|
12232
12300
|
severity: 2,
|
|
12233
|
-
message:
|
|
12301
|
+
message: `${name} is obsolete and should no longer be used: ${obsolete2.message}`,
|
|
12234
12302
|
line,
|
|
12235
12303
|
column
|
|
12236
12304
|
});
|
|
12237
12305
|
}
|
|
12238
12306
|
}
|
|
12239
|
-
for (const
|
|
12240
|
-
verifyObsolete(
|
|
12307
|
+
for (const [key, version2] of Object.entries(dependencies)) {
|
|
12308
|
+
verifyObsolete(key, version2, "dependencies");
|
|
12241
12309
|
}
|
|
12242
|
-
for (const
|
|
12243
|
-
verifyObsolete(
|
|
12310
|
+
for (const [key, version2] of Object.entries(devDependencies)) {
|
|
12311
|
+
verifyObsolete(key, version2, "devDependencies");
|
|
12244
12312
|
}
|
|
12245
|
-
for (const
|
|
12246
|
-
verifyObsolete(
|
|
12313
|
+
for (const [key, version2] of Object.entries(peerDependencies)) {
|
|
12314
|
+
verifyObsolete(key, version2, "peerDependencies");
|
|
12247
12315
|
}
|
|
12248
12316
|
return messages;
|
|
12249
12317
|
}
|
|
@@ -12263,6 +12331,7 @@ async function verifyPackageJson(pkg, pkgAst, filePath, options = { allowedDepen
|
|
|
12263
12331
|
...outdatedEngines(pkg, pkgAst, ignoreNodeVersion),
|
|
12264
12332
|
...preferTypes(pkg, pkgAst),
|
|
12265
12333
|
...shadowedTypes(pkg, pkgAst),
|
|
12334
|
+
...tsconfigBaseMatchingEngine(pkg, pkgAst),
|
|
12266
12335
|
...typesNodeMatchingEngine(pkg, pkgAst)
|
|
12267
12336
|
];
|
|
12268
12337
|
if (messages.length === 0) {
|