intlayer-editor 2.1.12 → 3.0.1
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/README.md +9 -9
- package/dist/cjs/{client/ContentEditionLayout.cjs → ContentEditionLayout.cjs} +2 -2
- package/dist/cjs/ContentEditionLayout.cjs.map +1 -0
- package/dist/cjs/{client/ContentEditorProvider.cjs → ContentEditorProvider.cjs} +9 -1
- package/dist/cjs/ContentEditorProvider.cjs.map +1 -0
- package/dist/cjs/{client/ContentSelectorWrapper.cjs → ContentSelectorWrapper.cjs} +8 -10
- package/dist/cjs/ContentSelectorWrapper.cjs.map +1 -0
- package/dist/cjs/{client/DictionaryEditionDrawer → DictionaryEditionDrawer}/DictionaryEditionDrawer.cjs +47 -38
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -0
- package/dist/cjs/{client/DictionaryEditionDrawer → DictionaryEditionDrawer}/index.cjs +1 -3
- package/dist/cjs/DictionaryEditionDrawer/index.cjs.map +1 -0
- package/dist/cjs/{client/DictionaryEditionDrawer → DictionaryEditionDrawer}/useDictionaryEditionDrawer.cjs +12 -9
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +1 -0
- package/dist/cjs/{client/DictionaryListDrawer → DictionaryListDrawer}/DictionaryListDrawer.cjs +16 -23
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs.map +1 -0
- package/dist/cjs/DictionaryListDrawer/index.cjs.map +1 -0
- package/dist/cjs/DictionaryListDrawer/useDictionaryListDrawer.cjs.map +1 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/{client/renderContentEditor.cjs → renderContentEditor.cjs} +10 -4
- package/dist/cjs/renderContentEditor.cjs.map +1 -0
- package/dist/cjs/{client/useEditorServer.cjs → useEditorServer.cjs} +4 -4
- package/dist/cjs/useEditorServer.cjs.map +1 -0
- package/dist/esm/{client/ContentEditionLayout.mjs → ContentEditionLayout.mjs} +2 -2
- package/dist/esm/ContentEditionLayout.mjs.map +1 -0
- package/dist/esm/{client/ContentEditorProvider.mjs → ContentEditorProvider.mjs} +11 -2
- package/dist/esm/ContentEditorProvider.mjs.map +1 -0
- package/dist/esm/{client/ContentSelectorWrapper.mjs → ContentSelectorWrapper.mjs} +14 -11
- package/dist/esm/ContentSelectorWrapper.mjs.map +1 -0
- package/dist/esm/{client/DictionaryEditionDrawer → DictionaryEditionDrawer}/DictionaryEditionDrawer.mjs +50 -26
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -0
- package/dist/esm/{client/DictionaryEditionDrawer → DictionaryEditionDrawer}/index.mjs +0 -1
- package/dist/esm/DictionaryEditionDrawer/index.mjs.map +1 -0
- package/dist/esm/{client/DictionaryEditionDrawer → DictionaryEditionDrawer}/useDictionaryEditionDrawer.mjs +10 -6
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +1 -0
- package/dist/esm/{client/DictionaryListDrawer → DictionaryListDrawer}/DictionaryListDrawer.mjs +17 -13
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs.map +1 -0
- package/dist/esm/DictionaryListDrawer/index.mjs.map +1 -0
- package/dist/esm/DictionaryListDrawer/useDictionaryListDrawer.mjs.map +1 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/{client/renderContentEditor.mjs → renderContentEditor.mjs} +10 -4
- package/dist/esm/renderContentEditor.mjs.map +1 -0
- package/dist/esm/{client/useEditorServer.mjs → useEditorServer.mjs} +3 -3
- package/dist/esm/useEditorServer.mjs.map +1 -0
- package/dist/types/ContentEditionLayout.d.ts +11 -0
- package/dist/types/ContentEditionLayout.d.ts.map +1 -0
- package/dist/types/ContentEditorProvider.d.ts +21 -0
- package/dist/types/ContentEditorProvider.d.ts.map +1 -0
- package/dist/types/ContentSelectorWrapper.d.ts +11 -0
- package/dist/types/ContentSelectorWrapper.d.ts.map +1 -0
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts +21 -0
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +1 -0
- package/dist/types/DictionaryEditionDrawer/index.d.ts +3 -0
- package/dist/types/DictionaryEditionDrawer/index.d.ts.map +1 -0
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +31 -0
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts.map +1 -0
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts +3 -0
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts.map +1 -0
- package/dist/types/DictionaryListDrawer/index.d.ts +3 -0
- package/dist/types/DictionaryListDrawer/index.d.ts.map +1 -0
- package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts +7 -0
- package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/renderContentEditor.d.ts +14 -0
- package/dist/types/renderContentEditor.d.ts.map +1 -0
- package/dist/types/useEditorServer.d.ts +4 -0
- package/dist/types/useEditorServer.d.ts.map +1 -0
- package/package.json +39 -35
- package/dist/cjs/client/ContentEditionLayout.cjs.map +0 -1
- package/dist/cjs/client/ContentEditionLayout.d.ts +0 -13
- package/dist/cjs/client/ContentEditorProvider.cjs.map +0 -1
- package/dist/cjs/client/ContentEditorProvider.d.ts +0 -23
- package/dist/cjs/client/ContentSelectorWrapper.cjs.map +0 -1
- package/dist/cjs/client/ContentSelectorWrapper.d.ts +0 -12
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +0 -1
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts +0 -28
- package/dist/cjs/client/DictionaryEditionDrawer/index.cjs.map +0 -1
- package/dist/cjs/client/DictionaryEditionDrawer/index.d.ts +0 -9
- package/dist/cjs/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +0 -1
- package/dist/cjs/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +0 -32
- package/dist/cjs/client/DictionaryEditionDrawer/useEditedContentStore.cjs +0 -98
- package/dist/cjs/client/DictionaryEditionDrawer/useEditedContentStore.cjs.map +0 -1
- package/dist/cjs/client/DictionaryEditionDrawer/useEditedContentStore.d.ts +0 -28
- package/dist/cjs/client/DictionaryEditionDrawer/useFocusContentStore.cjs +0 -33
- package/dist/cjs/client/DictionaryEditionDrawer/useFocusContentStore.cjs.map +0 -1
- package/dist/cjs/client/DictionaryEditionDrawer/useFocusContentStore.d.ts +0 -16
- package/dist/cjs/client/DictionaryListDrawer/DictionaryListDrawer.cjs.map +0 -1
- package/dist/cjs/client/DictionaryListDrawer/DictionaryListDrawer.d.ts +0 -5
- package/dist/cjs/client/DictionaryListDrawer/index.cjs.map +0 -1
- package/dist/cjs/client/DictionaryListDrawer/index.d.ts +0 -3
- package/dist/cjs/client/DictionaryListDrawer/useDictionaryListDrawer.cjs.map +0 -1
- package/dist/cjs/client/DictionaryListDrawer/useDictionaryListDrawer.d.ts +0 -8
- package/dist/cjs/client/index.cjs.map +0 -1
- package/dist/cjs/client/index.d.ts +0 -15
- package/dist/cjs/client/renderContentEditor.cjs.map +0 -1
- package/dist/cjs/client/renderContentEditor.d.ts +0 -15
- package/dist/cjs/client/useEditorServer.cjs.map +0 -1
- package/dist/cjs/client/useEditorServer.d.ts +0 -5
- package/dist/cjs/server/formatPrettier.cjs +0 -51
- package/dist/cjs/server/formatPrettier.cjs.map +0 -1
- package/dist/cjs/server/formatPrettier.d.ts +0 -6
- package/dist/cjs/server/index.cjs +0 -68
- package/dist/cjs/server/index.cjs.map +0 -1
- package/dist/cjs/server/index.d.ts +0 -3
- package/dist/cjs/server/processEdition.cjs +0 -157
- package/dist/cjs/server/processEdition.cjs.map +0 -1
- package/dist/cjs/server/processEdition.d.ts +0 -12
- package/dist/esm/client/ContentEditionLayout.d.mts +0 -13
- package/dist/esm/client/ContentEditionLayout.mjs.map +0 -1
- package/dist/esm/client/ContentEditorProvider.d.mts +0 -23
- package/dist/esm/client/ContentEditorProvider.mjs.map +0 -1
- package/dist/esm/client/ContentSelectorWrapper.d.mts +0 -12
- package/dist/esm/client/ContentSelectorWrapper.mjs.map +0 -1
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.d.mts +0 -28
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +0 -1
- package/dist/esm/client/DictionaryEditionDrawer/index.d.mts +0 -9
- package/dist/esm/client/DictionaryEditionDrawer/index.mjs.map +0 -1
- package/dist/esm/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.mts +0 -32
- package/dist/esm/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +0 -1
- package/dist/esm/client/DictionaryEditionDrawer/useEditedContentStore.d.mts +0 -28
- package/dist/esm/client/DictionaryEditionDrawer/useEditedContentStore.mjs +0 -74
- package/dist/esm/client/DictionaryEditionDrawer/useEditedContentStore.mjs.map +0 -1
- package/dist/esm/client/DictionaryEditionDrawer/useFocusContentStore.d.mts +0 -16
- package/dist/esm/client/DictionaryEditionDrawer/useFocusContentStore.mjs +0 -9
- package/dist/esm/client/DictionaryEditionDrawer/useFocusContentStore.mjs.map +0 -1
- package/dist/esm/client/DictionaryListDrawer/DictionaryListDrawer.d.mts +0 -5
- package/dist/esm/client/DictionaryListDrawer/DictionaryListDrawer.mjs.map +0 -1
- package/dist/esm/client/DictionaryListDrawer/index.d.mts +0 -3
- package/dist/esm/client/DictionaryListDrawer/index.mjs.map +0 -1
- package/dist/esm/client/DictionaryListDrawer/useDictionaryListDrawer.d.mts +0 -8
- package/dist/esm/client/DictionaryListDrawer/useDictionaryListDrawer.mjs.map +0 -1
- package/dist/esm/client/index.d.mts +0 -15
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/client/renderContentEditor.d.mts +0 -15
- package/dist/esm/client/renderContentEditor.mjs.map +0 -1
- package/dist/esm/client/useEditorServer.d.mts +0 -5
- package/dist/esm/client/useEditorServer.mjs.map +0 -1
- package/dist/esm/server/formatPrettier.d.mts +0 -6
- package/dist/esm/server/formatPrettier.mjs +0 -17
- package/dist/esm/server/formatPrettier.mjs.map +0 -1
- package/dist/esm/server/index.d.mts +0 -3
- package/dist/esm/server/index.mjs +0 -34
- package/dist/esm/server/index.mjs.map +0 -1
- package/dist/esm/server/processEdition.d.mts +0 -12
- package/dist/esm/server/processEdition.mjs +0 -134
- package/dist/esm/server/processEdition.mjs.map +0 -1
- /package/dist/cjs/{client/DictionaryListDrawer → DictionaryListDrawer}/index.cjs +0 -0
- /package/dist/cjs/{client/DictionaryListDrawer → DictionaryListDrawer}/useDictionaryListDrawer.cjs +0 -0
- /package/dist/cjs/{client/index.cjs → index.cjs} +0 -0
- /package/dist/esm/{client/DictionaryListDrawer → DictionaryListDrawer}/index.mjs +0 -0
- /package/dist/esm/{client/DictionaryListDrawer → DictionaryListDrawer}/useDictionaryListDrawer.mjs +0 -0
- /package/dist/esm/{client/index.mjs → index.mjs} +0 -0
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as zustand from 'zustand';
|
|
2
|
-
import { KeyPath } from '@intlayer/core';
|
|
3
|
-
|
|
4
|
-
type DictionaryPath = string;
|
|
5
|
-
type FileContent = {
|
|
6
|
-
dictionaryPath: DictionaryPath;
|
|
7
|
-
dictionaryId: string;
|
|
8
|
-
keyPath?: KeyPath[];
|
|
9
|
-
};
|
|
10
|
-
type EditionPanelStore = {
|
|
11
|
-
focusedContent: FileContent | null;
|
|
12
|
-
setFocusedContent: (content: FileContent | null) => void;
|
|
13
|
-
};
|
|
14
|
-
declare const useEditionPanelStore: zustand.UseBoundStore<zustand.StoreApi<EditionPanelStore>>;
|
|
15
|
-
|
|
16
|
-
export { useEditionPanelStore };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
const useEditionPanelStore = create((set) => ({
|
|
3
|
-
focusedContent: null,
|
|
4
|
-
setFocusedContent: (content) => set({ focusedContent: content })
|
|
5
|
-
}));
|
|
6
|
-
export {
|
|
7
|
-
useEditionPanelStore
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=useFocusContentStore.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/useFocusContentStore.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/core';\nimport { create } from 'zustand';\n\ntype DictionaryPath = string;\ntype FileContent = {\n dictionaryPath: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype EditionPanelStore = {\n focusedContent: FileContent | null;\n setFocusedContent: (content: FileContent | null) => void;\n};\n\nexport const useEditionPanelStore = create<EditionPanelStore>((set) => ({\n focusedContent: null,\n setFocusedContent: (content) => set({ focusedContent: content }),\n}));\n"],"mappings":"AACA,SAAS,cAAc;AAchB,MAAM,uBAAuB,OAA0B,CAAC,SAAS;AAAA,EACtE,gBAAgB;AAAA,EAChB,mBAAmB,CAAC,YAAY,IAAI,EAAE,gBAAgB,QAAQ,CAAC;AACjE,EAAE;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/client/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport { RightDrawer, RedirectionButton } from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport {\n useDictionaryEditionDrawerControl,\n useEditedContentStore,\n} from '../DictionaryEditionDrawer/index';\nimport {\n dictionaryListDrawerIdentifier,\n useDictionaryListDrawer,\n} from './useDictionaryListDrawer';\n\nexport const DictionaryListDrawer: FC = () => {\n const dictionaryKeyList = Object.keys(dictionaries) as Locales[];\n const { open: openDictionaryEditionDrawer } =\n useDictionaryEditionDrawerControl();\n const { close } = useDictionaryListDrawer();\n const editedContent = useEditedContentStore((s) => s.editedContent);\n\n const handleClickDictionary = (dictionaryId: string) => {\n const { filePath } = dictionaries[dictionaryId];\n\n close();\n openDictionaryEditionDrawer({ dictionaryId, dictionaryPath: filePath });\n };\n\n const isDictionaryEdited = (dictionaryId: string) => {\n const dictionaryPath = dictionaries[dictionaryId].filePath;\n\n return Object.keys(editedContent).includes(dictionaryPath);\n };\n\n return (\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <RedirectionButton\n key={dictionaryId}\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </RedirectionButton>\n ))}\n </RightDrawer>\n );\n};\n"],"mappings":"AA4CQ;AA3CR,SAAS,aAAa,yBAAyB;AAM/C,OAAO,kBAAkB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,uBAA2B,MAAM;AAC5C,QAAM,oBAAoB,OAAO,KAAK,YAAY;AAClD,QAAM,EAAE,MAAM,4BAA4B,IACxC,kCAAkC;AACpC,QAAM,EAAE,MAAM,IAAI,wBAAwB;AAC1C,QAAM,gBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa;AAElE,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAE9C,UAAM;AACN,gCAA4B,EAAE,cAAc,gBAAgB,SAAS,CAAC;AAAA,EACxE;AAEA,QAAM,qBAAqB,CAAC,iBAAyB;AACnD,UAAM,iBAAiB,aAAa,YAAY,EAAE;AAElD,WAAO,OAAO,KAAK,aAAa,EAAE,SAAS,cAAc;AAAA,EAC3D;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB;AAAA,QAAC;AAAA;AAAA,UAEC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UAEhD,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,QANC;AAAA,MAOP,CACD;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/client/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './useDictionaryListDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/client/DictionaryListDrawer/useDictionaryListDrawer.ts"],"sourcesContent":["import { useRightDrawerStore } from '@intlayer/design-system';\n\nexport const dictionaryListDrawerIdentifier = 'dictionaryList';\n\nexport const useDictionaryListDrawer = () =>\n useRightDrawerStore(dictionaryListDrawerIdentifier)();\n"],"mappings":"AAAA,SAAS,2BAA2B;AAE7B,MAAM,iCAAiC;AAEvC,MAAM,0BAA0B,MACrC,oBAAoB,8BAA8B,EAAE;","names":[]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { DictionaryEditionDrawer, DictionaryEditionDrawerContent, DictionaryEditionDrawerController, getDrawerIdentifier } from './DictionaryEditionDrawer/DictionaryEditionDrawer.mjs';
|
|
2
|
-
export { FileContent, useDictionaryEditionDrawer, useDictionaryEditionDrawerControl } from './DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
|
|
3
|
-
export { EditedContent, useEditedContentStore } from './DictionaryEditionDrawer/useEditedContentStore.mjs';
|
|
4
|
-
export { DictionaryListDrawer } from './DictionaryListDrawer/DictionaryListDrawer.mjs';
|
|
5
|
-
export { dictionaryListDrawerIdentifier, useDictionaryListDrawer } from './DictionaryListDrawer/useDictionaryListDrawer.mjs';
|
|
6
|
-
export { ContentEditionLayout, ContentEditionLayoutProps } from './ContentEditionLayout.mjs';
|
|
7
|
-
export { useEditorServer } from './useEditorServer.mjs';
|
|
8
|
-
export { IntlayerEditorElementProps, RenderIntlayerEditorResult, renderIntlayerEditor } from './renderContentEditor.mjs';
|
|
9
|
-
export { IntlayerEditorContext, IntlayerEditorProvider, IntlayerEditorProviderProps, useIntlayerEditorContext } from './ContentEditorProvider.mjs';
|
|
10
|
-
import '@intlayer/config/client';
|
|
11
|
-
import 'react';
|
|
12
|
-
import '@intlayer/core';
|
|
13
|
-
import 'zustand/middleware';
|
|
14
|
-
import 'zustand';
|
|
15
|
-
import '@intlayer/design-system';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer/index';\nexport * from './DictionaryListDrawer/index';\nexport * from './ContentEditionLayout';\nexport * from './useEditorServer';\nexport * from './renderContentEditor';\nexport * from './ContentEditorProvider';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { KeyPath } from '@intlayer/core';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type IntlayerEditorElementProps = {
|
|
5
|
-
content: string;
|
|
6
|
-
dictionaryId: string;
|
|
7
|
-
dictionaryPath: string;
|
|
8
|
-
keyPath: KeyPath[];
|
|
9
|
-
};
|
|
10
|
-
type RenderIntlayerEditorResult = ReactNode & {
|
|
11
|
-
value: string;
|
|
12
|
-
};
|
|
13
|
-
declare const renderIntlayerEditor: (data: IntlayerEditorElementProps) => RenderIntlayerEditorResult;
|
|
14
|
-
|
|
15
|
-
export { type IntlayerEditorElementProps, type RenderIntlayerEditorResult, renderIntlayerEditor };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/renderContentEditor.tsx"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport type { KeyPath } from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\nexport type IntlayerEditorElementProps = {\n content: string;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport type RenderIntlayerEditorResult = ReactNode & { value: string };\n\nconst IntlayerEditorElement = ({\n content,\n ...props\n}: IntlayerEditorElementProps) => {\n if (enabled) {\n return (\n <ContentSelectorWrapper {...props}>{content}</ContentSelectorWrapper>\n );\n }\n return content;\n};\n\nIntlayerEditorElement.content = '';\n\nexport const renderIntlayerEditor = (\n data: IntlayerEditorElementProps\n): RenderIntlayerEditorResult => {\n const Result = <IntlayerEditorElement {...data} />;\n\n return { ...Result, value: data.content };\n};\n"],"mappings":"AAwBM;AAxBN,SAAS,wBAAwB;AAGjC,SAAS,8BAA8B;AAEvC,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,IAAI,iBAAiB;AAWrB,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MAAkC;AAChC,MAAI,SAAS;AACX,WACE,oBAAC,0BAAwB,GAAG,OAAQ,mBAAQ;AAAA,EAEhD;AACA,SAAO;AACT;AAEA,sBAAsB,UAAU;AAEzB,MAAM,uBAAuB,CAClC,SAC+B;AAC/B,QAAM,SAAS,oBAAC,yBAAuB,GAAG,MAAM;AAEhD,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK,QAAQ;AAC1C;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useEditorServer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport { useEditedContentStore } from './DictionaryEditionDrawer/useEditedContentStore';\n\nexport const useEditorServer = () => {\n const { editedContent, clearEditedContent } = useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n clearEditedContent: s.clearEditedContent,\n }));\n\n const editContentRequest = async () => {\n const {\n editor: { port },\n } = getConfiguration();\n\n await fetch(`http://localhost:${port}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(editedContent),\n })\n .then((response) => {\n if (!response.ok) {\n throw new Error('Failed to edit content');\n }\n clearEditedContent();\n })\n .catch((error) => {\n console.error('Failed to edit content:', error);\n });\n };\n\n return { editContentRequest };\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AAE/B,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,eAAe,mBAAmB,IAAI,sBAAsB,CAAC,OAAO;AAAA,IAC1E,eAAe,EAAE;AAAA,IACjB,oBAAoB,EAAE;AAAA,EACxB,EAAE;AAEF,QAAM,qBAAqB,YAAY;AACrC,UAAM;AAAA,MACJ,QAAQ,EAAE,KAAK;AAAA,IACjB,IAAI,iBAAiB;AAErB,UAAM,MAAM,oBAAoB,IAAI,IAAI;AAAA,MACtC,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,aAAa;AAAA,IACpC,CAAC,EACE,KAAK,CAAC,aAAa;AAClB,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,IAAI,MAAM,wBAAwB;AAAA,MAC1C;AACA,yBAAmB;AAAA,IACrB,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,cAAQ,MAAM,2BAA2B,KAAK;AAAA,IAChD,CAAC;AAAA,EACL;AAEA,SAAO,EAAE,mBAAmB;AAC9B;","names":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import prettier from "prettier";
|
|
2
|
-
const format = async (content) => {
|
|
3
|
-
let options = {};
|
|
4
|
-
try {
|
|
5
|
-
options = await prettier.resolveConfig(content, {
|
|
6
|
-
editorconfig: true
|
|
7
|
-
}) ?? {};
|
|
8
|
-
} catch (error) {
|
|
9
|
-
console.error("Failed to resolve Prettier configuration:", error);
|
|
10
|
-
}
|
|
11
|
-
const config = { ...options, parser: "typescript" };
|
|
12
|
-
return prettier.format(content, config);
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
format
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=formatPrettier.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/formatPrettier.ts"],"sourcesContent":["import prettier from 'prettier';\n\n/**\n * Format the content with Prettier\n */\nexport const format = async (content: string) => {\n // Resolve the configuration from the project\n let options: prettier.Options = {};\n\n try {\n // Resolve the prettier configuration from the project\n options =\n (await prettier.resolveConfig(content, {\n editorconfig: true,\n })) ?? {};\n } catch (error) {\n console.error('Failed to resolve Prettier configuration:', error);\n }\n\n // Add the parser option to the resolved config\n const config: prettier.Options = { ...options, parser: 'typescript' };\n\n return prettier.format(content, config);\n};\n"],"mappings":"AAAA,OAAO,cAAc;AAKd,MAAM,SAAS,OAAO,YAAoB;AAE/C,MAAI,UAA4B,CAAC;AAEjC,MAAI;AAEF,cACG,MAAM,SAAS,cAAc,SAAS;AAAA,MACrC,cAAc;AAAA,IAChB,CAAC,KAAM,CAAC;AAAA,EACZ,SAAS,OAAO;AACd,YAAQ,MAAM,6CAA6C,KAAK;AAAA,EAClE;AAGA,QAAM,SAA2B,EAAE,GAAG,SAAS,QAAQ,aAAa;AAEpE,SAAO,SAAS,OAAO,SAAS,MAAM;AACxC;","names":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config";
|
|
2
|
-
import bodyParser from "body-parser";
|
|
3
|
-
import express from "express";
|
|
4
|
-
import { processEdition } from './processEdition.mjs';
|
|
5
|
-
const startIntlayerEditor = () => {
|
|
6
|
-
const app = express();
|
|
7
|
-
const {
|
|
8
|
-
editor: { port }
|
|
9
|
-
} = getConfiguration();
|
|
10
|
-
app.use(bodyParser.json());
|
|
11
|
-
app.use(bodyParser.urlencoded({ extended: true }));
|
|
12
|
-
app.post(
|
|
13
|
-
"/",
|
|
14
|
-
async (req, res) => {
|
|
15
|
-
const editedContent = req.body;
|
|
16
|
-
try {
|
|
17
|
-
await processEdition(editedContent);
|
|
18
|
-
res.send({ success: true, editedContent });
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error(error);
|
|
21
|
-
res.status(500).send({ success: false });
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
app.listen(port, () => {
|
|
26
|
-
console.info(
|
|
27
|
-
`Intlayer editor server is running on http://localhost:${port}`
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
startIntlayerEditor
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport bodyParser from 'body-parser';\nimport express, { type Request, type Response } from 'express';\nimport type { EditedContent } from '../client';\nimport { processEdition } from './processEdition';\n\nexport const startIntlayerEditor = () => {\n const app = express();\n const {\n editor: { port },\n } = getConfiguration();\n\n app.use(bodyParser.json());\n app.use(bodyParser.urlencoded({ extended: true }));\n\n app.post(\n '/',\n async (\n req: Request<undefined, undefined, EditedContent>,\n res: Response\n ) => {\n const editedContent = req.body;\n\n try {\n await processEdition(editedContent);\n\n res.send({ success: true, editedContent });\n } catch (error) {\n console.error(error);\n res.status(500).send({ success: false });\n }\n }\n );\n\n app.listen(port, () => {\n console.info(\n `Intlayer editor server is running on http://localhost:${port}`\n );\n });\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,OAAO,gBAAgB;AACvB,OAAO,aAA8C;AAErD,SAAS,sBAAsB;AAExB,MAAM,sBAAsB,MAAM;AACvC,QAAM,MAAM,QAAQ;AACpB,QAAM;AAAA,IACJ,QAAQ,EAAE,KAAK;AAAA,EACjB,IAAI,iBAAiB;AAErB,MAAI,IAAI,WAAW,KAAK,CAAC;AACzB,MAAI,IAAI,WAAW,WAAW,EAAE,UAAU,KAAK,CAAC,CAAC;AAEjD,MAAI;AAAA,IACF;AAAA,IACA,OACE,KACA,QACG;AACH,YAAM,gBAAgB,IAAI;AAE1B,UAAI;AACF,cAAM,eAAe,aAAa;AAElC,YAAI,KAAK,EAAE,SAAS,MAAM,cAAc,CAAC;AAAA,MAC3C,SAAS,OAAO;AACd,gBAAQ,MAAM,KAAK;AACnB,YAAI,OAAO,GAAG,EAAE,KAAK,EAAE,SAAS,MAAM,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,MAAM;AACrB,YAAQ;AAAA,MACN,yDAAyD,IAAI;AAAA,IAC/D;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EditedContent } from '../client/DictionaryEditionDrawer/useEditedContentStore.mjs';
|
|
2
|
-
import 'zustand/middleware';
|
|
3
|
-
import 'zustand';
|
|
4
|
-
import '@intlayer/core';
|
|
5
|
-
import '@intlayer/design-system';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Edit the content of a file based on the key path and new value
|
|
9
|
-
*/
|
|
10
|
-
declare const processEdition: (editedContent: EditedContent) => Promise<void>;
|
|
11
|
-
|
|
12
|
-
export { processEdition };
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "fs";
|
|
2
|
-
import { createRequire } from "module";
|
|
3
|
-
import { parse } from "@babel/parser";
|
|
4
|
-
import {
|
|
5
|
-
NodeType
|
|
6
|
-
} from "@intlayer/core";
|
|
7
|
-
import { format } from './formatPrettier.mjs';
|
|
8
|
-
const requireFunction = typeof import.meta.url === "undefined" ? require : createRequire(import.meta.url);
|
|
9
|
-
const { default: generate } = requireFunction("@babel/generator");
|
|
10
|
-
const findNestedProperty = (obj, keyPath) => {
|
|
11
|
-
let currentObj = obj;
|
|
12
|
-
for (const key of keyPath) {
|
|
13
|
-
const nextProperty = getNextProperty(currentObj, key);
|
|
14
|
-
if (!nextProperty)
|
|
15
|
-
throw new Error("Could not find the specified key path.");
|
|
16
|
-
currentObj = nextProperty;
|
|
17
|
-
}
|
|
18
|
-
return currentObj;
|
|
19
|
-
};
|
|
20
|
-
const getNextProperty = (obj, key) => {
|
|
21
|
-
if (key.type === "ObjectExpression") {
|
|
22
|
-
return findInObjectExpression(
|
|
23
|
-
obj,
|
|
24
|
-
key
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
if (key.type === "ArrayExpression") {
|
|
28
|
-
return obj.elements[key.key];
|
|
29
|
-
}
|
|
30
|
-
if (Object.values(NodeType).includes(key.type)) {
|
|
31
|
-
return findInTranslationOrEnumerationNode(
|
|
32
|
-
obj,
|
|
33
|
-
key
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
return void 0;
|
|
37
|
-
};
|
|
38
|
-
const findInObjectExpression = (obj, key) => {
|
|
39
|
-
const result = obj.properties.find(
|
|
40
|
-
(prop) => "key" in prop && prop.key.name === key.key
|
|
41
|
-
);
|
|
42
|
-
return result && "value" in result ? result.value : void 0;
|
|
43
|
-
};
|
|
44
|
-
const findInTranslationOrEnumerationNode = (obj, key) => {
|
|
45
|
-
const argument = obj.arguments[0];
|
|
46
|
-
const identifierResult = argument.properties.find(
|
|
47
|
-
(prop) => "key" in prop && prop.key.name === key.key
|
|
48
|
-
);
|
|
49
|
-
const stringResult = identifierResult.value;
|
|
50
|
-
return stringResult ? identifierResult : identifierResult && "name" in identifierResult ? identifierResult.name : void 0;
|
|
51
|
-
};
|
|
52
|
-
const findAndUpdate = (objExpr, keyPath, newValue) => {
|
|
53
|
-
const lastKey = keyPath[keyPath.length - 1];
|
|
54
|
-
if (lastKey) {
|
|
55
|
-
const propertyToUpdate = findNestedProperty(objExpr, keyPath);
|
|
56
|
-
if (!propertyToUpdate) {
|
|
57
|
-
throw new Error("Could not find the specified key path.");
|
|
58
|
-
}
|
|
59
|
-
if ("value" in propertyToUpdate) {
|
|
60
|
-
propertyToUpdate.value.value = newValue;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const traverseNode = (node, keyPath, newValue) => {
|
|
65
|
-
if (Array.isArray(node.body)) {
|
|
66
|
-
node.body.forEach(
|
|
67
|
-
(subNode) => traverseNode(subNode, keyPath, newValue)
|
|
68
|
-
);
|
|
69
|
-
} else if (node.body) {
|
|
70
|
-
traverseNode(node.body, keyPath, newValue);
|
|
71
|
-
}
|
|
72
|
-
if (
|
|
73
|
-
// For ES Module (e.g., `const variable = ...; export default variable`)
|
|
74
|
-
"declarations" in node
|
|
75
|
-
) {
|
|
76
|
-
node.declarations.forEach((declaration) => {
|
|
77
|
-
if (declaration.init?.type === "ObjectExpression") {
|
|
78
|
-
findAndUpdate(declaration.init, keyPath, newValue);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (
|
|
83
|
-
// For ES Module (e.g., `export default { ... }`)
|
|
84
|
-
"declaration" in node && node.declaration.type === "ObjectExpression"
|
|
85
|
-
) {
|
|
86
|
-
return findAndUpdate(
|
|
87
|
-
node.declaration,
|
|
88
|
-
keyPath,
|
|
89
|
-
newValue
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
if (
|
|
93
|
-
// For CommonJS (e.g., `module.exports = ...`)
|
|
94
|
-
"expression" in node && node.expression.right.type === "ObjectExpression"
|
|
95
|
-
) {
|
|
96
|
-
return findAndUpdate(
|
|
97
|
-
node.expression.right,
|
|
98
|
-
keyPath,
|
|
99
|
-
newValue
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const processEdition = async (editedContent) => {
|
|
104
|
-
for (const dictionaryPath of Object.keys(editedContent)) {
|
|
105
|
-
const fileContent = readFileSync(dictionaryPath, "utf-8");
|
|
106
|
-
const parsedBase = parseFileContent(fileContent);
|
|
107
|
-
const parsed = parseFileContent(fileContent);
|
|
108
|
-
for (const { keyPath, newValue } of editedContent[dictionaryPath]) {
|
|
109
|
-
traverseNode(parsed.program, keyPath, newValue);
|
|
110
|
-
}
|
|
111
|
-
await writeUpdatedContent(dictionaryPath, parsedBase, parsed);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
const parseFileContent = (fileContent) => parse(fileContent, {
|
|
115
|
-
sourceType: "module",
|
|
116
|
-
plugins: ["jsx", "typescript"]
|
|
117
|
-
});
|
|
118
|
-
const writeUpdatedContent = async (dictionaryPath, parsedBase, parsed) => {
|
|
119
|
-
const baseContent = generate(parsedBase).code;
|
|
120
|
-
const updatedContent = generate(parsed).code;
|
|
121
|
-
if (baseContent === updatedContent) {
|
|
122
|
-
console.info(
|
|
123
|
-
`No change made on the dictionary - dictionaryPath: ${dictionaryPath}.`
|
|
124
|
-
);
|
|
125
|
-
} else {
|
|
126
|
-
const formattedContent = await format(updatedContent);
|
|
127
|
-
writeFileSync(dictionaryPath, formattedContent, "utf-8");
|
|
128
|
-
console.info("Updated the file successfully.");
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
export {
|
|
132
|
-
processEdition
|
|
133
|
-
};
|
|
134
|
-
//# sourceMappingURL=processEdition.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/processEdition.ts"],"sourcesContent":["/* eslint-disable sonarjs/cognitive-complexity */\nimport { readFileSync, writeFileSync } from 'fs';\nimport { createRequire } from 'module';\nimport { parse } from '@babel/parser';\nimport type {\n ObjectExpression,\n VariableDeclarator,\n Program,\n Identifier,\n StringLiteral,\n AssignmentExpression,\n ObjectProperty,\n CallExpression,\n ArrayExpression,\n} from '@babel/types';\nimport {\n NodeType,\n type KeyPath,\n type ArrayExpressionNode,\n type ObjectExpressionNode,\n type TranslationOrEnumerationNode,\n} from '@intlayer/core';\nimport type { EditedContent } from '../client/index';\nimport { format } from './formatPrettier';\n\nconst requireFunction =\n typeof import.meta.url === 'undefined'\n ? require\n : createRequire(import.meta.url);\n\nconst { default: generate } = requireFunction('@babel/generator');\n\ntype ObjectOrArrayExpression = ObjectExpression | ArrayExpression;\n\n/**\n * Helper function to find a nested property in an ObjectExpression based on a key path\n */\nconst findNestedProperty = (\n obj: ObjectOrArrayExpression,\n keyPath: KeyPath[]\n): ObjectOrArrayExpression | undefined => {\n let currentObj: ObjectOrArrayExpression = obj;\n\n for (const key of keyPath) {\n const nextProperty = getNextProperty(currentObj, key);\n\n if (!nextProperty)\n throw new Error('Could not find the specified key path.');\n\n currentObj = nextProperty;\n }\n\n return currentObj;\n};\n\nconst getNextProperty = (\n obj: ObjectOrArrayExpression,\n key: KeyPath\n): ObjectOrArrayExpression | undefined => {\n if ((key as ObjectExpressionNode).type === 'ObjectExpression') {\n return findInObjectExpression(\n obj as ObjectExpression,\n key as ObjectExpressionNode\n );\n }\n\n if ((key as ArrayExpressionNode).type === 'ArrayExpression') {\n return (obj as ArrayExpression).elements[\n (key as ArrayExpressionNode).key\n ] as ObjectOrArrayExpression;\n }\n\n if (\n Object.values(NodeType).includes((key as TranslationOrEnumerationNode).type)\n ) {\n return findInTranslationOrEnumerationNode(\n obj as unknown as CallExpression,\n key as TranslationOrEnumerationNode\n );\n }\n\n return undefined;\n};\n\nconst findInObjectExpression = (\n obj: ObjectExpression,\n key: ObjectExpressionNode\n): ObjectOrArrayExpression | undefined => {\n const result = obj.properties.find(\n (prop) => 'key' in prop && (prop.key as Identifier).name === key.key\n );\n\n return result && 'value' in result\n ? (result.value as ObjectOrArrayExpression)\n : undefined;\n};\n\nconst findInTranslationOrEnumerationNode = (\n obj: CallExpression,\n key: TranslationOrEnumerationNode\n): ObjectOrArrayExpression | undefined => {\n const argument = obj.arguments[0] as ObjectExpression;\n const identifierResult = argument.properties.find(\n (prop) => 'key' in prop && (prop.key as Identifier).name === key.key\n ) as ObjectProperty;\n\n const stringResult = identifierResult.value as StringLiteral;\n\n return stringResult\n ? (identifierResult as unknown as ObjectOrArrayExpression)\n : identifierResult && 'name' in identifierResult\n ? (identifierResult.name as ObjectOrArrayExpression)\n : undefined;\n};\n\n/**\n * Find and update specific content based on key path\n */\nconst findAndUpdate = (\n objExpr: ObjectExpression,\n keyPath: KeyPath[],\n newValue: string\n) => {\n const lastKey = keyPath[keyPath.length - 1]; // Get the last key in the path\n\n if (lastKey) {\n const propertyToUpdate = findNestedProperty(objExpr, keyPath); // Traverse the key path\n\n if (!propertyToUpdate) {\n throw new Error('Could not find the specified key path.');\n }\n\n if ('value' in propertyToUpdate) {\n (propertyToUpdate.value as StringLiteral).value = newValue; // Update the value of the specified key\n }\n }\n};\n\n/**\n * Traverse the AST and update based on key path and new value\n */\nconst traverseNode = (node: Program, keyPath: KeyPath[], newValue: string) => {\n if (Array.isArray(node.body)) {\n node.body.forEach((subNode) =>\n traverseNode(subNode as unknown as Program, keyPath, newValue)\n );\n } else if (node.body) {\n traverseNode(node.body as Program, keyPath, newValue);\n }\n\n if (\n // For ES Module (e.g., `const variable = ...; export default variable`)\n 'declarations' in node\n ) {\n (node.declarations as VariableDeclarator[]).forEach((declaration) => {\n if (declaration.init?.type === 'ObjectExpression') {\n findAndUpdate(declaration.init, keyPath, newValue);\n }\n });\n }\n\n if (\n // For ES Module (e.g., `export default { ... }`)\n 'declaration' in node &&\n (node.declaration as ObjectExpression).type === 'ObjectExpression'\n ) {\n return findAndUpdate(\n node.declaration as ObjectExpression,\n keyPath,\n newValue\n );\n }\n\n if (\n // For CommonJS (e.g., `module.exports = ...`)\n 'expression' in node &&\n (node.expression as AssignmentExpression).right.type === 'ObjectExpression'\n ) {\n return findAndUpdate(\n (node.expression as AssignmentExpression).right as ObjectExpression,\n keyPath,\n newValue\n );\n }\n};\n\n/**\n * Edit the content of a file based on the key path and new value\n */\nexport const processEdition = async (editedContent: EditedContent) => {\n for (const dictionaryPath of Object.keys(editedContent)) {\n const fileContent = readFileSync(dictionaryPath, 'utf-8');\n const parsedBase = parseFileContent(fileContent);\n const parsed = parseFileContent(fileContent);\n\n for (const { keyPath, newValue } of editedContent[dictionaryPath]) {\n traverseNode(parsed.program, keyPath, newValue);\n }\n\n await writeUpdatedContent(dictionaryPath, parsedBase, parsed);\n }\n};\n\nconst parseFileContent = (fileContent: string) =>\n parse(fileContent, {\n sourceType: 'module',\n plugins: ['jsx', 'typescript'],\n });\n\nconst writeUpdatedContent = async (\n dictionaryPath: string,\n parsedBase: ReturnType<typeof parseFileContent>,\n parsed: ReturnType<typeof parseFileContent>\n) => {\n const baseContent = generate(parsedBase).code;\n const updatedContent = generate(parsed).code;\n\n if (baseContent === updatedContent) {\n console.info(\n `No change made on the dictionary - dictionaryPath: ${dictionaryPath}.`\n );\n } else {\n const formattedContent = await format(updatedContent);\n writeFileSync(dictionaryPath, formattedContent, 'utf-8');\n console.info('Updated the file successfully.');\n }\n};\n"],"mappings":"AACA,SAAS,cAAc,qBAAqB;AAC5C,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AAYtB;AAAA,EACE;AAAA,OAKK;AAEP,SAAS,cAAc;AAEvB,MAAM,kBACJ,OAAO,YAAY,QAAQ,cACvB,UACA,cAAc,YAAY,GAAG;AAEnC,MAAM,EAAE,SAAS,SAAS,IAAI,gBAAgB,kBAAkB;AAOhE,MAAM,qBAAqB,CACzB,KACA,YACwC;AACxC,MAAI,aAAsC;AAE1C,aAAW,OAAO,SAAS;AACzB,UAAM,eAAe,gBAAgB,YAAY,GAAG;AAEpD,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,wCAAwC;AAE1D,iBAAa;AAAA,EACf;AAEA,SAAO;AACT;AAEA,MAAM,kBAAkB,CACtB,KACA,QACwC;AACxC,MAAK,IAA6B,SAAS,oBAAoB;AAC7D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAK,IAA4B,SAAS,mBAAmB;AAC3D,WAAQ,IAAwB,SAC7B,IAA4B,GAC/B;AAAA,EACF;AAEA,MACE,OAAO,OAAO,QAAQ,EAAE,SAAU,IAAqC,IAAI,GAC3E;AACA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,yBAAyB,CAC7B,KACA,QACwC;AACxC,QAAM,SAAS,IAAI,WAAW;AAAA,IAC5B,CAAC,SAAS,SAAS,QAAS,KAAK,IAAmB,SAAS,IAAI;AAAA,EACnE;AAEA,SAAO,UAAU,WAAW,SACvB,OAAO,QACR;AACN;AAEA,MAAM,qCAAqC,CACzC,KACA,QACwC;AACxC,QAAM,WAAW,IAAI,UAAU,CAAC;AAChC,QAAM,mBAAmB,SAAS,WAAW;AAAA,IAC3C,CAAC,SAAS,SAAS,QAAS,KAAK,IAAmB,SAAS,IAAI;AAAA,EACnE;AAEA,QAAM,eAAe,iBAAiB;AAEtC,SAAO,eACF,mBACD,oBAAoB,UAAU,mBAC3B,iBAAiB,OAClB;AACR;AAKA,MAAM,gBAAgB,CACpB,SACA,SACA,aACG;AACH,QAAM,UAAU,QAAQ,QAAQ,SAAS,CAAC;AAE1C,MAAI,SAAS;AACX,UAAM,mBAAmB,mBAAmB,SAAS,OAAO;AAE5D,QAAI,CAAC,kBAAkB;AACrB,YAAM,IAAI,MAAM,wCAAwC;AAAA,IAC1D;AAEA,QAAI,WAAW,kBAAkB;AAC/B,MAAC,iBAAiB,MAAwB,QAAQ;AAAA,IACpD;AAAA,EACF;AACF;AAKA,MAAM,eAAe,CAAC,MAAe,SAAoB,aAAqB;AAC5E,MAAI,MAAM,QAAQ,KAAK,IAAI,GAAG;AAC5B,SAAK,KAAK;AAAA,MAAQ,CAAC,YACjB,aAAa,SAA+B,SAAS,QAAQ;AAAA,IAC/D;AAAA,EACF,WAAW,KAAK,MAAM;AACpB,iBAAa,KAAK,MAAiB,SAAS,QAAQ;AAAA,EACtD;AAEA;AAAA;AAAA,IAEE,kBAAkB;AAAA,IAClB;AACA,IAAC,KAAK,aAAsC,QAAQ,CAAC,gBAAgB;AACnE,UAAI,YAAY,MAAM,SAAS,oBAAoB;AACjD,sBAAc,YAAY,MAAM,SAAS,QAAQ;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AAEA;AAAA;AAAA,IAEE,iBAAiB,QAChB,KAAK,YAAiC,SAAS;AAAA,IAChD;AACA,WAAO;AAAA,MACL,KAAK;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA;AAAA;AAAA,IAEE,gBAAgB,QACf,KAAK,WAAoC,MAAM,SAAS;AAAA,IACzD;AACA,WAAO;AAAA,MACJ,KAAK,WAAoC;AAAA,MAC1C;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAKO,MAAM,iBAAiB,OAAO,kBAAiC;AACpE,aAAW,kBAAkB,OAAO,KAAK,aAAa,GAAG;AACvD,UAAM,cAAc,aAAa,gBAAgB,OAAO;AACxD,UAAM,aAAa,iBAAiB,WAAW;AAC/C,UAAM,SAAS,iBAAiB,WAAW;AAE3C,eAAW,EAAE,SAAS,SAAS,KAAK,cAAc,cAAc,GAAG;AACjE,mBAAa,OAAO,SAAS,SAAS,QAAQ;AAAA,IAChD;AAEA,UAAM,oBAAoB,gBAAgB,YAAY,MAAM;AAAA,EAC9D;AACF;AAEA,MAAM,mBAAmB,CAAC,gBACxB,MAAM,aAAa;AAAA,EACjB,YAAY;AAAA,EACZ,SAAS,CAAC,OAAO,YAAY;AAC/B,CAAC;AAEH,MAAM,sBAAsB,OAC1B,gBACA,YACA,WACG;AACH,QAAM,cAAc,SAAS,UAAU,EAAE;AACzC,QAAM,iBAAiB,SAAS,MAAM,EAAE;AAExC,MAAI,gBAAgB,gBAAgB;AAClC,YAAQ;AAAA,MACN,sDAAsD,cAAc;AAAA,IACtE;AAAA,EACF,OAAO;AACL,UAAM,mBAAmB,MAAM,OAAO,cAAc;AACpD,kBAAc,gBAAgB,kBAAkB,OAAO;AACvD,YAAQ,KAAK,gCAAgC;AAAA,EAC/C;AACF;","names":[]}
|
|
File without changes
|
/package/dist/cjs/{client/DictionaryListDrawer → DictionaryListDrawer}/useDictionaryListDrawer.cjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/esm/{client/DictionaryListDrawer → DictionaryListDrawer}/useDictionaryListDrawer.mjs
RENAMED
|
File without changes
|
|
File without changes
|