
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
vue-jscodeshift-adapter
Advanced tools
Run jscodeshift on Vue single file components
npm install vue-jscodeshift-adapter -D
The instructions below assume you're familiar with jscodeshift.
This module wraps the transform()
function, enabling it to run on Vue single file components (sfc).
The two main use cases are:
<script>
part of an sfcmy-transform.js
:
const adapt = require('vue-jscodeshift-adapter');
function myTransform(fileInfo, api, options) {
const script = fileInfo.script.content;
const template = fileInfo.template.content;
const style = fileInfo.style.content;
// (transform source somehow)
fileInfo.script.content = newScript;
fileInfo.template.content = newTemplate;
fileInfo.style.content = newStyle;
}
module.exports = adapt(myTransform);
After wrapping, you can run jscodeshift-compatible codemods on your sfc because
fileInfo.source
will be the content of the sfc's <script>
transform()
returns a string, that string becomes the content of <script>
my-transform.js
:
const adapt = require('vue-jscodeshift-adapter');
const someCodemod = require('some-codemod');
module.exports = adapt(someCodemod);
$ jscodeshift <path> -t my-transform.js --extensions vue
See jscodeshift readme for more info.
MIT
[1.1.0] - 2018-03-03
<script>
content through fileInfo.script.content
<template>
content through fileInfo.template.content
<style>
content through fileInfo.style.content
FAQs
Run jscodeshift on Vue single file components
The npm package vue-jscodeshift-adapter receives a total of 34,069 weekly downloads. As such, vue-jscodeshift-adapter popularity was classified as popular.
We found that vue-jscodeshift-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.