@inlang/sdk 0.9.0 → 0.11.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 +12 -8
- package/dist/errors.d.ts +18 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -10
- package/dist/loadProject.d.ts +4 -1
- package/dist/loadProject.d.ts.map +1 -1
- package/dist/loadProject.js +22 -11
- package/dist/loadProject.test.js +122 -43
- package/dist/resolve-modules/createNodeishFsWithAbsolutePaths.d.ts +6 -0
- package/dist/resolve-modules/createNodeishFsWithAbsolutePaths.d.ts.map +1 -0
- package/dist/resolve-modules/createNodeishFsWithAbsolutePaths.js +20 -0
- package/dist/resolve-modules/createNodeishFsWithAbsolutePaths.test.d.ts +2 -0
- package/dist/resolve-modules/createNodeishFsWithAbsolutePaths.test.d.ts.map +1 -0
- package/dist/resolve-modules/createNodeishFsWithAbsolutePaths.test.js +85 -0
- package/dist/resolve-modules/errors.d.ts +6 -5
- package/dist/resolve-modules/errors.d.ts.map +1 -1
- package/dist/resolve-modules/errors.js +10 -8
- package/dist/resolve-modules/import.d.ts.map +1 -1
- package/dist/resolve-modules/import.js +5 -5
- package/dist/resolve-modules/message-lint-rules/errors.d.ts +5 -4
- package/dist/resolve-modules/message-lint-rules/errors.d.ts.map +1 -1
- package/dist/resolve-modules/message-lint-rules/errors.js +2 -4
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts.map +1 -1
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.js +4 -2
- package/dist/resolve-modules/plugins/errors.d.ts +35 -28
- package/dist/resolve-modules/plugins/errors.d.ts.map +1 -1
- package/dist/resolve-modules/plugins/errors.js +23 -30
- package/dist/resolve-modules/plugins/resolvePlugins.d.ts.map +1 -1
- package/dist/resolve-modules/plugins/resolvePlugins.js +15 -14
- package/dist/resolve-modules/plugins/types.d.ts +2 -2
- package/dist/resolve-modules/plugins/types.d.ts.map +1 -1
- package/dist/resolve-modules/resolveModules.d.ts.map +1 -1
- package/dist/resolve-modules/resolveModules.js +5 -4
- package/dist/resolve-modules/resolveModules.test.js +2 -2
- package/dist/test-utilities/createMessage.d.ts +1 -1
- package/package.json +1 -1
- package/src/adapter/solidAdapter.test.ts +12 -8
- package/src/errors.ts +19 -10
- package/src/loadProject.test.ts +132 -43
- package/src/loadProject.ts +30 -18
- package/src/resolve-modules/createNodeishFsWithAbsolutePaths.test.ts +102 -0
- package/src/resolve-modules/createNodeishFsWithAbsolutePaths.ts +30 -0
- package/src/resolve-modules/errors.ts +14 -8
- package/src/resolve-modules/import.ts +5 -5
- package/src/resolve-modules/message-lint-rules/errors.ts +5 -5
- package/src/resolve-modules/message-lint-rules/resolveMessageLintRules.ts +4 -2
- package/src/resolve-modules/plugins/errors.ts +34 -36
- package/src/resolve-modules/plugins/resolvePlugins.ts +17 -46
- package/src/resolve-modules/plugins/types.ts +2 -2
- package/src/resolve-modules/resolveModules.test.ts +2 -2
- package/src/resolve-modules/resolveModules.ts +5 -6
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { normalizePath } from "@lix-js/fs";
|
|
2
|
+
export const createNodeishFsWithAbsolutePaths = (args) => {
|
|
3
|
+
const isAbsolutePath = (path) => /^[/\\]/.test(path);
|
|
4
|
+
if (!isAbsolutePath(args.basePath)) {
|
|
5
|
+
throw new Error("The argument `settingsFilePath` of `loadProject()` must be an absolute path.");
|
|
6
|
+
}
|
|
7
|
+
const intercept = (path) => {
|
|
8
|
+
if (isAbsolutePath(path)) {
|
|
9
|
+
return path;
|
|
10
|
+
}
|
|
11
|
+
return normalizePath(args.basePath + "/" + path);
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
readFile: (path, options) => args.nodeishFs.readFile(intercept(path), options),
|
|
16
|
+
readdir: (path) => args.nodeishFs.readdir(intercept(path)),
|
|
17
|
+
mkdir: (path) => args.nodeishFs.mkdir(intercept(path)),
|
|
18
|
+
writeFile: (path, data) => args.nodeishFs.writeFile(intercept(path), data),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNodeishFsWithAbsolutePaths.test.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/createNodeishFsWithAbsolutePaths.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { createNodeishFsWithAbsolutePaths } from "./createNodeishFsWithAbsolutePaths.js";
|
|
3
|
+
describe("createNodeishFsWithAbsolutePaths", () => {
|
|
4
|
+
it("throws an error if basePath is not an absolute path", () => {
|
|
5
|
+
const invalidBasePath = "relative/path";
|
|
6
|
+
const nodeishFs = {
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
readFile: async () => Promise.resolve(new Uint8Array(0)),
|
|
9
|
+
readdir: async () => Promise.resolve([]),
|
|
10
|
+
mkdir: async () => Promise.resolve(""),
|
|
11
|
+
writeFile: async () => Promise.resolve(),
|
|
12
|
+
};
|
|
13
|
+
expect(() => createNodeishFsWithAbsolutePaths({ basePath: invalidBasePath, nodeishFs })).toThrowError("The argument `settingsFilePath` of `loadProject()` must be an absolute path.");
|
|
14
|
+
});
|
|
15
|
+
it("intercepts paths correctly for readFile", async () => {
|
|
16
|
+
const basePath = "/absolute/path";
|
|
17
|
+
const filePath = "file.txt";
|
|
18
|
+
const expectedPath = "/absolute/path/file.txt";
|
|
19
|
+
const nodeishFs = {
|
|
20
|
+
// @ts-expect-error
|
|
21
|
+
readFile: async (path) => {
|
|
22
|
+
expect(path).toBe(expectedPath);
|
|
23
|
+
return Promise.resolve(new Uint8Array(0));
|
|
24
|
+
},
|
|
25
|
+
readdir: async () => Promise.resolve([]),
|
|
26
|
+
mkdir: async () => Promise.resolve(""),
|
|
27
|
+
writeFile: async () => Promise.resolve(),
|
|
28
|
+
};
|
|
29
|
+
const interceptedFs = createNodeishFsWithAbsolutePaths({ basePath, nodeishFs });
|
|
30
|
+
await interceptedFs.readFile(filePath, { encoding: "utf-8" });
|
|
31
|
+
});
|
|
32
|
+
it("intercepts paths correctly for readdir", async () => {
|
|
33
|
+
const basePath = "/absolute/path";
|
|
34
|
+
const dirPath = "dir";
|
|
35
|
+
const expectedPath = "/absolute/path/dir";
|
|
36
|
+
const nodeishFs = {
|
|
37
|
+
// @ts-expect-error
|
|
38
|
+
readFile: async () => Promise.resolve(new Uint8Array(0)),
|
|
39
|
+
readdir: async (path) => {
|
|
40
|
+
expect(path).toBe(expectedPath);
|
|
41
|
+
return Promise.resolve([]);
|
|
42
|
+
},
|
|
43
|
+
mkdir: async () => Promise.resolve(""),
|
|
44
|
+
writeFile: async () => Promise.resolve(),
|
|
45
|
+
};
|
|
46
|
+
const interceptedFs = createNodeishFsWithAbsolutePaths({ basePath, nodeishFs });
|
|
47
|
+
await interceptedFs.readdir(dirPath);
|
|
48
|
+
});
|
|
49
|
+
it("intercepts paths correctly for mkdir", async () => {
|
|
50
|
+
const basePath = "/absolute/path";
|
|
51
|
+
const dirPath = "newDir";
|
|
52
|
+
const expectedPath = "/absolute/path/newDir";
|
|
53
|
+
const nodeishFs = {
|
|
54
|
+
// @ts-expect-error
|
|
55
|
+
readFile: async () => Promise.resolve(new Uint8Array(0)),
|
|
56
|
+
readdir: async () => Promise.resolve([]),
|
|
57
|
+
mkdir: async (path) => {
|
|
58
|
+
expect(path).toBe(expectedPath);
|
|
59
|
+
return Promise.resolve("");
|
|
60
|
+
},
|
|
61
|
+
writeFile: async () => Promise.resolve(),
|
|
62
|
+
};
|
|
63
|
+
const interceptedFs = createNodeishFsWithAbsolutePaths({ basePath, nodeishFs });
|
|
64
|
+
await interceptedFs.mkdir(dirPath);
|
|
65
|
+
});
|
|
66
|
+
it("intercepts paths correctly for writeFile", async () => {
|
|
67
|
+
const basePath = "/absolute/path";
|
|
68
|
+
const filePath = "file.txt";
|
|
69
|
+
const expectedPath = "/absolute/path/file.txt";
|
|
70
|
+
const data = "Hello, World!";
|
|
71
|
+
const nodeishFs = {
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
readFile: async () => Promise.resolve(new Uint8Array(0)),
|
|
74
|
+
readdir: async () => Promise.resolve([]),
|
|
75
|
+
mkdir: async () => Promise.resolve(""),
|
|
76
|
+
writeFile: async (path, content) => {
|
|
77
|
+
expect(path).toBe(expectedPath);
|
|
78
|
+
expect(content).toBe(data);
|
|
79
|
+
return Promise.resolve();
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
const interceptedFs = createNodeishFsWithAbsolutePaths({ basePath, nodeishFs });
|
|
83
|
+
await interceptedFs.writeFile(filePath, data);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ValueError } from "@sinclair/typebox/errors";
|
|
1
2
|
export * from "./plugins/errors.js";
|
|
2
3
|
export * from "./message-lint-rules/errors.js";
|
|
3
4
|
export declare class ModuleError extends Error {
|
|
4
|
-
readonly
|
|
5
|
+
readonly module: string;
|
|
5
6
|
constructor(message: string, options: {
|
|
6
7
|
module: string;
|
|
7
8
|
cause?: Error;
|
|
@@ -11,7 +12,7 @@ export declare class ModuleError extends Error {
|
|
|
11
12
|
* Error when a Module does not export any plugins or lint rules.
|
|
12
13
|
*/
|
|
13
14
|
export declare class ModuleHasNoExportsError extends ModuleError {
|
|
14
|
-
constructor(
|
|
15
|
+
constructor(options: {
|
|
15
16
|
module: string;
|
|
16
17
|
cause?: Error;
|
|
17
18
|
});
|
|
@@ -20,15 +21,15 @@ export declare class ModuleHasNoExportsError extends ModuleError {
|
|
|
20
21
|
* Error when a Module cannot be imported.
|
|
21
22
|
*/
|
|
22
23
|
export declare class ModuleImportError extends ModuleError {
|
|
23
|
-
constructor(
|
|
24
|
+
constructor(options: {
|
|
24
25
|
module: string;
|
|
25
26
|
cause: Error;
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
export declare class ModuleExportIsInvalidError extends ModuleError {
|
|
29
|
-
constructor(
|
|
30
|
+
constructor(options: {
|
|
30
31
|
module: string;
|
|
31
|
-
|
|
32
|
+
errors: ValueError[];
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/errors.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAE9C,qBAAa,WAAY,SAAQ,KAAK;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAA;gBAClB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAMvE;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;gBAC3C,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAE9C,qBAAa,WAAY,SAAQ,KAAK;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAA;gBAClB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAMvE;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;gBAC3C,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE;CAItD;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;gBACrC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;CAIrD;AAED,qBAAa,0BAA2B,SAAQ,WAAW;gBAC9C,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,EAAE,CAAA;KAAE;CAS7D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * from "./plugins/errors.js";
|
|
2
2
|
export * from "./message-lint-rules/errors.js";
|
|
3
3
|
export class ModuleError extends Error {
|
|
4
|
-
|
|
4
|
+
module;
|
|
5
5
|
constructor(message, options) {
|
|
6
6
|
super(message);
|
|
7
7
|
this.name = "ModuleError";
|
|
8
|
-
this.
|
|
8
|
+
this.module = options.module;
|
|
9
9
|
this.cause = options.cause;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -13,8 +13,8 @@ export class ModuleError extends Error {
|
|
|
13
13
|
* Error when a Module does not export any plugins or lint rules.
|
|
14
14
|
*/
|
|
15
15
|
export class ModuleHasNoExportsError extends ModuleError {
|
|
16
|
-
constructor(
|
|
17
|
-
super(
|
|
16
|
+
constructor(options) {
|
|
17
|
+
super(`Module "${module}" has no exports. Every module must have an "export default".`, options);
|
|
18
18
|
this.name = "ModuleHasNoExportsError";
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -22,14 +22,16 @@ export class ModuleHasNoExportsError extends ModuleError {
|
|
|
22
22
|
* Error when a Module cannot be imported.
|
|
23
23
|
*/
|
|
24
24
|
export class ModuleImportError extends ModuleError {
|
|
25
|
-
constructor(
|
|
26
|
-
super(
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super(`Couldn't import the plugin "${module}":\n\n${options.cause}`, options);
|
|
27
27
|
this.name = "ModuleImportError";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export class ModuleExportIsInvalidError extends ModuleError {
|
|
31
|
-
constructor(
|
|
32
|
-
super(
|
|
31
|
+
constructor(options) {
|
|
32
|
+
super(`The export(s) of "${module}" are invalid:\n\n${options.errors
|
|
33
|
+
.map((error) => `Path "${error.path}" with value "${error.value}": "${error.message}"`)
|
|
34
|
+
.join("\n")}`, options);
|
|
33
35
|
this.name = "ModuleExportIsInvalidError";
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/import.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/import.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAG7D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAClC,6CAA6C;IAC7C,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAA;CAC7C,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,CAAC,OAAO,OAAO,CAAC,CAG9C;AAED,iBAAe,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;IACR;;OAEG;IACH,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAA;CAC7C,GACC,OAAO,CAAC,GAAG,CAAC,CAyBd"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import dedent from "dedent";
|
|
2
|
-
import { normalizePath } from "@lix-js/fs";
|
|
3
2
|
import { ModuleImportError } from "./errors.js";
|
|
4
3
|
/**
|
|
5
4
|
* Creates the import function.
|
|
@@ -20,21 +19,22 @@ async function $import(uri, options) {
|
|
|
20
19
|
moduleAsText = await (await fetch(uri)).text();
|
|
21
20
|
}
|
|
22
21
|
else {
|
|
23
|
-
moduleAsText = await options.readFile(
|
|
22
|
+
moduleAsText = await options.readFile(uri, {
|
|
23
|
+
encoding: "utf-8",
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
26
|
const moduleWithMimeType = "data:application/javascript," + encodeURIComponent(moduleAsText);
|
|
26
27
|
try {
|
|
27
28
|
return await import(/* @vite-ignore */ moduleWithMimeType);
|
|
28
29
|
}
|
|
29
30
|
catch (error) {
|
|
30
|
-
let message = `Error while importing ${uri}: ${error?.message ?? "Unknown error"}`;
|
|
31
31
|
if (error instanceof SyntaxError && uri.includes("jsdelivr")) {
|
|
32
|
-
message += dedent `\n\n
|
|
32
|
+
error.message += dedent `\n\n
|
|
33
33
|
Are you sure that the file exists on JSDelivr?
|
|
34
34
|
|
|
35
35
|
The error indicates that the imported file does not exist on JSDelivr. For non-existent files, JSDelivr returns a 404 text that JS cannot parse as a module and throws a SyntaxError.
|
|
36
36
|
`;
|
|
37
37
|
}
|
|
38
|
-
throw new ModuleImportError(
|
|
38
|
+
throw new ModuleImportError({ module: uri, cause: error });
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { MessageLintRule } from "@inlang/message-lint-rule";
|
|
2
|
+
import type { ValueError } from "@sinclair/typebox/errors";
|
|
1
3
|
export declare class MessageLintRuleIsInvalidError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
cause?: Error;
|
|
4
|
+
constructor(options: {
|
|
5
|
+
id: MessageLintRule["id"];
|
|
6
|
+
errors: ValueError[];
|
|
6
7
|
});
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/message-lint-rules/errors.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/message-lint-rules/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,qBAAa,6BAA8B,SAAQ,KAAK;gBAC3C,OAAO,EAAE;QAAE,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;QAAC,MAAM,EAAE,UAAU,EAAE,CAAA;KAAE;CAIxE"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export class MessageLintRuleIsInvalidError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
super(message);
|
|
5
|
-
this.module = options.module;
|
|
2
|
+
constructor(options) {
|
|
3
|
+
super(`The message lint rule "${options.id}" is invalid:\n\n${options.errors.join("\n")}`);
|
|
6
4
|
this.name = "MessageLintRuleIsInvalidError";
|
|
7
5
|
}
|
|
8
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveMessageLintRules.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/message-lint-rules/resolveMessageLintRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,uBAAuB,SAAU;IAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC,CAAA;CAAE;;;
|
|
1
|
+
{"version":3,"file":"resolveMessageLintRules.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/message-lint-rules/resolveMessageLintRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,uBAAuB,SAAU;IAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC,CAAA;CAAE;;;CAqBzF,CAAA"}
|
|
@@ -8,8 +8,10 @@ export const resolveMessageLintRules = (args) => {
|
|
|
8
8
|
};
|
|
9
9
|
for (const rule of args.messageLintRules) {
|
|
10
10
|
if (Value.Check(MessageLintRule, rule) === false) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const errors = [...Value.Errors(MessageLintRule, rule)];
|
|
12
|
+
result.errors.push(new MessageLintRuleIsInvalidError({
|
|
13
|
+
id: rule.id,
|
|
14
|
+
errors,
|
|
13
15
|
}));
|
|
14
16
|
continue;
|
|
15
17
|
}
|
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
import type { Plugin } from "@inlang/plugin";
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import type { ValueError } from "@sinclair/typebox/errors";
|
|
3
|
+
export declare class PluginHasInvalidIdError extends Error {
|
|
4
|
+
constructor(options: {
|
|
5
|
+
id: Plugin["id"];
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export declare class PluginUsesReservedNamespaceError extends Error {
|
|
9
|
+
constructor(options: {
|
|
10
|
+
id: Plugin["id"];
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export declare class PluginHasInvalidSchemaError extends Error {
|
|
14
|
+
constructor(options: {
|
|
15
|
+
id: Plugin["id"];
|
|
16
|
+
errors: ValueError[];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export declare class PluginLoadMessagesFunctionAlreadyDefinedError extends Error {
|
|
20
|
+
constructor(options: {
|
|
21
|
+
id: Plugin["id"];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export declare class PluginSaveMessagesFunctionAlreadyDefinedError extends Error {
|
|
25
|
+
constructor(options: {
|
|
26
|
+
id: Plugin["id"];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export declare class PluginReturnedInvalidCustomApiError extends Error {
|
|
30
|
+
constructor(options: {
|
|
31
|
+
id: Plugin["id"];
|
|
32
|
+
cause: ErrorOptions["cause"];
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export declare class PluginsDoNotProvideLoadOrSaveMessagesError extends Error {
|
|
36
|
+
constructor();
|
|
8
37
|
}
|
|
9
|
-
export declare class PluginHasInvalidIdError extends PluginError {
|
|
10
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
11
|
-
}
|
|
12
|
-
export declare class PluginUsesReservedNamespaceError extends PluginError {
|
|
13
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
14
|
-
}
|
|
15
|
-
export declare class PluginHasInvalidSchemaError extends PluginError {
|
|
16
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
17
|
-
}
|
|
18
|
-
export declare class PluginLoadMessagesFunctionAlreadyDefinedError extends PluginError {
|
|
19
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
20
|
-
}
|
|
21
|
-
export declare class PluginSaveMessagesFunctionAlreadyDefinedError extends PluginError {
|
|
22
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
23
|
-
}
|
|
24
|
-
export declare class PluginReturnedInvalidCustomApiError extends PluginError {
|
|
25
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
26
|
-
}
|
|
27
|
-
export declare class PluginsDoNotProvideLoadOrSaveMessagesError extends PluginError {
|
|
28
|
-
constructor(message: string, options: PluginErrorOptions);
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
31
38
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/plugins/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/plugins/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,qBAAa,uBAAwB,SAAQ,KAAK;gBACrC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;KAAE;CAMzC;AAED,qBAAa,gCAAiC,SAAQ,KAAK;gBAC9C,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;KAAE;CAIzC;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACzC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAAC,MAAM,EAAE,UAAU,EAAE,CAAA;KAAE;CAQ/D;AAED,qBAAa,6CAA8C,SAAQ,KAAK;gBAC3D,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;KAAE;CAMzC;AAED,qBAAa,6CAA8C,SAAQ,KAAK;gBAC3D,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;KAAE;CAMzC;AAED,qBAAa,mCAAoC,SAAQ,KAAK;gBACjD,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;KAAE;CAIvE;AAED,qBAAa,0CAA2C,SAAQ,KAAK;;CAOpE"}
|
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
class
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
super(message);
|
|
5
|
-
this.name = "PluginError";
|
|
6
|
-
this.plugin = options.plugin ?? "unknown";
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export class PluginHasInvalidIdError extends PluginError {
|
|
10
|
-
constructor(message, options) {
|
|
11
|
-
super(message, options);
|
|
1
|
+
export class PluginHasInvalidIdError extends Error {
|
|
2
|
+
constructor(options) {
|
|
3
|
+
super(`Plugin "${options.id}" has an invalid id. The id must:\n1) Start with "plugin."\n2) camelCase\n3) Contain a namespace.\nAn example would be "plugin.namespace.myPlugin".`);
|
|
12
4
|
this.name = "PluginHasInvalidIdError";
|
|
13
5
|
}
|
|
14
6
|
}
|
|
15
|
-
export class PluginUsesReservedNamespaceError extends
|
|
16
|
-
constructor(
|
|
17
|
-
super(
|
|
7
|
+
export class PluginUsesReservedNamespaceError extends Error {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super(`Plugin ${options.id} uses reserved namespace 'inlang'.`);
|
|
18
10
|
this.name = "PluginUsesReservedNamespaceError";
|
|
19
11
|
}
|
|
20
12
|
}
|
|
21
|
-
export class PluginHasInvalidSchemaError extends
|
|
22
|
-
constructor(
|
|
23
|
-
super(
|
|
13
|
+
export class PluginHasInvalidSchemaError extends Error {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super(`Plugin "${options.id}" has an invalid schema:\n\n${options.errors
|
|
16
|
+
.map((error) => `Path "${error.path}" with value "${error.value}": "${error.message}"`)
|
|
17
|
+
.join("\n")})}\n\nPlease refer to the documentation for the correct schema.`);
|
|
24
18
|
this.name = "PluginHasInvalidSchemaError";
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
|
-
export class PluginLoadMessagesFunctionAlreadyDefinedError extends
|
|
28
|
-
constructor(
|
|
29
|
-
super(
|
|
21
|
+
export class PluginLoadMessagesFunctionAlreadyDefinedError extends Error {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
super(`Plugin "${options.id}" defines the \`loadMessages()\` function, but it was already defined by another plugin.\n\nInlang only allows one plugin to define the \`loadMessages()\` function.`);
|
|
30
24
|
this.name = "PluginLoadMessagesFunctionAlreadyDefinedError";
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
|
-
export class PluginSaveMessagesFunctionAlreadyDefinedError extends
|
|
34
|
-
constructor(
|
|
35
|
-
super(
|
|
27
|
+
export class PluginSaveMessagesFunctionAlreadyDefinedError extends Error {
|
|
28
|
+
constructor(options) {
|
|
29
|
+
super(`Plugin "${options.id}" defines the \`saveMessages()\` function, but it was already defined by another plugin.\n\nInlang only allows one plugin to define the \`saveMessages()\` function.`);
|
|
36
30
|
this.name = "PluginSaveMessagesFunctionAlreadyDefinedError";
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
|
-
export class PluginReturnedInvalidCustomApiError extends
|
|
40
|
-
constructor(
|
|
41
|
-
super(
|
|
33
|
+
export class PluginReturnedInvalidCustomApiError extends Error {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
super(`Plugin "${options.id}" returned an invalid custom API:\n\n${options.cause}`, options);
|
|
42
36
|
this.name = "PluginReturnedInvalidCustomApiError";
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
|
-
export class PluginsDoNotProvideLoadOrSaveMessagesError extends
|
|
46
|
-
constructor(
|
|
47
|
-
super(
|
|
39
|
+
export class PluginsDoNotProvideLoadOrSaveMessagesError extends Error {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(`No plugin provides a \`loadMessages()\` or \`saveMessages()\` function\n\nIn case no plugin threw an error, you likely forgot to add a plugin that handles the loading and saving of messages. Refer to the marketplace for available plugins https://inlang.com/marketplace.`);
|
|
48
42
|
this.name = "PluginsDoNotProvideLoadOrSaveMessagesError";
|
|
49
|
-
options.plugin = "plugin.inlang.missing";
|
|
50
43
|
}
|
|
51
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePlugins.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/plugins/resolvePlugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAuBxD,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"resolvePlugins.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/plugins/resolvePlugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAuBxD,eAAO,MAAM,cAAc,EAAE,sBAqH5B,CAAA"}
|
|
@@ -27,27 +27,27 @@ export const resolvePlugins = async (args) => {
|
|
|
27
27
|
// -- INVALID ID in META --
|
|
28
28
|
const hasInvalidId = errors.some((error) => error.path === "/id");
|
|
29
29
|
if (hasInvalidId) {
|
|
30
|
-
result.errors.push(new PluginHasInvalidIdError(
|
|
30
|
+
result.errors.push(new PluginHasInvalidIdError({ id: plugin.id }));
|
|
31
31
|
}
|
|
32
32
|
// -- USES RESERVED NAMESPACE --
|
|
33
33
|
if (plugin.id.includes("inlang") && !whitelistedPlugins.includes(plugin.id)) {
|
|
34
|
-
result.errors.push(new PluginUsesReservedNamespaceError(
|
|
35
|
-
|
|
34
|
+
result.errors.push(new PluginUsesReservedNamespaceError({
|
|
35
|
+
id: plugin.id,
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
38
|
// -- USES INVALID SCHEMA --
|
|
39
39
|
if (errors.length > 0) {
|
|
40
|
-
result.errors.push(new PluginHasInvalidSchemaError(
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
result.errors.push(new PluginHasInvalidSchemaError({
|
|
41
|
+
id: plugin.id,
|
|
42
|
+
errors: errors,
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
45
45
|
// -- ALREADY DEFINED LOADMESSAGES / SAVEMESSAGES / DETECTEDLANGUAGETAGS --
|
|
46
46
|
if (typeof plugin.loadMessages === "function" && result.data.loadMessages !== undefined) {
|
|
47
|
-
result.errors.push(new PluginLoadMessagesFunctionAlreadyDefinedError(
|
|
47
|
+
result.errors.push(new PluginLoadMessagesFunctionAlreadyDefinedError({ id: plugin.id }));
|
|
48
48
|
}
|
|
49
49
|
if (typeof plugin.saveMessages === "function" && result.data.saveMessages !== undefined) {
|
|
50
|
-
result.errors.push(new PluginSaveMessagesFunctionAlreadyDefinedError(
|
|
50
|
+
result.errors.push(new PluginSaveMessagesFunctionAlreadyDefinedError({ id: plugin.id }));
|
|
51
51
|
}
|
|
52
52
|
// --- ADD APP SPECIFIC API ---
|
|
53
53
|
if (typeof plugin.addCustomApi === "function") {
|
|
@@ -56,12 +56,13 @@ export const resolvePlugins = async (args) => {
|
|
|
56
56
|
settings: args.settings,
|
|
57
57
|
}));
|
|
58
58
|
if (error) {
|
|
59
|
-
|
|
60
|
-
delete error.stack;
|
|
61
|
-
result.errors.push(error); // TODO: add correct error type
|
|
59
|
+
result.errors.push(new PluginReturnedInvalidCustomApiError({ id: plugin.id, cause: error }));
|
|
62
60
|
}
|
|
63
|
-
if (typeof customApi !== "object") {
|
|
64
|
-
result.errors.push(new PluginReturnedInvalidCustomApiError(
|
|
61
|
+
else if (typeof customApi !== "object") {
|
|
62
|
+
result.errors.push(new PluginReturnedInvalidCustomApiError({
|
|
63
|
+
id: plugin.id,
|
|
64
|
+
cause: new Error(`The return value must be an object. Received "${typeof customApi}".`),
|
|
65
|
+
}));
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
// -- CONTINUE IF ERRORS --
|
|
@@ -95,7 +96,7 @@ export const resolvePlugins = async (args) => {
|
|
|
95
96
|
// --- LOADMESSAGE / SAVEMESSAGE NOT DEFINED ---
|
|
96
97
|
if (typeof result.data.loadMessages !== "function" ||
|
|
97
98
|
typeof result.data.saveMessages !== "function") {
|
|
98
|
-
result.errors.push(new PluginsDoNotProvideLoadOrSaveMessagesError(
|
|
99
|
+
result.errors.push(new PluginsDoNotProvideLoadOrSaveMessagesError());
|
|
99
100
|
}
|
|
100
101
|
return result;
|
|
101
102
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NodeishFilesystem
|
|
1
|
+
import type { NodeishFilesystem } from "@lix-js/fs";
|
|
2
2
|
import type { PluginReturnedInvalidCustomApiError, PluginLoadMessagesFunctionAlreadyDefinedError, PluginSaveMessagesFunctionAlreadyDefinedError, PluginHasInvalidIdError, PluginHasInvalidSchemaError, PluginUsesReservedNamespaceError, PluginsDoNotProvideLoadOrSaveMessagesError } from "./errors.js";
|
|
3
3
|
import type { Message } from "@inlang/message";
|
|
4
4
|
import type { CustomApiInlangIdeExtension, Plugin } from "@inlang/plugin";
|
|
@@ -8,7 +8,7 @@ import type { ProjectSettings } from "@inlang/project-settings";
|
|
|
8
8
|
*
|
|
9
9
|
* - only uses minimally required functions to decrease the API footprint on the ecosystem.
|
|
10
10
|
*/
|
|
11
|
-
export type NodeishFilesystemSubset = Pick<
|
|
11
|
+
export type NodeishFilesystemSubset = Pick<NodeishFilesystem, "readFile" | "readdir" | "mkdir" | "writeFile">;
|
|
12
12
|
/**
|
|
13
13
|
* Function that resolves (imports and initializes) the plugins.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/resolve-modules/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EACX,mCAAmC,EACnC,6CAA6C,EAC7C,6CAA6C,EAC7C,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,0CAA0C,EAC1C,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACzC,iBAAiB,EACjB,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAC9C,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC3C,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACtB,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,uBAAuB,CAAA;CAClC,KAAK,OAAO,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,KAAK,CACV,mCAAmC,GACnC,6CAA6C,GAC7C,6CAA6C,GAC7C,uBAAuB,GACvB,2BAA2B,GAC3B,gCAAgC,GAChC,0CAA0C,CAC5C,CAAA;CACD,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,YAAY,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,eAAe,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAA;IACrF,YAAY,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,eAAe,CAAC;QAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAChG;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,EAAE,MAAM,CAAC,OAAO,MAAM,IAAI,MAAM,EAAE,GAAG,WAAW,MAAM,IAAI,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG;QACvF,yBAAyB,CAAC,EAAE,2BAA2B,CAAA;KACvD,CAAA;CACD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveModules.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/resolveModules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAkBvD,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"resolveModules.d.ts","sourceRoot":"","sources":["../../src/resolve-modules/resolveModules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAkBvD,eAAO,MAAM,cAAc,EAAE,qBA+E5B,CAAA"}
|
|
@@ -19,7 +19,7 @@ export const resolveModules = async (args) => {
|
|
|
19
19
|
const importedModule = await tryCatch(() => _import(module));
|
|
20
20
|
// -- IMPORT MODULE --
|
|
21
21
|
if (importedModule.error) {
|
|
22
|
-
moduleErrors.push(new ModuleImportError(
|
|
22
|
+
moduleErrors.push(new ModuleImportError({
|
|
23
23
|
module: module,
|
|
24
24
|
cause: importedModule.error,
|
|
25
25
|
}));
|
|
@@ -27,16 +27,17 @@ export const resolveModules = async (args) => {
|
|
|
27
27
|
}
|
|
28
28
|
// -- MODULE DOES NOT EXPORT ANYTHING --
|
|
29
29
|
if (importedModule.data?.default === undefined) {
|
|
30
|
-
moduleErrors.push(new ModuleHasNoExportsError(
|
|
30
|
+
moduleErrors.push(new ModuleHasNoExportsError({
|
|
31
31
|
module: module,
|
|
32
32
|
}));
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
const isValidModule = ModuleCompiler.Check(importedModule.data);
|
|
36
36
|
if (isValidModule === false) {
|
|
37
|
-
const errors = [...ModuleCompiler.Errors(importedModule.data)]
|
|
38
|
-
moduleErrors.push(new ModuleExportIsInvalidError(
|
|
37
|
+
const errors = [...ModuleCompiler.Errors(importedModule.data)];
|
|
38
|
+
moduleErrors.push(new ModuleExportIsInvalidError({
|
|
39
39
|
module: module,
|
|
40
|
+
errors,
|
|
40
41
|
}));
|
|
41
42
|
continue;
|
|
42
43
|
}
|
|
@@ -11,7 +11,7 @@ it("should return an error if a plugin cannot be imported", async () => {
|
|
|
11
11
|
settings,
|
|
12
12
|
nodeishFs: {},
|
|
13
13
|
_import: () => {
|
|
14
|
-
throw new ModuleImportError(
|
|
14
|
+
throw new ModuleImportError({
|
|
15
15
|
module: settings.modules[0],
|
|
16
16
|
cause: new Error("Could not import"),
|
|
17
17
|
});
|
|
@@ -74,7 +74,7 @@ it("should return an error if a module cannot be imported", async () => {
|
|
|
74
74
|
modules: ["https://myplugin.com/index.js"],
|
|
75
75
|
};
|
|
76
76
|
const _import = async () => {
|
|
77
|
-
throw new ModuleImportError(
|
|
77
|
+
throw new ModuleImportError({
|
|
78
78
|
module: settings.modules[0],
|
|
79
79
|
cause: new Error(),
|
|
80
80
|
});
|