@stll/anonymize-wasm 0.1.0 → 0.1.2

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/wasm.mjs CHANGED
@@ -1,10 +1,7 @@
1
- import { createRequire } from "node:module";
2
1
  import { TextSearch } from "@stll/text-search-wasm";
3
2
  import { at, be, bg, cy, cz, de, dk, ee, es, fi, fr, gb, gr, hr, hu, ie, it, lt, lu, lv, mt, nl, pl, pt, ro, se, si, sk } from "@stll/stdnum";
4
3
  import { toRegex } from "@stll/stdnum/patterns";
5
- //#region \0rolldown/runtime.js
6
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
7
- //#endregion
4
+ import charGroupsJson from "@stll/anonymize-data/config/char-groups.json";
8
5
  //#region src/search-engine.ts
9
6
  let _TextSearch;
10
7
  const initTextSearch = (ctor) => {
@@ -1056,21 +1053,27 @@ const POST_NOMINALS = [
1056
1053
  ];
1057
1054
  //#endregion
1058
1055
  //#region src/util/char-groups.ts
1056
+ /**
1057
+ * Centralized Unicode character equivalence groups.
1058
+ *
1059
+ * Loads char-groups.json from @stll/anonymize-data and
1060
+ * provides helpers to build regex character classes that
1061
+ * match all typographic variants of a character type
1062
+ * (dashes, spaces, quotes, etc.).
1063
+ *
1064
+ * The JSON is statically imported so the bundler inlines
1065
+ * it, avoiding a runtime require() that breaks browsers.
1066
+ */
1059
1067
  /** Chars that need escaping inside a regex char class. */
1060
1068
  const REGEX_CLASS_SPECIAL = /[\\\]^-]/;
1061
1069
  const escapeForCharClass = (ch) => REGEX_CLASS_SPECIAL.test(ch) ? `\\${ch}` : ch;
1062
- let cached;
1063
- const loadConfig = () => {
1064
- if (cached) return cached;
1065
- cached = __require("@stll/anonymize-data/config/char-groups.json");
1066
- return cached;
1067
- };
1070
+ const config = charGroupsJson;
1068
1071
  /**
1069
1072
  * Get the raw characters for a named group.
1070
1073
  * Throws if the group does not exist.
1071
1074
  */
1072
1075
  const charSet = (group) => {
1073
- const g = loadConfig().groups[group];
1076
+ const g = config.groups[group];
1074
1077
  if (!g) throw new Error(`Unknown char group: "${group}"`);
1075
1078
  return g.chars.map((entry) => entry.char);
1076
1079
  };