@pi-r/terser 0.11.3 → 0.12.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/index.js +6 -4
- package/package.json +2 -5
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const { isObject, removeInternalProperties } = require('@e-mc/document/util');
|
|
3
4
|
const MINIFY_PROPS = [
|
|
4
5
|
'compress',
|
|
5
6
|
'ecma',
|
|
@@ -29,7 +30,7 @@ async function transform(context, value, options) {
|
|
|
29
30
|
if (baseConfig.sourceMap === false) {
|
|
30
31
|
sourceMap.reset();
|
|
31
32
|
}
|
|
32
|
-
else if (
|
|
33
|
+
else if (isObject(baseConfig.sourceMap) || sourceMap.map && (baseConfig.sourceMap = {})) {
|
|
33
34
|
const map = baseConfig.sourceMap;
|
|
34
35
|
if (sourceMap.map) {
|
|
35
36
|
map.content = sourceMap.map;
|
|
@@ -41,7 +42,7 @@ async function transform(context, value, options) {
|
|
|
41
42
|
}
|
|
42
43
|
for (const chunk of supplementChunks) {
|
|
43
44
|
const chunkConfig = { ...baseConfig };
|
|
44
|
-
if (
|
|
45
|
+
if (isObject(chunkConfig.sourceMap)) {
|
|
45
46
|
chunkConfig.sourceMap = { content: chunk.sourceMap?.map, asObject: true };
|
|
46
47
|
}
|
|
47
48
|
const result = await context.minify(chunk.code, chunkConfig);
|
|
@@ -58,7 +59,7 @@ async function transform(context, value, options) {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
const { code, map } = await context.minify(value,
|
|
62
|
+
const { code, map } = await context.minify(value, removeInternalProperties(baseConfig, MINIFY_PROPS));
|
|
62
63
|
if (code) {
|
|
63
64
|
if (map) {
|
|
64
65
|
sourceMap.nextMap('terser', code, map, url);
|
|
@@ -66,4 +67,5 @@ async function transform(context, value, options) {
|
|
|
66
67
|
return code;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
70
|
+
|
|
69
71
|
module.exports = transform;
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/terser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Terser transform function for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
8
|
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
@@ -19,7 +16,7 @@
|
|
|
19
16
|
"license": "MIT",
|
|
20
17
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
21
18
|
"dependencies": {
|
|
22
|
-
"@e-mc/document": "^0.
|
|
19
|
+
"@e-mc/document": "^0.14.1",
|
|
23
20
|
"terser": "^5.46.2"
|
|
24
21
|
}
|
|
25
22
|
}
|