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

@inlang/core

Package Overview
Dependencies
Maintainers
1
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.3.1 to 0.4.0

dist/ast/index.js.map

1

dist/ast/index.js
export * from "./schema.js";
//# sourceMappingURL=index.js.map

44

dist/ast/schema.d.ts

@@ -0,7 +1,24 @@

export type NodeName = "Identifier" | "Resource" | "Message" | "Pattern" | "Text" | "LanguageTag";
/**
* A utility type to extend any node with a new property.
* Does this recursively for all child nodes.
*
* @example attach a verified property to all nodes
* ```
* type VerifiedResource = Resource<{ verified: boolean }>
* ```
* @example attach a verified property only to the Message node
* ```
* type ResourceWithVerifiedMessages = Resource<{ Message: { verified: boolean } }>
* ```
*/
type ExtensionInformation = {
[node in NodeName | "Node"]?: Record<string, unknown>;
};
/**
* A single node of the AST.
*
* Every other defintions are based on Node.
* Every other definitions are based on Node.
*/
export type Node<Name> = {
type Node<Name extends NodeName, Extension extends ExtensionInformation = ExtensionInformation> = Extension[Name] & Extension["Node"] & {
type: Name;

@@ -22,3 +39,3 @@ /**

*/
export type Identifier = Node<"Identifier"> & {
export type Identifier<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Identifier", Extension> & {
name: string;

@@ -29,5 +46,5 @@ };

*/
export type Resource = Node<"Resource"> & {
languageTag: LanguageTag;
body: Array<Message>;
export type Resource<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Resource", Extension> & {
languageTag: LanguageTag<Extension>;
body: Array<Message<Extension>>;
};

@@ -37,5 +54,5 @@ /**

*/
export type Message = Node<"Message"> & {
id: Identifier;
pattern: Pattern;
export type Message<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Message", Extension> & {
id: Identifier<Extension>;
pattern: Pattern<Extension>;
};

@@ -45,4 +62,4 @@ /**

*/
export type Pattern = Node<"Pattern"> & {
elements: Array<Text>;
export type Pattern<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Pattern", Extension> & {
elements: Array<Text<Extension>>;
};

@@ -52,3 +69,3 @@ /**

*/
export type Text = Node<"Text"> & {
export type Text<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Text", Extension> & {
value: string;

@@ -63,3 +80,3 @@ };

*/
export type LanguageTag = Node<"LanguageTag"> & {
export type LanguageTag<Extension extends ExtensionInformation = ExtensionInformation> = Node<"LanguageTag", Extension> & {
/**

@@ -70,1 +87,2 @@ * The ID of the language.

};
export {};

@@ -31,1 +31,2 @@ export {};

// };
//# sourceMappingURL=schema.js.map

@@ -1,2 +0,2 @@

import type { fs } from "memfs";
import type { FS } from "../../fs/index.js";
/**

@@ -16,18 +16,15 @@ * Importing ES modules either from a local path, or from a url.

* @example
* const $import = createImportFunction({ basePath: '/', fs: fs.promises });
* const module = await $import('./mock-module.js');
* const $import = initialize$import({ fs: fs.promises, fetch });
* const module = await $import('./some-module.js');
*/
export declare function initialize$import(args: {
/**
* The path from which the import should be resolved.
* Directory from which the import should be resolved. Be careful, as the working directory of the fs is not changed!
*
* ! Be careful when using this argument, as it can lead to unexpected behavior.
* The working directory for fs is not changed!
*
* @deprecated only use when you absolutely need to (for example in testing). Will likely be removed in the future.
*
* @deprecated, because it can lead to unintended side effects. Use only for testings. Likely to be removed in the future.
*/
workingDirectory?: string;
/** the fs from which the file can be read */
fs: typeof fs.promises;
fs: FS;
/** http client implementation */
fetch: typeof fetch;

@@ -48,6 +45,6 @@ }): (uri: string) => ReturnType<typeof $import>;

/** the fs from which the file can be read */
fs: typeof fs.promises;
/** the http client (avoiding side-effects) */
fs: FS;
/** http client implementation */
fetch: typeof fetch;
}): Promise<any>;
export {};

@@ -5,4 +5,4 @@ /**

* @example
* const $import = createImportFunction({ basePath: '/', fs: fs.promises });
* const module = await $import('./mock-module.js');
* const $import = initialize$import({ fs: fs.promises, fetch });
* const module = await $import('./some-module.js');
*/

@@ -33,1 +33,2 @@ export function initialize$import(args) {

}
//# sourceMappingURL=$import.js.map
export { initialize$import, type $import } from "./$import.js";
export { $fs } from "./$fs.js";
export { initialize$import } from "./$import.js";
export {} from "./$fs.js";
//# sourceMappingURL=index.js.map
export * from "./schema.js";
export * from "./environment-functions/index.js";
//# sourceMappingURL=index.js.map
import type * as ast from "../ast/index.js";
import type { $fs, $import } from "./environment-functions/index.js";
import type { FS } from "../fs/index.js";
import type { LintRule } from "../lint/rule.js";
import type { $import } from "./environment-functions/index.js";
/**

@@ -9,3 +11,3 @@ * The environment functions.

export type EnvironmentFunctions = {
$fs: $fs;
$fs: FS;
$import: $import;

@@ -28,11 +30,16 @@ };

*
* The language must be an ISO-639-1 string. See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.
* In most cases, the reference lanugage is `en` (English).
* The languages can be named freely. It's adviceable to follow the IETF BCP 47 language tag scheme.
* In most cases, the reference lanugage is `en-US` (American English).
*
* @see https://www.ietf.org/rfc/bcp/bcp47.txt
* @see https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
*/
referenceLanguage: string;
/**
* Languages of this project.
* Available languages in this project.
*
* The language must be an ISO-639-1 string and include the reference language itself.
* See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.
* The languages can be named freely. It's adviceable to follow the IETF BCP 47 language tag scheme.
*
* @see https://www.ietf.org/rfc/bcp/bcp47.txt
* @see https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
*/

@@ -47,2 +54,54 @@ languages: string[];

}) => Promise<void>;
lint?: {
rules: (LintRule | LintRule[])[];
};
/**
* WARNING: Experimental properties are not required,
* can change at any time and do not lead to a MAJOR version bump.
*
* Read more under https://inlang.com/documentation/breaking-changes
*/
experimental?: object;
ideExtension?: {
/**
* Defines matchers for message references inside the code.
*
* @param args represents the data to conduct the search on
* @returns a promise with matched message references
*/
messageReferenceMatchers: ((args: {
documentText: string;
}) => Promise<Array<{
/**
* The messages id.
*/
messageId: string;
/**
* The position from where to where the reference can be found.
*/
position: {
start: {
line: number;
character: number;
};
end: {
line: number;
character: number;
};
};
}>>)[];
/**
* Defines the options to extract messages.
*/
extractMessageOptions: {
/**
* Function which is called, when the user finished the message extraction command.
*
* @param messageId is the message identifier entered by the user
* @param selection is the text which was extracted
* @returns the code which is inserted into the document
*/
callback: (messageId: string, selection: string) => string;
}[];
};
};
export {};
//# sourceMappingURL=schema.js.map
import type { Message, Resource } from "../ast/index.js";
import { Result } from "@inlang/core/utilities";
import { Result } from "../utilities/index.js";
/**

@@ -21,3 +21,35 @@ * Query a resource.

*/
create: (args: Parameters<typeof create>[1]) => Result<Resource, Error>;
create: (args: Parameters<typeof create>[1]) => Result<Record<string, unknown> & {
type: "Resource";
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any;
} & {
name: string;
};
body: (Record<string, unknown> & {
type: "Message";
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any;
} & {
name: string;
};
pattern: Record<string, unknown> & {
type: "Pattern";
metadata?: any;
} & {
elements: (Record<string, unknown> & {
type: "Text";
metadata?: any;
} & {
value: string;
})[];
};
})[];
}, Error>;
/**

@@ -28,3 +60,24 @@ * Get a message.

*/
get: (args: Parameters<typeof get>[1]) => Message | undefined;
get: (args: Parameters<typeof get>[1]) => (Record<string, unknown> & {
type: "Message";
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any;
} & {
name: string;
};
pattern: Record<string, unknown> & {
type: "Pattern";
metadata?: any;
} & {
elements: (Record<string, unknown> & {
type: "Text";
metadata?: any;
} & {
value: string;
})[];
};
}) | undefined;
/**

@@ -35,7 +88,71 @@ * Updates a message.

*/
update: (args: Parameters<typeof update>[1]) => Result<Resource, Error>;
update: (args: Parameters<typeof update>[1]) => Result<Record<string, unknown> & {
type: "Resource";
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any;
} & {
name: string;
};
body: (Record<string, unknown> & {
type: "Message";
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any;
} & {
name: string;
};
pattern: Record<string, unknown> & {
type: "Pattern";
metadata?: any;
} & {
elements: (Record<string, unknown> & {
type: "Text";
metadata?: any;
} & {
value: string;
})[];
};
})[];
}, Error>;
/**
* Upserts a message.
*/
upsert: (args: Parameters<typeof upsert>[1]) => Result<Resource, Error>;
upsert: (args: Parameters<typeof upsert>[1]) => Result<Record<string, unknown> & {
type: "Resource";
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any;
} & {
name: string;
};
body: (Record<string, unknown> & {
type: "Message";
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any;
} & {
name: string;
};
pattern: Record<string, unknown> & {
type: "Pattern";
metadata?: any;
} & {
elements: (Record<string, unknown> & {
type: "Text";
metadata?: any;
} & {
value: string;
})[];
};
})[];
}, Error>;
/**

@@ -46,3 +163,35 @@ * Delete a message.

*/
delete: (args: Parameters<typeof get>[1]) => Result<Resource, Error>;
delete: (args: Parameters<typeof get>[1]) => Result<Record<string, unknown> & {
type: "Resource";
metadata?: any;
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any;
} & {
name: string;
};
body: (Record<string, unknown> & {
type: "Message";
metadata?: any;
} & {
id: Record<string, unknown> & {
type: "Identifier";
metadata?: any;
} & {
name: string;
};
pattern: Record<string, unknown> & {
type: "Pattern";
metadata?: any;
} & {
elements: (Record<string, unknown> & {
type: "Text";
metadata?: any;
} & {
value: string;
})[];
};
})[];
}, Error>;
/**

@@ -49,0 +198,0 @@ * Included message ids in a resource.

@@ -1,2 +0,2 @@

import { Result } from "@inlang/core/utilities";
import { Result } from "../utilities/index.js";
/**

@@ -112,1 +112,2 @@ * Query a resource.

}
//# sourceMappingURL=index.js.map
export * from "./result.js";
//# sourceMappingURL=index.js.map

@@ -79,1 +79,2 @@ /* eslint-disable unicorn/no-abusive-eslint-disable */

})(Result = Result || (Result = {}));
//# sourceMappingURL=result.js.map
{
"name": "@inlang/core",
"type": "module",
"version": "0.3.1",
"private": false,
"version": "0.4.0",
"publishConfig": {

@@ -18,2 +17,6 @@ "access": "public"

},
"./fs": {
"types": "./dist/fs/index.d.ts",
"import": "./dist/fs/index.js"
},
"./query": {

@@ -33,11 +36,15 @@ "types": "./dist/query/index.d.ts",

"build": "tsc --build ./tsconfig.build.json",
"dev": "tsc --watch",
"test": "vitest run --passWithNoTests --coverage",
"dev": "npm run tsc:watch",
"test": "tsc && vitest",
"tsc": "tsc --noEmit",
"tsc:watch": "tsc --noEmit --watch",
"vitest": "vitest run --passWithNoTests --coverage",
"vitest:watch": "vitest watch --passWithNoTests --coverage",
"format": "prettier ./src/** -w --config ../../.prettierrc.json",
"clean": "rm -r -f ./dist ./.turbo ./coverage ./node_modules"
},
"dependencies": {},
"devDependencies": {
"memfs": "^3.4.11"
"memfs": "^3.4.11",
"tsd": "^0.25.0"
}
}

@@ -8,3 +8,3 @@ Developer-first localization infrastructure that is built on git. Your git repository is the single source of truth for localization for collaboration and automation.

<h4 align="center">
<!-- <a href="https://inlang.dev/docs/getting-started" target="_blank">Get Started</a>
<!-- <a href="https://inlang.com/documentation" target="_blank">Get Started</a>
· -->

@@ -11,0 +11,0 @@ <a href="https://github.com/inlang/inlang/discussions" target="_blank">Discussions</a> · <a href="https://twitter.com/inlangHQ" target="_blank">Twitter</a>

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