diff --git a/.editorconfig b/.editorconfig index 9fc871ce3..bbbe36d3f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,9 @@ charset = utf-8 [*.yml] indent_style = space +[/test/**/*] +indent_style = space + [/test/stubs*/**] insert_final_newline = false trim_trailing_whitespace = false diff --git a/src/Plugins/InputPathToUrl.js b/src/Plugins/InputPathToUrl.js index b4c107a06..a0e41a3e2 100644 --- a/src/Plugins/InputPathToUrl.js +++ b/src/Plugins/InputPathToUrl.js @@ -29,16 +29,12 @@ function FilterPlugin(eleventyConfig) { contentMap = inputPathToUrl; }); - let inputDir; - eleventyConfig.on("eleventy.directories", function ({ input }) { - inputDir = input; - }); - eleventyConfig.addFilter("inputPathToUrl", function (filepath) { if (!contentMap) { throw new Error("Internal error: contentMap not available for `inputPathToUrl` filter."); } + let inputDir = eleventyConfig.directories.input; filepath = normalizeInputPath(filepath, inputDir, contentMap); let urls = contentMap[filepath]; @@ -63,15 +59,11 @@ function TransformPlugin(eleventyConfig, defaultOptions = {}) { contentMap = inputPathToUrl; }); - let inputDir; - eleventyConfig.on("eleventy.directories", function ({ input }) { - inputDir = input; - }); - eleventyConfig.htmlTransformer.addUrlTransform(opts.extensions, function (filepathOrUrl) { if (!contentMap) { throw new Error("Internal error: contentMap not available for the `pathToUrl` Transform."); } + let inputDir = eleventyConfig.directories.input; filepathOrUrl = normalizeInputPath(filepathOrUrl, inputDir, contentMap); let urls = contentMap[filepathOrUrl]; diff --git a/src/TemplateConfig.js b/src/TemplateConfig.js index debd79031..a9ef1c6f5 100644 --- a/src/TemplateConfig.js +++ b/src/TemplateConfig.js @@ -376,7 +376,9 @@ class TemplateConfig { // Add the ProjectDirectories instance to the user accessible config. if (this.directories) { - mergedConfig.directories = this.directories.getUserspaceInstance(); + let dirs = this.directories.getUserspaceInstance(); + mergedConfig.directories = dirs; + this.userConfig.directories = dirs; } // Delay processing plugins until after the result of localConfig is returned diff --git a/src/TemplateRender.js b/src/TemplateRender.js index 6a7ef2178..9e4c5a3f0 100644 --- a/src/TemplateRender.js +++ b/src/TemplateRender.js @@ -1,5 +1,3 @@ -import { TemplatePath } from "@11ty/eleventy-utils"; - import EleventyBaseError from "./Errors/EleventyBaseError.js"; import EleventyExtensionMap from "./EleventyExtensionMap.js"; import CustomEngine from "./Engines/Custom.js"; diff --git a/test/InputPathToUrlPluginTest.js b/test/InputPathToUrlPluginTest.js index 0fdb54c2b..57c32a140 100644 --- a/test/InputPathToUrlPluginTest.js +++ b/test/InputPathToUrlPluginTest.js @@ -51,8 +51,6 @@ test("Using the transform (and the filter too)", async (t) => { }, }); - await elev.initializeConfig(); - elev.setIsVerbose(false); elev.disableLogger(); @@ -73,7 +71,6 @@ test("Using the filter", async (t) => { // FilterPlugin is available in the default config. configPath: false, }); - await elev.initializeConfig(); elev.setIsVerbose(false); elev.disableLogger(); @@ -98,7 +95,6 @@ test("Using the transform and the base plugin", async (t) => { eleventyConfig.addPlugin(HtmlBasePlugin); }, }); - await elev.initializeConfig(); elev.setIsVerbose(false); elev.disableLogger(); @@ -123,7 +119,6 @@ test("Using the transform and the base plugin, reverse order", async (t) => { eleventyConfig.addPlugin(TransformPlugin); }, }); - await elev.initializeConfig(); elev.setIsVerbose(false); elev.disableLogger(); diff --git a/test/TemplateRenderTest.js b/test/TemplateRenderTest.js index 68bfda3ab..d2de6564b 100644 --- a/test/TemplateRenderTest.js +++ b/test/TemplateRenderTest.js @@ -7,10 +7,10 @@ import { getTemplateConfigInstance } from "./_testHelpers.js"; async function getNewTemplateRender(name, inputDir) { let eleventyConfig = await getTemplateConfigInstance({ - dir: { - input: inputDir - } - }); + dir: { + input: inputDir + } + }); let tr = new TemplateRender(name, eleventyConfig); tr.extensionMap = new EleventyExtensionMap([], eleventyConfig);