@inlang/sdk 2.6.2 → 2.7.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.
@@ -55,6 +55,11 @@ function toV1Pattern(pattern) {
55
55
  }
56
56
  throw new Error(`Unsupported expression argument type`);
57
57
  }
58
+ case "markup-start":
59
+ case "markup-end":
60
+ case "markup-standalone": {
61
+ throw new Error("Markup placeholders are not supported in MessageV1 conversion");
62
+ }
58
63
  default: {
59
64
  throw new Error(`Unsupported pattern element type`);
60
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toMessageV1.js","sourceRoot":"/","sources":["json-schema/old-v1-message/toMessageV1.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAoB;IAC/C,MAAM,QAAQ,GAAgB,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,6BAA6B;QAC7B,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;SACZ,CAAC,CAAC,EAAE,CAAC;YACL,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;QAED,uBAAuB;QACvB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACxC,QAAQ,CAAC,IAAI,CAAC;gBACb,WAAW,EAAE,OAAO,CAAC,MAAM;gBAC3B,KAAK,EAAE,EAAE;gBACT,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;aACrC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAmB,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnE,IAAI,EAAE,mBAAmB;QACzB,IAAI;KACJ,CAAC,CAAC,CAAC;IAEJ,OAAO;QACN,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,KAAK,EAAE,EAAE;QACT,QAAQ;QACR,SAAS;KACT,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,OAAgB;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,KAAK,MAAM,CAAC,CAAC,CAAC;gBACb,OAAO;oBACN,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,OAAO,CAAC,KAAK;iBACpB,CAAC;YACH,CAAC;YAED,KAAK,YAAY,CAAC,CAAC,CAAC;gBACnB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;oBAC/C,OAAO;wBACN,IAAI,EAAE,mBAAmB;wBACzB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;qBACtB,CAAC;gBACH,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACzD,CAAC;YAED,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACrD,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleNested } from \"../../database/schema.js\";\nimport type { Pattern } from \"../pattern.js\";\nimport type {\n\tExpressionV1,\n\tMessageV1,\n\tPatternV1,\n\tVariantV1,\n} from \"./schemaV1.js\";\n\n/**\n * Converts a BundleNested into a legacy format.\n *\n * @throws If the message cannot be represented in the v1 format\n */\nexport function toMessageV1(bundle: BundleNested): MessageV1 {\n\tconst variants: VariantV1[] = [];\n\tconst selectorNames = new Set<string>();\n\n\tfor (const message of bundle.messages) {\n\t\t// collect all selector names\n\t\tfor (const selector of message.selectors.map((s) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname: s.name,\n\t\t}))) {\n\t\t\tselectorNames.add(selector.name);\n\t\t}\n\n\t\t// collect all variants\n\t\tfor (const variant of message.variants) {\n\t\t\tvariants.push({\n\t\t\t\tlanguageTag: message.locale,\n\t\t\t\tmatch: [],\n\t\t\t\tpattern: toV1Pattern(variant.pattern),\n\t\t\t});\n\t\t}\n\t}\n\n\tconst selectors: ExpressionV1[] = [...selectorNames].map((name) => ({\n\t\ttype: \"VariableReference\",\n\t\tname,\n\t}));\n\n\treturn {\n\t\tid: bundle.id,\n\t\talias: {},\n\t\tvariants,\n\t\tselectors,\n\t};\n}\n\n/**\n * @throws If the pattern cannot be represented in the v1 format\n */\nfunction toV1Pattern(pattern: Pattern): PatternV1 {\n\treturn pattern.map((element) => {\n\t\tswitch (element.type) {\n\t\t\tcase \"text\": {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: element.value,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tcase \"expression\": {\n\t\t\t\tif (element.arg.type === \"variable-reference\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"VariableReference\",\n\t\t\t\t\t\tname: element.arg.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Unsupported expression argument type`);\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unsupported pattern element type`);\n\t\t\t}\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"toMessageV1.js","sourceRoot":"/","sources":["json-schema/old-v1-message/toMessageV1.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAoB;IAC/C,MAAM,QAAQ,GAAgB,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,KAAK,MAAM,OAAO,IAAI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B,EAAE,CAAC;oBAC/C,OAAO;wBACN,IAAI,EAAE,mBAAmB;wBACzB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;qBACtB,CAAC;gBACH,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACzD,CAAC;YAED,KAAK,cAAc,CAAC;YACpB,KAAK,YAAY,CAAC;YAClB,KAAK,mBAAmB,CAAC,CAAC,CAAC;gBAC1B,MAAM,IAAI,KAAK,CACd,+DAA+D,CAC/D,CAAC;YACH,CAAC;YAED,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACrD,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleNested } from \"../../database/schema.js\";\nimport type { Pattern } from \"../pattern.js\";\nimport type {\n\tExpressionV1,\n\tMessageV1,\n\tPatternV1,\n\tVariantV1,\n} from \"./schemaV1.js\";\n\n/**\n * Converts a BundleNested into a legacy format.\n *\n * @throws If the message cannot be represented in the v1 format\n */\nexport function toMessageV1(bundle: BundleNested): MessageV1 {\n\tconst variants: VariantV1[] = [];\n\tconst selectorNames = new Set<string>();\n\n\tfor (const message of bundle.messages) {\n\t\t// collect all selector names\n\t\tfor (const selector of message.selectors.map((s) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname: s.name,\n\t\t}))) {\n\t\t\tselectorNames.add(selector.name);\n\t\t}\n\n\t\t// collect all variants\n\t\tfor (const variant of message.variants) {\n\t\t\tvariants.push({\n\t\t\t\tlanguageTag: message.locale,\n\t\t\t\tmatch: [],\n\t\t\t\tpattern: toV1Pattern(variant.pattern),\n\t\t\t});\n\t\t}\n\t}\n\n\tconst selectors: ExpressionV1[] = [...selectorNames].map((name) => ({\n\t\ttype: \"VariableReference\",\n\t\tname,\n\t}));\n\n\treturn {\n\t\tid: bundle.id,\n\t\talias: {},\n\t\tvariants,\n\t\tselectors,\n\t};\n}\n\n/**\n * @throws If the pattern cannot be represented in the v1 format\n */\nfunction toV1Pattern(pattern: Pattern): PatternV1 {\n\treturn pattern.map((element) => {\n\t\tswitch (element.type) {\n\t\t\tcase \"text\": {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: element.value,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tcase \"expression\": {\n\t\t\t\tif (element.arg.type === \"variable-reference\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"VariableReference\",\n\t\t\t\t\t\tname: element.arg.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Unsupported expression argument type`);\n\t\t\t}\n\n\t\t\tcase \"markup-start\":\n\t\t\tcase \"markup-end\":\n\t\t\tcase \"markup-standalone\": {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Markup placeholders are not supported in MessageV1 conversion\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unsupported pattern element type`);\n\t\t\t}\n\t\t}\n\t});\n}\n"]}
@@ -7,6 +7,47 @@ test("toMessageV1", () => {
7
7
  expect(Value.Check(MessageV1, message)).toBe(true);
8
8
  expect(message).toStrictEqual(messageV1);
9
9
  });
10
+ test("throws when message contains markup placeholders", () => {
11
+ const markupBundle = {
12
+ id: "hello_world",
13
+ declarations: [],
14
+ messages: [
15
+ {
16
+ bundleId: "hello_world",
17
+ id: "hello_world_en",
18
+ locale: "en",
19
+ selectors: [],
20
+ variants: [
21
+ {
22
+ id: "hello_world_en_1",
23
+ matches: [],
24
+ messageId: "hello_world_en",
25
+ pattern: [
26
+ {
27
+ type: "markup-start",
28
+ name: "b",
29
+ options: [
30
+ {
31
+ name: "kind",
32
+ value: { type: "literal", value: "strong" },
33
+ },
34
+ ],
35
+ attributes: [{ name: "track", value: true }],
36
+ },
37
+ { type: "text", value: "Hello World!" },
38
+ {
39
+ type: "markup-end",
40
+ name: "b",
41
+ attributes: [{ name: "track", value: true }],
42
+ },
43
+ ],
44
+ },
45
+ ],
46
+ },
47
+ ],
48
+ };
49
+ expect(() => toMessageV1(markupBundle)).toThrow("Markup placeholders are not supported in MessageV1 conversion");
50
+ });
10
51
  test.todo("with variable references", () => { });
11
52
  const messageV1 = {
12
53
  id: "hello_world",
@@ -1 +1 @@
1
- {"version":3,"file":"toMessageV1.test.js","sourceRoot":"/","sources":["json-schema/old-v1-message/toMessageV1.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE;IACxB,MAAM,OAAO,GAAY,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAEhD,MAAM,SAAS,GAAc;IAC5B,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE;QACT;YACC,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,EAAE;YACT,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,cAAc;iBACrB;aACD;SACD;QACD;YACC,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,EAAE;YACT,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,aAAa;iBACpB;aACD;SACD;KACD;IACD,SAAS,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,MAAM,GAAiB;IAC5B,EAAE,EAAE,aAAa;IACjB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE;QACT;YACC,QAAQ,EAAE,aAAa;YACvB,EAAE,EAAE,aAAa,GAAG,KAAK;YACzB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,aAAa,GAAG,OAAO;oBAC3B,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,aAAa,GAAG,KAAK;oBAChC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,cAAc;yBACrB;qBACD;iBACD;aACD;SACD;QACD;YACC,QAAQ,EAAE,aAAa;YACvB,EAAE,EAAE,aAAa,GAAG,KAAK;YACzB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,aAAa,GAAG,OAAO;oBAC3B,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,aAAa,GAAG,KAAK;oBAChC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,aAAa;yBACpB;qBACD;iBACD;aACD;SACD;KACD;CACD,CAAC","sourcesContent":["import { test, expect } from \"vitest\";\nimport { toMessageV1 } from \"./toMessageV1.js\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport { MessageV1 } from \"./schemaV1.js\";\nimport type { BundleNested } from \"../../database/schema.js\";\n\ntest(\"toMessageV1\", () => {\n\tconst message: unknown = toMessageV1(bundle);\n\texpect(Value.Check(MessageV1, message)).toBe(true);\n\n\texpect(message).toStrictEqual(messageV1);\n});\n\ntest.todo(\"with variable references\", () => {});\n\nconst messageV1: MessageV1 = {\n\tid: \"hello_world\",\n\talias: {},\n\tvariants: [\n\t\t{\n\t\t\tlanguageTag: \"en\",\n\t\t\tmatch: [],\n\t\t\tpattern: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: \"Hello World!\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlanguageTag: \"de\",\n\t\t\tmatch: [],\n\t\t\tpattern: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: \"Hallo Welt!\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\tselectors: [],\n};\n\nconst bundle: BundleNested = {\n\tid: \"hello_world\",\n\tdeclarations: [],\n\tmessages: [\n\t\t{\n\t\t\tbundleId: \"hello_world\",\n\t\t\tid: \"hello_world\" + \"_en\",\n\t\t\tlocale: \"en\",\n\t\t\tselectors: [],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tid: \"hello_world\" + \"_en_1\",\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tmessageId: \"hello_world\" + \"_en\",\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: \"Hello World!\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tbundleId: \"hello_world\",\n\t\t\tid: \"hello_world\" + \"_de\",\n\t\t\tlocale: \"de\",\n\t\t\tselectors: [],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tid: \"hello_world\" + \"_de_1\",\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tmessageId: \"hello_world\" + \"_de\",\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: \"Hallo Welt!\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n"]}
1
+ {"version":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AE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,cAAc;yBACrB;qBACD;iBACD;aACD;SACD;QACD;YACC,QAAQ,EAAE,aAAa;YACvB,EAAE,EAAE,aAAa,GAAG,KAAK;YACzB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,aAAa,GAAG,OAAO;oBAC3B,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,aAAa,GAAG,KAAK;oBAChC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,aAAa;yBACpB;qBACD;iBACD;aACD;SACD;KACD;CACD,CAAC","sourcesContent":["import { test, expect } from \"vitest\";\nimport { toMessageV1 } from \"./toMessageV1.js\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport { MessageV1 } from \"./schemaV1.js\";\nimport type { BundleNested } from \"../../database/schema.js\";\n\ntest(\"toMessageV1\", () => {\n\tconst message: unknown = toMessageV1(bundle);\n\texpect(Value.Check(MessageV1, message)).toBe(true);\n\n\texpect(message).toStrictEqual(messageV1);\n});\n\ntest(\"throws when message contains markup placeholders\", () => {\n\tconst markupBundle: BundleNested = {\n\t\tid: \"hello_world\",\n\t\tdeclarations: [],\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tbundleId: \"hello_world\",\n\t\t\t\tid: \"hello_world_en\",\n\t\t\t\tlocale: \"en\",\n\t\t\t\tselectors: [],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"hello_world_en_1\",\n\t\t\t\t\t\tmatches: [],\n\t\t\t\t\t\tmessageId: \"hello_world_en\",\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"markup-start\",\n\t\t\t\t\t\t\t\tname: \"b\",\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"kind\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"literal\", value: \"strong\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tattributes: [{ name: \"track\", value: true }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ type: \"text\", value: \"Hello World!\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"markup-end\",\n\t\t\t\t\t\t\t\tname: \"b\",\n\t\t\t\t\t\t\t\tattributes: [{ name: \"track\", value: true }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\texpect(() => toMessageV1(markupBundle)).toThrow(\n\t\t\"Markup placeholders are not supported in MessageV1 conversion\"\n\t);\n});\n\ntest.todo(\"with variable references\", () => {});\n\nconst messageV1: MessageV1 = {\n\tid: \"hello_world\",\n\talias: {},\n\tvariants: [\n\t\t{\n\t\t\tlanguageTag: \"en\",\n\t\t\tmatch: [],\n\t\t\tpattern: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: \"Hello World!\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlanguageTag: \"de\",\n\t\t\tmatch: [],\n\t\t\tpattern: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tvalue: \"Hallo Welt!\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\tselectors: [],\n};\n\nconst bundle: BundleNested = {\n\tid: \"hello_world\",\n\tdeclarations: [],\n\tmessages: [\n\t\t{\n\t\t\tbundleId: \"hello_world\",\n\t\t\tid: \"hello_world\" + \"_en\",\n\t\t\tlocale: \"en\",\n\t\t\tselectors: [],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tid: \"hello_world\" + \"_en_1\",\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tmessageId: \"hello_world\" + \"_en\",\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: \"Hello World!\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tbundleId: \"hello_world\",\n\t\t\tid: \"hello_world\" + \"_de\",\n\t\t\tlocale: \"de\",\n\t\t\tselectors: [],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tid: \"hello_world\" + \"_de_1\",\n\t\t\t\t\tmatches: [],\n\t\t\t\t\tmessageId: \"hello_world\" + \"_de\",\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: \"Hallo Welt!\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n"]}
@@ -20,6 +20,14 @@ export declare const Option: import("@sinclair/typebox").TObject<{
20
20
  name: import("@sinclair/typebox").TString;
21
21
  }>]>;
22
22
  }>;
23
+ export type Attribute = Static<typeof Attribute>;
24
+ export declare const Attribute: import("@sinclair/typebox").TObject<{
25
+ name: import("@sinclair/typebox").TString;
26
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
27
+ type: import("@sinclair/typebox").TLiteral<"literal">;
28
+ value: import("@sinclair/typebox").TString;
29
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
30
+ }>;
23
31
  export type FunctionReference = Static<typeof FunctionReference>;
24
32
  export declare const FunctionReference: import("@sinclair/typebox").TObject<{
25
33
  type: import("@sinclair/typebox").TLiteral<"function-reference">;
@@ -65,6 +73,72 @@ export declare const Text: import("@sinclair/typebox").TObject<{
65
73
  type: import("@sinclair/typebox").TLiteral<"text">;
66
74
  value: import("@sinclair/typebox").TString;
67
75
  }>;
76
+ export type MarkupStart = Static<typeof MarkupStart>;
77
+ export declare const MarkupStart: import("@sinclair/typebox").TObject<{
78
+ type: import("@sinclair/typebox").TLiteral<"markup-start">;
79
+ name: import("@sinclair/typebox").TString;
80
+ options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
81
+ name: import("@sinclair/typebox").TString;
82
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
83
+ type: import("@sinclair/typebox").TLiteral<"literal">;
84
+ value: import("@sinclair/typebox").TString;
85
+ }>, import("@sinclair/typebox").TObject<{
86
+ type: import("@sinclair/typebox").TLiteral<"variable-reference">;
87
+ name: import("@sinclair/typebox").TString;
88
+ }>]>;
89
+ }>>>;
90
+ attributes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
91
+ name: import("@sinclair/typebox").TString;
92
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
93
+ type: import("@sinclair/typebox").TLiteral<"literal">;
94
+ value: import("@sinclair/typebox").TString;
95
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
96
+ }>>>;
97
+ }>;
98
+ export type MarkupEnd = Static<typeof MarkupEnd>;
99
+ export declare const MarkupEnd: import("@sinclair/typebox").TObject<{
100
+ type: import("@sinclair/typebox").TLiteral<"markup-end">;
101
+ name: import("@sinclair/typebox").TString;
102
+ options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
103
+ name: import("@sinclair/typebox").TString;
104
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
105
+ type: import("@sinclair/typebox").TLiteral<"literal">;
106
+ value: import("@sinclair/typebox").TString;
107
+ }>, import("@sinclair/typebox").TObject<{
108
+ type: import("@sinclair/typebox").TLiteral<"variable-reference">;
109
+ name: import("@sinclair/typebox").TString;
110
+ }>]>;
111
+ }>>>;
112
+ attributes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
113
+ name: import("@sinclair/typebox").TString;
114
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
115
+ type: import("@sinclair/typebox").TLiteral<"literal">;
116
+ value: import("@sinclair/typebox").TString;
117
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
118
+ }>>>;
119
+ }>;
120
+ export type MarkupStandalone = Static<typeof MarkupStandalone>;
121
+ export declare const MarkupStandalone: import("@sinclair/typebox").TObject<{
122
+ type: import("@sinclair/typebox").TLiteral<"markup-standalone">;
123
+ name: import("@sinclair/typebox").TString;
124
+ options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
125
+ name: import("@sinclair/typebox").TString;
126
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
127
+ type: import("@sinclair/typebox").TLiteral<"literal">;
128
+ value: import("@sinclair/typebox").TString;
129
+ }>, import("@sinclair/typebox").TObject<{
130
+ type: import("@sinclair/typebox").TLiteral<"variable-reference">;
131
+ name: import("@sinclair/typebox").TString;
132
+ }>]>;
133
+ }>>>;
134
+ attributes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
135
+ name: import("@sinclair/typebox").TString;
136
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
137
+ type: import("@sinclair/typebox").TLiteral<"literal">;
138
+ value: import("@sinclair/typebox").TString;
139
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
140
+ }>>>;
141
+ }>;
68
142
  export type LocalVariable = Static<typeof LocalVariable>;
69
143
  export declare const LocalVariable: import("@sinclair/typebox").TObject<{
70
144
  type: import("@sinclair/typebox").TLiteral<"local-variable">;
@@ -186,5 +260,65 @@ export declare const Pattern: import("@sinclair/typebox").TArray<import("@sincla
186
260
  }>]>;
187
261
  }>>;
188
262
  }>>;
263
+ }>, import("@sinclair/typebox").TObject<{
264
+ type: import("@sinclair/typebox").TLiteral<"markup-start">;
265
+ name: import("@sinclair/typebox").TString;
266
+ options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
267
+ name: import("@sinclair/typebox").TString;
268
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
269
+ type: import("@sinclair/typebox").TLiteral<"literal">;
270
+ value: import("@sinclair/typebox").TString;
271
+ }>, import("@sinclair/typebox").TObject<{
272
+ type: import("@sinclair/typebox").TLiteral<"variable-reference">;
273
+ name: import("@sinclair/typebox").TString;
274
+ }>]>;
275
+ }>>>;
276
+ attributes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
277
+ name: import("@sinclair/typebox").TString;
278
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
279
+ type: import("@sinclair/typebox").TLiteral<"literal">;
280
+ value: import("@sinclair/typebox").TString;
281
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
282
+ }>>>;
283
+ }>, import("@sinclair/typebox").TObject<{
284
+ type: import("@sinclair/typebox").TLiteral<"markup-end">;
285
+ name: import("@sinclair/typebox").TString;
286
+ options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
287
+ name: import("@sinclair/typebox").TString;
288
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
289
+ type: import("@sinclair/typebox").TLiteral<"literal">;
290
+ value: import("@sinclair/typebox").TString;
291
+ }>, import("@sinclair/typebox").TObject<{
292
+ type: import("@sinclair/typebox").TLiteral<"variable-reference">;
293
+ name: import("@sinclair/typebox").TString;
294
+ }>]>;
295
+ }>>>;
296
+ attributes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
297
+ name: import("@sinclair/typebox").TString;
298
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
299
+ type: import("@sinclair/typebox").TLiteral<"literal">;
300
+ value: import("@sinclair/typebox").TString;
301
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
302
+ }>>>;
303
+ }>, import("@sinclair/typebox").TObject<{
304
+ type: import("@sinclair/typebox").TLiteral<"markup-standalone">;
305
+ name: import("@sinclair/typebox").TString;
306
+ options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
307
+ name: import("@sinclair/typebox").TString;
308
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
309
+ type: import("@sinclair/typebox").TLiteral<"literal">;
310
+ value: import("@sinclair/typebox").TString;
311
+ }>, import("@sinclair/typebox").TObject<{
312
+ type: import("@sinclair/typebox").TLiteral<"variable-reference">;
313
+ name: import("@sinclair/typebox").TString;
314
+ }>]>;
315
+ }>>>;
316
+ attributes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
317
+ name: import("@sinclair/typebox").TString;
318
+ value: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
319
+ type: import("@sinclair/typebox").TLiteral<"literal">;
320
+ value: import("@sinclair/typebox").TString;
321
+ }>, import("@sinclair/typebox").TLiteral<true>]>;
322
+ }>>>;
189
323
  }>]>>;
190
324
  //# sourceMappingURL=pattern.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.d.ts","sourceRoot":"/","sources":["json-schema/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,eAAO,MAAM,iBAAiB;;;EAG5B,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAC7C,eAAO,MAAM,OAAO;;;EAGlB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,C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CAAC,OAAO,aAAa,CAAC,CAAC;AACzD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;EAIxB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AACrD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA6C,CAAC;AAEtE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAC7C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEnB,CAAC"}
@@ -11,6 +11,10 @@ export const Option = Type.Object({
11
11
  name: Type.String(),
12
12
  value: Type.Union([Literal, VariableReference]),
13
13
  });
14
+ export const Attribute = Type.Object({
15
+ name: Type.String(),
16
+ value: Type.Union([Literal, Type.Literal(true)]),
17
+ });
14
18
  export const FunctionReference = Type.Object({
15
19
  type: Type.Literal("function-reference"),
16
20
  name: Type.String(),
@@ -25,6 +29,24 @@ export const Text = Type.Object({
25
29
  type: Type.Literal("text"),
26
30
  value: Type.String(),
27
31
  });
32
+ export const MarkupStart = Type.Object({
33
+ type: Type.Literal("markup-start"),
34
+ name: Type.String(),
35
+ options: Type.Optional(Type.Array(Option)),
36
+ attributes: Type.Optional(Type.Array(Attribute)),
37
+ });
38
+ export const MarkupEnd = Type.Object({
39
+ type: Type.Literal("markup-end"),
40
+ name: Type.String(),
41
+ options: Type.Optional(Type.Array(Option)),
42
+ attributes: Type.Optional(Type.Array(Attribute)),
43
+ });
44
+ export const MarkupStandalone = Type.Object({
45
+ type: Type.Literal("markup-standalone"),
46
+ name: Type.String(),
47
+ options: Type.Optional(Type.Array(Option)),
48
+ attributes: Type.Optional(Type.Array(Attribute)),
49
+ });
28
50
  export const LocalVariable = Type.Object({
29
51
  type: Type.Literal("local-variable"),
30
52
  name: Type.String(),
@@ -36,5 +58,5 @@ export const InputVariable = Type.Object({
36
58
  annotation: Type.Optional(FunctionReference),
37
59
  });
38
60
  export const Declaration = Type.Union([InputVariable, LocalVariable]);
39
- export const Pattern = Type.Array(Type.Union([Text, Expression]));
61
+ export const Pattern = Type.Array(Type.Union([Text, Expression, MarkupStart, MarkupEnd, MarkupStandalone]));
40
62
  //# sourceMappingURL=pattern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.js","sourceRoot":"/","sources":["json-schema/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAGtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAC7B,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;CAC/C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;IAChC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAC7C,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;CAC5C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC1B,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACpC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,UAAU;CACjB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACpC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;CAC5C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;AAGtE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\n\nexport type VariableReference = Static<typeof VariableReference>;\nexport const VariableReference = Type.Object({\n\ttype: Type.Literal(\"variable-reference\"),\n\tname: Type.String(),\n});\n\nexport type Literal = Static<typeof Literal>;\nexport const Literal = Type.Object({\n\ttype: Type.Literal(\"literal\"),\n\tvalue: Type.String(),\n});\n\nexport type Option = Static<typeof Option>;\nexport const Option = Type.Object({\n\tname: Type.String(),\n\tvalue: Type.Union([Literal, VariableReference]),\n});\n\nexport type FunctionReference = Static<typeof FunctionReference>;\nexport const FunctionReference = Type.Object({\n\ttype: Type.Literal(\"function-reference\"),\n\tname: Type.String(),\n\toptions: Type.Array(Option),\n});\n\nexport type Expression = Static<typeof Expression>;\nexport const Expression = Type.Object({\n\ttype: Type.Literal(\"expression\"),\n\targ: Type.Union([VariableReference, Literal]),\n\tannotation: Type.Optional(FunctionReference),\n});\n\nexport type Text = Static<typeof Text>;\nexport const Text = Type.Object({\n\ttype: Type.Literal(\"text\"),\n\tvalue: Type.String(),\n});\n\nexport type LocalVariable = Static<typeof LocalVariable>;\nexport const LocalVariable = Type.Object({\n\ttype: Type.Literal(\"local-variable\"),\n\tname: Type.String(),\n\tvalue: Expression,\n});\n\nexport type InputVariable = Static<typeof InputVariable>;\nexport const InputVariable = Type.Object({\n\ttype: Type.Literal(\"input-variable\"),\n\tname: Type.String(),\n\tannotation: Type.Optional(FunctionReference),\n});\n\nexport type Declaration = Static<typeof Declaration>;\nexport const Declaration = Type.Union([InputVariable, LocalVariable]);\n\nexport type Pattern = Static<typeof Pattern>;\nexport const Pattern = Type.Array(Type.Union([Text, Expression]));\n"]}
1
+ {"version":3,"file":"pattern.js","sourceRoot":"/","sources":["json-schema/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAGtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;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B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACpC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;CAC5C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;AAGtE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAChC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CACxE,CAAC","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\n\nexport type VariableReference = Static<typeof VariableReference>;\nexport const VariableReference = Type.Object({\n\ttype: Type.Literal(\"variable-reference\"),\n\tname: Type.String(),\n});\n\nexport type Literal = Static<typeof Literal>;\nexport const Literal = Type.Object({\n\ttype: Type.Literal(\"literal\"),\n\tvalue: Type.String(),\n});\n\nexport type Option = Static<typeof Option>;\nexport const Option = Type.Object({\n\tname: Type.String(),\n\tvalue: Type.Union([Literal, VariableReference]),\n});\n\nexport type Attribute = Static<typeof Attribute>;\nexport const Attribute = Type.Object({\n\tname: Type.String(),\n\tvalue: Type.Union([Literal, Type.Literal(true)]),\n});\n\nexport type FunctionReference = Static<typeof FunctionReference>;\nexport const FunctionReference = Type.Object({\n\ttype: Type.Literal(\"function-reference\"),\n\tname: Type.String(),\n\toptions: Type.Array(Option),\n});\n\nexport type Expression = Static<typeof Expression>;\nexport const Expression = Type.Object({\n\ttype: Type.Literal(\"expression\"),\n\targ: Type.Union([VariableReference, Literal]),\n\tannotation: Type.Optional(FunctionReference),\n});\n\nexport type Text = Static<typeof Text>;\nexport const Text = Type.Object({\n\ttype: Type.Literal(\"text\"),\n\tvalue: Type.String(),\n});\n\nexport type MarkupStart = Static<typeof MarkupStart>;\nexport const MarkupStart = Type.Object({\n\ttype: Type.Literal(\"markup-start\"),\n\tname: Type.String(),\n\toptions: Type.Optional(Type.Array(Option)),\n\tattributes: Type.Optional(Type.Array(Attribute)),\n});\n\nexport type MarkupEnd = Static<typeof MarkupEnd>;\nexport const MarkupEnd = Type.Object({\n\ttype: Type.Literal(\"markup-end\"),\n\tname: Type.String(),\n\toptions: Type.Optional(Type.Array(Option)),\n\tattributes: Type.Optional(Type.Array(Attribute)),\n});\n\nexport type MarkupStandalone = Static<typeof MarkupStandalone>;\nexport const MarkupStandalone = Type.Object({\n\ttype: Type.Literal(\"markup-standalone\"),\n\tname: Type.String(),\n\toptions: Type.Optional(Type.Array(Option)),\n\tattributes: Type.Optional(Type.Array(Attribute)),\n});\n\nexport type LocalVariable = Static<typeof LocalVariable>;\nexport const LocalVariable = Type.Object({\n\ttype: Type.Literal(\"local-variable\"),\n\tname: Type.String(),\n\tvalue: Expression,\n});\n\nexport type InputVariable = Static<typeof InputVariable>;\nexport const InputVariable = Type.Object({\n\ttype: Type.Literal(\"input-variable\"),\n\tname: Type.String(),\n\tannotation: Type.Optional(FunctionReference),\n});\n\nexport type Declaration = Static<typeof Declaration>;\nexport const Declaration = Type.Union([InputVariable, LocalVariable]);\n\nexport type Pattern = Static<typeof Pattern>;\nexport const Pattern = Type.Array(\n\tType.Union([Text, Expression, MarkupStart, MarkupEnd, MarkupStandalone])\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"loadProjectFromDirectory.d.ts","sourceRoot":"/","sources":["project/loadProjectFromDirectory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAIN,KAAK,GAAG,EACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,KAAK,EAAE,YAAY,EA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,EAAE,OAAO,EAAE,CAAC;IACd;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;GAiL3D;AAggBD,qBAAa,yBAA0B,SAAQ,KAAK;gBACvC,MAAM,EAAE,MAAM;CAM1B;AAuCD,qBAAa,uBAAwB,SAAQ,KAAK;IACjD,IAAI,EAAE,MAAM,CAAC;gBAED,IAAI,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;CAMhD"}
@@ -1,6 +1,6 @@
1
1
  import { newProject } from "./newProject.js";
2
2
  import { loadProjectInMemory } from "./loadProjectInMemory.js";
3
- import { closeLix, openLixInMemory, toBlob, } from "@lix-js/sdk";
3
+ import { closeLix, openLixInMemory, toBlob } from "@lix-js/sdk";
4
4
  import fs from "node:fs";
5
5
  import nodePath from "node:path";
6
6
  import { fromMessageV1 } from "../json-schema/old-v1-message/fromMessageV1.js";
@@ -1 +1 @@
1
- {"version":3,"file":"loadProjectFromDirectory.js","sourceRoot":"/","sources":["project/loadProjectFromDirectory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACN,QAAQ,EACR,eAAe,EACf,MAAM,GAEN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAC;AAE9G,OAAO,EAAE,uBAAuB,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CAAC;IAC7C,IAAI,0BAA0B,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC;QAClC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,WAAW,EAAE,IAAI,CAAC,WAAW;KAC7B,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACvE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,UAAU,GAAG,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC3E,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,UAAU,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,QAA4B,EAAE,QAAgB;IACvE,IAAI,CAAC;QACJ,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AAED,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACjD,IAAI,CAAS;IAEb,YAAY,IAAoC;QAC/C,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { newProject } from \"./newProject.js\";\nimport { loadProjectInMemory } from \"./loadProjectInMemory.js\";\nimport {\n\tcloseLix,\n\topenLixInMemory,\n\ttoBlob,\n\ttype Lix,\n} from \"@lix-js/sdk\";\nimport fs from \"node:fs\";\nimport nodePath from \"node:path\";\nimport type { InlangPlugin } from \"../plugin/schema.js\";\nimport { fromMessageV1 } from \"../json-schema/old-v1-message/fromMessageV1.js\";\nimport type { ProjectSettings } from \"../json-schema/settings.js\";\nimport type { PreprocessPluginBeforeImportFunction } from \"../plugin/importPlugins.js\";\nimport { PluginImportError } from \"../plugin/errors.js\";\nimport { upsertBundleNestedMatchByProperties } from \"../import-export/upsertBundleNestedMatchByProperties.js\";\nimport type { ImportFile } from \"./api.js\";\nimport { absolutePathFromProject, withAbsolutePaths } from \"./path-helpers.js\";\nimport { saveProjectToDirectory } from \"./saveProjectToDirectory.js\";\nimport { ENV_VARIABLES } from \"../services/env-variables/index.js\";\nimport { compareSemver, pickHighestVersion, readProjectMeta } from \"./meta.js\";\n\n/**\n * Loads a project from a directory.\n *\n * Main use case are dev tools that want to load a project from a directory\n * that is stored in git.\n *\n * @example\n * const project = await loadProjectFromDirectory({\n * path: \"./project.inlang\",\n * fs: await import(\"node:fs\"),\n * });\n */\nexport async function loadProjectFromDirectory(\n\targs: {\n\t\t/**\n\t\t * The path to the inlang project directory.\n\t\t */\n\t\tpath: string;\n\t\t/**\n\t\t * The file system module to use for reading and writing files.\n\t\t */\n\t\tfs: typeof fs;\n\t\t/**\n\t\t * The interval in milliseconds at which to sync the project with the file system.\n\t\t *\n\t\t * If not provided, syncing only happens once on load.\n\t\t */\n\t\tsyncInterval?: number;\n\t} & Omit<Parameters<typeof loadProjectInMemory>[0], \"blob\">\n) {\n\tconst settingsPath = nodePath.join(args.path, \"settings.json\");\n\tconst settings = JSON.parse(\n\t\tawait args.fs.promises.readFile(settingsPath, \"utf8\")\n\t) as ProjectSettings;\n\n\tlet inlangId: string | undefined = undefined;\n\n\ttry {\n\t\tinlangId = await args.fs.promises.readFile(\n\t\t\tnodePath.join(args.path, \"project_id\"),\n\t\t\t\"utf8\"\n\t\t);\n\t} catch {\n\t\t// await args.fs.promises.writeFile(\n\t\t// \tnodePath.join(args.path, \"project_id\"),\n\t\t// \t,\n\t\t// \t{ encoding: \"utf8\" }\n\t\t// );\n\t\t// file doesn't exist yet\n\t}\n\n\tconst localImport = await importLocalPlugins({\n\t\tfs: args.fs,\n\t\tsettings,\n\t\tpath: args.path,\n\t});\n\n\tconst providePluginsWithLocalPlugins = [\n\t\t...(args.providePlugins ?? []),\n\t\t...localImport.locallyImportedPlugins,\n\t];\n\n\t// Loading a new lix to sync the fs files to before\n\t// opening the inlang project\n\t// https://github.com/opral/inlang-paraglide-js/issues/498\n\tconst newLix = await newProject({\n\t\tsettings,\n\t});\n\n\tconst tempLix = await openLixInMemory({ blob: newLix });\n\n\tawait syncLixFsFiles({\n\t\tfs: args.fs,\n\t\tpath: args.path,\n\t\tlix: tempLix,\n\t\tsyncInterval: undefined,\n\t});\n\n\t// TODO call tempProject.lix.settled() to wait for the new settings file, and remove reload of the proejct as soon as reactive settings has landed\n\t// NOTE: we need to ensure two things:\n\t// 1. settled needs to include the changes from the copyFiles call\n\t// 2. the changes created from the copyFiles call need to be realized and lead to a signal on the settings\n\tconst project = await loadProjectInMemory({\n\t\t...args,\n\t\tprovidePlugins: providePluginsWithLocalPlugins,\n\t\tlixKeyValues: inlangId\n\t\t\t? // reversing the id to have distinguishable lix ids from inlang ids\n\t\t\t\t[{ key: \"lix_id\", value: inlangId }]\n\t\t\t: undefined,\n\t\tblob: await toBlob({ lix: tempLix }),\n\t});\n\n\t// Closing the temp lix\n\tawait closeLix({ lix: tempLix });\n\n\tawait syncLixFsFiles({\n\t\tfs: args.fs,\n\t\tpath: args.path,\n\t\tlix: project.lix,\n\t\tsyncInterval: args.syncInterval,\n\t});\n\n\tconst allPlugins = await project.plugins.get();\n\tconst { loadSavePlugins, importExportPlugins } =\n\t\tcategorizePlugins(allPlugins);\n\n\t// TODO i guess we should move this validation logic into sdk2/src/project/loadProject.ts\n\t// Two scenarios could arise:\n\t// 1. set settings is called from an app - it should detect and reject the setting of settings -> app need to be able to validate before calling set\n\t// 2. the settings file loaded from disc here is corrupted -> user has to fix the file on disc\n\tif (loadSavePlugins.length > 1) {\n\t\tthrow new Error(\n\t\t\t\"Max one loadMessages (found: \" +\n\t\t\t\tloadSavePlugins.length +\n\t\t\t\t\") and one saveMessages plugins (found: \" +\n\t\t\t\tloadSavePlugins.length +\n\t\t\t\t\") are allowed \"\n\t\t);\n\t}\n\tconst importedResourceFileErrors: Error[] = [];\n\n\t// import files from local fs\n\tfor (const plugin of importExportPlugins) {\n\t\tconst files: ImportFile[] = [];\n\t\tif (plugin.toBeImportedFiles) {\n\t\t\tconst toBeImportedFiles = await plugin.toBeImportedFiles({\n\t\t\t\tsettings: await project.settings.get(),\n\t\t\t});\n\t\t\tfor (const toBeImported of toBeImportedFiles) {\n\t\t\t\tconst absolute = absolutePathFromProject(args.path, toBeImported.path);\n\t\t\t\ttry {\n\t\t\t\t\tconst data = await args.fs.promises.readFile(absolute);\n\t\t\t\t\tfiles.push({\n\t\t\t\t\t\tlocale: toBeImported.locale,\n\t\t\t\t\t\tcontent: data,\n\t\t\t\t\t\ttoBeImportedFilesMetadata: toBeImported.metadata,\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// https://github.com/opral/inlang/issues/202\n\t\t\t\t\tif ((e as any)?.code === \"ENOENT\") {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\timportedResourceFileErrors.push(\n\t\t\t\t\t\tnew ResourceFileImportError({\n\t\t\t\t\t\t\tcause: e as Error,\n\t\t\t\t\t\t\tpath: toBeImported.path,\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait project.importFiles({\n\t\t\tpluginKey: plugin.key,\n\t\t\tfiles,\n\t\t});\n\t}\n\n\tfor (const plugin of loadSavePlugins) {\n\t\tawait loadLegacyMessages({\n\t\t\tproject,\n\t\t\tpluginKey: plugin.key ?? plugin.id,\n\t\t\tloadMessagesFn: plugin.loadMessages!,\n\t\t\tprojectPath: args.path,\n\t\t\tfs: args.fs,\n\t\t});\n\t}\n\n\tconst shouldUpdateMeta = await shouldUpdateProjectMeta({\n\t\tfs: args.fs.promises,\n\t\tprojectPath: args.path,\n\t\tcurrentSdkVersion: ENV_VARIABLES.SDK_VERSION,\n\t});\n\tif (shouldUpdateMeta) {\n\t\tawait saveProjectToDirectory({\n\t\t\tfs: args.fs.promises,\n\t\t\tproject,\n\t\t\tpath: args.path,\n\t\t\tskipExporting: true,\n\t\t});\n\t}\n\n\treturn {\n\t\t...project,\n\t\terrors: {\n\t\t\tget: async () => {\n\t\t\t\treturn [\n\t\t\t\t\t...filterLocalPluginImportErrors(await project.errors.get()),\n\t\t\t\t\t...localImport.errors,\n\t\t\t\t\t...importedResourceFileErrors,\n\t\t\t\t];\n\t\t\t},\n\t\t\t// subscribe: (\n\t\t\t// \tcallback: Parameters<InlangProject[\"errors\"][\"subscribe\"]>[0]\n\t\t\t// ) => {\n\t\t\t// \treturn project.errors.subscribe((value) => {\n\t\t\t// \t\tcallback([\n\t\t\t// \t\t\t...withLocallyImportedPluginWarning(value),\n\t\t\t// \t\t\t...localImport.errors,\n\t\t\t// \t\t\t...importedResourceFileErrors,\n\t\t\t// \t\t]);\n\t\t\t// \t});\n\t\t\t// },\n\t\t},\n\t};\n}\n\nasync function loadLegacyMessages(args: {\n\tproject: Awaited<ReturnType<typeof loadProjectInMemory>>;\n\tpluginKey: NonNullable<InlangPlugin[\"key\"] | InlangPlugin[\"id\"]>;\n\tloadMessagesFn: Required<InlangPlugin>[\"loadMessages\"];\n\tprojectPath: string;\n\tfs: typeof fs;\n}) {\n\tconst loadedLegacyMessages = await args.loadMessagesFn({\n\t\tsettings: await args.project.settings.get(),\n\t\t// @ts-expect-error - type mismatch\n\t\tnodeishFs: withAbsolutePaths(args.fs.promises, args.projectPath),\n\t});\n\tconst upsertQueries = [];\n\n\tfor (const legacyMessage of loadedLegacyMessages) {\n\t\tconst messageBundle = fromMessageV1(legacyMessage);\n\n\t\tupsertQueries.push(\n\t\t\tupsertBundleNestedMatchByProperties(args.project.db, messageBundle)\n\t\t);\n\t}\n\n\treturn await Promise.all(upsertQueries);\n}\n\ntype FsFileState = Record<\n\tstring,\n\t{\n\t\t/*mtime: number, hash: string, */ content: ArrayBuffer;\n\t\tstate: \"known\" | \"unknown\" | \"updated\" | \"gone\";\n\t}\n>;\n\nfunction arrayBuffersEqual(a: ArrayBuffer, b: ArrayBuffer) {\n\tif (a.byteLength !== b.byteLength) return false;\n\n\t// Create views for byte-by-byte comparison\n\tconst view1 = new Uint8Array(a);\n\tconst view2 = new Uint8Array(b);\n\n\t// Compare each byte\n\tfor (const [i, element] of view1.entries()) {\n\t\tif (element !== view2[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Filters out errors that are related to local plugins because\n * `loadProjectFromDirectory()` can import local plugins.\n */\nfunction filterLocalPluginImportErrors(\n\terrors: readonly Error[]\n): readonly Error[] {\n\treturn errors.filter((error) => {\n\t\tif (\n\t\t\terror instanceof PluginImportError &&\n\t\t\terror.plugin.startsWith(\"http\") === false\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n}\n\n/**\n * Watches a directory and copies files into lix, keeping them in sync.\n */\nasync function syncLixFsFiles(args: {\n\tfs: typeof fs;\n\tpath: string;\n\tlix: Lix;\n\tsyncInterval?: number;\n}) {\n\tfunction shouldSyncPath(filePath: string) {\n\t\treturn filePath !== \"/project_id\" && !filePath.endsWith(\"/project_id\");\n\t}\n\n\t// NOTE this function is async - while it runs 100% sync in the naiv implementation - we may want to change to an async version to optimize\n\tasync function checkFsStateRecursive(\n\t\tdirPath: string,\n\t\tcurrentState: FsFileState\n\t) {\n\t\tconst entries = args.fs.readdirSync(dirPath, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = nodePath.join(dirPath, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tcheckFsStateRecursive(fullPath, currentState);\n\t\t\t} else {\n\t\t\t\t// NOTE we could start with comparing the mdate and skip file read completely...\n\t\t\t\tconst data = args.fs.readFileSync(fullPath) as unknown as ArrayBuffer;\n\n\t\t\t\tconst relativePath = \"/\" + nodePath.relative(args.path, fullPath);\n\t\t\t\tif (!shouldSyncPath(relativePath)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!currentState[relativePath]) {\n\t\t\t\t\tcurrentState[relativePath] = {\n\t\t\t\t\t\tcontent: data,\n\t\t\t\t\t\tstate: \"unknown\",\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tif (arrayBuffersEqual(currentState[relativePath].content, data)) {\n\t\t\t\t\t\tcurrentState[relativePath].state = \"known\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrentState[relativePath].state = \"updated\";\n\t\t\t\t\t\tcurrentState[relativePath].content = data;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function checkLixState(currentLixState: FsFileState) {\n\t\t// go through all files in lix and check there state\n\t\tconst filesInLix = await args.lix.db\n\t\t\t.selectFrom(\"file\")\n\t\t\t.where(\"path\", \"not like\", \"%db.sqlite\")\n\t\t\t.selectAll()\n\t\t\t.execute();\n\n\t\tfor (const fileInLix of filesInLix) {\n\t\t\tif (!shouldSyncPath(fileInLix.path)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst currentStateOfFileInLix = currentLixState[fileInLix.path];\n\t\t\t// NOTE we could start with comparing the mdate and skip file read completely...\n\t\t\tif (!currentStateOfFileInLix) {\n\t\t\t\tcurrentLixState[fileInLix.path] = {\n\t\t\t\t\tcontent: new Uint8Array(fileInLix.data).buffer,\n\t\t\t\t\tstate: \"unknown\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tarrayBuffersEqual(\n\t\t\t\t\t\tcurrentStateOfFileInLix.content,\n\t\t\t\t\t\tfileInLix.data.buffer as ArrayBuffer\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcurrentStateOfFileInLix.state = \"known\";\n\t\t\t\t} else {\n\t\t\t\t\tcurrentStateOfFileInLix.state = \"updated\";\n\t\t\t\t\tcurrentStateOfFileInLix.content = fileInLix.data\n\t\t\t\t\t\t.buffer as ArrayBuffer;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function syncUpFsAndLixFiles(statesToSync: {\n\t\tfsFileStates: FsFileState;\n\t\tlixFileStates: FsFileState;\n\t}) {\n\t\t// for (const file of Object.keys(statesToSync.fsFileStates)) {\n\t\t// \tif (file.includes(\"gitignore\"))\n\t\t// \t\tconsole.log(\n\t\t// \t\t\t\"fsFileStates : \" +\n\t\t// \t\t\t\tfile +\n\t\t// \t\t\t\t\" fs \" +\n\t\t// \t\t\t\tstatesToSync.fsFileStates[file]?.state +\n\t\t// \t\t\t\t\" lix \" +\n\t\t// \t\t\t\tstatesToSync.lixFileStates[file]?.state\n\t\t// \t\t);\n\t\t// }\n\n\t\t// Sync cases:\n\t\t// fs - no state for file | fs - unkonwn | fs - known | fs - updated | fs - gone\n\t\t// lix - no state for file \tNOTHING\t(1)\t | ADD TO LIX(2) | ERROR (3) | ERROR (4) | ERROR (5)\n\t\t// lix - unknown\t\t\t\t\tADD TO FS (6) | USE FS VER.(7) | ERROR (8) | CASE (9) | CASE (10)\n\t\t// lix - known ERROR (11) | ERROR (12) | NOTHING(13) | ERROR (14) | ERROR (15)\n\t\t// lix - updated\t\t\t\t\tERROR (16) | ERROR (17) | USE LIX (18) | CASE (19) | CASE (20)\n\t\t// lix - gone \t\t\t\t\t\tERROR (21) | ERROR (22) | DELETE FS (23)| CASE (24) | CASE (25)\n\n\t\t// TODO check export import from saveFileToDirectory\n\n\t\tfor (const [path, fsState] of Object.entries(statesToSync.fsFileStates)) {\n\t\t\t// no state for file in LIX\n\t\t\tif (!statesToSync.lixFileStates[path]) {\n\t\t\t\tif (fsState.state === \"unknown\") {\n\t\t\t\t\t// ADD TO LIX(2)\n\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\tstatesToSync.lixFileStates[path] = {\n\t\t\t\t\t\tstate: \"known\",\n\t\t\t\t\t\tcontent: fsState.content,\n\t\t\t\t\t};\n\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t} else {\n\t\t\t\t\t// ERROR (3), ERROR (4), ERROR (5)\n\t\t\t\t\t// The file does not exist in lix but its state differs from unknown?\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\" on disc did not exit in lix\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst lixState = statesToSync.lixFileStates[path];\n\t\t\t\tif (fsState.state === \"unknown\") {\n\t\t\t\t\tif (lixState.state === \"unknown\") {\n\t\t\t\t\t\tif (arrayBuffersEqual(lixState.content, fsState.content)) {\n\t\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\t\t\tlixState.content = fsState.content;\n\t\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// ERROR 12, 17, 22\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\t\" but did exist in lix already\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else if (fsState.state === \"known\") {\n\t\t\t\t\tif (lixState.state === \"known\") {\n\t\t\t\t\t\t// NO OP - NOTHING(13)\n\t\t\t\t\t} else if (lixState.state === \"updated\") {\n\t\t\t\t\t\t// USE LIX (18)\n\t\t\t\t\t\targs.fs.writeFileSync(\n\t\t\t\t\t\t\t// TODO check platform dependent folder separator\n\t\t\t\t\t\t\targs.path + path,\n\t\t\t\t\t\t\tBuffer.from(lixState.content)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfsState.content = lixState.content;\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t} else if (lixState.state === \"gone\") {\n\t\t\t\t\t\t// DELETE FS (23)\n\t\t\t\t\t\targs.fs.unlinkSync(args.path + path);\n\t\t\t\t\t\tfsState.state = \"gone\";\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t}\n\t\t\t\t} else if (fsState.state === \"updated\") {\n\t\t\t\t\tif (lixState.state === \"unknown\") {\n\t\t\t\t\t\t// TODO A file was added to lix while a known file from fs was updated?\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\t\" but it was not known by lix yet?\"\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (lixState.state === \"known\") {\n\t\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\t\tlixState.content = fsState.content;\n\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t} else if (lixState.state === \"updated\") {\n\t\t\t\t\t\t// seems like we saw an update on the file in fs while some changes on lix have not been reached fs? FS -> Winns?\n\t\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\t\tlixState.content = fsState.content;\n\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t} else if (lixState.state === \"gone\") {\n\t\t\t\t\t\t// seems like we saw an delete in lix while some changes on fs have not been reached fs? FS -> Winns?\n\t\t\t\t\t\t// TODO update the lix state\n\t\t\t\t\t\tlixState.content = fsState.content;\n\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t}\n\t\t\t\t} else if (fsState.state === \"gone\") {\n\t\t\t\t\tif (lixState.state === \"unknown\") {\n\t\t\t\t\t\t// TODO A file was added to lix while a known file from fs was removed?\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\t\" but it was not known by lix yet?\"\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (lixState.state === \"known\") {\n\t\t\t\t\t\t// file is in known state with lix - means we have only changes on the fs - easy\n\t\t\t\t\t\tawait args.lix.db\n\t\t\t\t\t\t\t.deleteFrom(\"file\")\n\t\t\t\t\t\t\t.where(\"path\", \"=\", path)\n\t\t\t\t\t\t\t.execute();\n\t\t\t\t\t\t// NOTE: states where both are gone will get removed in the lix state loop\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t} else if (lixState.state === \"updated\") {\n\t\t\t\t\t\t// seems like we saw an update on the file in fs while some changes on lix have not been reached fs? FS -> Winns?\n\t\t\t\t\t\tawait args.lix.db\n\t\t\t\t\t\t\t.deleteFrom(\"file\")\n\t\t\t\t\t\t\t.where(\"path\", \"=\", path)\n\t\t\t\t\t\t\t.execute();\n\t\t\t\t\t\t// NOTE: states where both are gone will get removed in the lix state loop\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t\tfsState.state = \"gone\";\n\t\t\t\t\t} else if (lixState.state === \"gone\") {\n\t\t\t\t\t\t// seems like we saw an delete in lix while we have a delete in lix simultaniously?\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t\tfsState.state = \"gone\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const [path, lixState] of Object.entries(statesToSync.lixFileStates)) {\n\t\t\t// no state for file in fs\n\t\t\tif (!statesToSync.fsFileStates[path]) {\n\t\t\t\tif (lixState.state == \"unknown\") {\n\t\t\t\t\t// ADD TO FS (6)\n\t\t\t\t\t// create directory if not exists\n\t\t\t\t\ttry {\n\t\t\t\t\t\targs.fs.mkdirSync(\n\t\t\t\t\t\t\tnodePath.dirname(nodePath.join(args.path, path)),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// ignore if directory already exists\n\t\t\t\t\t\t// https://github.com/opral/inlang-paraglide-js/issues/377\n\t\t\t\t\t\tif ((e as any)?.code !== \"EEXIST\") {\n\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// write file\n\t\t\t\t\targs.fs.writeFileSync(\n\t\t\t\t\t\tnodePath.join(args.path, path),\n\t\t\t\t\t\tBuffer.from(lixState.content)\n\t\t\t\t\t);\n\t\t\t\t\tstatesToSync.fsFileStates[path] = {\n\t\t\t\t\t\tstate: \"known\",\n\t\t\t\t\t\tcontent: lixState.content,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\t// ERROR (11) 16 21\n\t\t\t\t\t// The file does not exist on fs but its state differs from unknown?\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\"] that was in the state\" +\n\t\t\t\t\t\t\tlixState.state +\n\t\t\t\t\t\t\t\" for lix did not exist on disk\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tlixState.state === \"gone\" &&\n\t\t\t\t\tstatesToSync.fsFileStates[path].state === \"gone\"\n\t\t\t\t) {\n\t\t\t\t\tdelete statesToSync.lixFileStates[path];\n\t\t\t\t\tdelete statesToSync.fsFileStates[path];\n\t\t\t\t} else if (lixState.state !== statesToSync.fsFileStates[path].state) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"At this stage both states should be in sync lix state \" +\n\t\t\t\t\t\t\tlixState.state +\n\t\t\t\t\t\t\t\" fs state \" +\n\t\t\t\t\t\t\tstatesToSync.fsFileStates[path].state\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function syncFiles(\n\t\tdirPath: string,\n\t\tfileStates: {\n\t\t\tlixFileStates: FsFileState;\n\t\t\tfsFileStates: FsFileState;\n\t\t},\n\t\tinterval?: number\n\t) {\n\t\t// mark all states as removed - checkFsStateRecursive will update those that exist on the disc correspondingly\n\t\tfor (const fsState of Object.values(fileStates.fsFileStates)) {\n\t\t\tfsState.state = \"gone\";\n\t\t}\n\n\t\t// mark all states as removed - checkFsStateRecursive will update those that exist on the disc correspondingly\n\t\tfor (const lixState of Object.values(fileStates.lixFileStates)) {\n\t\t\tlixState.state = \"gone\";\n\t\t}\n\n\t\t// read states from disc - detect changes\n\t\tawait checkFsStateRecursive(dirPath, fileStates.fsFileStates);\n\n\t\t// read states form lix - detect changes\n\t\tawait checkLixState(fileStates.lixFileStates);\n\n\t\t// sync fs<->lix\n\t\tawait syncUpFsAndLixFiles(fileStates);\n\n\t\tif (interval) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tsyncFiles(dirPath, fileStates, interval);\n\t\t\t}, interval);\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// Initial copy of all files\n\tawait syncFiles(\n\t\targs.path,\n\t\t{ fsFileStates: {}, lixFileStates: {} },\n\t\targs.syncInterval\n\t);\n\n\treturn;\n}\n\nasync function upsertFileInLix(\n\targs: { fs: typeof fs; path: string; lix: Lix },\n\tpath: string,\n\tdata: ArrayBuffer\n) {\n\t// force posix path when upserting into lix\n\t// https://github.com/opral/inlang/issues/229\n\tlet posixPath = path.split(nodePath.win32.sep).join(nodePath.posix.sep);\n\n\tif (posixPath.startsWith(\"/\") === false) {\n\t\tposixPath = \"/\" + posixPath;\n\t}\n\n\tawait args.lix.db\n\t\t.insertInto(\"file\") // change queue\n\t\t.values({\n\t\t\tpath: posixPath,\n\t\t\tdata: new Uint8Array(data),\n\t\t})\n\t\t.onConflict((oc) =>\n\t\t\toc.column(\"path\").doUpdateSet({ data: new Uint8Array(data) })\n\t\t)\n\t\t.execute();\n}\n/**\n * Filters legacy load and save messages plugins.\n *\n * Legacy plugins are plugins that implement loadMessages and saveMessages but not importFiles and exportFiles.\n */\nfunction categorizePlugins(plugins: readonly InlangPlugin[]) {\n\tconst loadSavePlugins: InlangPlugin[] = [];\n\tconst importExportPlugins: InlangPlugin[] = [];\n\n\tfor (const plugin of plugins) {\n\t\tif (\n\t\t\tplugin.loadMessages &&\n\t\t\tplugin.saveMessages &&\n\t\t\t!(plugin.importFiles && plugin.exportFiles)\n\t\t) {\n\t\t\tloadSavePlugins.push(plugin);\n\t\t} else if (plugin.importFiles || plugin.exportFiles) {\n\t\t\timportExportPlugins.push(plugin);\n\t\t}\n\t}\n\n\treturn { loadSavePlugins, importExportPlugins };\n}\n\n/**\n * Imports local plugins for backwards compatibility.\n *\n * https://github.com/opral/inlang/issues/171\n */\nasync function importLocalPlugins(args: {\n\tfs: typeof fs;\n\tsettings: ProjectSettings;\n\tpath: string;\n\tpreprocessPluginBeforeImport?: PreprocessPluginBeforeImportFunction;\n}) {\n\tconst errors: Error[] = [];\n\tconst locallyImportedPlugins = [];\n\tfor (const module of args.settings.modules ?? []) {\n\t\tif (module.startsWith(\"http\")) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst modulePath = absolutePathFromProject(args.path, module);\n\t\ttry {\n\t\t\tlet moduleAsText = await args.fs.promises.readFile(modulePath, \"utf8\");\n\t\t\tif (moduleAsText.includes(\"messageLintRule\")) {\n\t\t\t\terrors.push(new WarningDeprecatedLintRule(module));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (args.preprocessPluginBeforeImport) {\n\t\t\t\tmoduleAsText = await args.preprocessPluginBeforeImport(moduleAsText);\n\t\t\t}\n\n\t\t\t// In bun we need to do dynamic imports differently\n\t\t\tconst pluginAsUrl = process.versions.bun\n\t\t\t\t? URL.createObjectURL(\n\t\t\t\t\t\tnew Blob([moduleAsText], { type: \"text/javascript\" })\n\t\t\t\t\t)\n\t\t\t\t: \"data:application/javascript,\" + encodeURIComponent(moduleAsText);\n\n\t\t\tconst { default: plugin } = await import(/* @vite-ignore */ pluginAsUrl);\n\t\t\tlocallyImportedPlugins.push(plugin);\n\t\t\tif (process.versions.bun) URL.revokeObjectURL(pluginAsUrl);\n\t\t} catch (e) {\n\t\t\terrors.push(new PluginImportError({ plugin: module, cause: e as Error }));\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn {\n\t\terrors,\n\t\tlocallyImportedPlugins,\n\t};\n}\n\nexport class WarningDeprecatedLintRule extends Error {\n\tconstructor(module: string) {\n\t\tsuper(\n\t\t\t`The lint rule ${module} is deprecated. Please remove the lint rule from the settings. Lint rules are interim built into apps and will be succeeded by more generilizable lix validation rules.`\n\t\t);\n\t\tthis.name = \"WarningDeprecatedLintRule\";\n\t}\n}\n\nasync function shouldUpdateProjectMeta(args: {\n\tfs: typeof fs.promises;\n\tprojectPath: string;\n\tcurrentSdkVersion: string;\n}): Promise<boolean> {\n\tconst readmePath = nodePath.join(args.projectPath, \"README.md\");\n\tconst gitignorePath = nodePath.join(args.projectPath, \".gitignore\");\n\tconst shouldRepairGeneratedFiles =\n\t\t!(await fileExists(args.fs, readmePath)) ||\n\t\t!(await fileExists(args.fs, gitignorePath));\n\tif (shouldRepairGeneratedFiles) {\n\t\treturn true;\n\t}\n\tconst meta = await readProjectMeta({\n\t\tfs: args.fs,\n\t\tprojectPath: args.projectPath,\n\t});\n\tconst storedSdkVersion = pickHighestVersion([meta?.highestSdkVersion]);\n\tif (!storedSdkVersion) {\n\t\treturn true;\n\t}\n\tconst comparison = compareSemver(storedSdkVersion, args.currentSdkVersion);\n\tif (comparison === null) {\n\t\treturn true;\n\t}\n\treturn comparison < 0;\n}\n\nasync function fileExists(fsModule: typeof fs.promises, filePath: string) {\n\ttry {\n\t\tawait fsModule.stat(filePath);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport class ResourceFileImportError extends Error {\n\tpath: string;\n\n\tconstructor(args: { cause: Error; path: string }) {\n\t\tsuper(\"Could not import a resource file\");\n\t\tthis.name = \"ResourceFileImportError\";\n\t\tthis.cause = args.cause;\n\t\tthis.path = args.path;\n\t}\n}\n"]}
1
+ {"version":3,"file":"loadProjectFromDirectory.js","sourceRoot":"/","sources":["project/loadProjectFromDirectory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAY,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAC;AAE9G,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAA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,CAAC,WAAW;KAC7B,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACvE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,UAAU,GAAG,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC3E,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,UAAU,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,QAA4B,EAAE,QAAgB;IACvE,IAAI,CAAC;QACJ,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AAED,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACjD,IAAI,CAAS;IAEb,YAAY,IAAoC;QAC/C,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { newProject } from \"./newProject.js\";\nimport { loadProjectInMemory } from \"./loadProjectInMemory.js\";\nimport { closeLix, openLixInMemory, toBlob, type Lix } from \"@lix-js/sdk\";\nimport fs from \"node:fs\";\nimport nodePath from \"node:path\";\nimport type { InlangPlugin } from \"../plugin/schema.js\";\nimport { fromMessageV1 } from \"../json-schema/old-v1-message/fromMessageV1.js\";\nimport type { ProjectSettings } from \"../json-schema/settings.js\";\nimport type { PreprocessPluginBeforeImportFunction } from \"../plugin/importPlugins.js\";\nimport { PluginImportError } from \"../plugin/errors.js\";\nimport { upsertBundleNestedMatchByProperties } from \"../import-export/upsertBundleNestedMatchByProperties.js\";\nimport type { ImportFile } from \"./api.js\";\nimport { absolutePathFromProject, withAbsolutePaths } from \"./path-helpers.js\";\nimport { saveProjectToDirectory } from \"./saveProjectToDirectory.js\";\nimport { ENV_VARIABLES } from \"../services/env-variables/index.js\";\nimport { compareSemver, pickHighestVersion, readProjectMeta } from \"./meta.js\";\n\n/**\n * Loads a project from a directory.\n *\n * Main use case are dev tools that want to load a project from a directory\n * that is stored in git.\n *\n * @example\n * const project = await loadProjectFromDirectory({\n * path: \"./project.inlang\",\n * fs: await import(\"node:fs\"),\n * });\n */\nexport async function loadProjectFromDirectory(\n\targs: {\n\t\t/**\n\t\t * The path to the inlang project directory.\n\t\t */\n\t\tpath: string;\n\t\t/**\n\t\t * The file system module to use for reading and writing files.\n\t\t */\n\t\tfs: typeof fs;\n\t\t/**\n\t\t * The interval in milliseconds at which to sync the project with the file system.\n\t\t *\n\t\t * If not provided, syncing only happens once on load.\n\t\t */\n\t\tsyncInterval?: number;\n\t} & Omit<Parameters<typeof loadProjectInMemory>[0], \"blob\">\n) {\n\tconst settingsPath = nodePath.join(args.path, \"settings.json\");\n\tconst settings = JSON.parse(\n\t\tawait args.fs.promises.readFile(settingsPath, \"utf8\")\n\t) as ProjectSettings;\n\n\tlet inlangId: string | undefined = undefined;\n\n\ttry {\n\t\tinlangId = await args.fs.promises.readFile(\n\t\t\tnodePath.join(args.path, \"project_id\"),\n\t\t\t\"utf8\"\n\t\t);\n\t} catch {\n\t\t// await args.fs.promises.writeFile(\n\t\t// \tnodePath.join(args.path, \"project_id\"),\n\t\t// \t,\n\t\t// \t{ encoding: \"utf8\" }\n\t\t// );\n\t\t// file doesn't exist yet\n\t}\n\n\tconst localImport = await importLocalPlugins({\n\t\tfs: args.fs,\n\t\tsettings,\n\t\tpath: args.path,\n\t});\n\n\tconst providePluginsWithLocalPlugins = [\n\t\t...(args.providePlugins ?? []),\n\t\t...localImport.locallyImportedPlugins,\n\t];\n\n\t// Loading a new lix to sync the fs files to before\n\t// opening the inlang project\n\t// https://github.com/opral/inlang-paraglide-js/issues/498\n\tconst newLix = await newProject({\n\t\tsettings,\n\t});\n\n\tconst tempLix = await openLixInMemory({ blob: newLix });\n\n\tawait syncLixFsFiles({\n\t\tfs: args.fs,\n\t\tpath: args.path,\n\t\tlix: tempLix,\n\t\tsyncInterval: undefined,\n\t});\n\n\t// TODO call tempProject.lix.settled() to wait for the new settings file, and remove reload of the proejct as soon as reactive settings has landed\n\t// NOTE: we need to ensure two things:\n\t// 1. settled needs to include the changes from the copyFiles call\n\t// 2. the changes created from the copyFiles call need to be realized and lead to a signal on the settings\n\tconst project = await loadProjectInMemory({\n\t\t...args,\n\t\tprovidePlugins: providePluginsWithLocalPlugins,\n\t\tlixKeyValues: inlangId\n\t\t\t? // reversing the id to have distinguishable lix ids from inlang ids\n\t\t\t\t[{ key: \"lix_id\", value: inlangId }]\n\t\t\t: undefined,\n\t\tblob: await toBlob({ lix: tempLix }),\n\t});\n\n\t// Closing the temp lix\n\tawait closeLix({ lix: tempLix });\n\n\tawait syncLixFsFiles({\n\t\tfs: args.fs,\n\t\tpath: args.path,\n\t\tlix: project.lix,\n\t\tsyncInterval: args.syncInterval,\n\t});\n\n\tconst allPlugins = await project.plugins.get();\n\tconst { loadSavePlugins, importExportPlugins } =\n\t\tcategorizePlugins(allPlugins);\n\n\t// TODO i guess we should move this validation logic into sdk2/src/project/loadProject.ts\n\t// Two scenarios could arise:\n\t// 1. set settings is called from an app - it should detect and reject the setting of settings -> app need to be able to validate before calling set\n\t// 2. the settings file loaded from disc here is corrupted -> user has to fix the file on disc\n\tif (loadSavePlugins.length > 1) {\n\t\tthrow new Error(\n\t\t\t\"Max one loadMessages (found: \" +\n\t\t\t\tloadSavePlugins.length +\n\t\t\t\t\") and one saveMessages plugins (found: \" +\n\t\t\t\tloadSavePlugins.length +\n\t\t\t\t\") are allowed \"\n\t\t);\n\t}\n\tconst importedResourceFileErrors: Error[] = [];\n\n\t// import files from local fs\n\tfor (const plugin of importExportPlugins) {\n\t\tconst files: ImportFile[] = [];\n\t\tif (plugin.toBeImportedFiles) {\n\t\t\tconst toBeImportedFiles = await plugin.toBeImportedFiles({\n\t\t\t\tsettings: await project.settings.get(),\n\t\t\t});\n\t\t\tfor (const toBeImported of toBeImportedFiles) {\n\t\t\t\tconst absolute = absolutePathFromProject(args.path, toBeImported.path);\n\t\t\t\ttry {\n\t\t\t\t\tconst data = await args.fs.promises.readFile(absolute);\n\t\t\t\t\tfiles.push({\n\t\t\t\t\t\tlocale: toBeImported.locale,\n\t\t\t\t\t\tcontent: data,\n\t\t\t\t\t\ttoBeImportedFilesMetadata: toBeImported.metadata,\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// https://github.com/opral/inlang/issues/202\n\t\t\t\t\tif ((e as any)?.code === \"ENOENT\") {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\timportedResourceFileErrors.push(\n\t\t\t\t\t\tnew ResourceFileImportError({\n\t\t\t\t\t\t\tcause: e as Error,\n\t\t\t\t\t\t\tpath: toBeImported.path,\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait project.importFiles({\n\t\t\tpluginKey: plugin.key,\n\t\t\tfiles,\n\t\t});\n\t}\n\n\tfor (const plugin of loadSavePlugins) {\n\t\tawait loadLegacyMessages({\n\t\t\tproject,\n\t\t\tpluginKey: plugin.key ?? plugin.id,\n\t\t\tloadMessagesFn: plugin.loadMessages!,\n\t\t\tprojectPath: args.path,\n\t\t\tfs: args.fs,\n\t\t});\n\t}\n\n\tconst shouldUpdateMeta = await shouldUpdateProjectMeta({\n\t\tfs: args.fs.promises,\n\t\tprojectPath: args.path,\n\t\tcurrentSdkVersion: ENV_VARIABLES.SDK_VERSION,\n\t});\n\tif (shouldUpdateMeta) {\n\t\tawait saveProjectToDirectory({\n\t\t\tfs: args.fs.promises,\n\t\t\tproject,\n\t\t\tpath: args.path,\n\t\t\tskipExporting: true,\n\t\t});\n\t}\n\n\treturn {\n\t\t...project,\n\t\terrors: {\n\t\t\tget: async () => {\n\t\t\t\treturn [\n\t\t\t\t\t...filterLocalPluginImportErrors(await project.errors.get()),\n\t\t\t\t\t...localImport.errors,\n\t\t\t\t\t...importedResourceFileErrors,\n\t\t\t\t];\n\t\t\t},\n\t\t\t// subscribe: (\n\t\t\t// \tcallback: Parameters<InlangProject[\"errors\"][\"subscribe\"]>[0]\n\t\t\t// ) => {\n\t\t\t// \treturn project.errors.subscribe((value) => {\n\t\t\t// \t\tcallback([\n\t\t\t// \t\t\t...withLocallyImportedPluginWarning(value),\n\t\t\t// \t\t\t...localImport.errors,\n\t\t\t// \t\t\t...importedResourceFileErrors,\n\t\t\t// \t\t]);\n\t\t\t// \t});\n\t\t\t// },\n\t\t},\n\t};\n}\n\nasync function loadLegacyMessages(args: {\n\tproject: Awaited<ReturnType<typeof loadProjectInMemory>>;\n\tpluginKey: NonNullable<InlangPlugin[\"key\"] | InlangPlugin[\"id\"]>;\n\tloadMessagesFn: Required<InlangPlugin>[\"loadMessages\"];\n\tprojectPath: string;\n\tfs: typeof fs;\n}) {\n\tconst loadedLegacyMessages = await args.loadMessagesFn({\n\t\tsettings: await args.project.settings.get(),\n\t\t// @ts-expect-error - type mismatch\n\t\tnodeishFs: withAbsolutePaths(args.fs.promises, args.projectPath),\n\t});\n\tconst upsertQueries = [];\n\n\tfor (const legacyMessage of loadedLegacyMessages) {\n\t\tconst messageBundle = fromMessageV1(legacyMessage);\n\n\t\tupsertQueries.push(\n\t\t\tupsertBundleNestedMatchByProperties(args.project.db, messageBundle)\n\t\t);\n\t}\n\n\treturn await Promise.all(upsertQueries);\n}\n\ntype FsFileState = Record<\n\tstring,\n\t{\n\t\t/*mtime: number, hash: string, */ content: ArrayBuffer;\n\t\tstate: \"known\" | \"unknown\" | \"updated\" | \"gone\";\n\t}\n>;\n\nfunction arrayBuffersEqual(a: ArrayBuffer, b: ArrayBuffer) {\n\tif (a.byteLength !== b.byteLength) return false;\n\n\t// Create views for byte-by-byte comparison\n\tconst view1 = new Uint8Array(a);\n\tconst view2 = new Uint8Array(b);\n\n\t// Compare each byte\n\tfor (const [i, element] of view1.entries()) {\n\t\tif (element !== view2[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Filters out errors that are related to local plugins because\n * `loadProjectFromDirectory()` can import local plugins.\n */\nfunction filterLocalPluginImportErrors(\n\terrors: readonly Error[]\n): readonly Error[] {\n\treturn errors.filter((error) => {\n\t\tif (\n\t\t\terror instanceof PluginImportError &&\n\t\t\terror.plugin.startsWith(\"http\") === false\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n}\n\n/**\n * Watches a directory and copies files into lix, keeping them in sync.\n */\nasync function syncLixFsFiles(args: {\n\tfs: typeof fs;\n\tpath: string;\n\tlix: Lix;\n\tsyncInterval?: number;\n}) {\n\tfunction shouldSyncPath(filePath: string) {\n\t\treturn filePath !== \"/project_id\" && !filePath.endsWith(\"/project_id\");\n\t}\n\n\t// NOTE this function is async - while it runs 100% sync in the naiv implementation - we may want to change to an async version to optimize\n\tasync function checkFsStateRecursive(\n\t\tdirPath: string,\n\t\tcurrentState: FsFileState\n\t) {\n\t\tconst entries = args.fs.readdirSync(dirPath, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = nodePath.join(dirPath, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tcheckFsStateRecursive(fullPath, currentState);\n\t\t\t} else {\n\t\t\t\t// NOTE we could start with comparing the mdate and skip file read completely...\n\t\t\t\tconst data = args.fs.readFileSync(fullPath) as unknown as ArrayBuffer;\n\n\t\t\t\tconst relativePath = \"/\" + nodePath.relative(args.path, fullPath);\n\t\t\t\tif (!shouldSyncPath(relativePath)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!currentState[relativePath]) {\n\t\t\t\t\tcurrentState[relativePath] = {\n\t\t\t\t\t\tcontent: data,\n\t\t\t\t\t\tstate: \"unknown\",\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tif (arrayBuffersEqual(currentState[relativePath].content, data)) {\n\t\t\t\t\t\tcurrentState[relativePath].state = \"known\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrentState[relativePath].state = \"updated\";\n\t\t\t\t\t\tcurrentState[relativePath].content = data;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function checkLixState(currentLixState: FsFileState) {\n\t\t// go through all files in lix and check there state\n\t\tconst filesInLix = await args.lix.db\n\t\t\t.selectFrom(\"file\")\n\t\t\t.where(\"path\", \"not like\", \"%db.sqlite\")\n\t\t\t.selectAll()\n\t\t\t.execute();\n\n\t\tfor (const fileInLix of filesInLix) {\n\t\t\tif (!shouldSyncPath(fileInLix.path)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst currentStateOfFileInLix = currentLixState[fileInLix.path];\n\t\t\t// NOTE we could start with comparing the mdate and skip file read completely...\n\t\t\tif (!currentStateOfFileInLix) {\n\t\t\t\tcurrentLixState[fileInLix.path] = {\n\t\t\t\t\tcontent: new Uint8Array(fileInLix.data).buffer,\n\t\t\t\t\tstate: \"unknown\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tarrayBuffersEqual(\n\t\t\t\t\t\tcurrentStateOfFileInLix.content,\n\t\t\t\t\t\tfileInLix.data.buffer as ArrayBuffer\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcurrentStateOfFileInLix.state = \"known\";\n\t\t\t\t} else {\n\t\t\t\t\tcurrentStateOfFileInLix.state = \"updated\";\n\t\t\t\t\tcurrentStateOfFileInLix.content = fileInLix.data\n\t\t\t\t\t\t.buffer as ArrayBuffer;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function syncUpFsAndLixFiles(statesToSync: {\n\t\tfsFileStates: FsFileState;\n\t\tlixFileStates: FsFileState;\n\t}) {\n\t\t// for (const file of Object.keys(statesToSync.fsFileStates)) {\n\t\t// \tif (file.includes(\"gitignore\"))\n\t\t// \t\tconsole.log(\n\t\t// \t\t\t\"fsFileStates : \" +\n\t\t// \t\t\t\tfile +\n\t\t// \t\t\t\t\" fs \" +\n\t\t// \t\t\t\tstatesToSync.fsFileStates[file]?.state +\n\t\t// \t\t\t\t\" lix \" +\n\t\t// \t\t\t\tstatesToSync.lixFileStates[file]?.state\n\t\t// \t\t);\n\t\t// }\n\n\t\t// Sync cases:\n\t\t// fs - no state for file | fs - unkonwn | fs - known | fs - updated | fs - gone\n\t\t// lix - no state for file \tNOTHING\t(1)\t | ADD TO LIX(2) | ERROR (3) | ERROR (4) | ERROR (5)\n\t\t// lix - unknown\t\t\t\t\tADD TO FS (6) | USE FS VER.(7) | ERROR (8) | CASE (9) | CASE (10)\n\t\t// lix - known ERROR (11) | ERROR (12) | NOTHING(13) | ERROR (14) | ERROR (15)\n\t\t// lix - updated\t\t\t\t\tERROR (16) | ERROR (17) | USE LIX (18) | CASE (19) | CASE (20)\n\t\t// lix - gone \t\t\t\t\t\tERROR (21) | ERROR (22) | DELETE FS (23)| CASE (24) | CASE (25)\n\n\t\t// TODO check export import from saveFileToDirectory\n\n\t\tfor (const [path, fsState] of Object.entries(statesToSync.fsFileStates)) {\n\t\t\t// no state for file in LIX\n\t\t\tif (!statesToSync.lixFileStates[path]) {\n\t\t\t\tif (fsState.state === \"unknown\") {\n\t\t\t\t\t// ADD TO LIX(2)\n\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\tstatesToSync.lixFileStates[path] = {\n\t\t\t\t\t\tstate: \"known\",\n\t\t\t\t\t\tcontent: fsState.content,\n\t\t\t\t\t};\n\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t} else {\n\t\t\t\t\t// ERROR (3), ERROR (4), ERROR (5)\n\t\t\t\t\t// The file does not exist in lix but its state differs from unknown?\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\" on disc did not exit in lix\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst lixState = statesToSync.lixFileStates[path];\n\t\t\t\tif (fsState.state === \"unknown\") {\n\t\t\t\t\tif (lixState.state === \"unknown\") {\n\t\t\t\t\t\tif (arrayBuffersEqual(lixState.content, fsState.content)) {\n\t\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\t\t\tlixState.content = fsState.content;\n\t\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// ERROR 12, 17, 22\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\t\" but did exist in lix already\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else if (fsState.state === \"known\") {\n\t\t\t\t\tif (lixState.state === \"known\") {\n\t\t\t\t\t\t// NO OP - NOTHING(13)\n\t\t\t\t\t} else if (lixState.state === \"updated\") {\n\t\t\t\t\t\t// USE LIX (18)\n\t\t\t\t\t\targs.fs.writeFileSync(\n\t\t\t\t\t\t\t// TODO check platform dependent folder separator\n\t\t\t\t\t\t\targs.path + path,\n\t\t\t\t\t\t\tBuffer.from(lixState.content)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfsState.content = lixState.content;\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t} else if (lixState.state === \"gone\") {\n\t\t\t\t\t\t// DELETE FS (23)\n\t\t\t\t\t\targs.fs.unlinkSync(args.path + path);\n\t\t\t\t\t\tfsState.state = \"gone\";\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t}\n\t\t\t\t} else if (fsState.state === \"updated\") {\n\t\t\t\t\tif (lixState.state === \"unknown\") {\n\t\t\t\t\t\t// TODO A file was added to lix while a known file from fs was updated?\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\t\" but it was not known by lix yet?\"\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (lixState.state === \"known\") {\n\t\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\t\tlixState.content = fsState.content;\n\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t} else if (lixState.state === \"updated\") {\n\t\t\t\t\t\t// seems like we saw an update on the file in fs while some changes on lix have not been reached fs? FS -> Winns?\n\t\t\t\t\t\tawait upsertFileInLix(args, path, fsState.content);\n\t\t\t\t\t\tlixState.content = fsState.content;\n\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t} else if (lixState.state === \"gone\") {\n\t\t\t\t\t\t// seems like we saw an delete in lix while some changes on fs have not been reached fs? FS -> Winns?\n\t\t\t\t\t\t// TODO update the lix state\n\t\t\t\t\t\tlixState.content = fsState.content;\n\t\t\t\t\t\tlixState.state = \"known\";\n\t\t\t\t\t\tfsState.state = \"known\";\n\t\t\t\t\t}\n\t\t\t\t} else if (fsState.state === \"gone\") {\n\t\t\t\t\tif (lixState.state === \"unknown\") {\n\t\t\t\t\t\t// TODO A file was added to lix while a known file from fs was removed?\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\t\"] that was \" +\n\t\t\t\t\t\t\t\tfsState.state +\n\t\t\t\t\t\t\t\t\" but it was not known by lix yet?\"\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (lixState.state === \"known\") {\n\t\t\t\t\t\t// file is in known state with lix - means we have only changes on the fs - easy\n\t\t\t\t\t\tawait args.lix.db\n\t\t\t\t\t\t\t.deleteFrom(\"file\")\n\t\t\t\t\t\t\t.where(\"path\", \"=\", path)\n\t\t\t\t\t\t\t.execute();\n\t\t\t\t\t\t// NOTE: states where both are gone will get removed in the lix state loop\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t} else if (lixState.state === \"updated\") {\n\t\t\t\t\t\t// seems like we saw an update on the file in fs while some changes on lix have not been reached fs? FS -> Winns?\n\t\t\t\t\t\tawait args.lix.db\n\t\t\t\t\t\t\t.deleteFrom(\"file\")\n\t\t\t\t\t\t\t.where(\"path\", \"=\", path)\n\t\t\t\t\t\t\t.execute();\n\t\t\t\t\t\t// NOTE: states where both are gone will get removed in the lix state loop\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t\tfsState.state = \"gone\";\n\t\t\t\t\t} else if (lixState.state === \"gone\") {\n\t\t\t\t\t\t// seems like we saw an delete in lix while we have a delete in lix simultaniously?\n\t\t\t\t\t\tlixState.state = \"gone\";\n\t\t\t\t\t\tfsState.state = \"gone\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const [path, lixState] of Object.entries(statesToSync.lixFileStates)) {\n\t\t\t// no state for file in fs\n\t\t\tif (!statesToSync.fsFileStates[path]) {\n\t\t\t\tif (lixState.state == \"unknown\") {\n\t\t\t\t\t// ADD TO FS (6)\n\t\t\t\t\t// create directory if not exists\n\t\t\t\t\ttry {\n\t\t\t\t\t\targs.fs.mkdirSync(\n\t\t\t\t\t\t\tnodePath.dirname(nodePath.join(args.path, path)),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// ignore if directory already exists\n\t\t\t\t\t\t// https://github.com/opral/inlang-paraglide-js/issues/377\n\t\t\t\t\t\tif ((e as any)?.code !== \"EEXIST\") {\n\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// write file\n\t\t\t\t\targs.fs.writeFileSync(\n\t\t\t\t\t\tnodePath.join(args.path, path),\n\t\t\t\t\t\tBuffer.from(lixState.content)\n\t\t\t\t\t);\n\t\t\t\t\tstatesToSync.fsFileStates[path] = {\n\t\t\t\t\t\tstate: \"known\",\n\t\t\t\t\t\tcontent: lixState.content,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\t// ERROR (11) 16 21\n\t\t\t\t\t// The file does not exist on fs but its state differs from unknown?\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Illeagal lix<->fs sync state. The file [\" +\n\t\t\t\t\t\t\tpath +\n\t\t\t\t\t\t\t\"] that was in the state\" +\n\t\t\t\t\t\t\tlixState.state +\n\t\t\t\t\t\t\t\" for lix did not exist on disk\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tlixState.state === \"gone\" &&\n\t\t\t\t\tstatesToSync.fsFileStates[path].state === \"gone\"\n\t\t\t\t) {\n\t\t\t\t\tdelete statesToSync.lixFileStates[path];\n\t\t\t\t\tdelete statesToSync.fsFileStates[path];\n\t\t\t\t} else if (lixState.state !== statesToSync.fsFileStates[path].state) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"At this stage both states should be in sync lix state \" +\n\t\t\t\t\t\t\tlixState.state +\n\t\t\t\t\t\t\t\" fs state \" +\n\t\t\t\t\t\t\tstatesToSync.fsFileStates[path].state\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tasync function syncFiles(\n\t\tdirPath: string,\n\t\tfileStates: {\n\t\t\tlixFileStates: FsFileState;\n\t\t\tfsFileStates: FsFileState;\n\t\t},\n\t\tinterval?: number\n\t) {\n\t\t// mark all states as removed - checkFsStateRecursive will update those that exist on the disc correspondingly\n\t\tfor (const fsState of Object.values(fileStates.fsFileStates)) {\n\t\t\tfsState.state = \"gone\";\n\t\t}\n\n\t\t// mark all states as removed - checkFsStateRecursive will update those that exist on the disc correspondingly\n\t\tfor (const lixState of Object.values(fileStates.lixFileStates)) {\n\t\t\tlixState.state = \"gone\";\n\t\t}\n\n\t\t// read states from disc - detect changes\n\t\tawait checkFsStateRecursive(dirPath, fileStates.fsFileStates);\n\n\t\t// read states form lix - detect changes\n\t\tawait checkLixState(fileStates.lixFileStates);\n\n\t\t// sync fs<->lix\n\t\tawait syncUpFsAndLixFiles(fileStates);\n\n\t\tif (interval) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tsyncFiles(dirPath, fileStates, interval);\n\t\t\t}, interval);\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// Initial copy of all files\n\tawait syncFiles(\n\t\targs.path,\n\t\t{ fsFileStates: {}, lixFileStates: {} },\n\t\targs.syncInterval\n\t);\n\n\treturn;\n}\n\nasync function upsertFileInLix(\n\targs: { fs: typeof fs; path: string; lix: Lix },\n\tpath: string,\n\tdata: ArrayBuffer\n) {\n\t// force posix path when upserting into lix\n\t// https://github.com/opral/inlang/issues/229\n\tlet posixPath = path.split(nodePath.win32.sep).join(nodePath.posix.sep);\n\n\tif (posixPath.startsWith(\"/\") === false) {\n\t\tposixPath = \"/\" + posixPath;\n\t}\n\n\tawait args.lix.db\n\t\t.insertInto(\"file\") // change queue\n\t\t.values({\n\t\t\tpath: posixPath,\n\t\t\tdata: new Uint8Array(data),\n\t\t})\n\t\t.onConflict((oc) =>\n\t\t\toc.column(\"path\").doUpdateSet({ data: new Uint8Array(data) })\n\t\t)\n\t\t.execute();\n}\n/**\n * Filters legacy load and save messages plugins.\n *\n * Legacy plugins are plugins that implement loadMessages and saveMessages but not importFiles and exportFiles.\n */\nfunction categorizePlugins(plugins: readonly InlangPlugin[]) {\n\tconst loadSavePlugins: InlangPlugin[] = [];\n\tconst importExportPlugins: InlangPlugin[] = [];\n\n\tfor (const plugin of plugins) {\n\t\tif (\n\t\t\tplugin.loadMessages &&\n\t\t\tplugin.saveMessages &&\n\t\t\t!(plugin.importFiles && plugin.exportFiles)\n\t\t) {\n\t\t\tloadSavePlugins.push(plugin);\n\t\t} else if (plugin.importFiles || plugin.exportFiles) {\n\t\t\timportExportPlugins.push(plugin);\n\t\t}\n\t}\n\n\treturn { loadSavePlugins, importExportPlugins };\n}\n\n/**\n * Imports local plugins for backwards compatibility.\n *\n * https://github.com/opral/inlang/issues/171\n */\nasync function importLocalPlugins(args: {\n\tfs: typeof fs;\n\tsettings: ProjectSettings;\n\tpath: string;\n\tpreprocessPluginBeforeImport?: PreprocessPluginBeforeImportFunction;\n}) {\n\tconst errors: Error[] = [];\n\tconst locallyImportedPlugins = [];\n\tfor (const module of args.settings.modules ?? []) {\n\t\tif (module.startsWith(\"http\")) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst modulePath = absolutePathFromProject(args.path, module);\n\t\ttry {\n\t\t\tlet moduleAsText = await args.fs.promises.readFile(modulePath, \"utf8\");\n\t\t\tif (moduleAsText.includes(\"messageLintRule\")) {\n\t\t\t\terrors.push(new WarningDeprecatedLintRule(module));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (args.preprocessPluginBeforeImport) {\n\t\t\t\tmoduleAsText = await args.preprocessPluginBeforeImport(moduleAsText);\n\t\t\t}\n\n\t\t\t// In bun we need to do dynamic imports differently\n\t\t\tconst pluginAsUrl = process.versions.bun\n\t\t\t\t? URL.createObjectURL(\n\t\t\t\t\t\tnew Blob([moduleAsText], { type: \"text/javascript\" })\n\t\t\t\t\t)\n\t\t\t\t: \"data:application/javascript,\" + encodeURIComponent(moduleAsText);\n\n\t\t\tconst { default: plugin } = await import(/* @vite-ignore */ pluginAsUrl);\n\t\t\tlocallyImportedPlugins.push(plugin);\n\t\t\tif (process.versions.bun) URL.revokeObjectURL(pluginAsUrl);\n\t\t} catch (e) {\n\t\t\terrors.push(new PluginImportError({ plugin: module, cause: e as Error }));\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn {\n\t\terrors,\n\t\tlocallyImportedPlugins,\n\t};\n}\n\nexport class WarningDeprecatedLintRule extends Error {\n\tconstructor(module: string) {\n\t\tsuper(\n\t\t\t`The lint rule ${module} is deprecated. Please remove the lint rule from the settings. Lint rules are interim built into apps and will be succeeded by more generilizable lix validation rules.`\n\t\t);\n\t\tthis.name = \"WarningDeprecatedLintRule\";\n\t}\n}\n\nasync function shouldUpdateProjectMeta(args: {\n\tfs: typeof fs.promises;\n\tprojectPath: string;\n\tcurrentSdkVersion: string;\n}): Promise<boolean> {\n\tconst readmePath = nodePath.join(args.projectPath, \"README.md\");\n\tconst gitignorePath = nodePath.join(args.projectPath, \".gitignore\");\n\tconst shouldRepairGeneratedFiles =\n\t\t!(await fileExists(args.fs, readmePath)) ||\n\t\t!(await fileExists(args.fs, gitignorePath));\n\tif (shouldRepairGeneratedFiles) {\n\t\treturn true;\n\t}\n\tconst meta = await readProjectMeta({\n\t\tfs: args.fs,\n\t\tprojectPath: args.projectPath,\n\t});\n\tconst storedSdkVersion = pickHighestVersion([meta?.highestSdkVersion]);\n\tif (!storedSdkVersion) {\n\t\treturn true;\n\t}\n\tconst comparison = compareSemver(storedSdkVersion, args.currentSdkVersion);\n\tif (comparison === null) {\n\t\treturn true;\n\t}\n\treturn comparison < 0;\n}\n\nasync function fileExists(fsModule: typeof fs.promises, filePath: string) {\n\ttry {\n\t\tawait fsModule.stat(filePath);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport class ResourceFileImportError extends Error {\n\tpath: string;\n\n\tconstructor(args: { cause: Error; path: string }) {\n\t\tsuper(\"Could not import a resource file\");\n\t\tthis.name = \"ResourceFileImportError\";\n\t\tthis.cause = args.cause;\n\t\tthis.path = args.path;\n\t}\n}\n"]}
@@ -97,6 +97,66 @@ export declare const selectBundleNested: (db: Kysely<InlangDatabaseSchema>) => i
97
97
  } | {
98
98
  type: "text";
99
99
  value: string;
100
+ } | {
101
+ options?: {
102
+ value: {
103
+ type: "variable-reference";
104
+ name: string;
105
+ } | {
106
+ type: "literal";
107
+ value: string;
108
+ };
109
+ name: string;
110
+ }[] | undefined;
111
+ attributes?: {
112
+ value: true | {
113
+ type: "literal";
114
+ value: string;
115
+ };
116
+ name: string;
117
+ }[] | undefined;
118
+ type: "markup-start";
119
+ name: string;
120
+ } | {
121
+ options?: {
122
+ value: {
123
+ type: "variable-reference";
124
+ name: string;
125
+ } | {
126
+ type: "literal";
127
+ value: string;
128
+ };
129
+ name: string;
130
+ }[] | undefined;
131
+ attributes?: {
132
+ value: true | {
133
+ type: "literal";
134
+ value: string;
135
+ };
136
+ name: string;
137
+ }[] | undefined;
138
+ type: "markup-end";
139
+ name: string;
140
+ } | {
141
+ options?: {
142
+ value: {
143
+ type: "variable-reference";
144
+ name: string;
145
+ } | {
146
+ type: "literal";
147
+ value: string;
148
+ };
149
+ name: string;
150
+ }[] | undefined;
151
+ attributes?: {
152
+ value: true | {
153
+ type: "literal";
154
+ value: string;
155
+ };
156
+ name: string;
157
+ }[] | undefined;
158
+ type: "markup-standalone";
159
+ name: string;
100
160
  })[];
101
161
  id: string;
102
162
  messageId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"selectBundleNested.d.ts","sourceRoot":"/","sources":["query-utilities/selectBundleNested.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,OAAQ,MAAM,CAAC,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BlE,CAAC"}
1
+ {"version":3,"file":"selectBundleNested.d.ts","sourceRoot":"/","sources":["query-utilities/selectBundleNested.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,OAAQ,MAAM,CAAC,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BlE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export const ENV_VARIABLES = {
2
2
  PUBLIC_POSTHOG_TOKEN: undefined,
3
3
  PUBLIC_INLANG_SDK_SENTRY_DSN: undefined,
4
- SDK_VERSION: "2.6.2",
4
+ SDK_VERSION: "2.7.0",
5
5
  };
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/env-variables/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,oBAAoB,EAAE,SAAS;IAChC,4BAA4B,EAAE,SAAS;IACvC,WAAW,EAAE,OAAO;CACpB,CAAA","sourcesContent":["\nexport const ENV_VARIABLES = {\n PUBLIC_POSTHOG_TOKEN: undefined,\n\tPUBLIC_INLANG_SDK_SENTRY_DSN: undefined,\n\tSDK_VERSION: \"2.6.2\",\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/env-variables/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,oBAAoB,EAAE,SAAS;IAChC,4BAA4B,EAAE,SAAS;IACvC,WAAW,EAAE,OAAO;CACpB,CAAA","sourcesContent":["\nexport const ENV_VARIABLES = {\n PUBLIC_POSTHOG_TOKEN: undefined,\n\tPUBLIC_INLANG_SDK_SENTRY_DSN: undefined,\n\tSDK_VERSION: \"2.7.0\",\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inlang/sdk",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -11,6 +11,51 @@ test("toMessageV1", () => {
11
11
  expect(message).toStrictEqual(messageV1);
12
12
  });
13
13
 
14
+ test("throws when message contains markup placeholders", () => {
15
+ const markupBundle: BundleNested = {
16
+ id: "hello_world",
17
+ declarations: [],
18
+ messages: [
19
+ {
20
+ bundleId: "hello_world",
21
+ id: "hello_world_en",
22
+ locale: "en",
23
+ selectors: [],
24
+ variants: [
25
+ {
26
+ id: "hello_world_en_1",
27
+ matches: [],
28
+ messageId: "hello_world_en",
29
+ pattern: [
30
+ {
31
+ type: "markup-start",
32
+ name: "b",
33
+ options: [
34
+ {
35
+ name: "kind",
36
+ value: { type: "literal", value: "strong" },
37
+ },
38
+ ],
39
+ attributes: [{ name: "track", value: true }],
40
+ },
41
+ { type: "text", value: "Hello World!" },
42
+ {
43
+ type: "markup-end",
44
+ name: "b",
45
+ attributes: [{ name: "track", value: true }],
46
+ },
47
+ ],
48
+ },
49
+ ],
50
+ },
51
+ ],
52
+ };
53
+
54
+ expect(() => toMessageV1(markupBundle)).toThrow(
55
+ "Markup placeholders are not supported in MessageV1 conversion"
56
+ );
57
+ });
58
+
14
59
  test.todo("with variable references", () => {});
15
60
 
16
61
  const messageV1: MessageV1 = {
@@ -71,6 +71,14 @@ function toV1Pattern(pattern: Pattern): PatternV1 {
71
71
  throw new Error(`Unsupported expression argument type`);
72
72
  }
73
73
 
74
+ case "markup-start":
75
+ case "markup-end":
76
+ case "markup-standalone": {
77
+ throw new Error(
78
+ "Markup placeholders are not supported in MessageV1 conversion"
79
+ );
80
+ }
81
+
74
82
  default: {
75
83
  throw new Error(`Unsupported pattern element type`);
76
84
  }
@@ -18,6 +18,12 @@ export const Option = Type.Object({
18
18
  value: Type.Union([Literal, VariableReference]),
19
19
  });
20
20
 
21
+ export type Attribute = Static<typeof Attribute>;
22
+ export const Attribute = Type.Object({
23
+ name: Type.String(),
24
+ value: Type.Union([Literal, Type.Literal(true)]),
25
+ });
26
+
21
27
  export type FunctionReference = Static<typeof FunctionReference>;
22
28
  export const FunctionReference = Type.Object({
23
29
  type: Type.Literal("function-reference"),
@@ -38,6 +44,30 @@ export const Text = Type.Object({
38
44
  value: Type.String(),
39
45
  });
40
46
 
47
+ export type MarkupStart = Static<typeof MarkupStart>;
48
+ export const MarkupStart = Type.Object({
49
+ type: Type.Literal("markup-start"),
50
+ name: Type.String(),
51
+ options: Type.Optional(Type.Array(Option)),
52
+ attributes: Type.Optional(Type.Array(Attribute)),
53
+ });
54
+
55
+ export type MarkupEnd = Static<typeof MarkupEnd>;
56
+ export const MarkupEnd = Type.Object({
57
+ type: Type.Literal("markup-end"),
58
+ name: Type.String(),
59
+ options: Type.Optional(Type.Array(Option)),
60
+ attributes: Type.Optional(Type.Array(Attribute)),
61
+ });
62
+
63
+ export type MarkupStandalone = Static<typeof MarkupStandalone>;
64
+ export const MarkupStandalone = Type.Object({
65
+ type: Type.Literal("markup-standalone"),
66
+ name: Type.String(),
67
+ options: Type.Optional(Type.Array(Option)),
68
+ attributes: Type.Optional(Type.Array(Attribute)),
69
+ });
70
+
41
71
  export type LocalVariable = Static<typeof LocalVariable>;
42
72
  export const LocalVariable = Type.Object({
43
73
  type: Type.Literal("local-variable"),
@@ -56,4 +86,6 @@ export type Declaration = Static<typeof Declaration>;
56
86
  export const Declaration = Type.Union([InputVariable, LocalVariable]);
57
87
 
58
88
  export type Pattern = Static<typeof Pattern>;
59
- export const Pattern = Type.Array(Type.Union([Text, Expression]));
89
+ export const Pattern = Type.Array(
90
+ Type.Union([Text, Expression, MarkupStart, MarkupEnd, MarkupStandalone])
91
+ );
@@ -1,11 +1,6 @@
1
1
  import { newProject } from "./newProject.js";
2
2
  import { loadProjectInMemory } from "./loadProjectInMemory.js";
3
- import {
4
- closeLix,
5
- openLixInMemory,
6
- toBlob,
7
- type Lix,
8
- } from "@lix-js/sdk";
3
+ import { closeLix, openLixInMemory, toBlob, type Lix } from "@lix-js/sdk";
9
4
  import fs from "node:fs";
10
5
  import nodePath from "node:path";
11
6
  import type { InlangPlugin } from "../plugin/schema.js";