Socket
Socket
Sign inDemoInstall

@hh.ru/babel-plugin-static-value-extractor

Package Overview
Dependencies
Maintainers
9
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hh.ru/babel-plugin-static-value-extractor - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

.idea/dictionaries/g_evdokimov.xml

1

lib/index.js

@@ -127,4 +127,5 @@ 'use strict';

if (content !== previousContent) {
_fs2.default.mkdirSync(saveFilePath, { recursive: true });
_fs2.default.writeFileSync(saveFilePath + '/' + opts.saveFileName + '.' + opts.saveFileExt, content);
}
};

@@ -19,2 +19,4 @@ 'use strict';

var JS_EXTENSIONS = ['', 'js', 'jsx'];
var getConcatenatedStaticProps = function getConcatenatedStaticProps(staticProps, nodeStaticProps) {

@@ -32,2 +34,15 @@ return staticProps.concat(nodeStaticProps.reduce(function (arr, _ref) {

var isJsFile = function isJsFile(path) {
return JS_EXTENSIONS.includes(_path2.default.parse(path).ext);
};
var replacePath = function replacePath(path) {
var pathsToReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return Object.keys(pathsToReplace).filter(function (checkPath) {
return path.startsWith(checkPath);
}).reduce(function (result, checkPath) {
return _path2.default.normalize(result.replace(checkPath, pathsToReplace[checkPath]));
}, path);
};
exports.default = function (cb) {

@@ -38,3 +53,4 @@ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var currentFileDir = _path2.default.parse(opts.filename).dir;
var staticPropName = opts.staticPropName;
var staticPropName = opts.staticPropName,
pathsToReplace = opts.pathsToReplace;

@@ -106,4 +122,4 @@ var importDeclarationPaths = [];

if (node && node.source && !_path2.default.isAbsolute(node.source.value) && node.source.value[0] === '.') {
processImports(node.source.value);
if (node && node.source && isJsFile(node.source.value)) {
processImports(replacePath(node.source.value, pathsToReplace));
}

@@ -110,0 +126,0 @@ }

7

package.json
{
"name": "@hh.ru/babel-plugin-static-value-extractor",
"version": "0.3.0",
"version": "0.4.0",
"main": "lib/index.js",

@@ -9,4 +9,8 @@ "devDependencies": {

"babel-preset-stage-0": "^6.24.1",
"del": "^3.0.0",
"mocha": "5.2.0"
},
"engines": {
"node": ">=10"
},
"repository": {

@@ -29,5 +33,4 @@ "type": "git",

"babel-core": "^6.26.3",
"del": "^3.0.0",
"glob-all": "^3.1.0"
}
}

@@ -13,7 +13,8 @@ # babel-plugin-static-value-extractor

], {
staticPropName: - имя свойства
saveFileName: - имя файла
saveFilePath: - путь, куда сохранять значения свойств
saveFileExt: - расширение файла,
template: Функция которая возвращает шаблон контента(string), в качестве аргумента передается объект с ключами названий Файлов и значением массивов извлеченных значений, если не передать контентом сохраненного файла будет JSON представление.',
staticPropName: — имя свойства
saveFileName: — имя файла
saveFilePath: — путь, куда сохранять значения свойств
saveFileExt: — расширение файла,
pathsToReplace: — webpackAliases
template: — функция которая возвращает шаблон контента(string), в качестве аргумента передается объект с ключами названий Файлов и значением массивов извлеченных значений, если не передать контентом сохраненного файла будет JSON представление.',
});

@@ -20,0 +21,0 @@ ```

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

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