@inthedark/dxlint 0.1.9 → 0.1.11
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/bin/dxlint-darwin-arm64 +0 -0
- package/bin/dxlint-linux-x64 +0 -0
- package/bin/dxlint-win32-x64.exe +0 -0
- package/package.json +5 -3
- package/std/core/frozen.dx +44 -0
- package/std/core.dx +1 -0
|
Binary file
|
package/bin/dxlint-linux-x64
CHANGED
|
Binary file
|
package/bin/dxlint-win32-x64.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inthedark/dxlint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "let you and your agents own your linter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"os": [
|
|
26
26
|
"win32",
|
|
27
|
-
"linux"
|
|
27
|
+
"linux",
|
|
28
|
+
"darwin"
|
|
28
29
|
],
|
|
29
30
|
"cpu": [
|
|
30
|
-
"x64"
|
|
31
|
+
"x64",
|
|
32
|
+
"arm64"
|
|
31
33
|
],
|
|
32
34
|
"bin": {
|
|
33
35
|
"dxlint": "bin/dxlint"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# .core/frozen: files sealed against change. A comment line holding
|
|
2
|
+
# `dxlint-frozen <hash>` seals the rest of the file: the hash covers every
|
|
3
|
+
# other line (line breaks as LF, no BOM), so any edit outside it shows.
|
|
4
|
+
# `dxlint-frozen <command> [args...] <hash>` seals what a command the root
|
|
5
|
+
# config declares prints for those arguments instead.
|
|
6
|
+
@macro frozen_seal_start /(?m)^[ \t]*(?:\/\/|#|--|;|\/\*|<!--)[ \t]*dxlint-frozen\b/
|
|
7
|
+
|
|
8
|
+
define {
|
|
9
|
+
fn frozen_hash(text) = fnv_hash(replace(re_replace(text, /^\u{FEFF}/, ""), "\r\n", "\n"))
|
|
10
|
+
|
|
11
|
+
in .* layer text match frozen_seal /^[ \t]*(?:\/\/|#|--|;|\/\*|<!--)[ \t]*dxlint-frozen\b[^\r\n]*(?:\r?\n|\z)/
|
|
12
|
+
in frozen_seal rule shared-frozen-file {
|
|
13
|
+
# Only the first seal counts; later ones are sealed content.
|
|
14
|
+
when !re_test(byte_slice(source, 0, offset), @frozen_seal_start)
|
|
15
|
+
let line trim_end(text, "\r\n")
|
|
16
|
+
# The line up to its last word, without a block comment's closer.
|
|
17
|
+
let kept re_replace(line, /[ \t]*(?:\*\/|-->)?[ \t]*$/, "")
|
|
18
|
+
let body re_replace(kept, /^.*?dxlint-frozen\b[ \t:]*/, "")
|
|
19
|
+
let words if body == "" then [] else split(re_replace(body, /[ \t]+/, " "), " ")
|
|
20
|
+
let written if re_test(last(words) ?? "", /^[0-9a-f]{16}$/) then last(words) else null
|
|
21
|
+
let named if written == null then words else take(words, count(words) - 1)
|
|
22
|
+
let command first(named)
|
|
23
|
+
let ran if command == null then null else command_output(node, command, drop(named, 1))
|
|
24
|
+
# A command still running: the file is linted again when it finishes.
|
|
25
|
+
when ran == null || ran.state != "pending"
|
|
26
|
+
let sealed when {
|
|
27
|
+
command == null then frozen_hash(byte_slice(source, 0, offset) byte_slice(source, end_offset))
|
|
28
|
+
ran.state == "ready" then frozen_hash(ran.output)
|
|
29
|
+
else then null
|
|
30
|
+
}
|
|
31
|
+
when sealed == null || written != sealed
|
|
32
|
+
let line_span { start: offset, end: offset + byte_len(line) }
|
|
33
|
+
let hash_span { start: offset + byte_len(kept) - 16, end: offset + byte_len(kept) }
|
|
34
|
+
report at line_span
|
|
35
|
+
warn when {
|
|
36
|
+
ran.state == "failed" then "Command `{command}` failed: {ran.message}"
|
|
37
|
+
ran.state == "disabled" then "Commands are off in this workspace, so this seal is not checked."
|
|
38
|
+
written == null then "Frozen file has no hash yet."
|
|
39
|
+
else then "Frozen file changed since it was sealed."
|
|
40
|
+
}
|
|
41
|
+
fix at line_span if sealed != null && written == null as kept " " sealed byte_slice(line, byte_len(kept))
|
|
42
|
+
suggest "Seal the file as it is now" at hash_span if sealed != null && written != null as sealed
|
|
43
|
+
}
|
|
44
|
+
}
|
package/std/core.dx
CHANGED