@suseejs/plugin-terser 1.0.0 → 1.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/dist/index.cjs +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9,20 +9,18 @@ const terser = require("terser");
|
|
|
9
9
|
*
|
|
10
10
|
* @returns {SuseeTypes.SuseePlugin} A Susee plugin object.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
const suseeTerser = (terserMinifyOptions) => {
|
|
13
13
|
return {
|
|
14
14
|
type: "post-process",
|
|
15
15
|
async: true,
|
|
16
|
-
func: async function (code,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
code = _code;
|
|
21
|
-
}
|
|
16
|
+
func: async function (code, _file) {
|
|
17
|
+
const _code = (await terser.minify(code, terserMinifyOptions)).code;
|
|
18
|
+
if (_code) {
|
|
19
|
+
code = _code;
|
|
22
20
|
}
|
|
23
21
|
return code;
|
|
24
22
|
},
|
|
25
23
|
};
|
|
26
|
-
}
|
|
24
|
+
};
|
|
27
25
|
module.exports = suseeTerser;
|
|
28
26
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":";AACA,iCAAkC;AAElC;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":";AACA,iCAAkC;AAElC;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAmC,CAClD,mBAAsD,EAC9B,EAAE;IAC1B,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,KAAK,WAAW,IAAI,EAAE,KAAK;YAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;YACpE,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,GAAG,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,iBAAS,WAAW,CAAC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type SuseeTypes = require("@suseejs/types");
|
|
2
|
-
import terser = require("terser");
|
|
3
2
|
/**
|
|
4
3
|
* A Susee plugin that minifies JavaScript code using the Terser library.
|
|
5
4
|
*
|
|
@@ -9,6 +8,6 @@ import terser = require("terser");
|
|
|
9
8
|
*
|
|
10
9
|
* @returns {SuseeTypes.SuseePlugin} A Susee plugin object.
|
|
11
10
|
*/
|
|
12
|
-
declare
|
|
11
|
+
declare const suseeTerser: SuseeTypes.SuseePluginFunction;
|
|
13
12
|
export = suseeTerser;
|
|
14
13
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AAAA,YAAY,UAAU,GAAG,QAAQ,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AAAA,YAAY,UAAU,GAAG,QAAQ,gBAAgB,CAAC,CAAC;AAGnD;;;;;;;;GAQG;AACH,QAAA,MAAM,WAAW,EAAE,UAAU,CAAC,mBAc7B,CAAC;AAEF,SAAS,WAAW,CAAC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type * as SuseeTypes from "@suseejs/types";
|
|
2
|
-
import * as terser from "terser";
|
|
3
2
|
/**
|
|
4
3
|
* A Susee plugin that minifies JavaScript code using the Terser library.
|
|
5
4
|
*
|
|
@@ -9,6 +8,6 @@ import * as terser from "terser";
|
|
|
9
8
|
*
|
|
10
9
|
* @returns {SuseeTypes.SuseePlugin} A Susee plugin object.
|
|
11
10
|
*/
|
|
12
|
-
declare
|
|
11
|
+
declare const suseeTerser: SuseeTypes.SuseePluginFunction;
|
|
13
12
|
export default suseeTerser;
|
|
14
13
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAGlD;;;;;;;;GAQG;AACH,QAAA,MAAM,WAAW,EAAE,UAAU,CAAC,mBAc7B,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -8,20 +8,18 @@ import * as terser from "terser";
|
|
|
8
8
|
*
|
|
9
9
|
* @returns {SuseeTypes.SuseePlugin} A Susee plugin object.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
const suseeTerser = (terserMinifyOptions) => {
|
|
12
12
|
return {
|
|
13
13
|
type: "post-process",
|
|
14
14
|
async: true,
|
|
15
|
-
func: async function (code,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
code = _code;
|
|
20
|
-
}
|
|
15
|
+
func: async function (code, _file) {
|
|
16
|
+
const _code = (await terser.minify(code, terserMinifyOptions)).code;
|
|
17
|
+
if (_code) {
|
|
18
|
+
code = _code;
|
|
21
19
|
}
|
|
22
20
|
return code;
|
|
23
21
|
},
|
|
24
22
|
};
|
|
25
|
-
}
|
|
23
|
+
};
|
|
26
24
|
export default suseeTerser;
|
|
27
25
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAmC,CAClD,mBAAsD,EAC9B,EAAE;IAC1B,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,KAAK,WAAW,IAAI,EAAE,KAAK;YAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;YACpE,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,GAAG,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suseejs/plugin-terser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Susee plugin terser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/suseejs/plugin-terser#readme",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@suseejs/types": "^0.1.
|
|
40
|
+
"@suseejs/types": "^0.1.9",
|
|
41
41
|
"typescript": "^5.9.3"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|