@node9/policy-engine 2.64.0 → 2.64.1
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 +48 -11
- package/dist/index.mjs +48 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16352,6 +16352,8 @@ function parseNpmSpec(raw) {
|
|
|
16352
16352
|
return { name, version: exact ? exact[1] : void 0 };
|
|
16353
16353
|
}
|
|
16354
16354
|
var NPM_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
16355
|
+
"--package",
|
|
16356
|
+
// `npm --package=<pkg> exec <cmd>`: read by the exec branch
|
|
16355
16357
|
"--registry",
|
|
16356
16358
|
"--prefix",
|
|
16357
16359
|
"--cache",
|
|
@@ -16373,6 +16375,8 @@ var NPM_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
16373
16375
|
"--libc"
|
|
16374
16376
|
]);
|
|
16375
16377
|
var PNPM_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
16378
|
+
"--package",
|
|
16379
|
+
// `pnpm --package=<pkg> dlx <cmd>`: read by the dlx branch
|
|
16376
16380
|
"--registry",
|
|
16377
16381
|
"-C",
|
|
16378
16382
|
"--dir",
|
|
@@ -16588,9 +16592,10 @@ function operands(words, from, valueFlags) {
|
|
|
16588
16592
|
}
|
|
16589
16593
|
return out;
|
|
16590
16594
|
}
|
|
16591
|
-
function flagValues(words, from, names) {
|
|
16595
|
+
function flagValues(words, from, names, until = words.length) {
|
|
16592
16596
|
const out = [];
|
|
16593
|
-
|
|
16597
|
+
const end = until < 0 ? words.length : Math.min(until, words.length);
|
|
16598
|
+
for (let i = from; i >= 0 && i < end; i++) {
|
|
16594
16599
|
const w = words[i];
|
|
16595
16600
|
if (w === null) continue;
|
|
16596
16601
|
for (const n of names) {
|
|
@@ -16998,8 +17003,9 @@ function pushPy(out, manager, specs, limit = Infinity) {
|
|
|
16998
17003
|
n++;
|
|
16999
17004
|
}
|
|
17000
17005
|
}
|
|
17001
|
-
function npxPackages(words, from) {
|
|
17002
|
-
const explicit =
|
|
17006
|
+
function npxPackages(words, from, before = []) {
|
|
17007
|
+
const explicit = [...before];
|
|
17008
|
+
const take = (v) => explicit.push(...v.split(",").filter((x) => x.length > 0));
|
|
17003
17009
|
for (let i = from; i >= 0 && i < words.length; i++) {
|
|
17004
17010
|
const w = words[i];
|
|
17005
17011
|
if (w === null) return explicit;
|
|
@@ -17008,7 +17014,14 @@ function npxPackages(words, from) {
|
|
|
17008
17014
|
return explicit.length > 0 ? explicit : next ? [next] : [];
|
|
17009
17015
|
}
|
|
17010
17016
|
if (w.startsWith("-")) {
|
|
17011
|
-
if (w === "-p" || w === "--package"
|
|
17017
|
+
if (w === "-p" || w === "--package") {
|
|
17018
|
+
const v = words[i + 1];
|
|
17019
|
+
if (typeof v === "string") take(v);
|
|
17020
|
+
i++;
|
|
17021
|
+
} else if (w.startsWith("-p=") || w.startsWith("--package="))
|
|
17022
|
+
take(w.slice(w.indexOf("=") + 1));
|
|
17023
|
+
else if (w === "-c" || w === "--call")
|
|
17024
|
+
i++;
|
|
17012
17025
|
else if (takesValue(w, NPM_VALUE_FLAGS)) i++;
|
|
17013
17026
|
continue;
|
|
17014
17027
|
}
|
|
@@ -17017,9 +17030,9 @@ function npxPackages(words, from) {
|
|
|
17017
17030
|
return explicit;
|
|
17018
17031
|
}
|
|
17019
17032
|
function uvxPackages(words, from) {
|
|
17020
|
-
const from_ = flagValues(words, from, ["--from"]);
|
|
17021
|
-
const withs = flagValues(words, from, ["--with"]);
|
|
17022
17033
|
const first = verbIndex(words, from, UV_VALUE_FLAGS);
|
|
17034
|
+
const from_ = flagValues(words, from, ["--from"], first);
|
|
17035
|
+
const withs = flagValues(words, from, ["--with"], first);
|
|
17023
17036
|
const tool = first >= 0 && from_.length === 0 ? [words[first]] : [];
|
|
17024
17037
|
return [...from_, ...tool, ...withs];
|
|
17025
17038
|
}
|
|
@@ -17062,7 +17075,12 @@ function fromCall(words, out, depth) {
|
|
|
17062
17075
|
const verb = lower(words[v]);
|
|
17063
17076
|
if (v < 0) return;
|
|
17064
17077
|
if (NPM_INSTALL_VERBS.has(verb)) pushNpm(out, "npm", operands(words, v + 1, NPM_VALUE_FLAGS));
|
|
17065
|
-
else if (NPM_EXEC_VERBS.has(verb))
|
|
17078
|
+
else if (NPM_EXEC_VERBS.has(verb)) {
|
|
17079
|
+
const before = flagValues(words, start + 1, ["--package"], v);
|
|
17080
|
+
const sep = words.indexOf("--", v + 1);
|
|
17081
|
+
const after = flagValues(words, v + 1, ["--package"], sep < 0 ? words.length : sep);
|
|
17082
|
+
pushNpm(out, "npm exec", [.../* @__PURE__ */ new Set([...npxPackages(words, v + 1, before), ...after])]);
|
|
17083
|
+
}
|
|
17066
17084
|
return;
|
|
17067
17085
|
}
|
|
17068
17086
|
case "npx":
|
|
@@ -17074,7 +17092,12 @@ function fromCall(words, out, depth) {
|
|
|
17074
17092
|
if (v < 0) return;
|
|
17075
17093
|
if (PNPM_INSTALL_VERBS.has(verb))
|
|
17076
17094
|
pushNpm(out, "pnpm", operands(words, v + 1, PNPM_VALUE_FLAGS));
|
|
17077
|
-
else if (DLX_VERBS.has(verb))
|
|
17095
|
+
else if (DLX_VERBS.has(verb))
|
|
17096
|
+
pushNpm(
|
|
17097
|
+
out,
|
|
17098
|
+
"pnpm dlx",
|
|
17099
|
+
npxPackages(words, v + 1, flagValues(words, start + 1, ["--package"], v))
|
|
17100
|
+
);
|
|
17078
17101
|
return;
|
|
17079
17102
|
}
|
|
17080
17103
|
case "yarn": {
|
|
@@ -17128,7 +17151,12 @@ function fromCall(words, out, depth) {
|
|
|
17128
17151
|
const v = verbIndex(words, start + 1, PIPX_VALUE_FLAGS);
|
|
17129
17152
|
const verb = lower(words[v]);
|
|
17130
17153
|
if (v < 0) return;
|
|
17131
|
-
const spec = flagValues(
|
|
17154
|
+
const spec = flagValues(
|
|
17155
|
+
words,
|
|
17156
|
+
v + 1,
|
|
17157
|
+
["--spec"],
|
|
17158
|
+
verb === "run" ? verbIndex(words, v + 1, PIPX_VALUE_FLAGS) : words.length
|
|
17159
|
+
);
|
|
17132
17160
|
if (verb === "install")
|
|
17133
17161
|
pushPy(out, "pipx", [...spec, ...operands(words, v + 1, PIPX_VALUE_FLAGS)]);
|
|
17134
17162
|
else if (verb === "run")
|
|
@@ -17149,7 +17177,16 @@ function fromCall(words, out, depth) {
|
|
|
17149
17177
|
return;
|
|
17150
17178
|
}
|
|
17151
17179
|
if (verb === "run") {
|
|
17152
|
-
pushPy(
|
|
17180
|
+
pushPy(
|
|
17181
|
+
out,
|
|
17182
|
+
"uv run",
|
|
17183
|
+
flagValues(
|
|
17184
|
+
words,
|
|
17185
|
+
v + 1,
|
|
17186
|
+
["--with", "--with-editable"],
|
|
17187
|
+
verbIndex(words, v + 1, UV_VALUE_FLAGS)
|
|
17188
|
+
)
|
|
17189
|
+
);
|
|
17153
17190
|
return;
|
|
17154
17191
|
}
|
|
17155
17192
|
const v2 = verbIndex(words, v + 1, UV_VALUE_FLAGS);
|
package/dist/index.mjs
CHANGED
|
@@ -16085,6 +16085,8 @@ function parseNpmSpec(raw) {
|
|
|
16085
16085
|
return { name, version: exact ? exact[1] : void 0 };
|
|
16086
16086
|
}
|
|
16087
16087
|
var NPM_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
16088
|
+
"--package",
|
|
16089
|
+
// `npm --package=<pkg> exec <cmd>`: read by the exec branch
|
|
16088
16090
|
"--registry",
|
|
16089
16091
|
"--prefix",
|
|
16090
16092
|
"--cache",
|
|
@@ -16106,6 +16108,8 @@ var NPM_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
16106
16108
|
"--libc"
|
|
16107
16109
|
]);
|
|
16108
16110
|
var PNPM_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
16111
|
+
"--package",
|
|
16112
|
+
// `pnpm --package=<pkg> dlx <cmd>`: read by the dlx branch
|
|
16109
16113
|
"--registry",
|
|
16110
16114
|
"-C",
|
|
16111
16115
|
"--dir",
|
|
@@ -16321,9 +16325,10 @@ function operands(words, from, valueFlags) {
|
|
|
16321
16325
|
}
|
|
16322
16326
|
return out;
|
|
16323
16327
|
}
|
|
16324
|
-
function flagValues(words, from, names) {
|
|
16328
|
+
function flagValues(words, from, names, until = words.length) {
|
|
16325
16329
|
const out = [];
|
|
16326
|
-
|
|
16330
|
+
const end = until < 0 ? words.length : Math.min(until, words.length);
|
|
16331
|
+
for (let i = from; i >= 0 && i < end; i++) {
|
|
16327
16332
|
const w = words[i];
|
|
16328
16333
|
if (w === null) continue;
|
|
16329
16334
|
for (const n of names) {
|
|
@@ -16731,8 +16736,9 @@ function pushPy(out, manager, specs, limit = Infinity) {
|
|
|
16731
16736
|
n++;
|
|
16732
16737
|
}
|
|
16733
16738
|
}
|
|
16734
|
-
function npxPackages(words, from) {
|
|
16735
|
-
const explicit =
|
|
16739
|
+
function npxPackages(words, from, before = []) {
|
|
16740
|
+
const explicit = [...before];
|
|
16741
|
+
const take = (v) => explicit.push(...v.split(",").filter((x) => x.length > 0));
|
|
16736
16742
|
for (let i = from; i >= 0 && i < words.length; i++) {
|
|
16737
16743
|
const w = words[i];
|
|
16738
16744
|
if (w === null) return explicit;
|
|
@@ -16741,7 +16747,14 @@ function npxPackages(words, from) {
|
|
|
16741
16747
|
return explicit.length > 0 ? explicit : next ? [next] : [];
|
|
16742
16748
|
}
|
|
16743
16749
|
if (w.startsWith("-")) {
|
|
16744
|
-
if (w === "-p" || w === "--package"
|
|
16750
|
+
if (w === "-p" || w === "--package") {
|
|
16751
|
+
const v = words[i + 1];
|
|
16752
|
+
if (typeof v === "string") take(v);
|
|
16753
|
+
i++;
|
|
16754
|
+
} else if (w.startsWith("-p=") || w.startsWith("--package="))
|
|
16755
|
+
take(w.slice(w.indexOf("=") + 1));
|
|
16756
|
+
else if (w === "-c" || w === "--call")
|
|
16757
|
+
i++;
|
|
16745
16758
|
else if (takesValue(w, NPM_VALUE_FLAGS)) i++;
|
|
16746
16759
|
continue;
|
|
16747
16760
|
}
|
|
@@ -16750,9 +16763,9 @@ function npxPackages(words, from) {
|
|
|
16750
16763
|
return explicit;
|
|
16751
16764
|
}
|
|
16752
16765
|
function uvxPackages(words, from) {
|
|
16753
|
-
const from_ = flagValues(words, from, ["--from"]);
|
|
16754
|
-
const withs = flagValues(words, from, ["--with"]);
|
|
16755
16766
|
const first = verbIndex(words, from, UV_VALUE_FLAGS);
|
|
16767
|
+
const from_ = flagValues(words, from, ["--from"], first);
|
|
16768
|
+
const withs = flagValues(words, from, ["--with"], first);
|
|
16756
16769
|
const tool = first >= 0 && from_.length === 0 ? [words[first]] : [];
|
|
16757
16770
|
return [...from_, ...tool, ...withs];
|
|
16758
16771
|
}
|
|
@@ -16795,7 +16808,12 @@ function fromCall(words, out, depth) {
|
|
|
16795
16808
|
const verb = lower(words[v]);
|
|
16796
16809
|
if (v < 0) return;
|
|
16797
16810
|
if (NPM_INSTALL_VERBS.has(verb)) pushNpm(out, "npm", operands(words, v + 1, NPM_VALUE_FLAGS));
|
|
16798
|
-
else if (NPM_EXEC_VERBS.has(verb))
|
|
16811
|
+
else if (NPM_EXEC_VERBS.has(verb)) {
|
|
16812
|
+
const before = flagValues(words, start + 1, ["--package"], v);
|
|
16813
|
+
const sep = words.indexOf("--", v + 1);
|
|
16814
|
+
const after = flagValues(words, v + 1, ["--package"], sep < 0 ? words.length : sep);
|
|
16815
|
+
pushNpm(out, "npm exec", [.../* @__PURE__ */ new Set([...npxPackages(words, v + 1, before), ...after])]);
|
|
16816
|
+
}
|
|
16799
16817
|
return;
|
|
16800
16818
|
}
|
|
16801
16819
|
case "npx":
|
|
@@ -16807,7 +16825,12 @@ function fromCall(words, out, depth) {
|
|
|
16807
16825
|
if (v < 0) return;
|
|
16808
16826
|
if (PNPM_INSTALL_VERBS.has(verb))
|
|
16809
16827
|
pushNpm(out, "pnpm", operands(words, v + 1, PNPM_VALUE_FLAGS));
|
|
16810
|
-
else if (DLX_VERBS.has(verb))
|
|
16828
|
+
else if (DLX_VERBS.has(verb))
|
|
16829
|
+
pushNpm(
|
|
16830
|
+
out,
|
|
16831
|
+
"pnpm dlx",
|
|
16832
|
+
npxPackages(words, v + 1, flagValues(words, start + 1, ["--package"], v))
|
|
16833
|
+
);
|
|
16811
16834
|
return;
|
|
16812
16835
|
}
|
|
16813
16836
|
case "yarn": {
|
|
@@ -16861,7 +16884,12 @@ function fromCall(words, out, depth) {
|
|
|
16861
16884
|
const v = verbIndex(words, start + 1, PIPX_VALUE_FLAGS);
|
|
16862
16885
|
const verb = lower(words[v]);
|
|
16863
16886
|
if (v < 0) return;
|
|
16864
|
-
const spec = flagValues(
|
|
16887
|
+
const spec = flagValues(
|
|
16888
|
+
words,
|
|
16889
|
+
v + 1,
|
|
16890
|
+
["--spec"],
|
|
16891
|
+
verb === "run" ? verbIndex(words, v + 1, PIPX_VALUE_FLAGS) : words.length
|
|
16892
|
+
);
|
|
16865
16893
|
if (verb === "install")
|
|
16866
16894
|
pushPy(out, "pipx", [...spec, ...operands(words, v + 1, PIPX_VALUE_FLAGS)]);
|
|
16867
16895
|
else if (verb === "run")
|
|
@@ -16882,7 +16910,16 @@ function fromCall(words, out, depth) {
|
|
|
16882
16910
|
return;
|
|
16883
16911
|
}
|
|
16884
16912
|
if (verb === "run") {
|
|
16885
|
-
pushPy(
|
|
16913
|
+
pushPy(
|
|
16914
|
+
out,
|
|
16915
|
+
"uv run",
|
|
16916
|
+
flagValues(
|
|
16917
|
+
words,
|
|
16918
|
+
v + 1,
|
|
16919
|
+
["--with", "--with-editable"],
|
|
16920
|
+
verbIndex(words, v + 1, UV_VALUE_FLAGS)
|
|
16921
|
+
)
|
|
16922
|
+
);
|
|
16886
16923
|
return;
|
|
16887
16924
|
}
|
|
16888
16925
|
const v2 = verbIndex(words, v + 1, UV_VALUE_FLAGS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/policy-engine",
|
|
3
|
-
"version": "2.64.
|
|
3
|
+
"version": "2.64.1",
|
|
4
4
|
"description": "Shared policy evaluation engine for node9 — DLP, smart rules, AST shell parsing, shields, loop detection. Pure functions, no I/O. Used by both node9-proxy and the node9 SaaS firewall.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://node9.ai",
|