Repository: 11ty/eleventy (js)

Issue:
.11ty.cjs extension not recognized as JavaScript template
**Describe the bug**
I have a project that has to have `"type": "module"` in its package.json. For other tools simply changing configuration/plugin scripts to have a `.cjs` extension has worked. Templates with `.11ty.cjs` don't work for eleventy however as that extension isn't recognized as a JavaScript template type.

**To Reproduce**
Steps to reproduce the behavior:

1. Create a `_includes/home.11ty.cjs` template file
2. Add `layout: home.11ty.cjs` to a content file
3. Run eleventy
4. See error

**Expected behavior**
`_includes/home.11ty.cjs` is treated as a JavaScript template

**Screenshots**

The error:
```
> Unknown engine for docs-src/_includes/home.11ty.cjs

`TemplateRenderUnknownEngineError` was thrown:
    TemplateRenderUnknownEngineError: Unknown engine for docs-src/_includes/home.11ty.cjs
```

**Environment:**

- macOS 10.14
- Eleventy Version 0.9.0

Pull request:
Add support for .11ty.cjs extensions
Fixes #826 

Patch:
diff --git a/src/EleventyExtensionMap.js b/src/EleventyExtensionMap.js
index 5b2940c8..db7a0485 100644
--- a/src/EleventyExtensionMap.js
+++ b/src/EleventyExtensionMap.js
@@ -150,7 +150,8 @@ class EleventyExtensionMap {
       pug: "pug",
       njk: "njk",
       liquid: "liquid",
-      "11ty.js": "11ty.js"
+      "11ty.js": "11ty.js",
+      "11ty.cjs": "11ty.js"
     };
 
     for (let extension in aliases) {


Test patch:
diff --git a/test/TemplateRenderJavaScriptTest.js b/test/TemplateRenderJavaScriptTest.js
index 330cc54f..a212d068 100644
--- a/test/TemplateRenderJavaScriptTest.js
+++ b/test/TemplateRenderJavaScriptTest.js
@@ -7,6 +7,11 @@ test("JS", t => {
     new TemplateRender("./test/stubs/filename.11ty.js").getEngineName(),
     "11ty.js"
   );
+  t.is(new TemplateRender("11ty.cjs").getEngineName(), "11ty.js");
+  t.is(
+    new TemplateRender("./test/stubs/filename.11ty.cjs").getEngineName(),
+    "11ty.js"
+  );
 });
 
 test("JS Render a string (no data)", async t => {
@@ -67,22 +72,24 @@ test("JS Render a function (Collections)", async t => {
   let tr = new TemplateRender("./test/stubs/use-collection.11ty.js");
   let fn = await tr.getCompiledTemplate();
   t.is(
-    (await fn({
-      collections: {
-        post: [
-          {
-            data: {
-              title: "Testing"
+    (
+      await fn({
+        collections: {
+          post: [
+            {
+              data: {
+                title: "Testing"
+              }
+            },
+            {
+              data: {
+                title: "Testing2"
+              }
             }
-          },
-          {
-            data: {
-              title: "Testing2"
-            }
-          }
-        ]
-      }
-    })).trim(),
+          ]
+        }
+      })
+    ).trim(),
     `<ul><li>Testing</li><li>Testing2</li></ul>`
   );
 });
diff --git a/test/TemplateWriterTest.js b/test/TemplateWriterTest.js
index bdce4312..a4a31c3f 100644
--- a/test/TemplateWriterTest.js
+++ b/test/TemplateWriterTest.js
@@ -511,7 +511,10 @@ test("Write Test 11ty.js", async t => {
   evf.init();
 
   let files = await fastglob(evf.getFileGlobs());
-  t.deepEqual(evf.getRawFiles(), ["./test/stubs/writeTestJS/**/*.11ty.js"]);
+  t.deepEqual(evf.getRawFiles(), [
+    "./test/stubs/writeTestJS/**/*.11ty.js",
+    "./test/stubs/writeTestJS/**/*.11ty.cjs"
+  ]);
   t.deepEqual(files, ["./test/stubs/writeTestJS/test.11ty.js"]);
 
   let tmpl = tw._createTemplate(files[0]);