@inlang/sdk 0.26.4 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/solidAdapter.test.js +52 -4
- package/dist/api.d.ts +3 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/createMessageLintReportsQuery.d.ts +1 -1
- package/dist/createMessageLintReportsQuery.d.ts.map +1 -1
- package/dist/createMessageLintReportsQuery.js +30 -22
- package/dist/createMessagesQuery.d.ts.map +1 -1
- package/dist/createMessagesQuery.js +24 -1
- package/dist/createMessagesQuery.test.js +46 -2
- package/dist/createNodeishFsWithAbsolutePaths.d.ts +3 -3
- package/dist/createNodeishFsWithAbsolutePaths.d.ts.map +1 -1
- package/dist/createNodeishFsWithAbsolutePaths.js +9 -1
- package/dist/createNodeishFsWithAbsolutePaths.test.js +7 -1
- package/dist/createNodeishFsWithWatcher.d.ts +3 -3
- package/dist/createNodeishFsWithWatcher.d.ts.map +1 -1
- package/dist/createNodeishFsWithWatcher.js +3 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -0
- package/dist/loadProject.d.ts.map +1 -1
- package/dist/loadProject.js +472 -39
- package/dist/loadProject.test.js +91 -14
- package/dist/messages/variant.test.js +3 -0
- package/dist/resolve-modules/plugins/resolvePlugins.test.js +4 -2
- package/dist/storage/helper.d.ts +5 -0
- package/dist/storage/helper.d.ts.map +1 -0
- package/dist/storage/helper.js +35 -0
- package/dist/storage/human-id/human-readable-id.d.ts +3 -0
- package/dist/storage/human-id/human-readable-id.d.ts.map +1 -0
- package/dist/storage/human-id/human-readable-id.js +20 -0
- package/dist/storage/human-id/words.d.ts +5 -0
- package/dist/storage/human-id/words.d.ts.map +1 -0
- package/dist/storage/human-id/words.js +1032 -0
- package/dist/storage/human-id/words.test.d.ts +2 -0
- package/dist/storage/human-id/words.test.d.ts.map +1 -0
- package/dist/storage/human-id/words.test.js +25 -0
- package/dist/test-utilities/createMessage.d.ts +1 -0
- package/dist/test-utilities/createMessage.d.ts.map +1 -1
- package/dist/test-utilities/createMessage.js +1 -0
- package/dist/test-utilities/createMessage.test.js +70 -55
- package/package.json +12 -8
- package/src/adapter/solidAdapter.test.ts +76 -4
- package/src/api.ts +4 -0
- package/src/createMessageLintReportsQuery.ts +46 -34
- package/src/createMessagesQuery.test.ts +54 -2
- package/src/createMessagesQuery.ts +30 -1
- package/src/createNodeishFsWithAbsolutePaths.test.ts +10 -3
- package/src/createNodeishFsWithAbsolutePaths.ts +14 -5
- package/src/createNodeishFsWithWatcher.ts +6 -3
- package/src/errors.ts +20 -0
- package/src/loadProject.test.ts +106 -14
- package/src/loadProject.ts +655 -60
- package/src/messages/variant.test.ts +3 -0
- package/src/resolve-modules/plugins/resolvePlugins.test.ts +4 -2
- package/src/storage/helper.ts +48 -0
- package/src/storage/human-id/human-readable-id.ts +27 -0
- package/src/storage/human-id/words.test.ts +27 -0
- package/src/storage/human-id/words.ts +1035 -0
- package/src/test-utilities/createMessage.test.ts +72 -54
- package/src/test-utilities/createMessage.ts +1 -0
|
@@ -6,8 +6,27 @@ test("should create a simple message", () => {
|
|
|
6
6
|
createMessage("welcome", {
|
|
7
7
|
de: "Hallo inlang",
|
|
8
8
|
})
|
|
9
|
-
).toMatchInlineSnapshot(
|
|
9
|
+
).toMatchInlineSnapshot(
|
|
10
10
|
{
|
|
11
|
+
alias: {},
|
|
12
|
+
id: "welcome",
|
|
13
|
+
selectors: [],
|
|
14
|
+
variants: [
|
|
15
|
+
{
|
|
16
|
+
languageTag: "de",
|
|
17
|
+
match: [],
|
|
18
|
+
pattern: [
|
|
19
|
+
{
|
|
20
|
+
type: "Text",
|
|
21
|
+
value: "Hallo inlang",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
`
|
|
28
|
+
{
|
|
29
|
+
"alias": {},
|
|
11
30
|
"id": "welcome",
|
|
12
31
|
"selectors": [],
|
|
13
32
|
"variants": [
|
|
@@ -23,7 +42,8 @@ test("should create a simple message", () => {
|
|
|
23
42
|
},
|
|
24
43
|
],
|
|
25
44
|
}
|
|
26
|
-
`
|
|
45
|
+
`
|
|
46
|
+
)
|
|
27
47
|
})
|
|
28
48
|
|
|
29
49
|
test("should create a message with pattern", () => {
|
|
@@ -35,32 +55,31 @@ test("should create a message with pattern", () => {
|
|
|
35
55
|
{ type: "Text", value: '"' },
|
|
36
56
|
],
|
|
37
57
|
})
|
|
38
|
-
).
|
|
58
|
+
).toStrictEqual({
|
|
59
|
+
alias: {},
|
|
60
|
+
id: "greeting",
|
|
61
|
+
selectors: [],
|
|
62
|
+
variants: [
|
|
39
63
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
}
|
|
63
|
-
`)
|
|
64
|
+
languageTag: "en",
|
|
65
|
+
match: [],
|
|
66
|
+
pattern: [
|
|
67
|
+
{
|
|
68
|
+
type: "Text",
|
|
69
|
+
value: "Hi ",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "name",
|
|
73
|
+
type: "VariableReference",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "Text",
|
|
77
|
+
value: '"',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
})
|
|
64
83
|
})
|
|
65
84
|
|
|
66
85
|
test("should create a message with a pattern", () => {
|
|
@@ -69,32 +88,31 @@ test("should create a message with a pattern", () => {
|
|
|
69
88
|
en: "hello inlang",
|
|
70
89
|
de: [{ type: "Text", value: "Hallo inlang" }],
|
|
71
90
|
})
|
|
72
|
-
).
|
|
91
|
+
).toStrictEqual({
|
|
92
|
+
alias: {},
|
|
93
|
+
id: "welcome",
|
|
94
|
+
selectors: [],
|
|
95
|
+
variants: [
|
|
96
|
+
{
|
|
97
|
+
languageTag: "en",
|
|
98
|
+
match: [],
|
|
99
|
+
pattern: [
|
|
100
|
+
{
|
|
101
|
+
type: "Text",
|
|
102
|
+
value: "hello inlang",
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
73
106
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"languageTag": "de",
|
|
89
|
-
"match": [],
|
|
90
|
-
"pattern": [
|
|
91
|
-
{
|
|
92
|
-
"type": "Text",
|
|
93
|
-
"value": "Hallo inlang",
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
}
|
|
99
|
-
`)
|
|
107
|
+
languageTag: "de",
|
|
108
|
+
match: [],
|
|
109
|
+
pattern: [
|
|
110
|
+
{
|
|
111
|
+
type: "Text",
|
|
112
|
+
value: "Hallo inlang",
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
})
|
|
100
118
|
})
|
|
@@ -3,6 +3,7 @@ import type { Message, Pattern } from "@inlang/message"
|
|
|
3
3
|
export const createMessage = (id: string, patterns: Record<string, Pattern | string>) =>
|
|
4
4
|
({
|
|
5
5
|
id,
|
|
6
|
+
alias: {},
|
|
6
7
|
selectors: [],
|
|
7
8
|
variants: Object.entries(patterns).map(([languageTag, patterns]) => ({
|
|
8
9
|
languageTag,
|