@inlang/core
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -46,2 +46,3 @@ import { PluginSetupError } from "./errors/PluginSetupError.js"; | ||
Failed to setup plugin '${args.config.plugins[i]?.id}': | ||
${error?.message ?? "Unknown error"} | ||
@@ -48,0 +49,0 @@ `)); |
@@ -13,13 +13,18 @@ import { setupConfig } from "../config/setupConfig.js"; | ||
export async function testConfigFile(args) { | ||
const [, importKeywordUsedException] = importKeywordUsed(args.file); | ||
if (importKeywordUsedException) { | ||
return [undefined, importKeywordUsedException]; | ||
try { | ||
const [, importKeywordUsedException] = importKeywordUsed(args.file); | ||
if (importKeywordUsedException) { | ||
return [undefined, importKeywordUsedException]; | ||
} | ||
const module = await import("data:application/javascript;base64," + btoa(args.file)); | ||
const config = await setupConfig({ module, env: args.env }); | ||
const [, exception] = await testConfig({ config }); | ||
if (exception) { | ||
return [undefined, exception]; | ||
} | ||
return [true, undefined]; | ||
} | ||
const module = await import("data:application/javascript;base64," + btoa(args.file)); | ||
const config = await setupConfig({ module, env: args.env }); | ||
const [, exception] = await testConfig({ config }); | ||
if (exception) { | ||
return [undefined, exception]; | ||
catch (e) { | ||
return [undefined, new TestConfigException(e.message)]; | ||
} | ||
return [true, undefined]; | ||
} | ||
@@ -26,0 +31,0 @@ /** |
{ | ||
"name": "@inlang/core", | ||
"type": "module", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"publishConfig": { | ||
@@ -6,0 +6,0 @@ "access": "public" |
@@ -58,2 +58,3 @@ import type { InlangConfig } from "../config/schema.js" | ||
Failed to setup plugin '${(args.config.plugins[i] as Plugin)?.id}': | ||
${(error as Error | undefined)?.message ?? "Unknown error"} | ||
@@ -60,0 +61,0 @@ `), |
@@ -20,16 +20,20 @@ import type { InlangConfigModule } from "../config/schema.js" | ||
}): Promise<Result<true, TestConfigException>> { | ||
const [, importKeywordUsedException] = importKeywordUsed(args.file) | ||
if (importKeywordUsedException) { | ||
return [undefined, importKeywordUsedException] | ||
try { | ||
const [, importKeywordUsedException] = importKeywordUsed(args.file) | ||
if (importKeywordUsedException) { | ||
return [undefined, importKeywordUsedException] | ||
} | ||
const module: InlangConfigModule = await import( | ||
"data:application/javascript;base64," + btoa(args.file) | ||
) | ||
const config = await setupConfig({ module, env: args.env }) | ||
const [, exception] = await testConfig({ config }) | ||
if (exception) { | ||
return [undefined, exception] | ||
} | ||
return [true, undefined] | ||
} catch (e) { | ||
return [undefined, new TestConfigException((e as Error).message)] | ||
} | ||
const module: InlangConfigModule = await import( | ||
"data:application/javascript;base64," + btoa(args.file) | ||
) | ||
const config = await setupConfig({ module, env: args.env }) | ||
const [, exception] = await testConfig({ config }) | ||
if (exception) { | ||
return [undefined, exception] | ||
} | ||
return [true, undefined] | ||
} | ||
@@ -36,0 +40,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464926
5622