From 4674c39da18d0ce7be38ceaef35f349aa942fb2b Mon Sep 17 00:00:00 2001 From: Zearin Date: Wed, 17 Apr 2024 19:58:40 -0400 Subject: [PATCH] =?UTF-8?q?refactor:=20Move=20data=20utils=20to=20?= =?UTF-8?q?=F0=9F=93=81`Data`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trying to keep all the data-related code in one place. --- src/{Util => Data}/GetJavaScriptData.js | 0 src/{Util => Data}/ReservedData.js | 0 src/Engines/Custom.js | 2 +- src/Engines/JavaScript.js | 2 +- src/Template.js | 4 ++-- test/ReservedDataTest.js | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename src/{Util => Data}/GetJavaScriptData.js (100%) rename src/{Util => Data}/ReservedData.js (100%) diff --git a/src/Util/GetJavaScriptData.js b/src/Data/GetJavaScriptData.js similarity index 100% rename from src/Util/GetJavaScriptData.js rename to src/Data/GetJavaScriptData.js diff --git a/src/Util/ReservedData.js b/src/Data/ReservedData.js similarity index 100% rename from src/Util/ReservedData.js rename to src/Data/ReservedData.js diff --git a/src/Engines/Custom.js b/src/Engines/Custom.js index 52251d8eb..59be3722d 100644 --- a/src/Engines/Custom.js +++ b/src/Engines/Custom.js @@ -1,5 +1,5 @@ import TemplateEngine from "./TemplateEngine.js"; -import getJavaScriptData from "../Util/GetJavaScriptData.js"; +import getJavaScriptData from "../Data/GetJavaScriptData.js"; import eventBus from "../EventBus.js"; let lastModifiedFile = undefined; diff --git a/src/Engines/JavaScript.js b/src/Engines/JavaScript.js index a6ddedc2b..687eb6175 100644 --- a/src/Engines/JavaScript.js +++ b/src/Engines/JavaScript.js @@ -2,7 +2,7 @@ import { TemplatePath } from "@11ty/eleventy-utils"; import TemplateEngine from "./TemplateEngine.js"; import EleventyBaseError from "../Errors/EleventyBaseError.js"; -import getJavaScriptData from "../Util/GetJavaScriptData.js"; +import getJavaScriptData from "../Data/GetJavaScriptData.js"; import EventBusUtil from "../Util/EventBusUtil.js"; import { EleventyImport } from "../Util/Require.js"; diff --git a/src/Template.js b/src/Template.js index ee17b8412..e0dcaba75 100755 --- a/src/Template.js +++ b/src/Template.js @@ -22,7 +22,7 @@ import TemplateBehavior from "./TemplateBehavior.js"; import TemplateContentPrematureUseError from "./Errors/TemplateContentPrematureUseError.js"; import TemplateContentUnrenderedTemplateError from "./Errors/TemplateContentUnrenderedTemplateError.js"; import EleventyBaseError from "./Errors/EleventyBaseError.js"; -import ReservedData from "./Util/ReservedData.js"; +import ReservedData from "./Data/ReservedData.js"; const { set: lodashSet, get: lodashGet } = lodash; const writeFile = util.promisify(fs.writeFile); @@ -390,7 +390,7 @@ class Template extends TemplateContent { let newDate = await this.getMappedDate(data); - // Make sure to keep these keys synchronized in src/Util/ReservedData.js + // Make sure to keep these keys synchronized in src/Data/ReservedData.js data.page.date = newDate; data.page.inputPath = this.inputPath; data.page.fileSlug = this.fileSlugStr; diff --git a/test/ReservedDataTest.js b/test/ReservedDataTest.js index f75c270b6..effe70cd1 100644 --- a/test/ReservedDataTest.js +++ b/test/ReservedDataTest.js @@ -1,5 +1,5 @@ import test from "ava"; -import ReservedData from "../src/Util/ReservedData.js"; +import ReservedData from "../src/Data/ReservedData.js"; test("No reserved Keys", t => { t.deepEqual(ReservedData.getReservedKeys({ key: {} }).sort(), []);