@dev-pi2pie/word-counter 0.1.6-canary.1 → 0.1.6
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/README.md +6 -0
- package/dist/esm/bin.mjs +11 -3
- package/dist/esm/detector.d.mts +1 -1
- package/dist/esm/index.d.mts +7 -7
- package/dist/esm/index2.d.mts +1 -1
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ Inspect detector behavior without count output:
|
|
|
111
111
|
```bash
|
|
112
112
|
word-counter inspect "こんにちは、世界!これはテストです。"
|
|
113
113
|
word-counter inspect --detector wasm --view engine "This sentence should clearly be detected as English for the wasm detector path."
|
|
114
|
+
word-counter inspect --detector wasm --view engine --content-gate strict "Readers understand this behavior."
|
|
114
115
|
word-counter inspect --detector regex -f json "こんにちは、世界!これはテストです。"
|
|
115
116
|
word-counter inspect --detector regex -f json --pretty "こんにちは、世界!これはテストです。"
|
|
116
117
|
word-counter inspect --detector wasm --content-gate off "mode: debug\ntee: true\npath: logs\nUse this for testing."
|
|
@@ -144,6 +145,11 @@ Detector mode notes:
|
|
|
144
145
|
- Technical-noise-heavy Latin windows stay conservative and may remain `und-Latn` even when the detector produces a wrong-but-confident language guess.
|
|
145
146
|
- inspect/debug disclosure uses `contentGate` as the canonical gate field.
|
|
146
147
|
- legacy debug/evidence payloads still emit `qualityGate` as a compatibility alias derived from `contentGate.passed`.
|
|
148
|
+
- `inspect --view engine` stays raw:
|
|
149
|
+
- it shows the detector sample plus raw/normalized/remapped Whatlang output
|
|
150
|
+
- it does not apply `eligibility` or `contentGate` policy decisions
|
|
151
|
+
- if engine view uses an explicit or effective non-default content-gate mode, the CLI emits a cyan info note and points to `--view pipeline`
|
|
152
|
+
- `inspect --view pipeline` is the inspect surface for `eligibility`, `contentGate`, acceptance, and fallback reasoning.
|
|
147
153
|
- for practical verification, use `inspect` to compare direct mode outcomes across `default`, `strict`, `loose`, and `off`; use `--debug --detector-evidence` when you specifically need counting-flow event details or legacy `qualityGate` compatibility
|
|
148
154
|
- `word-counter inspect` supports:
|
|
149
155
|
- positional text input
|
package/dist/esm/bin.mjs
CHANGED
|
@@ -1271,7 +1271,7 @@ function meetsRequiredNodeVersion(version) {
|
|
|
1271
1271
|
return version.patch >= REQUIRED_NODE_VERSION.patch;
|
|
1272
1272
|
}
|
|
1273
1273
|
function resolveRuntimeSummary(overrides = {}) {
|
|
1274
|
-
const packageVersion = normalizePackageVersion(overrides.packageVersion ?? "0.1.6
|
|
1274
|
+
const packageVersion = normalizePackageVersion(overrides.packageVersion ?? "0.1.6");
|
|
1275
1275
|
const nodeVersion = overrides.nodeVersion ?? process.version;
|
|
1276
1276
|
const parsedNodeVersion = parseNodeVersion(nodeVersion);
|
|
1277
1277
|
return {
|
|
@@ -4968,7 +4968,7 @@ const INSPECT_HELP_LINES = [
|
|
|
4968
4968
|
"",
|
|
4969
4969
|
"Options:",
|
|
4970
4970
|
" -d, --detector <mode> inspect detector mode (wasm, regex) (default: regex)",
|
|
4971
|
-
" --content-gate <mode> content gate mode (default, strict, loose, off) (default: default)",
|
|
4971
|
+
" --content-gate <mode> content gate mode for pipeline policy inspection (default, strict, loose, off) (default: default)",
|
|
4972
4972
|
" --view <view> inspect view (pipeline, engine) (default: pipeline)",
|
|
4973
4973
|
" -f, --format <format> inspect output format (standard, json) (default: standard)",
|
|
4974
4974
|
" --pretty pretty print inspect JSON output",
|
|
@@ -5223,6 +5223,13 @@ function emitConfigNotes$1(notes) {
|
|
|
5223
5223
|
console.error(import_picocolors.default.yellow(warningLine));
|
|
5224
5224
|
}
|
|
5225
5225
|
}
|
|
5226
|
+
function shouldEmitEngineContentGateInfo(validated) {
|
|
5227
|
+
if (validated.view !== "engine" || validated.detector !== "wasm") return false;
|
|
5228
|
+
return validated.sources.contentGate || validated.contentGateMode !== "default";
|
|
5229
|
+
}
|
|
5230
|
+
function emitEngineContentGateInfo() {
|
|
5231
|
+
console.error(import_picocolors.default.cyan("Info: `--content-gate` does not affect `inspect --view engine`; engine view shows raw detector output. Use `--view pipeline` to inspect eligibility and content-gate restrictions."));
|
|
5232
|
+
}
|
|
5226
5233
|
async function executeInspectCommand({ argv, runtime }) {
|
|
5227
5234
|
const parsed = validateInspectInvocation(argv);
|
|
5228
5235
|
if (!parsed.ok) {
|
|
@@ -5254,6 +5261,7 @@ async function executeInspectCommand({ argv, runtime }) {
|
|
|
5254
5261
|
process.exitCode = 1;
|
|
5255
5262
|
return;
|
|
5256
5263
|
}
|
|
5264
|
+
if (shouldEmitEngineContentGateInfo(validated)) emitEngineContentGateInfo();
|
|
5257
5265
|
try {
|
|
5258
5266
|
if (validated.paths.length === 0) {
|
|
5259
5267
|
const input = await loadSingleInspectInput(void 0, validated.textTokens, validated.section);
|
|
@@ -5362,7 +5370,7 @@ function normalizeVersion(value) {
|
|
|
5362
5370
|
return trimmed;
|
|
5363
5371
|
}
|
|
5364
5372
|
function resolvePackageVersion(options = {}) {
|
|
5365
|
-
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.1.6
|
|
5373
|
+
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.1.6");
|
|
5366
5374
|
if (embeddedVersion) return embeddedVersion;
|
|
5367
5375
|
const maxLevels = options.maxLevels ?? 8;
|
|
5368
5376
|
const resolveFromPath = options.resolveFromPath ?? resolveVersionFromPath;
|
package/dist/esm/detector.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as WordCounterOptions, c as SectionedResult, g as LocaleChunk, m as LocaleDetectOptions, s as SectionMode, x as WordCounterResult, y as WordCounterMode } from "./index.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/detector/policy.d.ts
|
|
4
4
|
type DetectorContentGatePolicy = "latinProse" | "none";
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -113,12 +113,6 @@ declare const DEFAULT_LATIN_HINT_RULES: ReadonlyArray<Readonly<LatinHintRule>>;
|
|
|
113
113
|
//#region src/wc/wc.d.ts
|
|
114
114
|
declare function wordCounter(text: string, options?: WordCounterOptions): WordCounterResult;
|
|
115
115
|
//#endregion
|
|
116
|
-
//#region src/utils/append-all.d.ts
|
|
117
|
-
declare function appendAll<T>(target: T[], source: readonly T[]): void;
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/utils/show-singular-or-plural-word.d.ts
|
|
120
|
-
declare function showSingularOrPluralWord(count: number, word: string): string;
|
|
121
|
-
//#endregion
|
|
122
116
|
//#region src/markdown/types.d.ts
|
|
123
117
|
type FrontmatterType = "yaml" | "toml" | "json";
|
|
124
118
|
interface ParsedMarkdown {
|
|
@@ -145,4 +139,10 @@ declare function parseMarkdown(input: string): ParsedMarkdown;
|
|
|
145
139
|
//#region src/markdown/section-count.d.ts
|
|
146
140
|
declare function countSections(input: string, section: SectionMode, options?: WordCounterOptions): SectionedResult;
|
|
147
141
|
//#endregion
|
|
148
|
-
|
|
142
|
+
//#region src/utils/append-all.d.ts
|
|
143
|
+
declare function appendAll<T>(target: T[], source: readonly T[]): void;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/utils/show-singular-or-plural-word.d.ts
|
|
146
|
+
declare function showSingularOrPluralWord(count: number, word: string): string;
|
|
147
|
+
//#endregion
|
|
148
|
+
export { NonWordCollection as _, FrontmatterType as a, WordCounterOptions as b, SectionedResult as c, countCharsForLocale as d, countWordsForLocale as f, LocaleChunk as g, LatinHintRule as h, parseMarkdown as i, wordCounter as l, LocaleDetectOptions as m, appendAll as n, ParsedMarkdown as o, segmentTextByLocale as p, countSections as r, SectionMode as s, showSingularOrPluralWord as t, DEFAULT_LATIN_HINT_RULES as u, WordCounterBreakdown as v, WordCounterResult as x, WordCounterMode as y };
|
package/dist/esm/index2.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as NonWordCollection, a as
|
|
1
|
+
import { _ as NonWordCollection, a as FrontmatterType, b as WordCounterOptions, c as SectionedResult, d as countCharsForLocale, f as countWordsForLocale, h as LatinHintRule, i as parseMarkdown, l as wordCounter, n as appendAll, o as ParsedMarkdown, p as segmentTextByLocale, r as countSections, s as SectionMode, t as showSingularOrPluralWord, u as DEFAULT_LATIN_HINT_RULES, v as WordCounterBreakdown, x as WordCounterResult, y as WordCounterMode } from "./index.mjs";
|
|
2
2
|
export { DEFAULT_LATIN_HINT_RULES, FrontmatterType, LatinHintRule, NonWordCollection, ParsedMarkdown, SectionMode, SectionedResult, WordCounterBreakdown, WordCounterMode, WordCounterOptions, WordCounterResult, appendAll, countCharsForLocale, countSections, countWordsForLocale, wordCounter as default, wordCounter, parseMarkdown, segmentTextByLocale, showSingularOrPluralWord };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-pi2pie/word-counter",
|
|
3
|
-
"version": "0.1.6
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cli",
|
|
6
6
|
"intl-segmenter",
|
|
@@ -71,9 +71,6 @@
|
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"typescript": "^5 || ^6"
|
|
73
73
|
},
|
|
74
|
-
"overrides": {
|
|
75
|
-
"picomatch": "4.0.4"
|
|
76
|
-
},
|
|
77
74
|
"engines": {
|
|
78
75
|
"node": ">=22.18.0"
|
|
79
76
|
}
|