@shuvi/compiler 1.0.55 → 1.0.57
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/lib/swc/index.js +6 -7
- package/package.json +1 -1
package/lib/swc/index.js
CHANGED
|
@@ -9,7 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.transform = transform;
|
|
13
|
+
exports.transformSync = transformSync;
|
|
14
|
+
exports.minify = minify;
|
|
15
|
+
exports.minifySync = minifySync;
|
|
16
|
+
exports.bundle = bundle;
|
|
13
17
|
const fs = require('fs');
|
|
14
18
|
const { platform, arch } = require('os');
|
|
15
19
|
const path = require('path');
|
|
@@ -54,8 +58,8 @@ else {
|
|
|
54
58
|
loadError = null;
|
|
55
59
|
}
|
|
56
60
|
function transform(src, options) {
|
|
57
|
-
var _a, _b;
|
|
58
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b;
|
|
59
63
|
const isModule = typeof src !== 'string' && !Buffer.isBuffer(src);
|
|
60
64
|
options = options || {};
|
|
61
65
|
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
|
|
@@ -64,7 +68,6 @@ function transform(src, options) {
|
|
|
64
68
|
return bindings.transform(isModule ? JSON.stringify(src) : src, isModule, toBuffer(options));
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
|
-
exports.transform = transform;
|
|
68
71
|
function transformSync(src, options) {
|
|
69
72
|
var _a, _b;
|
|
70
73
|
const isModule = typeof src !== 'string' && !Buffer.isBuffer(src);
|
|
@@ -74,7 +77,6 @@ function transformSync(src, options) {
|
|
|
74
77
|
}
|
|
75
78
|
return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(options));
|
|
76
79
|
}
|
|
77
|
-
exports.transformSync = transformSync;
|
|
78
80
|
function toBuffer(t) {
|
|
79
81
|
return Buffer.from(JSON.stringify(t));
|
|
80
82
|
}
|
|
@@ -83,14 +85,11 @@ function minify(src, opts) {
|
|
|
83
85
|
return bindings.minify(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
|
-
exports.minify = minify;
|
|
87
88
|
function minifySync(src, opts) {
|
|
88
89
|
return bindings.minifySync(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
|
|
89
90
|
}
|
|
90
|
-
exports.minifySync = minifySync;
|
|
91
91
|
function bundle(options) {
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
93
|
return bindings.bundle(toBuffer(options));
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
exports.bundle = bundle;
|