UNPKG

@platform/react.ssr

Version:

A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.

35 lines (34 loc) 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var common_1 = require("../common"); function bundle(args) { return tslib_1.__awaiter(this, void 0, void 0, function () { var bundleDir, manifest, dirSize; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: bundleDir = args.bundleDir, manifest = args.manifest; return [4, common_1.fs.size.dir(bundleDir)]; case 1: dirSize = _a.sent(); common_1.log.info(); common_1.log.info.gray(" size: " + common_1.log.magenta(dirSize.toString())); common_1.log.info.gray(" dir: " + common_1.util.formatPath(bundleDir)); common_1.log.info(); manifest.files.forEach(function (file) { var name = file; name = name.endsWith('.js') ? common_1.log.yellow(name) : name; name = name.endsWith('.html') ? common_1.log.green(name) : name; var fileSize = dirSize.files.find(function (item) { return item.path.endsWith("/" + file); }); var size = fileSize ? fileSize.toString({ round: 0, spacer: '' }) : ''; size = (size + " ").substring(0, 8); common_1.log.info.gray(" - " + size + " " + name); }); common_1.log.info(); return [2]; } }); }); } exports.bundle = bundle;