@ankhorage/orchestrator-module-expo-localization 0.1.4 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ankhorage/orchestrator-module-expo-localization
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ef56e0d: Generate localization runtime files under the canonical `src/modules/localization` namespace and rename the generated provider to `LocalizationModuleProvider`. Add an optional package-owned host contribution with generic metadata, layout integration, config normalization, and a serializable admin schema while keeping the root Orchestrator module standalone.
8
+
9
+ ## 0.1.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 2b1866c: Generate localization runtime files with direct `@ankhorage/runtime` imports and reject the retired `@ankh/runtime` workspace alias in regression coverage.
14
+
3
15
  ## 0.1.4
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -8,12 +8,31 @@ Adds localization support to Expo apps.
8
8
  - No boilerplate
9
9
  - Fully reversible
10
10
 
11
- ## 📦 Usage
11
+ ## Usage
12
12
 
13
13
  ```ts
14
- orchestrator.install('expo-localization');
14
+ import { createOrchestrator } from '@ankhorage/orchestrator';
15
+ import { expoLocalizationModule } from '@ankhorage/orchestrator-module-expo-localization';
16
+
17
+ const orchestrator = createOrchestrator({
18
+ modules: [expoLocalizationModule],
19
+ projectRoot: '/path/to/project',
20
+ });
21
+
22
+ await orchestrator.installModule('expo-localization', { config: {} });
23
+ ```
24
+
25
+ The Orchestrator ledger is the canonical lifecycle and configuration source. Updating an existing
26
+ installation uses `reconfigureModule()`, which also removes outputs recorded by an earlier module
27
+ version before generating the canonical `src/modules/localization` namespace.
28
+
29
+ Generic authoring hosts can opt into the package-owned metadata, layout integration, config
30
+ normalizer, and serializable admin schema without making the core module depend on Studio:
31
+
32
+ ```ts
33
+ import { expoLocalizationHostContribution } from '@ankhorage/orchestrator-module-expo-localization/host';
15
34
  ```
16
35
 
17
- ## 🧠 Why this exists
36
+ ## Why this exists
18
37
 
19
38
  Standardizes localization setup across apps.
package/dist/host.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { parseExpoLocalizationModuleConfig } from './config';
2
+ /**
3
+ * Optional package-owned data consumed by generic authoring hosts.
4
+ * The core module remains independently usable from the package root.
5
+ */
6
+ export declare const expoLocalizationHostContribution: {
7
+ readonly id: "expo-localization";
8
+ readonly name: "Localization (Expo)";
9
+ readonly description: "Multi-language support powered by expo-localization and i18next.";
10
+ readonly definition: import("@ankhorage/orchestrator").ModuleDefinition<import("./config").ExpoLocalizationModuleConfig>;
11
+ readonly normalizeConfig: typeof parseExpoLocalizationModuleConfig;
12
+ readonly layout: {
13
+ readonly imports: readonly ["import { LocalizationModuleProvider } from \"@/modules/localization\";"];
14
+ readonly hooks: readonly [];
15
+ readonly providerStart: readonly ["<LocalizationModuleProvider>"];
16
+ readonly providerEnd: readonly ["</LocalizationModuleProvider>"];
17
+ };
18
+ readonly admin: {
19
+ readonly kind: "config-schema";
20
+ readonly title: "Localization";
21
+ readonly description: "Configure supported locales, the default locale, and translation resources.";
22
+ readonly fields: readonly [{
23
+ readonly key: "defaultLocale";
24
+ readonly label: "Default locale";
25
+ readonly control: "text";
26
+ readonly required: true;
27
+ }, {
28
+ readonly key: "locales";
29
+ readonly label: "Locales";
30
+ readonly control: "string-list";
31
+ readonly required: true;
32
+ }, {
33
+ readonly key: "translations";
34
+ readonly label: "Translations";
35
+ readonly control: "locale-string-map";
36
+ readonly required: false;
37
+ }];
38
+ };
39
+ };
40
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAG7D;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCnC,CAAC"}
package/dist/host.js ADDED
@@ -0,0 +1,45 @@
1
+ import { parseExpoLocalizationModuleConfig } from './config';
2
+ import { EXPO_LOCALIZATION_MODULE_ID, expoLocalizationModule } from './module';
3
+ /**
4
+ * Optional package-owned data consumed by generic authoring hosts.
5
+ * The core module remains independently usable from the package root.
6
+ */
7
+ export const expoLocalizationHostContribution = {
8
+ id: EXPO_LOCALIZATION_MODULE_ID,
9
+ name: 'Localization (Expo)',
10
+ description: 'Multi-language support powered by expo-localization and i18next.',
11
+ definition: expoLocalizationModule,
12
+ normalizeConfig: parseExpoLocalizationModuleConfig,
13
+ layout: {
14
+ imports: ['import { LocalizationModuleProvider } from "@/modules/localization";'],
15
+ hooks: [],
16
+ providerStart: ['<LocalizationModuleProvider>'],
17
+ providerEnd: ['</LocalizationModuleProvider>'],
18
+ },
19
+ admin: {
20
+ kind: 'config-schema',
21
+ title: 'Localization',
22
+ description: 'Configure supported locales, the default locale, and translation resources.',
23
+ fields: [
24
+ {
25
+ key: 'defaultLocale',
26
+ label: 'Default locale',
27
+ control: 'text',
28
+ required: true,
29
+ },
30
+ {
31
+ key: 'locales',
32
+ label: 'Locales',
33
+ control: 'string-list',
34
+ required: true,
35
+ },
36
+ {
37
+ key: 'translations',
38
+ label: 'Translations',
39
+ control: 'locale-string-map',
40
+ required: false,
41
+ },
42
+ ],
43
+ },
44
+ };
45
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,EAAE,EAAE,2BAA2B;IAC/B,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,kEAAkE;IAC/E,UAAU,EAAE,sBAAsB;IAClC,eAAe,EAAE,iCAAiC;IAClD,MAAM,EAAE;QACN,OAAO,EAAE,CAAC,sEAAsE,CAAC;QACjF,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,CAAC,8BAA8B,CAAC;QAC/C,WAAW,EAAE,CAAC,+BAA+B,CAAC;KAC/C;IACD,KAAK,EAAE;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,6EAA6E;QAC1F,MAAM,EAAE;YACN;gBACE,GAAG,EAAE,eAAe;gBACpB,KAAK,EAAE,gBAAgB;gBACvB,OAAO,EAAE,MAAM;gBACf,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,GAAG,EAAE,SAAS;gBACd,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,aAAa;gBACtB,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,GAAG,EAAE,cAAc;gBACnB,KAAK,EAAE,cAAc;gBACrB,OAAO,EAAE,mBAAmB;gBAC5B,QAAQ,EAAE,KAAK;aAChB;SACF;KACF;CACO,CAAC"}
package/dist/module.js CHANGED
@@ -27,7 +27,7 @@ export const expoLocalizationModule = defineModule({
27
27
  type: 'patch-text-block',
28
28
  path: 'src/app/_layout.tsx',
29
29
  blockId: `${EXPO_LOCALIZATION_MODULE_ID}:root-layout-import`,
30
- content: 'import { LocalizationPluginProvider } from "@/plugins/localization";',
30
+ content: 'import { LocalizationModuleProvider } from "@/modules/localization";',
31
31
  anchor: {
32
32
  find: "import ankhConfig from '@root/ankh.config.json';",
33
33
  position: 'before',
@@ -37,7 +37,7 @@ export const expoLocalizationModule = defineModule({
37
37
  type: 'patch-text-block',
38
38
  path: 'src/app/_layout.tsx',
39
39
  blockId: `${EXPO_LOCALIZATION_MODULE_ID}:root-layout-provider`,
40
- content: ' output = <LocalizationPluginProvider>{output}</LocalizationPluginProvider>;',
40
+ content: ' output = <LocalizationModuleProvider>{output}</LocalizationModuleProvider>;',
41
41
  anchor: {
42
42
  find: ' return (',
43
43
  position: 'before',
@@ -11,24 +11,24 @@ export function buildLocalizationWriteFiles(args) {
11
11
  const { defaultLocale, locales, translations } = args;
12
12
  return [
13
13
  {
14
- path: 'src/plugins/localization/i18n.ts',
14
+ path: 'src/modules/localization/i18n.ts',
15
15
  content: renderTemplate('i18n.ts.tpl', {
16
16
  DEFAULT_LOCALE: JSON.stringify(defaultLocale),
17
17
  }),
18
18
  overwrite: true,
19
19
  },
20
20
  {
21
- path: 'src/plugins/localization/useT.ts',
21
+ path: 'src/modules/localization/useT.ts',
22
22
  content: readTemplate('useT.ts.tpl'),
23
23
  overwrite: true,
24
24
  },
25
25
  {
26
- path: 'src/plugins/localization/runtimeLocalization.ts',
26
+ path: 'src/modules/localization/runtimeLocalization.ts',
27
27
  content: readTemplate('runtimeLocalization.ts.tpl'),
28
28
  overwrite: true,
29
29
  },
30
30
  {
31
- path: 'src/plugins/localization/LocalizationProvider.tsx',
31
+ path: 'src/modules/localization/LocalizationProvider.tsx',
32
32
  content: renderTemplate('LocalizationProvider.tsx.tpl', {
33
33
  DEFAULT_LOCALE: JSON.stringify(defaultLocale),
34
34
  RESOURCE_LINES: locales
@@ -38,7 +38,7 @@ export function buildLocalizationWriteFiles(args) {
38
38
  overwrite: true,
39
39
  },
40
40
  {
41
- path: 'src/plugins/localization/index.ts',
41
+ path: 'src/modules/localization/index.ts',
42
42
  content: readTemplate('index.ts.tpl'),
43
43
  overwrite: true,
44
44
  },
@@ -50,7 +50,7 @@ function buildLocaleJsonFiles(locales, configTranslations) {
50
50
  const contentSource = configTranslations[locale] ??
51
51
  (locale.startsWith('de') ? defaultTranslations.de : defaultTranslations.en);
52
52
  return {
53
- path: `src/plugins/localization/locales/${locale}.json`,
53
+ path: `src/modules/localization/locales/${locale}.json`,
54
54
  content: `${JSON.stringify(contentSource, null, 2)}\n`,
55
55
  };
56
56
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "name": "@ankhorage/orchestrator-module-expo-localization",
4
- "version": "0.1.4",
4
+ "version": "0.2.0",
5
5
  "description": "Expo localization module for @ankhorage/orchestrator.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -34,6 +34,10 @@
34
34
  ".": {
35
35
  "types": "./dist/index.d.ts",
36
36
  "default": "./dist/index.js"
37
+ },
38
+ "./host": {
39
+ "types": "./dist/host.d.ts",
40
+ "default": "./dist/host.js"
37
41
  }
38
42
  },
39
43
  "scripts": {
@@ -48,7 +52,7 @@
48
52
  "version-packages": "changeset version"
49
53
  },
50
54
  "dependencies": {
51
- "@ankhorage/orchestrator": "^0.2.2"
55
+ "@ankhorage/orchestrator": "^0.3.0"
52
56
  },
53
57
  "devDependencies": {
54
58
  "@ankhorage/devtools": "^1.0.6",
@@ -1,5 +1,5 @@
1
1
  /* generated by @ankhorage/orchestrator-module-expo-localization */
2
- import { RuntimeRendererConfigProvider } from "@ankh/runtime";
2
+ import { RuntimeRendererConfigProvider } from "@ankhorage/runtime";
3
3
  import React, { useEffect, useMemo, useState } from "react";
4
4
  import * as ExpoLocalization from "expo-localization";
5
5
  import { useTranslation } from "react-i18next";
@@ -10,13 +10,13 @@ import {
10
10
  createLocalizationNodePropsResolver,
11
11
  } from "./runtimeLocalization";
12
12
 
13
- export interface LocalizationPluginConfig {
13
+ export interface LocalizationModuleConfig {
14
14
  defaultLocale?: string;
15
15
  }
16
16
 
17
- export function LocalizationPluginProvider(props: {
17
+ export function LocalizationModuleProvider(props: {
18
18
  children: React.ReactNode;
19
- config?: LocalizationPluginConfig;
19
+ config?: LocalizationModuleConfig;
20
20
  }) {
21
21
  const { children, config } = props;
22
22
 
@@ -1,4 +1,4 @@
1
1
  /* generated by @ankhorage/orchestrator-module-expo-localization */
2
- export { LocalizationPluginProvider } from "./LocalizationProvider";
2
+ export { LocalizationModuleProvider } from "./LocalizationProvider";
3
3
  export { useT } from "./useT";
4
4
  export { i18n } from "./i18n";
@@ -1,5 +1,5 @@
1
1
  /* generated by @ankhorage/orchestrator-module-expo-localization */
2
- import type { RuntimeActionHandlers, RuntimeNodePropsResolver } from "@ankh/runtime";
2
+ import type { RuntimeActionHandlers, RuntimeNodePropsResolver } from "@ankhorage/runtime";
3
3
  import type { i18n as I18nInstance } from "i18next";
4
4
 
5
5
  const LOCALIZED_PROP_PAIRS = [