greg 4d1d2f8c52
Some checks failed
continuous-integration/drone Build is failing
maj
2023-06-11 20:17:11 +02:00

50 lines
835 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _plugin() {
const data = require("@parcel/plugin");
_plugin = function () {
return data;
};
return data;
}
function _utils() {
const data = require("@parcel/utils");
_utils = function () {
return data;
};
return data;
}
var _native = require("../native");
var _default = new (_plugin().Optimizer)({
async optimize({
bundle,
contents
}) {
if (!bundle.env.shouldOptimize) {
return {
contents
};
}
let buffer = await (0, _utils().blobToBuffer)(contents);
let optimized = (0, _native.optimize)(bundle.type, buffer);
return {
contents: optimized.length < buffer.length ? optimized : buffer
};
}
});
exports.default = _default;