Socket
Socket
Sign inDemoInstall

@lingui/conf

Package Overview
Dependencies
4
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-0 to 2.0.0-1

LICENSE

76

index.js

@@ -1,1 +0,75 @@

export * from "./src"
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.replaceRootDir = replaceRootDir;
exports.getConfig = getConfig;
var path = require("path");
var chalk = require("chalk");
var pkgConf = require("pkg-conf");
var _require = require("jest-validate"),
validate = _require.validate;
var _require2 = require("jest-regex-util"),
replacePathSepForRegex = _require2.replacePathSepForRegex;
var NODE_MODULES = replacePathSepForRegex(path.sep + "node_modules" + path.sep);
function replaceRootDir(conf, rootDir) {
var replace = function replace(s) {
return s.replace("<rootDir>", rootDir);
};
["srcPathDirs", "srcPathIgnorePatterns", "localeDir"].forEach(function (key) {
var value = conf[key];
if (!value) {} else if (typeof value === "string") {
conf[key] = replace(value);
} else if (value.length) {
conf[key] = value.map(replace);
}
});
conf.rootDir = rootDir;
return conf;
}
var defaults = {
localeDir: "./locale",
sourceLocale: "",
fallbackLocale: "",
srcPathDirs: ["<rootDir>"],
srcPathIgnorePatterns: [NODE_MODULES],
format: "lingui",
rootDir: "."
};
var deprecatedConfig = {
fallbackLanguage: function fallbackLanguage(config) {
return " Option ".concat(chalk.bold("fallbackLanguage"), " was replaced by ").concat(chalk.bold("fallbackLocale"), "\n \n lingui-cli now treats your current configuration as:\n {\n ").concat(chalk.bold('"fallbackLocale"'), ": ").concat(chalk.bold("\"".concat(config.fallbackLanguage, "\"")), "\n }\n \n Please update your configuration.\n ");
}
};
var configValidation = {
exampleConfig: defaults,
deprecatedConfig: deprecatedConfig,
comment: "See https://l.lingui.io/ref-lingui-conf for a list of valid options"
};
function getConfig() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
cwd = _ref.cwd;
var raw = pkgConf.sync("lingui", {
defaults: defaults,
skipOnFalse: true,
cwd: cwd || process.cwd()
});
validate(raw, configValidation); // Use deprecated fallbackLanguage, if defined
raw.fallbackLocale = raw.fallbackLocale || raw.fallbackLanguage || "";
var rootDir = path.dirname(pkgConf.filepath(raw));
return replaceRootDir(raw, rootDir);
}

2

package.json
{
"name": "@lingui/conf",
"version": "2.0.0-0",
"version": "2.0.0-1",
"description": "Get lingui configuration from package.json",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc