@dloizides/frontend-devtools 1.10.0 → 2.1.0

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/package.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "name": "@dloizides/frontend-devtools",
3
- "version": "1.10.0",
4
- "description": "Shared RN-web dev tooling for the dloizides.com SaaS frontends: the 17-rule custom ESLint plugin pack (also at the /eslint subpath) and the parameterized initI18n() i18next + react-i18next init factory. Owned shape erevna-web / katalogos-web / kefi-web shared byte-for-byte; never imports a product.",
3
+ "version": "2.1.0",
4
+ "description": "Shared RN-web dev tooling (dev-only) for the dloizides.com SaaS frontends: the custom ESLint plugin pack and rule packs (/eslint) and the test-results reporters (/test-results). initI18n moved to @dloizides/i18n in 2.0.0. Never imports a product.",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslint-plugin",
8
- "i18next",
9
- "react-i18next",
10
8
  "react-native",
11
9
  "dev-tooling",
12
10
  "dloizides"
@@ -26,20 +24,7 @@
26
24
  "README.md",
27
25
  "CHANGELOG.md"
28
26
  ],
29
- "main": "./dist/index.js",
30
- "module": "./dist/index.mjs",
31
- "types": "./dist/index.d.ts",
32
27
  "exports": {
33
- ".": {
34
- "require": {
35
- "types": "./dist/index.d.ts",
36
- "default": "./dist/index.js"
37
- },
38
- "import": {
39
- "types": "./dist/index.d.mts",
40
- "default": "./dist/index.mjs"
41
- }
42
- },
43
28
  "./eslint": {
44
29
  "require": {
45
30
  "types": "./dist/eslint/index.d.ts",
@@ -98,24 +83,16 @@
98
83
  "security:audit": "npm audit --audit-level=high",
99
84
  "deps:outdated": "npm outdated || exit 0",
100
85
  "deps:unused": "npx depcheck --ignores \"@types/jest,@types/node,rimraf,@typescript-eslint/parser\"",
101
- "deps:licenses": "npx license-checker --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD;Unlicense;CC0-1.0\"",
86
+ "deps:licenses": "npx license-checker --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD;Unlicense;CC0-1.0;CC-BY-3.0;CC-BY-4.0;Python-2.0;BlueOak-1.0.0;LGPL-3.0;LGPL-3.0-only;LGPL-3.0-or-later\"",
102
87
  "deps:health": "npm run deps:outdated && npm run deps:unused",
103
88
  "prepublishOnly": "npm run clean && npm run build && npm run test"
104
89
  },
105
90
  "peerDependencies": {
106
- "eslint": ">=8.0.0",
107
- "i18next": ">=23.0.0",
108
- "react-i18next": ">=13.0.0"
91
+ "eslint": ">=8.0.0"
109
92
  },
110
93
  "peerDependenciesMeta": {
111
94
  "eslint": {
112
95
  "optional": true
113
- },
114
- "i18next": {
115
- "optional": true
116
- },
117
- "react-i18next": {
118
- "optional": true
119
96
  }
120
97
  },
121
98
  "devDependencies": {
@@ -128,11 +105,9 @@
128
105
  "ajv-formats": "^3.0.1",
129
106
  "eslint": "^8.57.0",
130
107
  "eslint-plugin-import": "^2.32.0",
131
- "i18next": "^23.0.0",
132
108
  "jest": "^29.7.0",
133
109
  "jest-environment-jsdom": "^29.7.0",
134
110
  "react": "^18.0.0",
135
- "react-i18next": "^13.0.0",
136
111
  "rimraf": "^5.0.0",
137
112
  "ts-jest": "^29.1.0",
138
113
  "tsup": "^8.0.0",
package/dist/index.d.mts DELETED
@@ -1,69 +0,0 @@
1
- import { Resource, i18n } from 'i18next';
2
-
3
- /**
4
- * Options for {@link initI18n}.
5
- *
6
- * Everything app-specific (the strings, the locales, the fallback language and
7
- * the active language) is passed in — the package owns only the init *chain*.
8
- */
9
- interface InitI18nOptions {
10
- /**
11
- * The i18next resource bundle, e.g. `{ en: { translation: en } }`.
12
- * The app owns its own `locales/*.json` — only the init logic is shared.
13
- */
14
- resources: Resource;
15
- /**
16
- * The active language. Apps typically derive this from device locale,
17
- * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.
18
- *
19
- * When omitted (or undefined), defaults to {@link fallbackLng}.
20
- */
21
- lng?: string;
22
- /**
23
- * The fallback language used when a key is missing in {@link lng}.
24
- * Defaults to `'en'`.
25
- */
26
- fallbackLng?: string;
27
- /**
28
- * Whether to escape interpolated values. React already escapes output, so
29
- * the SaaS apps run with `escapeValue: false`. Defaults to `false`.
30
- */
31
- escapeValue?: boolean;
32
- /**
33
- * Default namespace(s). i18next's default is `'translation'`; the SaaS apps
34
- * keep that single-namespace convention, so this is optional.
35
- */
36
- defaultNS?: string | readonly string[];
37
- /**
38
- * Namespace list. Optional — only needed when the app splits strings across
39
- * multiple namespaces. Single-namespace apps can omit it.
40
- */
41
- ns?: string | readonly string[];
42
- }
43
- /**
44
- * Initialize the shared i18next + react-i18next singleton.
45
- *
46
- * This is the parameterized factory that replaces the per-app `i18n.ts`. It
47
- * wires `react-i18next` into the i18next singleton and runs `.init()` with the
48
- * app-supplied resources/language, swallowing the async init rejection the same
49
- * way every app did (i18next resolves synchronously for in-memory resources).
50
- *
51
- * The returned value is the i18next singleton — apps `export default` it and
52
- * call `.t()` through their own `FM()` helper.
53
- *
54
- * @example
55
- * ```ts
56
- * import { initI18n } from '@dloizides/frontend-devtools';
57
- * import * as Localization from 'expo-localization';
58
- * import en from './locales/en.json';
59
- *
60
- * const i18n = initI18n({
61
- * resources: { en: { translation: en } },
62
- * lng: Localization.getLocales()[0]?.languageCode,
63
- * });
64
- * export default i18n;
65
- * ```
66
- */
67
- declare function initI18n(options: InitI18nOptions): i18n;
68
-
69
- export { type InitI18nOptions, initI18n };
package/dist/index.d.ts DELETED
@@ -1,69 +0,0 @@
1
- import { Resource, i18n } from 'i18next';
2
-
3
- /**
4
- * Options for {@link initI18n}.
5
- *
6
- * Everything app-specific (the strings, the locales, the fallback language and
7
- * the active language) is passed in — the package owns only the init *chain*.
8
- */
9
- interface InitI18nOptions {
10
- /**
11
- * The i18next resource bundle, e.g. `{ en: { translation: en } }`.
12
- * The app owns its own `locales/*.json` — only the init logic is shared.
13
- */
14
- resources: Resource;
15
- /**
16
- * The active language. Apps typically derive this from device locale,
17
- * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.
18
- *
19
- * When omitted (or undefined), defaults to {@link fallbackLng}.
20
- */
21
- lng?: string;
22
- /**
23
- * The fallback language used when a key is missing in {@link lng}.
24
- * Defaults to `'en'`.
25
- */
26
- fallbackLng?: string;
27
- /**
28
- * Whether to escape interpolated values. React already escapes output, so
29
- * the SaaS apps run with `escapeValue: false`. Defaults to `false`.
30
- */
31
- escapeValue?: boolean;
32
- /**
33
- * Default namespace(s). i18next's default is `'translation'`; the SaaS apps
34
- * keep that single-namespace convention, so this is optional.
35
- */
36
- defaultNS?: string | readonly string[];
37
- /**
38
- * Namespace list. Optional — only needed when the app splits strings across
39
- * multiple namespaces. Single-namespace apps can omit it.
40
- */
41
- ns?: string | readonly string[];
42
- }
43
- /**
44
- * Initialize the shared i18next + react-i18next singleton.
45
- *
46
- * This is the parameterized factory that replaces the per-app `i18n.ts`. It
47
- * wires `react-i18next` into the i18next singleton and runs `.init()` with the
48
- * app-supplied resources/language, swallowing the async init rejection the same
49
- * way every app did (i18next resolves synchronously for in-memory resources).
50
- *
51
- * The returned value is the i18next singleton — apps `export default` it and
52
- * call `.t()` through their own `FM()` helper.
53
- *
54
- * @example
55
- * ```ts
56
- * import { initI18n } from '@dloizides/frontend-devtools';
57
- * import * as Localization from 'expo-localization';
58
- * import en from './locales/en.json';
59
- *
60
- * const i18n = initI18n({
61
- * resources: { en: { translation: en } },
62
- * lng: Localization.getLocales()[0]?.languageCode,
63
- * });
64
- * export default i18n;
65
- * ```
66
- */
67
- declare function initI18n(options: InitI18nOptions): i18n;
68
-
69
- export { type InitI18nOptions, initI18n };
package/dist/index.js DELETED
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var i18n = require('i18next');
4
- var reactI18next = require('react-i18next');
5
-
6
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
-
8
- var i18n__default = /*#__PURE__*/_interopDefault(i18n);
9
-
10
- // src/i18n/initI18n.ts
11
- var DEFAULT_FALLBACK_LNG = "en";
12
- function initI18n(options) {
13
- const {
14
- resources,
15
- lng,
16
- fallbackLng = DEFAULT_FALLBACK_LNG,
17
- escapeValue = false,
18
- defaultNS,
19
- ns
20
- } = options;
21
- i18n__default.default.use(reactI18next.initReactI18next).init({
22
- lng: lng ?? fallbackLng,
23
- fallbackLng,
24
- resources,
25
- ...defaultNS !== void 0 ? { defaultNS } : {},
26
- ...ns !== void 0 ? { ns } : {},
27
- interpolation: {
28
- escapeValue
29
- }
30
- }).catch(() => {
31
- });
32
- return i18n__default.default;
33
- }
34
-
35
- exports.initI18n = initI18n;
36
- //# sourceMappingURL=index.js.map
37
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/i18n/initI18n.ts"],"names":["i18n","initReactI18next"],"mappings":";;;;;;;;;;AAsDA,IAAM,oBAAA,GAAuB,IAAA;AA0BtB,SAAS,SAAS,OAAA,EAAwC;AAC/D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,GAAA;AAAA,IACA,WAAA,GAAc,oBAAA;AAAA,IACd,WAAA,GAAc,KAAA;AAAA,IACd,SAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAAA,qBAAA,CACG,GAAA,CAAIC,6BAAgB,CAAA,CACpB,IAAA,CAAK;AAAA,IACJ,KAAK,GAAA,IAAO,WAAA;AAAA,IACZ,WAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAI,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,KAAc,EAAC;AAAA,IAC/C,GAAI,EAAA,KAAO,MAAA,GAAY,EAAE,EAAA,KAAO,EAAC;AAAA,IACjC,aAAA,EAAe;AAAA,MACb;AAAA;AACF,GACD,CAAA,CACA,KAAA,CAAM,MAAM;AAAA,EAGb,CAAC,CAAA;AAEH,EAAA,OAAOD,qBAAA;AACT","file":"index.js","sourcesContent":["// i18next's default export is the configurable singleton; `.use()` / `.init()`\n// are members on it — this is the documented i18next initialization pattern,\n// which trips `import/no-named-as-default-member` for the whole fluent chain.\n// The disable is owned by the package so the consuming apps don't repeat it.\n/* eslint-disable import/no-named-as-default-member */\nimport i18n, { type i18n as I18nInstance, type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\n/**\n * Options for {@link initI18n}.\n *\n * Everything app-specific (the strings, the locales, the fallback language and\n * the active language) is passed in — the package owns only the init *chain*.\n */\nexport interface InitI18nOptions {\n /**\n * The i18next resource bundle, e.g. `{ en: { translation: en } }`.\n * The app owns its own `locales/*.json` — only the init logic is shared.\n */\n resources: Resource;\n\n /**\n * The active language. Apps typically derive this from device locale,\n * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.\n *\n * When omitted (or undefined), defaults to {@link fallbackLng}.\n */\n lng?: string;\n\n /**\n * The fallback language used when a key is missing in {@link lng}.\n * Defaults to `'en'`.\n */\n fallbackLng?: string;\n\n /**\n * Whether to escape interpolated values. React already escapes output, so\n * the SaaS apps run with `escapeValue: false`. Defaults to `false`.\n */\n escapeValue?: boolean;\n\n /**\n * Default namespace(s). i18next's default is `'translation'`; the SaaS apps\n * keep that single-namespace convention, so this is optional.\n */\n defaultNS?: string | readonly string[];\n\n /**\n * Namespace list. Optional — only needed when the app splits strings across\n * multiple namespaces. Single-namespace apps can omit it.\n */\n ns?: string | readonly string[];\n}\n\nconst DEFAULT_FALLBACK_LNG = 'en';\n\n/**\n * Initialize the shared i18next + react-i18next singleton.\n *\n * This is the parameterized factory that replaces the per-app `i18n.ts`. It\n * wires `react-i18next` into the i18next singleton and runs `.init()` with the\n * app-supplied resources/language, swallowing the async init rejection the same\n * way every app did (i18next resolves synchronously for in-memory resources).\n *\n * The returned value is the i18next singleton — apps `export default` it and\n * call `.t()` through their own `FM()` helper.\n *\n * @example\n * ```ts\n * import { initI18n } from '@dloizides/frontend-devtools';\n * import * as Localization from 'expo-localization';\n * import en from './locales/en.json';\n *\n * const i18n = initI18n({\n * resources: { en: { translation: en } },\n * lng: Localization.getLocales()[0]?.languageCode,\n * });\n * export default i18n;\n * ```\n */\nexport function initI18n(options: InitI18nOptions): I18nInstance {\n const {\n resources,\n lng,\n fallbackLng = DEFAULT_FALLBACK_LNG,\n escapeValue = false,\n defaultNS,\n ns,\n } = options;\n\n i18n\n .use(initReactI18next)\n .init({\n lng: lng ?? fallbackLng,\n fallbackLng,\n resources,\n ...(defaultNS !== undefined ? { defaultNS } : {}),\n ...(ns !== undefined ? { ns } : {}),\n interpolation: {\n escapeValue,\n },\n })\n .catch(() => {\n // i18next resolves synchronously for in-memory resources; the apps have\n // always swallowed this rejection. Kept identical to avoid behaviour drift.\n });\n\n return i18n;\n}\n"]}
package/dist/index.mjs DELETED
@@ -1,31 +0,0 @@
1
- import i18n from 'i18next';
2
- import { initReactI18next } from 'react-i18next';
3
-
4
- // src/i18n/initI18n.ts
5
- var DEFAULT_FALLBACK_LNG = "en";
6
- function initI18n(options) {
7
- const {
8
- resources,
9
- lng,
10
- fallbackLng = DEFAULT_FALLBACK_LNG,
11
- escapeValue = false,
12
- defaultNS,
13
- ns
14
- } = options;
15
- i18n.use(initReactI18next).init({
16
- lng: lng ?? fallbackLng,
17
- fallbackLng,
18
- resources,
19
- ...defaultNS !== void 0 ? { defaultNS } : {},
20
- ...ns !== void 0 ? { ns } : {},
21
- interpolation: {
22
- escapeValue
23
- }
24
- }).catch(() => {
25
- });
26
- return i18n;
27
- }
28
-
29
- export { initI18n };
30
- //# sourceMappingURL=index.mjs.map
31
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/i18n/initI18n.ts"],"names":[],"mappings":";;;;AAsDA,IAAM,oBAAA,GAAuB,IAAA;AA0BtB,SAAS,SAAS,OAAA,EAAwC;AAC/D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,GAAA;AAAA,IACA,WAAA,GAAc,oBAAA;AAAA,IACd,WAAA,GAAc,KAAA;AAAA,IACd,SAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAA,IAAA,CACG,GAAA,CAAI,gBAAgB,CAAA,CACpB,IAAA,CAAK;AAAA,IACJ,KAAK,GAAA,IAAO,WAAA;AAAA,IACZ,WAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAI,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,KAAc,EAAC;AAAA,IAC/C,GAAI,EAAA,KAAO,MAAA,GAAY,EAAE,EAAA,KAAO,EAAC;AAAA,IACjC,aAAA,EAAe;AAAA,MACb;AAAA;AACF,GACD,CAAA,CACA,KAAA,CAAM,MAAM;AAAA,EAGb,CAAC,CAAA;AAEH,EAAA,OAAO,IAAA;AACT","file":"index.mjs","sourcesContent":["// i18next's default export is the configurable singleton; `.use()` / `.init()`\n// are members on it — this is the documented i18next initialization pattern,\n// which trips `import/no-named-as-default-member` for the whole fluent chain.\n// The disable is owned by the package so the consuming apps don't repeat it.\n/* eslint-disable import/no-named-as-default-member */\nimport i18n, { type i18n as I18nInstance, type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\n/**\n * Options for {@link initI18n}.\n *\n * Everything app-specific (the strings, the locales, the fallback language and\n * the active language) is passed in — the package owns only the init *chain*.\n */\nexport interface InitI18nOptions {\n /**\n * The i18next resource bundle, e.g. `{ en: { translation: en } }`.\n * The app owns its own `locales/*.json` — only the init logic is shared.\n */\n resources: Resource;\n\n /**\n * The active language. Apps typically derive this from device locale,\n * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.\n *\n * When omitted (or undefined), defaults to {@link fallbackLng}.\n */\n lng?: string;\n\n /**\n * The fallback language used when a key is missing in {@link lng}.\n * Defaults to `'en'`.\n */\n fallbackLng?: string;\n\n /**\n * Whether to escape interpolated values. React already escapes output, so\n * the SaaS apps run with `escapeValue: false`. Defaults to `false`.\n */\n escapeValue?: boolean;\n\n /**\n * Default namespace(s). i18next's default is `'translation'`; the SaaS apps\n * keep that single-namespace convention, so this is optional.\n */\n defaultNS?: string | readonly string[];\n\n /**\n * Namespace list. Optional — only needed when the app splits strings across\n * multiple namespaces. Single-namespace apps can omit it.\n */\n ns?: string | readonly string[];\n}\n\nconst DEFAULT_FALLBACK_LNG = 'en';\n\n/**\n * Initialize the shared i18next + react-i18next singleton.\n *\n * This is the parameterized factory that replaces the per-app `i18n.ts`. It\n * wires `react-i18next` into the i18next singleton and runs `.init()` with the\n * app-supplied resources/language, swallowing the async init rejection the same\n * way every app did (i18next resolves synchronously for in-memory resources).\n *\n * The returned value is the i18next singleton — apps `export default` it and\n * call `.t()` through their own `FM()` helper.\n *\n * @example\n * ```ts\n * import { initI18n } from '@dloizides/frontend-devtools';\n * import * as Localization from 'expo-localization';\n * import en from './locales/en.json';\n *\n * const i18n = initI18n({\n * resources: { en: { translation: en } },\n * lng: Localization.getLocales()[0]?.languageCode,\n * });\n * export default i18n;\n * ```\n */\nexport function initI18n(options: InitI18nOptions): I18nInstance {\n const {\n resources,\n lng,\n fallbackLng = DEFAULT_FALLBACK_LNG,\n escapeValue = false,\n defaultNS,\n ns,\n } = options;\n\n i18n\n .use(initReactI18next)\n .init({\n lng: lng ?? fallbackLng,\n fallbackLng,\n resources,\n ...(defaultNS !== undefined ? { defaultNS } : {}),\n ...(ns !== undefined ? { ns } : {}),\n interpolation: {\n escapeValue,\n },\n })\n .catch(() => {\n // i18next resolves synchronously for in-memory resources; the apps have\n // always swallowed this rejection. Kept identical to avoid behaviour drift.\n });\n\n return i18n;\n}\n"]}