New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fimbul/ve

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/ve - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0-dev.20180218

7

package.json
{
"name": "@fimbul/ve",
"version": "0.1.0",
"version": "0.2.0-dev.20180218",
"description": "Vue processor for wotan",

@@ -20,3 +20,3 @@ "main": "src/index",

"peerDependencies": {
"@fimbul/wotan": "^0.1.0",
"@fimbul/wotan": "0.2.0-dev.20180218",
"typescript": "^2.4.1 || >= 2.8.0-dev"

@@ -28,3 +28,6 @@ },

"void-elements": "^3.1.0"
},
"devDependencies": {
"@types/void-elements": "^3.1.0"
}
}

@@ -8,30 +8,5 @@ "use strict";

class Processor extends wotan_1.AbstractProcessor {
constructor() {
super(...arguments);
this.range = this.initRange();
}
static getSuffixForFile(name, _settings, readFile) {
if (path.extname(name) !== '.vue')
return '';
let suffix = '';
const parser = new parse5.SAXParser();
let depth = 0;
parser.on('startTag', (tagName, attr, selfClosing) => {
if (selfClosing || voidElements[tagName])
return;
++depth;
if (depth === 1 && tagName === 'script') {
const lang = attr.find(isLangAttr);
suffix = lang === undefined ? '.js' : `.${lang.value}`;
}
});
parser.on('endTag', () => {
--depth;
});
parser.write(readFile());
parser.end();
return suffix;
}
initRange() {
const range = {
constructor(context) {
super(context);
this.range = {
start: 0,

@@ -49,3 +24,3 @@ end: Infinity,

if (depth === 1 && tagName === 'script')
range.start = location.endOffset;
this.range.start = location.endOffset;
});

@@ -55,12 +30,33 @@ parser.on('endTag', (tagName, location) => {

if (depth === 0 && tagName === 'script')
range.end = location.startOffset;
this.range.end = location.startOffset;
});
parser.write(this.source);
parser.end();
const match = this.source.substring(0, range.start).match(/(\r?\n)/g);
const match = this.source.substring(0, this.range.start).match(/(\r?\n)/g);
if (match !== null)
range.line = match.length;
this.range.line = match.length;
}
return range;
}
static getSuffixForFile(context) {
if (path.extname(context.fileName) !== '.vue')
return '';
let suffix = '';
const parser = new parse5.SAXParser();
let depth = 0;
parser.on('startTag', (tagName, attr, selfClosing) => {
if (selfClosing || voidElements[tagName])
return;
++depth;
if (depth === 1 && tagName === 'script') {
const lang = attr.find(isLangAttr);
suffix = lang === undefined ? '.js' : `.${lang.value}`;
}
});
parser.on('endTag', () => {
--depth;
});
parser.write(context.readFile());
parser.end();
return suffix;
}
preprocess() {

@@ -67,0 +63,0 @@ return this.source.substring(this.range.start, this.range.end);

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