@l10nmonster/helpers-json 3.0.1 → 3.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## @l10nmonster/helpers-json [3.0.2](https://public-github/l10nmonster/l10nmonster/compare/@l10nmonster/helpers-json@3.0.1...@l10nmonster/helpers-json@3.0.2) (2025-12-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Improve type definitions and checks ([826b412](https://public-github/l10nmonster/l10nmonster/commit/826b412f0f7e761d404165a243b0c2b26c416ac1))
7
+
8
+
9
+
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * **@l10nmonster/core:** upgraded to 3.1.1
15
+
1
16
  ## @l10nmonster/helpers-json [3.0.1](https://public-github/l10nmonster/l10nmonster/compare/@l10nmonster/helpers-json@3.0.0...@l10nmonster/helpers-json@3.0.1) (2025-12-20)
2
17
 
3
18
 
package/i18next.js CHANGED
@@ -9,6 +9,8 @@ import {
9
9
  parseResourceAnnotations,
10
10
  } from './utils.js';
11
11
 
12
+ /** @typedef {import('@l10nmonster/core').ResourceFilter} ResourceFilter */
13
+
12
14
  const defaultArbAnnotationHandlers = {
13
15
  description: (_, data) => (data == null ? undefined : data),
14
16
  placeholders: (_, data) => (data == null ? undefined : arbPlaceholderHandler(data)),
@@ -18,6 +20,7 @@ const defaultArbAnnotationHandlers = {
18
20
  /**
19
21
  * Filter for i18next v4 JSON format.
20
22
  * @see https://www.i18next.com/misc/json-format
23
+ * @implements {ResourceFilter}
21
24
  */
22
25
  export class I18nextFilter {
23
26
 
@@ -93,7 +96,7 @@ export class I18nextFilter {
93
96
  let firstIndex = -1;
94
97
  for (let i = 0; i < response.segments.length; i++) {
95
98
  if (forms.has(response.segments[i].sid?.split('_').pop()) &&
96
- response.segments[i].sid?.startsWith(baseKey + '_')) {
99
+ response.segments[i].sid?.startsWith(`${baseKey}_`)) {
97
100
  firstIndex = i;
98
101
  break;
99
102
  }
@@ -225,6 +228,7 @@ export class I18nextFilter {
225
228
  // - "keyNesting": "reuse $t(keyDeep.inner)", or
226
229
  // - "keyInterpolate": "replace this {{value}}"
227
230
  // See: https://www.i18next.com/misc/json-format#i18next-json-v4
231
+ /** @type {import('@l10nmonster/core').DecoderFunction} */
228
232
  export const phDecoder = regex.decoderMaker(
229
233
  'i18nextKey',
230
234
  /(?<nestingPh>\$t\([\w:.]+\))|(?<doubleBracePh>{{[^}]+}})/g,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@l10nmonster/helpers-json",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Helpers to deal with JSON file formats",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "scripts": {
8
- "test": "node --test"
8
+ "test": "node --test",
9
+ "typecheck": "tsc --noEmit"
9
10
  },
10
11
  "author": "Diego Lagunas",
11
12
  "license": "MIT",
@@ -13,7 +14,7 @@
13
14
  "flat": "^6"
14
15
  },
15
16
  "peerDependencies": {
16
- "@l10nmonster/core": "3.1.0"
17
+ "@l10nmonster/core": "3.1.1"
17
18
  },
18
19
  "engines": {
19
20
  "node": ">=22.11.0"
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "include": [
4
+ "*.js",
5
+ "**/*.js"
6
+ ],
7
+ "exclude": [
8
+ "node_modules",
9
+ "**/node_modules",
10
+ "test/**",
11
+ "tests/**",
12
+ "**/*.test.js",
13
+ "**/*.spec.js",
14
+ "dist/**",
15
+ "ui/**",
16
+ "types/**"
17
+ ]
18
+ }
package/.releaserc.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "branches": [
3
- "main",
4
- {
5
- "name": "next",
6
- "prerelease": "alpha"
7
- },
8
- {
9
- "name": "beta",
10
- "prerelease": "beta"
11
- }
12
- ],
13
- "tagFormat": "@l10nmonster/helpers-json@${version}",
14
- "plugins": [
15
- "@semantic-release/commit-analyzer",
16
- "@semantic-release/release-notes-generator",
17
- {
18
- "path": "@semantic-release/changelog",
19
- "changelogFile": "CHANGELOG.md"
20
- },
21
- {
22
- "path": "@semantic-release/npm",
23
- "npmPublish": false
24
- },
25
- {
26
- "path": "@semantic-release/git",
27
- "assets": ["CHANGELOG.md", "package.json"],
28
- "message": "chore(release): @l10nmonster/helpers-json@${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
29
- }
30
- ]
31
- }