From 1dd828aeaecee492e0955664871315df56d1092f Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Wed, 11 Dec 2024 17:40:51 -0600 Subject: [PATCH] Fixes #3584 --- package-lock.json | 8 +------- package.json | 1 - src/TemplateContent.js | 18 ------------------ 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f6b120ad..682113597 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,6 @@ "@11ty/recursive-copy": "^3.0.1", "@sindresorhus/slugify": "^2.2.1", "bcp-47-normalize": "^2.3.0", - "chardet": "^2.0.0", "chokidar": "^3.6.0", "cross-spawn": "^7.0.6", "debug": "^4.3.7", @@ -41,6 +40,7 @@ "moo": "^0.5.2", "node-retrieve-globals": "^6.0.0", "nunjucks": "^3.2.4", + "p-map": "^7.0.2", "please-upgrade-node": "^3.2.0", "posthtml": "^0.16.6", "posthtml-match-helper": "^2.0.2", @@ -2823,11 +2823,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chardet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.0.0.tgz", - "integrity": "sha512-xVgPpulCooDjY6zH4m9YW3jbkaBe3FKIAvF5sj5t7aBNsVl2ljIE+xwJ4iNgiDZHFQvNIpjdKdVOQvvk5ZfxbQ==" - }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -7070,7 +7065,6 @@ "version": "7.0.2", "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.2.tgz", "integrity": "sha512-z4cYYMMdKHzw4O5UkWJImbZynVIo0lSGTXc7bzB1e/rrDqkgGUNysK/o4bTr+0+xKvvLoTyGqYC4Fgljy9qe1Q==", - "dev": true, "engines": { "node": ">=18" }, diff --git a/package.json b/package.json index ebcac0471..0ab60dfb2 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,6 @@ "@11ty/recursive-copy": "^3.0.1", "@sindresorhus/slugify": "^2.2.1", "bcp-47-normalize": "^2.3.0", - "chardet": "^2.0.0", "chokidar": "^3.6.0", "cross-spawn": "^7.0.6", "debug": "^4.3.7", diff --git a/src/TemplateContent.js b/src/TemplateContent.js index 6e5fbe11a..a2077ed38 100644 --- a/src/TemplateContent.js +++ b/src/TemplateContent.js @@ -5,7 +5,6 @@ import matter from "gray-matter"; import lodash from "@11ty/lodash-custom"; import { TemplatePath } from "@11ty/eleventy-utils"; import debugUtil from "debug"; -import chardet from "chardet"; import EleventyExtensionMap from "./EleventyExtensionMap.js"; import TemplateData from "./Data/TemplateData.js"; @@ -18,7 +17,6 @@ import { withResolvers } from "./Util/PromiseUtil.js"; const { set: lodashSet } = lodash; const debug = debugUtil("Eleventy:TemplateContent"); -const debugDiagnostic = debugUtil("Eleventy:Diagnostics"); const debugDev = debugUtil("Dev:Eleventy:TemplateContent"); class TemplateContentConfigError extends EleventyBaseError {} @@ -305,22 +303,6 @@ class TemplateContent { if (!content && content !== "") { let contentBuffer = fs.readFileSync(this.inputPath); - if (process.env.DEBUG) { - // Warning: this is slow!! - let encoding = chardet.detect(contentBuffer); - - if (encoding.startsWith("UTF-16")) { - debug("Warning: %o encoding detected on %o.", encoding, this.inputPath); - debugDiagnostic( - "%o encoding detected on %o. Please re-save as UTF-8.", - encoding, - this.inputPath, - ); - } else { - debug("%o encoding detected on %o.", encoding, this.inputPath); - } - } - content = contentBuffer.toString("utf8"); if (this.config.useTemplateCache) {