@wrongstack/plugins 0.307.1 → 0.308.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.
- package/dist/accessibility-auditor/index.d.ts +5 -0
- package/dist/accessibility-auditor.js +67 -11
- package/dist/code-metrics/index.d.ts +9 -0
- package/dist/code-metrics.js +42 -11
- package/dist/dep-guard.js +4 -2
- package/dist/dependency-vulnerability-gate/index.d.ts +4 -0
- package/dist/dependency-vulnerability-gate.js +435 -62
- package/dist/file-watcher.js +25 -10
- package/dist/format-on-save.js +10 -4
- package/dist/import-organizer/index.d.ts +4 -0
- package/dist/import-organizer.js +22 -1
- package/dist/index.js +509 -206
- package/dist/license-audit-gate/index.d.ts +1 -0
- package/dist/license-audit-gate.js +445 -83
- package/dist/lint-gate/index.d.ts +13 -0
- package/dist/lint-gate.js +13 -10
- package/dist/path-guard/glob.d.ts +23 -0
- package/dist/path-guard/index.d.ts +2 -0
- package/dist/path-guard.js +214 -32
- package/dist/prompt-firewall/index.d.ts +7 -0
- package/dist/prompt-firewall.js +92 -2
- package/dist/runtime/h1-state.d.ts +62 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/redos-guard.d.ts +69 -0
- package/dist/runtime/sandbox.d.ts +59 -0
- package/dist/runtime.js +210 -19
- package/dist/secret-scanner.js +16 -2
- package/dist/type-gate.js +33 -3
- package/package.json +3 -3
package/dist/format-on-save.js
CHANGED
|
@@ -328,6 +328,7 @@ async function formatFile(filePath, timeoutMs) {
|
|
|
328
328
|
}
|
|
329
329
|
const formatter = resolveFormatter();
|
|
330
330
|
if (!formatter) return null;
|
|
331
|
+
const started = Date.now();
|
|
331
332
|
let bytesBefore;
|
|
332
333
|
try {
|
|
333
334
|
bytesBefore = (await stat(filePath)).size;
|
|
@@ -372,14 +373,15 @@ async function formatFile(filePath, timeoutMs) {
|
|
|
372
373
|
} catch {
|
|
373
374
|
return null;
|
|
374
375
|
}
|
|
376
|
+
const durationMs = Date.now() - started;
|
|
375
377
|
if (bytesAfter !== bytesBefore) {
|
|
376
|
-
return { changed: true, bytesBefore, bytesAfter };
|
|
378
|
+
return { changed: true, bytesBefore, bytesAfter, durationMs };
|
|
377
379
|
}
|
|
378
380
|
const hashAfter = await sha256File(filePath);
|
|
379
381
|
if (hashBefore === null || hashAfter === null) {
|
|
380
|
-
return { changed: false, bytesBefore, bytesAfter };
|
|
382
|
+
return { changed: false, bytesBefore, bytesAfter, durationMs };
|
|
381
383
|
}
|
|
382
|
-
return { changed: hashBefore !== hashAfter, bytesBefore, bytesAfter };
|
|
384
|
+
return { changed: hashBefore !== hashAfter, bytesBefore, bytesAfter, durationMs };
|
|
383
385
|
}
|
|
384
386
|
var plugin = {
|
|
385
387
|
name: "format-on-save",
|
|
@@ -468,6 +470,7 @@ var plugin = {
|
|
|
468
470
|
changed: result.changed,
|
|
469
471
|
bytesBefore: result.bytesBefore,
|
|
470
472
|
bytesAfter: result.bytesAfter,
|
|
473
|
+
durationMs: result.durationMs,
|
|
471
474
|
when: (/* @__PURE__ */ new Date()).toISOString()
|
|
472
475
|
};
|
|
473
476
|
if (result.changed) {
|
|
@@ -522,7 +525,10 @@ var plugin = {
|
|
|
522
525
|
formatted: state.formattedCount,
|
|
523
526
|
clean: state.cleanCount,
|
|
524
527
|
errors: state.errorCount,
|
|
525
|
-
coveredSkips: state.coveredSkipCount
|
|
528
|
+
coveredSkips: state.coveredSkipCount,
|
|
529
|
+
bytesBefore: state.lastResult?.bytesBefore ?? 0,
|
|
530
|
+
bytesAfter: state.lastResult?.bytesAfter ?? 0,
|
|
531
|
+
durationMs: state.lastResult?.durationMs ?? 0
|
|
526
532
|
},
|
|
527
533
|
lastResult: state.lastResult
|
|
528
534
|
};
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
* @public
|
|
46
46
|
*/
|
|
47
47
|
import type { Plugin } from '@wrongstack/core/types';
|
|
48
|
+
export declare function resolveAllowedCommand(command: string): {
|
|
49
|
+
cmd: string;
|
|
50
|
+
args: string[];
|
|
51
|
+
} | null;
|
|
48
52
|
declare const plugin: Plugin;
|
|
49
53
|
export default plugin;
|
|
50
54
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/import-organizer.js
CHANGED
|
@@ -137,6 +137,20 @@ function resolveAllowedCommand(command) {
|
|
|
137
137
|
const tokens = command.split(/\s+/).filter(Boolean);
|
|
138
138
|
if (tokens.length === 0) return null;
|
|
139
139
|
const head = tokens[0];
|
|
140
|
+
if (PACKAGE_RUNNERS.has(head)) {
|
|
141
|
+
let i = 1;
|
|
142
|
+
while (i < tokens.length && (tokens[i] === "exec" || tokens[i] === "dlx" || tokens[i] === "run")) {
|
|
143
|
+
i++;
|
|
144
|
+
}
|
|
145
|
+
const toolToken = tokens[i];
|
|
146
|
+
if (!toolToken || !(toolToken in LOCAL_BIN_PACKAGES)) return null;
|
|
147
|
+
}
|
|
148
|
+
if (head === "node") {
|
|
149
|
+
const target = tokens[1];
|
|
150
|
+
if (!target) return null;
|
|
151
|
+
const base = basename2(target);
|
|
152
|
+
if (!(base in LOCAL_BIN_PACKAGES) && !ALLOWED_FIRST_TOKENS.has(base)) return null;
|
|
153
|
+
}
|
|
140
154
|
const local = ALLOWED_FIRST_TOKENS.has(head) ? resolveLocalToolCommand(tokens) : null;
|
|
141
155
|
if (local) return local;
|
|
142
156
|
if (ALLOWED_FIRST_TOKENS.has(head)) {
|
|
@@ -374,6 +388,12 @@ var plugin = {
|
|
|
374
388
|
bytesAfter: result.bytesAfter,
|
|
375
389
|
when: (/* @__PURE__ */ new Date()).toISOString()
|
|
376
390
|
};
|
|
391
|
+
if (/\boxlint\b/.test(result.command)) {
|
|
392
|
+
return {
|
|
393
|
+
additionalContext: `
|
|
394
|
+
\u{1F4E6} import-organizer: oxlint has no import-organize support \u2014 ran '${result.command}' as a no-op for import sorting on '${filePath}'.`
|
|
395
|
+
};
|
|
396
|
+
}
|
|
377
397
|
if (result.changed) {
|
|
378
398
|
state.organizedCount += 1;
|
|
379
399
|
const delta = result.bytesAfter - result.bytesBefore;
|
|
@@ -470,5 +490,6 @@ ${result.stderr.trim()}`
|
|
|
470
490
|
};
|
|
471
491
|
var import_organizer_default = plugin;
|
|
472
492
|
export {
|
|
473
|
-
import_organizer_default as default
|
|
493
|
+
import_organizer_default as default,
|
|
494
|
+
resolveAllowedCommand
|
|
474
495
|
};
|