You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
"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;
|