text-sanctifier 1.3.8 → 1.3.10
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/ADDITIONAL_TERMS.md +122 -122
- package/LICENSE +694 -694
- package/README.md +440 -437
- package/bin/text-sanctifier.js +122 -42
- package/dist/text-sanctifier.min.js +1 -1
- package/dist/types/hiddenScan.d.ts +30 -0
- package/dist/types/hiddenText.d.ts +44 -1
- package/dist/types/sanctifyText.d.ts +1 -1
- package/dist/types/version.generated.d.ts +1 -1
- package/package.json +89 -83
- package/robots.txt +79 -79
- package/src/hiddenScan.js +171 -0
- package/src/hiddenText.js +96 -233
- package/src/index.d.ts +22 -22
- package/src/index.js +29 -29
- package/src/sanctifyText.js +4 -4
- package/src/version.generated.js +5 -5
package/src/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { inspectText } from './inspectText.js';
|
|
2
|
-
import { inspectTextDetailed } from './inspectText.js';
|
|
3
|
-
import { getNewlineStats } from './inspectText.js';
|
|
4
|
-
import { getRecommendedSanctifierOptions } from './inspectText.js';
|
|
5
|
-
import { summonSanctifier } from './sanctifyText.js';
|
|
6
|
-
import { sanctifyStrict } from './sanctifyText.js';
|
|
7
|
-
import { sanctifyLoose } from './sanctifyText.js';
|
|
8
|
-
import { sanctifyKeyboardOnlyEmoji } from './sanctifyText.js';
|
|
9
|
-
import { sanctifyKeyboardOnly } from './sanctifyText.js';
|
|
10
|
-
import { sanctifyPasted } from './sanctifyText.js';
|
|
11
|
-
import { revealInvisible } from './reveal.js';
|
|
12
|
-
import { VERSION } from './version.generated.js';
|
|
13
|
-
export { inspectText, inspectTextDetailed, getNewlineStats, getRecommendedSanctifierOptions, summonSanctifier, sanctifyStrict, sanctifyLoose, sanctifyKeyboardOnlyEmoji, sanctifyKeyboardOnly, sanctifyPasted, revealInvisible, VERSION };
|
|
14
|
-
export type UnicodeTrashReport = import('./inspectText.js').UnicodeTrashReport;
|
|
15
|
-
export type TrashCategory = import('./inspectText.js').TrashCategory;
|
|
16
|
-
export type TrashFinding = import('./inspectText.js').TrashFinding;
|
|
17
|
-
export type TrashCounts = import('./inspectText.js').TrashCounts;
|
|
18
|
-
export type DetailedTrashReport = import('./inspectText.js').DetailedTrashReport;
|
|
19
|
-
export type InspectDetailedOptions = import('./inspectText.js').InspectDetailedOptions;
|
|
20
|
-
export type NewlineStats = import('./inspectText.js').NewlineStats;
|
|
21
|
-
export type SanctifyOptions = import('./sanctifyText.js').SanctifyOptions;
|
|
22
|
-
export type RevealOptions = import('./reveal.js').RevealOptions;
|
|
1
|
+
import { inspectText } from './inspectText.js';
|
|
2
|
+
import { inspectTextDetailed } from './inspectText.js';
|
|
3
|
+
import { getNewlineStats } from './inspectText.js';
|
|
4
|
+
import { getRecommendedSanctifierOptions } from './inspectText.js';
|
|
5
|
+
import { summonSanctifier } from './sanctifyText.js';
|
|
6
|
+
import { sanctifyStrict } from './sanctifyText.js';
|
|
7
|
+
import { sanctifyLoose } from './sanctifyText.js';
|
|
8
|
+
import { sanctifyKeyboardOnlyEmoji } from './sanctifyText.js';
|
|
9
|
+
import { sanctifyKeyboardOnly } from './sanctifyText.js';
|
|
10
|
+
import { sanctifyPasted } from './sanctifyText.js';
|
|
11
|
+
import { revealInvisible } from './reveal.js';
|
|
12
|
+
import { VERSION } from './version.generated.js';
|
|
13
|
+
export { inspectText, inspectTextDetailed, getNewlineStats, getRecommendedSanctifierOptions, summonSanctifier, sanctifyStrict, sanctifyLoose, sanctifyKeyboardOnlyEmoji, sanctifyKeyboardOnly, sanctifyPasted, revealInvisible, VERSION };
|
|
14
|
+
export type UnicodeTrashReport = import('./inspectText.js').UnicodeTrashReport;
|
|
15
|
+
export type TrashCategory = import('./inspectText.js').TrashCategory;
|
|
16
|
+
export type TrashFinding = import('./inspectText.js').TrashFinding;
|
|
17
|
+
export type TrashCounts = import('./inspectText.js').TrashCounts;
|
|
18
|
+
export type DetailedTrashReport = import('./inspectText.js').DetailedTrashReport;
|
|
19
|
+
export type InspectDetailedOptions = import('./inspectText.js').InspectDetailedOptions;
|
|
20
|
+
export type NewlineStats = import('./inspectText.js').NewlineStats;
|
|
21
|
+
export type SanctifyOptions = import('./sanctifyText.js').SanctifyOptions;
|
|
22
|
+
export type RevealOptions = import('./reveal.js').RevealOptions;
|
package/src/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
// src/index.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { inspectText, inspectTextDetailed, getNewlineStats, getRecommendedSanctifierOptions } from './inspectText.js';
|
|
5
|
-
export { inspectText, inspectTextDetailed, getNewlineStats, getRecommendedSanctifierOptions };
|
|
6
|
-
|
|
7
|
-
import { summonSanctifier, sanctifyStrict, sanctifyLoose, sanctifyKeyboardOnlyEmoji, sanctifyKeyboardOnly, sanctifyPasted } from './sanctifyText.js';
|
|
8
|
-
export { summonSanctifier, sanctifyStrict, sanctifyLoose, sanctifyKeyboardOnlyEmoji, sanctifyKeyboardOnly, sanctifyPasted };
|
|
9
|
-
|
|
10
|
-
import { revealInvisible } from './reveal.js';
|
|
11
|
-
export { revealInvisible };
|
|
12
|
-
|
|
13
|
-
import { VERSION } from './version.generated.js';
|
|
14
|
-
export { VERSION };
|
|
15
|
-
|
|
16
|
-
// Type-only re-exports so TypeScript consumers can name these from the package root.
|
|
17
|
-
/** @typedef {import('./inspectText.js').UnicodeTrashReport} UnicodeTrashReport */
|
|
18
|
-
/** @typedef {import('./inspectText.js').TrashCategory} TrashCategory */
|
|
19
|
-
/** @typedef {import('./inspectText.js').TrashFinding} TrashFinding */
|
|
20
|
-
/** @typedef {import('./inspectText.js').TrashCounts} TrashCounts */
|
|
21
|
-
/** @typedef {import('./inspectText.js').DetailedTrashReport} DetailedTrashReport */
|
|
22
|
-
/** @typedef {import('./inspectText.js').InspectDetailedOptions} InspectDetailedOptions */
|
|
23
|
-
/** @typedef {import('./inspectText.js').NewlineStats} NewlineStats */
|
|
24
|
-
/** @typedef {import('./sanctifyText.js').SanctifyOptions} SanctifyOptions */
|
|
25
|
-
/** @typedef {import('./reveal.js').RevealOptions} RevealOptions */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// In Future: export helpers for power users
|
|
29
|
-
// export { purgeInvisibleTrash, purgeEmojisCharacters, normalizeNewlines, trimSpacesAroundNewlines, collapseParagraphs, collapseExtraSpaces, purgeControlCharacters } from './sanctifyText.js';
|
|
1
|
+
// src/index.js
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { inspectText, inspectTextDetailed, getNewlineStats, getRecommendedSanctifierOptions } from './inspectText.js';
|
|
5
|
+
export { inspectText, inspectTextDetailed, getNewlineStats, getRecommendedSanctifierOptions };
|
|
6
|
+
|
|
7
|
+
import { summonSanctifier, sanctifyStrict, sanctifyLoose, sanctifyKeyboardOnlyEmoji, sanctifyKeyboardOnly, sanctifyPasted } from './sanctifyText.js';
|
|
8
|
+
export { summonSanctifier, sanctifyStrict, sanctifyLoose, sanctifyKeyboardOnlyEmoji, sanctifyKeyboardOnly, sanctifyPasted };
|
|
9
|
+
|
|
10
|
+
import { revealInvisible } from './reveal.js';
|
|
11
|
+
export { revealInvisible };
|
|
12
|
+
|
|
13
|
+
import { VERSION } from './version.generated.js';
|
|
14
|
+
export { VERSION };
|
|
15
|
+
|
|
16
|
+
// Type-only re-exports so TypeScript consumers can name these from the package root.
|
|
17
|
+
/** @typedef {import('./inspectText.js').UnicodeTrashReport} UnicodeTrashReport */
|
|
18
|
+
/** @typedef {import('./inspectText.js').TrashCategory} TrashCategory */
|
|
19
|
+
/** @typedef {import('./inspectText.js').TrashFinding} TrashFinding */
|
|
20
|
+
/** @typedef {import('./inspectText.js').TrashCounts} TrashCounts */
|
|
21
|
+
/** @typedef {import('./inspectText.js').DetailedTrashReport} DetailedTrashReport */
|
|
22
|
+
/** @typedef {import('./inspectText.js').InspectDetailedOptions} InspectDetailedOptions */
|
|
23
|
+
/** @typedef {import('./inspectText.js').NewlineStats} NewlineStats */
|
|
24
|
+
/** @typedef {import('./sanctifyText.js').SanctifyOptions} SanctifyOptions */
|
|
25
|
+
/** @typedef {import('./reveal.js').RevealOptions} RevealOptions */
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// In Future: export helpers for power users
|
|
29
|
+
// export { purgeInvisibleTrash, purgeEmojisCharacters, normalizeNewlines, trimSpacesAroundNewlines, collapseParagraphs, collapseExtraSpaces, purgeControlCharacters } from './sanctifyText.js';
|
package/src/sanctifyText.js
CHANGED
|
@@ -278,7 +278,7 @@ export const summonSanctifier = /* @__PURE__ */ Object.assign(createSanctifier,
|
|
|
278
278
|
* Brutal text normalizer and invisible trash scrubber,
|
|
279
279
|
* configurable to kill whatever ghosts you want dead.
|
|
280
280
|
*
|
|
281
|
-
*
|
|
281
|
+
* Note: This is plain-text normalization/filtering — not an HTML/XSS sanitizer.
|
|
282
282
|
*
|
|
283
283
|
* @param {string} text
|
|
284
284
|
* @param {boolean} [purgeInvisibleChars=false] - Remove ZWSP, NBSP, bidi, tags, variation selectors, etc.
|
|
@@ -413,8 +413,8 @@ function purgeInvisibleTrash(text) {
|
|
|
413
413
|
* Uses the global `EMOJI_REGEX` to match full emoji grapheme sequences,
|
|
414
414
|
* including:
|
|
415
415
|
* - Extended pictographic characters
|
|
416
|
-
* - Zero-width joiner (ZWJ) sequences (e.g.
|
|
417
|
-
* - Variation Selector-16 (VS16) emoji presentation forms (e.g.
|
|
416
|
+
* - Zero-width joiner (ZWJ) sequences (e.g. U+1F468 U+200D U+1F469 U+200D U+1F467 U+200D U+1F466)
|
|
417
|
+
* - Variation Selector-16 (VS16) emoji presentation forms (e.g. U+270C U+FE0F, U+203C U+FE0F)
|
|
418
418
|
*
|
|
419
419
|
* Any non-emoji characters are ignored.
|
|
420
420
|
*
|
|
@@ -451,7 +451,7 @@ function purgeNonKeyboardChars(text, purgeEmojis = false) {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
// Replace each non-ASCII run with ONLY the emoji sequences inside it.
|
|
454
|
-
// This preserves ZWJ sequences and VS16 variants (e.g.
|
|
454
|
+
// This preserves ZWJ sequences and VS16 variants (e.g. the family emoji, U+270C U+FE0F, U+203C U+FE0F),
|
|
455
455
|
// while dropping non-emoji non-ASCII (e.g. 𝌆).
|
|
456
456
|
return normalized.replace(ASCII_KEYBOARD_SAFE_REGEX, (run) => extractEmojiSequences(run));
|
|
457
457
|
}
|
package/src/version.generated.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/version.generated.js
|
|
2
|
-
// Generated from package.json by scripts/gen-version.js (`npm run gen`); do not edit.
|
|
3
|
-
|
|
4
|
-
/** The installed version of text-sanctifier, as in its package.json. */
|
|
5
|
-
export const VERSION = '1.3.
|
|
1
|
+
// src/version.generated.js
|
|
2
|
+
// Generated from package.json by scripts/gen-version.js (`npm run gen`); do not edit.
|
|
3
|
+
|
|
4
|
+
/** The installed version of text-sanctifier, as in its package.json. */
|
|
5
|
+
export const VERSION = '1.3.10';
|