From e831261c2f6e02485ff415e5448588f329f0dbcd Mon Sep 17 00:00:00 2001
From: anishka25 <115390390+anishka25@users.noreply.github.com>
Date: Sat, 21 Oct 2023 17:00:36 +0530
Subject: [PATCH 1/3] added javascript minifier
---
package-lock.json | 40 +++++++++++------
package.json | 3 ++
src/modules/JsMinifier/JsMinifier.vue | 63 +++++++++++++++++++++++++++
src/modules/JsMinifier/config.json | 1 +
src/routes.ts | 5 +++
tsconfig.app.json | 2 +-
tsconfig.json | 2 +-
7 files changed, 101 insertions(+), 15 deletions(-)
create mode 100644 src/modules/JsMinifier/JsMinifier.vue
create mode 100644 src/modules/JsMinifier/config.json
diff --git a/package-lock.json b/package-lock.json
index 60cd21f..721a696 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,6 +28,7 @@
"pinia": "^2.1.4",
"qr-scanner": "^1.4.2",
"qrcode": "^1.5.3",
+ "terser": "^5.22.0",
"vue": "^3.3.4",
"vue-accessible-color-picker": "^4.1.4",
"vue-router": "^4.2.4"
@@ -39,6 +40,7 @@
"@types/diff": "^5.0.3",
"@types/node": "^18.17.19",
"@types/qrcode": "^1.5.2",
+ "@types/uglify-js": "^3.17.3",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
@@ -49,6 +51,7 @@
"eslint-plugin-vue": "^9.15.1",
"prettier": "^3.0.0",
"typescript": "~5.1.6",
+ "uglify-js": "^3.17.4",
"vite": "^4.4.6",
"vite-plugin-node-polyfills": "^0.14.0",
"vite-plugin-pwa": "^0.16.5",
@@ -2191,7 +2194,6 @@
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.3",
- "dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/set-array": "^1.0.1",
@@ -2204,7 +2206,6 @@
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.1",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=6.0.0"
@@ -2212,7 +2213,6 @@
},
"node_modules/@jridgewell/set-array": {
"version": "1.1.2",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=6.0.0"
@@ -2220,7 +2220,6 @@
},
"node_modules/@jridgewell/source-map": {
"version": "0.3.5",
- "dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.0",
@@ -2235,7 +2234,6 @@
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.19",
- "dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
@@ -3738,6 +3736,15 @@
"integrity": "sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g==",
"license": "MIT"
},
+ "node_modules/@types/uglify-js": {
+ "version": "3.17.3",
+ "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.3.tgz",
+ "integrity": "sha512-ToldSfJ6wxO21cakcz63oFD1GjqQbKzhZCD57eH7zWuYT5UEZvfUoqvrjX5d+jB9g4a/sFO0n6QSVzzn5sMsjg==",
+ "dev": true,
+ "dependencies": {
+ "source-map": "^0.6.1"
+ }
+ },
"node_modules/@types/verror": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.6.tgz",
@@ -4255,7 +4262,6 @@
"version": "8.10.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
"integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==",
- "dev": true,
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
@@ -4926,7 +4932,6 @@
},
"node_modules/buffer-from": {
"version": "1.1.2",
- "dev": true,
"license": "MIT"
},
"node_modules/buffer-polyfill": {
@@ -10527,7 +10532,6 @@
},
"node_modules/source-map": {
"version": "0.6.1",
- "dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@@ -10544,7 +10548,6 @@
},
"node_modules/source-map-support": {
"version": "0.5.21",
- "dev": true,
"license": "MIT",
"dependencies": {
"buffer-from": "^1.0.0",
@@ -10962,9 +10965,9 @@
}
},
"node_modules/terser": {
- "version": "5.19.2",
- "dev": true,
- "license": "BSD-2-Clause",
+ "version": "5.22.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz",
+ "integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2",
@@ -10980,7 +10983,6 @@
},
"node_modules/terser/node_modules/commander": {
"version": "2.20.3",
- "dev": true,
"license": "MIT"
},
"node_modules/text-table": {
@@ -11237,6 +11239,18 @@
"node": ">=14.17"
}
},
+ "node_modules/uglify-js": {
+ "version": "3.17.4",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
+ "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
+ "dev": true,
+ "bin": {
+ "uglifyjs": "bin/uglifyjs"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
"node_modules/unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
diff --git a/package.json b/package.json
index 2dc98cb..963ae4e 100644
--- a/package.json
+++ b/package.json
@@ -68,6 +68,7 @@
"pinia": "^2.1.4",
"qr-scanner": "^1.4.2",
"qrcode": "^1.5.3",
+ "terser": "^5.22.0",
"vue": "^3.3.4",
"vue-accessible-color-picker": "^4.1.4",
"vue-router": "^4.2.4"
@@ -79,6 +80,7 @@
"@types/diff": "^5.0.3",
"@types/node": "^18.17.19",
"@types/qrcode": "^1.5.2",
+ "@types/uglify-js": "^3.17.3",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
@@ -89,6 +91,7 @@
"eslint-plugin-vue": "^9.15.1",
"prettier": "^3.0.0",
"typescript": "~5.1.6",
+ "uglify-js": "^3.17.4",
"vite": "^4.4.6",
"vite-plugin-node-polyfills": "^0.14.0",
"vite-plugin-pwa": "^0.16.5",
diff --git a/src/modules/JsMinifier/JsMinifier.vue b/src/modules/JsMinifier/JsMinifier.vue
new file mode 100644
index 0000000..59dad37
--- /dev/null
+++ b/src/modules/JsMinifier/JsMinifier.vue
@@ -0,0 +1,63 @@
+
+
+
JavaScript Minifier
+
+
+
Minified Code:
+
{{ minifiedCode }}
+
+
+
+
+
+
diff --git a/src/modules/JsMinifier/config.json b/src/modules/JsMinifier/config.json
new file mode 100644
index 0000000..ef06c3b
--- /dev/null
+++ b/src/modules/JsMinifier/config.json
@@ -0,0 +1 @@
+{ "slug": "js_minifier", "name": "Javascript Minifier", "icon": "javascript" }
diff --git a/src/routes.ts b/src/routes.ts
index a380afa..68ab336 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -40,6 +40,11 @@ const routes: Routes = {
"name": "HTML Preview",
"icon": "code"
},
+ "js_minifier": {
+ "dir": "JsMinifier",
+ "name": "Javascript Minifier",
+ "icon": "javascript"
+ },
"json_formatter": {
"dir": "JsonFormatter",
"name": "JSON Formatter",
diff --git a/tsconfig.app.json b/tsconfig.app.json
index b94a1c8..1eacf86 100644
--- a/tsconfig.app.json
+++ b/tsconfig.app.json
@@ -8,4 +8,4 @@
"@/*": ["./src/*"]
}
}
-}
+}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index ca23412..4fbdab9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -9,4 +9,4 @@
"path": "./tsconfig.app.json"
}
]
-}
+}
\ No newline at end of file
From a47e6f92d2534b1240c9a20b6439521b178af4b9 Mon Sep 17 00:00:00 2001
From: anishka25 <115390390+anishka25@users.noreply.github.com>
Date: Sat, 21 Oct 2023 17:17:06 +0530
Subject: [PATCH 2/3] fixed types
---
src/modules/JsMinifier/JsMinifier.vue | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/modules/JsMinifier/JsMinifier.vue b/src/modules/JsMinifier/JsMinifier.vue
index 59dad37..fceb35a 100644
--- a/src/modules/JsMinifier/JsMinifier.vue
+++ b/src/modules/JsMinifier/JsMinifier.vue
@@ -24,14 +24,14 @@ export default {
},
methods: {
minifyCode() {
- minify(this.inputCode).then((result)=>{
+ minify(this.inputCode).then((result: any)=>{
this.minifiedCode = result.code
}).catch(()=>{
this.minifiedCode = "Check your code for errors."
})
},
- adjustTextarea(event) {
- const textarea = event.target
+ adjustTextarea(event: Event) {
+ const textarea = event.target as HTMLInputElement
textarea.style.height = 'auto'
textarea.style.height = textarea.scrollHeight + 'px'
}
From fb763fedfcbf5d7626165aac18bc316a68260121 Mon Sep 17 00:00:00 2001
From: anishka25 <115390390+anishka25@users.noreply.github.com>
Date: Sun, 22 Oct 2023 19:32:47 +0530
Subject: [PATCH 3/3] used in-built components
---
src/modules/JsMinifier/JsMinifier.vue | 40 +++++++++++++++++----------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/src/modules/JsMinifier/JsMinifier.vue b/src/modules/JsMinifier/JsMinifier.vue
index fceb35a..8d277ca 100644
--- a/src/modules/JsMinifier/JsMinifier.vue
+++ b/src/modules/JsMinifier/JsMinifier.vue
@@ -1,22 +1,22 @@
JavaScript Minifier
-
-
+
+
Minified Code:
-
{{ minifiedCode }}
+
+
@@ -50,14 +62,14 @@ export default {
.inputText {
width: 100%;
flex-grow: 1;
- resize: vertical; /* Allow vertical resizing */
- min-height: 100px; /* Set a minimum height */
+ resize: vertical;
+ min-height: 100px;
}
.minifiedOutput {
- width: 100%; /* Set the width to 100% of the container */
- white-space: pre-wrap; /* Wrap long lines */
+ width: 100%;
+ white-space: pre-wrap;
}
-/* Add your other CSS styles here if needed */
+