vue-jscodeshift-adapter
Advanced tools
Comparing version 2.2.0 to 2.2.1
# Change Log | ||
## [2.2.1] - 2023-10-11 | ||
- Fix indent of whitespace-only lines. Thanks to [@nemoDreamer](https://github.com/nemoDreamer). | ||
## [2.2.0] - 2020-10-02 | ||
- Preserve indent of `<script>` and `<style>` tags. Thanks to @SevInf | ||
- Preserve indent of `<script>` and `<style>` tags. Thanks to [@SevInf](https://github.com/SevInf) | ||
@@ -7,0 +11,0 @@ ## [2.1.0] - 2020-05-15 |
{ | ||
"name": "vue-jscodeshift-adapter", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Run jscodeshift on Vue single file components", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
# vue-jscodeshift-adapter | ||
[![Build Status](https://travis-ci.org/psalaets/vue-jscodeshift-adapter.svg?branch=master)](https://travis-ci.org/psalaets/vue-jscodeshift-adapter) [![Greenkeeper badge](https://badges.greenkeeper.io/psalaets/vue-jscodeshift-adapter.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/psalaets/vue-jscodeshift-adapter.svg?branch=master)](https://travis-ci.org/psalaets/vue-jscodeshift-adapter) | ||
@@ -5,0 +5,0 @@ Run [jscodeshift](https://github.com/facebook/jscodeshift) on Vue single file components |
const descriptorToString = require('vue-sfc-descriptor-to-string'); | ||
const parseSfc = require('./parse-sfc'); | ||
const fixWhitespace = require('./fix-whitespace'); | ||
@@ -13,8 +15,16 @@ module.exports = adapt; | ||
const { sfcDescriptor, indents } = parseSfc(fileInfo.source); | ||
fixWhitespace(sfcDescriptor, indents); | ||
const scriptBlock = sfcDescriptor.script; | ||
if (scriptBlock) { | ||
fileInfo.source = scriptBlock.content; | ||
const newScriptContent = transform( | ||
Object.assign({}, fileInfo, { | ||
source: scriptBlock.content, | ||
}), | ||
api, | ||
options | ||
); | ||
const newScriptContent = transform(fileInfo, api, options); | ||
if (!!newScriptContent) { | ||
@@ -34,2 +44,1 @@ scriptBlock.content = newScriptContent; | ||
} | ||
@@ -25,3 +25,3 @@ const compiler = require('vue-template-compiler'); | ||
.split('\n') | ||
.filter(line => line !== '') | ||
.filter(line => !line.match(/^\s*$/)) | ||
.map(getLinePadding); | ||
@@ -28,0 +28,0 @@ |
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
21293
29
609