google-fonts-plugin
Version:
Webpack plugin that downloads fonts from Google Fonts and encodes them to base64.
46 lines • 1.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = require("axios");
const fs_1 = require("fs");
const path_1 = require("path");
const Plugin_1 = require("../Plugin/Plugin");
class Stats {
constructor() {
this.track = async (options) => {
let response = null;
try {
response = await axios_1.default({
method: 'POST',
baseURL: Stats.HOST,
url: Stats.PATH,
params: {
v: 1,
tid: Stats.UA_CODE,
cid: this.clientId,
t: 'event',
ec: Plugin_1.default.getPluginName(),
ea: 'initialize',
el: JSON.stringify({
version: JSON.parse(fs_1.readFileSync(path_1.resolve(__dirname, '..', '..', 'package.json'), 'utf8')).version,
fonts: options.fonts,
formats: options.formats,
fontDisplay: options.fontDisplay,
encode: options.encode,
cache: options.cache,
chunkName: options.chunkName,
filename: options.filename
})
}
});
}
catch (e) { }
return response !== null && response.status === 200;
};
this.clientId = new Date().getTime();
}
}
exports.default = Stats;
Stats.UA_CODE = 'UA-37249277-1';
Stats.HOST = 'https://www.google-analytics.com';
Stats.PATH = '/collect';
//# sourceMappingURL=Stats.js.map