@inlang/sdk 0.36.3 → 0.37.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.
@@ -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;AAoBvD,eAAO,MAAM,cAAc,EAAE,qBA4F5B,CAAA"}
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,qBA4F5B,CAAA"}
@@ -6,7 +6,6 @@ import { createImport } from "./import.js";
6
6
  import { resolvePlugins } from "./plugins/resolvePlugins.js";
7
7
  import { TypeCompiler } from "@sinclair/typebox/compiler";
8
8
  import { validatedModuleSettings } from "./validatedModuleSettings.js";
9
- const ModuleCompiler = TypeCompiler.Compile(InlangModule);
10
9
  export const resolveModules = async (args) => {
11
10
  const _import = args._import ?? createImport(args.projectPath, args.nodeishFs);
12
11
  const allPlugins = [];
@@ -30,16 +29,18 @@ export const resolveModules = async (args) => {
30
29
  }));
31
30
  return;
32
31
  }
33
- // -- CHECK IF MODULE IS SYNTACTIALLY VALID
34
- const isValidModule = ModuleCompiler.Check(importedModule.data);
35
- if (isValidModule === false) {
36
- const errors = [...ModuleCompiler.Errors(importedModule.data)];
37
- moduleErrors.push(new ModuleExportIsInvalidError({
38
- module: module,
39
- errors,
40
- }));
41
- return;
42
- }
32
+ // // -- CHECK IF MODULE IS SYNTACTIALLY VALID
33
+ // const isValidModule = ModuleCompiler.Check(importedModule.data)
34
+ // if (isValidModule === false) {
35
+ // const errors = [...ModuleCompiler.Errors(importedModule.data)]
36
+ // moduleErrors.push(
37
+ // new ModuleExportIsInvalidError({
38
+ // module: module,
39
+ // errors,
40
+ // })
41
+ // )
42
+ // return
43
+ // }
43
44
  // -- VALIDATE MODULE SETTINGS
44
45
  const result = validatedModuleSettings({
45
46
  settingsSchema: importedModule.data.default.settingsSchema,
@@ -113,7 +113,7 @@ it("should return an error if a module does not export anything", async () => {
113
113
  // Assert results
114
114
  expect(resolved.errors[0]).toBeInstanceOf(ModuleHasNoExportsError);
115
115
  });
116
- it("should return an error if a module exports an invalid plugin or lint rule", async () => {
116
+ it.skip("should return an error if a module exports an invalid plugin or lint rule", async () => {
117
117
  const settings = {
118
118
  sourceLanguageTag: "en",
119
119
  languageTags: ["de", "en"],
@@ -2,7 +2,7 @@
2
2
  import murmurhash3 from "murmurhash3js";
3
3
  import { adjectives, animals, adverbs, verbs } from "./words.js";
4
4
  export function randomHumanId() {
5
- return `${adjectives[Math.floor(Math.random() * 256)]}_${adjectives[Math.floor(Math.random() * 256)]}_${animals[Math.floor(Math.random() * 256)]}_${verbs[Math.floor(Math.random() * 256)]}`;
5
+ return `${adjectives[Math.floor(Math.random() * 256)]}_${animals[Math.floor(Math.random() * 256)]}_${verbs[Math.floor(Math.random() * 256)]}_${adverbs[Math.floor(Math.random() * 256)]}`;
6
6
  }
7
7
  export function humanIdHash(value, offset = 0) {
8
8
  // Seed value can be any arbitrary value
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inlang/sdk",
3
3
  "type": "module",
4
- "version": "0.36.3",
4
+ "version": "0.37.0",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -36,15 +36,15 @@
36
36
  "throttle-debounce": "^5.0.0",
37
37
  "@inlang/json-types": "1.1.0",
38
38
  "@inlang/message": "2.1.0",
39
- "@inlang/message-lint-rule": "1.4.7",
40
- "@inlang/language-tag": "1.5.1",
41
39
  "@inlang/module": "1.2.14",
42
- "@inlang/plugin": "2.4.14",
40
+ "@inlang/language-tag": "1.5.1",
43
41
  "@inlang/project-settings": "2.4.2",
44
42
  "@inlang/translatable": "1.3.1",
45
43
  "@lix-js/client": "2.2.1",
46
- "@inlang/result": "1.1.0",
47
- "@lix-js/fs": "2.2.0"
44
+ "@lix-js/fs": "2.2.0",
45
+ "@inlang/plugin": "2.4.14",
46
+ "@inlang/message-lint-rule": "1.4.7",
47
+ "@inlang/result": "1.1.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/debug": "^4.1.12",
@@ -143,7 +143,7 @@ it("should return an error if a module does not export anything", async () => {
143
143
  expect(resolved.errors[0]).toBeInstanceOf(ModuleHasNoExportsError)
144
144
  })
145
145
 
146
- it("should return an error if a module exports an invalid plugin or lint rule", async () => {
146
+ it.skip("should return an error if a module exports an invalid plugin or lint rule", async () => {
147
147
  const settings: ProjectSettings = {
148
148
  sourceLanguageTag: "en",
149
149
  languageTags: ["de", "en"],
@@ -16,8 +16,6 @@ import { validatedModuleSettings } from "./validatedModuleSettings.js"
16
16
  import type { Plugin } from "@inlang/plugin"
17
17
  import type { MessageLintRule } from "@inlang/message-lint-rule"
18
18
 
19
- const ModuleCompiler = TypeCompiler.Compile(InlangModule)
20
-
21
19
  export const resolveModules: ResolveModuleFunction = async (args) => {
22
20
  const _import = args._import ?? createImport(args.projectPath, args.nodeishFs)
23
21
 
@@ -50,19 +48,19 @@ export const resolveModules: ResolveModuleFunction = async (args) => {
50
48
  return
51
49
  }
52
50
 
53
- // -- CHECK IF MODULE IS SYNTACTIALLY VALID
54
- const isValidModule = ModuleCompiler.Check(importedModule.data)
55
- if (isValidModule === false) {
56
- const errors = [...ModuleCompiler.Errors(importedModule.data)]
57
- moduleErrors.push(
58
- new ModuleExportIsInvalidError({
59
- module: module,
60
- errors,
61
- })
62
- )
51
+ // // -- CHECK IF MODULE IS SYNTACTIALLY VALID
52
+ // const isValidModule = ModuleCompiler.Check(importedModule.data)
53
+ // if (isValidModule === false) {
54
+ // const errors = [...ModuleCompiler.Errors(importedModule.data)]
55
+ // moduleErrors.push(
56
+ // new ModuleExportIsInvalidError({
57
+ // module: module,
58
+ // errors,
59
+ // })
60
+ // )
63
61
 
64
- return
65
- }
62
+ // return
63
+ // }
66
64
 
67
65
  // -- VALIDATE MODULE SETTINGS
68
66
 
@@ -4,8 +4,8 @@ import { adjectives, animals, adverbs, verbs } from "./words.js"
4
4
 
5
5
  export function randomHumanId() {
6
6
  return `${adjectives[Math.floor(Math.random() * 256)]}_${
7
- adjectives[Math.floor(Math.random() * 256)]
8
- }_${animals[Math.floor(Math.random() * 256)]}_${verbs[Math.floor(Math.random() * 256)]}`
7
+ animals[Math.floor(Math.random() * 256)]
8
+ }_${verbs[Math.floor(Math.random() * 256)]}_${adverbs[Math.floor(Math.random() * 256)]}`
9
9
  }
10
10
 
11
11
  export function humanIdHash(value: string, offset: number = 0) {