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.
- package/.vscode/settings.json +13 -0
- package/CHANGELOG.md +83 -17
- package/LICENSE +2 -2
- package/README.md +53 -28
- package/demo.js +16 -2
- package/dist/module.js +126 -76
- package/dist/modules/fileHandler.js +51 -0
- package/dist/modules/logger.js +115 -0
- package/dist/modules/minifier.js +42 -0
- package/logs/error.log +6 -0
- package/logs/summary.log +112 -0
- package/package.json +6 -3
- package/test/lib/test.css +9 -0
- package/test/lib/test.js +3 -0
- package/test/test.css +8 -0
- package/test/test.js +89 -0
- package/test/common.js +0 -1
- package/test/lib/comon.js +0 -1
- package/test/lib/languagepack.js +0 -1
- package/test/lib/launcher.css +0 -89
- package/test/lib/launcher.js +0 -1
|
@@ -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
package/logs/summary.log
ADDED
|
@@ -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": "
|
|
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.
|
|
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
|
-
"
|
|
46
|
+
"@babel/core": "^7.25.2",
|
|
47
|
+
"@babel/preset-env": "^7.25.3"
|
|
45
48
|
}
|
|
46
49
|
}
|
package/test/lib/test.js
ADDED
package/test/test.css
ADDED
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")}
|