author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
731
16.02.2019 15:02:06
-3,600
9a626b012b26407b1e87f37c12cea241beabfb0b
issue fixed, check for .gitignore empty and " " to take default Added tests: - test no .eleventyignore, .gitignore exists but empty - test .eleventyignore, .gitignore exists but empty - .gitignore with spaces takes default
[ { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -129,14 +129,20 @@ class EleventyFiles {\nlet dir = TemplatePath.getDirFromFilePath(ignorePath);\ndirs.push(dir);\n- if (fs.existsSync(ignorePath)) {\n+ if (fs.existsSync(ignorePath) && fs.statSync(ignorePath).size > 0) {\nfileFound = true;\nlet ignoreContent = fs.readFileSync(ignorePath, \"utf-8\");\n+\n+ // make sure that empty .gitignore with spaces takes default ignore.\n+ if (ignoreContent.trim().length === 0) {\n+ fileFound = false;\n+ } else {\nignores = ignores.concat(\nEleventyFiles.normalizeIgnoreContent(dir, ignoreContent)\n);\n}\n}\n+ }\nif (!fileFound && defaultIfFileDoesNotExist) {\nignores.push(\"!\" + TemplateGlob.normalizePath(defaultIfFileDoesNotExist));\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyFilesTest.js", "new_path": "test/EleventyFilesTest.js", "diff": "@@ -272,6 +272,84 @@ test(\"Get ignores (both .eleventyignore and .gitignore, using setUseGitIgnore(fa\n\"!./test/stubs/ignore4/_site/**\"\n]);\n});\n+\n+test(\"Get ignores (no .eleventyignore .gitignore exists but empty)\", t => {\n+ let evf = new EleventyFiles(\n+ \"test/stubs/ignore5\",\n+ \"test/stubs/ignore5/_site\",\n+ []\n+ );\n+ evf.init();\n+\n+ evf._setLocalPathRoot(\"./test/stubs/ignorelocalroot\");\n+\n+ t.deepEqual(evf.getIgnores(), [\n+ \"!./node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/node_modules/**\",\n+ \"!./test/stubs/ignore5/node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/test.md\",\n+ \"!./test/stubs/ignore5/_site/**\"\n+ ]);\n+});\n+\n+test(\"Get ignores (both .eleventyignore and .gitignore exists, but .gitignore is empty)\", t => {\n+ let evf = new EleventyFiles(\n+ \"test/stubs/ignore6\",\n+ \"test/stubs/ignore6/_site\",\n+ []\n+ );\n+ evf.init();\n+ evf._setLocalPathRoot(\"./test/stubs/ignorelocalroot\");\n+\n+ t.deepEqual(evf.getIgnores(), [\n+ \"!./node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/node_modules/**\",\n+ \"!./test/stubs/ignore6/node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/test.md\",\n+ \"!./test/stubs/ignore6/ignoredFolder/**\",\n+ \"!./test/stubs/ignore6/ignoredFolder/ignored.md\",\n+ \"!./test/stubs/ignore6/_site/**\"\n+ ]);\n+});\n+\n+test(\"Get ignores (no .eleventyignore .gitignore exists but has spaces inside)\", t => {\n+ let evf = new EleventyFiles(\n+ \"test/stubs/ignore7\",\n+ \"test/stubs/ignore7/_site\",\n+ []\n+ );\n+ evf.init();\n+\n+ evf._setLocalPathRoot(\"./test/stubs/ignorelocalroot\");\n+\n+ t.deepEqual(evf.getIgnores(), [\n+ \"!./node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/node_modules/**\",\n+ \"!./test/stubs/ignore7/node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/test.md\",\n+ \"!./test/stubs/ignore7/_site/**\"\n+ ]);\n+});\n+\n+test(\"Get ignores (both .eleventyignore and .gitignore exists, but .gitignore has spaces inside)\", t => {\n+ let evf = new EleventyFiles(\n+ \"test/stubs/ignore8\",\n+ \"test/stubs/ignore8/_site\",\n+ []\n+ );\n+ evf.init();\n+ evf._setLocalPathRoot(\"./test/stubs/ignorelocalroot\");\n+\n+ t.deepEqual(evf.getIgnores(), [\n+ \"!./node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/node_modules/**\",\n+ \"!./test/stubs/ignore8/node_modules/**\",\n+ \"!./test/stubs/ignorelocalroot/test.md\",\n+ \"!./test/stubs/ignore8/ignoredFolder/**\",\n+ \"!./test/stubs/ignore8/ignoredFolder/ignored.md\",\n+ \"!./test/stubs/ignore8/_site/**\"\n+ ]);\n+});\n/* End .eleventyignore and .gitignore combos */\ntest(\"getDataDir\", t => {\n" }, { "change_type": "ADD", "old_path": "test/stubs/ignore5/.gitignore", "new_path": "test/stubs/ignore5/.gitignore", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore5/ignoredFolder/ignored.md", "diff": "+# This should be ignored\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore6/.eleventyignore", "diff": "+ignoredFolder\n+./ignoredFolder/ignored.md\n+# This is a comment\n" }, { "change_type": "ADD", "old_path": "test/stubs/ignore6/.gitignore", "new_path": "test/stubs/ignore6/.gitignore", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore6/ignoredFolder/ignored.md", "diff": "+# This should be ignored\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore7/.gitignore", "diff": "+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore7/ignoredFolder/ignored.md", "diff": "+# This should be ignored\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore8/.eleventyignore", "diff": "+ignoredFolder\n+./ignoredFolder/ignored.md\n+# This is a comment\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore8/.gitignore", "diff": "+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/ignore8/ignoredFolder/ignored.md", "diff": "+# This should be ignored\n" } ]
JavaScript
MIT License
11ty/eleventy
issue #389 fixed, check for .gitignore empty and " " to take default Added tests: - test no .eleventyignore, .gitignore exists but empty - test .eleventyignore, .gitignore exists but empty - .gitignore with spaces takes default
699
16.03.2019 20:52:45
18,000
17fe483a04e1c7f76137c78e293460b25e94a662
Change TemplateLayoutPathResolver so that you pass in inputDir and it figures out the layouts directory internally.
[ { "change_type": "MODIFY", "old_path": "src/TemplateLayout.js", "new_path": "src/TemplateLayout.js", "diff": "@@ -12,13 +12,9 @@ class TemplateLayout extends TemplateContent {\nconstructor(key, inputDir) {\n// TODO getConfig() is duplicated in TemplateContent (super)\nlet cfg = config.getConfig();\n- let layoutsDir = TemplatePath.join(\n- inputDir,\n- cfg.dir.layouts || cfg.dir.includes\n- );\nlet resolvedPath = new TemplateLayoutPathResolver(\nkey,\n- layoutsDir\n+ inputDir\n).getFullPath();\nsuper(resolvedPath, inputDir);\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateLayoutPathResolver.js", "new_path": "src/TemplateLayoutPathResolver.js", "diff": "const fs = require(\"fs-extra\");\nconst config = require(\"./Config\");\nconst EleventyExtensionMap = require(\"./EleventyExtensionMap\");\n+const TemplatePath = require(\"./TemplatePath\");\nconst debug = require(\"debug\")(\"Eleventy:TemplateLayoutPathResolver\");\nclass TemplateLayoutPathResolver {\n- constructor(path, dir) {\n+ constructor(path, inputDir) {\nthis.config = config.getConfig();\n- this.dir = dir;\n+ this.inputDir = inputDir;\nthis.originalPath = path;\nthis.path = path;\nthis.aliases = {};\n@@ -14,6 +15,23 @@ class TemplateLayoutPathResolver {\nthis.init();\n}\n+ set config(cfg) {\n+ this._config = cfg;\n+ }\n+\n+ get config() {\n+ return this._config;\n+ }\n+\n+ set inputDir(dir) {\n+ this._inputDir = dir;\n+ this.dir = this.getLayoutsDir();\n+ }\n+\n+ get inputDir() {\n+ return this._inputDir;\n+ }\n+\ninit() {\n// we might be able to move this into the constructor?\nthis.aliases = Object.assign({}, this.config.layoutAliases, this.aliases);\n@@ -88,6 +106,20 @@ class TemplateLayoutPathResolver {\n}\n}\n}\n+\n+ getLayoutsDir() {\n+ let layoutsDir;\n+ if (\"layouts\" in this.config.dir) {\n+ layoutsDir = this.config.dir.layouts;\n+ } else if (\"includes\" in this.config.dir) {\n+ layoutsDir = this.config.dir.includes;\n+ } else {\n+ // Should this have a default?\n+ layoutsDir = \"_includes\";\n+ }\n+\n+ return TemplatePath.join(this.inputDir, layoutsDir);\n+ }\n}\nmodule.exports = TemplateLayoutPathResolver;\n" }, { "change_type": "RENAME", "old_path": "test/stubs/multiple.ejs", "new_path": "test/stubs/_includes/default.ejs", "diff": "" }, { "change_type": "RENAME", "old_path": "test/stubs/multiple.md", "new_path": "test/stubs/_includes/multiple.ejs", "diff": "" }, { "change_type": "ADD", "old_path": "test/stubs/_includes/multiple.md", "new_path": "test/stubs/_includes/multiple.md", "diff": "" } ]
JavaScript
MIT License
11ty/eleventy
Change TemplateLayoutPathResolver so that you pass in inputDir and it figures out the layouts directory internally.
699
16.03.2019 21:28:39
18,000
f5bd488d5da977b6078f2558d068d54dd07d7505
All of these getInputDir calls were incorrectly named.
[ { "change_type": "MODIFY", "old_path": "src/Engines/Ejs.js", "new_path": "src/Engines/Ejs.js", "diff": "const ejsLib = require(\"ejs\");\nconst TemplateEngine = require(\"./TemplateEngine\");\nconst config = require(\"../Config\");\n-const path = require(\"path\");\nclass Ejs extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.ejsOptions = {};\n@@ -27,13 +26,13 @@ class Ejs extends TemplateEngine {\n}\ngetEjsOptions() {\n- let inputDir = super.getInputDir();\n+ let includesDir = super.getIncludesDir();\nreturn Object.assign(\n{\n- root: \"./\" + inputDir,\n+ root: \"./\" + includesDir,\ncompileDebug: true,\n- filename: \"./\" + inputDir\n+ filename: \"./\" + includesDir\n},\nthis.ejsOptions || {}\n);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Haml.js", "new_path": "src/Engines/Haml.js", "diff": "@@ -3,8 +3,8 @@ const TemplateEngine = require(\"./TemplateEngine\");\nconst config = require(\"../Config\");\nclass Haml extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.setLibrary(this.config.libraryOverrides.haml);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Handlebars.js", "new_path": "src/Engines/Handlebars.js", "diff": "@@ -3,8 +3,8 @@ const TemplateEngine = require(\"./TemplateEngine\");\nconst config = require(\"../Config\");\nclass Handlebars extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.setLibrary(this.config.libraryOverrides.hbs);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Html.js", "new_path": "src/Engines/Html.js", "diff": "@@ -5,7 +5,7 @@ class Html extends TemplateEngine {\nif (preTemplateEngine) {\nlet engine = TemplateEngine.getEngine(\npreTemplateEngine,\n- super.getInputDir()\n+ super.getIncludesDir()\n);\nlet fn = await engine.compile(str, inputPath);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Liquid.js", "new_path": "src/Engines/Liquid.js", "diff": "@@ -4,8 +4,8 @@ const TemplateEngine = require(\"./TemplateEngine\");\n// const debug = require(\"debug\")(\"Eleventy:Liquid\");\nclass Liquid extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.liquidOptions = {};\n@@ -44,7 +44,7 @@ class Liquid extends TemplateEngine {\ngetLiquidOptions() {\nlet defaults = {\n- root: [super.getInputDir()],\n+ root: [super.getIncludesDir()],\nextname: \".liquid\",\ndynamicPartials: false,\nstrict_filters: false\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Markdown.js", "new_path": "src/Engines/Markdown.js", "diff": "@@ -4,8 +4,8 @@ const config = require(\"../Config\");\n// const debug = require(\"debug\")(\"Eleventy:Markdown\");\nclass Markdown extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.markdownOptions = {};\n@@ -51,7 +51,7 @@ class Markdown extends TemplateEngine {\nlet fn;\nlet engine = TemplateEngine.getEngine(\npreTemplateEngine,\n- super.getInputDir()\n+ super.getIncludesDir()\n);\nfn = await engine.compile(str, inputPath);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Mustache.js", "new_path": "src/Engines/Mustache.js", "diff": "@@ -3,8 +3,8 @@ const TemplateEngine = require(\"./TemplateEngine\");\nconst config = require(\"../Config\");\nclass Mustache extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.setLibrary(this.config.libraryOverrides.mustache);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Nunjucks.js", "new_path": "src/Engines/Nunjucks.js", "diff": "@@ -2,8 +2,8 @@ const NunjucksLib = require(\"nunjucks\");\nconst TemplateEngine = require(\"./TemplateEngine\");\nclass Nunjucks extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.setLibrary(this.config.libraryOverrides.njk);\n}\n@@ -12,7 +12,7 @@ class Nunjucks extends TemplateEngine {\nthis.njkEnv =\nenv ||\nnew NunjucksLib.Environment(\n- new NunjucksLib.FileSystemLoader(super.getInputDir())\n+ new NunjucksLib.FileSystemLoader(super.getIncludesDir())\n);\nthis.setEngineLib(this.njkEnv);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Pug.js", "new_path": "src/Engines/Pug.js", "diff": "@@ -3,8 +3,8 @@ const TemplateEngine = require(\"./TemplateEngine\");\nconst config = require(\"../Config\");\nclass Pug extends TemplateEngine {\n- constructor(name, inputDir) {\n- super(name, inputDir);\n+ constructor(name, includesDir) {\n+ super(name, includesDir);\nthis.pugOptions = {};\n@@ -22,12 +22,12 @@ class Pug extends TemplateEngine {\n}\ngetPugOptions() {\n- let inputDir = super.getInputDir();\n+ let includesDir = super.getIncludesDir();\nreturn Object.assign(\n{\n- basedir: inputDir,\n- filename: inputDir\n+ basedir: includesDir,\n+ filename: includesDir\n},\nthis.pugOptions || {}\n);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/TemplateEngine.js", "new_path": "src/Engines/TemplateEngine.js", "diff": "@@ -6,12 +6,12 @@ const config = require(\"../Config\");\nconst debug = require(\"debug\")(\"Eleventy:TemplateEngine\");\nclass TemplateEngine {\n- constructor(name, inputDir) {\n+ constructor(name, includesDir) {\nthis.name = name;\nthis.extensionMap = new EleventyExtensionMap();\nthis.extensions = this.extensionMap.getExtensionsFromKey(name);\n- this.inputDir = inputDir;\n+ this.includesDir = includesDir;\nthis.partialsHaveBeenCached = false;\nthis.partials = [];\nthis.engineLib = null;\n@@ -32,8 +32,8 @@ class TemplateEngine {\nreturn this.name;\n}\n- getInputDir() {\n- return this.inputDir;\n+ getIncludesDir() {\n+ return this.includesDir;\n}\n// TODO make async\n@@ -50,10 +50,10 @@ class TemplateEngine {\n// This only runs if getPartials() is called, which is only for Mustache/Handlebars\nthis.partialsHaveBeenCached = true;\nlet partials = {};\n- let prefix = this.inputDir + \"/**/*.\";\n+ let prefix = this.includesDir + \"/**/*.\";\n// TODO: reuse mustache partials in handlebars?\nlet partialFiles = [];\n- if (this.inputDir) {\n+ if (this.includesDir) {\nthis.extensions.forEach(function(extension) {\npartialFiles = partialFiles.concat(fastglob.sync(prefix + extension));\n});\n@@ -64,7 +64,7 @@ class TemplateEngine {\nfor (let j = 0, k = partialFiles.length; j < k; j++) {\nlet partialPath = TemplatePath.stripLeadingSubPath(\npartialFiles[j],\n- this.inputDir\n+ this.includesDir\n);\nlet partialPathNoExt = partialPath;\nthis.extensions.forEach(function(extension) {\n@@ -77,7 +77,7 @@ class TemplateEngine {\n}\ndebug(\n- `${this.inputDir}/*.{${this.extensions}} found partials for: %o`,\n+ `${this.includesDir}/*.{${this.extensions}} found partials for: %o`,\nObject.keys(partials)\n);\n@@ -131,15 +131,15 @@ class TemplateEngine {\nreturn name in TemplateEngine.templateKeyMapToClassName;\n}\n- static getEngine(name, inputDir) {\n+ static getEngine(name, includesDir) {\nif (!this.hasEngine(name)) {\nthrow new Error(\n- `Template Engine ${name} does not exist in getEngine (input dir: ${inputDir})`\n+ `Template Engine ${name} does not exist in getEngine (includes dir: ${includesDir})`\n);\n}\nconst cls = require(\"./\" + TemplateEngine.templateKeyMapToClassName[name]);\n- return new cls(name, inputDir);\n+ return new cls(name, includesDir);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateRender.js", "new_path": "src/TemplateRender.js", "diff": "@@ -20,7 +20,7 @@ class TemplateRender {\nthis.extensionMap = extensionMap;\n// optional\n- this.inputDir = this._normalizeInputDir(inputDir);\n+ this.includesDir = this._normalizeIncludesDir(inputDir);\nthis.parseMarkdownWith = this.config.markdownTemplateEngine;\nthis.parseHtmlWith = this.config.htmlTemplateEngine;\n@@ -52,7 +52,7 @@ class TemplateRender {\n`Unknown engine for ${engineNameOrPath}`\n);\n}\n- this.engine = TemplateEngine.getEngine(this.engineName, this.inputDir);\n+ this.engine = TemplateEngine.getEngine(this.engineName, this.includesDir);\nthis.engine.initRequireCache(this.path);\n}\n@@ -155,17 +155,17 @@ class TemplateRender {\nreturn this.engineName;\n}\n- _normalizeInputDir(dir) {\n+ getIncludesDir() {\n+ return this.includesDir;\n+ }\n+\n+ _normalizeIncludesDir(dir) {\nreturn TemplatePath.join(\ndir ? dir : this.config.dir.input,\nthis.config.dir.includes\n);\n}\n- getInputDir() {\n- return this.inputDir;\n- }\n-\nisEngine(engine) {\nreturn this.engineName === engine;\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderTest.js", "new_path": "test/TemplateRenderTest.js", "diff": "@@ -19,9 +19,9 @@ test(\"Basic\", t => {\nt.false(TemplateRender.hasEngine(\"sldkjfkldsj\"));\n});\n-test(\"Input Dir\", async t => {\n+test(\"Includes Dir\", async t => {\nt.is(\n- new TemplateRender(\"ejs\", \"./test/stubs\").getInputDir(),\n+ new TemplateRender(\"ejs\", \"./test/stubs\").getIncludesDir(),\n\"test/stubs/_includes\"\n);\n});\n" } ]
JavaScript
MIT License
11ty/eleventy
All of these getInputDir calls were incorrectly named.
699
16.03.2019 21:29:51
18,000
82ce52ec18f17283c8b94674a2fb2880e3176e00
Adds tests for when a layouts folder exists.
[ { "change_type": "MODIFY", "old_path": "src/TemplateLayoutPathResolver.js", "new_path": "src/TemplateLayoutPathResolver.js", "diff": "@@ -6,7 +6,7 @@ const debug = require(\"debug\")(\"Eleventy:TemplateLayoutPathResolver\");\nclass TemplateLayoutPathResolver {\nconstructor(path, inputDir) {\n- this.config = config.getConfig();\n+ this._config = config.getConfig();\nthis.inputDir = inputDir;\nthis.originalPath = path;\nthis.path = path;\n@@ -15,14 +15,6 @@ class TemplateLayoutPathResolver {\nthis.init();\n}\n- set config(cfg) {\n- this._config = cfg;\n- }\n-\n- get config() {\n- return this._config;\n- }\n-\nset inputDir(dir) {\nthis._inputDir = dir;\nthis.dir = this.getLayoutsDir();\n@@ -32,6 +24,17 @@ class TemplateLayoutPathResolver {\nreturn this._inputDir;\n}\n+ // for testing\n+ set config(cfg) {\n+ this._config = cfg;\n+ this.dir = this.getLayoutsDir();\n+ this.init();\n+ }\n+\n+ get config() {\n+ return this._config;\n+ }\n+\ninit() {\n// we might be able to move this into the constructor?\nthis.aliases = Object.assign({}, this.config.layoutAliases, this.aliases);\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateLayoutPathResolverTest.js", "new_path": "test/TemplateLayoutPathResolverTest.js", "diff": "@@ -15,6 +15,35 @@ test(\"Layout already has extension\", t => {\n);\n});\n+test(\"Layout (uses layouts folder)\", t => {\n+ let res = new TemplateLayoutPathResolver(\"layoutsdefault\", \"./test/stubs\");\n+ res.config = {\n+ templateFormats: [\"ejs\"],\n+ dir: {\n+ layouts: \"_layouts\",\n+ includes: \"_includes\"\n+ }\n+ };\n+\n+ t.is(res.getFileName(), \"layoutsdefault.ejs\");\n+});\n+\n+test(\"Layout (uses layouts folder) already has extension\", t => {\n+ let res = new TemplateLayoutPathResolver(\n+ \"layoutsdefault.ejs\",\n+ \"./test/stubs\"\n+ );\n+ res.config = {\n+ templateFormats: [\"ejs\"],\n+ dir: {\n+ layouts: \"_layouts\",\n+ includes: \"_includes\"\n+ }\n+ };\n+\n+ t.is(res.getFileName(), \"layoutsdefault.ejs\");\n+});\n+\ntest(\"Layout subdir\", t => {\nt.is(\nnew TemplateLayoutPathResolver(\n" }, { "change_type": "ADD", "old_path": "test/stubs/_layouts/layoutsdefault.ejs", "new_path": "test/stubs/_layouts/layoutsdefault.ejs", "diff": "" } ]
JavaScript
MIT License
11ty/eleventy
Adds tests for when a layouts folder exists.
699
16.03.2019 21:36:56
18,000
e59bcfcdfddae96afaa4efc6d4b7f4e801b6d0ab
Add tests for empty string layouts and empty string includes folders.
[ { "change_type": "MODIFY", "old_path": "test/TemplateLayoutPathResolverTest.js", "new_path": "test/TemplateLayoutPathResolverTest.js", "diff": "@@ -15,6 +15,36 @@ test(\"Layout already has extension\", t => {\n);\n});\n+test(\"Layout (uses empty string includes folder)\", t => {\n+ let res = new TemplateLayoutPathResolver(\n+ \"includesemptystring\",\n+ \"./test/stubs\"\n+ );\n+ res.config = {\n+ templateFormats: [\"ejs\"],\n+ dir: {\n+ includes: \"\"\n+ }\n+ };\n+\n+ t.is(res.getFileName(), \"includesemptystring.ejs\");\n+});\n+\n+test(\"Layout (uses empty string includes folder) already has extension\", t => {\n+ let res = new TemplateLayoutPathResolver(\n+ \"includesemptystring.ejs\",\n+ \"./test/stubs\"\n+ );\n+ res.config = {\n+ templateFormats: [\"ejs\"],\n+ dir: {\n+ includes: \"\"\n+ }\n+ };\n+\n+ t.is(res.getFileName(), \"includesemptystring.ejs\");\n+});\n+\ntest(\"Layout (uses layouts folder)\", t => {\nlet res = new TemplateLayoutPathResolver(\"layoutsdefault\", \"./test/stubs\");\nres.config = {\n@@ -44,6 +74,38 @@ test(\"Layout (uses layouts folder) already has extension\", t => {\nt.is(res.getFileName(), \"layoutsdefault.ejs\");\n});\n+test(\"Layout (uses empty string layouts folder)\", t => {\n+ let res = new TemplateLayoutPathResolver(\n+ \"layoutsemptystring\",\n+ \"./test/stubs\"\n+ );\n+ res.config = {\n+ templateFormats: [\"ejs\"],\n+ dir: {\n+ layouts: \"\",\n+ includes: \"_includes\"\n+ }\n+ };\n+\n+ t.is(res.getFileName(), \"layoutsemptystring.ejs\");\n+});\n+\n+test(\"Layout (uses empty string layouts folder) already has extension\", t => {\n+ let res = new TemplateLayoutPathResolver(\n+ \"layoutsemptystring.ejs\",\n+ \"./test/stubs\"\n+ );\n+ res.config = {\n+ templateFormats: [\"ejs\"],\n+ dir: {\n+ layouts: \"\",\n+ includes: \"_includes\"\n+ }\n+ };\n+\n+ t.is(res.getFileName(), \"layoutsemptystring.ejs\");\n+});\n+\ntest(\"Layout subdir\", t => {\nt.is(\nnew TemplateLayoutPathResolver(\n" }, { "change_type": "ADD", "old_path": "test/stubs/includesemptystring.ejs", "new_path": "test/stubs/includesemptystring.ejs", "diff": "" }, { "change_type": "ADD", "old_path": "test/stubs/layoutsemptystring.ejs", "new_path": "test/stubs/layoutsemptystring.ejs", "diff": "" } ]
JavaScript
MIT License
11ty/eleventy
Add tests for empty string layouts and empty string includes folders.
699
22.03.2019 20:19:56
18,000
d75a04e1daa25bdd709e507531f1b96a8ef0f1bb
Adds another test for
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderHandlebarsTest.js", "new_path": "test/TemplateRenderHandlebarsTest.js", "diff": "@@ -152,6 +152,23 @@ test(\"Handlebars Render Paired Shortcode\", async t => {\nt.is(await fn({ name: \"Howdy\" }), \"<p>This is a TESTINGHOWDY.</p>\");\n});\n+test(\"Handlebars Render Paired Shortcode (HTML)\", async t => {\n+ let tr = new TemplateRender(\"hbs\");\n+ tr.engine.addPairedShortcodes({\n+ shortcodename3html: function(content, name, options) {\n+ return `<span>${(content + name).toUpperCase()}</span>`;\n+ }\n+ });\n+\n+ let fn = await tr.getCompiledTemplate(\n+ \"<p>This is a {{#shortcodename3html name}}<span>Testing</span>{{/shortcodename3html}}.</p>\"\n+ );\n+ t.is(\n+ await fn({ name: \"Howdy\" }),\n+ \"<p>This is a <span><SPAN>TESTING</SPAN>HOWDY</span>.</p>\"\n+ );\n+});\n+\ntest(\"Handlebars Render Paired Shortcode (Spaces)\", async t => {\nlet tr = new TemplateRender(\"hbs\");\ntr.engine.addPairedShortcodes({\n" } ]
JavaScript
MIT License
11ty/eleventy
Adds another test for #460
699
22.03.2019 22:03:55
18,000
0ee0282f27aa43f14e2732cc30c7f3620ebbdbec
Test cases for and
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "@@ -27,6 +27,39 @@ test(\"Nunjucks Render Include\", async t => {\nt.is(await fn(), \"<p>This is an include.</p>\");\n});\n+test(\"Nunjucks Render Include a JS file (Issue 398)\", async t => {\n+ let tr = new TemplateRender(\"njk\", \"test/stubs\");\n+ let engine = tr.engine;\n+ engine.addFilters({\n+ jsmin: function(str) {\n+ return str;\n+ }\n+ });\n+ let fn = await tr.getCompiledTemplate(\n+ \"{% set ga %}{% include 'test.js' %}{% endset %}{{ ga | safe | jsmin }}\"\n+ );\n+ t.is(\n+ await fn(),\n+ `/**\n+ * Copyright 2015 Google Inc. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+alert(\"Issue #398\");\n+`\n+ );\n+});\n+\ntest(\"Nunjucks Render Include Subfolder\", async t => {\nlet fn = await new TemplateRender(\"njk\", \"test/stubs\").getCompiledTemplate(\n\"<p>{% include 'subfolder/included.html' %}</p>\"\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1604,3 +1604,14 @@ test(\"Throws a Premature Template Content Error (haml)\", async t => {\n});\nt.is(EleventyErrorUtil.isPrematureTemplateContentError(error), true);\n});\n+\n+test.skip(\"Issue 413 weird date format\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs-413/date-frontmatter.md\",\n+ \"./test/stubs-413/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ t.is(data.page.date, \"\");\n+});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs-413/date-frontmatter.md", "diff": "+---\n+subtitle: New doc page\n+date: 2019-03-13 20:18:42 +0000\n+tags:\n+ - docs\n+---\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/_includes/test.js", "diff": "+/**\n+ * Copyright 2015 Google Inc. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+alert(\"Issue #398\");\n" } ]
JavaScript
MIT License
11ty/eleventy
Test cases for #398 and #413
699
28.03.2019 20:32:42
18,000
cff8446a751ee49816f35bb78b37e2e6c2c25c06
Updates a few deps minor versions
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"devDependencies\": {\n\"@11ty/eleventy-plugin-syntaxhighlight\": \"^2.0.1\",\n- \"ava\": \"^1.3.1\",\n+ \"ava\": \"^1.4.1\",\n\"husky\": \"^1.3.1\",\n- \"lint-staged\": \"^8.1.0\",\n+ \"lint-staged\": \"^8.1.5\",\n\"markdown-it-emoji\": \"^1.4.0\",\n\"nyc\": \"^13.3.0\",\n- \"prettier\": \"^1.15.3\",\n+ \"prettier\": \"^1.16.4\",\n\"viperhtml\": \"^2.17.0\",\n- \"vue\": \"^2.5.22\",\n- \"vue-server-renderer\": \"^2.5.22\"\n+ \"vue\": \"^2.6.10\",\n+ \"vue-server-renderer\": \"^2.6.10\"\n},\n\"dependencies\": {\n\"browser-sync\": \"^2.26.3\",\n\"chalk\": \"^2.4.2\",\n- \"chokidar\": \"^2.0.4\",\n+ \"chokidar\": \"^2.1.5\",\n\"debug\": \"^4.1.1\",\n\"dependency-graph\": \"^0.8.0\",\n\"dependency-tree\": \"^6.3.0\",\n\"ejs\": \"^2.6.1\",\n\"fast-glob\": \"^2.2.6\",\n\"fs-extra\": \"^7.0.1\",\n- \"gray-matter\": \"^4.0.1\",\n+ \"gray-matter\": \"^4.0.2\",\n\"hamljs\": \"^0.6.2\",\n- \"handlebars\": \"^4.1.0\",\n\"javascript-stringify\": \"^1.6.0\",\n\"liquidjs\": \"^6.2.0\",\n+ \"handlebars\": \"^4.1.1\",\n\"lodash\": \"^4.17.11\",\n- \"luxon\": \"^1.9.0\",\n+ \"luxon\": \"^1.12.0\",\n\"markdown-it\": \"^8.4.2\",\n\"minimist\": \"^1.2.0\",\n\"moo\": \"^0.5.0\",\n\"multimatch\": \"^3.0.0\",\n\"mustache\": \"^2.3.0\",\n\"normalize-path\": \"^3.0.0\",\n- \"nunjucks\": \"^3.1.7\",\n+ \"nunjucks\": \"^3.2.0\",\n\"parse-filepath\": \"^1.0.2\",\n\"please-upgrade-node\": \"^3.1.1\",\n\"pretty\": \"^2.0.0\",\n\"pug\": \"^2.0.3\",\n- \"recursive-copy\": \"^2.0.9\",\n\"semver\": \"^5.6.0\",\n+ \"recursive-copy\": \"^2.0.10\",\n\"slugify\": \"^1.3.4\",\n\"time-require\": \"^0.1.2\",\n\"valid-url\": \"^1.0.9\"\n" } ]
JavaScript
MIT License
11ty/eleventy
Updates a few deps minor versions
699
28.03.2019 20:41:16
18,000
04fd05a62043aa3bad7be243294a8ae97f7b9e0b
Major release update javascript-stringify 1.6 -> 2.0 (rewrite in TypeScript, changes API signature)
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"fs-extra\": \"^7.0.1\",\n\"gray-matter\": \"^4.0.2\",\n\"hamljs\": \"^0.6.2\",\n- \"javascript-stringify\": \"^1.6.0\",\n- \"liquidjs\": \"^6.2.0\",\n\"handlebars\": \"^4.1.1\",\n+ \"javascript-stringify\": \"^2.0.0\",\n+ \"liquidjs\": \"^6.2.0\",\n\"lodash\": \"^4.17.11\",\n\"luxon\": \"^1.12.0\",\n\"markdown-it\": \"^8.4.2\",\n\"please-upgrade-node\": \"^3.1.1\",\n\"pretty\": \"^2.0.0\",\n\"pug\": \"^2.0.3\",\n- \"semver\": \"^5.6.0\",\n\"recursive-copy\": \"^2.0.10\",\n+ \"semver\": \"^5.6.0\",\n\"slugify\": \"^1.3.4\",\n\"time-require\": \"^0.1.2\",\n\"valid-url\": \"^1.0.9\"\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/JavaScriptTemplateLiteral.js", "new_path": "src/Engines/JavaScriptTemplateLiteral.js", "diff": "-const stringify = require(\"javascript-stringify\");\n+const javascriptStringify = require(\"javascript-stringify\");\nconst TemplateEngine = require(\"./TemplateEngine\");\nconst EleventyBaseError = require(\"../EleventyBaseError\");\n@@ -33,9 +33,14 @@ class JavaScriptTemplateLiteral extends TemplateEngine {\n// avoid `with`\nlet dataStr = \"\";\nfor (let j in data) {\n- dataStr += `let ${j} = ${stringify(data[j], null, null, {\n+ dataStr += `let ${j} = ${javascriptStringify.stringify(\n+ data[j],\n+ null,\n+ null,\n+ {\nreferences: true\n- })};\\n`;\n+ }\n+ )};\\n`;\n}\nlet evalStr = `${dataStr}\\n${JavaScriptTemplateLiteral.normalizeTicks(\n" } ]
JavaScript
MIT License
11ty/eleventy
Major release update javascript-stringify 1.6 -> 2.0 (rewrite in TypeScript, changes API signature)
699
28.03.2019 20:44:12
18,000
ed922d62034e26fd7f70e8ebf8e5b0678b202e7c
semver major version update (should have no affect)
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"pretty\": \"^2.0.0\",\n\"pug\": \"^2.0.3\",\n\"recursive-copy\": \"^2.0.10\",\n- \"semver\": \"^5.6.0\",\n+ \"semver\": \"^6.0.0\",\n\"slugify\": \"^1.3.4\",\n\"time-require\": \"^0.1.2\",\n\"valid-url\": \"^1.0.9\"\n" } ]
JavaScript
MIT License
11ty/eleventy
semver major version update (should have no affect) https://github.com/npm/node-semver/blob/master/CHANGELOG.md#60
699
28.03.2019 21:01:54
18,000
fac2861fc4ad5fec79077b01fc7e6462b1457426
Updates liquidjs (minor version)
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"hamljs\": \"^0.6.2\",\n\"handlebars\": \"^4.1.1\",\n\"javascript-stringify\": \"^2.0.0\",\n- \"liquidjs\": \"^6.2.0\",\n+ \"liquidjs\": \"^6.4.3\",\n\"lodash\": \"^4.17.11\",\n\"luxon\": \"^1.12.0\",\n\"markdown-it\": \"^8.4.2\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Updates liquidjs (minor version)
699
05.04.2019 22:32:40
18,000
2ab149e74fcdb0419ad77e36cfe3e1d3311d274f
Fix jenkins builds (just ordering problems in the tests)
[ { "change_type": "MODIFY", "old_path": "test/TemplateMapTest.js", "new_path": "test/TemplateMapTest.js", "diff": "@@ -897,20 +897,22 @@ test(\"Paginate over collections.all\", async t => {\nlet collections = await tm.getCollectionsData();\nt.is(collections.all.length, 4);\nt.is(\n- collections.all[0].inputPath,\n- \"./test/stubs/templateMapCollection/test1.md\"\n+ collections.all.filter(function(entry) {\n+ return entry.inputPath.endsWith(\"test1.md\");\n+ }).length,\n+ 1\n);\nt.is(\n- collections.all[1].inputPath,\n- \"./test/stubs/templateMapCollection/test2.md\"\n+ collections.all.filter(function(entry) {\n+ return entry.inputPath.endsWith(\"test2.md\");\n+ }).length,\n+ 1\n);\nt.is(\n- collections.all[2].inputPath,\n- \"./test/stubs/page-target-collections/paginateall.njk\"\n- );\n- t.is(\n- collections.all[3].inputPath,\n- \"./test/stubs/page-target-collections/paginateall.njk\"\n+ collections.all.filter(function(entry) {\n+ return entry.inputPath.endsWith(\"paginateall.njk\");\n+ }).length,\n+ 2\n);\nlet map = tm.getMap();\n" } ]
JavaScript
MIT License
11ty/eleventy
Fix jenkins builds (just ordering problems in the tests)
699
09.04.2019 22:12:53
18,000
1abdedf8349a6babfe9849311fd85515900bd302
A few more linter/transform tests.
[ { "change_type": "MODIFY", "old_path": "src/Template.js", "new_path": "src/Template.js", "diff": "@@ -525,7 +525,7 @@ class Template extends TemplateContent {\n);\ncontent = await layout.render(page.data, page.templateContent);\nawait this.runLinters(content, page.inputPath, page.outputPath);\n- content = await this.runTransforms(content, page.outputPath);\n+ content = await this.runTransforms(content, page.outputPath); // pass in page.inputPath?\nreturn content;\n} else {\ncontent = page.templateContent;\n@@ -534,7 +534,7 @@ class Template extends TemplateContent {\npage.inputPath,\npage.outputPath\n);\n- content = await this.runTransforms(content, page.outputPath);\n+ content = await this.runTransforms(content, page.outputPath); // pass in page.inputPath?\n}\nreturn content;\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateMapTest.js", "new_path": "test/TemplateMapTest.js", "diff": "@@ -959,15 +959,24 @@ test(\"Paginate over collections.all WITH a paginate over collections (tag pages)\n});\ntest(\"Test a transform with a layout (via templateMap)\", async t => {\n- t.plan(3);\n+ t.plan(7);\nlet tm = new TemplateMap();\nlet tmpl = new Template(\n\"./test/stubs-475/transform-layout/transform-layout.njk\",\n\"./test/stubs-475/\",\n\"./test/stubs-475/_site\"\n);\n- tmpl.addTransform(function(content) {\n- t.is(content, `<html><body>This is content.</body></html>`);\n+\n+ tmpl.addLinter(function(content, inputPath, outputPath) {\n+ // should be pre-transform content\n+ t.is(content, \"<html><body>This is content.</body></html>\");\n+ t.true(inputPath.endsWith(\"transform-layout.njk\"));\n+ t.true(outputPath.endsWith(\"transform-layout/index.html\"));\n+ });\n+\n+ tmpl.addTransform(function(content, outputPath) {\n+ t.is(content, \"<html><body>This is content.</body></html>\");\n+ t.true(outputPath.endsWith(\"transform-layout/index.html\"));\nreturn \"OVERRIDE BY A TRANSFORM\";\n});\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1057,13 +1057,16 @@ test(\"renderContent on a markdown file, permalink should not render markdown (ha\n/* Transforms */\ntest(\"Test a transform\", async t => {\n+ t.plan(2);\n+\nlet tmpl = new Template(\n\"./test/stubs/template.ejs\",\n\"./test/stubs/\",\n\"./test/stubs/_site\"\n);\n- tmpl.addTransform(function() {\n+ tmpl.addTransform(function(content, outputPath) {\n+ t.true(outputPath.endsWith(\".html\"));\nreturn \"OVERRIDE BY A TRANSFORM\";\n});\n@@ -1072,13 +1075,18 @@ test(\"Test a transform\", async t => {\n});\ntest(\"Test a transform with pages\", async t => {\n+ t.plan(5);\n+\nlet tmpl = new Template(\n\"./test/stubs/transform-pages/template.njk\",\n\"./test/stubs/\",\n\"./test/stubs/_site\"\n);\n- tmpl.addTransform(function() {\n+ tmpl.addTransform(function(content, outputPath) {\n+ // should run twice, one for each page\n+ t.true(content.length > 0);\n+ t.true(outputPath.endsWith(\".html\"));\nreturn \"OVERRIDE BY A TRANSFORM\";\n});\n@@ -1087,7 +1095,7 @@ test(\"Test a transform with pages\", async t => {\n});\ntest(\"Test a transform with a layout\", async t => {\n- t.plan(2);\n+ t.plan(3);\nlet tmpl = new Template(\n\"./test/stubs-475/transform-layout/transform-layout.njk\",\n@@ -1095,8 +1103,9 @@ test(\"Test a transform with a layout\", async t => {\n\"./test/stubs-475/_site\"\n);\n- tmpl.addTransform(function(content) {\n- t.is(content, `<html><body>This is content.</body></html>`);\n+ tmpl.addTransform(function(content, outputPath) {\n+ t.is(content, \"<html><body>This is content.</body></html>\");\n+ t.true(outputPath.endsWith(\".html\"));\nreturn \"OVERRIDE BY A TRANSFORM\";\n});\n@@ -1105,15 +1114,19 @@ test(\"Test a transform with a layout\", async t => {\n});\ntest(\"Test a single asynchronous transform\", async t => {\n+ t.plan(2);\n+\nlet tmpl = new Template(\n\"./test/stubs/template.ejs\",\n\"./test/stubs/\",\n\"./test/stubs/_site\"\n);\n- tmpl.addTransform(async function() {\n+ tmpl.addTransform(async function(content, outputPath) {\n+ t.true(outputPath.endsWith(\"template/index.html\"));\n+\nreturn new Promise((resolve, reject) => {\n- setTimeout(function(str, outputPath, inputPath) {\n+ setTimeout(function(str, outputPath) {\nresolve(\"OVERRIDE BY A TRANSFORM\");\n}, 50);\n});\n@@ -1124,22 +1137,28 @@ test(\"Test a single asynchronous transform\", async t => {\n});\ntest(\"Test multiple asynchronous transforms\", async t => {\n+ t.plan(3);\n+\nlet tmpl = new Template(\n\"./test/stubs/template.ejs\",\n\"./test/stubs/\",\n\"./test/stubs/_site\"\n);\n- tmpl.addTransform(async function() {\n+ tmpl.addTransform(async function(content, outputPath) {\n+ t.true(outputPath.endsWith(\"template/index.html\"));\n+\nreturn new Promise((resolve, reject) => {\n- setTimeout(function(str, outputPath, inputPath) {\n+ setTimeout(function(str, outputPath) {\nresolve(\"lowercase transform\");\n}, 50);\n});\n});\n// uppercase\n- tmpl.addTransform(async function(str, outputPath, inputPath) {\n+ tmpl.addTransform(async function(str, outputPath) {\n+ t.true(outputPath.endsWith(\"template/index.html\"));\n+\nreturn new Promise((resolve, reject) => {\nsetTimeout(function() {\nresolve(str.toUpperCase());\n@@ -1152,22 +1171,20 @@ test(\"Test multiple asynchronous transforms\", async t => {\n});\ntest(\"Test a linter\", async t => {\n+ t.plan(4);\n+\nlet tmpl = new Template(\n\"./test/stubs/transform-pages/template.njk\",\n\"./test/stubs/\",\n\"./test/stubs/_site\"\n);\n- tmpl.addLinter(function(str) {\n- throw new Error(\"this is a lint rule\");\n+ tmpl.addLinter(function(str, inputPath, outputPath) {\n+ t.true(inputPath.endsWith(\"template.njk\"));\n+ t.true(outputPath.endsWith(\"index.html\"));\n});\n- try {\nawait tmpl._testCompleteRender();\n- t.fail(\"Should have errored\");\n- } catch (e) {\n- t.pass(\"Threw an error:\" + e);\n- }\n});\ntest(\"permalink: false\", async t => {\n" } ]
JavaScript
MIT License
11ty/eleventy
A few more linter/transform tests.
704
11.04.2019 06:25:32
14,400
19501f5337bc65370119146ecd9dd3bb21181b49
forces uses of posix path separator in url normalization
[ { "change_type": "MODIFY", "old_path": "src/TemplatePath.js", "new_path": "src/TemplatePath.js", "diff": "@@ -121,7 +121,7 @@ TemplatePath.join = function(...paths) {\n* @returns {String} a normalized URL path described by the given URL path segments.\n*/\nTemplatePath.normalizeUrlPath = function(...urlPaths) {\n- const urlPath = path.join(...urlPaths);\n+ const urlPath = path.posix.join(...urlPaths);\nreturn urlPath.replace(/\\/+$/, \"/\");\n};\n" } ]
JavaScript
MIT License
11ty/eleventy
forces uses of posix path separator in url normalization
699
11.04.2019 10:30:21
18,000
f452534ba9cbee92f8f9e22e8fd08fcffc932755
Updates license year
[ { "change_type": "MODIFY", "old_path": "LICENSE", "new_path": "LICENSE", "diff": "MIT License\n-Copyright (c) 2018 Zach Leatherman @zachleat\n+Copyright (c) 2019 Zach Leatherman @zachleat\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\n" } ]
JavaScript
MIT License
11ty/eleventy
Updates license year
699
11.04.2019 10:57:04
18,000
ec6e7636b975816aab0c76e9575633cb351e1fbe
The only remaining test failure for Windows per
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "@@ -39,12 +39,10 @@ test(\"Nunjucks Render Include a JS file (Issue 398)\", async t => {\n\"{% set ga %}{% include 'test.js' %}{% endset %}{{ ga | safe | jsmin }}\"\n);\nt.is(\n- await fn(),\n+ (await fn()).trim(),\n`/**\n* THIS IS A COMMENT\n- */\n-alert(\"Issue #398\");\n-`\n+ */ alert(\"Issue #398\");`\n);\n});\n" }, { "change_type": "MODIFY", "old_path": "test/stubs/_includes/test.js", "new_path": "test/stubs/_includes/test.js", "diff": "/**\n* THIS IS A COMMENT\n- */\n-alert(\"Issue #398\");\n+ */ alert(\"Issue #398\");\n" } ]
JavaScript
MIT License
11ty/eleventy
The only remaining test failure for Windows per https://travis-ci.org/11ty/eleventy/jobs/518833095 #353
699
11.04.2019 11:09:04
18,000
90b75df8e4c6b842d7183d0d0527e233363c1255
Ugh, okay one more time for
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "@@ -38,12 +38,7 @@ test(\"Nunjucks Render Include a JS file (Issue 398)\", async t => {\nlet fn = await tr.getCompiledTemplate(\n\"{% set ga %}{% include 'test.js' %}{% endset %}{{ ga | safe | jsmin }}\"\n);\n- t.is(\n- (await fn()).trim(),\n- `/**\n- * THIS IS A COMMENT\n- */ alert(\"Issue #398\");`\n- );\n+ t.is((await fn()).trim(), `/* THIS IS A COMMENT */ alert(\"Issue #398\");`);\n});\ntest(\"Nunjucks Render Include Subfolder\", async t => {\n" }, { "change_type": "MODIFY", "old_path": "test/stubs/_includes/test.js", "new_path": "test/stubs/_includes/test.js", "diff": "-/**\n- * THIS IS A COMMENT\n- */ alert(\"Issue #398\");\n+/* THIS IS A COMMENT */ alert(\"Issue #398\");\n" } ]
JavaScript
MIT License
11ty/eleventy
Ugh, okay one more time for #353
669
14.04.2019 08:05:44
-7,200
a30ac00de9f34cc15b4de96ff839607f4a7b6b90
Fix getAllDirs not handling segments of equal name
[ { "change_type": "MODIFY", "old_path": "src/TemplatePath.js", "new_path": "src/TemplatePath.js", "diff": "@@ -78,9 +78,7 @@ TemplatePath.getAllDirs = function(path) {\nreturn path\n.split(\"/\")\n- .map(segment =>\n- path.substring(0, path.lastIndexOf(segment) + segment.length)\n- )\n+ .map((segment, index, array) => array.slice(0, index + 1).join(\"/\"))\n.filter(path => path !== \".\")\n.reverse();\n};\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePathTest.js", "new_path": "test/TemplatePathTest.js", "diff": "@@ -30,10 +30,12 @@ test(\"getAllDirs\", t => {\nt.deepEqual(TemplatePath.getAllDirs(\"./testing/\"), [\"./testing\"]);\nt.deepEqual(TemplatePath.getAllDirs(\"testing/\"), [\"testing\"]);\nt.deepEqual(TemplatePath.getAllDirs(\"testing\"), [\"testing\"]);\n+\nt.deepEqual(TemplatePath.getAllDirs(\"./testing/hello\"), [\n\"./testing/hello\",\n\"./testing\"\n]);\n+\nt.deepEqual(TemplatePath.getAllDirs(\"./src/collections/posts\"), [\n\"./src/collections/posts\",\n\"./src/collections\",\n@@ -51,6 +53,12 @@ test(\"getAllDirs\", t => {\n\"./src\"\n]\n);\n+\n+ t.deepEqual(TemplatePath.getAllDirs(\"./src/_site/src\"), [\n+ \"./src/_site/src\",\n+ \"./src/_site\",\n+ \"./src\"\n+ ]);\n});\ntest(\"normalize\", async t => {\n" } ]
JavaScript
MIT License
11ty/eleventy
Fix getAllDirs not handling segments of equal name
699
14.04.2019 13:23:22
18,000
5cfdbe6153bb153e319c62d2d148d7e60b81426f
Just another test for why not
[ { "change_type": "MODIFY", "old_path": "test/TemplatePathTest.js", "new_path": "test/TemplatePathTest.js", "diff": "@@ -59,6 +59,14 @@ test(\"getAllDirs\", t => {\n\"./src/_site\",\n\"./src\"\n]);\n+\n+ t.deepEqual(TemplatePath.getAllDirs(\"./src/_site/src/src/src\"), [\n+ \"./src/_site/src/src/src\",\n+ \"./src/_site/src/src\",\n+ \"./src/_site/src\",\n+ \"./src/_site\",\n+ \"./src\"\n+ ]);\n});\ntest(\"normalize\", async t => {\n" } ]
JavaScript
MIT License
11ty/eleventy
Just another test for #484, why not
699
15.04.2019 21:14:31
18,000
442d5ee5f8362811ee8b0105c0d8287af3f23afa
Add test for async addCollection
[ { "change_type": "MODIFY", "old_path": "test/TemplateMapTest.js", "new_path": "test/TemplateMapTest.js", "diff": "@@ -994,3 +994,22 @@ test(\"Test a transform with a layout (via templateMap)\", async t => {\n}\n}\n});\n+\n+test(\"Async user collection addCollection method\", async t => {\n+ let tm = new TemplateMap();\n+ await tm.add(tmpl1);\n+ tm.setUserConfigCollections({\n+ userCollection: async function(collection) {\n+ return new Promise((resolve, reject) => {\n+ setTimeout(function() {\n+ resolve(collection.getAll());\n+ }, 50);\n+ });\n+ }\n+ });\n+\n+ let collections = await tm.getCollectionsData();\n+ t.is(collections.userCollection[0].url, \"/templateMapCollection/test1/\");\n+\n+ t.is(collections.userCollection[0].data.collections.userCollection.length, 1);\n+});\n" } ]
JavaScript
MIT License
11ty/eleventy
Add test for async addCollection
699
04.05.2019 12:41:38
18,000
07cb65e08dc93a6b86d7167ea35f0bc92ee1c972
Coverage stats for 0.8.3
[ { "change_type": "MODIFY", "old_path": "docs-src/_data/coverage.json", "new_path": "docs-src/_data/coverage.json", "diff": "-{\"total\": {\"lines\":{\"total\":2637,\"covered\":2332,\"skipped\":0,\"pct\":88.43},\"statements\":{\"total\":2651,\"covered\":2346,\"skipped\":0,\"pct\":88.49},\"functions\":{\"total\":640,\"covered\":560,\"skipped\":0,\"pct\":87.5},\"branches\":{\"total\":995,\"covered\":802,\"skipped\":0,\"pct\":80.6}}\n+{\"total\": {\"lines\":{\"total\":2643,\"covered\":2331,\"skipped\":0,\"pct\":88.2},\"statements\":{\"total\":2657,\"covered\":2345,\"skipped\":0,\"pct\":88.26},\"functions\":{\"total\":640,\"covered\":558,\"skipped\":0,\"pct\":87.19},\"branches\":{\"total\":999,\"covered\":803,\"skipped\":0,\"pct\":80.38}}\n,\"/Users/zachleat/Code/eleventy/config.js\": {\"lines\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":1,\"covered\":1,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Benchmark.js\": {\"lines\":{\"total\":12,\"covered\":11,\"skipped\":0,\"pct\":91.67},\"functions\":{\"total\":6,\"covered\":5,\"skipped\":0,\"pct\":83.33},\"statements\":{\"total\":12,\"covered\":11,\"skipped\":0,\"pct\":91.67},\"branches\":{\"total\":6,\"covered\":4,\"skipped\":0,\"pct\":66.67}}\n,\"/Users/zachleat/Code/eleventy/src/BenchmarkGroup.js\": {\"lines\":{\"total\":34,\"covered\":23,\"skipped\":0,\"pct\":67.65},\"functions\":{\"total\":7,\"covered\":5,\"skipped\":0,\"pct\":71.43},\"statements\":{\"total\":34,\"covered\":23,\"skipped\":0,\"pct\":67.65},\"branches\":{\"total\":10,\"covered\":3,\"skipped\":0,\"pct\":30}}\n,\"/Users/zachleat/Code/eleventy/src/TemplatePermalink.js\": {\"lines\":{\"total\":30,\"covered\":30,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":7,\"covered\":7,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":30,\"covered\":30,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":20,\"covered\":20,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplatePermalinkNoWrite.js\": {\"lines\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateRender.js\": {\"lines\":{\"total\":77,\"covered\":76,\"skipped\":0,\"pct\":98.7},\"functions\":{\"total\":22,\"covered\":22,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":77,\"covered\":76,\"skipped\":0,\"pct\":98.7},\"branches\":{\"total\":42,\"covered\":40,\"skipped\":0,\"pct\":95.24}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateWriter.js\": {\"lines\":{\"total\":87,\"covered\":75,\"skipped\":0,\"pct\":86.21},\"functions\":{\"total\":20,\"covered\":15,\"skipped\":0,\"pct\":75},\"statements\":{\"total\":87,\"covered\":75,\"skipped\":0,\"pct\":86.21},\"branches\":{\"total\":8,\"covered\":3,\"skipped\":0,\"pct\":37.5}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateWriter.js\": {\"lines\":{\"total\":94,\"covered\":78,\"skipped\":0,\"pct\":82.98},\"functions\":{\"total\":21,\"covered\":15,\"skipped\":0,\"pct\":71.43},\"statements\":{\"total\":94,\"covered\":78,\"skipped\":0,\"pct\":82.98},\"branches\":{\"total\":10,\"covered\":3,\"skipped\":0,\"pct\":30}}\n,\"/Users/zachleat/Code/eleventy/src/UserConfig.js\": {\"lines\":{\"total\":163,\"covered\":105,\"skipped\":0,\"pct\":64.42},\"functions\":{\"total\":44,\"covered\":23,\"skipped\":0,\"pct\":52.27},\"statements\":{\"total\":164,\"covered\":106,\"skipped\":0,\"pct\":64.63},\"branches\":{\"total\":63,\"covered\":34,\"skipped\":0,\"pct\":53.97}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Ejs.js\": {\"lines\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"functions\":{\"total\":7,\"covered\":6,\"skipped\":0,\"pct\":85.71},\"statements\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"branches\":{\"total\":6,\"covered\":4,\"skipped\":0,\"pct\":66.67}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Haml.js\": {\"lines\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/JavaScript.js\": {\"lines\":{\"total\":35,\"covered\":35,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":10,\"covered\":10,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":35,\"covered\":35,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":22,\"covered\":22,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/JavaScriptTemplateLiteral.js\": {\"lines\":{\"total\":18,\"covered\":17,\"skipped\":0,\"pct\":94.44},\"functions\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":18,\"covered\":17,\"skipped\":0,\"pct\":94.44},\"branches\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Liquid.js\": {\"lines\":{\"total\":69,\"covered\":66,\"skipped\":0,\"pct\":95.65},\"functions\":{\"total\":26,\"covered\":25,\"skipped\":0,\"pct\":96.15},\"statements\":{\"total\":69,\"covered\":66,\"skipped\":0,\"pct\":95.65},\"branches\":{\"total\":10,\"covered\":8,\"skipped\":0,\"pct\":80}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Markdown.js\": {\"lines\":{\"total\":28,\"covered\":25,\"skipped\":0,\"pct\":89.29},\"functions\":{\"total\":8,\"covered\":7,\"skipped\":0,\"pct\":87.5},\"statements\":{\"total\":28,\"covered\":25,\"skipped\":0,\"pct\":89.29},\"branches\":{\"total\":12,\"covered\":9,\"skipped\":0,\"pct\":75}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Markdown.js\": {\"lines\":{\"total\":31,\"covered\":28,\"skipped\":0,\"pct\":90.32},\"functions\":{\"total\":9,\"covered\":8,\"skipped\":0,\"pct\":88.89},\"statements\":{\"total\":31,\"covered\":28,\"skipped\":0,\"pct\":90.32},\"branches\":{\"total\":14,\"covered\":11,\"skipped\":0,\"pct\":78.57}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Mustache.js\": {\"lines\":{\"total\":10,\"covered\":10,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":4,\"covered\":4,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":10,\"covered\":10,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Nunjucks.js\": {\"lines\":{\"total\":62,\"covered\":58,\"skipped\":0,\"pct\":93.55},\"functions\":{\"total\":21,\"covered\":21,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":62,\"covered\":58,\"skipped\":0,\"pct\":93.55},\"branches\":{\"total\":8,\"covered\":7,\"skipped\":0,\"pct\":87.5}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Nunjucks.js\": {\"lines\":{\"total\":58,\"covered\":51,\"skipped\":0,\"pct\":87.93},\"functions\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"statements\":{\"total\":58,\"covered\":51,\"skipped\":0,\"pct\":87.93},\"branches\":{\"total\":8,\"covered\":6,\"skipped\":0,\"pct\":75}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Pug.js\": {\"lines\":{\"total\":15,\"covered\":15,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":15,\"covered\":15,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":4,\"covered\":3,\"skipped\":0,\"pct\":75}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/TemplateEngine.js\": {\"lines\":{\"total\":51,\"covered\":51,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":18,\"covered\":18,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":53,\"covered\":53,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":8,\"covered\":8,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Errors/TemplateContentPrematureUseError.js\": {\"lines\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n" }, { "change_type": "MODIFY", "old_path": "docs/coverage.md", "new_path": "docs/coverage.md", "diff": "-# Code Coverage for Eleventy v0.8.2\n+# Code Coverage for Eleventy v0.8.3\n| Filename | % Lines | % Statements | % Functions | % Branches |\n| ---------------------------------------------------------- | ------- | ------------ | ----------- | ---------- |\n-| `total` | 88.43% | 88.49% | 87.5% | 80.6% |\n+| `total` | 88.2% | 88.26% | 87.19% | 80.38% |\n| `config.js` | 100% | 100% | 100% | 100% |\n| `src/Benchmark.js` | 91.67% | 91.67% | 83.33% | 66.67% |\n| `src/BenchmarkGroup.js` | 67.65% | 67.65% | 71.43% | 30% |\n| `src/TemplatePermalink.js` | 100% | 100% | 100% | 100% |\n| `src/TemplatePermalinkNoWrite.js` | 100% | 100% | 100% | 100% |\n| `src/TemplateRender.js` | 98.7% | 98.7% | 100% | 95.24% |\n-| `src/TemplateWriter.js` | 86.21% | 86.21% | 75% | 37.5% |\n+| `src/TemplateWriter.js` | 82.98% | 82.98% | 71.43% | 30% |\n| `src/UserConfig.js` | 64.42% | 64.63% | 52.27% | 53.97% |\n| `src/Engines/Ejs.js` | 94.74% | 94.74% | 85.71% | 66.67% |\n| `src/Engines/Haml.js` | 100% | 100% | 100% | 100% |\n| `src/Engines/JavaScript.js` | 100% | 100% | 100% | 100% |\n| `src/Engines/JavaScriptTemplateLiteral.js` | 94.44% | 94.44% | 100% | 100% |\n| `src/Engines/Liquid.js` | 95.65% | 95.65% | 96.15% | 80% |\n-| `src/Engines/Markdown.js` | 89.29% | 89.29% | 87.5% | 75% |\n+| `src/Engines/Markdown.js` | 90.32% | 90.32% | 88.89% | 78.57% |\n| `src/Engines/Mustache.js` | 100% | 100% | 100% | 100% |\n-| `src/Engines/Nunjucks.js` | 93.55% | 93.55% | 100% | 87.5% |\n+| `src/Engines/Nunjucks.js` | 87.93% | 87.93% | 94.74% | 75% |\n| `src/Engines/Pug.js` | 100% | 100% | 100% | 75% |\n| `src/Engines/TemplateEngine.js` | 100% | 100% | 100% | 100% |\n| `src/Errors/TemplateContentPrematureUseError.js` | 100% | 100% | 100% | 100% |\n" } ]
JavaScript
MIT License
11ty/eleventy
Coverage stats for 0.8.3
699
04.05.2019 15:33:37
18,000
bfe4af424407061b95340ae19f6cc93f803323e1
Make tests work with out of order results.
[ { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -547,10 +547,8 @@ test(\"Markdown with alias\", async t => {\n\"./test/stubs/writeTestMarkdown/**/*.md\",\n\"./test/stubs/writeTestMarkdown/**/*.markdown\"\n]);\n- t.deepEqual(files, [\n- \"./test/stubs/writeTestMarkdown/sample.md\",\n- \"./test/stubs/writeTestMarkdown/sample2.markdown\"\n- ]);\n+ t.true(files.indexOf(\"./test/stubs/writeTestMarkdown/sample.md\") > -1);\n+ t.true(files.indexOf(\"./test/stubs/writeTestMarkdown/sample2.markdown\") > -1);\nlet tw = new TemplateWriter(\n\"./test/stubs/writeTestMarkdown\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Make tests work with out of order results.
699
28.05.2019 20:55:33
18,000
4c69043bc60f3e42cfe173c2c9ad152538907c19
New test, related to
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderLiquidTest.js", "new_path": "test/TemplateRenderLiquidTest.js", "diff": "@@ -104,6 +104,28 @@ test(\"Liquid Custom Tag postfixWithZach\", async t => {\n);\n});\n+test(\"Liquid Custom Tag Unquoted String\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addTag(\"testUnquotedStringTag\", function(liquidEngine) {\n+ return {\n+ parse: function(tagToken, remainTokens) {\n+ this.str = tagToken.args;\n+ },\n+ render: function(scope, hash) {\n+ return Promise.resolve(this.str + \"Zach\");\n+ }\n+ };\n+ });\n+\n+ t.is(\n+ await tr.render(\n+ \"{% testUnquotedStringTag _posts/2016-07-26-name-of-post.md %}\",\n+ { name: \"test\" }\n+ ),\n+ \"_posts/2016-07-26-name-of-post.mdZach\"\n+ );\n+});\n+\ntest(\"Liquid addTag errors\", async t => {\nlet tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\nt.throws(() => {\n" } ]
JavaScript
MIT License
11ty/eleventy
New test, related to #544
699
07.06.2019 22:40:42
18,000
cff8af20b19fe65c6b31d28e54516bc2739bd82c
Use less verbose test output for pre-push
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"scripts\": {\n\"default\": \"npm run test\",\n- \"test\": \"npx nyc ava\",\n+ \"test\": \"npx ava --verbose\",\n\"lint-staged\": \"lint-staged\",\n- \"coverage\": \"npm run test && npx nyc report --reporter=json-summary && cp coverage/coverage-summary.json docs-src/_data/coverage.json && node cmd.js --config=docs-src/.eleventy.docs.js\"\n+ \"coverage\": \"npx nyc ava && npx nyc report --reporter=json-summary && cp coverage/coverage-summary.json docs-src/_data/coverage.json && node cmd.js --config=docs-src/.eleventy.docs.js\"\n},\n\"author\": {\n\"name\": \"Zach Leatherman\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Use less verbose test output for pre-push
699
08.06.2019 13:26:28
18,000
dd64f236fef61d0b326970ade449bda03aefe479
Improvements to One error at a time, better output, tests around EleventyErrorHandler.
[ { "change_type": "MODIFY", "old_path": "src/TemplateMap.js", "new_path": "src/TemplateMap.js", "diff": "-const chalk = require(\"chalk\");\nconst isPlainObject = require(\"lodash/isPlainObject\");\nconst DependencyGraph = require(\"dependency-graph\").DepGraph;\nconst TemplateCollection = require(\"./TemplateCollection\");\n@@ -9,7 +8,11 @@ const debug = require(\"debug\")(\"Eleventy:TemplateMap\");\nconst debugDev = require(\"debug\")(\"Dev:Eleventy:TemplateMap\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\n-class DuplicatePermalinkOutputError extends EleventyBaseError {}\n+class DuplicatePermalinkOutputError extends EleventyBaseError {\n+ get removeDuplicateErrorStringFromOutput() {\n+ return true;\n+ }\n+}\nclass TemplateMap {\nconstructor() {\n@@ -503,7 +506,7 @@ class TemplateMap {\n} else {\nwarnings[\npage.outputPath\n- ] = `Output conflict: multiple files are writing to \\`${\n+ ] = `Output conflict: multiple input files are writing to \\`${\npage.outputPath\n}\\`. Use distinct \\`permalink\\` values to resolve this conflict.\n1. ${entry.inputPath}\n@@ -521,7 +524,8 @@ ${permalinks[page.url]\nlet warningList = Object.values(warnings);\nif (warningList.length) {\n- throw new DuplicatePermalinkOutputError(warningList.join(\"\\n\"));\n+ // throw one at a time\n+ throw new DuplicatePermalinkOutputError(warningList[0]);\n}\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Improvements to #562. One error at a time, better output, tests around EleventyErrorHandler.
699
12.06.2019 08:21:35
18,000
f014f56f26c3df71de3520558c0034e9cae8fb59
Test added for
[ { "change_type": "MODIFY", "old_path": "test/TemplateDataTest.js", "new_path": "test/TemplateDataTest.js", "diff": "@@ -313,6 +313,7 @@ test(\"TemplateData.merge\", t => {\ntest(\"TemplateData.cleanupData\", t => {\nt.deepEqual(TemplateData.cleanupData({}), {});\n+ t.deepEqual(TemplateData.cleanupData({ tags: null }), { tags: [] });\nt.deepEqual(TemplateData.cleanupData({ tags: \"\" }), { tags: [] });\nt.deepEqual(TemplateData.cleanupData({ tags: [] }), { tags: [] });\nt.deepEqual(TemplateData.cleanupData({ tags: \"test\" }), { tags: [\"test\"] });\n" } ]
JavaScript
MIT License
11ty/eleventy
Test added for #557 #556
680
14.06.2019 16:22:36
14,400
4d1f5033bd255f6ceaa13874ca3648683a68b6ca
Add Layouts Directory to debug output
[ { "change_type": "MODIFY", "old_path": "src/Eleventy.js", "new_path": "src/Eleventy.js", "diff": "@@ -166,6 +166,7 @@ class Eleventy {\nInput: ${this.inputDir}\nData: ${this.templateData.getDataDir()}\nIncludes: ${this.eleventyFiles.getIncludesDir()}\n+Layouts: ${this.eleventyFiles.getLayoutsDir()}\nOutput: ${this.outputDir}\nTemplate Formats: ${formats.join(\",\")}`);\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -248,6 +248,10 @@ class EleventyFiles {\nreturn this.includesDir;\n}\n+ getLayoutsDir() {\n+ return this.layoutsDir;\n+ }\n+\ngetFileGlobs() {\nreturn this.templateGlobsWithIgnores;\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Add Layouts Directory to debug output
699
15.06.2019 13:22:38
18,000
045e033595e05bdd0a0a9577a10003f23c969195
Skip unimplemented tests (they failed on Windows in https://github.com/11ty/eleventy/pull/570)
[ { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -526,7 +526,7 @@ test(\"Write Test 11ty.js\", async t => {\n);\n});\n-test(\"Markdown with alias\", async t => {\n+test.skip(\"Markdown with alias\", async t => {\nlet map = new EleventyExtensionMap([\"md\"]);\nmap.config = {\ntemplateExtensionAliases: {\n@@ -571,7 +571,7 @@ test(\"Markdown with alias\", async t => {\n);\n});\n-test(\"JavaScript with alias\", async t => {\n+test.skip(\"JavaScript with alias\", async t => {\nlet map = new EleventyExtensionMap([\"11ty.js\"]);\nmap.config = {\ntemplateExtensionAliases: {\n" } ]
JavaScript
MIT License
11ty/eleventy
Skip unimplemented tests (they failed on Windows in https://github.com/11ty/eleventy/pull/570)
699
15.06.2019 20:01:04
18,000
e127ca1e05e9d607b85018740432fc396e449e7b
Major version upgrades to ava and nyc (devDependencies only)
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"devDependencies\": {\n\"@11ty/eleventy-plugin-syntaxhighlight\": \"^2.0.3\",\n- \"ava\": \"^1.4.1\",\n+ \"ava\": \"^2.1.0\",\n\"lint-staged\": \"^8.2.1\",\n\"markdown-it-emoji\": \"^1.4.0\",\n- \"nyc\": \"^13.3.0\",\n+ \"nyc\": \"^14.1.1\",\n\"pre-commit\": \"^1.2.2\",\n\"pre-push\": \"^0.1.1\",\n\"prettier\": \"^1.18.2\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Major version upgrades to ava and nyc (devDependencies only)
670
17.03.2019 11:22:22
-28,800
585f81a7aff50797302c84eef18e1c77340d8e2d
Add support for passthrough with directory remapping
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -22,12 +22,6 @@ class TemplatePassthrough {\n}\nasync write() {\n- // debug(\n- // `${this.path} has no TemplateEngine engine and will copy to ${\n- // this.outputDir\n- // }`\n- // );\n-\nif (!this.isDryRun) {\ndebug(\"Copying %o\", this.path);\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -8,9 +8,8 @@ const debug = require(\"debug\")(\"Eleventy:TemplatePassthroughManager\");\nclass TemplatePassthroughManagerCopyError extends EleventyBaseError {}\nclass TemplatePassthroughManager {\n- constructor(inputDir, outputDir, isDryRun) {\n+ constructor() {\nthis.config = config.getConfig();\n-\nthis.reset();\n}\n@@ -45,7 +44,12 @@ class TemplatePassthroughManager {\nlet target = this.config.passthroughCopies || {};\ndebug(\"`passthroughFileCopy` config paths: %o\", target);\nfor (let path in target) {\n- paths.push(TemplatePath.addLeadingDotSlash(path));\n+ const inputPath = TemplatePath.addLeadingDotSlash(path);\n+ const outputPath =\n+ typeof target[path] === \"string\"\n+ ? TemplatePath.addLeadingDotSlash(target[path])\n+ : inputPath;\n+ paths.push({ inputPath, outputPath });\n}\ndebug(\"`passthroughFileCopy` config normalized paths: %o\", paths);\nreturn paths;\n@@ -53,7 +57,8 @@ class TemplatePassthroughManager {\ngetConfigPathGlobs() {\nreturn this.getConfigPaths().map(path => {\n- return TemplatePath.convertToRecursiveGlob(path);\n+ const inputPath = TemplatePath.convertToRecursiveGlob(path.inputPath);\n+ return inputPath;\n});\n}\n@@ -78,7 +83,11 @@ class TemplatePassthroughManager {\n}\nasync copyPath(path) {\n- let pass = new TemplatePassthrough(path, this.outputDir, this.inputDir);\n+ let pass = new TemplatePassthrough(\n+ path.inputPath,\n+ TemplatePath.join(this.outputDir, path.outputPath),\n+ this.inputDir\n+ );\npass.setDryRun(this.isDryRun);\nreturn pass\n" }, { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -286,11 +286,13 @@ class UserConfig {\n*\n* @param {String} fileOrDir The path to the file or directory that should\n* be copied.\n+ * @param {String} outputPath The path to the file or directory that should\n+ * be written.\n* @returns {any} a reference to the `EleventyConfig` object.\n* @memberof EleventyConfig\n*/\n- addPassthroughCopy(fileOrDir) {\n- this.passthroughCopies[fileOrDir] = true;\n+ addPassthroughCopy(fileOrDir, outputPath) {\n+ this.passthroughCopies[fileOrDir] = outputPath || fileOrDir;\nreturn this;\n}\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyConfigTest.js", "new_path": "test/EleventyConfigTest.js", "diff": "@@ -34,14 +34,18 @@ test(\"Add Collections throws error on key collision\", t => {\ntest(\"Set manual Pass-through File Copy (single call)\", t => {\neleventyConfig.addPassthroughCopy(\"img\");\n- t.is(eleventyConfig.passthroughCopies[\"img\"], true);\n+ t.is(eleventyConfig.passthroughCopies[\"img\"], \"img\");\n});\ntest(\"Set manual Pass-through File Copy (chained calls)\", t => {\n- eleventyConfig.addPassthroughCopy(\"css\").addPassthroughCopy(\"js\");\n+ eleventyConfig\n+ .addPassthroughCopy(\"css\")\n+ .addPassthroughCopy(\"js\")\n+ .addPassthroughCopy(\"./src/static\", \"static\");\n- t.is(eleventyConfig.passthroughCopies[\"css\"], true);\n- t.is(eleventyConfig.passthroughCopies[\"js\"], true);\n+ t.is(eleventyConfig.passthroughCopies[\"css\"], \"css\");\n+ t.is(eleventyConfig.passthroughCopies[\"js\"], \"js\");\n+ t.is(eleventyConfig.passthroughCopies[\"./src/static\"], \"static\");\n});\ntest(\"Set Template Formats (string)\", t => {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePassthroughManagerTest.js", "new_path": "test/TemplatePassthroughManagerTest.js", "diff": "@@ -10,7 +10,9 @@ test(\"Get paths from Config\", async t => {\n}\n});\n- t.deepEqual(mgr.getConfigPaths(), [\"./img\"]);\n+ t.deepEqual(mgr.getConfigPaths(), [\n+ { inputPath: \"./img\", outputPath: \"./img\" }\n+ ]);\n});\ntest(\"Empty config paths when disabled in config\", async t => {\n" } ]
JavaScript
MIT License
11ty/eleventy
Add support for passthrough with directory remapping
670
17.03.2019 12:31:53
-28,800
32fb716759b9b2fe64e9b34c2b7219cda3dfe3fa
Resolve issues with outpur paths
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -3,18 +3,22 @@ const TemplatePath = require(\"./TemplatePath\");\nconst debug = require(\"debug\")(\"Eleventy:TemplatePassthrough\");\nclass TemplatePassthrough {\n- constructor(inputPath, outputDir, inputDir) {\n- this.path = inputPath;\n+ constructor(path, outputDir, inputDir) {\n+ this.inputPath = path.inputPath;\n+ this.outputPath = path.outputPath;\nthis.outputDir = outputDir;\nthis.inputDir = inputDir;\nthis.isDryRun = false;\n}\ngetOutputPath() {\n- return TemplatePath.join(\n- this.outputDir,\n- TemplatePath.stripLeadingSubPath(this.path, this.inputDir)\n- );\n+ const { inputDir, outputDir, inputPath, outputPath } = this;\n+ // assuming if paths are the same an outputPath was not set and we will resolve manually?\n+ const path =\n+ outputPath === inputPath\n+ ? TemplatePath.stripLeadingSubPath(outputPath, inputDir)\n+ : outputPath;\n+ return TemplatePath.join(outputDir, path);\n}\nsetDryRun(isDryRun) {\n@@ -23,9 +27,9 @@ class TemplatePassthrough {\nasync write() {\nif (!this.isDryRun) {\n- debug(\"Copying %o\", this.path);\n+ debug(\"Copying %o\", this.inputPath);\n- return copy(this.path, this.getOutputPath(), {\n+ return copy(this.inputPath, this.getOutputPath(), {\noverwrite: true,\ndot: true,\njunk: false,\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -83,11 +83,7 @@ class TemplatePassthroughManager {\n}\nasync copyPath(path) {\n- let pass = new TemplatePassthrough(\n- path.inputPath,\n- TemplatePath.join(this.outputDir, path.outputPath),\n- this.inputDir\n- );\n+ let pass = new TemplatePassthrough(path, this.outputDir, this.inputDir);\npass.setDryRun(this.isDryRun);\nreturn pass\n" } ]
JavaScript
MIT License
11ty/eleventy
Resolve issues with outpur paths
670
04.05.2019 16:51:47
-28,800
3788c07bf67f0dd1e4a53229622510d1ddc28910
Fix async write issue
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -38,7 +38,10 @@ class TemplatePassthrough {\nasync getFiles(glob) {\ndebug(\"Searching for: %o\", glob);\n- return TemplatePath.addLeadingDotSlashArray(await fastglob.async(glob));\n+ const files = await TemplatePath.addLeadingDotSlashArray(\n+ await fastglob.async(glob)\n+ );\n+ return files;\n}\nasync write() {\n@@ -51,7 +54,6 @@ class TemplatePassthrough {\nif (!this.isDryRun) {\ndebug(\"Copying %o\", this.inputPath);\n-\nconst isDirectory = TemplatePath.isDirectorySync(this.inputPath);\nconst isFile = fs.existsSync(this.inputPath);\n// If directory or file, recursive copy\n@@ -60,10 +62,14 @@ class TemplatePassthrough {\n}\n// If not directory or file, attempt to get globs\n+\nconst files = await this.getFiles(this.inputPath);\n- return files.forEach(inputFile => {\n- return copy(inputFile, this.getGlobOutputPath(inputFile), copyOptions);\n- });\n+\n+ const promises = files.map(inputFile =>\n+ copy(inputFile, this.getGlobOutputPath(inputFile), copyOptions)\n+ );\n+\n+ return Promise.all(promises);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -45,7 +45,8 @@ class TemplatePassthroughManager {\ndebug(\"`passthroughFileCopy` config paths: %o\", target);\nfor (let path in target) {\nconst inputPath = TemplatePath.addLeadingDotSlash(path);\n- paths.push(inputPath);\n+ const outputPath = target[path];\n+ paths.push({ inputPath, outputPath });\n}\ndebug(\"`passthroughFileCopy` config normalized paths: %o\", paths);\nreturn paths;\n@@ -53,7 +54,7 @@ class TemplatePassthroughManager {\ngetConfigPathGlobs() {\nreturn this.getConfigPaths().map(path => {\n- return TemplatePath.convertToRecursiveGlob(path);\n+ return TemplatePath.convertToRecursiveGlob(path.inputPath);\n});\n}\n@@ -80,7 +81,6 @@ class TemplatePassthroughManager {\nasync copyPath(path) {\nlet pass = new TemplatePassthrough(path, this.outputDir, this.inputDir);\npass.setDryRun(this.isDryRun);\n-\nreturn pass\n.write()\n.then(\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateWriter.js", "new_path": "src/TemplateWriter.js", "diff": "@@ -138,6 +138,7 @@ TemplateWriter.prototype._writeTemplate = async function(mapEntry) {\nTemplateWriter.prototype.write = async function() {\nlet promises = [];\nlet paths = await this._getAllPaths();\n+\ndebug(\"Found: %o\", paths);\npromises.push(\nthis.getFileManager()\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyFilesTest.js", "new_path": "test/EleventyFilesTest.js", "diff": "@@ -46,11 +46,14 @@ test(\"getFiles (with js, treated as passthrough copy)\", async t => {\n[\"ejs\", \"md\", \"js\"]\n);\nevf.init();\n-\n- t.deepEqual(await evf.getFiles(), [\n+ const files = await evf.getFiles();\n+ t.deepEqual(\n+ files.sort(),\n+ [\n\"./test/stubs/writeTestJS/sample.js\",\n\"./test/stubs/writeTestJS/test.11ty.js\"\n- ]);\n+ ].sort()\n+ );\nt.false(TemplateRender.hasEngine(\"./test/stubs/writeTestJS/sample.js\"));\nt.true(TemplateRender.hasEngine(\"./test/stubs/writeTestJS/test.11ty.js\"));\n});\n@@ -579,8 +582,11 @@ test(\"File extension aliasing\", async t => {\nconst files = await evf.getFiles();\n- t.deepEqual(files, [\n+ t.deepEqual(\n+ files.sort(),\n+ [\n\"./test/stubs/writeTestMarkdown/sample.md\",\n\"./test/stubs/writeTestMarkdown/sample2.markdown\"\n- ]);\n+ ].sort()\n+ );\n});\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePassthroughManagerTest.js", "new_path": "test/TemplatePassthroughManagerTest.js", "diff": "@@ -10,7 +10,7 @@ test(\"Get paths from Config\", async t => {\n}\n});\n- t.deepEqual(mgr.getConfigPaths(), [\"./img\"]);\n+ t.deepEqual(mgr.getConfigPaths(), [{ inputPath: \"./img\", outputPath: true }]);\n});\ntest(\"Empty config paths when disabled in config\", async t => {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePassthroughTest.js", "new_path": "test/TemplatePassthroughTest.js", "diff": "@@ -142,11 +142,14 @@ test(\"getFiles with glob\", async t => {\n);\nt.truthy(pass);\nconst files = await pass.getFiles(inputPath);\n- t.deepEqual(files, [\n+ t.deepEqual(\n+ files.sort(),\n+ [\n\"./test/stubs/template-passthrough/static/test.css\",\n\"./test/stubs/template-passthrough/static/test.js\",\n\"./test/stubs/template-passthrough/static/nested/test-nested.css\"\n- ]);\n+ ].sort()\n+ );\n});\ntest(\"getFiles with glob 2\", async t => {\nconst inputPath = \"./test/stubs/template-passthrough/static/**/*.js\";\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -625,9 +625,9 @@ test(\"Passthrough file output\", async t => {\npassthroughFileCopy: true,\npassthroughCopies: {\n\"./test/stubs/template-passthrough/static\": true,\n- \"./test/stubs/template-passthrough/static/**/*\": \"./all/\",\n\"./test/stubs/template-passthrough/static\": \"./\",\n- \"./test/stubs/template-passthrough/**/*.js\": \"./js/\"\n+ \"./test/stubs/template-passthrough/static/**/*\": \"./all/\",\n+ \"./test/stubs/template-passthrough/static/**/*.js\": \"./js/\"\n}\n});\n@@ -646,8 +646,11 @@ test(\"Passthrough file output\", async t => {\n\"./test/stubs/template-passthrough/_site/test.js\"\n];\noutput.forEach(path => {\n+ if (!fs.existsSync(path)) {\n+ console.log({ path });\n+ }\nt.true(fs.existsSync(path));\n});\n- // rimraf.sync(\"./test/stubs/template-passthrough/_site/\");\n+ rimraf.sync(\"./test/stubs/template-passthrough/_site/\");\n});\n" } ]
JavaScript
MIT License
11ty/eleventy
Fix async write issue
670
04.05.2019 17:25:12
-28,800
fb8621ca0da02d9dc998efce16aa637ea2eaa92d
Sort when comparing arrays because some versions of node... I don't really know why but order is different and it matters
[ { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -583,14 +583,20 @@ test.skip(\"JavaScript with alias\", async t => {\nevf.init();\nlet files = await fastglob.async(evf.getFileGlobs());\n- t.deepEqual(evf.getRawFiles(), [\n+ t.deepEqual(\n+ evf.getRawFiles().sort(),\n+ [\n\"./test/stubs/writeTestJS/**/*.11ty.js\",\n\"./test/stubs/writeTestJS/**/*.js\"\n- ]);\n- t.deepEqual(files, [\n+ ].sort()\n+ );\n+ t.deepEqual(\n+ files.sort(),\n+ [\n\"./test/stubs/writeTestJS/sample.js\",\n\"./test/stubs/writeTestJS/test.11ty.js\"\n- ]);\n+ ].sort()\n+ );\nlet tw = new TemplateWriter(\n\"./test/stubs/writeTestJS\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Sort when comparing arrays because some versions of node... I don't really know why but order is different and it matters
670
13.05.2019 11:24:57
-28,800
652867e541cd304714f11fc040a81a23c4248ed9
Update copy function to catch when destination is outside site output directory
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "const copy = require(\"recursive-copy\");\nconst fs = require(\"fs\");\n+const path = require(\"path\");\nconst TemplatePath = require(\"./TemplatePath\");\nconst debug = require(\"debug\")(\"Eleventy:TemplatePassthrough\");\nconst fastglob = require(\"fast-glob\");\n+const EleventyBaseError = require(\"./EleventyBaseError\");\n+\n+class TemplatePassthroughError extends EleventyBaseError {}\nclass TemplatePassthrough {\nconstructor(path, outputDir, inputDir) {\n@@ -22,7 +26,7 @@ class TemplatePassthrough {\nTemplatePath.stripLeadingSubPath(inputPath, inputDir)\n);\n}\n- return TemplatePath.join(outputDir, outputPath);\n+ return path.normalize(TemplatePath.join(outputDir, outputPath));\n}\ngetGlobOutputPath(globFile) {\n@@ -44,6 +48,20 @@ class TemplatePassthrough {\nreturn files;\n}\n+ copy(src, dest, copyOptions) {\n+ if (\n+ TemplatePath.stripLeadingDotSlash(dest).includes(\n+ TemplatePath.stripLeadingDotSlash(this.outputDir)\n+ )\n+ ) {\n+ return copy(src, dest, copyOptions);\n+ }\n+ return Promise.reject(\n+ new TemplatePassthroughError(\n+ \"Destination is not in the site output directory. Check your passthrough paths.\"\n+ )\n+ );\n+ }\nasync write() {\nconst copyOptions = {\noverwrite: true,\n@@ -58,18 +76,22 @@ class TemplatePassthrough {\nconst isFile = fs.existsSync(this.inputPath);\n// If directory or file, recursive copy\nif (isDirectory || isFile) {\n- return copy(this.inputPath, this.getOutputPath(), copyOptions);\n+ return this.copy(this.inputPath, this.getOutputPath(), copyOptions);\n}\n// If not directory or file, attempt to get globs\n-\nconst files = await this.getFiles(this.inputPath);\nconst promises = files.map(inputFile =>\n- copy(inputFile, this.getGlobOutputPath(inputFile), copyOptions)\n+ this.copy(inputFile, this.getGlobOutputPath(inputFile), copyOptions)\n);\n- return Promise.all(promises);\n+ return Promise.all(promises).catch(err => {\n+ throw new EleventyBaseError(\n+ `Error copying passthrough files: ${err.message}`,\n+ err\n+ );\n+ });\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -86,13 +86,15 @@ class TemplatePassthroughManager {\n.then(\nfunction() {\nthis.count++;\n- debug(\"Copied %o\", path);\n+ debug(\"Copied %o\", path.inputPath);\n}.bind(this)\n)\n.catch(function(e) {\n- throw new TemplatePassthroughManagerCopyError(\n- `Having trouble copying '${path}'`,\n+ return Promise.reject(\n+ new TemplatePassthroughManagerCopyError(\n+ `Having trouble copying '${path.inputPath}'`,\ne\n+ )\n);\n});\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Update copy function to catch when destination is outside site output directory
670
13.05.2019 11:26:43
-28,800
320af9bb0206d2befb0eafd4007481e3965a28ec
Functions that return promises should not throw but reject with error. Pearent should catch
[ { "change_type": "MODIFY", "old_path": "src/TemplateWriter.js", "new_path": "src/TemplateWriter.js", "diff": "@@ -138,7 +138,6 @@ TemplateWriter.prototype._writeTemplate = async function(mapEntry) {\nTemplateWriter.prototype.write = async function() {\nlet promises = [];\nlet paths = await this._getAllPaths();\n-\ndebug(\"Found: %o\", paths);\npromises.push(\nthis.getFileManager()\n@@ -146,6 +145,9 @@ TemplateWriter.prototype.write = async function() {\n.copyAll(paths)\n.catch(e => {\nEleventyErrorHandler.warn(e, \"Error with passthrough copy\");\n+ return Promise.reject(\n+ new TemplateWriterWriteError(`Having trouble copying`, e)\n+ );\n})\n);\n@@ -163,9 +165,11 @@ TemplateWriter.prototype.write = async function() {\nif (EleventyErrorUtil.isPrematureTemplateContentError(e)) {\nusedTemplateContentTooEarlyMap.push(mapEntry);\n} else {\n- throw new TemplateWriterWriteError(\n+ return Promise.reject(\n+ TemplateWriterWriteError(\n`Having trouble writing template: ${mapEntry.outputPath}`,\ne\n+ )\n);\n}\n})\n@@ -175,11 +179,13 @@ TemplateWriter.prototype.write = async function() {\nfor (mapEntry of usedTemplateContentTooEarlyMap) {\npromises.push(\nthis._writeTemplate(mapEntry).catch(function(e) {\n- throw new TemplateWriterWriteError(\n+ return Promise.reject(\n+ TemplateWriterWriteError(\n`Having trouble writing template (second pass): ${\nmapEntry.outputPath\n}`,\ne\n+ )\n);\n})\n);\n@@ -187,6 +193,7 @@ TemplateWriter.prototype.write = async function() {\nreturn Promise.all(promises).catch(e => {\nEleventyErrorHandler.error(e, \"Error writing templates\");\n+ throw e;\n});\n};\n" } ]
JavaScript
MIT License
11ty/eleventy
Functions that return promises should not throw but reject with error. Pearent should catch
670
13.05.2019 11:27:20
-28,800
aa92655e9eb9c9a46a02b75ad71f470b26703ba4
update test for dest outside output dir
[ { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -652,11 +652,45 @@ test(\"Passthrough file output\", async t => {\n\"./test/stubs/template-passthrough/_site/test.js\"\n];\noutput.forEach(path => {\n- if (!fs.existsSync(path)) {\n- console.log({ path });\n- }\nt.true(fs.existsSync(path));\n});\nrimraf.sync(\"./test/stubs/template-passthrough/_site/\");\n});\n+\n+test(\"Naughty Passthrough paths\", async t => {\n+ let tw = new TemplateWriter(\n+ \"./test/stubs/template-passthrough/\",\n+ \"./test/stubs/template-passthrough/_site\",\n+ [\"njk\", \"md\"]\n+ );\n+\n+ const mgr = tw.getFileManager().getPassthroughManager();\n+ mgr.setConfig({\n+ passthroughFileCopy: true,\n+ passthroughCopies: {\n+ \"../\": true,\n+ \"../\": \"./\",\n+ \"../*\": \"./\",\n+ \"./test/stubs/template-passthrough/static/*.css\": \"./\",\n+ \"./test/stubs/template-passthrough/static/*.js\": \"../../\",\n+ \"./test/stubs/template-passthrough/img.jpg\": \"../../\"\n+ }\n+ });\n+\n+ tw.setVerboseOutput(false);\n+\n+ await t.throwsAsync(async () => {\n+ await tw.write();\n+ });\n+\n+ const output = [\n+ \"./test/stubs/template-passthrough/_site/nope.txt\",\n+ \"./test/stubs/template-passthrough/_site/nope/\",\n+ \"./test/stubs/test.js\",\n+ \"./test/stubs/img.jpg\"\n+ ];\n+ output.forEach(path => {\n+ t.false(fs.existsSync(path));\n+ });\n+});\n" } ]
JavaScript
MIT License
11ty/eleventy
update test for dest outside output dir
670
13.05.2019 11:28:10
-28,800
378ace982013ab7d5894aed97989c5eff3c563f2
chore: remove year old dead code
[ { "change_type": "MODIFY", "old_path": "test/TemplateDataTest.js", "new_path": "test/TemplateDataTest.js", "diff": "@@ -11,13 +11,6 @@ test(\"Create\", async t => {\nt.true(Object.keys(data[config.keys.package]).length > 0);\n});\n-// test(\"Create (old method, file name not dir)\", async t => {\n-// let dataObj = new TemplateData(\"./test/stubs/globalData.json\");\n-// let data = await dataObj.getData();\n-\n-// t.true(Object.keys(data[config.keys.package]).length > 0);\n-// });\n-\ntest(\"getData()\", async t => {\nlet dataObj = new TemplateData(\"./test/stubs/\");\n" } ]
JavaScript
MIT License
11ty/eleventy
chore: remove year old dead code
670
13.05.2019 13:18:59
-28,800
0a764704811a8c250cd8d40c4186e5b08f9970ce
fix windows paths for test
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -26,7 +26,9 @@ class TemplatePassthrough {\nTemplatePath.stripLeadingSubPath(inputPath, inputDir)\n);\n}\n- return path.normalize(TemplatePath.join(outputDir, outputPath));\n+ return path\n+ .normalize(TemplatePath.join(outputDir, outputPath))\n+ .replace(/\\\\/g, \"/\"); // Fix for windows paths\n}\ngetGlobOutputPath(globFile) {\n" } ]
JavaScript
MIT License
11ty/eleventy
fix windows paths for test
670
16.06.2019 10:22:53
-28,800
460d09cdddf28e00be00d5a476b4bc72cdc848e9
test removal of windows path fix
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -26,9 +26,8 @@ class TemplatePassthrough {\nTemplatePath.stripLeadingSubPath(inputPath, inputDir)\n);\n}\n- return path\n- .normalize(TemplatePath.join(outputDir, outputPath))\n- .replace(/\\\\/g, \"/\"); // Fix for windows paths\n+ return path.normalize(TemplatePath.join(outputDir, outputPath));\n+ // .replace(/\\\\/g, \"/\"); // Fix for windows paths\n}\ngetGlobOutputPath(globFile) {\n" } ]
JavaScript
MIT License
11ty/eleventy
test removal of windows path fix
670
16.06.2019 11:17:40
-28,800
7099d5f51884aa0b267957a6677b693739648d51
Normalise all paths in test
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -26,7 +26,6 @@ class TemplatePassthrough {\n);\n}\nreturn path.normalize(TemplatePath.join(outputDir, outputPath));\n- // .replace(/\\\\/g, \"/\"); // Fix for windows paths\n}\ngetGlobOutputPath(globFile) {\n" } ]
JavaScript
MIT License
11ty/eleventy
Normalise all paths in test
670
16.06.2019 11:34:47
-28,800
4c3f89f4c290b7474086a609276c44b5e9cbed97
Rename getOutputPathForGlobFile
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -28,7 +28,7 @@ class TemplatePassthrough {\nreturn path.normalize(TemplatePath.join(outputDir, outputPath));\n}\n- getGlobOutputPath(globFile) {\n+ getOutputPathForGlobFile(globFile) {\nreturn TemplatePath.join(\nthis.getOutputPath(),\nTemplatePath.getLastPathSegment(globFile)\n@@ -82,7 +82,11 @@ class TemplatePassthrough {\nconst files = await this.getFiles(this.inputPath);\nconst promises = files.map(inputFile =>\n- this.copy(inputFile, this.getGlobOutputPath(inputFile), copyOptions)\n+ this.copy(\n+ inputFile,\n+ this.getOutputPathForGlobFile(inputFile),\n+ copyOptions\n+ )\n);\nreturn Promise.all(promises).catch(err => {\n" } ]
JavaScript
MIT License
11ty/eleventy
Rename getOutputPathForGlobFile
670
16.06.2019 13:48:24
-28,800
0608138e8400a927d2ad9b0a0142ca7e2c1079bc
use TemplatePath.normalize rather than path.normalize
[ { "change_type": "UNKNOWN", "old_path": "package.json", "new_path": "package.json", "diff": "" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "const copy = require(\"recursive-copy\");\nconst fs = require(\"fs\");\n-const path = require(\"path\");\nconst TemplatePath = require(\"./TemplatePath\");\nconst debug = require(\"debug\")(\"Eleventy:TemplatePassthrough\");\nconst fastglob = require(\"fast-glob\");\n@@ -20,12 +19,14 @@ class TemplatePassthrough {\ngetOutputPath() {\nconst { inputDir, outputDir, outputPath, inputPath } = this;\nif (outputPath === true) {\n- return TemplatePath.join(\n+ return TemplatePath.normalize(\n+ TemplatePath.join(\noutputDir,\nTemplatePath.stripLeadingSubPath(inputPath, inputDir)\n+ )\n);\n}\n- return path.normalize(TemplatePath.join(outputDir, outputPath));\n+ return TemplatePath.normalize(TemplatePath.join(outputDir, outputPath));\n}\ngetOutputPathForGlobFile(globFile) {\n" } ]
JavaScript
MIT License
11ty/eleventy
use TemplatePath.normalize rather than path.normalize
699
21.06.2019 17:34:44
18,000
303e4d48a387b178cf603471dc1dec548eb1ca07
Support customizing front matter parsing options passed to gray-matter plugin. See Fixes Needs docs.
[ { "change_type": "MODIFY", "old_path": "src/TemplateContent.js", "new_path": "src/TemplateContent.js", "diff": "@@ -69,11 +69,31 @@ class TemplateContent {\nthis.inputContent = await this.getInputContent();\nif (this.inputContent) {\n- this.frontMatter = matter(this.inputContent);\n+ let options = this.config.frontMatterParsingOptions || {};\n+ let fm = matter(this.inputContent, options);\n+ if (options.excerpt && fm.excerpt) {\n+ if (\n+ fm.content.startsWith(\n+ fm.excerpt + (fm.excerpt_separator || \"---\") + \"\\n\"\n+ )\n+ ) {\n+ fm.content = fm.content.substr(\n+ (fm.excerpt + (fm.excerpt_separator || \"---\") + \"\\n\").length\n+ );\n+ }\n+\n+ // add to page.excerpt\n+ if (!fm.data.page) {\n+ fm.data.page = {};\n+ }\n+ fm.data.page.excerpt = fm.excerpt;\n+ }\n+ this.frontMatter = fm;\n} else {\nthis.frontMatter = {\ndata: {},\n- content: \"\"\n+ content: \"\",\n+ excerpt: \"\"\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -59,9 +59,7 @@ class UserConfig {\nversionCheck(expected) {\nif (!semver.satisfies(pkg.version, expected)) {\nthrow new UserConfigError(\n- `This project requires the eleventy version to match '${expected}' but found ${\n- pkg.version\n- }. Use \\`npm update @11ty/eleventy -g\\` to upgrade the eleventy global or \\`npm update @11ty/eleventy --save\\` to upgrade your local project version.`\n+ `This project requires the eleventy version to match '${expected}' but found ${pkg.version}. Use \\`npm update @11ty/eleventy -g\\` to upgrade the eleventy global or \\`npm update @11ty/eleventy --save\\` to upgrade your local project version.`\n);\n}\n}\n@@ -495,6 +493,10 @@ class UserConfig {\nthis.browserSyncConfig = options;\n}\n+ setFrontMatterParsingOptions(options = {}) {\n+ this.frontMatterParsingOptions = options;\n+ }\n+\ngetMergingConfigObject() {\nreturn {\ntemplateFormats: this.templateFormats,\n@@ -526,7 +528,8 @@ class UserConfig {\nexperiments: this.experiments,\n// templateExtensionAliases: this.templateExtensionAliases,\nwatchJavaScriptDependencies: this.watchJavaScriptDependencies,\n- browserSyncConfig: this.browserSyncConfig\n+ browserSyncConfig: this.browserSyncConfig,\n+ frontMatterParsingOptions: this.frontMatterParsingOptions\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1657,3 +1657,32 @@ test.skip(\"Issue 413 weird date format\", async t => {\nlet data = await tmpl.getData();\nt.is(data.page.date, \"\");\n});\n+\n+test(\"Custom Front Matter Parsing Options\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ newConfig.frontMatterParsingOptions = {\n+ excerpt: true\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.deepEqual(frontmatter.data, {\n+ front: \"hello\",\n+ page: {\n+ excerpt: `This is an excerpt.\n+`\n+ }\n+ });\n+ t.is(\n+ frontmatter.excerpt,\n+ `This is an excerpt.\n+`\n+ );\n+ t.is(frontmatter.content, \"This is content.\");\n+});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template.njk", "diff": "+---\n+front: hello\n+---\n+This is an excerpt.\n+---\n+This is content.\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
Support customizing front matter parsing options passed to gray-matter plugin. See https://www.npmjs.com/package/gray-matter#options Fixes #410. Needs docs.
699
21.06.2019 20:19:30
18,000
6f6c4c0812456c4f318ea9ef5e5986b2dc388f0a
A bit more readable for
[ { "change_type": "MODIFY", "old_path": "src/TemplateContent.js", "new_path": "src/TemplateContent.js", "diff": "@@ -72,14 +72,9 @@ class TemplateContent {\nlet options = this.config.frontMatterParsingOptions || {};\nlet fm = matter(this.inputContent, options);\nif (options.excerpt && fm.excerpt) {\n- if (\n- fm.content.startsWith(\n- fm.excerpt + (fm.excerpt_separator || \"---\") + \"\\n\"\n- )\n- ) {\n- fm.content = fm.content.substr(\n- (fm.excerpt + (fm.excerpt_separator || \"---\") + \"\\n\").length\n- );\n+ let excerptString = fm.excerpt + (fm.excerpt_separator || \"---\") + \"\\n\";\n+ if (fm.content.startsWith(excerptString)) {\n+ fm.content = fm.content.substr(excerptString.length);\n}\n// add to page.excerpt\n" } ]
JavaScript
MIT License
11ty/eleventy
A bit more readable for #410
699
21.06.2019 20:24:21
18,000
fb1082f0549e1f5da7a0ad11b01b6e4ca644304c
work without a newline after excerpt separator
[ { "change_type": "MODIFY", "old_path": "src/TemplateContent.js", "new_path": "src/TemplateContent.js", "diff": "@@ -72,8 +72,12 @@ class TemplateContent {\nlet options = this.config.frontMatterParsingOptions || {};\nlet fm = matter(this.inputContent, options);\nif (options.excerpt && fm.excerpt) {\n- let excerptString = fm.excerpt + (fm.excerpt_separator || \"---\") + \"\\n\";\n- if (fm.content.startsWith(excerptString)) {\n+ let excerptString = fm.excerpt + (fm.excerpt_separator || \"---\");\n+ if (fm.content.startsWith(excerptString + \"\\n\")) {\n+ // with a newline after excerpt separator\n+ fm.content = fm.content.substr((excerptString + \"\\n\").length);\n+ } else if (fm.content.startsWith(excerptString)) {\n+ // no newline after excerpt separator\nfm.content = fm.content.substr(excerptString.length);\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1686,3 +1686,32 @@ test(\"Custom Front Matter Parsing Options\", async t => {\n);\nt.is(frontmatter.content, \"This is content.\");\n});\n+\n+test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ newConfig.frontMatterParsingOptions = {\n+ excerpt: true\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template-nonewline.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.deepEqual(frontmatter.data, {\n+ front: \"hello\",\n+ page: {\n+ excerpt: `This is an excerpt.\n+`\n+ }\n+ });\n+ t.is(\n+ frontmatter.excerpt,\n+ `This is an excerpt.\n+`\n+ );\n+ t.is(frontmatter.content, \"This is content.\");\n+});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template-nonewline.njk", "diff": "+---\n+front: hello\n+---\n+This is an excerpt.\n+---This is content.\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
#410 work without a newline after excerpt separator
699
21.06.2019 20:45:37
18,000
bce2ae5070636350c2c0e5860acd9b32a3ecf95f
Custom aliasing for
[ { "change_type": "MODIFY", "old_path": "src/TemplateContent.js", "new_path": "src/TemplateContent.js", "diff": "const fs = require(\"fs-extra\");\nconst normalize = require(\"normalize-path\");\nconst matter = require(\"gray-matter\");\n+const lodashSet = require(\"lodash/set\");\nconst TemplateData = require(\"./TemplateData\");\nconst TemplateRender = require(\"./TemplateRender\");\n@@ -81,11 +82,9 @@ class TemplateContent {\nfm.content = fm.content.substr(excerptString.length);\n}\n- // add to page.excerpt\n- if (!fm.data.page) {\n- fm.data.page = {};\n- }\n- fm.data.page.excerpt = fm.excerpt;\n+ // alias, defaults to page.excerpt\n+ let alias = options.excerpt_alias || \"page.excerpt\";\n+ lodashSet(fm.data, alias, fm.excerpt);\n}\nthis.frontMatter = fm;\n} else {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1685,6 +1685,43 @@ test(\"Custom Front Matter Parsing Options\", async t => {\n`\n);\nt.is(frontmatter.content, \"This is content.\");\n+\n+ let fulldata = await tmpl.getData();\n+ t.is(\n+ fulldata.page.excerpt,\n+ `This is an excerpt.\n+`\n+ );\n+});\n+\n+test(\"Custom Front Matter Parsing Options (using alias)\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ newConfig.frontMatterParsingOptions = {\n+ excerpt: true,\n+ excerpt_alias: \"my_excerpt\"\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.deepEqual(frontmatter.data, {\n+ front: \"hello\",\n+ my_excerpt: `This is an excerpt.\n+`\n+ });\n+ t.is(frontmatter.content, \"This is content.\");\n+\n+ let fulldata = await tmpl.getData();\n+ t.is(\n+ fulldata.my_excerpt,\n+ `This is an excerpt.\n+`\n+ );\n});\ntest(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\", async t => {\n@@ -1714,4 +1751,11 @@ test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\",\n`\n);\nt.is(frontmatter.content, \"This is content.\");\n+\n+ let fulldata = await tmpl.getData();\n+ t.is(\n+ fulldata.page.excerpt,\n+ `This is an excerpt.\n+`\n+ );\n});\n" } ]
JavaScript
MIT License
11ty/eleventy
Custom aliasing for #410
699
21.06.2019 20:59:34
18,000
b2c14c0961013ead03315ac62f7999783c251bf9
TOML test for
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"pre-commit\": \"^1.2.2\",\n\"pre-push\": \"^0.1.1\",\n\"prettier\": \"^1.18.2\",\n+ \"toml\": \"^3.0.0\",\n\"viperhtml\": \"^2.17.0\",\n\"vue\": \"^2.6.10\",\n\"vue-server-renderer\": \"^2.6.10\"\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1759,3 +1759,30 @@ test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\",\n`\n);\n});\n+\n+test(\"Custom Front Matter Parsing Options (using TOML)\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ let toml = require(\"toml\");\n+\n+ newConfig.frontMatterParsingOptions = {\n+ engines: {\n+ toml: toml.parse.bind(toml)\n+ }\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template-toml.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.deepEqual(frontmatter.data, {\n+ front: \"hello\"\n+ });\n+ t.is(frontmatter.content, \"This is content.\");\n+\n+ let fulldata = await tmpl.getData();\n+ t.is(fulldata.front, \"hello\");\n+});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template-toml.njk", "diff": "+---toml\n+front = \"hello\"\n+---\n+This is content.\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
TOML test for #410
699
24.06.2019 10:51:50
18,000
22c6ecaca6401b4253ed9dd1bae53b8c03f15d34
Tests for imports, extends, macros
[ { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/_includes/included-relative.njk", "diff": "+akdlsjafkljdskl\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/njk-relative/dir/base.njk", "diff": "+<p>{% block content %}This is a parent.{% endblock %}</p>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/njk-relative/dir/imports.njk", "diff": "+{% macro label(text) %}<label>{{ text }}</label>{% endmacro %}\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
Tests for imports, extends, macros #190
699
24.06.2019 21:45:10
18,000
f36eaa6eb71c9c6fb8a1bcdc45c8792e15725ab2
Windows tests :(
[ { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1676,7 +1676,7 @@ test(\"Custom Front Matter Parsing Options\", async t => {\nt.is(frontmatter.data.page.excerpt.trim(), \"This is an excerpt.\");\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\n- t.is(frontmatter.content, \"This is content.\");\n+ t.is(frontmatter.content.trim(), \"This is content.\");\nlet fulldata = await tmpl.getData();\nt.is(fulldata.page.excerpt.trim(), \"This is an excerpt.\");\n@@ -1699,7 +1699,7 @@ test(\"Custom Front Matter Parsing Options (using alias)\", async t => {\nlet frontmatter = await tmpl.getFrontMatter();\nt.is(frontmatter.data.front, \"hello\");\nt.is(frontmatter.data.my_excerpt.trim(), \"This is an excerpt.\");\n- t.is(frontmatter.content, \"This is content.\");\n+ t.is(frontmatter.content.trim(), \"This is content.\");\nlet fulldata = await tmpl.getData();\nt.is(fulldata.my_excerpt.trim(), \"This is an excerpt.\");\n@@ -1723,7 +1723,7 @@ test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\",\nt.is(frontmatter.data.page.excerpt.trim(), \"This is an excerpt.\");\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\n- t.is(frontmatter.content, \"This is content.\");\n+ t.is(frontmatter.content.trim(), \"This is content.\");\nlet fulldata = await tmpl.getData();\nt.is(fulldata.page.excerpt.trim(), \"This is an excerpt.\");\n@@ -1750,7 +1750,7 @@ test(\"Custom Front Matter Parsing Options (using TOML)\", async t => {\nt.deepEqual(frontmatter.data, {\nfront: \"hello\"\n});\n- t.is(frontmatter.content, \"This is content.\");\n+ t.is(frontmatter.content.trim(), \"This is content.\");\nlet fulldata = await tmpl.getData();\nt.is(fulldata.front, \"hello\");\n" } ]
JavaScript
MIT License
11ty/eleventy
Windows tests :(
699
25.06.2019 08:10:48
18,000
a1dde2166cf709ff0f82562e885ece32aba4b25e
Skip TOML parsing test (fails on Windows), failure in dependency
[ { "change_type": "MODIFY", "old_path": ".editorconfig", "new_path": ".editorconfig", "diff": "@@ -10,6 +10,3 @@ charset = utf-8\n[*.js]\ninsert_final_newline = true\n\\ No newline at end of file\n-\n-[*.njk]\n-insert_final_newline = true\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1729,7 +1729,8 @@ test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\",\nt.is(fulldata.page.excerpt.trim(), \"This is an excerpt.\");\n});\n-test(\"Custom Front Matter Parsing Options (using TOML)\", async t => {\n+test.skip(\"Custom Front Matter Parsing Options (using TOML)\", async t => {\n+ // Depends on https://github.com/jonschlinkert/gray-matter/issues/92 for Windows\nlet newConfig = Object.assign({}, config);\nlet toml = require(\"toml\");\n" } ]
JavaScript
MIT License
11ty/eleventy
Skip TOML parsing test (fails on Windows), failure in dependency https://github.com/jonschlinkert/gray-matter/issues/92
699
04.07.2019 21:01:31
18,000
831df5f9a76d0c3d7b0034ab0ee7223494cd5fe3
Removes a bunch of static usage to get ready for
[ { "change_type": "MODIFY", "old_path": "src/Eleventy.js", "new_path": "src/Eleventy.js", "diff": "const TemplatePath = require(\"./TemplatePath\");\nconst TemplateData = require(\"./TemplateData\");\nconst TemplateWriter = require(\"./TemplateWriter\");\n+const EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst EleventyErrorHandler = require(\"./EleventyErrorHandler\");\nconst EleventyServe = require(\"./EleventyServe\");\nconst EleventyWatchTargets = require(\"./EleventyWatchTargets\");\n@@ -140,15 +141,19 @@ class Eleventy {\nasync init() {\nlet formats = this.formatsOverride || this.config.templateFormats;\n+ this.extensionMap = new EleventyExtensionMap(formats);\n+\nthis.eleventyFiles = new EleventyFiles(\nthis.input,\nthis.outputDir,\nformats,\nthis.isPassthroughAll\n);\n+ this.eleventyFiles.extensionMap = this.extensionMap;\nthis.eleventyFiles.init();\nthis.templateData = new TemplateData(this.inputDir);\n+ this.templateData.extensionMap = this.extensionMap;\nthis.eleventyFiles.setTemplateData(this.templateData);\nthis.writer = new TemplateWriter(\n@@ -159,6 +164,7 @@ class Eleventy {\nthis.isPassthroughAll\n);\n+ this.writer.extensionMap = this.extensionMap;\nthis.writer.setEleventyFiles(this.eleventyFiles);\n// TODO maybe isVerbose -> console.log?\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyExtensionMap.js", "new_path": "src/EleventyExtensionMap.js", "diff": "@@ -2,7 +2,11 @@ const TemplatePath = require(\"./TemplatePath\");\nconst config = require(\"./Config\");\nclass EleventyExtensionMap {\n- constructor(formatKeys = []) {\n+ constructor(formatKeys) {\n+ this.setFormats(formatKeys);\n+ }\n+\n+ setFormats(formatKeys = []) {\nthis.unfilteredFormatKeys = formatKeys.map(function(key) {\nreturn key.trim().toLowerCase();\n});\n@@ -71,8 +75,8 @@ class EleventyExtensionMap {\n}\nhasExtension(key) {\n- for (var extension in EleventyExtensionMap.keyMap) {\n- if (EleventyExtensionMap.keyMap[extension] === key) {\n+ for (var extension in this.keyMap) {\n+ if (this.keyMap[extension] === key) {\nreturn true;\n}\n}\n@@ -89,17 +93,15 @@ class EleventyExtensionMap {\nreturn extensions;\n}\n- getKey(pathOrKey) {\n- return EleventyExtensionMap._getKey(pathOrKey, this.keyMap);\n- }\n- static getKey(pathOrKey) {\n- return EleventyExtensionMap._getKey(pathOrKey, EleventyExtensionMap.keyMap);\n+ hasEngine(pathOrKey) {\n+ return !!this.getKey(pathOrKey);\n}\n- static _getKey(pathOrKey, map) {\n- pathOrKey = pathOrKey.toLowerCase();\n- for (var extension in map) {\n- let key = map[extension];\n+ getKey(pathOrKey) {\n+ pathOrKey = (pathOrKey || \"\").toLowerCase();\n+\n+ for (var extension in this.keyMap) {\n+ let key = this.keyMap[extension];\nif (pathOrKey === extension) {\nreturn key;\n} else if (pathOrKey.endsWith(\".\" + extension)) {\n@@ -109,16 +111,7 @@ class EleventyExtensionMap {\n}\nremoveTemplateExtension(path) {\n- return EleventyExtensionMap._removeTemplateExtension(path, this.keyMap);\n- }\n- static removeTemplateExtension(path) {\n- return EleventyExtensionMap._removeTemplateExtension(\n- path,\n- EleventyExtensionMap.keyMap\n- );\n- }\n- static _removeTemplateExtension(path, map) {\n- for (var extension in map) {\n+ for (var extension in this.keyMap) {\nif (path === extension || path.endsWith(\".\" + extension)) {\nreturn path.substr(0, path.length - 1 - extension.length);\n}\n@@ -127,19 +120,7 @@ class EleventyExtensionMap {\n}\nget keyMap() {\n- return EleventyExtensionMap._getKeyMap(\n- this.config.templateExtensionAliases || {}\n- );\n- }\n- static get keyMap() {\n- return EleventyExtensionMap._getKeyMap(\n- config.getConfig().templateExtensionAliases || {}\n- );\n- }\n-\n- // file extension => key\n- static _getKeyMap(aliases) {\n- let fileExtensionToKeyMap = {\n+ return {\nejs: \"ejs\",\nmd: \"md\",\njstl: \"jstl\",\n@@ -152,12 +133,6 @@ class EleventyExtensionMap {\nliquid: \"liquid\",\n\"11ty.js\": \"11ty.js\"\n};\n-\n- for (let extension in aliases) {\n- fileExtensionToKeyMap[extension] = aliases[extension];\n- }\n-\n- return fileExtensionToKeyMap;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -23,7 +23,6 @@ class EleventyFiles {\nthis.passthroughAll = !!passthroughAll;\nthis.formats = formats;\n- this.extensionMap = new EleventyExtensionMap(formats);\n}\ninitConfig() {\n@@ -42,7 +41,7 @@ class EleventyFiles {\ninit() {\nthis.initFormatsGlobs();\n- this.setPassthroughManager();\n+ this.initPassthroughManager();\nthis.setupGlobs();\n}\n@@ -56,15 +55,22 @@ class EleventyFiles {\nthis.config = config;\nthis.initConfig();\n}\n- /* For testing */\n- _setExtensionMap(map) {\n- this.extensionMap = map;\n- }\n/* Set command root for local project paths */\n_setLocalPathRoot(dir) {\nthis.localPathRoot = dir;\n}\n+ set extensionMap(extensionMap) {\n+ this._extensionMap = extensionMap;\n+ }\n+\n+ get extensionMap() {\n+ if (!this._extensionMap) {\n+ this._extensionMap = new EleventyExtensionMap(this.formats);\n+ }\n+ return this._extensionMap;\n+ }\n+\nsetPassthroughAll(passthroughAll) {\nthis.passthroughAll = !!passthroughAll;\n}\n@@ -80,17 +86,20 @@ class EleventyFiles {\n}\n}\n+ initPassthroughManager() {\n+ let mgr = new TemplatePassthroughManager();\n+ mgr.setInputDir(this.inputDir);\n+ mgr.setOutputDir(this.outputDir);\n+ mgr.extensionMap = this.extensionMap;\n+ this.passthroughManager = mgr;\n+ }\n+\ngetPassthroughManager() {\nreturn this.passthroughManager;\n}\nsetPassthroughManager(mgr) {\n- if (!mgr) {\n- mgr = new TemplatePassthroughManager();\n- mgr.setInputDir(this.inputDir);\n- mgr.setOutputDir(this.outputDir);\n- }\n-\n+ mgr.extensionMap = this.extensionMap;\nthis.passthroughManager = mgr;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Template.js", "new_path": "src/Template.js", "diff": "@@ -4,7 +4,6 @@ const normalize = require(\"normalize-path\");\nconst lodashIsObject = require(\"lodash/isObject\");\nconst { DateTime } = require(\"luxon\");\n-const EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst TemplateData = require(\"./TemplateData\");\nconst TemplateContent = require(\"./TemplateContent\");\nconst TemplatePath = require(\"./TemplatePath\");\n@@ -71,9 +70,7 @@ class Template extends TemplateContent {\n}\nget baseFile() {\n- return (this._extensionMap || EleventyExtensionMap).removeTemplateExtension(\n- this.parsed.base\n- );\n+ return this.extensionMap.removeTemplateExtension(this.parsed.base);\n}\nget htmlIOException() {\n@@ -450,9 +447,7 @@ class Template extends TemplateContent {\nget templateContent() {\nif (!this._templateContent) {\nthrow new TemplateContentPrematureUseError(\n- `Tried to use templateContent too early (${\n- this.inputPath\n- } page ${this.pageNumber})`\n+ `Tried to use templateContent too early (${this.inputPath} page ${this.pageNumber})`\n);\n}\nreturn this._templateContent;\n@@ -609,9 +604,7 @@ class Template extends TemplateContent {\nlet date = DateTime.fromISO(data.date, { zone: \"utc\" });\nif (!date.isValid) {\nthrow new Error(\n- `date front matter value (${data.date}) is invalid for ${\n- this.inputPath\n- }`\n+ `date front matter value (${data.date}) is invalid for ${this.inputPath}`\n);\n}\ndebug(\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateContent.js", "new_path": "src/TemplateContent.js", "diff": "@@ -3,6 +3,7 @@ const normalize = require(\"normalize-path\");\nconst matter = require(\"gray-matter\");\nconst lodashSet = require(\"lodash/set\");\n+const EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst TemplateData = require(\"./TemplateData\");\nconst TemplateRender = require(\"./TemplateRender\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\n@@ -26,7 +27,14 @@ class TemplateContent {\n}\n/* Used by tests */\n- _setExtensionMap(map) {\n+ get extensionMap() {\n+ if (!this._extensionMap) {\n+ this._extensionMap = new EleventyExtensionMap();\n+ }\n+ return this._extensionMap;\n+ }\n+\n+ set extensionMap(map) {\nthis._extensionMap = map;\n}\n@@ -51,7 +59,7 @@ class TemplateContent {\nthis._templateRender = new TemplateRender(\nthis.inputPath,\nthis.inputDir,\n- this._extensionMap\n+ this.extensionMap\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateData.js", "new_path": "src/TemplateData.js", "diff": "@@ -29,6 +29,18 @@ class TemplateData {\nthis.globalData = null;\n}\n+ // for tests\n+ get extensionMap() {\n+ if (!this._extensionMap) {\n+ this._extensionMap = new EleventyExtensionMap();\n+ }\n+ return this._extensionMap;\n+ }\n+\n+ set extensionMap(map) {\n+ this._extensionMap = map;\n+ }\n+\n/* Used by tests */\n_setConfig(config) {\nthis.config = config;\n@@ -161,11 +173,7 @@ class TemplateData {\n// TODO maybe merge these two? (if both valid objects)\nif (dataFileConflicts[folders]) {\ndebugWarn(\n- `Warning: the key for a global data file (${\n- files[j]\n- }) will overwrite data from an already existing global data file (${\n- dataFileConflicts[folders]\n- })`\n+ `Warning: the key for a global data file (${files[j]}) will overwrite data from an already existing global data file (${dataFileConflicts[folders]})`\n);\n}\ndataFileConflicts[folders] = files[j];\n@@ -290,7 +298,7 @@ class TemplateData {\ndebugDev(\"parsed.dir: %o\", parsed.dir);\nif (parsed.dir) {\n- let fileNameNoExt = EleventyExtensionMap.removeTemplateExtension(\n+ let fileNameNoExt = this.extensionMap.removeTemplateExtension(\nparsed.base\n);\nlet filePathNoExt = parsed.dir + \"/\" + fileNameNoExt;\n@@ -341,9 +349,8 @@ class TemplateData {\nif (\"tags\" in data) {\nif (typeof data.tags === \"string\") {\ndata.tags = data.tags ? [data.tags] : [];\n- }\n- else if (data.tags === null){\n- data.tags = []\n+ } else if (data.tags === null) {\n+ data.tags = [];\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "const config = require(\"./Config\");\n+const EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\nconst TemplatePassthrough = require(\"./TemplatePassthrough\");\n-const TemplateRender = require(\"./TemplateRender\");\nconst TemplatePath = require(\"./TemplatePath\");\nconst debug = require(\"debug\")(\"Eleventy:TemplatePassthroughManager\");\nclass TemplatePassthroughManagerCopyError extends EleventyBaseError {}\nclass TemplatePassthroughManager {\n+ // TODO bunch of unused args here\nconstructor(inputDir, outputDir, isDryRun) {\nthis.config = config.getConfig();\n@@ -23,6 +24,17 @@ class TemplatePassthroughManager {\nthis.config = configOverride || {};\n}\n+ set extensionMap(extensionMap) {\n+ this._extensionMap = extensionMap;\n+ }\n+\n+ get extensionMap() {\n+ if (!this._extensionMap) {\n+ this._extensionMap = new EleventyExtensionMap();\n+ }\n+ return this._extensionMap;\n+ }\n+\nsetOutputDir(outputDir) {\nthis.outputDir = outputDir;\n}\n@@ -65,7 +77,7 @@ class TemplatePassthroughManager {\nlet matches = [];\nfor (let path of paths) {\n- if (!TemplateRender.hasEngine(path)) {\n+ if (!this.extensionMap.hasEngine(path)) {\nmatches.push(path);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateRender.js", "new_path": "src/TemplateRender.js", "diff": "@@ -45,8 +45,19 @@ class TemplateRender {\n}\n}\n+ set extensionMap(extensionMap) {\n+ this._extensionMap = extensionMap;\n+ }\n+\n+ get extensionMap() {\n+ if (!this._extensionMap) {\n+ this._extensionMap = new EleventyExtensionMap();\n+ }\n+ return this._extensionMap;\n+ }\n+\ninit(engineNameOrPath) {\n- this.engineName = this.cleanupEngineName(engineNameOrPath);\n+ this.engineName = this.extensionMap.getKey(engineNameOrPath);\nif (!this.engineName) {\nthrow new TemplateRenderUnknownEngineError(\n`Unknown engine for ${engineNameOrPath}`\n@@ -56,24 +67,6 @@ class TemplateRender {\nthis.engine.initRequireCache(this.path);\n}\n- cleanupEngineName(tmplPath) {\n- return TemplateRender._cleanupEngineName(\n- tmplPath,\n- this.extensionMap || EleventyExtensionMap\n- );\n- }\n- static cleanupEngineName(tmplPath) {\n- return TemplateRender._cleanupEngineName(tmplPath, EleventyExtensionMap);\n- }\n- static _cleanupEngineName(tmplPath, extensionMapRef) {\n- return extensionMapRef.getKey(tmplPath);\n- }\n-\n- static hasEngine(tmplPath) {\n- let name = TemplateRender.cleanupEngineName(tmplPath);\n- return TemplateEngine.hasEngine(name);\n- }\n-\nstatic parseEngineOverrides(engineName) {\nlet overlappingEngineWarningCount = 0;\nlet engines = [];\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateWriter.js", "new_path": "src/TemplateWriter.js", "diff": "@@ -3,6 +3,7 @@ const TemplatePath = require(\"./TemplatePath\");\nconst TemplateMap = require(\"./TemplateMap\");\nconst TemplateRender = require(\"./TemplateRender\");\nconst EleventyFiles = require(\"./EleventyFiles\");\n+const EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\nconst EleventyErrorHandler = require(\"./EleventyErrorHandler\");\nconst EleventyErrorUtil = require(\"./EleventyErrorUtil\");\n@@ -49,6 +50,19 @@ class TemplateWriter {\nthis.eleventyFiles = eleventyFiles;\n}\n+ set extensionMap(extensionMap) {\n+ this._extensionMap = extensionMap;\n+ }\n+\n+ get extensionMap() {\n+ if (!this._extensionMap) {\n+ this._extensionMap = new EleventyExtensionMap(\n+ this.config.templateFormats\n+ );\n+ }\n+ return this._extensionMap;\n+ }\n+\ngetFileManager() {\n// usually Eleventy.js will setEleventyFiles with the EleventyFiles manager\nif (!this.eleventyFiles) {\n@@ -77,6 +91,8 @@ class TemplateWriter {\nthis.templateData\n);\n+ tmpl.extensionMap = this.extensionMap;\n+\ntmpl.setIsVerbose(this.isVerbose);\ntmpl.setDryRun(this.isDryRun);\n@@ -106,7 +122,7 @@ class TemplateWriter {\nasync _addToTemplateMap(paths) {\nlet promises = [];\nfor (let path of paths) {\n- if (TemplateRender.hasEngine(path)) {\n+ if (this.extensionMap.hasEngine(path)) {\npromises.push(\nthis.templateMap.add(this._createTemplate(path)).then(() => {\ndebug(`${path} added to map.`);\n" }, { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -51,7 +51,6 @@ class UserConfig {\nthis.dataDeepMerge = false;\nthis.experiments = new Set();\n// this.userExtensionMap = {};\n- // this.templateExtensionAliases = {};\nthis.watchJavaScriptDependencies = true;\nthis.browserSyncConfig = {};\n}\n@@ -481,10 +480,6 @@ class UserConfig {\nthis.dataDeepMerge = !!deepMerge;\n}\n- // addTemplateExtensionAlias(targetKey, extension) {\n- // this.templateExtensionAliases[extension] = targetKey;\n- // }\n-\nsetWatchJavaScriptDependencies(watchEnabled) {\nthis.watchJavaScriptDependencies = !!watchEnabled;\n}\n@@ -526,7 +521,6 @@ class UserConfig {\nuseGitIgnore: this.useGitIgnore,\ndataDeepMerge: this.dataDeepMerge,\nexperiments: this.experiments,\n- // templateExtensionAliases: this.templateExtensionAliases,\nwatchJavaScriptDependencies: this.watchJavaScriptDependencies,\nbrowserSyncConfig: this.browserSyncConfig,\nfrontMatterParsingOptions: this.frontMatterParsingOptions\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyExtensionMapTest.js", "new_path": "test/EleventyExtensionMapTest.js", "diff": "@@ -77,67 +77,69 @@ test(\"fileList with dir in path and dir\", t => {\n});\ntest(\"removeTemplateExtension\", t => {\n- t.is(\n- EleventyExtensionMap.removeTemplateExtension(\"component.njk\"),\n- \"component\"\n- );\n- t.is(\n- EleventyExtensionMap.removeTemplateExtension(\"component.11ty.js\"),\n- \"component\"\n- );\n-\n- t.is(EleventyExtensionMap.removeTemplateExtension(\"\"), \"\");\n- t.is(EleventyExtensionMap.removeTemplateExtension(\"component\"), \"component\");\n- t.is(\n- EleventyExtensionMap.removeTemplateExtension(\"component.js\"),\n- \"component.js\"\n- );\n-});\n-\n-test(\"getKey\", t => {\n- t.is(EleventyExtensionMap.getKey(\"component.njk\"), \"njk\");\n- t.is(EleventyExtensionMap.getKey(\"component.11ty.js\"), \"11ty.js\");\n- t.is(EleventyExtensionMap.getKey(\"11ty.js\"), \"11ty.js\");\n- t.is(EleventyExtensionMap.getKey(\".11ty.js\"), \"11ty.js\");\n+ let map = new EleventyExtensionMap([\"njk\", \"11ty.js\"]);\n+ t.is(map.removeTemplateExtension(\"component.njk\"), \"component\");\n+ t.is(map.removeTemplateExtension(\"component.11ty.js\"), \"component\");\n+\n+ t.is(map.removeTemplateExtension(\"\"), \"\");\n+ t.is(map.removeTemplateExtension(\"component\"), \"component\");\n+ t.is(map.removeTemplateExtension(\"component.js\"), \"component.js\");\n+});\n+\n+test(\"hasEngine\", t => {\n+ let map = new EleventyExtensionMap([\n+ \"liquid\",\n+ \"njk\",\n+ \"11ty.js\",\n+ \"ejs\",\n+ \"pug\"\n+ ]);\n+ t.true(map.hasEngine(\"default.ejs\"));\n+ t.is(map.getKey(\"default.ejs\"), \"ejs\");\n+ t.falsy(map.getKey());\n+ t.is(map.getKey(\"EjS\"), \"ejs\");\n+ t.true(map.hasEngine(\"EjS\"));\n+ t.true(map.hasEngine(\"ejs\"));\n+ t.falsy(map.getKey(\"sldkjfkldsj\"));\n+ t.false(map.hasEngine(\"sldkjfkldsj\"));\n- t.is(EleventyExtensionMap.getKey(\"sample.md\"), \"md\");\n+ t.is(map.getKey(\"11ty.js\"), \"11ty.js\");\n+ t.true(map.hasEngine(\"11ty.js\"));\n- t.is(EleventyExtensionMap.getKey(\"\"), undefined);\n- t.is(EleventyExtensionMap.getKey(\"js\"), undefined);\n- t.is(EleventyExtensionMap.getKey(\"component\"), undefined);\n- t.is(EleventyExtensionMap.getKey(\"component.js\"), undefined);\n+ t.is(map.getKey(\"md\"), \"md\");\n+ t.true(map.hasEngine(\"md\"));\n});\n-test(\"Extension aliasing (one format key)\", t => {\n- let map = new EleventyExtensionMap([\"md\"]);\n- map.config = {\n- templateExtensionAliases: {\n- markdown: \"md\",\n- nunjucks: \"njk\" // N/A to current format list\n- }\n- };\n- t.deepEqual(map.getExtensionsFromKey(\"md\"), [\"md\", \"markdown\"]);\n- t.deepEqual(map.getExtensionsFromKey(\"njk\"), [\"njk\", \"nunjucks\"]);\n+test(\"hasEngine no formats passed in\", t => {\n+ let map = new EleventyExtensionMap([]);\n+ t.true(map.hasEngine(\"default.ejs\"));\n+ t.is(map.getKey(\"default.ejs\"), \"ejs\");\n+ t.falsy(map.getKey());\n+ t.is(map.getKey(\"EjS\"), \"ejs\");\n+ t.true(map.hasEngine(\"EjS\"));\n+ t.true(map.hasEngine(\"ejs\"));\n+ t.falsy(map.getKey(\"sldkjfkldsj\"));\n+ t.false(map.hasEngine(\"sldkjfkldsj\"));\n+\n+ // should return keys for engines that exist but are not filtered\n+ t.is(map.getKey(\"11ty.js\"), \"11ty.js\");\n+ t.true(map.hasEngine(\"11ty.js\"));\n- // should filter out N/A aliases\n- t.deepEqual(map.getGlobs(\".\"), [\"./**/*.md\", \"./**/*.markdown\"]);\n+ t.is(map.getKey(\"md\"), \"md\");\n+ t.true(map.hasEngine(\"md\"));\n});\n-test(\"Extension aliasing (two format keys)\", t => {\n- let map = new EleventyExtensionMap([\"md\", \"njk\"]);\n- map.config = {\n- templateExtensionAliases: {\n- markdown: \"md\",\n- nunjucks: \"njk\"\n- }\n- };\n- t.deepEqual(map.getExtensionsFromKey(\"md\"), [\"md\", \"markdown\"]);\n- t.deepEqual(map.getExtensionsFromKey(\"njk\"), [\"njk\", \"nunjucks\"]);\n-\n- t.deepEqual(map.getGlobs(\".\"), [\n- \"./**/*.md\",\n- \"./**/*.markdown\",\n- \"./**/*.njk\",\n- \"./**/*.nunjucks\"\n- ]);\n+test(\"getKey\", t => {\n+ let map = new EleventyExtensionMap([\"njk\", \"11ty.js\", \"md\"]);\n+ t.is(map.getKey(\"component.njk\"), \"njk\");\n+ t.is(map.getKey(\"component.11ty.js\"), \"11ty.js\");\n+ t.is(map.getKey(\"11ty.js\"), \"11ty.js\");\n+ t.is(map.getKey(\".11ty.js\"), \"11ty.js\");\n+\n+ t.is(map.getKey(\"sample.md\"), \"md\");\n+\n+ t.is(map.getKey(\"\"), undefined);\n+ t.is(map.getKey(\"js\"), undefined);\n+ t.is(map.getKey(\"component\"), undefined);\n+ t.is(map.getKey(\"component.js\"), undefined);\n});\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyFilesTest.js", "new_path": "test/EleventyFilesTest.js", "diff": "@@ -54,8 +54,8 @@ test(\"getFiles (with js, treated as passthrough copy)\", async t => {\n\"./test/stubs/writeTestJS/test.11ty.js\"\n].sort()\n);\n- t.false(TemplateRender.hasEngine(\"./test/stubs/writeTestJS/sample.js\"));\n- t.true(TemplateRender.hasEngine(\"./test/stubs/writeTestJS/test.11ty.js\"));\n+ t.false(evf.extensionMap.hasEngine(\"./test/stubs/writeTestJS/sample.js\"));\n+ t.true(evf.extensionMap.hasEngine(\"./test/stubs/writeTestJS/test.11ty.js\"));\n});\ntest(\"getFiles (with case insensitivity)\", async t => {\n@@ -73,8 +73,8 @@ test(\"getFiles (with case insensitivity)\", async t => {\n\"./test/stubs/writeTestJS/test.11ty.js\"\n].sort()\n);\n- t.false(TemplateRender.hasEngine(\"./test/stubs/writeTestJS/sample.js\"));\n- t.true(TemplateRender.hasEngine(\"./test/stubs/writeTestJS/test.11ty.js\"));\n+ t.false(evf.extensionMap.hasEngine(\"./test/stubs/writeTestJS/sample.js\"));\n+ t.true(evf.extensionMap.hasEngine(\"./test/stubs/writeTestJS/test.11ty.js\"));\n});\ntest(\"Mutually exclusive Input and Output dirs\", async t => {\n@@ -566,25 +566,3 @@ test(\"Glob Watcher Files with passthroughAll\", async t => {\nt.is((await evf.getFileGlobs())[0], \"./test/stubs/**\");\n});\n-\n-test(\"File extension aliasing\", async t => {\n- let map = new EleventyExtensionMap([\"md\"]);\n- map.config = {\n- templateExtensionAliases: {\n- markdown: \"md\"\n- }\n- };\n-\n- let evf = new EleventyFiles(\n- \"./test/stubs/writeTestMarkdown\",\n- \"./test/stubs/_writeTestMarkdownSite\",\n- [\"md\"]\n- );\n- evf._setExtensionMap(map);\n- evf.init();\n-\n- t.deepEqual(await evf.getFiles(), [\n- \"./test/stubs/writeTestMarkdown/sample.md\",\n- \"./test/stubs/writeTestMarkdown/sample2.markdown\"\n- ]);\n-});\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderTest.js", "new_path": "test/TemplateRenderTest.js", "diff": "import test from \"ava\";\nimport TemplateRender from \"../src/TemplateRender\";\n-import path from \"path\";\ntest(\"Basic\", t => {\n- // Path is unnecessary but supported\n- t.is(TemplateRender.cleanupEngineName(\"default.ejs\"), \"ejs\");\n- t.true(TemplateRender.hasEngine(\"default.ejs\"));\n- t.is(new TemplateRender(\"default.ejs\").getEngineName(), \"ejs\");\n-\n- // Better\n- t.is(TemplateRender.cleanupEngineName(\"ejs\"), \"ejs\");\n- t.is(TemplateRender.cleanupEngineName(\"EjS\"), \"ejs\");\n- t.true(TemplateRender.hasEngine(\"EjS\"));\n- t.true(TemplateRender.hasEngine(\"ejs\"));\n- t.is(new TemplateRender(\"ejs\").getEngineName(), \"ejs\");\n-\n- t.falsy(TemplateRender.cleanupEngineName(\"sldkjfkldsj\"));\n- t.false(TemplateRender.hasEngine(\"sldkjfkldsj\"));\n+ t.throws(() => {\n+ new TemplateRender(\"sldkjfkldsj\");\n+ });\n});\ntest(\"Includes Dir\", async t => {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -525,95 +525,3 @@ test(\"Write Test 11ty.js\", async t => {\n\"./test/stubs/_writeTestJSSite/test/index.html\"\n);\n});\n-\n-test.skip(\"Markdown with alias\", async t => {\n- let map = new EleventyExtensionMap([\"md\"]);\n- map.config = {\n- templateExtensionAliases: {\n- markdown: \"md\"\n- }\n- };\n-\n- let evf = new EleventyFiles(\n- \"./test/stubs/writeTestMarkdown\",\n- \"./test/stubs/_writeTestMarkdownSite\",\n- [\"md\"]\n- );\n- evf._setExtensionMap(map);\n- evf.init();\n-\n- let files = await fastglob.async(evf.getFileGlobs());\n- t.deepEqual(evf.getRawFiles(), [\n- \"./test/stubs/writeTestMarkdown/**/*.md\",\n- \"./test/stubs/writeTestMarkdown/**/*.markdown\"\n- ]);\n- t.true(files.indexOf(\"./test/stubs/writeTestMarkdown/sample.md\") > -1);\n- t.true(files.indexOf(\"./test/stubs/writeTestMarkdown/sample2.markdown\") > -1);\n-\n- let tw = new TemplateWriter(\n- \"./test/stubs/writeTestMarkdown\",\n- \"./test/stubs/_writeTestMarkdownSite\"\n- );\n- tw.setEleventyFiles(evf);\n-\n- let tmpl = tw._createTemplate(files[0]);\n- tmpl._setExtensionMap(map);\n- t.is(\n- await tmpl.getOutputPath(),\n- \"./test/stubs/_writeTestMarkdownSite/sample/index.html\"\n- );\n-\n- let tmpl2 = tw._createTemplate(files[1]);\n- tmpl2._setExtensionMap(map);\n- t.is(\n- await tmpl2.getOutputPath(),\n- \"./test/stubs/_writeTestMarkdownSite/sample2/index.html\"\n- );\n-});\n-\n-test.skip(\"JavaScript with alias\", async t => {\n- let map = new EleventyExtensionMap([\"11ty.js\"]);\n- map.config = {\n- templateExtensionAliases: {\n- js: \"11ty.js\"\n- }\n- };\n-\n- let evf = new EleventyFiles(\n- \"./test/stubs/writeTestJS\",\n- \"./test/stubs/_writeTestJSSite\",\n- [\"11ty.js\"]\n- );\n- evf._setExtensionMap(map);\n- evf.init();\n-\n- let files = await fastglob.async(evf.getFileGlobs());\n- t.deepEqual(evf.getRawFiles(), [\n- \"./test/stubs/writeTestJS/**/*.11ty.js\",\n- \"./test/stubs/writeTestJS/**/*.js\"\n- ]);\n- t.deepEqual(files, [\n- \"./test/stubs/writeTestJS/sample.js\",\n- \"./test/stubs/writeTestJS/test.11ty.js\"\n- ]);\n-\n- let tw = new TemplateWriter(\n- \"./test/stubs/writeTestJS\",\n- \"./test/stubs/_writeTestJSSite\"\n- );\n- tw.setEleventyFiles(evf);\n-\n- let tmpl = tw._createTemplate(files[0]);\n- tmpl._setExtensionMap(map);\n- t.is(\n- await tmpl.getOutputPath(),\n- \"./test/stubs/_writeTestJSSite/sample/index.html\"\n- );\n-\n- let tmpl2 = tw._createTemplate(files[1]);\n- tmpl2._setExtensionMap(map);\n- t.is(\n- await tmpl2.getOutputPath(),\n- \"./test/stubs/_writeTestJSSite/test/index.html\"\n- );\n-});\n" } ]
JavaScript
MIT License
11ty/eleventy
Removes a bunch of static usage to get ready for #117
699
04.07.2019 22:36:39
18,000
59c6aabba905731dbe6e57eb902d337dc7f62f32
More static removal
[ { "change_type": "MODIFY", "old_path": "src/Engines/Html.js", "new_path": "src/Engines/Html.js", "diff": "@@ -3,7 +3,7 @@ const TemplateEngine = require(\"./TemplateEngine\");\nclass Html extends TemplateEngine {\nasync compile(str, inputPath, preTemplateEngine) {\nif (preTemplateEngine) {\n- let engine = TemplateEngine.getEngine(\n+ let engine = this.engineManager.getEngine(\npreTemplateEngine,\nsuper.getIncludesDir()\n);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Markdown.js", "new_path": "src/Engines/Markdown.js", "diff": "@@ -52,7 +52,7 @@ class Markdown extends TemplateEngine {\nlet engine;\nif (typeof preTemplateEngine === \"string\") {\n- engine = TemplateEngine.getEngine(\n+ engine = this.engineManager.getEngine(\npreTemplateEngine,\nsuper.getIncludesDir()\n);\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/TemplateEngine.js", "new_path": "src/Engines/TemplateEngine.js", "diff": "@@ -28,6 +28,14 @@ class TemplateEngine {\nthis._config = config;\n}\n+ get engineManager() {\n+ return this._engineManager;\n+ }\n+\n+ set engineManager(manager) {\n+ this._engineManager = manager;\n+ }\n+\ngetName() {\nreturn this.name;\n}\n@@ -110,37 +118,6 @@ class TemplateEngine {\ninitRequireCache(inputPath) {\n// do nothing\n}\n-\n- static get templateKeyMapToClassName() {\n- return {\n- ejs: \"Ejs\",\n- md: \"Markdown\",\n- jstl: \"JavaScriptTemplateLiteral\",\n- html: \"Html\",\n- hbs: \"Handlebars\",\n- mustache: \"Mustache\",\n- haml: \"Haml\",\n- pug: \"Pug\",\n- njk: \"Nunjucks\",\n- liquid: \"Liquid\",\n- \"11ty.js\": \"JavaScript\"\n- };\n- }\n-\n- static hasEngine(name) {\n- return name in TemplateEngine.templateKeyMapToClassName;\n- }\n-\n- static getEngine(name, includesDir) {\n- if (!this.hasEngine(name)) {\n- throw new Error(\n- `Template Engine ${name} does not exist in getEngine (includes dir: ${includesDir})`\n- );\n- }\n-\n- const cls = require(\"./\" + TemplateEngine.templateKeyMapToClassName[name]);\n- return new cls(name, includesDir);\n- }\n}\nmodule.exports = TemplateEngine;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/TemplateEngineManager.js", "diff": "+class TemplateEngineManager {\n+ constructor() {}\n+\n+ getClassNameFromTemplateKey(key) {\n+ let keys = {\n+ ejs: \"Ejs\",\n+ md: \"Markdown\",\n+ jstl: \"JavaScriptTemplateLiteral\",\n+ html: \"Html\",\n+ hbs: \"Handlebars\",\n+ mustache: \"Mustache\",\n+ haml: \"Haml\",\n+ pug: \"Pug\",\n+ njk: \"Nunjucks\",\n+ liquid: \"Liquid\",\n+ \"11ty.js\": \"JavaScript\"\n+ };\n+\n+ return keys[key];\n+ }\n+\n+ hasEngine(name) {\n+ return !!this.getClassNameFromTemplateKey(name);\n+ }\n+\n+ getEngine(name, includesDir) {\n+ if (!this.hasEngine(name)) {\n+ throw new Error(\n+ `Template Engine ${name} does not exist in getEngine (includes dir: ${includesDir})`\n+ );\n+ }\n+\n+ const cls = require(\"./Engines/\" + this.getClassNameFromTemplateKey(name));\n+ let instance = new cls(name, includesDir);\n+ instance.engineManager = this;\n+ return instance;\n+ }\n+}\n+\n+module.exports = TemplateEngineManager;\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateRender.js", "new_path": "src/TemplateRender.js", "diff": "const TemplatePath = require(\"./TemplatePath\");\nconst TemplateEngine = require(\"./Engines/TemplateEngine\");\n+const TemplateEngineManager = require(\"./TemplateEngineManager\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\nconst EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst config = require(\"./Config\");\n@@ -63,7 +64,11 @@ class TemplateRender {\n`Unknown engine for ${engineNameOrPath}`\n);\n}\n- this.engine = TemplateEngine.getEngine(this.engineName, this.includesDir);\n+ this.engineManager = new TemplateEngineManager();\n+ this.engine = this.engineManager.getEngine(\n+ this.engineName,\n+ this.includesDir\n+ );\nthis.engine.initRequireCache(this.path);\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/TemplateEngineManagerTest.js", "diff": "+import test from \"ava\";\n+import TemplateEngineManager from \"../src/TemplateEngineManager\";\n+\n+test(\"Unsupported engine\", async t => {\n+ t.throws(() => {\n+ let tem = new TemplateEngineManager();\n+ tem.getEngine(\"doesnotexist\");\n+ });\n+});\n+\n+test(\"Supported engine\", async t => {\n+ let tem = new TemplateEngineManager();\n+ t.truthy(tem.hasEngine(\"ejs\"));\n+});\n+\n+test(\"Handlebars Helpers\", async t => {\n+ let tem = new TemplateEngineManager();\n+ let engine = tem.getEngine(\"hbs\");\n+ engine.addHelpers({\n+ uppercase: function(name) {\n+ return name.toUpperCase();\n+ }\n+ });\n+\n+ let fn = await engine.compile(\"<p>{{uppercase author}}</p>\");\n+ t.is(await fn({ author: \"zach\" }), \"<p>ZACH</p>\");\n+});\n+\n+test(\"getEngineLib\", async t => {\n+ let tem = new TemplateEngineManager();\n+ t.truthy(tem.getEngine(\"md\").getEngineLib());\n+});\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateEngineTest.js", "new_path": "test/TemplateEngineTest.js", "diff": "@@ -3,29 +3,8 @@ import TemplateEngine from \"../src/Engines/TemplateEngine\";\ntest(\"Unsupported engine\", async t => {\nt.is(new TemplateEngine(\"doesnotexist\").getName(), \"doesnotexist\");\n-\n- t.throws(() => {\n- TemplateEngine.getEngine(\"doesnotexist\");\n- });\n});\ntest(\"Supported engine\", async t => {\nt.is(new TemplateEngine(\"ejs\").getName(), \"ejs\");\n- t.truthy(TemplateEngine.hasEngine(\"ejs\"));\n-});\n-\n-test(\"Handlebars Helpers\", async t => {\n- let engine = TemplateEngine.getEngine(\"hbs\");\n- engine.addHelpers({\n- uppercase: function(name) {\n- return name.toUpperCase();\n- }\n- });\n-\n- let fn = await engine.compile(\"<p>{{uppercase author}}</p>\");\n- t.is(await fn({ author: \"zach\" }), \"<p>ZACH</p>\");\n-});\n-\n-test(\"getEngineLib\", async t => {\n- t.truthy(TemplateEngine.getEngine(\"md\").getEngineLib());\n});\n" } ]
JavaScript
MIT License
11ty/eleventy
More static removal
699
05.07.2019 12:19:40
18,000
6a9da7bb53161634d76ec302a97ee54d8aacee0b
Also adds case sensitivity to the file names in the test for
[ { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -278,7 +278,12 @@ class EleventyFiles {\ndebug(\"Searching for: %o\", globs);\nlet paths = TemplatePath.addLeadingDotSlashArray(\n- await fastglob.async(globs, { nocase: true, onlyFiles: true })\n+ await fastglob.async(globs, {\n+ // nocase: true (case insensitive match) was the old property but was from node-glob, not fastglob\n+ caseSensitiveMatch: false,\n+ onlyFiles: true,\n+ dot: true\n+ })\n);\nthis.pathCache = paths;\nreturn paths;\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyFilesTest.js", "new_path": "test/EleventyFilesTest.js", "diff": "@@ -60,8 +60,8 @@ test(\"getFiles (with js, treated as passthrough copy)\", async t => {\ntest(\"getFiles (with case insensitivity)\", async t => {\nlet evf = new EleventyFiles(\n- \"./test/stubs/writeTestJS\",\n- \"./test/stubs/_writeTestJSSite\",\n+ \"./test/stubs/writeTestJS-casesensitive\",\n+ \"./test/stubs/_writeTestJSCaseSensitiveSite\",\n[\"JS\"]\n);\nevf.init();\n@@ -69,12 +69,20 @@ test(\"getFiles (with case insensitivity)\", async t => {\nt.deepEqual(\n(await evf.getFiles()).sort(),\n[\n- \"./test/stubs/writeTestJS/sample.js\",\n- \"./test/stubs/writeTestJS/test.11ty.js\"\n+ \"./test/stubs/writeTestJS-casesensitive/sample.Js\",\n+ \"./test/stubs/writeTestJS-casesensitive/test.11Ty.js\"\n].sort()\n);\n- t.false(evf.extensionMap.hasEngine(\"./test/stubs/writeTestJS/sample.js\"));\n- t.true(evf.extensionMap.hasEngine(\"./test/stubs/writeTestJS/test.11ty.js\"));\n+ t.false(\n+ evf.extensionMap.hasEngine(\n+ \"./test/stubs/writeTestJS-casesensitive/sample.Js\"\n+ )\n+ );\n+ t.true(\n+ evf.extensionMap.hasEngine(\n+ \"./test/stubs/writeTestJS-casesensitive/test.11Ty.js\"\n+ )\n+ );\n});\ntest(\"Mutually exclusive Input and Output dirs\", async t => {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/writeTestJS-casesensitive/sample.Js", "diff": "+module.exports = \"<p>Zach</p>\";\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/writeTestJS-casesensitive/test.11Ty.js", "diff": "+module.exports = \"<p>Zach</p>\";\n" } ]
JavaScript
MIT License
11ty/eleventy
Also adds case sensitivity to the file names in the test for #517
699
05.07.2019 15:53:37
18,000
6eabbc235fde1201f8c3eb8bc6832c3eacbf7dfd
Bunch more refactoring to get ready for
[ { "change_type": "MODIFY", "old_path": "src/EleventyExtensionMap.js", "new_path": "src/EleventyExtensionMap.js", "diff": "@@ -3,6 +3,7 @@ const config = require(\"./Config\");\nclass EleventyExtensionMap {\nconstructor(formatKeys) {\n+ this.config = config.getConfig();\nthis.setFormats(formatKeys);\n}\n@@ -11,17 +12,17 @@ class EleventyExtensionMap {\nreturn key.trim().toLowerCase();\n});\n- this.formatKeys = this.unfilteredFormatKeys.filter(key =>\n+ this.validTemplateLanguageKeys = this.unfilteredFormatKeys.filter(key =>\nthis.hasExtension(key)\n);\n- this.prunedFormatKeys = this.unfilteredFormatKeys.filter(\n+ this.passthroughCopyKeys = this.unfilteredFormatKeys.filter(\nkey => !this.hasExtension(key)\n);\n}\nget config() {\n- return this.configOverride || config.getConfig();\n+ return this.configOverride || this.config.getConfig();\n}\nset config(cfg) {\nthis.configOverride = cfg;\n@@ -34,7 +35,7 @@ class EleventyExtensionMap {\n}\nlet files = [];\n- this.formatKeys.forEach(\n+ this.validTemplateLanguageKeys.forEach(\nfunction(key) {\nthis.getExtensionsFromKey(key).forEach(function(extension) {\nfiles.push((dir ? dir + \"/\" : \"\") + path + \".\" + extension);\n@@ -45,8 +46,12 @@ class EleventyExtensionMap {\nreturn files;\n}\n- getPrunedGlobs(inputDir) {\n- return this._getGlobs(this.prunedFormatKeys, inputDir);\n+ getPassthroughCopyGlobs(inputDir) {\n+ return this._getGlobs(this.passthroughCopyKeys, inputDir);\n+ }\n+\n+ getValidGlobs(inputDir) {\n+ return this._getGlobs(this.validTemplateLanguageKeys, inputDir);\n}\ngetGlobs(inputDir) {\n@@ -54,7 +59,7 @@ class EleventyExtensionMap {\nreturn this._getGlobs(this.unfilteredFormatKeys, inputDir);\n}\n- return this._getGlobs(this.formatKeys, inputDir);\n+ return this._getGlobs(this.validTemplateLanguageKeys, inputDir);\n}\n_getGlobs(formatKeys, inputDir) {\n@@ -75,8 +80,8 @@ class EleventyExtensionMap {\n}\nhasExtension(key) {\n- for (var extension in this.keyMap) {\n- if (this.keyMap[extension] === key) {\n+ for (var extension in this.extensionToKeyMap) {\n+ if (this.extensionToKeyMap[extension] === key) {\nreturn true;\n}\n}\n@@ -85,8 +90,8 @@ class EleventyExtensionMap {\ngetExtensionsFromKey(key) {\nlet extensions = [];\n- for (var extension in this.keyMap) {\n- if (this.keyMap[extension] === key) {\n+ for (var extension in this.extensionToKeyMap) {\n+ if (this.extensionToKeyMap[extension] === key) {\nextensions.push(extension);\n}\n}\n@@ -100,8 +105,8 @@ class EleventyExtensionMap {\ngetKey(pathOrKey) {\npathOrKey = (pathOrKey || \"\").toLowerCase();\n- for (var extension in this.keyMap) {\n- let key = this.keyMap[extension];\n+ for (var extension in this.extensionToKeyMap) {\n+ let key = this.extensionToKeyMap[extension];\nif (pathOrKey === extension) {\nreturn key;\n} else if (pathOrKey.endsWith(\".\" + extension)) {\n@@ -111,7 +116,7 @@ class EleventyExtensionMap {\n}\nremoveTemplateExtension(path) {\n- for (var extension in this.keyMap) {\n+ for (var extension in this.extensionToKeyMap) {\nif (path === extension || path.endsWith(\".\" + extension)) {\nreturn path.substr(0, path.length - 1 - extension.length);\n}\n@@ -119,7 +124,9 @@ class EleventyExtensionMap {\nreturn path;\n}\n- get keyMap() {\n+ // keys are file extensions\n+ // values are template language keys\n+ get extensionToKeyMap() {\nreturn {\nejs: \"ejs\",\nmd: \"md\",\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyExtensionMapTest.js", "new_path": "test/EleventyExtensionMapTest.js", "diff": "@@ -39,7 +39,7 @@ test(\"Keys are mapped to lower case\", t => {\ntest(\"Pruned globs\", t => {\nlet map = new EleventyExtensionMap([\"pug\", \"njk\", \"png\"]);\n- t.deepEqual(map.getPrunedGlobs(\".\"), [\"./**/*.png\"]);\n+ t.deepEqual(map.getPassthroughCopyGlobs(\".\"), [\"./**/*.png\"]);\n});\ntest(\"Empty path for fileList\", t => {\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyFilesTest.js", "new_path": "test/EleventyFilesTest.js", "diff": "@@ -2,8 +2,6 @@ import test from \"ava\";\nimport fastglob from \"fast-glob\";\nimport EleventyFiles from \"../src/EleventyFiles\";\nimport TemplatePath from \"../src/TemplatePath\";\n-import EleventyExtensionMap from \"../src/EleventyExtensionMap\";\n-import TemplateRender from \"../src/TemplateRender\";\nimport TemplatePassthroughManager from \"../src/TemplatePassthroughManager\";\ntest(\"getFiles\", async t => {\n@@ -93,8 +91,8 @@ test(\"Mutually exclusive Input and Output dirs\", async t => {\n);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n- t.is(evf.getRawFiles().length, 2);\n+ let files = await fastglob.async(evf._testGetFileGlobs());\n+ t.is(evf._testGetRawFiles().length, 2);\nt.true(files.length > 0);\nt.is(files[0], \"./test/stubs/writeTest/test.md\");\n});\n@@ -106,8 +104,8 @@ test(\"Single File Input (deep path)\", async t => {\n]);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n- t.is(evf.getRawFiles().length, 1);\n+ let files = await fastglob.async(evf._testGetFileGlobs());\n+ t.is(evf._testGetRawFiles().length, 1);\nt.is(files.length, 1);\nt.is(files[0], \"./test/stubs/index.html\");\n});\n@@ -116,9 +114,9 @@ test(\"Single File Input (shallow path)\", async t => {\nlet evf = new EleventyFiles(\"README.md\", \"./test/stubs/_site\", [\"md\"]);\nevf.init();\n- let globs = evf.getFileGlobs().filter(path => path !== \"!./README.md\");\n+ let globs = evf._testGetFileGlobs().filter(path => path !== \"!./README.md\");\nlet files = await fastglob.async(globs);\n- t.is(evf.getRawFiles().length, 1);\n+ t.is(evf._testGetRawFiles().length, 1);\nt.is(files.length, 1);\nt.is(files[0], \"./README.md\");\n});\n@@ -131,7 +129,7 @@ test(\"Glob Input\", async t => {\n);\nevf.init();\n- let globs = evf.getFileGlobs();\n+ let globs = evf._testGetFileGlobs();\nlet files = await fastglob.async(globs);\nt.is(files.length, 2);\nt.is(files[0], \"./test/stubs/glob-pages/about.md\");\n@@ -179,7 +177,7 @@ test(\".eleventyignore files\", async t => {\nlet ignoredFiles = await fastglob.async(\"test/stubs/ignoredFolder/*.md\");\nt.is(ignoredFiles.length, 1);\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob.async(evf._testGetFileGlobs());\nt.true(files.length > 0);\nt.is(\n@@ -405,7 +403,7 @@ test(\"Include and Data Dirs\", t => {\nlet evf = new EleventyFiles(\"test/stubs\", \"test/stubs/_site\", []);\nevf.init();\n- t.deepEqual(evf.getIncludesAndDataDirs(), [\n+ t.deepEqual(evf._getIncludesAndDataDirs(), [\n\"./test/stubs/_includes/**\",\n\"./test/stubs/_data/**\"\n]);\n@@ -415,7 +413,7 @@ test(\"Ignore Include and Data Dirs\", t => {\nlet evf = new EleventyFiles(\"test/stubs\", \"test/stubs/_site\", []);\nevf.init();\n- t.deepEqual(evf.getTemplateIgnores(), [\n+ t.deepEqual(evf._getIncludesAndDataDirIgnores(), [\n\"!./test/stubs/_includes/**\",\n\"!./test/stubs/_data/**\"\n]);\n@@ -435,7 +433,7 @@ test(\"Input to 'src' and empty includes dir (issue #403)\", t => {\n});\nevf.init();\n- t.deepEqual(evf.getFileGlobs(), [\n+ t.deepEqual(evf._testGetFileGlobs(), [\n\"./src/**/*.md\",\n\"./src/**/*.liquid\",\n\"./src/**/*.html\",\n@@ -503,7 +501,7 @@ test(\"Issue #403: all .eleventyignores should be relative paths not absolute pat\n});\nevf.init();\n- let globs = await evf.getFileGlobs();\n+ let globs = await evf._testGetFileGlobs();\nt.is(\nglobs.filter(glob => {\nreturn glob.indexOf(TemplatePath.absolutePath()) > -1;\n@@ -552,9 +550,9 @@ test(\"Glob Watcher Files with Config Passthroughs (one template format)\", async\nt.deepEqual(evf.getGlobWatcherFiles(), [\n\"./test/stubs/**/*.njk\",\n+ \"./test/stubs/img/**\",\n\"./test/stubs/_includes/**\",\n- \"./test/stubs/_data/**\",\n- \"./test/stubs/img/**\"\n+ \"./test/stubs/_data/**\"\n]);\n});\n@@ -572,5 +570,5 @@ test(\"Glob Watcher Files with passthroughAll\", async t => {\nlet evf = new EleventyFiles(\"test/stubs\", \"test/stubs/_site\", [], true);\nevf.init();\n- t.is((await evf.getFileGlobs())[0], \"./test/stubs/**\");\n+ t.is((await evf._testGetFileGlobs())[0], \"./test/stubs/**\");\n});\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -23,8 +23,8 @@ test(\"Output is a subdir of input\", async t => {\n);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n- t.is(evf.getRawFiles().length, 2);\n+ let files = await fastglob.async(evf._testGetFileGlobs());\n+ t.is(evf._testGetRawFiles().length, 2);\nt.true(files.length > 0);\nlet tmpl = tw._createTemplate(files[0]);\n@@ -366,7 +366,9 @@ Layout 1 dog`\ntest(\"Glob Watcher Files with Passthroughs\", t => {\nlet tw = new TemplateWriter(\"test/stubs\", \"test/stubs/_site\", [\"njk\", \"png\"]);\n- t.deepEqual(tw.getFileManager().getPassthroughPaths(), []);\n+ t.deepEqual(tw.eleventyFiles._getPassthroughPaths(), [\n+ \"./test/stubs/**/*.png\"\n+ ]);\n});\ntest(\"Pagination and TemplateContent\", async t => {\n@@ -515,8 +517,10 @@ test(\"Write Test 11ty.js\", async t => {\n);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n- t.deepEqual(evf.getRawFiles(), [\"./test/stubs/writeTestJS/**/*.11ty.js\"]);\n+ let files = await fastglob.async(evf._testGetFileGlobs());\n+ t.deepEqual(evf._testGetRawFiles(), [\n+ \"./test/stubs/writeTestJS/**/*.11ty.js\"\n+ ]);\nt.deepEqual(files, [\"./test/stubs/writeTestJS/test.11ty.js\"]);\nlet tmpl = tw._createTemplate(files[0]);\n" } ]
JavaScript
MIT License
11ty/eleventy
Bunch more refactoring to get ready for #117
699
11.07.2019 22:17:25
18,000
b0a717079a17afb9e087ada1980501e587377819
Option to use a different default file extension for a template type.
[ { "change_type": "MODIFY", "old_path": "src/Engines/TemplateEngine.js", "new_path": "src/Engines/TemplateEngine.js", "diff": "@@ -118,6 +118,10 @@ class TemplateEngine {\ninitRequireCache(inputPath) {\n// do nothing\n}\n+\n+ get defaultTemplateFileExtension() {\n+ return \"html\";\n+ }\n}\nmodule.exports = TemplateEngine;\n" }, { "change_type": "MODIFY", "old_path": "src/Template.js", "new_path": "src/Template.js", "diff": "@@ -119,7 +119,8 @@ class Template extends TemplateContent {\nthis.getTemplateSubfolder(),\nthis.baseFile,\nthis.extraOutputSubdirectory,\n- this.htmlIOException ? this.config.htmlOutputSuffix : \"\"\n+ this.htmlIOException ? this.config.htmlOutputSuffix : \"\",\n+ this.engine.defaultTemplateFileExtension\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePermalink.js", "new_path": "src/TemplatePermalink.js", "diff": "@@ -43,14 +43,30 @@ TemplatePermalink._hasDuplicateFolder = function(dir, base) {\nreturn folders[folders.length - 1] === base;\n};\n-TemplatePermalink.generate = function(dir, filenameNoExt, extraSubdir, suffix) {\n+TemplatePermalink.generate = function(\n+ dir,\n+ filenameNoExt,\n+ extraSubdir,\n+ suffix,\n+ fileExtension = \"html\"\n+) {\nlet hasDupeFolder = TemplatePermalink._hasDuplicateFolder(dir, filenameNoExt);\n- let path =\n+ let path;\n+ if (fileExtension === \"html\") {\n+ path =\n(dir ? dir + \"/\" : \"\") +\n(filenameNoExt !== \"index\" && !hasDupeFolder ? filenameNoExt + \"/\" : \"\") +\n\"index\" +\n(suffix || \"\") +\n\".html\";\n+ } else {\n+ path =\n+ (dir ? dir + \"/\" : \"\") +\n+ filenameNoExt +\n+ (suffix || \"\") +\n+ \".\" +\n+ fileExtension;\n+ }\nreturn new TemplatePermalink(path, extraSubdir);\n};\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateRender.js", "new_path": "src/TemplateRender.js", "diff": "const TemplatePath = require(\"./TemplatePath\");\nconst TemplateEngineManager = require(\"./TemplateEngineManager\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\n-const EleventyExtensionMap = require(\"./EleventyExtensionMap\");\nconst config = require(\"./Config\");\n// const debug = require(\"debug\")(\"Eleventy:TemplateRender\");\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePermalinkTest.js", "new_path": "test/TemplatePermalinkTest.js", "diff": "@@ -99,6 +99,15 @@ test(\"Permalink generate with suffix\", t => {\nt.is(gen(\".\", \"test\", \"1/\", \"-o\").toHref(), \"/test/1/index-o.html\");\n});\n+test(\"Permalink generate with new extension\", t => {\n+ let gen = TemplatePermalink.generate;\n+\n+ t.is(gen(\".\", \"test\", null, null, \"css\").toString(), \"test.css\");\n+ t.is(gen(\".\", \"test\", null, null, \"css\").toHref(), \"/test.css\");\n+ t.is(gen(\".\", \"test\", \"1/\", null, \"css\").toString(), \"1/test.css\");\n+ t.is(gen(\".\", \"test\", \"1/\", null, \"css\").toHref(), \"/1/test.css\");\n+});\n+\ntest(\"Permalink generate with subfolders\", t => {\nlet gen = TemplatePermalink.generate;\n" } ]
JavaScript
MIT License
11ty/eleventy
Option to use a different default file extension for a template type.
699
11.07.2019 22:18:05
18,000
5bdc077d4f190b3f491f42e82033fba027d30560
Adds sass test and filter option for addExtension
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"ava\": \"^2.1.0\",\n\"lint-staged\": \"^8.2.1\",\n\"markdown-it-emoji\": \"^1.4.0\",\n+ \"node-sass\": \"^4.12.0\",\n\"nyc\": \"^14.1.1\",\n\"pre-commit\": \"^1.2.2\",\n\"pre-push\": \"^0.1.1\",\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -298,6 +298,17 @@ class EleventyFiles {\ndot: true\n})\n);\n+\n+ let extensions = this.config.extensionMap;\n+ paths = paths.filter(function(path) {\n+ for (let entry of extensions) {\n+ if (path.endsWith(entry.extension) && entry.filter) {\n+ return entry.filter(path);\n+ }\n+ }\n+ return true;\n+ });\n+\nthis.pathCache = paths;\nreturn paths;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/Custom.js", "new_path": "src/Engines/Custom.js", "diff": "@@ -21,6 +21,18 @@ class CustomEngine extends TemplateEngine {\n// TODO generalize this (look at JavaScript.js)\nreturn this.compileFunction(str, inputPath);\n}\n+\n+ get defaultTemplateFileExtension() {\n+ for (let entry of this.config.extensionMap) {\n+ if (entry.key.toLowerCase() === this.name.toLowerCase()) {\n+ return entry.outputFileExtension;\n+ }\n+ }\n+\n+ throw Error(\n+ `Could not find a custom extension for ${this.name}. Did you add it to your config file?`\n+ );\n+ }\n}\nmodule.exports = CustomEngine;\n" }, { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -492,12 +492,16 @@ class UserConfig {\nthis.frontMatterParsingOptions = options;\n}\n- addExtension(fileExtension, userClass) {\n- this.extensionMap.add({\n+ addExtension(fileExtension, options = {}) {\n+ this.extensionMap.add(\n+ Object.assign(\n+ {\nkey: fileExtension,\n- extension: fileExtension,\n- compile: userClass\n- });\n+ extension: fileExtension\n+ },\n+ options\n+ )\n+ );\n}\ngetMergingConfigObject() {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderCustomTest.js", "new_path": "test/TemplateRenderCustomTest.js", "diff": "@@ -55,3 +55,46 @@ test(\"Custom Vue Render\", async t => {\nlet fn = await tr.getCompiledTemplate(`<p v-html=\"test\">Paragraph</p>`);\nt.is(await fn({ test: \"Hello\" }), `<p data-server-rendered=\"true\">Hello</p>`);\n});\n+\n+test(\"Custom Sass Render\", async t => {\n+ const sass = require(\"node-sass\");\n+ let tr = getNewTemplateRender(\"sass\");\n+\n+ const config = templateConfig.getConfig();\n+ tr.config = Object.assign({}, config);\n+ tr.config.extensionMap.add({\n+ extension: \"sass\",\n+ key: \"sass\",\n+ compile: function(str, inputPath) {\n+ // TODO declare data variables as SASS variables?\n+ return async function(data) {\n+ return new Promise(function(resolve, reject) {\n+ sass.render(\n+ {\n+ data: str,\n+ includePaths: [tr.inputDir, tr.includesDir],\n+ style: \"expanded\",\n+ // TODO\n+ // sourcemap: \"file\",\n+ outFile: \"test_this_is_to_not_write_a_file.css\"\n+ },\n+ function(error, result) {\n+ if (error) {\n+ reject(error);\n+ } else {\n+ resolve(result.css.toString(\"utf8\"));\n+ }\n+ }\n+ );\n+ });\n+ };\n+ }\n+ });\n+\n+ let fn = await tr.getCompiledTemplate(`$color: blue; p { color: $color; }`);\n+ t.is(\n+ (await fn({})).trim(),\n+ `p {\n+ color: blue; }`\n+ );\n+});\n" } ]
JavaScript
MIT License
11ty/eleventy
Adds sass test and filter option for addExtension
699
17.07.2019 20:53:48
18,000
0b92ca328b1824fd95b2b1fdea67ab0f35e742e8
Fixes error output in tests
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"devDependencies\": {\n\"@11ty/eleventy-plugin-syntaxhighlight\": \"^2.0.3\",\n- \"ava\": \"^2.1.0\",\n+ \"ava\": \"^2.2.0\",\n\"lint-staged\": \"^8.2.1\",\n\"markdown-it-emoji\": \"^1.4.0\",\n\"nyc\": \"^14.1.1\",\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1451,7 +1451,6 @@ test(\"Throws a Premature Template Content Error from rendering (njk)\", async t =\nlet error = await t.throwsAsync(async () => {\nawait tmpl.renderPageEntry(mapEntries[0], pageEntries[0]);\n});\n- console.log(error);\nt.is(EleventyErrorUtil.isPrematureTemplateContentError(error), true);\n});\n" } ]
JavaScript
MIT License
11ty/eleventy
Fixes error output in tests
670
20.07.2019 10:54:40
-28,800
922222b6e42197af178324cd7e3f5a71f2bf6ac8
Remove test files from root
[ { "change_type": "DELETE", "old_path": "css/test-nested.css", "new_path": "css/test-nested.css", "diff": "" }, { "change_type": "DELETE", "old_path": "css/test.css", "new_path": "css/test.css", "diff": "" }, { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -632,7 +632,7 @@ test(\"Passthrough file output\", async t => {\npassthroughFileCopy: true,\npassthroughCopies: {\n\"./test/stubs/template-passthrough/static\": true,\n- \"./test/stubs/template-passthrough/static\": \"./\",\n+ \"./test/stubs/template-passthrough/static/\": \"./\",\n\"./test/stubs/template-passthrough/static/**/*\": \"./all/\",\n\"./test/stubs/template-passthrough/static/**/*.js\": \"./js/\"\n}\n@@ -642,6 +642,7 @@ test(\"Passthrough file output\", async t => {\nawait tw.write();\nconst output = [\n+ \"./test/stubs/template-passthrough/_site/static/nested/test-nested.css\",\n\"./test/stubs/template-passthrough/_site/all/test.js\",\n\"./test/stubs/template-passthrough/_site/all/test.css\",\n\"./test/stubs/template-passthrough/_site/all/test-nested.css\",\n@@ -653,6 +654,9 @@ test(\"Passthrough file output\", async t => {\n\"./test/stubs/template-passthrough/_site/test.js\"\n];\noutput.forEach(path => {\n+ if (!fs.existsSync(path)) {\n+ t.log(path);\n+ }\nt.true(fs.existsSync(path));\n});\n@@ -676,8 +680,7 @@ test(\"Naughty Passthrough paths\", async t => {\nmgr.setConfig({\npassthroughFileCopy: true,\npassthroughCopies: {\n- \"../\": true,\n- \"../\": \"./\",\n+ \"../static\": true,\n\"../*\": \"./\",\n\"./test/stubs/template-passthrough/static/*.css\": \"./\",\n\"./test/stubs/template-passthrough/static/*.js\": \"../../\",\n@@ -692,6 +695,7 @@ test(\"Naughty Passthrough paths\", async t => {\n});\nconst output = [\n+ \"./test/stubs/template-passthrough/_site/static\",\n\"./test/stubs/template-passthrough/_site/nope.txt\",\n\"./test/stubs/template-passthrough/_site/nope/\",\n\"./test/stubs/test.js\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Remove test files from root
699
19.07.2019 22:20:55
18,000
7327554e3a35b4dea177845b381988f39bba7cb5
Still has one failing test
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"dependency-graph\": \"^0.8.0\",\n\"dependency-tree\": \"^6.3.0\",\n\"ejs\": \"^2.6.2\",\n- \"fast-glob\": \"^2.2.7\",\n+ \"fast-glob\": \"^3.0.4\",\n\"fs-extra\": \"^7.0.1\",\n\"gray-matter\": \"^4.0.2\",\n\"hamljs\": \"^0.6.2\",\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -269,7 +269,10 @@ class EleventyFiles {\ndebug(\"Searching for: %o\", globs);\nlet paths = TemplatePath.addLeadingDotSlashArray(\n- await fastglob.async(globs, { nocase: true, onlyFiles: true })\n+ await fastglob(globs, {\n+ caseSensitiveMatch: false,\n+ dot: true\n+ })\n);\nthis.pathCache = paths;\nreturn paths;\n@@ -291,7 +294,11 @@ class EleventyFiles {\nasync getWatcherTemplateJavaScriptDataFiles() {\nlet globs = await this.getTemplateData().getTemplateJavaScriptDataFileGlob();\nreturn TemplatePath.addLeadingDotSlashArray(\n- await fastglob.async(globs, { ignore: [\"**/node_modules/**\"] })\n+ await fastglob(globs, {\n+ ignore: [\"**/node_modules/**\"],\n+ caseSensitiveMatch: false,\n+ dot: true\n+ })\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/TemplateEngine.js", "new_path": "src/Engines/TemplateEngine.js", "diff": "@@ -55,7 +55,12 @@ class TemplateEngine {\nlet partialFiles = [];\nif (this.includesDir) {\nthis.extensions.forEach(function(extension) {\n- partialFiles = partialFiles.concat(fastglob.sync(prefix + extension));\n+ partialFiles = partialFiles.concat(\n+ fastglob.sync(prefix + extension, {\n+ caseSensitiveMatch: false,\n+ dot: true\n+ })\n+ );\n});\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateData.js", "new_path": "src/TemplateData.js", "diff": "@@ -133,7 +133,10 @@ class TemplateData {\n}\nasync getGlobalDataFiles() {\n- let paths = await fastglob.async(await this.getGlobalDataGlob());\n+ let paths = await fastglob(await this.getGlobalDataGlob(), {\n+ caseSensitiveMatch: false,\n+ dot: true\n+ });\nthis.pathCache = paths;\nreturn paths;\n}\n@@ -161,11 +164,7 @@ class TemplateData {\n// TODO maybe merge these two? (if both valid objects)\nif (dataFileConflicts[folders]) {\ndebugWarn(\n- `Warning: the key for a global data file (${\n- files[j]\n- }) will overwrite data from an already existing global data file (${\n- dataFileConflicts[folders]\n- })`\n+ `Warning: the key for a global data file (${files[j]}) will overwrite data from an already existing global data file (${dataFileConflicts[folders]})`\n);\n}\ndataFileConflicts[folders] = files[j];\n@@ -341,9 +340,8 @@ class TemplateData {\nif (\"tags\" in data) {\nif (typeof data.tags === \"string\") {\ndata.tags = data.tags ? [data.tags] : [];\n- }\n- else if (data.tags === null){\n- data.tags = []\n+ } else if (data.tags === null) {\n+ data.tags = [];\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -42,8 +42,11 @@ class TemplatePassthrough {\nasync getFiles(glob) {\ndebug(\"Searching for: %o\", glob);\n- const files = await TemplatePath.addLeadingDotSlashArray(\n- await fastglob.async(glob)\n+ const files = TemplatePath.addLeadingDotSlashArray(\n+ await fastglob(glob, {\n+ caseSensitiveMatch: false,\n+ dot: true\n+ })\n);\nreturn files;\n}\n" }, { "change_type": "MODIFY", "old_path": "test/EleventyFilesTest.js", "new_path": "test/EleventyFilesTest.js", "diff": "@@ -87,7 +87,7 @@ test(\"Mutually exclusive Input and Output dirs\", async t => {\n);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.is(evf.getRawFiles().length, 2);\nt.true(files.length > 0);\nt.is(files[0], \"./test/stubs/writeTest/test.md\");\n@@ -100,7 +100,7 @@ test(\"Single File Input (deep path)\", async t => {\n]);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.is(evf.getRawFiles().length, 1);\nt.is(files.length, 1);\nt.is(files[0], \"./test/stubs/index.html\");\n@@ -111,7 +111,7 @@ test(\"Single File Input (shallow path)\", async t => {\nevf.init();\nlet globs = evf.getFileGlobs().filter(path => path !== \"!./README.md\");\n- let files = await fastglob.async(globs);\n+ let files = await fastglob(globs);\nt.is(evf.getRawFiles().length, 1);\nt.is(files.length, 1);\nt.is(files[0], \"./README.md\");\n@@ -126,7 +126,7 @@ test(\"Glob Input\", async t => {\nevf.init();\nlet globs = evf.getFileGlobs();\n- let files = await fastglob.async(globs);\n+ let files = await fastglob(globs);\nt.is(files.length, 2);\nt.is(files[0], \"./test/stubs/glob-pages/about.md\");\nt.is(files[1], \"./test/stubs/glob-pages/home.md\");\n@@ -170,10 +170,10 @@ test(\"defaults if passed file name does not exist\", t => {\ntest(\".eleventyignore files\", async t => {\nlet evf = new EleventyFiles(\"test/stubs\", \"test/stubs/_site\", [\"ejs\", \"md\"]);\nevf.init();\n- let ignoredFiles = await fastglob.async(\"test/stubs/ignoredFolder/*.md\");\n+ let ignoredFiles = await fastglob(\"test/stubs/ignoredFolder/*.md\");\nt.is(ignoredFiles.length, 1);\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.true(files.length > 0);\nt.is(\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateGlobTest.js", "new_path": "test/TemplateGlobTest.js", "diff": "@@ -75,7 +75,7 @@ test(\"Normalize array argument\", t => {\n});\ntest(\"matuzo project issue with fastglob assumptions\", async t => {\n- let dotslashincludes = await fastglob.async(\n+ let dotslashincludes = await fastglob(\nTemplateGlob.map([\n\"./test/stubs/globby/**/*.html\",\n\"!./test/stubs/globby/_includes/**/*\",\n@@ -90,7 +90,7 @@ test(\"matuzo project issue with fastglob assumptions\", async t => {\n0\n);\n- let globincludes = await fastglob.async(\n+ let globincludes = await fastglob(\nTemplateGlob.map([\n\"test/stubs/globby/**/*.html\",\n\"!./test/stubs/globby/_includes/**/*\",\n@@ -106,25 +106,25 @@ test(\"matuzo project issue with fastglob assumptions\", async t => {\n});\ntest(\"fastglob assumptions\", async t => {\n- let glob = await fastglob.async(\"test/stubs/ignoredFolder/**\");\n+ let glob = await fastglob(\"test/stubs/ignoredFolder/**\");\nt.is(glob.length, 1);\n- let glob2 = await fastglob.async(\"test/stubs/ignoredFolder/**/*\");\n+ let glob2 = await fastglob(\"test/stubs/ignoredFolder/**/*\");\nt.is(glob2.length, 1);\n- let glob3 = await fastglob.async([\n+ let glob3 = await fastglob([\n\"./test/stubs/ignoredFolder/**/*.md\",\n\"!./test/stubs/ignoredFolder/**\"\n]);\nt.is(glob3.length, 0);\n- let glob4 = await fastglob.async([\n+ let glob4 = await fastglob([\n\"./test/stubs/ignoredFolder/*.md\",\n\"!./test/stubs/ignoredFolder/**\"\n]);\nt.is(glob4.length, 0);\n- let glob5 = await fastglob.async([\n+ let glob5 = await fastglob([\n\"./test/stubs/ignoredFolder/ignored.md\",\n\"!./test/stubs/ignoredFolder/**\"\n]);\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePermalinkTest.js", "new_path": "test/TemplatePermalinkTest.js", "diff": "import test from \"ava\";\n-import parsePath from \"parse-filepath\";\nimport TemplatePermalink from \"../src/TemplatePermalink\";\ntest(\"Simple straight permalink\", t => {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateWriterTest.js", "new_path": "test/TemplateWriterTest.js", "diff": "@@ -25,7 +25,7 @@ test(\"Output is a subdir of input\", async t => {\n);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.is(evf.getRawFiles().length, 2);\nt.true(files.length > 0);\n@@ -511,7 +511,7 @@ test(\"Write Test 11ty.js\", async t => {\n);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.deepEqual(evf.getRawFiles(), [\"./test/stubs/writeTestJS/**/*.11ty.js\"]);\nt.deepEqual(files, [\"./test/stubs/writeTestJS/test.11ty.js\"]);\n@@ -538,7 +538,7 @@ test.skip(\"Markdown with alias\", async t => {\nevf._setExtensionMap(map);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.deepEqual(evf.getRawFiles(), [\n\"./test/stubs/writeTestMarkdown/**/*.md\",\n\"./test/stubs/writeTestMarkdown/**/*.markdown\"\n@@ -583,7 +583,7 @@ test.skip(\"JavaScript with alias\", async t => {\nevf._setExtensionMap(map);\nevf.init();\n- let files = await fastglob.async(evf.getFileGlobs());\n+ let files = await fastglob(evf.getFileGlobs());\nt.deepEqual(\nevf.getRawFiles().sort(),\n[\n" } ]
JavaScript
MIT License
11ty/eleventy
Still has one failing test
699
22.07.2019 07:47:49
18,000
ab73549ac972197f18ec071ea5822bf351d66703
AVA uses only js extensions to find tests so use .js was superfluous. This also fixes some infinite looping in test watching where tests were writing to _site folders which would trigger another test run.
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"ava\": {\n\"files\": [\n- \"test/*.js\"\n+ \"test/*\"\n],\n\"sources\": [\n\"**/.eleventyignore\",\n\"src/**/*.js\",\n- \"test/stubs/**\"\n+ \"test/stubs/**\",\n+ \"!test/stubs/**/_site/**/*\"\n]\n},\n\"lint-staged\": {\n" } ]
JavaScript
MIT License
11ty/eleventy
AVA uses only js extensions to find tests so use .js was superfluous. This also fixes some infinite looping in test watching where tests were writing to _site folders which would trigger another test run.
699
22.07.2019 08:23:26
18,000
f15ef1ddf416b8ae407f66449790511b8bceae75
Trying to prevent watch loops
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"ava\": {\n\"files\": [\n- \"test/*\"\n+ \"./test/*\"\n],\n\"sources\": [\n- \"**/.eleventyignore\",\n- \"src/**/*.js\",\n- \"test/stubs/**\",\n- \"!test/stubs/**/_site/**/*\"\n+ \"./**/.eleventyignore\",\n+ \"./src/**/*.js\",\n+ \"./test/stubs/**\",\n+ \"!./test/stubs/**/_site/**\",\n+ \"!./test/stubs/**/_site/**/*\"\n]\n},\n\"lint-staged\": {\n" } ]
JavaScript
MIT License
11ty/eleventy
Trying to prevent watch loops
699
23.07.2019 17:40:56
18,000
31c93bc2c1b19478700646cc39f79d34b1801bff
Adds two more tests for
[ { "change_type": "MODIFY", "old_path": "src/Engines/Liquid.js", "new_path": "src/Engines/Liquid.js", "diff": "@@ -17,7 +17,7 @@ class Liquid extends TemplateEngine {\nnumber: /[0-9]+\\.*[0-9]*/,\ndoubleQuoteString: /\"(?:\\\\[\"\\\\]|[^\\n\"\\\\])*\"/,\nsingleQuoteString: /'(?:\\\\['\\\\]|[^\\n'\\\\])*'/,\n- keyword: /[a-zA-Z0-9\\.]+/,\n+ keyword: /[a-zA-Z0-9\\.\\-\\_]+/,\n\"ignore:whitespace\": /[, \\t]+/ // includes comma separator\n});\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderLiquidTest.js", "new_path": "test/TemplateRenderLiquidTest.js", "diff": "@@ -679,7 +679,7 @@ test(\"Liquid Render with dash variable Issue #567\", async t => {\nt.is(await fn({ \"my-global-name\": \"Zach\" }), \"<p>Zach</p>\");\n});\n-test(\"Issue 600: Liquid Shortcode page.url\", async t => {\n+test(\"Issue 600: Liquid Shortcode argument page.url\", async t => {\nlet tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\ntr.engine.addShortcode(\"issue600\", function(str) {\nreturn str + \"Zach\";\n@@ -692,3 +692,31 @@ test(\"Issue 600: Liquid Shortcode page.url\", async t => {\n\"alkdsjfksljaZach\"\n);\n});\n+\n+test(\"Issue 600: Liquid Shortcode argument with dashes\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\"issue600b\", function(str) {\n+ return str + \"Zach\";\n+ });\n+\n+ t.is(\n+ await tr.render(\"{% issue600b page-url %}\", {\n+ \"page-url\": \"alkdsjfkslja\"\n+ }),\n+ \"alkdsjfksljaZach\"\n+ );\n+});\n+\n+test(\"Issue 600: Liquid Shortcode argument with underscores\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\"issue600c\", function(str) {\n+ return str + \"Zach\";\n+ });\n+\n+ t.is(\n+ await tr.render(\"{% issue600c page_url %}\", {\n+ page_url: \"alkdsjfkslja\"\n+ }),\n+ \"alkdsjfksljaZach\"\n+ );\n+});\n" } ]
JavaScript
MIT License
11ty/eleventy
Adds two more tests for #600.
699
23.07.2019 20:23:11
18,000
550c1f0c312d1510d7352314f1b75f9038d470f8
Test for Nunjucks
[ { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -783,6 +783,22 @@ test(\"getRenderedData() has all the page variables\", async t => {\nt.is(data.page.outputPath, \"./dist/template/index.html\");\n});\n+test(\"Issue #603: page.date.toUTCString() Nunjucks\", async t => {\n+ // Note this is not supported in Liquid\n+ let tmpl = new Template(\n+ \"./test/stubs/pagedate.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ let data = await tmpl.getData();\n+\n+ t.truthy(data.page.date);\n+ t.truthy(data.page.date.toUTCString());\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), data.page.date.toUTCString());\n+});\n+\ntest(\"getTemplates() data has all the root variables\", async t => {\nlet tmpl = new Template(\n\"./test/stubs/template.ejs\",\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/pagedate.njk", "diff": "+{{ page.date.toUTCString() }}\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
Test for #603 Nunjucks
699
23.07.2019 21:24:28
18,000
25dd2af079115fe2b0276e1445b272a708b132c7
More tests for and docs.
[ { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -783,10 +783,40 @@ test(\"getRenderedData() has all the page variables\", async t => {\nt.is(data.page.outputPath, \"./dist/template/index.html\");\n});\n+test(\"Issue #603: page.date Liquid\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/pagedate.liquid\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ let data = await tmpl.getData();\n+\n+ t.truthy(data.page.date);\n+ t.truthy(data.page.date.toUTCString());\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), data.page.date.toString());\n+});\n+\n+test(\"Issue #603: page.date Nunjucks\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/pagedate.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ let data = await tmpl.getData();\n+\n+ t.truthy(data.page.date);\n+ t.truthy(data.page.date.toUTCString());\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), data.page.date.toString());\n+});\n+\ntest(\"Issue #603: page.date.toUTCString() Nunjucks\", async t => {\n// Note this is not supported in Liquid\nlet tmpl = new Template(\n- \"./test/stubs/pagedate.njk\",\n+ \"./test/stubs/pagedateutc.njk\",\n\"./test/stubs/\",\n\"./dist\"\n);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/pagedate.liquid", "diff": "+{{ page.date }}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "test/stubs/pagedate.njk", "new_path": "test/stubs/pagedate.njk", "diff": "-{{ page.date.toUTCString() }}\n\\ No newline at end of file\n+{{ page.date }}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/pagedateutc.njk", "diff": "+{{ page.date.toUTCString() }}\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
More tests for #603 and docs.
699
23.07.2019 22:42:02
18,000
b2d33bc1f948f9ef5ff507a31a30990b1f20f2ee
Unskip the test it works in Nunjucks
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "@@ -418,7 +418,7 @@ test(\"Nunjucks Test if statements on arrays (Issue #524)\", async t => {\n);\n});\n-test.skip(\"Issue 611: Run a function\", async t => {\n+test(\"Issue 611: Run a function\", async t => {\nlet tr = new TemplateRender(\"njk\", \"./test/stubs/\");\nt.is(\n" } ]
JavaScript
MIT License
11ty/eleventy
Unskip the test it works in Nunjucks #611.
699
25.07.2019 08:19:21
18,000
752b39ace127ab0a258785ca885621aaa6fada3d
Adds simplification code suggested by this awesome feedback from
[ { "change_type": "MODIFY", "old_path": "src/Engines/JavaScript.js", "new_path": "src/Engines/JavaScript.js", "diff": "@@ -15,23 +15,34 @@ class JavaScript extends TemplateEngine {\nreturn result;\n}\n+ _getInstance(mod) {\n+ if (typeof mod === \"string\" || mod instanceof Buffer || mod.then) {\n+ return { render: () => mod };\n+ } else if (typeof mod === \"function\") {\n+ if (\n+ mod.prototype &&\n+ (\"data\" in mod.prototype || \"render\" in mod.prototype)\n+ ) {\n+ return new mod();\n+ } else {\n+ return { render: mod };\n+ }\n+ } else if (\"data\" in mod || \"render\" in mod) {\n+ return mod;\n+ }\n+ }\n+\ngetInstanceFromInputPath(inputPath) {\nif (this.instances[inputPath]) {\nreturn this.instances[inputPath];\n}\n- const cls = this._getRequire(inputPath);\n- if (typeof cls === \"function\") {\n- if (\n- cls.prototype &&\n- (\"data\" in cls.prototype || \"render\" in cls.prototype)\n- ) {\n- let inst = new cls();\n+ const mod = this._getRequire(inputPath);\n+ let inst = this._getInstance(mod);\n+\nthis.instances[inputPath] = inst;\nreturn inst;\n}\n- }\n- }\n_getRequire(inputPath) {\nlet requirePath = TemplatePath.absolutePath(inputPath);\n@@ -56,57 +67,28 @@ class JavaScript extends TemplateEngine {\nasync getExtraDataFromFile(inputPath) {\nlet inst = this.getInstanceFromInputPath(inputPath);\n- if (inst) {\n+ if (inst && \"data\" in inst) {\n// get extra data from `data` method,\n// either as a function or getter or object literal\nreturn typeof inst.data === \"function\" ? await inst.data() : inst.data;\n}\n-\n- const cls = this._getRequire(inputPath);\n- if (typeof cls === \"object\") {\n- return typeof cls.data === \"function\" ? await cls.data() : cls.data;\n- }\n}\nasync compile(str, inputPath) {\n- // for permalinks\n+ let inst;\nif (str) {\n- // works with String, Buffer, Function!\n- return function(data) {\n- let target = str;\n- if (typeof str === \"function\") {\n- target = str.call(this.config.javascriptFunctions, data);\n- }\n- return this.normalize(target);\n- }.bind(this);\n+ // When str has a value, it's being used for permalinks in data\n+ inst = this._getInstance(str);\n+ } else {\n+ // For normal templates, str will be falsy.\n+ inst = this.getInstanceFromInputPath(inputPath);\n}\n- // for all other requires, str will be falsy\n- const cls = this._getRequire(inputPath);\n- if (typeof cls === \"function\") {\n- // class with a `render` method\n- if (cls.prototype && \"render\" in cls.prototype) {\n- let inst = this.getInstanceFromInputPath(inputPath);\n+ if (inst && \"render\" in inst) {\nObject.assign(inst, this.config.javascriptFunctions);\n- return function(data) {\n- return this.normalize(inst.render.call(inst, data));\n- }.bind(this);\n- }\n- // raw function\n- return function(data) {\n- return this.normalize(cls.call(this.config.javascriptFunctions, data));\n- }.bind(this);\n- } else if (typeof cls === \"object\" && \"render\" in cls) {\nreturn function(data) {\n- return this.normalize(\n- cls.render.call(this.config.javascriptFunctions, data)\n- );\n- }.bind(this);\n- } else {\n- // string type does not work with javascriptFunctions\n- return function() {\n- return this.normalize(cls);\n+ return this.normalize(inst.render.call(inst, data));\n}.bind(this);\n}\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Adds simplification code suggested by this awesome feedback from @jakearchibald https://github.com/11ty/eleventy/issues/622#issuecomment-514955817
699
25.07.2019 17:32:08
18,000
598397ec7608fb48c87619e1a92f783bb1cac399
More tests for Proceed gracefully if a render method is missing from class or object definition
[ { "change_type": "MODIFY", "old_path": "src/Engines/JavaScript.js", "new_path": "src/Engines/JavaScript.js", "diff": "@@ -15,7 +15,14 @@ class JavaScript extends TemplateEngine {\nreturn result;\n}\n+ // String, Buffer, Promise\n+ // Function, Class\n+ // Object\n_getInstance(mod) {\n+ let noop = function() {\n+ return \"\";\n+ };\n+\nif (typeof mod === \"string\" || mod instanceof Buffer || mod.then) {\nreturn { render: () => mod };\n} else if (typeof mod === \"function\") {\n@@ -23,11 +30,17 @@ class JavaScript extends TemplateEngine {\nmod.prototype &&\n(\"data\" in mod.prototype || \"render\" in mod.prototype)\n) {\n+ if (!(\"render\" in mod.prototype)) {\n+ mod.prototype.render = noop;\n+ }\nreturn new mod();\n} else {\nreturn { render: mod };\n}\n} else if (\"data\" in mod || \"render\" in mod) {\n+ if (!(\"render\" in mod)) {\n+ mod.render = noop;\n+ }\nreturn mod;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest-JavaScript.js", "new_path": "test/TemplateTest-JavaScript.js", "diff": "@@ -222,7 +222,6 @@ test(\"JavaScript template type (should use the same class instance for data and\nt.is(pages[0].templateContent.trim(), `<p>Ted${data.rand}</p>`);\n});\n-// TODO needs way more tests\ntest(\"JavaScript template type (multiple exports)\", async t => {\nlet tmpl = new Template(\n\"./test/stubs/multipleexports.11ty.js\",\n@@ -234,3 +233,59 @@ test(\"JavaScript template type (multiple exports)\", async t => {\nlet pages = await tmpl.getRenderedTemplates(data);\nt.is(pages[0].templateContent.trim(), \"<p>Ted</p>\");\n});\n+\n+test(\"JavaScript template type (multiple exports, promises)\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/multipleexports-promises.11ty.js\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ t.is(data.name, \"Ted\");\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), \"<p>Ted</p>\");\n+});\n+\n+test(\"JavaScript template type (object)\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/object.11ty.js\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ t.is(data.name, \"Ted\");\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), \"<p>Ted</p>\");\n+});\n+\n+test(\"JavaScript template type (object, no render method)\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/object-norender.11ty.js\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ t.is(data.name, \"Ted\");\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), \"\");\n+});\n+\n+test(\"JavaScript template type (class, no render method)\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/class-norender.11ty.js\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ t.is(data.name, \"Ted\");\n+\n+ let pages = await tmpl.getRenderedTemplates(data);\n+ t.is(pages[0].templateContent.trim(), \"\");\n+});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/class-norender.11ty.js", "diff": "+class Test {\n+ data() {\n+ return {\n+ name: \"Ted\"\n+ };\n+ }\n+}\n+\n+module.exports = Test;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/multipleexports-promises.11ty.js", "diff": "+exports.data = async function() {\n+ return new Promise((resolve, reject) => {\n+ setTimeout(function() {\n+ resolve({ name: \"Ted\" });\n+ }, 100);\n+ });\n+};\n+\n+exports.render = async function({ name }) {\n+ return new Promise((resolve, reject) => {\n+ setTimeout(function() {\n+ resolve(`<p>${name}</p>`);\n+ }, 100);\n+ });\n+};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/object-norender.11ty.js", "diff": "+module.exports = {\n+ data: {\n+ name: \"Ted\"\n+ }\n+};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/object.11ty.js", "diff": "+module.exports = {\n+ data: {\n+ name: \"Ted\"\n+ },\n+ render: function({ name }) {\n+ return `<p>${name}</p>`;\n+ }\n+};\n" } ]
JavaScript
MIT License
11ty/eleventy
More tests for #622. Proceed gracefully if a render method is missing from class or object definition
699
25.07.2019 20:53:50
18,000
fcba193f1f3d7bbd3cbd117e48b70ec37c681928
Updates to how excerpts work (docs already updated)
[ { "change_type": "MODIFY", "old_path": "src/TemplateContent.js", "new_path": "src/TemplateContent.js", "diff": "@@ -73,13 +73,16 @@ class TemplateContent {\nlet options = this.config.frontMatterParsingOptions || {};\nlet fm = matter(this.inputContent, options);\nif (options.excerpt && fm.excerpt) {\n- let excerptString = fm.excerpt + (fm.excerpt_separator || \"---\");\n+ let excerptString = fm.excerpt + (options.excerpt_separator || \"---\");\nif (fm.content.startsWith(excerptString + \"\\n\")) {\n// with a newline after excerpt separator\n- fm.content = fm.content.substr((excerptString + \"\\n\").length);\n+ fm.content =\n+ fm.excerpt.trim() +\n+ \"\\n\" +\n+ fm.content.substr((excerptString + \"\\n\").length);\n} else if (fm.content.startsWith(excerptString)) {\n// no newline after excerpt separator\n- fm.content = fm.content.substr(excerptString.length);\n+ fm.content = fm.excerpt + fm.content.substr(excerptString.length);\n}\n// alias, defaults to page.excerpt\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1733,7 +1733,11 @@ test(\"Custom Front Matter Parsing Options\", async t => {\nt.is(frontmatter.data.page.excerpt.trim(), \"This is an excerpt.\");\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\n- t.is(frontmatter.content.trim(), \"This is content.\");\n+ t.is(\n+ frontmatter.content.trim(),\n+ `This is an excerpt.\n+This is content.`\n+ );\nlet fulldata = await tmpl.getData();\nt.is(fulldata.page.excerpt.trim(), \"This is an excerpt.\");\n@@ -1756,20 +1760,24 @@ test(\"Custom Front Matter Parsing Options (using alias)\", async t => {\nlet frontmatter = await tmpl.getFrontMatter();\nt.is(frontmatter.data.front, \"hello\");\nt.is(frontmatter.data.my_excerpt.trim(), \"This is an excerpt.\");\n- t.is(frontmatter.content.trim(), \"This is content.\");\n+ t.is(\n+ frontmatter.content.trim(),\n+ `This is an excerpt.\n+This is content.`\n+ );\nlet fulldata = await tmpl.getData();\nt.is(fulldata.my_excerpt.trim(), \"This is an excerpt.\");\n});\n-test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\", async t => {\n+test(\"Custom Front Matter Parsing Options (no newline before excerpt separator)\", async t => {\nlet newConfig = Object.assign({}, config);\nnewConfig.frontMatterParsingOptions = {\nexcerpt: true\n};\nlet tmpl = new Template(\n- \"./test/stubs/custom-frontmatter/template-nonewline.njk\",\n+ \"./test/stubs/custom-frontmatter/template-newline1.njk\",\n\"./test/stubs/\",\n\"./dist\"\n);\n@@ -1780,12 +1788,80 @@ test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\",\nt.is(frontmatter.data.page.excerpt.trim(), \"This is an excerpt.\");\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\n- t.is(frontmatter.content.trim(), \"This is content.\");\n+ t.is(\n+ frontmatter.content.trim(),\n+ `This is an excerpt.\n+This is content.`\n+ );\nlet fulldata = await tmpl.getData();\nt.is(fulldata.page.excerpt.trim(), \"This is an excerpt.\");\n});\n+test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ newConfig.frontMatterParsingOptions = {\n+ excerpt: true\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template-newline3.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.is(\n+ frontmatter.content.trim(),\n+ `This is an excerpt.\n+This is content.`\n+ );\n+});\n+\n+test(\"Custom Front Matter Parsing Options (no newlines before or after excerpt separator)\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ newConfig.frontMatterParsingOptions = {\n+ excerpt: true\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template-newline2.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.is(frontmatter.content.trim(), \"This is an excerpt.This is content.\");\n+});\n+\n+test(\"Custom Front Matter Parsing Options (html comment separator)\", async t => {\n+ let newConfig = Object.assign({}, config);\n+ newConfig.frontMatterParsingOptions = {\n+ excerpt: true,\n+ excerpt_separator: \"<!-- excerpt -->\"\n+ };\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/custom-frontmatter/template-excerpt-comment.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+ tmpl.config = newConfig;\n+\n+ let frontmatter = await tmpl.getFrontMatter();\n+ t.is(frontmatter.data.front, \"hello\");\n+ t.is(frontmatter.data.page.excerpt.trim(), \"This is an excerpt.\");\n+\n+ t.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\n+ t.is(\n+ frontmatter.content.trim(),\n+ `This is an excerpt.\n+This is content.`\n+ );\n+});\n+\ntest.skip(\"Custom Front Matter Parsing Options (using TOML)\", async t => {\n// Depends on https://github.com/jonschlinkert/gray-matter/issues/92 for Windows\nlet newConfig = Object.assign({}, config);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template-excerpt-comment.njk", "diff": "+---\n+front: hello\n+---\n+This is an excerpt.\n+<!-- excerpt -->\n+This is content.\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template-newline1.njk", "diff": "+---\n+front: hello\n+---\n+This is an excerpt.---\n+This is content.\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template-newline2.njk", "diff": "+---\n+front: hello\n+---\n+This is an excerpt.---This is content.\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/custom-frontmatter/template-newline3.njk", "diff": "+---\n+front: hello\n+---\n+This is an excerpt.\n+---This is content.\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
Updates to how excerpts work (docs already updated) #410
699
25.07.2019 22:56:17
18,000
a0a6bf872be367c04bf2482def8ffd97482ebf84
Normalize newlines on Windows
[ { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1734,7 +1734,7 @@ test(\"Custom Front Matter Parsing Options\", async t => {\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\nt.is(\n- frontmatter.content.trim(),\n+ normalizeNewLines(frontmatter.content.trim()),\n`This is an excerpt.\nThis is content.`\n);\n@@ -1761,7 +1761,7 @@ test(\"Custom Front Matter Parsing Options (using alias)\", async t => {\nt.is(frontmatter.data.front, \"hello\");\nt.is(frontmatter.data.my_excerpt.trim(), \"This is an excerpt.\");\nt.is(\n- frontmatter.content.trim(),\n+ normalizeNewLines(frontmatter.content.trim()),\n`This is an excerpt.\nThis is content.`\n);\n@@ -1789,7 +1789,7 @@ test(\"Custom Front Matter Parsing Options (no newline before excerpt separator)\"\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\nt.is(\n- frontmatter.content.trim(),\n+ normalizeNewLines(frontmatter.content.trim()),\n`This is an excerpt.\nThis is content.`\n);\n@@ -1813,7 +1813,7 @@ test(\"Custom Front Matter Parsing Options (no newline after excerpt separator)\",\nlet frontmatter = await tmpl.getFrontMatter();\nt.is(\n- frontmatter.content.trim(),\n+ normalizeNewLines(frontmatter.content.trim()),\n`This is an excerpt.\nThis is content.`\n);\n@@ -1856,7 +1856,7 @@ test(\"Custom Front Matter Parsing Options (html comment separator)\", async t =>\nt.is(frontmatter.excerpt.trim(), \"This is an excerpt.\");\nt.is(\n- frontmatter.content.trim(),\n+ normalizeNewLines(frontmatter.content.trim()),\n`This is an excerpt.\nThis is content.`\n);\n" } ]
JavaScript
MIT License
11ty/eleventy
Normalize newlines on Windows
699
26.07.2019 07:16:24
18,000
c6d1fda9114fbaaa9e2a57f02a09ff232edc92a4
Newlines, what
[ { "change_type": "MODIFY", "old_path": "test/TestUtilityTest.js", "new_path": "test/TestUtilityTest.js", "diff": "@@ -2,9 +2,9 @@ import test from \"ava\";\nimport normalizeNewLines from \"./Util/normalizeNewLines\";\ntest(\"normalizeNewLines\", t => {\n- t.is(normalizeNewLines(\"\\r\"), \"\");\n- t.is(normalizeNewLines(\"\\\\r\"), \"\\\\r\");\n+ // t.is(normalizeNewLines(\"\\r\"), \"\");\n+ // t.is(normalizeNewLines(\"\\\\r\"), \"\\\\r\");\nt.is(normalizeNewLines(\"\\r\\n\"), \"\\n\");\n- t.is(normalizeNewLines(\"\\r\\n\\r\"), \"\\n\");\n+ // t.is(normalizeNewLines(\"\\r\\n\\r\"), \"\\n\");\nt.is(normalizeNewLines(\"\\r\\n\\n\"), \"\\n\\n\");\n});\n" }, { "change_type": "MODIFY", "old_path": "test/Util/normalizeNewLines.js", "new_path": "test/Util/normalizeNewLines.js", "diff": "function normalizeNewLines(str) {\n- return str.replace(/\\r/g, \"\");\n+ return str.replace(/\\r\\n/g, \"\\n\");\n}\nmodule.exports = normalizeNewLines;\n" } ]
JavaScript
MIT License
11ty/eleventy
Newlines, what
699
26.07.2019 07:48:33
18,000
5e502e920a67a5e2071baf3038e9bdc16c8a78c5
A few more tests for the newlines
[ { "change_type": "MODIFY", "old_path": "test/TestUtilityTest.js", "new_path": "test/TestUtilityTest.js", "diff": "@@ -2,9 +2,9 @@ import test from \"ava\";\nimport normalizeNewLines from \"./Util/normalizeNewLines\";\ntest(\"normalizeNewLines\", t => {\n- // t.is(normalizeNewLines(\"\\r\"), \"\");\n- // t.is(normalizeNewLines(\"\\\\r\"), \"\\\\r\");\n+ t.is(normalizeNewLines(\"\\n\"), \"\\n\");\nt.is(normalizeNewLines(\"\\r\\n\"), \"\\n\");\n- // t.is(normalizeNewLines(\"\\r\\n\\r\"), \"\\n\");\nt.is(normalizeNewLines(\"\\r\\n\\n\"), \"\\n\\n\");\n+ t.is(normalizeNewLines(\"\\r\\n\\r\\n\"), \"\\n\\n\");\n+ t.is(normalizeNewLines(\"a\\r\\nhello\\r\\nhi\"), \"a\\nhello\\nhi\");\n});\n" } ]
JavaScript
MIT License
11ty/eleventy
A few more tests for the newlines
699
26.07.2019 08:08:27
18,000
e74ae9de4d746d4bf3808a3d6200b0d308a903fa
Adds page.filePathStem, fixes
[ { "change_type": "MODIFY", "old_path": "src/Template.js", "new_path": "src/Template.js", "diff": "@@ -48,6 +48,7 @@ class Template extends TemplateContent {\nthis.wrapWithLayouts = true;\nthis.fileSlug = new TemplateFileSlug(this.inputPath, this.inputDir);\nthis.fileSlugStr = this.fileSlug.getSlug();\n+ this.filePathStem = this.fileSlug.getFullPathWithoutExtension();\n}\nsetIsVerbose(isVerbose) {\n@@ -274,6 +275,7 @@ class Template extends TemplateContent {\ndata.page.inputPath = this.inputPath;\ndata.page.fileSlug = this.fileSlugStr;\n+ data.page.filePathStem = this.filePathStem;\nreturn data;\n}\n@@ -399,6 +401,7 @@ class Template extends TemplateContent {\ntemplate: this,\ninputPath: this.inputPath,\nfileSlug: this.fileSlugStr,\n+ filePathStem: this.filePathStem,\ndata: data,\ndate: data.page.date,\noutputPath: data.page.outputPath,\n@@ -439,6 +442,7 @@ class Template extends TemplateContent {\ntemplate: page,\ninputPath: this.inputPath,\nfileSlug: this.fileSlugStr,\n+ filePathStem: this.filePathStem,\ndata: pageData,\ndate: pageData.page.date,\npageNumber: pageNumber++,\n@@ -450,9 +454,7 @@ class Template extends TemplateContent {\nget templateContent() {\nif (!this._templateContent) {\nthrow new TemplateContentPrematureUseError(\n- `Tried to use templateContent too early (${\n- this.inputPath\n- } page ${this.pageNumber})`\n+ `Tried to use templateContent too early (${this.inputPath} page ${this.pageNumber})`\n);\n}\nreturn this._templateContent;\n@@ -609,9 +611,7 @@ class Template extends TemplateContent {\nlet date = DateTime.fromISO(data.date, { zone: \"utc\" });\nif (!date.isValid) {\nthrow new Error(\n- `date front matter value (${data.date}) is invalid for ${\n- this.inputPath\n- }`\n+ `date front matter value (${data.date}) is invalid for ${this.inputPath}`\n);\n}\ndebug(\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateFileSlug.js", "new_path": "src/TemplateFileSlug.js", "diff": "@@ -12,28 +12,37 @@ class TemplateFileSlug {\nthis.cleanInputPath = inputPath.replace(/^.\\//, \"\");\nlet dirs = this.cleanInputPath.split(\"/\");\n- this.filename = dirs.pop();\nthis.dirs = dirs;\n+ this.dirs.pop();\n- let parsed = parsePath(inputPath);\n+ this.parsed = parsePath(inputPath);\n// TODO update this after the fix for issue #117 merges\nthis.filenameNoExt = EleventyExtensionMap.removeTemplateExtension(\n- parsed.base\n+ this.parsed.base\n);\n}\n- getSlug() {\n- let reg = this.filenameNoExt.match(/\\d{4}-\\d{2}-\\d{2}-(.*)/);\n+ getFullPathWithoutExtension() {\n+ return \"/\" + TemplatePath.join(...this.dirs, this._getRawSlug());\n+ }\n+\n+ _getRawSlug() {\nlet slug = this.filenameNoExt;\n+ let reg = slug.match(/\\d{4}-\\d{2}-\\d{2}-(.*)/);\nif (reg) {\n- slug = reg[1];\n+ return reg[1];\n+ }\n+ return slug;\n}\n- if (slug === \"index\") {\n+ getSlug() {\n+ let rawSlug = this._getRawSlug();\n+\n+ if (rawSlug === \"index\") {\nreturn this.dirs.length ? this.dirs[this.dirs.length - 1] : \"\";\n}\n- return slug;\n+ return rawSlug;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateFileSlugTest.js", "new_path": "test/TemplateFileSlugTest.js", "diff": "@@ -4,36 +4,43 @@ import TemplateFileSlug from \"../src/TemplateFileSlug\";\ntest(\"Easy slug\", t => {\nlet fs = new TemplateFileSlug(\"./file.html\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file\");\n});\ntest(\"Easy slug with dot\", t => {\nlet fs = new TemplateFileSlug(\"./file.test.html\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug with dot 11ty.js\", t => {\nlet fs = new TemplateFileSlug(\"./file.test.11ty.js\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug with date\", t => {\nlet fs = new TemplateFileSlug(\"./2018-01-01-file.html\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file\");\n});\ntest(\"Easy slug with date and dot in slug\", t => {\nlet fs = new TemplateFileSlug(\"./2018-01-01-file.test.html\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug, index\", t => {\nlet fs = new TemplateFileSlug(\"./index.html\");\nt.is(fs.getSlug(), \"\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/index\");\n});\ntest(\"Easy slug with date, index\", t => {\nlet fs = new TemplateFileSlug(\"./2018-01-01-index.html\");\nt.is(fs.getSlug(), \"\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/index\");\n});\n/* Directories */\n@@ -41,62 +48,74 @@ test(\"Easy slug with date, index\", t => {\ntest(\"Easy slug with dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/file.html\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/test/file\");\n});\ntest(\"Easy slug with dot with dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/file.test.html\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/test/file.test\");\n});\ntest(\"Easy slug with date with dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/2018-01-01-file.html\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/test/file\");\n});\ntest(\"Easy slug with date and dot in slug with dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/2018-01-01-file.test.html\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/test/file.test\");\n});\ntest(\"Easy slug, index with dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/index.html\");\nt.is(fs.getSlug(), \"test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/test/index\");\n});\ntest(\"Easy slug with date, index with dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/2018-01-01-index.html\");\nt.is(fs.getSlug(), \"test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/test/index\");\n});\n/* Pass Input dir */\ntest(\"Easy slug, input dir\", t => {\nlet fs = new TemplateFileSlug(\"./file.html\", \".\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file\");\n});\ntest(\"Easy slug with dot, input dir\", t => {\nlet fs = new TemplateFileSlug(\"./file.test.html\", \".\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug with date, input dir\", t => {\nlet fs = new TemplateFileSlug(\"./2018-01-01-file.html\", \".\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file\");\n});\ntest(\"Easy slug with date and dot in slug, input dir\", t => {\nlet fs = new TemplateFileSlug(\"./2018-01-01-file.test.html\", \".\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug, index, input dir\", t => {\nlet fs = new TemplateFileSlug(\"./index.html\", \".\");\nt.is(fs.getSlug(), \"\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/index\");\n});\ntest(\"Easy slug with date, index, input dir\", t => {\nlet fs = new TemplateFileSlug(\"./2018-01-01-index.html\", \".\");\nt.is(fs.getSlug(), \"\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/index\");\n});\n/* Directories and Input Dir */\n@@ -104,29 +123,47 @@ test(\"Easy slug with date, index, input dir\", t => {\ntest(\"Easy slug with dir and input dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/file.html\", \"./test\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file\");\n});\ntest(\"Easy slug with dot with dir and input dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/file.test.html\", \"./test\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug with date with dir and input dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/2018-01-01-file.html\", \"./test\");\nt.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file\");\n});\ntest(\"Easy slug with date and dot in slug with dir and input dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/2018-01-01-file.test.html\", \"./test\");\nt.is(fs.getSlug(), \"file.test\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/file.test\");\n});\ntest(\"Easy slug, index with dir and input dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/index.html\", \"./test\");\nt.is(fs.getSlug(), \"\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/index\");\n});\ntest(\"Easy slug with date, index with dir and input dir\", t => {\nlet fs = new TemplateFileSlug(\"./test/2018-01-01-index.html\", \"./test\");\nt.is(fs.getSlug(), \"\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/index\");\n+});\n+\n+test(\"Easy slug with multiple dirs\", t => {\n+ let fs = new TemplateFileSlug(\"./dir1/dir2/dir3/file.html\", \".\");\n+ t.is(fs.getSlug(), \"file\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/dir1/dir2/dir3/file\");\n+});\n+\n+test(\"Easy slug with multiple dirs and an index file\", t => {\n+ let fs = new TemplateFileSlug(\"./dir1/dir2/dir3/index.html\", \".\");\n+ t.is(fs.getSlug(), \"dir3\");\n+ t.is(fs.getFullPathWithoutExtension(), \"/dir1/dir2/dir3/index\");\n});\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -778,6 +778,7 @@ test(\"getRenderedData() has all the page variables\", async t => {\nt.truthy(data.page.url);\nt.is(data.page.url, \"/template/\");\nt.is(data.page.fileSlug, \"template\");\n+ t.is(data.page.filePathStem, \"/template\");\nt.truthy(data.page.date.getTime());\nt.is(data.page.inputPath, \"./test/stubs/template.ejs\");\nt.is(data.page.outputPath, \"./dist/template/index.html\");\n@@ -840,6 +841,7 @@ test(\"getTemplates() data has all the root variables\", async t => {\nt.is(templates[0].url, \"/template/\");\nt.is(templates[0].fileSlug, \"template\");\n+ t.is(templates[0].filePathStem, \"/template\");\nt.truthy(templates[0].date.getTime());\nt.is(templates[0].inputPath, \"./test/stubs/template.ejs\");\nt.is(templates[0].outputPath, \"./dist/template/index.html\");\n@@ -856,6 +858,7 @@ test(\"getTemplates() data has all the page variables\", async t => {\nt.is(templates[0].data.page.url, \"/template/\");\nt.is(templates[0].data.page.fileSlug, \"template\");\n+ t.is(templates[0].filePathStem, \"/template\");\nt.truthy(templates[0].data.page.date.getTime());\nt.is(templates[0].data.page.inputPath, \"./test/stubs/template.ejs\");\nt.is(templates[0].data.page.outputPath, \"./dist/template/index.html\");\n@@ -872,6 +875,7 @@ test(\"getRenderedTemplates() data has all the page variables\", async t => {\nlet templates = await tmpl.getRenderedTemplates(data);\nt.is(templates[0].data.page.url, \"/template/\");\nt.is(templates[0].data.page.fileSlug, \"template\");\n+ t.is(templates[0].filePathStem, \"/template\");\nt.truthy(templates[0].data.page.date.getTime());\nt.is(templates[0].data.page.inputPath, \"./test/stubs/template.ejs\");\nt.is(templates[0].data.page.outputPath, \"./dist/template/index.html\");\n@@ -881,6 +885,7 @@ test(\"getRenderedData() has good slug (empty, index)\", async t => {\nlet tmpl = new Template(\"./test/stubs/index.ejs\", \"./test/stubs/\", \"./dist\");\nlet data = await tmpl.getRenderedData();\nt.is(data.page.fileSlug, \"\");\n+ t.is(data.page.filePathStem, \"/index\");\n});\ntest(\"getRenderedData() has good slug\", async t => {\n@@ -891,6 +896,7 @@ test(\"getRenderedData() has good slug\", async t => {\n);\nlet data = await tmpl.getRenderedData();\nt.is(data.page.fileSlug, \"includer\");\n+ t.is(data.page.filePathStem, \"/includer\");\n});\ntest(\"Override base templating engine from .liquid to ejs\", async t => {\n" }, { "change_type": "MODIFY", "old_path": "test/stubs/_includes/permalink-in-layout/layout-fileslug.ejs", "new_path": "test/stubs/_includes/permalink-in-layout/layout-fileslug.ejs", "diff": "---\n-permalink: test/<%= page.fileSlug %>/index.html\n+permalink: test/<%= page.fileSlug %>/\n---\n<%- content %>\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
Adds page.filePathStem, fixes #244.
699
26.07.2019 17:36:36
18,000
1f5f24e154925e3bd4718755b36bfe3a39003869
Fix issue with that threw an error when doing passthrough copy by unmatched file extension
[ { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -34,6 +34,15 @@ class TemplatePassthroughManager {\nthis.isDryRun = !!isDryRun;\n}\n+ _normalizePaths(path, outputPath) {\n+ return {\n+ inputPath: TemplatePath.addLeadingDotSlash(path),\n+ outputPath: TemplatePath.stripLeadingDotSlash(\n+ outputPath !== undefined ? outputPath : path\n+ )\n+ };\n+ }\n+\ngetConfigPaths() {\nif (!this.config.passthroughFileCopy) {\ndebug(\"`passthroughFileCopy` is disabled in config, bypassing.\");\n@@ -44,9 +53,7 @@ class TemplatePassthroughManager {\nlet target = this.config.passthroughCopies || {};\ndebug(\"`passthroughFileCopy` config paths: %o\", target);\nfor (let path in target) {\n- const inputPath = TemplatePath.addLeadingDotSlash(path);\n- const outputPath = target[path];\n- paths.push({ inputPath, outputPath });\n+ paths.push(this._normalizePaths(path, target[path]));\n}\ndebug(\"`passthroughFileCopy` config normalized paths: %o\", paths);\nreturn paths;\n@@ -111,12 +118,17 @@ class TemplatePassthroughManager {\nlet promises = [];\ndebug(\"TemplatePassthrough copy started.\");\nfor (let path of this.getConfigPaths()) {\n+ debug(`TemplatePassthrough copying from config: ${path}`);\npromises.push(this.copyPath(path));\n}\nlet passthroughPaths = this.getFilePaths(paths);\nfor (let path of passthroughPaths) {\n- promises.push(this.copyPath(path));\n+ let normalizedPath = this._normalizePaths(path);\n+ debug(\n+ `TemplatePassthrough copying from non-matching file extension: ${normalizedPath}`\n+ );\n+ promises.push(this.copyPath(normalizedPath));\n}\nreturn Promise.all(promises).then(() => {\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePath.js", "new_path": "src/TemplatePath.js", "diff": "@@ -184,7 +184,7 @@ TemplatePath.addLeadingDotSlash = function(path) {\n* @returns {String} the `path` without a leading dot-slash segment.\n*/\nTemplatePath.stripLeadingDotSlash = function(path) {\n- return path.replace(/^\\.\\//, \"\");\n+ return typeof path === \"string\" ? path.replace(/^\\.\\//, \"\") : path;\n};\n/**\n" } ]
JavaScript
MIT License
11ty/eleventy
Fix issue with #452 that threw an error when doing passthrough copy by unmatched file extension
699
26.07.2019 17:40:31
18,000
dd3b17c9254bb553dabcc02a4b5beaf8a6e865c1
start of a test for issue (commented out)
[ { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1909,3 +1909,17 @@ test(\"global variable with dashes Issue #567 (liquid)\", async t => {\nlet pages = await tmpl.getRenderedTemplates(data);\nt.is(pages[0].templateContent.trim(), \"Yes\");\n});\n+\n+// test(\"Issue #446: Layout has a permalink with a different template language than content\", async t => {\n+// let tmpl = new Template(\n+// \"./test/stubs/layout-permalink-difflang/test.md\",\n+// \"./test/stubs/layout-permalink-difflang/\",\n+// \"dist\"\n+// );\n+\n+// let data = await tmpl.getData();\n+// let pages = await tmpl.getRenderedTemplates(data);\n+\n+// t.is(data.permalink, \"/{{ page.fileSlug }}/\");\n+// t.is(data.page.url, \"/test/\");\n+// });\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/layout-permalink-difflang/_includes/test.njk", "diff": "+---\n+permalink: \"/{{ page.fileSlug }}/\"\n+---\n+{{ content }}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/layout-permalink-difflang/test.md", "diff": "+---\n+layout: test.njk\n+templateEngineOverride: md\n+---\n+\n+# Title\n" } ]
JavaScript
MIT License
11ty/eleventy
start of a test for issue #446 (commented out)
699
26.07.2019 17:43:51
18,000
690832f9f91d2205e9df065dac1711eb9b0f2449
New code coverage for 0.9.0-beta.1
[ { "change_type": "MODIFY", "old_path": "docs-src/_data/coverage.json", "new_path": "docs-src/_data/coverage.json", "diff": "-{\"total\": {\"lines\":{\"total\":2643,\"covered\":2331,\"skipped\":0,\"pct\":88.2},\"statements\":{\"total\":2657,\"covered\":2345,\"skipped\":0,\"pct\":88.26},\"functions\":{\"total\":640,\"covered\":558,\"skipped\":0,\"pct\":87.19},\"branches\":{\"total\":999,\"covered\":803,\"skipped\":0,\"pct\":80.38}}\n+{\"total\": {\"lines\":{\"total\":2757,\"covered\":2443,\"skipped\":0,\"pct\":88.61},\"statements\":{\"total\":2772,\"covered\":2458,\"skipped\":0,\"pct\":88.67},\"functions\":{\"total\":657,\"covered\":574,\"skipped\":0,\"pct\":87.37},\"branches\":{\"total\":1102,\"covered\":894,\"skipped\":0,\"pct\":81.13}}\n,\"/Users/zachleat/Code/eleventy/config.js\": {\"lines\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":1,\"covered\":1,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Benchmark.js\": {\"lines\":{\"total\":12,\"covered\":11,\"skipped\":0,\"pct\":91.67},\"functions\":{\"total\":6,\"covered\":5,\"skipped\":0,\"pct\":83.33},\"statements\":{\"total\":12,\"covered\":11,\"skipped\":0,\"pct\":91.67},\"branches\":{\"total\":6,\"covered\":4,\"skipped\":0,\"pct\":66.67}}\n,\"/Users/zachleat/Code/eleventy/src/BenchmarkGroup.js\": {\"lines\":{\"total\":34,\"covered\":23,\"skipped\":0,\"pct\":67.65},\"functions\":{\"total\":7,\"covered\":5,\"skipped\":0,\"pct\":71.43},\"statements\":{\"total\":34,\"covered\":23,\"skipped\":0,\"pct\":67.65},\"branches\":{\"total\":10,\"covered\":3,\"skipped\":0,\"pct\":30}}\n,\"/Users/zachleat/Code/eleventy/src/EleventyBaseError.js\": {\"lines\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":1,\"covered\":1,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/EleventyCommandCheck.js\": {\"lines\":{\"total\":28,\"covered\":28,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":28,\"covered\":28,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":8,\"covered\":7,\"skipped\":0,\"pct\":87.5}}\n,\"/Users/zachleat/Code/eleventy/src/EleventyConfig.js\": {\"lines\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/EleventyErrorHandler.js\": {\"lines\":{\"total\":27,\"covered\":23,\"skipped\":0,\"pct\":85.19},\"functions\":{\"total\":6,\"covered\":5,\"skipped\":0,\"pct\":83.33},\"statements\":{\"total\":27,\"covered\":23,\"skipped\":0,\"pct\":85.19},\"branches\":{\"total\":25,\"covered\":16,\"skipped\":0,\"pct\":64}}\n+,\"/Users/zachleat/Code/eleventy/src/EleventyErrorHandler.js\": {\"lines\":{\"total\":36,\"covered\":33,\"skipped\":0,\"pct\":91.67},\"functions\":{\"total\":8,\"covered\":8,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":36,\"covered\":33,\"skipped\":0,\"pct\":91.67},\"branches\":{\"total\":37,\"covered\":25,\"skipped\":0,\"pct\":67.57}}\n,\"/Users/zachleat/Code/eleventy/src/EleventyErrorUtil.js\": {\"lines\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":1,\"covered\":1,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/EleventyExtensionMap.js\": {\"lines\":{\"total\":60,\"covered\":60,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":25,\"covered\":25,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":60,\"covered\":60,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":27,\"covered\":27,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/EleventyFiles.js\": {\"lines\":{\"total\":123,\"covered\":116,\"skipped\":0,\"pct\":94.31},\"functions\":{\"total\":36,\"covered\":32,\"skipped\":0,\"pct\":88.89},\"statements\":{\"total\":123,\"covered\":116,\"skipped\":0,\"pct\":94.31},\"branches\":{\"total\":42,\"covered\":38,\"skipped\":0,\"pct\":90.48}}\n+,\"/Users/zachleat/Code/eleventy/src/EleventyExtensionMap.js\": {\"lines\":{\"total\":60,\"covered\":58,\"skipped\":0,\"pct\":96.67},\"functions\":{\"total\":25,\"covered\":23,\"skipped\":0,\"pct\":92},\"statements\":{\"total\":60,\"covered\":58,\"skipped\":0,\"pct\":96.67},\"branches\":{\"total\":27,\"covered\":27,\"skipped\":0,\"pct\":100}}\n+,\"/Users/zachleat/Code/eleventy/src/EleventyFiles.js\": {\"lines\":{\"total\":126,\"covered\":119,\"skipped\":0,\"pct\":94.44},\"functions\":{\"total\":37,\"covered\":33,\"skipped\":0,\"pct\":89.19},\"statements\":{\"total\":126,\"covered\":119,\"skipped\":0,\"pct\":94.44},\"branches\":{\"total\":46,\"covered\":42,\"skipped\":0,\"pct\":91.3}}\n,\"/Users/zachleat/Code/eleventy/src/EleventyServe.js\": {\"lines\":{\"total\":61,\"covered\":22,\"skipped\":0,\"pct\":36.07},\"functions\":{\"total\":16,\"covered\":9,\"skipped\":0,\"pct\":56.25},\"statements\":{\"total\":61,\"covered\":22,\"skipped\":0,\"pct\":36.07},\"branches\":{\"total\":41,\"covered\":10,\"skipped\":0,\"pct\":24.39}}\n,\"/Users/zachleat/Code/eleventy/src/EleventyWatchTargets.js\": {\"lines\":{\"total\":46,\"covered\":43,\"skipped\":0,\"pct\":93.48},\"functions\":{\"total\":20,\"covered\":18,\"skipped\":0,\"pct\":90},\"statements\":{\"total\":46,\"covered\":43,\"skipped\":0,\"pct\":93.48},\"branches\":{\"total\":15,\"covered\":14,\"skipped\":0,\"pct\":93.33}}\n-,\"/Users/zachleat/Code/eleventy/src/Template.js\": {\"lines\":{\"total\":280,\"covered\":265,\"skipped\":0,\"pct\":94.64},\"functions\":{\"total\":47,\"covered\":46,\"skipped\":0,\"pct\":97.87},\"statements\":{\"total\":282,\"covered\":267,\"skipped\":0,\"pct\":94.68},\"branches\":{\"total\":101,\"covered\":86,\"skipped\":0,\"pct\":85.15}}\n+,\"/Users/zachleat/Code/eleventy/src/Template.js\": {\"lines\":{\"total\":282,\"covered\":267,\"skipped\":0,\"pct\":94.68},\"functions\":{\"total\":47,\"covered\":46,\"skipped\":0,\"pct\":97.87},\"statements\":{\"total\":284,\"covered\":269,\"skipped\":0,\"pct\":94.72},\"branches\":{\"total\":101,\"covered\":87,\"skipped\":0,\"pct\":86.14}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateCache.js\": {\"lines\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateCollection.js\": {\"lines\":{\"total\":29,\"covered\":27,\"skipped\":0,\"pct\":93.1},\"functions\":{\"total\":13,\"covered\":12,\"skipped\":0,\"pct\":92.31},\"statements\":{\"total\":31,\"covered\":29,\"skipped\":0,\"pct\":93.55},\"branches\":{\"total\":10,\"covered\":8,\"skipped\":0,\"pct\":80}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateConfig.js\": {\"lines\":{\"total\":55,\"covered\":50,\"skipped\":0,\"pct\":90.91},\"functions\":{\"total\":9,\"covered\":6,\"skipped\":0,\"pct\":66.67},\"statements\":{\"total\":55,\"covered\":50,\"skipped\":0,\"pct\":90.91},\"branches\":{\"total\":20,\"covered\":18,\"skipped\":0,\"pct\":90}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateContent.js\": {\"lines\":{\"total\":69,\"covered\":65,\"skipped\":0,\"pct\":94.2},\"functions\":{\"total\":17,\"covered\":17,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":69,\"covered\":65,\"skipped\":0,\"pct\":94.2},\"branches\":{\"total\":20,\"covered\":18,\"skipped\":0,\"pct\":90}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateData.js\": {\"lines\":{\"total\":158,\"covered\":149,\"skipped\":0,\"pct\":94.3},\"functions\":{\"total\":27,\"covered\":27,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":160,\"covered\":151,\"skipped\":0,\"pct\":94.38},\"branches\":{\"total\":48,\"covered\":39,\"skipped\":0,\"pct\":81.25}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateFileSlug.js\": {\"lines\":{\"total\":19,\"covered\":19,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":19,\"covered\":19,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":8,\"covered\":8,\"skipped\":0,\"pct\":100}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateConfig.js\": {\"lines\":{\"total\":57,\"covered\":52,\"skipped\":0,\"pct\":91.23},\"functions\":{\"total\":9,\"covered\":6,\"skipped\":0,\"pct\":66.67},\"statements\":{\"total\":57,\"covered\":52,\"skipped\":0,\"pct\":91.23},\"branches\":{\"total\":24,\"covered\":22,\"skipped\":0,\"pct\":91.67}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateContent.js\": {\"lines\":{\"total\":81,\"covered\":76,\"skipped\":0,\"pct\":93.83},\"functions\":{\"total\":17,\"covered\":16,\"skipped\":0,\"pct\":94.12},\"statements\":{\"total\":81,\"covered\":76,\"skipped\":0,\"pct\":93.83},\"branches\":{\"total\":34,\"covered\":31,\"skipped\":0,\"pct\":91.18}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateData.js\": {\"lines\":{\"total\":161,\"covered\":152,\"skipped\":0,\"pct\":94.41},\"functions\":{\"total\":27,\"covered\":27,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":163,\"covered\":154,\"skipped\":0,\"pct\":94.48},\"branches\":{\"total\":50,\"covered\":41,\"skipped\":0,\"pct\":82}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateFileSlug.js\": {\"lines\":{\"total\":23,\"covered\":23,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":4,\"covered\":4,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":23,\"covered\":23,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":8,\"covered\":8,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateGlob.js\": {\"lines\":{\"total\":15,\"covered\":14,\"skipped\":0,\"pct\":93.33},\"functions\":{\"total\":4,\"covered\":4,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":15,\"covered\":14,\"skipped\":0,\"pct\":93.33},\"branches\":{\"total\":8,\"covered\":7,\"skipped\":0,\"pct\":87.5}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateLayout.js\": {\"lines\":{\"total\":68,\"covered\":68,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":69,\"covered\":69,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":14,\"covered\":14,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateLayoutPathResolver.js\": {\"lines\":{\"total\":47,\"covered\":45,\"skipped\":0,\"pct\":95.74},\"functions\":{\"total\":11,\"covered\":11,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":47,\"covered\":45,\"skipped\":0,\"pct\":95.74},\"branches\":{\"total\":18,\"covered\":16,\"skipped\":0,\"pct\":88.89}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateMap.js\": {\"lines\":{\"total\":218,\"covered\":213,\"skipped\":0,\"pct\":97.71},\"functions\":{\"total\":30,\"covered\":29,\"skipped\":0,\"pct\":96.67},\"statements\":{\"total\":218,\"covered\":213,\"skipped\":0,\"pct\":97.71},\"branches\":{\"total\":111,\"covered\":102,\"skipped\":0,\"pct\":91.89}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplatePassthrough.js\": {\"lines\":{\"total\":13,\"covered\":10,\"skipped\":0,\"pct\":76.92},\"functions\":{\"total\":4,\"covered\":3,\"skipped\":0,\"pct\":75},\"statements\":{\"total\":13,\"covered\":10,\"skipped\":0,\"pct\":76.92},\"branches\":{\"total\":2,\"covered\":0,\"skipped\":0,\"pct\":0}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplatePassthroughManager.js\": {\"lines\":{\"total\":54,\"covered\":44,\"skipped\":0,\"pct\":81.48},\"functions\":{\"total\":16,\"covered\":13,\"skipped\":0,\"pct\":81.25},\"statements\":{\"total\":54,\"covered\":44,\"skipped\":0,\"pct\":81.48},\"branches\":{\"total\":12,\"covered\":9,\"skipped\":0,\"pct\":75}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplatePath.js\": {\"lines\":{\"total\":74,\"covered\":74,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":23,\"covered\":22,\"skipped\":0,\"pct\":95.65},\"statements\":{\"total\":75,\"covered\":75,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":36,\"covered\":36,\"skipped\":0,\"pct\":100}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateMap.js\": {\"lines\":{\"total\":238,\"covered\":232,\"skipped\":0,\"pct\":97.48},\"functions\":{\"total\":33,\"covered\":31,\"skipped\":0,\"pct\":93.94},\"statements\":{\"total\":238,\"covered\":232,\"skipped\":0,\"pct\":97.48},\"branches\":{\"total\":123,\"covered\":111,\"skipped\":0,\"pct\":90.24}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplatePassthrough.js\": {\"lines\":{\"total\":36,\"covered\":34,\"skipped\":0,\"pct\":94.44},\"functions\":{\"total\":9,\"covered\":8,\"skipped\":0,\"pct\":88.89},\"statements\":{\"total\":36,\"covered\":34,\"skipped\":0,\"pct\":94.44},\"branches\":{\"total\":10,\"covered\":8,\"skipped\":0,\"pct\":80}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplatePassthroughManager.js\": {\"lines\":{\"total\":58,\"covered\":53,\"skipped\":0,\"pct\":91.38},\"functions\":{\"total\":17,\"covered\":17,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":58,\"covered\":53,\"skipped\":0,\"pct\":91.38},\"branches\":{\"total\":14,\"covered\":10,\"skipped\":0,\"pct\":71.43}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplatePath.js\": {\"lines\":{\"total\":74,\"covered\":74,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":23,\"covered\":22,\"skipped\":0,\"pct\":95.65},\"statements\":{\"total\":75,\"covered\":75,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":38,\"covered\":38,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplatePermalink.js\": {\"lines\":{\"total\":30,\"covered\":30,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":7,\"covered\":7,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":30,\"covered\":30,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":20,\"covered\":20,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplatePermalinkNoWrite.js\": {\"lines\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/TemplateRender.js\": {\"lines\":{\"total\":77,\"covered\":76,\"skipped\":0,\"pct\":98.7},\"functions\":{\"total\":22,\"covered\":22,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":77,\"covered\":76,\"skipped\":0,\"pct\":98.7},\"branches\":{\"total\":42,\"covered\":40,\"skipped\":0,\"pct\":95.24}}\n-,\"/Users/zachleat/Code/eleventy/src/TemplateWriter.js\": {\"lines\":{\"total\":94,\"covered\":78,\"skipped\":0,\"pct\":82.98},\"functions\":{\"total\":21,\"covered\":15,\"skipped\":0,\"pct\":71.43},\"statements\":{\"total\":94,\"covered\":78,\"skipped\":0,\"pct\":82.98},\"branches\":{\"total\":10,\"covered\":3,\"skipped\":0,\"pct\":30}}\n-,\"/Users/zachleat/Code/eleventy/src/UserConfig.js\": {\"lines\":{\"total\":163,\"covered\":105,\"skipped\":0,\"pct\":64.42},\"functions\":{\"total\":44,\"covered\":23,\"skipped\":0,\"pct\":52.27},\"statements\":{\"total\":164,\"covered\":106,\"skipped\":0,\"pct\":64.63},\"branches\":{\"total\":63,\"covered\":34,\"skipped\":0,\"pct\":53.97}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Ejs.js\": {\"lines\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"functions\":{\"total\":7,\"covered\":6,\"skipped\":0,\"pct\":85.71},\"statements\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"branches\":{\"total\":6,\"covered\":4,\"skipped\":0,\"pct\":66.67}}\n+,\"/Users/zachleat/Code/eleventy/src/TemplateWriter.js\": {\"lines\":{\"total\":96,\"covered\":78,\"skipped\":0,\"pct\":81.25},\"functions\":{\"total\":21,\"covered\":15,\"skipped\":0,\"pct\":71.43},\"statements\":{\"total\":96,\"covered\":78,\"skipped\":0,\"pct\":81.25},\"branches\":{\"total\":10,\"covered\":3,\"skipped\":0,\"pct\":30}}\n+,\"/Users/zachleat/Code/eleventy/src/UserConfig.js\": {\"lines\":{\"total\":166,\"covered\":107,\"skipped\":0,\"pct\":64.46},\"functions\":{\"total\":45,\"covered\":23,\"skipped\":0,\"pct\":51.11},\"statements\":{\"total\":167,\"covered\":108,\"skipped\":0,\"pct\":64.67},\"branches\":{\"total\":66,\"covered\":36,\"skipped\":0,\"pct\":54.55}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Ejs.js\": {\"lines\":{\"total\":20,\"covered\":19,\"skipped\":0,\"pct\":95},\"functions\":{\"total\":7,\"covered\":6,\"skipped\":0,\"pct\":85.71},\"statements\":{\"total\":20,\"covered\":19,\"skipped\":0,\"pct\":95},\"branches\":{\"total\":9,\"covered\":8,\"skipped\":0,\"pct\":88.89}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Haml.js\": {\"lines\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Handlebars.js\": {\"lines\":{\"total\":30,\"covered\":30,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":30,\"covered\":30,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":6,\"covered\":5,\"skipped\":0,\"pct\":83.33}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Html.js\": {\"lines\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":9,\"covered\":9,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/JavaScript.js\": {\"lines\":{\"total\":35,\"covered\":35,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":10,\"covered\":10,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":35,\"covered\":35,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":22,\"covered\":22,\"skipped\":0,\"pct\":100}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/JavaScript.js\": {\"lines\":{\"total\":50,\"covered\":48,\"skipped\":0,\"pct\":96},\"functions\":{\"total\":12,\"covered\":12,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":51,\"covered\":49,\"skipped\":0,\"pct\":96.08},\"branches\":{\"total\":42,\"covered\":37,\"skipped\":0,\"pct\":88.1}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/JavaScriptTemplateLiteral.js\": {\"lines\":{\"total\":18,\"covered\":17,\"skipped\":0,\"pct\":94.44},\"functions\":{\"total\":3,\"covered\":3,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":18,\"covered\":17,\"skipped\":0,\"pct\":94.44},\"branches\":{\"total\":6,\"covered\":6,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Liquid.js\": {\"lines\":{\"total\":69,\"covered\":66,\"skipped\":0,\"pct\":95.65},\"functions\":{\"total\":26,\"covered\":25,\"skipped\":0,\"pct\":96.15},\"statements\":{\"total\":69,\"covered\":66,\"skipped\":0,\"pct\":95.65},\"branches\":{\"total\":10,\"covered\":8,\"skipped\":0,\"pct\":80}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Markdown.js\": {\"lines\":{\"total\":31,\"covered\":28,\"skipped\":0,\"pct\":90.32},\"functions\":{\"total\":9,\"covered\":8,\"skipped\":0,\"pct\":88.89},\"statements\":{\"total\":31,\"covered\":28,\"skipped\":0,\"pct\":90.32},\"branches\":{\"total\":14,\"covered\":11,\"skipped\":0,\"pct\":78.57}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Liquid.js\": {\"lines\":{\"total\":73,\"covered\":70,\"skipped\":0,\"pct\":95.89},\"functions\":{\"total\":26,\"covered\":25,\"skipped\":0,\"pct\":96.15},\"statements\":{\"total\":73,\"covered\":70,\"skipped\":0,\"pct\":95.89},\"branches\":{\"total\":15,\"covered\":13,\"skipped\":0,\"pct\":86.67}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Markdown.js\": {\"lines\":{\"total\":33,\"covered\":30,\"skipped\":0,\"pct\":90.91},\"functions\":{\"total\":9,\"covered\":8,\"skipped\":0,\"pct\":88.89},\"statements\":{\"total\":33,\"covered\":30,\"skipped\":0,\"pct\":90.91},\"branches\":{\"total\":16,\"covered\":13,\"skipped\":0,\"pct\":81.25}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/Mustache.js\": {\"lines\":{\"total\":10,\"covered\":10,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":4,\"covered\":4,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":10,\"covered\":10,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Nunjucks.js\": {\"lines\":{\"total\":58,\"covered\":51,\"skipped\":0,\"pct\":87.93},\"functions\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"statements\":{\"total\":58,\"covered\":51,\"skipped\":0,\"pct\":87.93},\"branches\":{\"total\":8,\"covered\":6,\"skipped\":0,\"pct\":75}}\n-,\"/Users/zachleat/Code/eleventy/src/Engines/Pug.js\": {\"lines\":{\"total\":15,\"covered\":15,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":15,\"covered\":15,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":4,\"covered\":3,\"skipped\":0,\"pct\":75}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Nunjucks.js\": {\"lines\":{\"total\":61,\"covered\":54,\"skipped\":0,\"pct\":88.52},\"functions\":{\"total\":19,\"covered\":18,\"skipped\":0,\"pct\":94.74},\"statements\":{\"total\":61,\"covered\":54,\"skipped\":0,\"pct\":88.52},\"branches\":{\"total\":13,\"covered\":11,\"skipped\":0,\"pct\":84.62}}\n+,\"/Users/zachleat/Code/eleventy/src/Engines/Pug.js\": {\"lines\":{\"total\":17,\"covered\":17,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":5,\"covered\":5,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":17,\"covered\":17,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":9,\"covered\":8,\"skipped\":0,\"pct\":88.89}}\n,\"/Users/zachleat/Code/eleventy/src/Engines/TemplateEngine.js\": {\"lines\":{\"total\":51,\"covered\":51,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":18,\"covered\":18,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":53,\"covered\":53,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":8,\"covered\":8,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Errors/TemplateContentPrematureUseError.js\": {\"lines\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n,\"/Users/zachleat/Code/eleventy/src/Errors/UsingCircularTemplateContentReferenceError.js\": {\"lines\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"functions\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100},\"statements\":{\"total\":2,\"covered\":2,\"skipped\":0,\"pct\":100},\"branches\":{\"total\":0,\"covered\":0,\"skipped\":0,\"pct\":100}}\n" }, { "change_type": "MODIFY", "old_path": "docs/coverage.md", "new_path": "docs/coverage.md", "diff": "-# Code Coverage for Eleventy v0.8.3\n+# Code Coverage for Eleventy v0.9.0-beta.1\n| Filename | % Lines | % Statements | % Functions | % Branches |\n| ---------------------------------------------------------- | ------- | ------------ | ----------- | ---------- |\n-| `total` | 88.2% | 88.26% | 87.19% | 80.38% |\n+| `total` | 88.61% | 88.67% | 87.37% | 81.13% |\n| `config.js` | 100% | 100% | 100% | 100% |\n| `src/Benchmark.js` | 91.67% | 91.67% | 83.33% | 66.67% |\n| `src/BenchmarkGroup.js` | 67.65% | 67.65% | 71.43% | 30% |\n| `src/EleventyBaseError.js` | 100% | 100% | 100% | 100% |\n| `src/EleventyCommandCheck.js` | 100% | 100% | 100% | 87.5% |\n| `src/EleventyConfig.js` | 100% | 100% | 100% | 100% |\n-| `src/EleventyErrorHandler.js` | 85.19% | 85.19% | 83.33% | 64% |\n+| `src/EleventyErrorHandler.js` | 91.67% | 91.67% | 100% | 67.57% |\n| `src/EleventyErrorUtil.js` | 100% | 100% | 100% | 100% |\n-| `src/EleventyExtensionMap.js` | 100% | 100% | 100% | 100% |\n-| `src/EleventyFiles.js` | 94.31% | 94.31% | 88.89% | 90.48% |\n+| `src/EleventyExtensionMap.js` | 96.67% | 96.67% | 92% | 100% |\n+| `src/EleventyFiles.js` | 94.44% | 94.44% | 89.19% | 91.3% |\n| `src/EleventyServe.js` | 36.07% | 36.07% | 56.25% | 24.39% |\n| `src/EleventyWatchTargets.js` | 93.48% | 93.48% | 90% | 93.33% |\n-| `src/Template.js` | 94.64% | 94.68% | 97.87% | 85.15% |\n+| `src/Template.js` | 94.68% | 94.72% | 97.87% | 86.14% |\n| `src/TemplateCache.js` | 100% | 100% | 100% | 100% |\n| `src/TemplateCollection.js` | 93.1% | 93.55% | 92.31% | 80% |\n-| `src/TemplateConfig.js` | 90.91% | 90.91% | 66.67% | 90% |\n-| `src/TemplateContent.js` | 94.2% | 94.2% | 100% | 90% |\n-| `src/TemplateData.js` | 94.3% | 94.38% | 100% | 81.25% |\n+| `src/TemplateConfig.js` | 91.23% | 91.23% | 66.67% | 91.67% |\n+| `src/TemplateContent.js` | 93.83% | 93.83% | 94.12% | 91.18% |\n+| `src/TemplateData.js` | 94.41% | 94.48% | 100% | 82% |\n| `src/TemplateFileSlug.js` | 100% | 100% | 100% | 100% |\n| `src/TemplateGlob.js` | 93.33% | 93.33% | 100% | 87.5% |\n| `src/TemplateLayout.js` | 100% | 100% | 100% | 100% |\n| `src/TemplateLayoutPathResolver.js` | 95.74% | 95.74% | 100% | 88.89% |\n-| `src/TemplateMap.js` | 97.71% | 97.71% | 96.67% | 91.89% |\n-| `src/TemplatePassthrough.js` | 76.92% | 76.92% | 75% | 0% |\n-| `src/TemplatePassthroughManager.js` | 81.48% | 81.48% | 81.25% | 75% |\n+| `src/TemplateMap.js` | 97.48% | 97.48% | 93.94% | 90.24% |\n+| `src/TemplatePassthrough.js` | 94.44% | 94.44% | 88.89% | 80% |\n+| `src/TemplatePassthroughManager.js` | 91.38% | 91.38% | 100% | 71.43% |\n| `src/TemplatePath.js` | 100% | 100% | 95.65% | 100% |\n| `src/TemplatePermalink.js` | 100% | 100% | 100% | 100% |\n| `src/TemplatePermalinkNoWrite.js` | 100% | 100% | 100% | 100% |\n| `src/TemplateRender.js` | 98.7% | 98.7% | 100% | 95.24% |\n-| `src/TemplateWriter.js` | 82.98% | 82.98% | 71.43% | 30% |\n-| `src/UserConfig.js` | 64.42% | 64.63% | 52.27% | 53.97% |\n-| `src/Engines/Ejs.js` | 94.74% | 94.74% | 85.71% | 66.67% |\n+| `src/TemplateWriter.js` | 81.25% | 81.25% | 71.43% | 30% |\n+| `src/UserConfig.js` | 64.46% | 64.67% | 51.11% | 54.55% |\n+| `src/Engines/Ejs.js` | 95% | 95% | 85.71% | 88.89% |\n| `src/Engines/Haml.js` | 100% | 100% | 100% | 100% |\n| `src/Engines/Handlebars.js` | 100% | 100% | 100% | 83.33% |\n| `src/Engines/Html.js` | 100% | 100% | 100% | 100% |\n-| `src/Engines/JavaScript.js` | 100% | 100% | 100% | 100% |\n+| `src/Engines/JavaScript.js` | 96% | 96.08% | 100% | 88.1% |\n| `src/Engines/JavaScriptTemplateLiteral.js` | 94.44% | 94.44% | 100% | 100% |\n-| `src/Engines/Liquid.js` | 95.65% | 95.65% | 96.15% | 80% |\n-| `src/Engines/Markdown.js` | 90.32% | 90.32% | 88.89% | 78.57% |\n+| `src/Engines/Liquid.js` | 95.89% | 95.89% | 96.15% | 86.67% |\n+| `src/Engines/Markdown.js` | 90.91% | 90.91% | 88.89% | 81.25% |\n| `src/Engines/Mustache.js` | 100% | 100% | 100% | 100% |\n-| `src/Engines/Nunjucks.js` | 87.93% | 87.93% | 94.74% | 75% |\n-| `src/Engines/Pug.js` | 100% | 100% | 100% | 75% |\n+| `src/Engines/Nunjucks.js` | 88.52% | 88.52% | 94.74% | 84.62% |\n+| `src/Engines/Pug.js` | 100% | 100% | 100% | 88.89% |\n| `src/Engines/TemplateEngine.js` | 100% | 100% | 100% | 100% |\n| `src/Errors/TemplateContentPrematureUseError.js` | 100% | 100% | 100% | 100% |\n| `src/Errors/UsingCircularTemplateContentReferenceError.js` | 100% | 100% | 100% | 100% |\n" } ]
JavaScript
MIT License
11ty/eleventy
New code coverage for 0.9.0-beta.1
669
27.07.2019 10:15:37
-7,200
2098f81b1fabe5924d1392c7885872e716d6d287
Update dependencies (minor and patch versions)
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"handlebars\": \"^4.1.2\",\n\"javascript-stringify\": \"^2.0.0\",\n\"liquidjs\": \"^6.4.3\",\n- \"lodash\": \"^4.17.11\",\n- \"luxon\": \"^1.16.0\",\n+ \"lodash\": \"^4.17.15\",\n+ \"luxon\": \"^1.17.2\",\n\"markdown-it\": \"^8.4.2\",\n\"minimist\": \"^1.2.0\",\n\"moo\": \"^0.5.0\",\n\"parse-filepath\": \"^1.0.2\",\n\"please-upgrade-node\": \"^3.1.1\",\n\"pretty\": \"^2.0.0\",\n- \"pug\": \"^2.0.3\",\n+ \"pug\": \"^2.0.4\",\n\"recursive-copy\": \"^2.0.10\",\n- \"semver\": \"^6.1.1\",\n+ \"semver\": \"^6.3.0\",\n\"slugify\": \"^1.3.4\",\n\"time-require\": \"^0.1.2\",\n\"valid-url\": \"^1.0.9\"\n" } ]
JavaScript
MIT License
11ty/eleventy
Update dependencies (minor and patch versions)
701
28.07.2019 23:25:36
-10,800
09e5046f07c01057f34348a21c313d190c2eb12e
Implementation of custom data files. Main changes are in TemplateData. User config uses new Map() to store pairs (extension, parser) where parser is a function receiving file contents in string and returning data object. Later declared parsers have priority over first ones.
[ { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -54,6 +54,9 @@ class UserConfig {\n// this.templateExtensionAliases = {};\nthis.watchJavaScriptDependencies = true;\nthis.browserSyncConfig = {};\n+\n+ // using Map to preserve insertion order\n+ this.dataExtensions = new Map();\n}\nversionCheck(expected) {\n@@ -537,13 +540,18 @@ class UserConfig {\n// templateExtensionAliases: this.templateExtensionAliases,\nwatchJavaScriptDependencies: this.watchJavaScriptDependencies,\nbrowserSyncConfig: this.browserSyncConfig,\n- frontMatterParsingOptions: this.frontMatterParsingOptions\n+ frontMatterParsingOptions: this.frontMatterParsingOptions,\n+ dataExtensions: this.dataExtensions\n};\n}\n// addExtension(fileExtension, userClass) {\n// this.userExtensionMap[ fileExtension ] = userClass;\n// }\n+\n+ addDataExtension(formatExtension, formatParser) {\n+ this.dataExtensions.set(formatExtension, formatParser);\n+ }\n}\nmodule.exports = UserConfig;\n" } ]
JavaScript
MIT License
11ty/eleventy
Implementation of custom data files. Main changes are in TemplateData. User config uses new Map() to store pairs (extension, parser) where parser is a function receiving file contents in string and returning data object. Later declared parsers have priority over first ones.
716
05.08.2019 18:53:28
-7,200
5118d6088a32343662460ca54d89330af619034d
Pass current template data to the Markdown engine
[ { "change_type": "MODIFY", "old_path": "src/Engines/Markdown.js", "new_path": "src/Engines/Markdown.js", "diff": "@@ -69,7 +69,7 @@ class Markdown extends TemplateEngine {\n} else {\nreturn async function(data) {\nlet preTemplateEngineRender = await fn(data);\n- let finishedRender = mdlib.render(preTemplateEngineRender);\n+ let finishedRender = mdlib.render(preTemplateEngineRender, data);\nreturn finishedRender;\n};\n}\n@@ -79,9 +79,8 @@ class Markdown extends TemplateEngine {\nreturn str;\n};\n} else {\n- return function() {\n- // throw away data if preTemplateEngine is falsy\n- return mdlib.render(str);\n+ return function(data) {\n+ return mdlib.render(str, data);\n};\n}\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Pass current template data to the Markdown engine
716
06.08.2019 07:30:31
-7,200
4d5d33a3cc66d92d8814a55b1c3af46cc4dcd411
Add tests to see that we send context data through Markdown to plugins
[ { "change_type": "ADD", "old_path": null, "new_path": "test/TemplateRenderMarkdownPluginTest.js", "diff": "+import test from \"ava\";\n+import TemplateRender from \"../src/TemplateRender\";\n+import md from \"markdown-it\";\n+\n+const createTestMarkdownPlugin = () => {\n+ const plugin = md => {\n+ md.core.ruler.after(\"inline\", \"replace-link\", function(state) {\n+ plugin.environment = state.env;\n+ return false;\n+ });\n+ };\n+ plugin.environment = {};\n+ return plugin;\n+};\n+\n+test(\"Markdown Render: with HTML prerender, sends context data to the markdown library\", async t => {\n+ let tr = new TemplateRender(\"md\");\n+\n+ const plugin = createTestMarkdownPlugin();\n+ let mdLib = md().use(plugin);\n+ tr.engine.setLibrary(mdLib);\n+\n+ const data = { some: \"data\" };\n+\n+ let fn = await tr.getCompiledTemplate(\"[link text](http://link.com)\");\n+ let result = await fn(data);\n+ t.deepEqual(plugin.environment, data);\n+});\n+\n+test(\"Markdown Render: without HTML prerender, sends context data to the markdown library\", async t => {\n+ let tr = new TemplateRender(\"md\");\n+\n+ const plugin = createTestMarkdownPlugin();\n+ let mdLib = md().use(plugin);\n+ tr.engine.setLibrary(mdLib);\n+ tr.setHtmlEngine(false);\n+\n+ const data = { some: \"data\" };\n+\n+ let fn = await tr.getCompiledTemplate(\"[link text](http://link.com)\");\n+ let result = await fn(data);\n+ t.deepEqual(plugin.environment, data);\n+});\n" } ]
JavaScript
MIT License
11ty/eleventy
Add tests to see that we send context data through Markdown to plugins
717
08.08.2019 16:57:20
14,400
7b34edb4b1d0b2b15bf7dd5e9cbb1456620620bb
Fix broken error reporting when writing templates Adds missed `new` operators from commit
[ { "change_type": "MODIFY", "old_path": "src/TemplateWriter.js", "new_path": "src/TemplateWriter.js", "diff": "@@ -166,7 +166,7 @@ TemplateWriter.prototype.write = async function() {\nusedTemplateContentTooEarlyMap.push(mapEntry);\n} else {\nreturn Promise.reject(\n- TemplateWriterWriteError(\n+ new TemplateWriterWriteError(\n`Having trouble writing template: ${mapEntry.outputPath}`,\ne\n)\n@@ -180,7 +180,7 @@ TemplateWriter.prototype.write = async function() {\npromises.push(\nthis._writeTemplate(mapEntry).catch(function(e) {\nreturn Promise.reject(\n- TemplateWriterWriteError(\n+ new TemplateWriterWriteError(\n`Having trouble writing template (second pass): ${mapEntry.outputPath}`,\ne\n)\n" } ]
JavaScript
MIT License
11ty/eleventy
Fix broken error reporting when writing templates Adds missed `new` operators from commit 320af9bb0206d2befb0eafd4007481e3965a28ec
699
15.08.2019 08:37:30
18,000
e29808f2314715b23722cbb0ade4698a024ef882
Keep a test for
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "@@ -71,6 +71,18 @@ test(\"Nunjucks Render Relative Include (using ..) Issue #190\", async t => {\n\"<p>{% include '../dir/included.njk' %}</p>\"\n);\nt.is(await fn(), \"<p>HELLO FROM THE OTHER SIDE.</p>\");\n+\n+ // should look in _includes too, related to Issue #633\n+ let fn2a = await tr.getCompiledTemplate(\n+ \"<p>{% include 'included-relative.njk' %}</p>\"\n+ );\n+ t.is(await fn2a(), \"<p>akdlsjafkljdskl</p>\");\n+\n+ // should look in _includes too Issue #633\n+ // let fn3 = await tr.getCompiledTemplate(\n+ // \"<p>{% include '../_includes/included-relative.njk' %}</p>\"\n+ // );\n+ // t.is(await fn3(), \"<p>akdlsjafkljdskl</p>\");\n});\ntest(\"Nunjucks Render Relative Include (using current dir) Issue #190\", async t => {\n" } ]
JavaScript
MIT License
11ty/eleventy
Keep a test for #633
699
21.08.2019 20:46:22
18,000
dc994d734e61908274737b7831eb7448141857ae
A few more tests and fixes for
[ { "change_type": "MODIFY", "old_path": "src/TemplateMap.js", "new_path": "src/TemplateMap.js", "diff": "@@ -28,10 +28,6 @@ class TemplateMap {\nreturn \"___TAG___\";\n}\n- get specialPrefix() {\n- return \"___SPECIAL___\";\n- }\n-\nasync add(template) {\nfor (let map of await template.getTemplateMapEntries()) {\nthis.map.push(map);\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthrough.js", "new_path": "src/TemplatePassthrough.js", "diff": "@@ -20,23 +20,32 @@ class TemplatePassthrough {\nthis.isDryRun = false;\n}\n- getOutputPath() {\n+ getOutputPath(inputFileFromGlob) {\nconst { inputDir, outputDir, outputPath, inputPath } = this;\n+\nif (outputPath === true) {\nreturn TemplatePath.normalize(\nTemplatePath.join(\noutputDir,\n- TemplatePath.stripLeadingSubPath(inputPath, inputDir)\n+ TemplatePath.stripLeadingSubPath(\n+ inputFileFromGlob || inputPath,\n+ inputDir\n+ )\n)\n);\n}\n+\n+ if (inputFileFromGlob) {\n+ return this.getOutputPathForGlobFile(inputFileFromGlob);\n+ }\n+\nreturn TemplatePath.normalize(TemplatePath.join(outputDir, outputPath));\n}\n- getOutputPathForGlobFile(globFile) {\n+ getOutputPathForGlobFile(inputFileFromGlob) {\nreturn TemplatePath.join(\nthis.getOutputPath(),\n- TemplatePath.getLastPathSegment(globFile)\n+ TemplatePath.getLastPathSegment(inputFileFromGlob)\n);\n}\n@@ -93,11 +102,7 @@ class TemplatePassthrough {\nconst files = await this.getFiles(this.inputPath);\nconst promises = files.map(inputFile =>\n- this.copy(\n- inputFile,\n- this.getOutputPathForGlobFile(inputFile),\n- copyOptions\n- )\n+ this.copy(inputFile, this.getOutputPath(inputFile), copyOptions)\n);\nreturn Promise.all(promises).catch(err => {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplatePassthroughTest.js", "new_path": "test/TemplatePassthroughTest.js", "diff": "@@ -198,6 +198,7 @@ test(\"getFiles with glob\", async t => {\nconst inputPath = \"./test/stubs/template-passthrough/static/**\";\nlet pass = getTemplatePassthrough(inputPath, \"_site\", \"_src\");\nt.is(pass.outputPath, true);\n+\nconst files = await pass.getFiles(inputPath);\nt.deepEqual(\nfiles.sort(),\n@@ -207,17 +208,32 @@ test(\"getFiles with glob\", async t => {\n\"./test/stubs/template-passthrough/static/nested/test-nested.css\"\n].sort()\n);\n+\n+ t.is(\n+ pass.getOutputPath(files.filter(entry => entry.endsWith(\"test.css\"))[0]),\n+ \"_site/test/stubs/template-passthrough/static/test.css\"\n+ );\n+ t.is(\n+ pass.getOutputPath(files.filter(entry => entry.endsWith(\"test.js\"))[0]),\n+ \"_site/test/stubs/template-passthrough/static/test.js\"\n+ );\n+ t.is(\n+ pass.getOutputPath(\n+ files.filter(entry => entry.endsWith(\"test-nested.css\"))[0]\n+ ),\n+ \"_site/test/stubs/template-passthrough/static/nested/test-nested.css\"\n+ );\n});\ntest(\"getFiles with glob 2\", async t => {\nconst inputPath = \"./test/stubs/template-passthrough/static/**/*.js\";\n- let pass = getTemplatePassthrough(\n- \"./test/stubs/template-passthrough/static/**/*\",\n- \"_site\",\n- \"_src\"\n- );\n+ let pass = getTemplatePassthrough(inputPath, \"_site\", \"_src\");\nt.is(pass.outputPath, true);\nconst files = await pass.getFiles(inputPath);\nt.deepEqual(files, [\"./test/stubs/template-passthrough/static/test.js\"]);\n+ t.is(\n+ pass.getOutputPath(files[0]),\n+ \"_site/test/stubs/template-passthrough/static/test.js\"\n+ );\n});\ntest(\"Directory where outputPath is true\", async t => {\n@@ -251,10 +267,7 @@ test(\"Glob pattern\", async t => {\n\"_src\"\n);\nt.is(pass.outputPath, \"./directory/\");\n- t.is(\n- pass.getOutputPathForGlobFile(globResolvedPath),\n- \"_site/directory/test.js\"\n- );\n+ t.is(pass.getOutputPath(globResolvedPath), \"_site/directory/test.js\");\n});\ntest(\"Output paths match with different templatePassthrough methods\", async t => {\n" } ]
JavaScript
MIT License
11ty/eleventy
A few more tests and fixes for #661
699
27.08.2019 08:06:18
18,000
592395aa276839d2371c6e86d7840b035981c566
Updating dependencies for 0.9.0
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"devDependencies\": {\n\"@11ty/eleventy-plugin-syntaxhighlight\": \"^2.0.3\",\n\"ava\": \"^2.2.0\",\n- \"lint-staged\": \"^8.2.1\",\n+ \"lint-staged\": \"^9.2.5\",\n\"markdown-it-emoji\": \"^1.4.0\",\n\"nyc\": \"^14.1.1\",\n\"pre-commit\": \"^1.2.2\",\n\"pre-push\": \"^0.1.1\",\n\"prettier\": \"^1.18.2\",\n- \"rimraf\": \"^2.6.3\",\n+ \"rimraf\": \"^3.0.0\",\n\"toml\": \"^3.0.0\",\n\"viperhtml\": \"^2.17.0\",\n\"vue\": \"^2.6.10\",\n\"dependencies\": {\n\"browser-sync\": \"^2.26.7\",\n\"chalk\": \"^2.4.2\",\n- \"chokidar\": \"^2.1.5\",\n+ \"chokidar\": \"^3.0.2\",\n\"debug\": \"^4.1.1\",\n\"dependency-graph\": \"^0.8.0\",\n- \"dependency-tree\": \"^6.3.0\",\n+ \"dependency-tree\": \"^7.0.2\",\n\"ejs\": \"^2.6.2\",\n\"fast-glob\": \"^3.0.4\",\n- \"fs-extra\": \"^7.0.1\",\n+ \"fs-extra\": \"^8.1.0\",\n\"gray-matter\": \"^4.0.2\",\n\"hamljs\": \"^0.6.2\",\n\"handlebars\": \"^4.1.2\",\n\"markdown-it\": \"^8.4.2\",\n\"minimist\": \"^1.2.0\",\n\"moo\": \"^0.5.0\",\n- \"multimatch\": \"^3.0.0\",\n+ \"multimatch\": \"^4.0.0\",\n\"mustache\": \"^2.3.0\",\n\"normalize-path\": \"^3.0.0\",\n\"nunjucks\": \"^3.2.0\",\n" } ]
JavaScript
MIT License
11ty/eleventy
Updating dependencies for 0.9.0
699
29.08.2019 21:09:44
18,000
47431cdbff5495b1eeb0a678d690cd8ff4061fe0
Fixes adds promise/async support for shortcodes in Nunjucks (they were already working in Liquid).
[ { "change_type": "MODIFY", "old_path": "src/Engines/Nunjucks.js", "new_path": "src/Engines/Nunjucks.js", "diff": "@@ -26,7 +26,12 @@ class Nunjucks extends TemplateEngine {\n// TODO these all go to the same place (addTag), add warnings for overwrites\nthis.addCustomTags(this.config.nunjucksTags);\nthis.addAllShortcodes(this.config.nunjucksShortcodes);\n+ this.addAllShortcodes(this.config.nunjucksAsyncShortcodes, true);\nthis.addAllPairedShortcodes(this.config.nunjucksPairedShortcodes);\n+ this.addAllPairedShortcodes(\n+ this.config.nunjucksAsyncPairedShortcodes,\n+ true\n+ );\n}\naddFilters(helpers, isAsync) {\n@@ -54,19 +59,19 @@ class Nunjucks extends TemplateEngine {\nthis.njkEnv.addExtension(name, tagObj);\n}\n- addAllShortcodes(shortcodes) {\n+ addAllShortcodes(shortcodes, isAsync = false) {\nfor (let name in shortcodes) {\n- this.addShortcode(name, shortcodes[name]);\n+ this.addShortcode(name, shortcodes[name], isAsync);\n}\n}\n- addAllPairedShortcodes(shortcodes) {\n+ addAllPairedShortcodes(shortcodes, isAsync = false) {\nfor (let name in shortcodes) {\n- this.addPairedShortcode(name, shortcodes[name]);\n+ this.addPairedShortcode(name, shortcodes[name], isAsync);\n}\n}\n- addShortcode(shortcodeName, shortcodeFn) {\n+ addShortcode(shortcodeName, shortcodeFn, isAsync = false) {\nfunction ShortcodeFunction() {\nthis.tags = [shortcodeName];\n@@ -85,23 +90,36 @@ class Nunjucks extends TemplateEngine {\nparser.advanceAfterBlockEnd(tok.value);\n- // return new nodes.CallExtensionAsync(this, \"run\", args);\n+ if (isAsync) {\n+ return new nodes.CallExtensionAsync(this, \"run\", args);\n+ } else {\nreturn new nodes.CallExtension(this, \"run\", args);\n+ }\n};\nthis.run = function(...args) {\n- // let callback = args.pop();\n+ let callback;\n+ if (isAsync) {\n+ callback = args.pop();\n+ }\n+\nlet [context, ...argArray] = args;\n- let ret = new NunjucksLib.runtime.SafeString(shortcodeFn(...argArray));\n- // callback(null, ret);\n- return ret;\n+ let fnReturnValue = shortcodeFn(...argArray);\n+\n+ if (isAsync && fnReturnValue.then) {\n+ fnReturnValue.then(function(returnValue) {\n+ callback(null, returnValue);\n+ });\n+ } else {\n+ return new NunjucksLib.runtime.SafeString(fnReturnValue);\n+ }\n};\n}\nthis.njkEnv.addExtension(shortcodeName, new ShortcodeFunction());\n}\n- addPairedShortcode(shortcodeName, shortcodeFn) {\n+ addPairedShortcode(shortcodeName, shortcodeFn, isAsync = false) {\nfunction PairedShortcodeFunction() {\nthis.tags = [shortcodeName];\n@@ -114,19 +132,28 @@ class Nunjucks extends TemplateEngine {\nvar body = parser.parseUntilBlocks(\"end\" + shortcodeName);\nparser.advanceAfterBlockEnd();\n- // return new nodes.CallExtensionAsync(this, \"run\", args, [body]);\n+ if (isAsync) {\n+ return new nodes.CallExtensionAsync(this, \"run\", args, [body]);\n+ }\nreturn new nodes.CallExtension(this, \"run\", args, [body]);\n};\nthis.run = function(...args) {\n- // let callback = args.pop();\n+ let callback;\n+ if (isAsync) {\n+ callback = args.pop();\n+ }\nlet body = args.pop();\nlet [context, ...argArray] = args;\n- let ret = new NunjucksLib.runtime.SafeString(\n- shortcodeFn(body(), ...argArray)\n- );\n- // callback(null, ret);\n- return ret;\n+ let fnReturnValue = shortcodeFn(body(), ...argArray);\n+\n+ if (isAsync && fnReturnValue.then) {\n+ fnReturnValue.then(function(returnValue) {\n+ callback(null, returnValue);\n+ });\n+ } else {\n+ return new NunjucksLib.runtime.SafeString(fnReturnValue);\n+ }\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -29,7 +29,9 @@ class UserConfig {\nthis.nunjucksAsyncFilters = {};\nthis.nunjucksTags = {};\nthis.nunjucksShortcodes = {};\n+ this.nunjucksAsyncShortcodes = {};\nthis.nunjucksPairedShortcodes = {};\n+ this.nunjucksAsyncPairedShortcodes = {};\nthis.handlebarsHelpers = {};\nthis.handlebarsShortcodes = {};\nthis.handlebarsPairedShortcodes = {};\n@@ -134,7 +136,7 @@ class UserConfig {\n}\n// Support the nunjucks style syntax for asynchronous filter add\n- addNunjucksFilter(name, callback, isAsync) {\n+ addNunjucksFilter(name, callback, isAsync = false) {\nif (isAsync) {\n// namespacing happens downstream\nthis.addNunjucksAsyncFilter(name, callback);\n@@ -344,7 +346,28 @@ class UserConfig {\nthis.addJavaScriptFunction(name, callback);\n}\n- addNunjucksShortcode(name, callback) {\n+ addNunjucksAsyncShortcode(name, callback) {\n+ name = this.getNamespacedName(name);\n+\n+ if (this.nunjucksAsyncShortcodes[name]) {\n+ debug(\n+ chalk.yellow(\n+ \"Warning, overwriting a Nunjucks Async Shortcode with `addNunjucksAsyncShortcode(%o)`\"\n+ ),\n+ name\n+ );\n+ }\n+\n+ this.nunjucksAsyncShortcodes[name] = bench.add(\n+ `\"${name}\" Nunjucks Async Shortcode`,\n+ callback\n+ );\n+ }\n+\n+ addNunjucksShortcode(name, callback, isAsync = false) {\n+ if (isAsync) {\n+ this.addNunjucksAsyncShortcode(name, callback);\n+ } else {\nname = this.getNamespacedName(name);\nif (this.nunjucksShortcodes[name]) {\n@@ -361,6 +384,7 @@ class UserConfig {\ncallback\n);\n}\n+ }\naddLiquidShortcode(name, callback) {\nname = this.getNamespacedName(name);\n@@ -405,7 +429,28 @@ class UserConfig {\nthis.addJavaScriptFunction(name, callback);\n}\n- addPairedNunjucksShortcode(name, callback) {\n+ addPairedNunjucksAsyncShortcode(name, callback) {\n+ name = this.getNamespacedName(name);\n+\n+ if (this.nunjucksAsyncPairedShortcodes[name]) {\n+ debug(\n+ chalk.yellow(\n+ \"Warning, overwriting a Nunjucks Async Paired Shortcode with `addPairedNunjucksAsyncShortcode(%o)`\"\n+ ),\n+ name\n+ );\n+ }\n+\n+ this.nunjucksAsyncPairedShortcodes[name] = bench.add(\n+ `\"${name}\" Nunjucks Async Paired Shortcode`,\n+ callback\n+ );\n+ }\n+\n+ addPairedNunjucksShortcode(name, callback, isAsync = false) {\n+ if (isAsync) {\n+ this.addPairedNunjucksAsyncShortcode(name, callback);\n+ } else {\nname = this.getNamespacedName(name);\nif (this.nunjucksPairedShortcodes[name]) {\n@@ -422,6 +467,7 @@ class UserConfig {\ncallback\n);\n}\n+ }\naddPairedLiquidShortcode(name, callback) {\nname = this.getNamespacedName(name);\n@@ -516,7 +562,9 @@ class UserConfig {\nnunjucksFilters: this.nunjucksFilters,\nnunjucksAsyncFilters: this.nunjucksAsyncFilters,\nnunjucksTags: this.nunjucksTags,\n+ nunjucksAsyncShortcodes: this.nunjucksAsyncShortcodes,\nnunjucksShortcodes: this.nunjucksShortcodes,\n+ nunjucksAsyncPairedShortcodes: this.nunjucksAsyncPairedShortcodes,\nnunjucksPairedShortcodes: this.nunjucksPairedShortcodes,\nhandlebarsHelpers: this.handlebarsHelpers,\nhandlebarsShortcodes: this.handlebarsShortcodes,\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderLiquidTest.js", "new_path": "test/TemplateRenderLiquidTest.js", "diff": "@@ -206,6 +206,22 @@ test(\"Liquid Shortcode\", async t => {\n);\n});\n+test(\"Liquid Async Shortcode\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\"postfixWithZach\", function(str) {\n+ return new Promise(function(resolve) {\n+ setTimeout(function() {\n+ resolve(str + \"Zach\");\n+ });\n+ });\n+ });\n+\n+ t.is(\n+ await tr.render(\"{% postfixWithZach name %}\", { name: \"test\" }),\n+ \"testZach\"\n+ );\n+});\n+\ntest(\"Liquid Shortcode Safe Output\", async t => {\nlet tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\ntr.engine.addShortcode(\"postfixWithZach\", function(str) {\n@@ -233,6 +249,25 @@ test(\"Liquid Paired Shortcode\", async t => {\n);\n});\n+test(\"Liquid Async Paired Shortcode\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addPairedShortcode(\"postfixWithZach\", function(content, str) {\n+ return new Promise(function(resolve) {\n+ setTimeout(function() {\n+ resolve(str + content + \"Zach\");\n+ });\n+ });\n+ });\n+\n+ t.is(\n+ await tr.render(\n+ \"{% postfixWithZach name %}Content{% endpostfixWithZach %}\",\n+ { name: \"test\" }\n+ ),\n+ \"testContentZach\"\n+ );\n+});\n+\ntest(\"Liquid Render Include Subfolder\", async t => {\nlet fn = await new TemplateRender(\n\"liquid\",\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "@@ -246,6 +246,26 @@ test(\"Nunjucks Shortcode\", async t => {\n);\n});\n+test(\"Nunjucks Async Shortcode\", async t => {\n+ let tr = new TemplateRender(\"njk\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\n+ \"postfixWithZach\",\n+ function(str) {\n+ return new Promise(function(resolve) {\n+ setTimeout(function() {\n+ resolve(str + \"Zach\");\n+ });\n+ });\n+ },\n+ true\n+ );\n+\n+ t.is(\n+ await tr.render(\"{% postfixWithZach name %}\", { name: \"test\" }),\n+ \"testZach\"\n+ );\n+});\n+\ntest(\"Nunjucks Shortcode Safe Output\", async t => {\nlet tr = new TemplateRender(\"njk\", \"./test/stubs/\");\ntr.engine.addShortcode(\"postfixWithZach\", function(str) {\n@@ -273,6 +293,29 @@ test(\"Nunjucks Paired Shortcode\", async t => {\n);\n});\n+test(\"Nunjucks Async Paired Shortcode\", async t => {\n+ let tr = new TemplateRender(\"njk\", \"./test/stubs/\");\n+ tr.engine.addPairedShortcode(\n+ \"postfixWithZach\",\n+ function(content, str) {\n+ return new Promise(function(resolve) {\n+ setTimeout(function() {\n+ resolve(str + content + \"Zach\");\n+ });\n+ });\n+ },\n+ true\n+ );\n+\n+ t.is(\n+ await tr.render(\n+ \"{% postfixWithZach name %}Content{% endpostfixWithZach %}\",\n+ { name: \"test\" }\n+ ),\n+ \"testContentZach\"\n+ );\n+});\n+\ntest(\"Nunjucks Paired Shortcode without args\", async t => {\nlet tr = new TemplateRender(\"njk\", \"./test/stubs/\");\ntr.engine.addPairedShortcode(\"postfixWithZach\", function(content) {\n" } ]
JavaScript
MIT License
11ty/eleventy
Fixes #429, adds promise/async support for shortcodes in Nunjucks (they were already working in Liquid).
699
29.08.2019 21:24:36
18,000
d27cbd10cc4726678930e1467f0a0355a35ea2f2
Also added a test to show that this works with JavaScript template functions too.
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderJavaScriptTest.js", "new_path": "test/TemplateRenderJavaScriptTest.js", "diff": "@@ -174,6 +174,23 @@ test(\"JS Render with a function\", async t => {\nt.is(await fn({ name: \"Bill\" }), \"<p>BILLT9000</p>\");\n});\n+test(\"JS Render with a function and async filter\", async t => {\n+ let tr = new TemplateRender(\"./test/stubs/function-async-filter.11ty.js\");\n+ tr.config = {\n+ javascriptFunctions: {\n+ upper: function(val) {\n+ return new Promise(function(resolve) {\n+ resolve(new String(val).toUpperCase());\n+ });\n+ }\n+ }\n+ };\n+\n+ let fn = await tr.getCompiledTemplate();\n+ t.is(await fn({ name: \"Zach\" }), \"<p>ZACH</p>\");\n+ t.is(await fn({ name: \"Bill\" }), \"<p>BILL</p>\");\n+});\n+\ntest(\"JS Render with a function prototype\", async t => {\nlet tr = new TemplateRender(\"./test/stubs/function-prototype.11ty.js\");\ntr.config = {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/function-async-filter.11ty.js", "diff": "+module.exports = async function({ name }) {\n+ return `<p>${await this.upper(name)}</p>`;\n+};\n" } ]
JavaScript
MIT License
11ty/eleventy
Also added a test to show that this works with JavaScript template functions too. #429
699
29.08.2019 21:59:58
18,000
a3c0b8906676c22a9312d8cdcca49f576587c269
Oops needed safe string here
[ { "change_type": "MODIFY", "old_path": "src/Engines/Nunjucks.js", "new_path": "src/Engines/Nunjucks.js", "diff": "@@ -108,7 +108,7 @@ class Nunjucks extends TemplateEngine {\nif (isAsync && fnReturnValue.then) {\nfnReturnValue.then(function(returnValue) {\n- callback(null, returnValue);\n+ callback(null, new NunjucksLib.runtime.SafeString(returnValue));\n});\n} else {\nreturn new NunjucksLib.runtime.SafeString(fnReturnValue);\n@@ -149,7 +149,7 @@ class Nunjucks extends TemplateEngine {\nif (isAsync && fnReturnValue.then) {\nfnReturnValue.then(function(returnValue) {\n- callback(null, returnValue);\n+ callback(null, new NunjucksLib.runtime.SafeString(returnValue));\n});\n} else {\nreturn new NunjucksLib.runtime.SafeString(fnReturnValue);\n" }, { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -346,6 +346,14 @@ class UserConfig {\nthis.addJavaScriptFunction(name, callback);\n}\n+ addAsyncShortcode(name, callback) {\n+ debug(\"Adding universal async shortcode %o\", this.getNamespacedName(name));\n+ this.addNunjucksAsyncShortcode(name, callback);\n+ this.addLiquidShortcode(name, callback);\n+ // this.addHandlebarsShortcode(name, callback); // not supported in Handlebars\n+ this.addJavaScriptFunction(name, callback);\n+ }\n+\naddNunjucksAsyncShortcode(name, callback) {\nname = this.getNamespacedName(name);\n@@ -429,6 +437,14 @@ class UserConfig {\nthis.addJavaScriptFunction(name, callback);\n}\n+ addPairedAsyncShortcode(name, callback) {\n+ debug(\"Adding universal async shortcode %o\", this.getNamespacedName(name));\n+ this.addPairedNunjucksAsyncShortcode(name, callback);\n+ this.addPairedLiquidShortcode(name, callback);\n+ // this.addPairedHandlebarsShortcode(name, callback); // not supported in Handlebars\n+ this.addJavaScriptFunction(name, callback);\n+ }\n+\naddPairedNunjucksAsyncShortcode(name, callback) {\nname = this.getNamespacedName(name);\n" } ]
JavaScript
MIT License
11ty/eleventy
Oops needed safe string here #429
699
30.08.2019 08:31:13
18,000
b58f9960094fc5a565a12f5e814f6dd53d7c95da
More tests to verify stuff from docs for
[ { "change_type": "MODIFY", "old_path": "src/UserConfig.js", "new_path": "src/UserConfig.js", "diff": "@@ -346,14 +346,6 @@ class UserConfig {\nthis.addJavaScriptFunction(name, callback);\n}\n- addAsyncShortcode(name, callback) {\n- debug(\"Adding universal async shortcode %o\", this.getNamespacedName(name));\n- this.addNunjucksAsyncShortcode(name, callback);\n- this.addLiquidShortcode(name, callback);\n- // this.addHandlebarsShortcode(name, callback); // not supported in Handlebars\n- this.addJavaScriptFunction(name, callback);\n- }\n-\naddNunjucksAsyncShortcode(name, callback) {\nname = this.getNamespacedName(name);\n@@ -437,14 +429,6 @@ class UserConfig {\nthis.addJavaScriptFunction(name, callback);\n}\n- addPairedAsyncShortcode(name, callback) {\n- debug(\"Adding universal async shortcode %o\", this.getNamespacedName(name));\n- this.addPairedNunjucksAsyncShortcode(name, callback);\n- this.addPairedLiquidShortcode(name, callback);\n- // this.addPairedHandlebarsShortcode(name, callback); // not supported in Handlebars\n- this.addJavaScriptFunction(name, callback);\n- }\n-\naddPairedNunjucksAsyncShortcode(name, callback) {\nname = this.getNamespacedName(name);\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderLiquidTest.js", "new_path": "test/TemplateRenderLiquidTest.js", "diff": "import test from \"ava\";\nimport TemplateRender from \"../src/TemplateRender\";\n+async function getPromise(resolveTo) {\n+ return new Promise(function(resolve) {\n+ setTimeout(function() {\n+ resolve(resolveTo);\n+ });\n+ });\n+}\n+\n// Liquid\ntest(\"Liquid\", t => {\nt.is(new TemplateRender(\"liquid\").getEngineName(), \"liquid\");\n@@ -206,7 +214,7 @@ test(\"Liquid Shortcode\", async t => {\n);\n});\n-test(\"Liquid Async Shortcode\", async t => {\n+test(\"Liquid Shortcode returns promise\", async t => {\nlet tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\ntr.engine.addShortcode(\"postfixWithZach\", function(str) {\nreturn new Promise(function(resolve) {\n@@ -222,6 +230,30 @@ test(\"Liquid Async Shortcode\", async t => {\n);\n});\n+test(\"Liquid Shortcode returns promise (await inside)\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\"postfixWithZach\", async function(str) {\n+ return await getPromise(str + \"Zach\");\n+ });\n+\n+ t.is(\n+ await tr.render(\"{% postfixWithZach name %}\", { name: \"test\" }),\n+ \"testZach\"\n+ );\n+});\n+\n+test(\"Liquid Shortcode returns promise (no await inside)\", async t => {\n+ let tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\"postfixWithZach\", async function(str) {\n+ return getPromise(str + \"Zach\");\n+ });\n+\n+ t.is(\n+ await tr.render(\"{% postfixWithZach name %}\", { name: \"test\" }),\n+ \"testZach\"\n+ );\n+});\n+\ntest(\"Liquid Shortcode Safe Output\", async t => {\nlet tr = new TemplateRender(\"liquid\", \"./test/stubs/\");\ntr.engine.addShortcode(\"postfixWithZach\", function(str) {\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateRenderNunjucksTest.js", "new_path": "test/TemplateRenderNunjucksTest.js", "diff": "import test from \"ava\";\nimport TemplateRender from \"../src/TemplateRender\";\n+async function getPromise(resolveTo) {\n+ return new Promise(function(resolve) {\n+ setTimeout(function() {\n+ resolve(resolveTo);\n+ });\n+ });\n+}\n+\n// Nunjucks\ntest(\"Nunjucks\", t => {\nt.is(new TemplateRender(\"njk\").getEngineName(), \"njk\");\n@@ -266,6 +274,22 @@ test(\"Nunjucks Async Shortcode\", async t => {\n);\n});\n+test(\"Nunjucks Async function Shortcode\", async t => {\n+ let tr = new TemplateRender(\"njk\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\n+ \"postfixWithZach\",\n+ async function(str) {\n+ return await getPromise(str + \"Zach\");\n+ },\n+ true\n+ );\n+\n+ t.is(\n+ await tr.render(\"{% postfixWithZach name %}\", { name: \"test\" }),\n+ \"testZach\"\n+ );\n+});\n+\ntest(\"Nunjucks Shortcode Safe Output\", async t => {\nlet tr = new TemplateRender(\"njk\", \"./test/stubs/\");\ntr.engine.addShortcode(\"postfixWithZach\", function(str) {\n@@ -373,6 +397,20 @@ test(\"Nunjucks Shortcode Multiple Args\", async t => {\n);\n});\n+test(\"Nunjucks Shortcode Multiple Args (Comma is not optional)\", async t => {\n+ let tr = new TemplateRender(\"njk\", \"./test/stubs/\");\n+ tr.engine.addShortcode(\"postfixWithZach\", function(str, str2) {\n+ return str + str2 + \"Zach\";\n+ });\n+\n+ await t.throwsAsync(async () => {\n+ await tr.render(\"{% postfixWithZach name other %}\", {\n+ name: \"test\",\n+ other: \"howdy\"\n+ });\n+ });\n+});\n+\ntest(\"Nunjucks Shortcode Named Args\", async t => {\nlet tr = new TemplateRender(\"njk\", \"./test/stubs/\");\ntr.engine.addShortcode(\"postfixWithZach\", function(arg) {\n" } ]
JavaScript
MIT License
11ty/eleventy
More tests to verify stuff from docs for #429 #672
732
05.09.2019 19:39:19
-7,200
002e49bca857aecbddcb87a45680a2d28c081a9a
Fix require cache cleanup on Windows
[ { "change_type": "MODIFY", "old_path": "src/Eleventy.js", "new_path": "src/Eleventy.js", "diff": "@@ -11,6 +11,7 @@ const simplePlural = require(\"./Util/Pluralize\");\nconst config = require(\"./Config\");\nconst bench = require(\"./BenchmarkManager\");\nconst debug = require(\"debug\")(\"Eleventy\");\n+const deleteRequireCache = require(\"./Util/DeleteRequireCache\");\n/**\n* @module @11ty/eleventy/Eleventy\n@@ -171,7 +172,7 @@ class Eleventy {\n// reload package.json values (if applicable)\n// TODO only reset this if it changed\n- delete require.cache[TemplatePath.absolutePath(\"package.json\")];\n+ deleteRequireCache(TemplatePath.absolutePath(\"package.json\"));\nawait this.init();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyWatchTargets.js", "new_path": "src/EleventyWatchTargets.js", "diff": "const dependencyTree = require(\"dependency-tree\");\nconst TemplatePath = require(\"./TemplatePath\");\n+const deleteRequireCache = require(\"./Util/DeleteRequireCache\");\nclass EleventyWatchTargets {\nconstructor() {\n@@ -109,7 +110,7 @@ class EleventyWatchTargets {\nclearDependencyRequireCache() {\nfor (let path of this.dependencies) {\n- delete require.cache[TemplatePath.absolutePath(path)];\n+ deleteRequireCache(TemplatePath.absolutePath(path));\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Engines/JavaScript.js", "new_path": "src/Engines/JavaScript.js", "diff": "const TemplateEngine = require(\"./TemplateEngine\");\nconst TemplatePath = require(\"../TemplatePath\");\nconst EleventyBaseError = require(\"../EleventyBaseError\");\n+const deleteRequireCache = require(\"../Util/DeleteRequireCache\");\nclass JavaScriptTemplateInvalidDataFormatError extends EleventyBaseError {}\n@@ -72,8 +73,8 @@ class JavaScript extends TemplateEngine {\n// only remove from cache once on startup (if it already exists)\ninitRequireCache(inputPath) {\nlet requirePath = TemplatePath.absolutePath(inputPath);\n- if (requirePath in require.cache) {\n- delete require.cache[requirePath];\n+ if (requirePath) {\n+ deleteRequireCache(requirePath);\n}\nif (inputPath in this.instances) {\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateConfig.js", "new_path": "src/TemplateConfig.js", "diff": "@@ -5,6 +5,7 @@ const TemplatePath = require(\"./TemplatePath\");\nconst EleventyBaseError = require(\"./EleventyBaseError\");\nconst eleventyConfig = require(\"./EleventyConfig\");\nconst debug = require(\"debug\")(\"Eleventy:TemplateConfig\");\n+const deleteRequireCache = require(\"./Util/DeleteRequireCache\");\nclass EleventyConfigError extends EleventyBaseError {}\n@@ -76,7 +77,7 @@ class TemplateConfig {\ntry {\n// remove from require cache so it will grab a fresh copy\nif (path in require.cache) {\n- delete require.cache[path];\n+ deleteRequireCache(path);\n}\nlocalConfig = require(path);\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateData.js", "new_path": "src/TemplateData.js", "diff": "@@ -14,6 +14,7 @@ const config = require(\"./Config\");\nconst debugWarn = require(\"debug\")(\"Eleventy:Warnings\");\nconst debug = require(\"debug\")(\"Eleventy:TemplateData\");\nconst debugDev = require(\"debug\")(\"Dev:Eleventy:TemplateData\");\n+const deleteRequireCache = require(\"./Util/DeleteRequireCache\");\nclass TemplateDataParseError extends EleventyBaseError {}\n@@ -233,7 +234,7 @@ class TemplateData {\nif (await fs.pathExists(localPath)) {\nlet dataBench = bench.get(`\\`${path}\\``);\ndataBench.before();\n- delete require.cache[localPath];\n+ deleteRequireCache(localPath);\nlet returnValue = require(localPath);\nif (typeof returnValue === \"function\") {\nreturnValue = await returnValue();\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Util/DeleteRequireCache.js", "diff": "+const path = require(\"path\");\n+\n+/**\n+ * Removes a nodejs module from the cache.\n+ * The keys of the nodejs require cache are file paths based on the current operating system.\n+ * @param {string} absoluteModulePath An absolute POSIX path to the module.\n+ */\n+module.exports = function deleteRequireCache(absoluteModulePath) {\n+ const normalizedPath = path.normalize(absoluteModulePath);\n+ delete require.cache[normalizedPath];\n+};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/DeleteRequireCacheTest.js", "diff": "+import test from \"ava\";\n+import path from \"path\";\n+import deleteRequireCache from \"../src/Util/DeleteRequireCache\";\n+import template from \"./stubs/function.11ty\";\n+\n+test(\"deleteRequireCache\", t => {\n+ const modulePath = path.normalize(\n+ path.join(__dirname, \"./stubs/function.11ty.js\")\n+ );\n+ const posixModulePath = useForwardSlashes(modulePath);\n+ const windowsModulePath = useBackwardSlashes(modulePath);\n+\n+ deleteRequireCache(posixModulePath);\n+\n+ t.is(require.cache[windowsModulePath], undefined);\n+});\n+\n+/**\n+ * @param {string} path\n+ * @returns {string}\n+ */\n+function useForwardSlashes(path) {\n+ return path.replace(/\\\\/g, \"/\");\n+}\n+\n+/**\n+ * @param {string} path\n+ * @returns {string}\n+ */\n+function useBackwardSlashes(path) {\n+ return path.replace(/\\//g, \"\\\\\");\n+}\n" } ]
JavaScript
MIT License
11ty/eleventy
Fix require cache cleanup on Windows (#596)
732
07.09.2019 14:57:55
-7,200
cd039af83eabeb55549991772b4dc40f15632ee6
Ignore IDEA settings folders
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "-_site/\n+# Ignore installed npm modules\nnode_modules/\n+\n+# Ignore build tool output, e.g. code coverage\n.nyc_output/\ncoverage/\n-package-lock.json\n+\n+# Ignore API documentation\napi-docs/\n+\n+# Ignore folders from source code editors\n+.vscode\n+.idea\n+\n+# Ignore eleventy output when doing manuell tests\n+_site/\n+\n+package-lock.json\n" } ]
JavaScript
MIT License
11ty/eleventy
Ignore IDEA settings folders
699
18.09.2019 17:43:55
18,000
f7fb0858ec4831cfe87e1da4de2cbdbad24121fc
Make --incremental work with passthrough copy
[ { "change_type": "MODIFY", "old_path": "src/Eleventy.js", "new_path": "src/Eleventy.js", "diff": "@@ -406,6 +406,8 @@ Arguments:\nlet isInclude =\npath &&\nTemplatePath.startsWithSubPath(path, this.eleventyFiles.getIncludesDir());\n+ let isJavaScriptDependency =\n+ path && this.watchTargets.isJavaScriptDependency(path);\nlet localProjectConfigPath = config.getLocalProjectConfigFile();\n// reset and reload global configuration :O\n@@ -417,7 +419,7 @@ Arguments:\nawait this.restart();\nthis.watchTargets.clearDependencyRequireCache();\n- if (path && !isInclude && this.isIncremental) {\n+ if (path && !isInclude && !isJavaScriptDependency && this.isIncremental) {\nthis.writer.setIncrementalFile(path);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/EleventyWatchTargets.js", "new_path": "src/EleventyWatchTargets.js", "diff": "@@ -18,6 +18,10 @@ class EleventyWatchTargets {\nreturn this._watchJavaScriptDependencies;\n}\n+ isJavaScriptDependency(path) {\n+ return this.dependencies.has(path);\n+ }\n+\n_normalizeTargets(targets) {\nif (!targets) {\nreturn [];\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -15,6 +15,7 @@ class TemplatePassthroughManager {\nreset() {\nthis.count = 0;\n+ this.incrementalFile = null;\ndebug(\"Resetting counts to 0\");\n}\n@@ -34,6 +35,10 @@ class TemplatePassthroughManager {\nthis.isDryRun = !!isDryRun;\n}\n+ setIncrementalFile(path) {\n+ this.incrementalFile = path;\n+ }\n+\n_normalizePaths(path, outputPath) {\nreturn {\ninputPath: TemplatePath.addLeadingDotSlash(path),\n@@ -87,16 +92,21 @@ class TemplatePassthroughManager {\nasync copyPath(path) {\nlet pass = new TemplatePassthrough(path, this.outputDir, this.inputDir);\n+\n+ if (this.incrementalFile && path.inputPath !== this.incrementalFile) {\n+ pass.setDryRun(true);\n+ } else {\npass.setDryRun(this.isDryRun);\n+ }\nreturn pass\n.write()\n- .then(\n- function() {\n+ .then(() => {\n+ if (!pass.isDryRun) {\nthis.count++;\ndebug(\"Copied %o\", path.inputPath);\n- }.bind(this)\n- )\n+ }\n+ })\n.catch(function(e) {\nreturn Promise.reject(\nnew TemplatePassthroughManagerCopyError(\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateWriter.js", "new_path": "src/TemplateWriter.js", "diff": "@@ -151,14 +151,17 @@ TemplateWriter.prototype.write = async function() {\nlet promises = [];\nlet paths = await this._getAllPaths();\ndebug(\"Found: %o\", paths);\n+\n+ let passthroughManager = this.getFileManager().getPassthroughManager();\n+ passthroughManager.setIncrementalFile(\n+ this.incrementalFile ? this.incrementalFile : false\n+ );\n+\npromises.push(\n- this.getFileManager()\n- .getPassthroughManager()\n- .copyAll(paths)\n- .catch(e => {\n+ passthroughManager.copyAll(paths).catch(e => {\nEleventyErrorHandler.warn(e, \"Error with passthrough copy\");\nreturn Promise.reject(\n- new TemplateWriterWriteError(`Having trouble copying`, e)\n+ new TemplateWriterWriteError(\"Having trouble copying\", e)\n);\n})\n);\n" } ]
JavaScript
MIT License
11ty/eleventy
Make --incremental work with passthrough copy #108
699
20.09.2019 08:29:30
18,000
8bd052a9eddded118f7de52e7235951315f4c606
Installation missing from GitHub readme
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -17,6 +17,14 @@ Works with HTML, Markdown, Liquid, Nunjucks, Handlebars, Mustache, EJS, Haml, Pu\n[![npm Version](https://img.shields.io/npm/v/@11ty/eleventy.svg?style=for-the-badge)](https://www.npmjs.com/package/@11ty/eleventy) [![GitHub issues](https://img.shields.io/github/issues/11ty/eleventy.svg?style=for-the-badge)](https://github.com/11ty/eleventy/issues) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier) [![npm Downloads](https://img.shields.io/npm/dt/@11ty/eleventy.svg?style=for-the-badge)](https://www.npmjs.com/package/@11ty/eleventy)\n+## Installation\n+\n+```\n+npm install @11ty/eleventy --save-dev\n+```\n+\n+Read our [Getting Started guide](https://www.11ty.io/docs/getting-started/).\n+\n## Tests\n```\n" } ]
JavaScript
MIT License
11ty/eleventy
Installation missing from GitHub readme
699
20.09.2019 08:43:33
18,000
844b3620b0ecfcd8bbf516b22cbfc340cef7ad10
Better counts for incremental and dryrun
[ { "change_type": "MODIFY", "old_path": "src/Eleventy.js", "new_path": "src/Eleventy.js", "diff": "@@ -215,19 +215,23 @@ class Eleventy {\nlet ret = [];\nlet writeCount = this.writer.getWriteCount();\n- let pretendWriteCount = this.writer.getPretendWriteCount();\n+ let skippedCount = this.writer.getSkippedCount();\n+\nlet copyCount = this.writer.getCopyCount();\n- if (!this.isDryRun && copyCount) {\n+ let skippedCopyCount = this.writer.getSkippedCopyCount();\n+\n+ if (copyCount) {\nret.push(\n- `Copied ${copyCount} ${simplePlural(copyCount, \"item\", \"items\")} /`\n+ `Copied ${copyCount} ${simplePlural(copyCount, \"item\", \"items\")}${\n+ skippedCopyCount ? ` (skipped ${skippedCopyCount})` : \"\"\n+ } /`\n);\n}\n- if (pretendWriteCount) {\n- ret.push(`Processed ${writeCount + pretendWriteCount},`);\n- }\nret.push(\n- `Wrote ${writeCount} ${simplePlural(writeCount, \"file\", \"files\")}`\n+ `Wrote ${writeCount} ${simplePlural(writeCount, \"file\", \"files\")}${\n+ skippedCount ? ` (skipped ${skippedCount})` : \"\"\n+ }`\n);\nlet time = ((new Date() - this.start) / 1000).toFixed(2);\n" }, { "change_type": "MODIFY", "old_path": "src/TemplatePassthroughManager.js", "new_path": "src/TemplatePassthroughManager.js", "diff": "@@ -15,6 +15,7 @@ class TemplatePassthroughManager {\nreset() {\nthis.count = 0;\n+ this.skippedCount = 0;\nthis.incrementalFile = null;\ndebug(\"Resetting counts to 0\");\n}\n@@ -90,6 +91,10 @@ class TemplatePassthroughManager {\nreturn this.count;\n}\n+ getSkippedCount() {\n+ return this.skippedCount;\n+ }\n+\nasync copyPath(path) {\nlet pass = new TemplatePassthrough(path, this.outputDir, this.inputDir);\n@@ -102,7 +107,13 @@ class TemplatePassthroughManager {\nreturn pass\n.write()\n.then(() => {\n- if (!pass.isDryRun) {\n+ if (pass.isDryRun) {\n+ this.skippedCount++;\n+ debug(\n+ \"Skipped %o (either from --dryrun or --incremental)\",\n+ path.inputPath\n+ );\n+ } else {\nthis.count++;\ndebug(\"Copied %o\", path.inputPath);\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Better counts for incremental and dryrun
688
23.09.2019 20:16:31
-10,800
5a75821ca5d6d1468bbb5471b11010497562adc7
Resolves and by checking for negative patterns in and not including and not processing them as files to ignore. This allows you to use the negative pattern (!filename) in your .gitignore and .eleventyignore files without eleventy skipping over everything and not processing your files.
[ { "change_type": "MODIFY", "old_path": "src/EleventyFiles.js", "new_path": "src/EleventyFiles.js", "diff": "@@ -183,7 +183,9 @@ class EleventyFiles {\n})\n.filter(line => {\n// empty lines or comments get filtered out\n- return line.length > 0 && line.charAt(0) !== \"#\";\n+ return (\n+ line.length > 0 && line.charAt(0) !== \"#\" && line.charAt(0) !== \"!\"\n+ );\n})\n.map(line => {\nlet path = TemplateGlob.normalizePath(dir, \"/\", line);\n" } ]
JavaScript
MIT License
11ty/eleventy
Resolves #693 and #677 by checking for negative patterns in and not including and not processing them as files to ignore. This allows you to use the negative pattern (!filename) in your .gitignore and .eleventyignore files without eleventy skipping over everything and not processing your files.
703
26.09.2019 12:21:07
-7,200
20292cde6ad9f01802020d95b1280519330d0055
Added getFilteredByTags method and tests
[ { "change_type": "MODIFY", "old_path": "src/TemplateCollection.js", "new_path": "src/TemplateCollection.js", "diff": "@@ -50,19 +50,30 @@ class TemplateCollection extends Sortable {\n}\ngetFilteredByTag(tagName) {\n- return this.getAllSorted().filter(function(item) {\n- let match = false;\n+ return this.getAllSorted().filter(item => {\nif (!tagName) {\nreturn true;\n} else if (Array.isArray(item.data.tags)) {\n- item.data.tags.forEach(tag => {\n- if (tag === tagName) {\n- match = true;\n+ return item.data.tags.some(tag => tag === tagName);\n}\n+ return false;\n});\n}\n- return match;\n- });\n+\n+ getFilteredByTags(tags) {\n+ if (!Array.isArray(tags)) {\n+ return this.getFilteredByTag(tags);\n+ }\n+ return this.getAllSorted().filter(item =>\n+ tags.every(requiredTag => {\n+ const itemTags = item.data.tags;\n+ if (Array.isArray(itemTags)) {\n+ return itemTags.includes(requiredTag);\n+ } else {\n+ return itemTags === requiredTag;\n+ }\n+ })\n+ );\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateCollectionTest.js", "new_path": "test/TemplateCollectionTest.js", "diff": "@@ -76,6 +76,7 @@ test(\"getFilteredByTag\", async t => {\nlet cats = c.getFilteredByTag(\"cat\");\nt.is(cats.length, 2);\nt.deepEqual(cats[0].template, tmpl2);\n+ t.deepEqual(cats[1].template, tmpl3);\nlet dogs = c.getFilteredByTag(\"dog\");\nt.is(dogs.length, 1);\n@@ -97,12 +98,56 @@ test(\"getFilteredByTag (added out of order, sorted)\", async t => {\nt.truthy(cats.length);\nt.is(cats.length, 2);\nt.deepEqual(cats[0].template, tmpl2);\n+ t.deepEqual(cats[1].template, tmpl3);\nlet dogs = c.getFilteredByTag(\"dog\");\nt.truthy(dogs.length);\nt.deepEqual(dogs[0].template, tmpl1);\n});\n+test(\"getFilteredByTags\", async t => {\n+ let c = new Collection();\n+ await c._testAddTemplate(tmpl1);\n+ await c._testAddTemplate(tmpl2);\n+ await c._testAddTemplate(tmpl3);\n+\n+ let postsAndCats = c.getFilteredByTags([\"post\", \"cat\"]);\n+ t.is(postsAndCats.length, 1);\n+ t.deepEqual(postsAndCats[0].template, tmpl3);\n+\n+ let cats = c.getFilteredByTags([\"cat\"]);\n+ t.is(cats.length, 2);\n+ t.deepEqual(cats[0].template, tmpl2);\n+ t.deepEqual(cats[1].template, tmpl3);\n+\n+ let dogs = c.getFilteredByTags(\"dog\");\n+ t.is(dogs.length, 1);\n+ t.deepEqual(dogs[0].template, tmpl1);\n+});\n+\n+test(\"getFilteredByTags (added out of order, sorted)\", async t => {\n+ let c = new Collection();\n+ await c._testAddTemplate(tmpl3);\n+ await c._testAddTemplate(tmpl2);\n+ await c._testAddTemplate(tmpl1);\n+\n+ let postsAndCats = c.getFilteredByTags([\"post\", \"cat\"]);\n+ t.truthy(postsAndCats.length);\n+ t.is(postsAndCats.length, 1);\n+ t.deepEqual(postsAndCats[0].template, tmpl3);\n+\n+ let cats = c.getFilteredByTags([\"cat\"]);\n+ t.truthy(cats.length);\n+ t.is(cats.length, 2);\n+ t.deepEqual(cats[0].template, tmpl2);\n+ t.deepEqual(cats[1].template, tmpl3);\n+\n+ let dogs = c.getFilteredByTags(\"dog\");\n+ t.truthy(dogs.length);\n+ t.is(dogs.length, 1);\n+ t.deepEqual(dogs[0].template, tmpl1);\n+});\n+\ntest(\"getFilteredByGlob\", async t => {\nlet c = new Collection();\nawait c._testAddTemplate(tmpl1);\n" } ]
JavaScript
MIT License
11ty/eleventy
Added getFilteredByTags method and tests
703
26.09.2019 13:18:37
-7,200
3da2f8644393b153c6c32a408886748638dcf3cd
Switched to rest parameters
[ { "change_type": "MODIFY", "old_path": "src/TemplateCollection.js", "new_path": "src/TemplateCollection.js", "diff": "@@ -60,10 +60,7 @@ class TemplateCollection extends Sortable {\n});\n}\n- getFilteredByTags(tags) {\n- if (!Array.isArray(tags)) {\n- return this.getFilteredByTag(tags);\n- }\n+ getFilteredByTags(...tags) {\nreturn this.getAllSorted().filter(item =>\ntags.every(requiredTag => {\nconst itemTags = item.data.tags;\n" }, { "change_type": "MODIFY", "old_path": "test/TemplateCollectionTest.js", "new_path": "test/TemplateCollectionTest.js", "diff": "@@ -111,11 +111,11 @@ test(\"getFilteredByTags\", async t => {\nawait c._testAddTemplate(tmpl2);\nawait c._testAddTemplate(tmpl3);\n- let postsAndCats = c.getFilteredByTags([\"post\", \"cat\"]);\n+ let postsAndCats = c.getFilteredByTags(\"post\", \"cat\");\nt.is(postsAndCats.length, 1);\nt.deepEqual(postsAndCats[0].template, tmpl3);\n- let cats = c.getFilteredByTags([\"cat\"]);\n+ let cats = c.getFilteredByTags(\"cat\");\nt.is(cats.length, 2);\nt.deepEqual(cats[0].template, tmpl2);\nt.deepEqual(cats[1].template, tmpl3);\n@@ -131,12 +131,12 @@ test(\"getFilteredByTags (added out of order, sorted)\", async t => {\nawait c._testAddTemplate(tmpl2);\nawait c._testAddTemplate(tmpl1);\n- let postsAndCats = c.getFilteredByTags([\"post\", \"cat\"]);\n+ let postsAndCats = c.getFilteredByTags(\"post\", \"cat\");\nt.truthy(postsAndCats.length);\nt.is(postsAndCats.length, 1);\nt.deepEqual(postsAndCats[0].template, tmpl3);\n- let cats = c.getFilteredByTags([\"cat\"]);\n+ let cats = c.getFilteredByTags(\"cat\");\nt.truthy(cats.length);\nt.is(cats.length, 2);\nt.deepEqual(cats[0].template, tmpl2);\n" } ]
JavaScript
MIT License
11ty/eleventy
Switched to rest parameters
660
03.10.2019 12:27:05
-7,200
a3b594aca1ed2058035df461557bbd2f933b28eb
Add JSDoc Comments for Config and TemplateConfig. Adjust references
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"scripts\": {\n\"default\": \"npm run test\",\n- \"doc\": \"jsdoc -c .jsdoc.conf.json -d ./api-docs -p ./package.json -R README.md -t ./node_modules/ink-docstrap/template -r src/*.js\",\n+ \"doc\": \"jsdoc -c .jsdoc.conf.json -d ./api-docs -p ./package.json -R README.md -t ./node_modules/ink-docstrap/template -r src/\",\n\"test\": \"npx ava --verbose\",\n\"lint-staged\": \"lint-staged\",\n\"coverage\": \"npx nyc ava && npx nyc report --reporter=json-summary && cp coverage/coverage-summary.json docs-src/_data/coverage.json && node cmd.js --config=docs-src/.eleventy.docs.js\"\n" }, { "change_type": "MODIFY", "old_path": "src/Config.js", "new_path": "src/Config.js", "diff": "const TemplateConfig = require(\"./TemplateConfig\");\nconst debug = require(\"debug\")(\"Eleventy:Config\");\n+/**\n+ * @module 11ty/eleventy/Config\n+ */\n+\ndebug(\"Setting up global TemplateConfig.\");\n+/**\n+ * Provides global TemplateConfig.\n+ * @type {module:11ty/eleventy/TemplateConfig~TemplateConfig}\n+ */\nlet config = new TemplateConfig();\nmodule.exports = config;\n" }, { "change_type": "MODIFY", "old_path": "src/Eleventy.js", "new_path": "src/Eleventy.js", "diff": "@@ -14,7 +14,7 @@ const debug = require(\"debug\")(\"Eleventy\");\nconst deleteRequireCache = require(\"./Util/DeleteRequireCache\");\n/**\n- * @module @11ty/eleventy/Eleventy\n+ * @module 11ty/eleventy/Eleventy\n*/\n/**\n@@ -22,11 +22,11 @@ const deleteRequireCache = require(\"./Util/DeleteRequireCache\");\n*\n* @param {String} input - Where to read files from.\n* @param {String} output - Where to write rendered files to.\n- * @returns {undefined}\n+ * @returns {module:11ty/eleventy/Eleventy~Eleventy}\n*/\nclass Eleventy {\nconstructor(input, output) {\n- /** @member {Object} - tbd. */\n+ /** @member {module:11ty/eleventy/TemplateConfig~TemplateConfig~config} - TemplateConfig instance */\nthis.config = config.getConfig();\n/**\n" }, { "change_type": "MODIFY", "old_path": "src/TemplateConfig.js", "new_path": "src/TemplateConfig.js", "diff": "@@ -7,53 +7,124 @@ const eleventyConfig = require(\"./EleventyConfig\");\nconst debug = require(\"debug\")(\"Eleventy:TemplateConfig\");\nconst deleteRequireCache = require(\"./Util/DeleteRequireCache\");\n+/**\n+ * @module 11ty/eleventy/TemplateConfig\n+ */\n+\n+/**\n+ * Config as used by the template.\n+ * @typedef {Object} module:11ty/eleventy/TemplateConfig~TemplateConfig~config\n+ * @property {String=} pathPrefix - The path prefix.\n+ */\n+\n+/**\n+ * Object holding override information for the template config.\n+ * @typedef {Object} module:11ty/eleventy/TemplateConfig~TemplateConfig~override\n+ * @property {String=} pathPrefix - The path prefix.\n+ */\n+\n+/**\n+ * Errors in eleventy config.\n+ */\nclass EleventyConfigError extends EleventyBaseError {}\n+/**\n+ * Config for a template.\n+ *\n+ * @param {{}} customRootConfig - tbd.\n+ * @param {String} localProjectConfigPath - Path to local project config.\n+ */\nclass TemplateConfig {\nconstructor(customRootConfig, localProjectConfigPath) {\n+ /** @member {module:11ty/eleventy/TemplateConfig~TemplateConfig~override} - tbd. */\nthis.overrides = {};\n+\n+ /**\n+ * @member {String} - Path to local project config.\n+ * @default .eleventy.js\n+ */\nthis.localProjectConfigPath = localProjectConfigPath || \".eleventy.js\";\nif (customRootConfig) {\n+ /**\n+ * @member {?{}} - Custom root config.\n+ */\nthis.customRootConfig = customRootConfig;\ndebug(\"Warning: Using custom root config!\");\n} else {\nthis.customRootConfig = null;\n}\n+\nthis.initializeRootConfig();\n+\n+ /**\n+ * @member {module:11ty/eleventy/TemplateConfig~TemplateConfig~config} - tbd.\n+ */\nthis.config = this.mergeConfig(this.localProjectConfigPath);\n}\n+ /**\n+ * Normalises local project config file path.\n+ *\n+ * @method\n+ * @returns {String} - The normalised local project config file path.\n+ */\ngetLocalProjectConfigFile() {\nreturn TemplatePath.addLeadingDotSlash(this.localProjectConfigPath);\n}\n+ /**\n+ * Resets the configuration.\n+ */\nreset() {\neleventyConfig.reset();\nthis.initializeRootConfig();\nthis.config = this.mergeConfig(this.localProjectConfigPath);\n}\n+ /**\n+ * Resets the configuration while in watch mode.\n+ *\n+ * @todo Add implementation.\n+ */\nresetOnWatch() {\n// nothing yet\n}\n+ /**\n+ * Returns the config object.\n+ *\n+ * @returns {{}} - The config object.\n+ */\ngetConfig() {\nreturn this.config;\n}\n+ /**\n+ * Overwrites the config path.\n+ *\n+ * @param {String} path - The new config path.\n+ */\nsetProjectConfigPath(path) {\nthis.localProjectConfigPath = path;\nthis.config = this.mergeConfig(path);\n}\n+ /**\n+ * Overwrites the path prefix.\n+ *\n+ * @param {String} pathPrefix - The new path prefix.\n+ */\nsetPathPrefix(pathPrefix) {\ndebug(\"Setting pathPrefix to %o\", pathPrefix);\nthis.overrides.pathPrefix = pathPrefix;\nthis.config.pathPrefix = pathPrefix;\n}\n+ /**\n+ * Bootstraps the config object.\n+ */\ninitializeRootConfig() {\nthis.rootConfig = this.customRootConfig || require(\"../config.js\");\n@@ -64,6 +135,12 @@ class TemplateConfig {\ndebug(\"rootConfig %o\", this.rootConfig);\n}\n+ /**\n+ * Merges different config files together.\n+ *\n+ * @param {String} localProjectConfigPath - Path to local project config.\n+ * @returns {{}} merged - The merged config file.\n+ */\nmergeConfig(localProjectConfigPath) {\nlet overrides = [\"templateFormats\"];\nlet localConfig = {};\n" } ]
JavaScript
MIT License
11ty/eleventy
Add JSDoc Comments for Config and TemplateConfig. Adjust references
699
05.11.2019 20:31:48
21,600
e0dc2ac00d8085c7ad3aa30f52e774110fb150c6
New pagination options, fixes
[ { "change_type": "MODIFY", "old_path": "test/PaginationTest.js", "new_path": "test/PaginationTest.js", "diff": "@@ -672,3 +672,110 @@ test(\"Circular dependency but should not error because it uses eleventyExcludeFr\nt.true(true);\n});\n+\n+test(\"Pagination `before` Callback\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/paged/paged-before.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ let templates = await tmpl.getTemplates(data);\n+ t.deepEqual(templates[0].data.pagination.items, [\"item6\"]);\n+});\n+\n+test(\"Pagination `before` Callback with a Filter\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/paged/paged-before-filter.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ let templates = await tmpl.getTemplates(data);\n+ t.deepEqual(templates[0].data.pagination.items, [\"item2\"]);\n+});\n+\n+test(\"Pagination `before` Callback with `reverse: true` (test order of operations)\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/paged/paged-before-and-reverse.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ let templates = await tmpl.getTemplates(data);\n+ t.deepEqual(templates[0].data.pagination.items, [\"item2\"]);\n+});\n+\n+test(\"Pagination new v0.10.0 href/hrefs\", async t => {\n+ let dataObj = new TemplateData(\"./test/stubs/\");\n+ await dataObj.cacheData();\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/paged/paged.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\",\n+ dataObj\n+ );\n+\n+ let data = await tmpl.getData();\n+ let templates = await tmpl.getTemplates(data);\n+ t.is(templates[0].data.pagination.hrefs.length, 2);\n+ t.truthy(templates[0].data.pagination.href.first);\n+ t.truthy(templates[0].data.pagination.href.last);\n+ t.falsy(templates[0].data.pagination.href.previous);\n+ t.truthy(templates[0].data.pagination.href.next);\n+\n+ t.is(templates[1].data.pagination.hrefs.length, 2);\n+ t.truthy(templates[1].data.pagination.href.first);\n+ t.truthy(templates[1].data.pagination.href.last);\n+ t.truthy(templates[1].data.pagination.href.previous);\n+ t.falsy(templates[1].data.pagination.href.next);\n+});\n+\n+test(\"Pagination new v0.10.0 page/pages\", async t => {\n+ let dataObj = new TemplateData(\"./test/stubs/\");\n+ await dataObj.cacheData();\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/paged/paged.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\",\n+ dataObj\n+ );\n+\n+ let data = await tmpl.getData();\n+ let templates = await tmpl.getTemplates(data);\n+\n+ t.is(templates[0].data.pagination.pages.length, 2);\n+ t.is(templates[0].data.pagination.pages[0].length, 5);\n+ t.is(templates[0].data.pagination.pages[1].length, 3);\n+ t.truthy(templates[0].data.pagination.page.first);\n+ t.truthy(templates[0].data.pagination.page.last);\n+ t.falsy(templates[0].data.pagination.page.previous);\n+ t.truthy(templates[0].data.pagination.page.next);\n+\n+ t.is(templates[1].data.pagination.pages.length, 2);\n+ t.is(templates[1].data.pagination.pages[0].length, 5);\n+ t.is(templates[1].data.pagination.pages[1].length, 3);\n+ t.truthy(templates[1].data.pagination.page.first);\n+ t.truthy(templates[1].data.pagination.page.last);\n+ t.truthy(templates[1].data.pagination.page.previous);\n+ t.falsy(templates[1].data.pagination.page.next);\n+});\n+\n+test(\"Pagination new v0.10.0 alias\", async t => {\n+ let tmpl = new Template(\n+ \"./test/stubs/paged/pagedalias.njk\",\n+ \"./test/stubs/\",\n+ \"./dist\"\n+ );\n+\n+ let data = await tmpl.getData();\n+ let templates = await tmpl.getTemplates(data);\n+\n+ t.is(templates[0].data.pagination.alias, \"font.test\");\n+ t.is(templates[1].data.pagination.alias, \"font.test\");\n+});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/paged/paged-before-and-reverse.njk", "diff": "+---js\n+{\n+ pagination: {\n+ data: \"items\",\n+ size: 1,\n+ reverse: true,\n+ before: function(data) {\n+ return data.slice(0, 2);\n+ }\n+ },\n+ items: [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\", \"item6\"]\n+}\n+---\n+<ol>{% for item in pagination.items %}<li>{{ item }}</li>{% endfor %}</ol>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/paged/paged-before-filter.njk", "diff": "+---js\n+{\n+ pagination: {\n+ data: \"items\",\n+ size: 1,\n+ before: function(data) {\n+ return data.slice(0, 2).reverse();\n+ }\n+ },\n+ items: [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\", \"item6\"]\n+}\n+---\n+<ol>{% for item in pagination.items %}<li>{{ item }}</li>{% endfor %}</ol>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/stubs/paged/paged-before.njk", "diff": "+---js\n+{\n+ pagination: {\n+ data: \"items\",\n+ size: 1,\n+ before: function(data) {\n+ return data.reverse();\n+ }\n+ },\n+ items: [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\", \"item6\"]\n+}\n+---\n+<ol>{% for item in pagination.items %}<li>{{ item }}</li>{% endfor %}</ol>\n\\ No newline at end of file\n" } ]
JavaScript
MIT License
11ty/eleventy
New pagination options, fixes #280.
699
05.11.2019 20:56:19
21,600
f02a17cb393aae8f52657c3fcee1e0bbcb5f3f63
Make sure works with aliasing
[ { "change_type": "MODIFY", "old_path": "test/PaginationTest.js", "new_path": "test/PaginationTest.js", "diff": "@@ -683,6 +683,7 @@ test(\"Pagination `before` Callback\", async t => {\nlet data = await tmpl.getData();\nlet templates = await tmpl.getTemplates(data);\nt.deepEqual(templates[0].data.pagination.items, [\"item6\"]);\n+ t.deepEqual(templates[0].data.myalias, \"item6\");\n});\ntest(\"Pagination `before` Callback with a Filter\", async t => {\n@@ -695,6 +696,7 @@ test(\"Pagination `before` Callback with a Filter\", async t => {\nlet data = await tmpl.getData();\nlet templates = await tmpl.getTemplates(data);\nt.deepEqual(templates[0].data.pagination.items, [\"item2\"]);\n+ t.deepEqual(templates[0].data.myalias, \"item2\");\n});\ntest(\"Pagination `before` Callback with `reverse: true` (test order of operations)\", async t => {\n" }, { "change_type": "MODIFY", "old_path": "test/stubs/paged/paged-before-filter.njk", "new_path": "test/stubs/paged/paged-before-filter.njk", "diff": "size: 1,\nbefore: function(data) {\nreturn data.slice(0, 2).reverse();\n- }\n+ },\n+ alias: \"myalias\"\n},\nitems: [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\", \"item6\"]\n}\n" }, { "change_type": "MODIFY", "old_path": "test/stubs/paged/paged-before.njk", "new_path": "test/stubs/paged/paged-before.njk", "diff": "size: 1,\nbefore: function(data) {\nreturn data.reverse();\n- }\n+ },\n+ alias: 'myalias'\n},\nitems: [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\", \"item6\"]\n}\n" } ]
JavaScript
MIT License
11ty/eleventy
Make sure #699 works with aliasing
699
26.11.2019 08:23:22
21,600
ff33f7d64cfe07a8fd586e50cf8d001af03ce182
Check raw in Liquid
[ { "change_type": "MODIFY", "old_path": "test/TemplateRenderLiquidTest.js", "new_path": "test/TemplateRenderLiquidTest.js", "diff": "@@ -18,10 +18,30 @@ test(\"Liquid Render Addition\", async t => {\nlet fn = await new TemplateRender(\"liquid\").getCompiledTemplate(\n\"<p>{{ number | plus: 1 }}</p>\"\n);\n- // Important for pagination. This currently outputs 1.\nt.is(await fn({ number: 1 }), \"<p>2</p>\");\n});\n+test(\"Liquid Render Raw\", async t => {\n+ let fn = await new TemplateRender(\"liquid\").getCompiledTemplate(\n+ \"<p>{% raw %}{{name}}{% endraw %}</p>\"\n+ );\n+ t.is(await fn({ name: \"tim\" }), \"<p>{{name}}</p>\");\n+});\n+\n+test(\"Liquid Render Raw Multiline\", async t => {\n+ let fn = await new TemplateRender(\"liquid\").getCompiledTemplate(\n+ `<p>{% raw %}\n+{{name}}\n+{% endraw %}</p>`\n+ );\n+ t.is(\n+ await fn({ name: \"tim\" }),\n+ `<p>\n+{{name}}\n+</p>`\n+ );\n+});\n+\ntest(\"Liquid Render (with Helper)\", async t => {\nlet fn = await new TemplateRender(\"liquid\").getCompiledTemplate(\n\"<p>{{name | capitalize}}</p>\"\n" } ]
JavaScript
MIT License
11ty/eleventy
Check raw in Liquid
699
26.11.2019 08:23:56
21,600
918ff772f062c815b308d3f0efdd63a4c3bcfd07
Adds skipped test for (transforms and inputPath)
[ { "change_type": "MODIFY", "old_path": "test/TemplateTest.js", "new_path": "test/TemplateTest.js", "diff": "@@ -1138,6 +1138,26 @@ test(\"Test a transform\", async t => {\nt.is(renders[0], \"OVERRIDE BY A TRANSFORM\");\n});\n+// #789: https://github.com/11ty/eleventy/issues/789\n+test.skip(\"Test a transform (does it have inputPath?)\", async t => {\n+ t.plan(3);\n+\n+ let tmpl = new Template(\n+ \"./test/stubs/template.ejs\",\n+ \"./test/stubs/\",\n+ \"./test/stubs/_site\"\n+ );\n+\n+ tmpl.addTransform(function(content, outputPath, inputPath) {\n+ t.true(outputPath.endsWith(\".html\"));\n+ t.true(!!inputPath);\n+ return \"OVERRIDE BY A TRANSFORM\";\n+ });\n+\n+ let renders = await tmpl._testCompleteRender();\n+ t.is(renders[0], \"OVERRIDE BY A TRANSFORM\");\n+});\n+\ntest(\"Test a transform with pages\", async t => {\nt.plan(5);\n" } ]
JavaScript
MIT License
11ty/eleventy
Adds skipped test for #789 (transforms and inputPath)