🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

babel-plugin-dev-debug

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-dev-debug - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+5
-1
package.json
{
"name": "babel-plugin-dev-debug",
"version": "1.0.0",
"version": "1.0.1",
"description": "an babel plugin that for dev debug",

@@ -9,2 +9,6 @@ "main": "index.js",

},
"files": [
"index.js",
"README.md"
],
"repository": {

@@ -11,0 +15,0 @@ "type": "git",

+3
-3

@@ -21,3 +21,3 @@ # babel-plugin-dev-debug

1. add babel-plugin-dev-debug plugin to babel.config.js
add babel-plugin-dev-debug plugin to babel.config.js

@@ -31,7 +31,7 @@ ```js

2. in you code
in you code
```js
if (DEBUG) {
// write something for debug
// do something for debug
// removed in production env

@@ -38,0 +38,0 @@ const a = 10;

Sorry, the diff of this file is not supported yet

module.exports = {
root: true,
env: {
node: true,
},
globals: {
DEBUG: true,
},
extends: ["plugin:vue/vue3-essential", "eslint:recommended", "@vue/prettier"],
parserOptions: {
parser: "babel-eslint",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
plugins: ["../index.js"],
};

Sorry, the diff of this file is too big to display

{
"name": "example",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0-0",
"prettier": "^1.19.1"
}
}

Sorry, the diff of this file is not supported yet

<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
# example
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
<template>
<div>
example
<button @click="handleClick">click</button>
</div>
</template>
<script>
export default {
name: "App",
setup() {
const handleClick = () => {
console.log("click");
if (DEBUG) {
console.log("for debug")
const a = 10;
const b = 20;
console.log(a + b);
}
};
return {
handleClick,
};
},
};
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
import { createApp } from "vue";
import App from "./App.vue";
createApp(App).mount("#app");

Sorry, the diff of this file is not supported yet

const babel = require("@babel/core");
const plugin = require("../");
const inputCode = `
const a = 10;
const b = 20;
if("DEBUG"){
console.log("heihei")
}
`;
describe("babel-plugin-dev-debug", () => {
it("dev", () => {
// input
process.env.NODE_ENV = "development";
const { code } = babel.transform(inputCode, { plugins: [plugin] });
expect(code).toMatchSnapshot();
});
it("prod", () => {
// input
process.env.NODE_ENV = "production";
const { code } = babel.transform(inputCode, { plugins: [plugin] });
expect(code).toMatchSnapshot();
});
});