1 parent
306d15fbe9
commit
de882505f0
1 file changed
+3
-4
@@ -68,12 +68,12 @@ async function createBundle(bundleConfig, cache, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const file = path.join("dist", output);
|
const file = path.join("dist", output);
|
||||||
const content = fs.readFileSync(file, "utf8");
|
|
||||||
|
|
||||||
// Files including U+FFEE can't load in Chrome Extension
|
// Files including U+FFEE can't load in Chrome Extension
|
||||||
// `prettier-chrome-extension` https://github.com/prettier/prettier-chrome-extension
|
// `prettier-chrome-extension` https://github.com/prettier/prettier-chrome-extension
|
||||||
// details https://github.com/prettier/prettier/pull/8534
|
// details https://github.com/prettier/prettier/pull/8534
|
||||||
if (target === "universal") {
|
if (target === "universal") {
|
||||||
|
const content = fs.readFileSync(file, "utf8");
|
||||||
if (content.includes("\ufffe")) {
|
if (content.includes("\ufffe")) {
|
||||||
throw new Error("Bundled umd file should not have U+FFFE character.");
|
throw new Error("Bundled umd file should not have U+FFFE character.");
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ async function createBundle(bundleConfig, cache, options) {
|
|||||||
|
|
||||||
const prettyBytes = require("pretty-bytes");
|
const prettyBytes = require("pretty-bytes");
|
||||||
const getSizeText = (file) => prettyBytes(fs.statSync(file).size);
|
const getSizeText = (file) => prettyBytes(fs.statSync(file).size);
|
||||||
const sizeTexts = [getSizeText(file, content)];
|
const sizeTexts = [getSizeText(file)];
|
||||||
if (
|
if (
|
||||||
type !== "core" &&
|
type !== "core" &&
|
||||||
format !== "esm" &&
|
format !== "esm" &&
|
||||||
@@ -94,8 +94,7 @@ async function createBundle(bundleConfig, cache, options) {
|
|||||||
target === "universal"
|
target === "universal"
|
||||||
) {
|
) {
|
||||||
const esmFile = path.join("dist/esm", output.replace(".js", ".mjs"));
|
const esmFile = path.join("dist/esm", output.replace(".js", ".mjs"));
|
||||||
const esmContent = fs.readFileSync(esmFile, "utf8");
|
sizeTexts.push(`esm ${getSizeText(esmFile)}`);
|
||||||
sizeTexts.push(`esm ${getSizeText(esmFile, esmContent)}`);
|
|
||||||
}
|
}
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
fitTerminal(output, sizeTexts.join(", ").concat(" "))
|
fitTerminal(output, sizeTexts.join(", ").concat(" "))
|
||||||
|
|||||||
Reference in new issue
Block a user