@inlang/sdk 0.1.0 → 0.2.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/README.md CHANGED
@@ -2,24 +2,15 @@ Developer-first localization infrastructure that is built on git. Your git repos
2
2
 
3
3
  <div>
4
4
  <p align="center">
5
- <img width="300" src="https://cdn.jsdelivr.net/gh/inlang/inlang/assets/logo-white-background.png"/>
5
+ <img width="300" src="https://cdn.jsdelivr.net/gh/inlang/monorepo/inlang/assets/logo-white-background.png"/>
6
6
  </p>
7
7
  <h4 align="center">
8
8
  <!-- <a href="https://inlang.com/documentation" target="_blank">Get Started</a>
9
9
  · -->
10
- <a href="https://github.com/inlang/inlang/discussions" target="_blank">Discussions</a> · <a href="https://twitter.com/inlangHQ" target="_blank">Twitter</a>
10
+ <a href="https://github.com/inlang/monorepo/discussions" target="_blank">Discussions</a> · <a href="https://twitter.com/inlangHQ" target="_blank">Twitter</a>
11
11
  </h4>
12
12
  </div>
13
13
 
14
- # @inlang/core
14
+ # @inlang/sdk
15
15
 
16
- The core module bundles "core" modules that depend on each other and is everything one needs to build [plugins](https://inlang.com/documentation/plugins) or entire [apps](https://inlang.com/documentation/build-on-inlang) on inlang.
17
-
18
- ## Modules
19
-
20
- Click on the modules to get to their respective READMEs.
21
-
22
- - [@inlang/core/ast](https://github.com/inlang/inlang/tree/main/source-code/core/src/ast/) - The AST.
23
- - [@inlang/core/config](https://github.com/inlang/inlang/tree/main/source-code/core/src/config/) - The config that powers inlang.
24
- - [@inlang/core/query](https://github.com/inlang/inlang/tree/main/source-code/core/src/query/) - A query module for the AST.
25
- - [@inlang/core/utilities](https://github.com/inlang/inlang/tree/main/source-code/core/src/utilities/) - Utility types, functions, and more dealing that ease interactions with inlang, i18n, and localization.
16
+ The core module bundles "sdk" modules that depend on each other and is everything one needs to build [plugins](https://inlang.com/documentation/plugin) or entire [apps](https://inlang.com/documentation/develop-app) on inlang.
@@ -104,10 +104,9 @@ const matchMostSpecificVariant = (message, languageTag, selectors) => {
104
104
  // resolve preferenceSelectors to match length and order of message selectors
105
105
  const resolvedSelectors = resolveSelector(message.selectors, selectors);
106
106
  const index = {};
107
- const languageVariants = message.variants.filter((variant) => variant.languageTag === languageTag);
108
- if (languageVariants.length === 0)
109
- return undefined;
110
- for (const variant of languageVariants) {
107
+ for (const variant of message.variants) {
108
+ if (variant.languageTag !== languageTag)
109
+ continue;
111
110
  let isMatch = true;
112
111
  //check if variant is a match
113
112
  for (const [key, value] of Object.entries(variant.match)) {
@@ -98,7 +98,7 @@ export const openInlangProject = async (args) => {
98
98
  meta: rule.meta,
99
99
  module: resolvedModules()?.meta.find((m) => m.id.includes(rule.meta.id))?.module ??
100
100
  "Unknown module. You stumbled on a bug in inlang's source code. Please open an issue.",
101
- // default to warning, see https://github.com/inlang/inlang/issues/1254
101
+ // default to warning, see https://github.com/inlang/monorepo/issues/1254
102
102
  lintLevel: configValue.settings["project.messageLintRuleLevels"]?.[rule.meta.id] ?? "warning",
103
103
  }));
104
104
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inlang/sdk",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -45,7 +45,6 @@
45
45
  "ts-dedent": "2.2.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@placeholder-company/js-code-style": "*",
49
48
  "@lix-js/fs": "*",
50
49
  "@types/throttle-debounce": "5.0.0",
51
50
  "@vitest/coverage-v8": "^0.33.0",
@@ -154,10 +154,9 @@ const matchMostSpecificVariant = (
154
154
  const resolvedSelectors = resolveSelector(message.selectors, selectors)
155
155
  const index: Record<string, any> = {}
156
156
 
157
- const languageVariants = message.variants.filter((variant) => variant.languageTag === languageTag)
158
- if (languageVariants.length === 0) return undefined
157
+ for (const variant of message.variants) {
158
+ if (variant.languageTag !== languageTag) continue
159
159
 
160
- for (const variant of languageVariants) {
161
160
  let isMatch = true
162
161
 
163
162
  //check if variant is a match
@@ -146,7 +146,7 @@ export const openInlangProject = async (args: {
146
146
  resolvedModules()?.meta.find((m) => m.id.includes(rule.meta.id))?.module ??
147
147
  "Unknown module. You stumbled on a bug in inlang's source code. Please open an issue.",
148
148
 
149
- // default to warning, see https://github.com/inlang/inlang/issues/1254
149
+ // default to warning, see https://github.com/inlang/monorepo/issues/1254
150
150
  lintLevel:
151
151
  configValue.settings["project.messageLintRuleLevels"]?.[rule.meta.id] ?? "warning",
152
152
  } satisfies InstalledMessageLintRule),