@shrkcrft/compress 0.1.0-alpha.18 → 0.1.0-alpha.20

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.
@@ -1 +1 @@
1
- {"version":3,"file":"detect-content-type.d.ts","sourceRoot":"","sources":["../../src/content/detect-content-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA0FjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAkG5D"}
1
+ {"version":3,"file":"detect-content-type.d.ts","sourceRoot":"","sources":["../../src/content/detect-content-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA0FjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAuG5D"}
@@ -171,13 +171,18 @@ export function detectContentType(text) {
171
171
  if (yamlShaped >= 0.8 && (keyDensity >= 0.3 || blockSeq))
172
172
  return EContentType.Yaml;
173
173
  }
174
- // 6. Markdown — a marker-dense blob, OR a prose doc with ≥2 ATX headers. The
174
+ // 6. Markdown — a marker-dense blob, OR a prose doc with ≥1 ATX header. The
175
175
  // header rule is gated so a commented script (Python/shell `# …` lines, or
176
176
  // a `#!`-shebang file) with low code-syntax density isn't mistaken for a doc.
177
+ // A single `# ` header is enough: ATX headers require a trailing space
178
+ // (`#{1,6}\s`), so a `#!`-shebang never counts, and the `looksLikeScript` +
179
+ // `codeRatio` guards already exclude commented scripts — without the
180
+ // single-header case, an ordinary prose doc (one title + paragraphs) fell
181
+ // through to PlainText and the markdown compressor was never applied.
177
182
  const headerCount = lines.reduce((n, l) => (/^#{1,6}\s/.test(l) ? n + 1 : n), 0);
178
183
  const looksLikeScript = (lines[0] ?? '').startsWith('#!');
179
184
  if (lineHitRatio(lines, MARKDOWN_MARKER) >= 0.3 ||
180
- (headerCount >= 2 && codeRatio < 0.15 && !looksLikeScript)) {
185
+ (headerCount >= 1 && codeRatio < 0.15 && !looksLikeScript)) {
181
186
  return EContentType.Markdown;
182
187
  }
183
188
  return EContentType.PlainText;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@shrkcrft/compress",
3
- "version": "0.1.0-alpha.18",
3
+ "version": "0.1.0-alpha.20",
4
4
  "description": "SharkCraft deterministic context-compression engine: content routing, lossless columnar/table compaction, log/search/diff line reduction, and reversible Compress-Cache-Retrieve (CCR). No model inside — every transform is a pure function of its input.",
5
5
  "license": "MIT",
6
6
  "author": "SharkCraft contributors",
7
7
  "type": "module",
8
8
  "main": "./dist/index.js",
9
- "types": "./dist/index.d.d.ts",
9
+ "types": "./dist/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./dist/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  "typecheck": "tsc --noEmit -p tsconfig.json"
45
45
  },
46
46
  "dependencies": {
47
- "@shrkcrft/core": "^0.1.0-alpha.18"
47
+ "@shrkcrft/core": "^0.1.0-alpha.20"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"