Transform Vue Class Components to Vue 3 script setup
Package Exports
@heatsrc/vue-declassified
@heatsrc/vue-declassified/dist/main.cjs.js
@heatsrc/vue-declassified/dist/main.es.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@heatsrc/vue-declassified) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Vue Declassified is an opinionated tool that will format Vue class components (including the v8 RC package) to script setup. This project a fork and re-write of yoyo930021's vc2c which is focused more on Vue 2 -> Composition API using defineComponent.
Opinionated decisions
These decisions are made arbitrarily, mostly for sanity and convenience. You get what you get and you don't get upset.
No/Limited configuration
There is a lot of different edge cases to test and adding configuration options tends to act as a multiplier for those cases.
Will only support TS
Won't support esoteric/redundant @Component/@Options options
Will consider accepting PRs
Will order files script -> template -> style
Will reference macros by arbitrary variables (see below)
No transform path to script setup (breaking change in Vue 2 -> 3)
🚀
All planned features are supported in section, let go!
vue-class-component
Basic class transforms (5 ✅ / 2 ✔️)
feature
supported?
notes
methods
✅
Basic method support (no decorators)
data properties
✅
Basic class properties (no decorators)
getters/setters
✅
Computed refs
mixins
✔️
extend
✔️
sort by dependency
✅
Will try to sort dependencies*
$refs:! {...}
✅
converted to regular Refs
* VueDc does it best to sort dependencies to avoid used before defined issues. It requires processing essentially a directed acyclic graph and it's complicated so please raise issues if found.
These are options provided in the decorator call, e.g., @Component({ components: { MyIcon } }). All Options API fields are technically supported in Vue Class Components (e.g., data, computed, methods, etc) but many of them don't make sense and will not be actively developed but PRs may be accepted.
Options-Data (4/4 🚀)
Options-Data
supported?
notes
data
💤
While you can add these what you even using VCC for?
props
✅
propsData
💤
This is primarily a testing feature
computed
💤
While you can add these what you even using VCC for?
watch
✅
exposes
✅
RC Feature since Vue 3 require declaring exposed fields
emits
✅
RC Feature since Vue 3 require declaring events that are emitted
Options-Assets (2 ✔️ / 1 💤)
Options-Assets
supported?
notes
directives
✔️
Will attempt to rename directives if they don't match
filters
✔️
Will be converted to simple methods, you'll need to fix pipe style filters in your html templates
components
💤
If you chance the name of your imports this may break
Options-Composition (1 ✔️ / 3 💤)
Options-Composition
supported?
notes
parent
💤
Seem hacky to be specifying a parent in VCC SFC
mixins
💤
While you can add these what are you even using VCC for?
extends
💤
-
provide/inject
✔️
Options-Misc (2 ✔️ / 4 💤)
Options-Misc
supported?
notes
name
💤
Doesn't make much sense an script setup
delimiters
💤
functional
💤
If all it uses is props script setup will automatically be functional
model
✔️
inheritAttrs
✔️
comments
💤
VueDc will try to preserve comments by default
Options-DOM (4/4 💤)
Options-DOM
supported?
notes
el
💤
DOM Options are more suited for Options API
template
💤
-
render
💤
-
renderError
💤
-
Options-LifeCycleHooks (11/11 💤)
Options-LifeCycle Hooks
supported?
notes
beforeCreate
💤
While you can add these what you even using VCC for?
created
💤
-
beforeMount
💤
-
mounted
💤
-
beforeUpdate
💤
-
updated
💤
-
activated
💤
-
deactivated
💤
-
beforeDestroy
💤
-
destroyed
💤
-
errorCaptured
💤
-
vue-property-decorator
`Decorators` (6 ✅ 1 ✔️ / 3 💤)
decorator
supported?
notes
@Prop
✅
@PropSync
💤
@Model
✔️
@Watch
✅
@Provide
✅
@Inject
✅
@ProvideReactive
💤
@InjectReactive
💤
@Emit
✅
@Ref
✅
Currently parsing templates isn't in the works so ref aliases will require updating if used.