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.5.5 to 0.6.0

dist/ast/index.d.ts.map

1

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

10

dist/ast/schema.d.ts
export type Language = string;
export type NodeName = "Identifier" | "Resource" | "Message" | "Pattern" | "Text" | "LanguageTag" | "Placeholder" | "Expression" | "Variable";
export type NodeName = "Identifier" | "Resource" | "Message" | "Pattern" | "Text" | "LanguageTag" | "Placeholder" | "VariableReference";
/**

@@ -70,8 +70,5 @@ * A utility type to extend any node with a new property.

export type Placeholder<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Placeholder", Extension> & {
placeholder: Expression<Extension>;
body: VariableReference<Extension>;
};
export type Expression<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Expression", Extension> & {
expression: Variable<Extension>;
};
export type Variable<Extension extends ExtensionInformation = ExtensionInformation> = Node<"Variable", Extension> & {
export type VariableReference<Extension extends ExtensionInformation = ExtensionInformation> = Node<"VariableReference", Extension> & {
name: string;

@@ -93,1 +90,2 @@ };

export {};
//# sourceMappingURL=schema.d.ts.map

@@ -155,1 +155,2 @@ import { z } from "zod";

}>;
//# sourceMappingURL=zod.d.ts.map

@@ -1,18 +0,12 @@

import type { fs as memfs } from "memfs";
import type { NodeishFilesystem } from "@inlang-git/fs";
/**
* ! IF YOU DO CHANGES TO THIS FILE,
* ! CONTACT @samuelstroschein BEFORE.
*/
/**
* Minimal filesystem required by inlang.
* Minimal filesystem provided by inlang.
*
* Uses memfs under the hood for now. To avoid
* type issues, use memfs or node:fs/promises
* with @ts-ignore.
* $fs is a subset of `@inlang-git/fs`. The subset ensures
* that the filesystem API is supported across all environments
* (node, browser, etc).
*
* If you are missing a method, please open an issue on github.
*/
export type $fs = {
readFile: (...args: Parameters<typeof memfs.promises.readFile>) => ReturnType<typeof memfs.promises.readFile>;
writeFile: (...args: Parameters<typeof memfs.promises.writeFile>) => ReturnType<typeof memfs.promises.writeFile>;
readdir: (...args: Parameters<typeof memfs.promises.readdir>) => ReturnType<typeof memfs.promises.readdir>;
mkdir: (...args: Parameters<typeof memfs.promises.mkdir>) => ReturnType<typeof memfs.promises.mkdir>;
};
export type $fs = Pick<NodeishFilesystem, "readdir" | "mkdir" | "writeFile" | "readFile">;
//# sourceMappingURL=$fs.d.ts.map

@@ -41,1 +41,2 @@ /**

export {};
//# sourceMappingURL=$import.d.ts.map

@@ -16,3 +16,4 @@ /**

// when hovering over the type.
import dedent from "dedent";
import { dedent } from "ts-dedent";
import { normalizePath } from "@inlang-git/fs";
/**

@@ -75,30 +76,1 @@ * Initializes the $import function.

}
/*
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/
function normalizePath(path) {
if (typeof path !== "string") {
throw new TypeError("expected path to be a string");
}
if (path === "\\" || path === "/")
return "/";
const len = path.length;
if (len <= 1)
return path;
// ensure that win32 namespaces has two leading slashes, so that the path is
// handled properly by the win32 version of path.parse() after being normalized
// https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
let prefix = "";
if (len > 4 && path[3] === "\\") {
const ch = path[2];
if ((ch === "?" || ch === ".") && path.slice(0, 2) === "\\\\") {
path = path.slice(2);
prefix = "//";
}
}
const segs = path.split(/[/\\]+/);
return prefix + segs.join("/");
}

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

export { Config, EnvironmentFunctions, DefineConfig } from "./schema.js";
export type { Config, EnvironmentFunctions, DefineConfig } from "./schema.js";
export type { $fs } from "./environment-functions/$fs.js";
export type { $import } from "./environment-functions/$import.js";
export { initialize$import } from "./environment-functions/$import.js";
//# sourceMappingURL=index.d.ts.map

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

export {} from "./schema.js";
export { initialize$import } from "./environment-functions/$import.js";

@@ -6,2 +6,3 @@ import type { Language } from "../ast/index.js";

import type { $import } from "./environment-functions/$import.js";
import type { SdkConfig } from './_sdk.js';
/**

@@ -106,2 +107,4 @@ * The environment functions.

};
sdk?: SdkConfig;
};
//# sourceMappingURL=schema.d.ts.map

@@ -229,1 +229,2 @@ import { z } from "zod";

}>;
//# sourceMappingURL=zod.d.ts.map

@@ -38,1 +38,2 @@ import type { LintRule } from "./rule.js";

export {};
//# sourceMappingURL=createLintRule.d.ts.map

@@ -5,1 +5,2 @@ export type { LintRule, LintedResource, LintReport, LintedMessage, LintedNode } from "./rule.js";

export { lint } from "./linter.js";
//# sourceMappingURL=index.d.ts.map

@@ -49,1 +49,2 @@ import type { Config } from "@inlang/core/config";

}[], errors?: Error[] | undefined]>;
//# sourceMappingURL=linter.d.ts.map
import type { LintedResource, LintReport } from "./rule.js";
export declare const print: (resource: LintedResource) => void;
export declare const printReport: (report: LintReport, methodOverride?: "info" | "warn" | "error") => void;
//# sourceMappingURL=output.d.ts.map

@@ -32,1 +32,2 @@ import type { LintedNode, LintReport, LintRule } from "./rule.js";

}) => boolean;
//# sourceMappingURL=query.d.ts.map

@@ -12,1 +12,2 @@ import type { LintableNode, LintRule } from "./rule.js";

}) => void;
//# sourceMappingURL=report.d.ts.map

@@ -57,1 +57,2 @@ import type { Config } from "../config/index.js";

export {};
//# sourceMappingURL=rule.d.ts.map

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

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

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

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

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

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

@@ -55,14 +67,13 @@ value: string;

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

@@ -80,7 +91,11 @@ }))[];

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

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

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

@@ -101,14 +120,13 @@ value: string;

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

@@ -125,7 +143,11 @@ }))[];

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

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

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

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

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

@@ -157,14 +187,13 @@ value: string;

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

@@ -178,9 +207,13 @@ }))[];

*/
upsert: (args: Parameters<typeof upsert>[1]) => Record<string, unknown> & {
upsert: (args: Parameters<typeof upsert>[1]) => Result<Record<string, unknown> & {
type: "Resource";
metadata?: any;
metadata?: any; /**
* Included message ids in a resource.
*/
} & {
languageTag: Record<string, unknown> & {
type: "LanguageTag";
metadata?: any;
metadata?: any; /**
* Included message ids in a resource.
*/
} & {

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

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

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

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

@@ -212,14 +253,13 @@ value: string;

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

@@ -229,3 +269,3 @@ }))[];

})[];
};
}, Error>;
/**

@@ -238,7 +278,11 @@ * Delete a message.

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

@@ -249,7 +293,11 @@ name: string;

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

@@ -260,7 +308,11 @@ name: string;

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

@@ -270,14 +322,13 @@ value: string;

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

@@ -302,3 +353,3 @@ }))[];

message: Message;
}): Resource;
}): Result<Resource, Error>;
declare function get(resource: Resource, args: {

@@ -316,1 +367,2 @@ id: Message["id"]["name"];

export {};
//# sourceMappingURL=index.d.ts.map

@@ -79,6 +79,8 @@ var _MessageAlreadyExistsException_id, _MessageDoesNotExistsException_id;

if (exception) {
// should throw because internal error that should never happen
throw Error("Message from an update is undefined. Even though an if statement checked is the message existed. This is an internal bug in inlang.", { cause: exception });
return [
undefined,
Error("Message from an update is undefined. Even though an if statement checked is the message existed. This is an internal bug in inlang.", { cause: exception }),
];
}
return updatedResource;
return [updatedResource, undefined];
}

@@ -90,3 +92,3 @@ const [updatedResource, exception] = create(resource, args);

}
return updatedResource;
return [updatedResource, undefined];
}

@@ -93,0 +95,0 @@ function get(resource, args) {

export { validateConfig, ValidateConfigException } from "./validateConfig.js";
export { validateConfigFile } from "./validateConfigFile.js";
export { mockEnvironment } from "./mockEnvironment.js";
//# sourceMappingURL=index.d.ts.map

@@ -18,1 +18,2 @@ import { EnvironmentFunctions } from "../config/index.js";

}): Promise<EnvironmentFunctions>;
//# sourceMappingURL=mockEnvironment.d.ts.map
import { initialize$import } from "../config/index.js";
import { Volume } from "memfs";
import dedent from "dedent";
import { createMemoryFs, normalizePath } from "@inlang-git/fs";
import { dedent } from "ts-dedent";
/**

@@ -15,3 +15,3 @@ * Initializes a mock environment.

export async function mockEnvironment(args) {
const $fs = Volume.fromJSON({}).promises;
const $fs = createMemoryFs();
const $import = initialize$import({

@@ -45,3 +45,3 @@ fs: $fs,

Solution: Make sure that the \`copyDirectory.path\` is relative to the current working directory ${process.cwd()}.
Solution: Make sure that the \`copyDirectory.path\` is relative to the current working directory.

@@ -55,16 +55,9 @@ Context: The path is relative to the current working directory, not the file that calls \`mockEnvironment\`.

for (const subpath of pathsInDirectory) {
let isFile = true;
// check if the path is a file
const path = normalizePath(`${args.path}/${subpath}`);
try {
await args.copyFrom.readFile(path);
}
catch {
isFile = false;
}
if (isFile) {
const file = await args.copyFrom.readFile(path, { encoding: "utf-8" });
await args.copyTo.writeFile(path, file);
}
else {
catch (err) {
await copyDirectory({ ...args, path });

@@ -74,27 +67,1 @@ }

}
/*
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/
function normalizePath(path) {
if (path === "\\" || path === "/")
return "/";
const len = path.length;
if (len <= 1)
return path;
// ensure that win32 namespaces has two leading slashes, so that the path is
// handled properly by the win32 version of path.parse() after being normalized
// https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
let prefix = "";
if (len > 4 && path[3] === "\\") {
const ch = path[2];
if ((ch === "?" || ch === ".") && path.slice(0, 2) === "\\\\") {
path = path.slice(2);
prefix = "//";
}
}
const segs = path.split(/[/\\]+/);
return prefix + segs.join("/");
}

@@ -18,1 +18,2 @@ import type { Config } from "../config/schema.js";

}): Promise<Result<true, ValidateConfigException>>;
//# sourceMappingURL=validateConfig.d.ts.map

@@ -17,1 +17,2 @@ import type { EnvironmentFunctions } from "../config/schema.js";

}): Promise<Result<true, ValidateConfigException>>;
//# sourceMappingURL=validateConfigFile.d.ts.map
export { Result } from "./result.js";
export { pluginBuildConfig } from "./pluginBuildConfig.js";
//# sourceMappingURL=index.d.ts.map

@@ -19,1 +19,2 @@ import type { BuildOptions } from "esbuild";

export {};
//# sourceMappingURL=pluginBuildConfig.d.ts.map

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

import dedent from "dedent";
import { dedent } from "ts-dedent";
//! DON'T TOP-LEVEL IMPORT ESBUILD PLUGINS. USE DYNAMIC IMPORTS.

@@ -63,5 +63,5 @@ //! See https://github.com/inlang/inlang/issues/486

ops.plugins.push(
// @ts-expect-error
// @ts-expect-error - esbuild plugins have a wrong type
NodeModulesPolyfillPlugin());
return ops;
}

@@ -5,1 +5,2 @@ export type NonNullish = Exclude<{}, null>;

export type Result<Data extends NonNullish, Exception extends NonNullish> = SuccessResult<Data> | ExceptionResult<Exception>;
//# sourceMappingURL=result.d.ts.map
{
"name": "@inlang/core",
"type": "module",
"version": "0.5.5",
"version": "0.6.0",
"publishConfig": {

@@ -17,3 +17,4 @@ "access": "public"

"files": [
"./dist"
"./dist",
"./src"
],

@@ -39,3 +40,4 @@ "scripts": {

"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"dedent": "^0.7.0",
"@inlang-git/fs": "*",
"ts-dedent": "^2.2.0",
"zod": "^3.21.4"

@@ -45,5 +47,4 @@ },

"esbuild": "^0.17.14",
"memfs": "^3.4.13",
"tsd": "^0.25.0"
}
}
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