vouchington-tooling 0.68.0 → 0.69.0

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.
Files changed (37) hide show
  1. package/README.md +32 -0
  2. package/dist/cli/commands/docker-image-mirror.d.mts +13 -0
  3. package/dist/cli/commands/docker-image-mirror.mjs +39 -0
  4. package/dist/cli/commands/trivy-policy.d.mts +12 -0
  5. package/dist/cli/commands/trivy-policy.mjs +76 -0
  6. package/dist/cli/index.mjs +4 -0
  7. package/dist/cli/parse-forwarded-commands.d.mts +7 -72
  8. package/dist/cli/parse-forwarded-commands.mjs +30 -49
  9. package/dist/cli/parse.d.mts +6 -0
  10. package/dist/cli/usage-text-policy.d.mts +2 -0
  11. package/dist/cli/usage-text-policy.mjs +25 -0
  12. package/dist/cli/usage-text.d.mts +1 -1
  13. package/dist/cli/usage-text.mjs +3 -6
  14. package/dist/docker-image-mirror/images.d.mts +25 -0
  15. package/dist/docker-image-mirror/images.mjs +108 -0
  16. package/dist/docker-image-mirror/index.d.mts +16 -0
  17. package/dist/docker-image-mirror/index.mjs +39 -0
  18. package/dist/index.d.mts +4 -0
  19. package/dist/index.mjs +2 -0
  20. package/dist/trivy-policy/background.d.mts +1 -0
  21. package/dist/trivy-policy/background.mjs +24 -0
  22. package/dist/trivy-policy/gate.d.mts +5 -0
  23. package/dist/trivy-policy/gate.mjs +92 -0
  24. package/dist/trivy-policy/index.d.mts +15 -0
  25. package/dist/trivy-policy/index.mjs +48 -0
  26. package/dist/trivy-policy/invocations.d.mts +4 -0
  27. package/dist/trivy-policy/invocations.mjs +76 -0
  28. package/dist/trivy-policy/options.d.mts +26 -0
  29. package/dist/trivy-policy/options.mjs +17 -0
  30. package/dist/trivy-policy/registry.d.mts +7 -0
  31. package/dist/trivy-policy/registry.mjs +48 -0
  32. package/dist/trivy-policy/scan.d.mts +5 -0
  33. package/dist/trivy-policy/scan.mjs +59 -0
  34. package/dist/trivy-policy/shell.d.mts +2 -0
  35. package/dist/trivy-policy/shell.mjs +62 -0
  36. package/package.json +11 -1
  37. package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
@@ -0,0 +1,62 @@
1
+ export function withoutShellComment(command) {
2
+ return command
3
+ .replace(/\\\r?\n/g, '')
4
+ .split('\n')
5
+ .map(withoutShellCommentLine)
6
+ .join('\n');
7
+ }
8
+ function withoutShellCommentLine(command) {
9
+ let quote = '';
10
+ for (let index = 0; index < command.length; index++) {
11
+ const character = command[index];
12
+ if (character === '\\' && quote !== "'") {
13
+ index++;
14
+ continue;
15
+ }
16
+ if (quote !== '') {
17
+ if (character === quote)
18
+ quote = '';
19
+ }
20
+ else if (character === '"' || character === "'")
21
+ quote = character;
22
+ else if (character === '#' && (index === 0 || /\s/.test(command[index - 1])))
23
+ return command.slice(0, index);
24
+ }
25
+ return command;
26
+ }
27
+ export function shellSegments(command) {
28
+ const segments = [];
29
+ let quote = '';
30
+ let start = 0;
31
+ for (let index = 0; index < command.length; index++) {
32
+ const character = command[index];
33
+ if (character === '\\' && quote !== "'") {
34
+ index++;
35
+ continue;
36
+ }
37
+ if (quote !== '') {
38
+ if (character === quote)
39
+ quote = '';
40
+ continue;
41
+ }
42
+ if (character === '"' || character === "'") {
43
+ quote = character;
44
+ continue;
45
+ }
46
+ const operatorLength = character === ';' ||
47
+ character === '\n' ||
48
+ character === '|' ||
49
+ (character === '&' && command[index + 1] === '&')
50
+ ? command[index + 1] === character && character !== ';'
51
+ ? 2
52
+ : 1
53
+ : 0;
54
+ if (operatorLength === 0)
55
+ continue;
56
+ segments.push(command.slice(start, index));
57
+ index += operatorLength - 1;
58
+ start = index + 1;
59
+ }
60
+ segments.push(command.slice(start));
61
+ return segments;
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vouchington-tooling",
3
- "version": "0.68.0",
3
+ "version": "0.69.0",
4
4
  "description": "Vouchington CLI and extractable tooling libraries.",
5
5
  "homepage": "https://github.com/vouchington/vouchington-tooling/tree/main/packages/vouchington-tooling#readme",
6
6
  "bugs": {
@@ -321,6 +321,16 @@
321
321
  "import": "./dist/dead-code/index.mjs",
322
322
  "default": "./dist/dead-code/index.mjs"
323
323
  },
324
+ "./trivy-policy": {
325
+ "types": "./dist/trivy-policy/index.d.mts",
326
+ "import": "./dist/trivy-policy/index.mjs",
327
+ "default": "./dist/trivy-policy/index.mjs"
328
+ },
329
+ "./docker-image-mirror": {
330
+ "types": "./dist/docker-image-mirror/index.d.mts",
331
+ "import": "./dist/docker-image-mirror/index.mjs",
332
+ "default": "./dist/docker-image-mirror/index.mjs"
333
+ },
324
334
  "./cloc": {
325
335
  "types": "./dist/cloc/index.d.mts",
326
336
  "import": "./dist/cloc/index.mjs",