@pi-r/terser 0.7.2 → 0.8.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +11 -10
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ### @pi-r/terser
2
2
 
3
- https://e-mc.readthedocs.io/en/latest/document/plugins/built-in.html
3
+ https://e-mc.readthedocs.io/en/latest/document/plugins
4
4
 
5
5
  ### LICENSE
6
6
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const util = require("@e-mc/document/util");
2
+ const util_1 = require("@e-mc/document/util");
3
3
  const MINIFY_PROPS = [
4
4
  'compress',
5
5
  'ecma',
@@ -22,14 +22,14 @@ const MINIFY_PROPS = [
22
22
  'warnings',
23
23
  'wrap'
24
24
  ];
25
- module.exports = async function transform(context, value, options) {
25
+ async function transform(context, value, options) {
26
26
  const { sourceMap, supplementChunks } = options;
27
27
  const baseConfig = options.toBaseConfig();
28
28
  let url;
29
29
  if (baseConfig.sourceMap === false) {
30
30
  sourceMap.reset();
31
31
  }
32
- else if (util.isObject(baseConfig.sourceMap) || sourceMap.map && (baseConfig.sourceMap = {})) {
32
+ else if ((0, util_1.isObject)(baseConfig.sourceMap) || sourceMap.map && (baseConfig.sourceMap = {})) {
33
33
  const map = baseConfig.sourceMap;
34
34
  if (sourceMap.map) {
35
35
  map.content = sourceMap.map;
@@ -41,7 +41,7 @@ module.exports = async function transform(context, value, options) {
41
41
  }
42
42
  for (const chunk of supplementChunks) {
43
43
  const chunkConfig = { ...baseConfig };
44
- if (util.isObject(chunkConfig.sourceMap)) {
44
+ if ((0, util_1.isObject)(chunkConfig.sourceMap)) {
45
45
  chunkConfig.sourceMap = { content: chunk.sourceMap?.map, asObject: true };
46
46
  }
47
47
  const result = await context.minify(chunk.code, chunkConfig);
@@ -58,11 +58,12 @@ module.exports = async function transform(context, value, options) {
58
58
  }
59
59
  }
60
60
  }
61
- const result = await context.minify(value, util.removeInternalProperties(baseConfig, MINIFY_PROPS));
62
- if (result?.code) {
63
- if (result.map) {
64
- sourceMap.nextMap('terser', result.code, result.map, url);
61
+ const { code, map } = await context.minify(value, (0, util_1.removeInternalProperties)(baseConfig, MINIFY_PROPS));
62
+ if (code) {
63
+ if (map) {
64
+ sourceMap.nextMap('terser', code, map, url);
65
65
  }
66
- return result.code;
66
+ return code;
67
67
  }
68
- };
68
+ }
69
+ module.exports = transform;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pi-r/terser",
3
- "version": "0.7.2",
4
- "description": "terser transform function for E-mc.",
3
+ "version": "0.8.1",
4
+ "description": "Terser transform function for E-mc.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -9,7 +9,7 @@
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/anpham6/pi-r.git",
12
- "directory": "src/documemt/terser"
12
+ "directory": "src/document/terser"
13
13
  },
14
14
  "keywords": [
15
15
  "squared",
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
22
  "dependencies": {
23
- "@e-mc/document": "^0.9.4",
24
- "terser": "^5.31.1"
23
+ "@e-mc/document": "^0.10.0",
24
+ "terser": "^5.31.3"
25
25
  }
26
26
  }