@anydigital/eleventy-bricks 0.28.0-alpha → 0.28.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anydigital/eleventy-bricks",
3
- "version": "0.28.0-alpha",
3
+ "version": "0.28.0-alpha.3",
4
4
  "description": "A collection of helpful utilities and filters for Eleventy (11ty)",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -11,8 +11,7 @@
11
11
  }
12
12
  },
13
13
  "scripts": {
14
- "test": "node --test src/**/*.test.js",
15
- "prepublishOnly": "npm run test"
14
+ "test": "node --test src/**/*.test.js"
16
15
  },
17
16
  "keywords": [
18
17
  "11ty",
@@ -50,6 +50,12 @@ export default function (eleventyConfig) {
50
50
  const argv = minimist(process.argv.slice(2));
51
51
  const inputDir = argv.input || ".";
52
52
 
53
+ /* Jekyll parity */
54
+ eleventyConfig.addPassthroughCopy("assets");
55
+ eleventyConfig.addGlobalData("layout", "default");
56
+ eleventyConfig.setLiquidOptions({ dynamicPartials: false }); // allows unquoted Jekyll-style includes
57
+ eleventyConfig.addFilter("relative_url", (content) => content);
58
+
53
59
  /* Plugins */
54
60
  eleventyConfig.addPlugin(RenderPlugin);
55
61
  if (eleventyNavigationPlugin) eleventyConfig.addPlugin(eleventyNavigationPlugin);
@@ -68,9 +74,6 @@ export default function (eleventyConfig) {
68
74
  }
69
75
 
70
76
  /* Libraries */
71
- eleventyConfig.setLiquidOptions({
72
- dynamicPartials: false, // This allows unquoted includes like Jekyll
73
- });
74
77
  let md = markdownIt({
75
78
  html: true,
76
79
  linkify: true,
@@ -86,7 +89,6 @@ export default function (eleventyConfig) {
86
89
  eleventyConfig.addFilter("markdownify", (content) => md.render(String(content ?? "")));
87
90
 
88
91
  /* Data */
89
- // eleventyConfig.addGlobalData("layout", "__layout");
90
92
  eleventyConfig.addDataExtension("yml", (contents) => yaml.load(contents));
91
93
 
92
94
  /* Build */
@@ -50,7 +50,7 @@ export function buildFaviconLink(attrs, domain, text) {
50
50
  updatedAttrs = updatedAttrs + ' target="_blank"';
51
51
  }
52
52
 
53
- return `<a ${updatedAttrs}><i><img src="https://www.google.com/s2/favicons?domain=${domain}&sz=32"></i><span>${text}</span></a>`;
53
+ return `<a ${updatedAttrs}><i><img src="https://www.google.com/s2/favicons?domain=${domain}&sz=64"></i><span>${text}</span></a>`;
54
54
  }
55
55
 
56
56
  /**
@@ -90,7 +90,7 @@ describe("buildFaviconLink", () => {
90
90
  const result = buildFaviconLink('href="https://example.com/docs"', "example.com", "/docs");
91
91
  assert.equal(
92
92
  result,
93
- '<a href="https://example.com/docs" class="whitespace-nowrap" target="_blank"><i><img src="https://www.google.com/s2/favicons?domain=example.com&sz=32"></i><span>/docs</span></a>',
93
+ '<a href="https://example.com/docs" class="whitespace-nowrap" target="_blank"><i><img src="https://www.google.com/s2/favicons?domain=example.com&sz=64"></i><span>/docs</span></a>',
94
94
  );
95
95
  });
96
96
 
@@ -98,13 +98,13 @@ describe("buildFaviconLink", () => {
98
98
  const result = buildFaviconLink('href="https://example.com" class="link"', "example.com", "text");
99
99
  assert.equal(
100
100
  result,
101
- '<a href="https://example.com" class="link whitespace-nowrap" target="_blank"><i><img src="https://www.google.com/s2/favicons?domain=example.com&sz=32"></i><span>text</span></a>',
101
+ '<a href="https://example.com" class="link whitespace-nowrap" target="_blank"><i><img src="https://www.google.com/s2/favicons?domain=example.com&sz=64"></i><span>text</span></a>',
102
102
  );
103
103
  });
104
104
 
105
- it("should use sz=32 parameter for favicon size", () => {
105
+ it("should use sz=64 parameter for favicon size", () => {
106
106
  const result = buildFaviconLink('href="https://example.com"', "example.com", "text");
107
- assert.match(result, /sz=32/);
107
+ assert.match(result, /sz=64/);
108
108
  });
109
109
 
110
110
  it("should wrap img in <i> tag", () => {
@@ -116,7 +116,7 @@ describe("buildFaviconLink", () => {
116
116
  const result = buildFaviconLink('href="https://github.com/repo"', "github.com", "/repo");
117
117
  assert.equal(
118
118
  result,
119
- '<a href="https://github.com/repo" class="whitespace-nowrap" target="_blank"><i><img src="https://www.google.com/s2/favicons?domain=github.com&sz=32"></i><span>/repo</span></a>',
119
+ '<a href="https://github.com/repo" class="whitespace-nowrap" target="_blank"><i><img src="https://www.google.com/s2/favicons?domain=github.com&sz=64"></i><span>/repo</span></a>',
120
120
  );
121
121
  });
122
122
 
@@ -136,7 +136,7 @@ describe("transformLink", () => {
136
136
  );
137
137
  assert.match(
138
138
  result,
139
- /<i><img src="https:\/\/www\.google\.com\/s2\/favicons\?domain=example\.com&sz=32"><\/i><span>\/docs<\/span>/,
139
+ /<i><img src="https:\/\/www\.google\.com\/s2\/favicons\?domain=example\.com&sz=64"><\/i><span>\/docs<\/span>/,
140
140
  );
141
141
  });
142
142
 
@@ -395,7 +395,7 @@ describe("replaceLinksInHtml", () => {
395
395
  const html = '<a href="https://example.com/docs">https://example.com/docs</a>';
396
396
  const result = replaceLinksInHtml(html, transformLink);
397
397
  // transformLink should add favicon for plain URL links
398
- assert.match(result, /<img src="https:\/\/www\.google\.com\/s2\/favicons\?domain=example\.com&sz=32">/);
398
+ assert.match(result, /<img src="https:\/\/www\.google\.com\/s2\/favicons\?domain=example\.com&sz=64">/);
399
399
  assert.match(result, /<span>\/docs<\/span><\/a>/);
400
400
  });
401
401