Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@inlang/core

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inlang/core - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

dist/test/utils.d.ts

5

dist/ast/schema.d.ts

@@ -27,7 +27,4 @@ export type Language = string;

/**
* Metadata is ignored by inlang.
*
* Use the metadata property to store additional
* information for a particular node like parsing
* and serialization information.
* @deprecated Will be removed in the future, see https://github.com/inlang/inlang/issues/945.
*/

@@ -34,0 +31,0 @@ metadata?: any;

2

dist/config/parseConfig.js

@@ -40,3 +40,3 @@ var _ParseConfigException_id;

if (!config.readResources || !config.writeResources) {
throw new ParseConfigException(`It seems you didn't set up a plugin to handle Resource files. See https://github.com/inlang/ecosystem#resources.`);
throw new ParseConfigException(`It seems you didn't set up a plugin to handle Resource files. See https://inlang.com/documentation/plugins/registry.`);
}

@@ -43,0 +43,0 @@ }

@@ -55,2 +55,13 @@ //! DON'T TOP-LEVEL IMPORT ESBUILD PLUGINS. USE DYNAMIC IMPORTS.

ops.bundle = true;
//! Extremely important to set platform to neutral.
//!
//! Platform neutral ensures that the plugin is build as ESM
//! with strict EcmaScript semantics. No hacky workarounds,
//! no CommonJS, no NodeJS, no nothing. Pure EcmaScript.
//!
//! Pure ECMAScript is important to future proof the plugin
//! ecosystem and ease inlang's maintenance burden. Everything
//! else than pure ESM will die in the long run. We don't want to
//! take on technical debt now which we will have to MASSIVELY pay off
//! later.
ops.platform = "neutral";

@@ -57,0 +68,0 @@ ops.format = "esm";

@@ -23,11 +23,7 @@ import type { Message, Resource } from "../ast/index.js";

type: "Resource";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -38,11 +34,7 @@ name: string;

type: "Message";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -53,11 +45,7 @@ name: string;

type: "Pattern";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
elements: ((Record<string, unknown> & {
type: "Text";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -67,11 +55,7 @@ value: string;

type: "Placeholder";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
body: Record<string, unknown> & {
type: "VariableReference";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -91,11 +75,7 @@ name: string;

type: "Message";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -106,11 +86,7 @@ name: string;

type: "Pattern";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
elements: ((Record<string, unknown> & {
type: "Text";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -120,11 +96,7 @@ value: string;

type: "Placeholder";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
body: Record<string, unknown> & {
type: "VariableReference";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -143,11 +115,7 @@ name: string;

type: "Resource";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -158,11 +126,7 @@ name: string;

type: "Message";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -173,11 +137,7 @@ name: string;

type: "Pattern";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
elements: ((Record<string, unknown> & {
type: "Text";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -187,11 +147,7 @@ value: string;

type: "Placeholder";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
body: Record<string, unknown> & {
type: "VariableReference";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -209,11 +165,7 @@ name: string;

type: "Resource";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -224,11 +176,7 @@ name: string;

type: "Message";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -239,11 +187,7 @@ name: string;

type: "Pattern";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
elements: ((Record<string, unknown> & {
type: "Text";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -253,11 +197,7 @@ value: string;

type: "Placeholder";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
body: Record<string, unknown> & {
type: "VariableReference";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -277,11 +217,7 @@ name: string;

type: "Resource";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -292,11 +228,7 @@ name: string;

type: "Message";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -307,11 +239,7 @@ name: string;

type: "Pattern";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
elements: ((Record<string, unknown> & {
type: "Text";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -321,11 +249,7 @@ value: string;

type: "Placeholder";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {
body: Record<string, unknown> & {
type: "VariableReference";
metadata?: any; /**
* Included message ids in a resource.
*/
metadata?: any;
} & {

@@ -332,0 +256,0 @@ name: string;

export { testConfig, TestConfigException } from "./testConfig.js";
export { testConfigFile } from "./testConfigFile.js";
export { mockEnvironment, copyDirectory } from "./mockEnvironment.js";
export { createMessage, createResource } from "./utils.js";
//# sourceMappingURL=index.d.ts.map
export { testConfig, TestConfigException } from "./testConfig.js";
export { testConfigFile } from "./testConfigFile.js";
export { mockEnvironment, copyDirectory } from "./mockEnvironment.js";
export { createMessage, createResource } from "./utils.js";
{
"name": "@inlang/core",
"type": "module",
"version": "0.9.1",
"version": "0.9.2",
"publishConfig": {

@@ -6,0 +6,0 @@ "access": "public"

@@ -44,7 +44,4 @@ // inspired by (https://github.com/unicode-org/message-format-wg/blob/main/spec/syntax.md)

/**
* Metadata is ignored by inlang.
*
* Use the metadata property to store additional
* information for a particular node like parsing
* and serialization information.
* @deprecated Will be removed in the future, see https://github.com/inlang/inlang/issues/945.
*/

@@ -51,0 +48,0 @@ metadata?: any

@@ -8,2 +8,3 @@ import type * as ast from "@inlang/core/ast"

import { mockEnvironment } from "../test/mockEnvironment.js"
import { createResource } from '../test/utils.js'

@@ -149,10 +150,3 @@ it("should succeed if the config is valid", async () => {

): ast.Resource {
return {
type: "Resource",
languageTag: {
type: "LanguageTag",
name: language,
},
body: Object.entries(flatJson).map(([id, value]) => parseMessage(id, value)),
}
return createResource(language, ...Object.entries(flatJson).map(([id, value]) => parseMessage(id, value)))
}

@@ -159,0 +153,0 @@

@@ -43,3 +43,3 @@ import type { InlangConfig } from "./schema.js"

throw new ParseConfigException(
`It seems you didn't set up a plugin to handle Resource files. See https://github.com/inlang/ecosystem#resources.`,
`It seems you didn't set up a plugin to handle Resource files. See https://inlang.com/documentation/plugins/registry.`,
)

@@ -46,0 +46,0 @@ }

import { it, expect, vi } from "vitest"
import { setupConfig } from "./setupConfig.js"
import { createResource } from '../test/utils.js'

@@ -8,6 +9,3 @@ it("should setup the config with plugins", async () => {

defineConfig: async () => ({
readResources: async () => [
{ type: "Resource", languageTag: { type: "LanguageTag", name: "en" }, body: [] },
{ type: "Resource", languageTag: { type: "LanguageTag", name: "de" }, body: [] },
],
readResources: async () => [createResource('en'), createResource('de'),],
writeResources: async () => undefined,

@@ -38,6 +36,3 @@ plugins: [

defineConfig: async () => ({
readResources: async () => [
{ type: "Resource", languageTag: { type: "LanguageTag", name: "en" }, body: [] },
{ type: "Resource", languageTag: { type: "LanguageTag", name: "de" }, body: [] },
],
readResources: async () => [createResource('en'), createResource('de'),],
writeResources: async () => undefined,

@@ -110,6 +105,3 @@ someProperty: "someValue",

languages: ["de", "en"],
readResources: async () => [
{ type: "Resource", languageTag: { type: "LanguageTag", name: "en" }, body: [] },
{ type: "Resource", languageTag: { type: "LanguageTag", name: "de" }, body: [] },
],
readResources: async () => [createResource('en'), createResource('de'),],
writeResources: async () => undefined,

@@ -116,0 +108,0 @@ plugins: [

import { beforeEach, describe, expect, MockContext, test, vi } from "vitest"
import type { Language, Message, Resource } from "@inlang/core/ast"
import type { Resource } from "@inlang/core/ast"
import { lint } from "./linter.js"
import type { LintRule } from "./rule.js"
import { createLintRule } from "./createLintRule.js"
import { createMessage, createResource } from '../test/utils.js'

@@ -21,22 +22,2 @@ vi.spyOn(console, "info").mockImplementation(vi.fn)

const createResource = (language: Language, ...messages: Message[]) =>
({
type: "Resource",
languageTag: {
type: "LanguageTag",
name: language,
},
body: messages,
} satisfies Resource)
const createMessage = (id: string, pattern: string) =>
({
type: "Message",
id: { type: "Identifier", name: id },
pattern: {
type: "Pattern",
elements: [{ type: "Text", value: pattern }],
},
} satisfies Message)
// --------------------------------------------------------------------------------------------------------------------

@@ -43,0 +24,0 @@

@@ -77,3 +77,3 @@ ---

There exist some lint rules you can use to check your `Resources` against. You can find them [here](https://github.com/inlang/ecosystem). Or you can write your own rules.
There exist some lint rules you can use to check your `Resources` against. You can find them [here](/documentation/plugins/registry). Or you can write your own rules.

@@ -80,0 +80,0 @@ ### Creating your own lint rule

@@ -67,2 +67,13 @@ import type { BuildOptions } from "esbuild"

ops.bundle = true
//! Extremely important to set platform to neutral.
//!
//! Platform neutral ensures that the plugin is build as ESM
//! with strict EcmaScript semantics. No hacky workarounds,
//! no CommonJS, no NodeJS, no nothing. Pure EcmaScript.
//!
//! Pure ECMAScript is important to future proof the plugin
//! ecosystem and ease inlang's maintenance burden. Everything
//! else than pure ESM will die in the long run. We don't want to
//! take on technical debt now which we will have to MASSIVELY pay off
//! later.
ops.platform = "neutral"

@@ -69,0 +80,0 @@ ops.format = "esm"

import { describe, expect, it } from "vitest"
import type { Resource } from "../ast/index.js"
import { query } from "./index.js"
import { createMessage, createResource } from '../test/utils.js'

@@ -133,26 +134,5 @@ describe("query.create", () => {

const mockResource: Resource = {
type: "Resource",
languageTag: {
type: "LanguageTag",
name: "en",
},
body: [
{
type: "Message",
id: { type: "Identifier", name: "first-message" },
pattern: {
type: "Pattern",
elements: [{ type: "Text", value: "Welcome to this app." }],
},
},
{
type: "Message",
id: { type: "Identifier", name: "second-message" },
pattern: {
type: "Pattern",
elements: [{ type: "Text", value: "You opened the app, congrats!" }],
},
},
],
}
const mockResource: Resource = createResource('en',
createMessage('first-message', "Welcome to this app."),
createMessage('second-message', "You opened the app, congrats!"),
)
export { testConfig, TestConfigException } from "./testConfig.js"
export { testConfigFile } from "./testConfigFile.js"
export { mockEnvironment, copyDirectory } from "./mockEnvironment.js"
export { createMessage, createResource } from "./utils.js"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc