Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-template-babel-compiler

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-template-babel-compiler - npm Package Compare versions

Comparing version 1.0.0-1 to 1.0.0

useVueTemplateBabelCompiler.sh

15

lib/index.js

@@ -81,7 +81,6 @@ 'use strict';

function renderCompiler(code, options) {
var _options$filename, _options$transforms;
var _options$transforms;
// TODO add customize individual options
const fileNameHasFunctional = options === null || options === void 0 ? void 0 : (_options$filename = options.filename) === null || _options$filename === void 0 ? void 0 : _options$filename.includes((options === null || options === void 0 ? void 0 : options.functionalComponentFileIdentifier) || '.functional');
const isFunctional = fileNameHasFunctional || (options === null || options === void 0 ? void 0 : (_options$transforms = options.transforms) === null || _options$transforms === void 0 ? void 0 : _options$transforms.stripWithFunctional);
const isFunctional = options === null || options === void 0 ? void 0 : (_options$transforms = options.transforms) === null || _options$transforms === void 0 ? void 0 : _options$transforms.stripWithFunctional;
const output = babel.transformSync(code, {

@@ -126,5 +125,5 @@ filename: 'compiledTemplate',

function compileTemplate(source, options) {
var _options$transforms;
var _options$filename;
const isFunctional = options === null || options === void 0 ? void 0 : (_options$transforms = options.transforms) === null || _options$transforms === void 0 ? void 0 : _options$transforms.stripWithFunctional;
const isFunctional = options === null || options === void 0 ? void 0 : (_options$filename = options.filename) === null || _options$filename === void 0 ? void 0 : _options$filename.includes((options === null || options === void 0 ? void 0 : options.functionalComponentFileIdentifier) || '.functional');
const {

@@ -145,3 +144,7 @@ ast,

const [compiledRender, compiledStaticRenders] = renderCompiler(code, options).split(renderSeparator);
const [compiledRender, compiledStaticRenders] = renderCompiler(code, {
transforms: {
stripWithFunctional: isFunctional
}
}).split(renderSeparator);
return {

@@ -148,0 +151,0 @@ ast,

4

package.json
{
"name": "vue-template-babel-compiler",
"version": "1.0.0-1",
"version": "1.0.0",
"description": "Post compiler for Vue template render functions to support ES features with Babel",

@@ -10,3 +10,3 @@ "main": "lib/index.js",

"lib/index.js",
"updateVueTemplateBabelCompiler.sh"
"useVueTemplateBabelCompiler.sh"
],

@@ -13,0 +13,0 @@ "engines": {

# vue-template-babel-compiler
Enable `Optional Chaining` and many new ES features for [Vue.js SFC](https://vuejs.org/v2/guide/single-file-components.html) based on [Babel](https://babeljs.io/).
Enable `Optional Chaining(?.)`, `Nullish Coalescing(??)` and many new ES syntax for [Vue.js SFC](https://vuejs.org/v2/guide/single-file-components.html) based on [Babel](https://babeljs.io/).

@@ -17,36 +17,44 @@ <p align="center">

## DEMO
![DEMO](https://user-images.githubusercontent.com/14243906/127761300-076db45a-cdce-4fda-bd02-1f4fa96de6d8.png)
## Features
- All features of [vue-template-es2015-compiler](https://github.com/vuejs/vue-template-es2015-compiler)
- `Optional Chaining` and more new ES features
- [x] `Bigint`
- [x] `nullish coalescing`
- [ ] Customization......
- All features of [vue-template-compiler](https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#readme) && [vue-template-es2015-compiler](https://github.com/vuejs/vue-template-es2015-compiler)
- new ES syntax: `Optional Chaining`, `Bigint`, `Nullish Coalescing` and more
- Customization syntax, babel plugin...
## DEMO
![DEMO](https://user-images.githubusercontent.com/14243906/126038645-61bc6c2a-25bb-4dc5-9981-e2b1d216385e.png)
## Usage
### 1. Install
``` bash
# 1: Install in your Vue project directory
npm install --save-dev vue-template-babel-compiler
# or:
yarn add vue-template-babel-compiler --dev
```
# 2: Run a script to substitute vue-template-es2015-compiler with this repo (To be simplified)
sh ./node_modules/vue-template-babel-compiler/updateVueTemplateBabelCompiler.sh
### 2. Config
#### 1. [vue-cli](https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader)
``` js
// vue.config.js
module.exports = {
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.tap(options => {
options.compiler = require('vue-template-babel-compiler')
return options
})
}
}
```
# 3. Enjoy~
#### 2. [nuxt.js](https://nuxtjs.org/docs/2.x/features/configuration#extend-webpack-to-load-audio-files)
``` js
// nuxt.config.js
```
## TODO
#### 3. [webpack](https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader)
``` js
// your webpack.config.js which config vue-loader
```
- [x] Support `__staticRenderFns__`
- [ ] More new ES features in SFC <template>
- [ ] Customize options for babel and globals in SFC <template>
- [x] publish [NPM package](https://www.npmjs.com/package/vue-template-babel-compiler)
- [ ] More Usage
- [ ] PR to [vue-template-es2015-compiler official repo](https://github.com/vuejs/vue-template-es2015-compiler)
- [ ] Then we can use this simpler without run
### Welcome for issue, PR.
### Welcome for Issues && PR.
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