
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
vue-sfcmod
is a framework for codemodding Vue 3 Single-File Components. It aims to support <script>
codemods for both JavaScript and TypeScript with JSCodeshift, <template>
codemods with the Vue compiler and <style>
codemods with tools to be determined.
This project couldn't exist without the prior work done by vue-codemod. This repository started as a fork of vue-codemod
. The decision to fork was made because:
vue-codemod
appears to be unmaintained since 2021vue-codemod
supports both Vue 2 and Vue 3 whereas this project wants a smaller maintenance surface and only supports Vue 3vue-codemod
ships and maintains transform scripts, whereas this project aims to provide a raw codemodding framework rather than pre-built codemodsThis project also takes inspiration from vue-template-ast-to-template, a Vue 2 template stringifier. vue-sfcmod
was rewritten from scratch to target Vue 3 ASTs, however.
yarn add -D vue-sfcmod
npx vue-sfcmod <path> -t <transformation> --params [transformation params] [...additional options]
transformation
(required) - path to a module exporting a transformation function (JS/TS only) or an object with three transformation functions (script
key for JS/TS, template
for HTML and style
for CSS)path
(required) - files or directory to transform.--params
(optional) - additional parameters passed to the transformation functionrunTransformation(fileInfo, transformation, params)
Elements using the v-text
directive and children are not supported. The Vue compiler does not compile children of elements that use the v-text
directive, so we cannot provide the content of children.
Content inside v-html
directives is printed as is and cannot be transformed.
transition
The built-in Vue transition
component is returned by the Vue compiler without HTML comment children. Because the children are missing from the compiler AST, they cannot be recovered by vue-sfcmod. Upstream issue.
When strings are passed to style
attributes, it is converted to JSON (and deduplicated in the process). This is done by the Vue compiler, and attempting to undo that conversion could result in bugs in the template codemod engine.
jscodeshift
codemods to .vue
files<script setup>
<template>
#15<template>
<style>
#16See https://github.com/facebook/jscodeshift#transform-module
No API yet. You may manually modify the AST provided by the Vue SFC compiler.
Running transformations will generally ruin the formatting of your files. A recommended way to solve that problem is by using Prettier or eslint --fix
.
FAQs
Vue 3 SFC codemod framework
The npm package vue-sfcmod receives a total of 436 weekly downloads. As such, vue-sfcmod popularity was classified as not popular.
We found that vue-sfcmod demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.