Type Alias: LixPlugin

LixPlugin = { applyChanges?: ({ file, changes, }: { changes: Change[]; file: Omit<LixFile, "data"> & { data?: Uint8Array; }; }) => { fileData: Uint8Array; }; detectChanges?: ({ before, after, }: { after: Omit<LixFile, "data"> & { data: Uint8Array; }; before?: Omit<LixFile, "data"> & { data?: Uint8Array; }; }) => DetectedChange[]; detectChangesGlob?: string; diffUiComponent?: CustomElementConstructor; key: string; }

Properties

applyChanges()?

optional applyChanges: ({ file, changes, }: { changes: Change[]; file: Omit<LixFile, "data"> & { data?: Uint8Array; }; }) => { fileData: Uint8Array; }

Parameters

ParameterTypeDescription
{ file, changes, }{ changes: Change[]; file: Omit<LixFile, "data"> & { data?: Uint8Array; }; }-
{ file, changes, }.changesChange[]-
{ file, changes, }.fileOmit<LixFile, "data"> & { data?: Uint8Array; }The file to which the changes should be applied. The file.data might be undefined if the file does not exist at the time of applying the changes. This can happen when merging a version that created a new file that did not exist in the target version. Or, a file has been deleted and should be restored at a later point.

Returns

{ fileData: Uint8Array; }

fileData

fileData: Uint8Array


detectChanges()?

optional detectChanges: ({ before, after, }: { after: Omit<LixFile, "data"> & { data: Uint8Array; }; before?: Omit<LixFile, "data"> & { data?: Uint8Array; }; }) => DetectedChange[]

Detects changes between the before and after file update(s).

Before is undefined if the file did not exist before ( the file was created).

After is always defined. Either the file was updated, or deleted. If the file is deleted, lix own change control will handle the deletion. Hence, after is always be defined.

Parameters

ParameterType
{ before, after, }{ after: Omit<LixFile, "data"> & { data: Uint8Array; }; before?: Omit<LixFile, "data"> & { data?: Uint8Array; }; }
{ before, after, }.afterOmit<LixFile, "data"> & { data: Uint8Array; }
{ before, after, }.before?Omit<LixFile, "data"> & { data?: Uint8Array; }

Returns

DetectedChange[]


detectChangesGlob?

optional detectChangesGlob: string

The glob pattern that should invoke detectChanges().

Example

`**/*.json` for all JSON files
  `**/*.inlang` for all inlang files

diffUiComponent?

optional diffUiComponent: CustomElementConstructor

UI components that are used to render the diff view.


key

key: string