
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
gettext-extractor-vue
Advanced tools
Extend gettext-extractor with the possibility to parse Vue single file components
Extend gettext-extractor with the possibility to parse
.vue
single file components.
decorateJSParserWithVueSupport
Support for Vue single file components (SFC) is provided by a decorating the JSExtractor
of gettext-extractor
.
The Single File Components will be transformed to JavaScript and fed into JSExtractor
.
Both vue@2 (via vue-template-compiler
) and vue@3 (via @vue/compiler-sfc
) are supported.
Below you can see an example, derived from gettext-extractor
's README.
const { GettextExtractor, JsExtractors } = require('gettext-extractor');
const { decorateJSParserWithVueSupport } = require('gettext-extractor-vue');
const extractor = new GettextExtractor();
const jsParser = extractor.createJsParser([
JsExtractors.callExpression('getText', {
arguments: {
text: 0,
context: 1,
},
}),
JsExtractors.callExpression('getPlural', {
arguments: {
text: 1,
textPlural: 2,
context: 3,
},
}),
]);
let vueParser;
// For vue@2 support please provide vue-template-compiler via `vue2TemplateCompiler`
vueParser = decorateJSParserWithVueSupport(jsParser, {
vue2TemplateCompiler: require('vue-template-compiler'),
});
// For vue@3 support please provide @vue/compiler-sfc via `vue3TemplateCompiler`
vueParser = decorateJSParserWithVueSupport(jsParser, {
vue3TemplateCompiler: require('@vue/compiler-sfc'),
});
vueParser.parseFilesGlob('./src/**/*.@(js|vue)');
extractor.savePotFile('./messages.pot');
extractor.printStats();
decorateExtractorWithHelpers
decorateExtractorWithHelpers
enables to you to add message transform functions to the extractor.
For example:
const { GettextExtractor, JSExtractor } = require('gettext-extractor');
const { decorateExtractorWithHelpers } = require('gettext-extractor-vue');
const extractor = decorateExtractorWithHelpers(new GettextExtractor());
// Ensure that every message has leading and trailing spaces removed
extractor.addMessageTransformFunction((message) => message.trim());
FAQs
Extend gettext-extractor with the possibility to parse Vue single file components
The npm package gettext-extractor-vue receives a total of 6,135 weekly downloads. As such, gettext-extractor-vue popularity was classified as popular.
We found that gettext-extractor-vue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.