sanity-plugin-internationalized-array

5.2.15.2.2
~

Modified (4 files)

Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -4,11 +4,11 @@
 import { c } from "react/compiler-runtime";
 import { Box, Button, Card, Flex, Grid, Label, Spinner, Stack, Text } from "@sanity/ui";
 import { useToast } from "@sanity/ui/toast";
 import { randomKey } from "@sanity/util/content";
-import { createContext, createElement, use, useCallback, useContext, useDeferredValue, useEffect } from "react";
 import { useDocumentPane } from "sanity/structure";
 import { AddIcon } from "@sanity/icons/Add";
+import { createContext, createElement, use, useCallback, useContext, useDeferredValue, useEffect } from "react";
 import get from "lodash-es/get.js";
 import { Fragment, jsx, jsxs } from "react/jsx-runtime";
 import { TranslateIcon } from "@sanity/icons/Translate";
 import camelCase from "lodash-es/camelCase.js";
Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "sanity-plugin-internationalized-array",
-  "version": "5.2.1",
+  "version": "5.2.2",
   "description": "Store localized fields in an array to save on attributes",
   "keywords": [
     "sanity",
     "sanity-plugin"
@@ -41,23 +41,23 @@
     "@types/lodash-es": "^4.17.12",
     "@types/node": "^24.13.3",
     "@types/react": "^19.2.18",
     "@types/react-dom": "^19.2.4",
-    "babel-plugin-react-compiler": "^1.0.0",
     "jsdom": "^29.1.1",
+    "oxc-transform-react": "^0.145.0",
     "react": "^19.2.8",
     "react-dom": "^19.2.8",
     "sanity": "^6.10.1",
     "styled-components": "^6.5.3",
     "tsdown": "^0.22.14",
-    "@sanity/language-filter": "5.0.17"
+    "@sanity/language-filter": "5.0.18"
   },
   "peerDependencies": {
     "react": "^19.2",
     "react-dom": "^19.2",
     "sanity": "^5 || ^6.0.0-0",
-    "@sanity/assist": "^6.1.20",
-    "@sanity/language-filter": "^5.0.17"
+    "@sanity/assist": "^6.1.21",
+    "@sanity/language-filter": "^5.0.18"
   },
   "peerDependenciesMeta": {
     "@sanity/assist": {
       "optional": true
File too large for inline diff
Index: package/dist/migrations/index.js.map
===================================================================
--- package/dist/migrations/index.js.map
+++ package/dist/migrations/index.js.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.js","names":["defineMigration","set","LANGUAGE_FIELD_NAME","INTERNATIONALIZED_PREFIX","VALUE_SUFFIX","migrateToLanguageField","documentTypes","title","migrate","object","node","type","language","startsWith","endsWith","undefined","oldKey","length","_key"],"sources":["../../migrations/migrateToLanguageField.ts"],"sourcesContent":["import {defineMigration, set} from 'sanity/migrate'\n\n/**\n * The property which will be used to store the language identifier from v5.\n */\nconst LANGUAGE_FIELD_NAME = 'language'\n/**\n * The prefix of the internationalized array type name.\n * Internationalized arrays contain objects with `_type` starting with this prefix\n * and ending with `Value` (e.g. `internationalizedArrayStringValue`).\n */\nconst INTERNATIONALIZED_PREFIX = 'internationalizedArray'\n/**\n * The suffix of the internationalized array value type name.\n */\nconst VALUE_SUFFIX = 'Value'\n\n/**\n * Creates a migration that automatically finds all internationalized array\n * item objects and moves language identifiers from `_key` to the dedicated\n * `language` field, generating new random `_key` values.\n *\n * Detection is automatic: the `object` handler is called for every object in\n * every matching document. If the object has a `_type` matching\n * `internationalizedArray*Value` and is missing the `language` field, it is\n * migrated.\n */\nexport function migrateToLanguageField(documentTypes: string[]) {\n  return defineMigration({\n    title: 'Migrate internationalized array from _key to language',\n    documentTypes,\n    migrate: {\n      object(node) {\n        const type = node['_type']\n        const language = node[LANGUAGE_FIELD_NAME]\n\n        if (\n          typeof type !== 'string' ||\n          !type.startsWith(INTERNATIONALIZED_PREFIX) ||\n          !type.endsWith(VALUE_SUFFIX)\n        ) {\n          return undefined\n        }\n\n        // Already migrated: has a language field.\n        if (language && typeof language === 'string') {\n          return undefined\n        }\n\n        // Needs migration: _key holds the language id.\n        const oldKey = node['_key']\n        if (typeof oldKey !== 'string' || oldKey.length === 0) {\n          return undefined\n        }\n\n        return set({\n          ...node,\n          _key: undefined,\n          [LANGUAGE_FIELD_NAME]: oldKey,\n        })\n      },\n    },\n  })\n}\n"],"mappings":";;;;AAKA,MAAME,sBAAsB;;;;;;;;;;;AAsB5B,SAAgBG,uBAAuBC,eAAyB;CAC9D,OAAON,gBAAgB;EACrBO,OAAO;EACPD;EACAE,SAAS,EACPC,OAAOC,MAAM;GACX,IAAMC,OAAOD,KAAK,OACZE,WAAWF,KAAKR;GAWtB,IARE,OAAOS,QAAS,YAChB,CAACA,KAAKE,WAAWV,wBAAwB,KACzC,CAACQ,KAAKG,SAASV,OAAY,KAMzBQ,YAAY,OAAOA,YAAa,UAClC;GAIF,IAAMI,SAASN,KAAK;GAChB,WAAOM,UAAW,YAAYA,OAAOC,WAAW,GAIpD,OAAOhB,IAAI;IACT,GAAGS;IACHQ,MAAMH,KAAAA;KACLb,sBAAsBc;GACzB,CAAC;EACH,EACF;CACF,CAAC;AACH"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":[],"sources":["../../migrations/migrateToLanguageField.ts"],"sourcesContent":["import {defineMigration, set} from 'sanity/migrate'\n\n/**\n * The property which will be used to store the language identifier from v5.\n */\nconst LANGUAGE_FIELD_NAME = 'language'\n/**\n * The prefix of the internationalized array type name.\n * Internationalized arrays contain objects with `_type` starting with this prefix\n * and ending with `Value` (e.g. `internationalizedArrayStringValue`).\n */\nconst INTERNATIONALIZED_PREFIX = 'internationalizedArray'\n/**\n * The suffix of the internationalized array value type name.\n */\nconst VALUE_SUFFIX = 'Value'\n\n/**\n * Creates a migration that automatically finds all internationalized array\n * item objects and moves language identifiers from `_key` to the dedicated\n * `language` field, generating new random `_key` values.\n *\n * Detection is automatic: the `object` handler is called for every object in\n * every matching document. If the object has a `_type` matching\n * `internationalizedArray*Value` and is missing the `language` field, it is\n * migrated.\n */\nexport function migrateToLanguageField(documentTypes: string[]) {\n  return defineMigration({\n    title: 'Migrate internationalized array from _key to language',\n    documentTypes,\n    migrate: {\n      object(node) {\n        const type = node['_type']\n        const language = node[LANGUAGE_FIELD_NAME]\n\n        if (\n          typeof type !== 'string' ||\n          !type.startsWith(INTERNATIONALIZED_PREFIX) ||\n          !type.endsWith(VALUE_SUFFIX)\n        ) {\n          return undefined\n        }\n\n        // Already migrated: has a language field.\n        if (language && typeof language === 'string') {\n          return undefined\n        }\n\n        // Needs migration: _key holds the language id.\n        const oldKey = node['_key']\n        if (typeof oldKey !== 'string' || oldKey.length === 0) {\n          return undefined\n        }\n\n        return set({\n          ...node,\n          _key: undefined,\n          [LANGUAGE_FIELD_NAME]: oldKey,\n        })\n      },\n    },\n  })\n}\n"],"mappings":";;;;AAKA,MAAM,sBAAsB;;;;;;;;;;;AAsB5B,SAAgB,uBAAuB,eAAyB;CAC9D,OAAO,gBAAgB;EACrB,OAAO;EACP;EACA,SAAS,EACP,OAAO,MAAM;GACX,IAAM,OAAO,KAAK,OACZ,WAAW,KAAK;GAWtB,IARE,OAAO,QAAS,YAChB,CAAC,KAAK,WAAW,wBAAwB,KACzC,CAAC,KAAK,SAAS,OAAY,KAMzB,YAAY,OAAO,YAAa,UAClC;GAIF,IAAM,SAAS,KAAK;GAChB,WAAO,UAAW,YAAY,OAAO,WAAW,GAIpD,OAAO,IAAI;IACT,GAAG;IACH,MAAM,KAAA;KACL,sBAAsB;GACzB,CAAC;EACH,EACF;CACF,CAAC;AACH"}
\ No newline at end of file