UNPKG

683 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = getExisting;
7
8var _fs = _interopRequireDefault(require("fs"));
9
10function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12/**
13 * Creates an object that contains both source and minified (using the source as a fallback).
14 * e.g. builtins.min.js and builtins.js.
15 */
16function getExisting(minifiedPath, sourcePath) {
17 let source = _fs.default.readFileSync(sourcePath, 'utf8').trim();
18
19 return {
20 source,
21 minified: _fs.default.existsSync(minifiedPath) ? _fs.default.readFileSync(minifiedPath, 'utf8').trim().replace(/;$/, '') : source
22 };
23}
\No newline at end of file