uglify-js-minify-css-allfiles 1.3.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Minification module for JavaScript and CSS files.
3
+ * @module minifier
4
+ */
5
+
6
+ import { minify as uglifyJS } from 'uglify-js';
7
+ import CleanCSS from 'clean-css';
8
+
9
+ /**
10
+ * Options for CSS minification.
11
+ * @constant {Object}
12
+ */
13
+ const CSS_OPTIONS = {
14
+ level: { 1: { all: false } },
15
+ };
16
+
17
+ /**
18
+ * Minifies JavaScript content.
19
+ *
20
+ * @param {string} content - The JavaScript content to minify.
21
+ * @returns {string} The minified JavaScript content.
22
+ */
23
+ export function minifyJS(content) {
24
+ return uglifyJS(content, {
25
+ compress: {
26
+ pure_funcs: ['console.log', 'console.error', 'console.warn', 'console.info'],
27
+ },
28
+ }).code;
29
+ }
30
+
31
+ /**
32
+ * Minifies CSS content.
33
+ *
34
+ * @async
35
+ * @param {string} content - The CSS content to minify.
36
+ * @returns {Promise<Object>} A promise that resolves to the minification result.
37
+ */
38
+ export function minifyCSS(content) {
39
+ return new Promise((resolve) => {
40
+ new CleanCSS(CSS_OPTIONS).minify(content, (error, output) => resolve(output));
41
+ });
42
+ }
package/logs/error.log ADDED
@@ -0,0 +1,6 @@
1
+
2
+ =============== File Error ===============
3
+ Time: 08/19/2024, 21:39:36
4
+ File: test\test.js
5
+ Reason: Invalid or empty content
6
+ ==========================================
@@ -0,0 +1,112 @@
1
+
2
+ =============== Processing Summary ===============
3
+ Time: 08/19/2024, 21:39:36
4
+ Total files processed: 2
5
+ Files with errors: 1
6
+ Error files:
7
+ 1. test\test.js
8
+ ==================================================
9
+
10
+ =============== Processing Summary ===============
11
+ Time: 08/19/2024, 21:40:08
12
+ Total files processed: 0
13
+ Files with errors: 0
14
+ Error files:
15
+
16
+ ==================================================
17
+
18
+ =============== Processing Summary ===============
19
+ Time: 08/19/2024, 21:57:46
20
+ Total files processed: 0
21
+ Files with errors: 0
22
+ Error files:
23
+
24
+ ==================================================
25
+
26
+ =============== Processing Summary ===============
27
+ Time: 08/19/2024, 22:14:47
28
+ Total files processed: 0
29
+ Files with errors: 0
30
+ Error files:
31
+
32
+ ==================================================
33
+
34
+ =============== Processing Summary ===============
35
+ Time: 08/19/2024, 22:20:22
36
+ Total files processed: 0
37
+ Files with errors: 0
38
+ Error files:
39
+
40
+ ==================================================
41
+
42
+ =============== Processing Summary ===============
43
+ Time: 08/19/2024, 22:24:04
44
+ Total files processed: 0
45
+ Files with errors: 0
46
+ Error files:
47
+
48
+ ==================================================
49
+
50
+ =============== Processing Summary ===============
51
+ Time: 08/19/2024, 22:25:15
52
+ Total files processed: 0
53
+ Files with errors: 0
54
+ Error files:
55
+
56
+ ==================================================
57
+
58
+ =============== Processing Summary ===============
59
+ Time: 08/19/2024, 22:32:13
60
+ Total files processed: 0
61
+ Files with errors: 0
62
+ Error files:
63
+
64
+ ==================================================
65
+
66
+ =============== Processing Summary ===============
67
+ Time: 08/19/2024, 22:32:49
68
+ Total files processed: 0
69
+ Files with errors: 0
70
+ Error files:
71
+
72
+ ==================================================
73
+
74
+ =============== Processing Summary ===============
75
+ Time: 08/19/2024, 22:33:35
76
+ Total files processed: 0
77
+ Files with errors: 0
78
+ Error files:
79
+
80
+ ==================================================
81
+
82
+ =============== Processing Summary ===============
83
+ Time: 08/19/2024, 22:42:58
84
+ Total files processed: 0
85
+ Files with errors: 0
86
+ Error files:
87
+
88
+ ==================================================
89
+
90
+ =============== Processing Summary ===============
91
+ Time: 08/19/2024, 22:43:10
92
+ Total files processed: 0
93
+ Files with errors: 0
94
+ Error files:
95
+
96
+ ==================================================
97
+
98
+ =============== Processing Summary ===============
99
+ Time: 08/20/2024, 10:34:11
100
+ Total files processed: 0
101
+ Files with errors: 0
102
+ Error files:
103
+
104
+ ==================================================
105
+
106
+ =============== Processing Summary ===============
107
+ Time: 08/20/2024, 10:38:29
108
+ Total files processed: 0
109
+ Files with errors: 0
110
+ Error files:
111
+
112
+ ==================================================
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "uglify-js-minify-css-allfiles",
3
- "version": "1.3.3",
3
+ "version": "2.0.1",
4
4
  "description": "you will be able to minify all files as same file names which is js or css",
5
5
  "main": "minify.js",
6
+ "type": "module",
6
7
  "scripts": {
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
@@ -37,10 +38,12 @@
37
38
  },
38
39
  "homepage": "https://github.com/oinochoe/uglify-js-minify-css-allfiles#readme",
39
40
  "dependencies": {
40
- "clean-css": "^4.2.3",
41
+ "clean-css": "^4.2.4",
42
+ "uglify-js": "^3.19.2",
41
43
  "uglify-js-es6": "^2.8.9"
42
44
  },
43
45
  "devDependencies": {
44
- "uglify-js": "github:mishoo/UglifyJS2#harmony"
46
+ "@babel/core": "^7.25.2",
47
+ "@babel/preset-env": "^7.25.3"
45
48
  }
46
49
  }
@@ -0,0 +1,9 @@
1
+ .dragon {
2
+ width: 30px;
3
+ height: 50px;
4
+ }
5
+
6
+ .dragon a {
7
+ display: block;
8
+ margin: 30px;
9
+ }
@@ -0,0 +1,3 @@
1
+ const dragon = () => {
2
+ alert('dd');
3
+ };
package/test/test.css ADDED
@@ -0,0 +1,8 @@
1
+ .dragon {
2
+ width: 30px;
3
+ height: 50px;
4
+ }
5
+ .dragon a {
6
+ display: block;
7
+ margin: 30px;
8
+ }
package/test/test.js ADDED
@@ -0,0 +1,89 @@
1
+ class ModernBank {
2
+ // Private fields
3
+ #balance = 0;
4
+ #transactionHistory = [];
5
+
6
+ // Public field
7
+ accountType = 'Checking';
8
+
9
+ // Static private field
10
+ static #bankName = 'Modern JS Bank';
11
+
12
+ // Static public field
13
+ static exchangeRate = 1.2;
14
+
15
+ // Static initialization block
16
+ static {
17
+ console.log(`${this.#bankName} is initializing...`);
18
+ }
19
+
20
+ constructor(initialBalance) {
21
+ this.#balance = initialBalance;
22
+ this.#addTransaction('Initial deposit', initialBalance);
23
+ }
24
+
25
+ // Private method
26
+ #addTransaction(description, amount) {
27
+ this.#transactionHistory.push({ description, amount, date: new Date() });
28
+ }
29
+
30
+ // Public method
31
+ deposit(amount) {
32
+ this.#balance += amount;
33
+ this.#addTransaction('Deposit', amount);
34
+ }
35
+
36
+ // Public method with optional chaining and nullish coalescing
37
+ withdraw(amount, { fee, description } = {}) {
38
+ const totalAmount = amount + (fee ?? 0);
39
+ if (this.#balance >= totalAmount) {
40
+ this.#balance -= totalAmount;
41
+ this.#addTransaction(description?.trim() || 'Withdrawal', -amount);
42
+ if (fee) this.#addTransaction('Withdrawal fee', -fee);
43
+ return true;
44
+ }
45
+ return false;
46
+ }
47
+
48
+ // Getter
49
+ get balance() {
50
+ return this.#balance;
51
+ }
52
+
53
+ // Static method
54
+ static convertCurrency(amount) {
55
+ return amount * this.exchangeRate;
56
+ }
57
+
58
+ // Async method
59
+ async getTransactionHistory() {
60
+ // Simulating an async operation
61
+ await new Promise((resolve) => setTimeout(resolve, 1000));
62
+ return this.#transactionHistory;
63
+ }
64
+
65
+ // Method using the logical assignment operator
66
+ updateAccountType(newType) {
67
+ this.accountType ||= newType;
68
+ }
69
+
70
+ // toString method using template literals
71
+ toString() {
72
+ return `ModernBank account (${this.accountType}) - Balance: $${this.#balance}`;
73
+ }
74
+ }
75
+
76
+ // Usage example
77
+ (async () => {
78
+ const account = new ModernBank(1000);
79
+ account.deposit(500);
80
+ account.withdraw(200, { fee: 5, description: 'ATM withdrawal ' });
81
+ account.updateAccountType('Savings');
82
+
83
+ console.log(account.toString());
84
+ console.log(`Balance: $${account.balance}`);
85
+ console.log(`$100 in foreign currency: $${ModernBank.convertCurrency(100)}`);
86
+
87
+ const history = await account.getTransactionHistory();
88
+ console.log('Transaction History:', history);
89
+ })();
package/test/common.js DELETED
@@ -1 +0,0 @@
1
- var dragon=()=>{alert("dd")};
package/test/lib/comon.js DELETED
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}