@anyblades/buildawesome-kit-plugin 1.3.0-alpha → 1.3.0-alpha.2

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.
@@ -60,8 +60,8 @@ export function replaceLinksInHtml(content, transformer) {
60
60
  );
61
61
  }
62
62
 
63
- export default function (eleventyConfig) {
64
- eleventyConfig.addTransform("autoLinkFavicons", function (content) {
63
+ export default function ($config) {
64
+ $config.addTransform("autoLinkFavicons", function (content) {
65
65
  if (this.page.outputPath && this.page.outputPath.endsWith(".html")) {
66
66
  return replaceLinksInHtml(content, transformLink);
67
67
  }
@@ -12,8 +12,8 @@ export function transformNl2br(content) {
12
12
  return content.replace(/\\n\\n/g, "<br>").replace(/\\n/g, "<br>");
13
13
  }
14
14
 
15
- export default function mdAutoNl2br(eleventyConfig) {
16
- eleventyConfig.amendLibrary("md", (mdLib) => {
15
+ export default function mdAutoNl2br($config) {
16
+ $config.amendLibrary("md", (mdLib) => {
17
17
  mdLib.renderer.rules.text = (tokens, idx) => {
18
18
  return transformNl2br(tokens[idx].content);
19
19
  };
@@ -9,8 +9,8 @@ export function transformAutoRaw(content) {
9
9
  return content.replace(/({{|}}|{%|%})/g, "{% raw %}$1{% endraw %}");
10
10
  }
11
11
 
12
- export default function mdAutoRawTags(eleventyConfig) {
13
- eleventyConfig.addPreprocessor("mdAutoRawTags", "md", (data, content) => {
12
+ export default function mdAutoRawTags($config) {
13
+ $config.addPreprocessor("mdAutoRawTags", "md", (data, content) => {
14
14
  return transformAutoRaw(content);
15
15
  });
16
16
  }
@@ -16,8 +16,8 @@ export function transformUncommentAttrs(content) {
16
16
  return content;
17
17
  }
18
18
 
19
- export default function mdAutoUncommentAttrs(eleventyConfig) {
20
- eleventyConfig.amendLibrary("md", (mdLib) => {
19
+ export default function mdAutoUncommentAttrs($config) {
20
+ $config.amendLibrary("md", (mdLib) => {
21
21
  mdLib.core.ruler.before("normalize", "uncomment_attrs", (state) => {
22
22
  state.src = transformUncommentAttrs(state.src);
23
23
  });
@@ -31,8 +31,8 @@ export const siteData = (data) => {
31
31
  };
32
32
  };
33
33
 
34
- export default function (eleventyConfig) {
35
- eleventyConfig.addGlobalData("eleventyComputed", {
34
+ export default function ($config) {
35
+ $config.addGlobalData("eleventyComputed", {
36
36
  site: (data) => ({
37
37
  ...siteData(data),
38
38
  prod: process.env.ELEVENTY_RUN_MODE === "build",
@@ -6,13 +6,13 @@
6
6
  import { readFileSync } from "fs";
7
7
  import YAML from "js-yaml";
8
8
 
9
- export default function (eleventyConfig) {
9
+ export default function ($config) {
10
10
  // Virtual pages
11
- const pages = YAML.load(readFileSync(eleventyConfig.directories.input + "/pages.yaml", "utf8"));
11
+ const pages = YAML.load(readFileSync($config.directories.input + "/pages.yaml", "utf8"));
12
12
  for (const [index, data] of pages.entries()) {
13
13
  const virtualSlug = data.permalink ? data.permalink + "index" : index;
14
14
  // console.log(data, virtualSlug);
15
- eleventyConfig.addTemplate("." + virtualSlug + ".md", "", data);
15
+ $config.addTemplate("." + virtualSlug + ".md", "", data);
16
16
  }
17
17
  }
18
18
  //```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyblades/buildawesome-kit-plugin",
3
- "version": "1.3.0-alpha",
3
+ "version": "1.3.0-alpha.2",
4
4
  "type": "module",
5
5
  "main": "./plugin.js",
6
6
  "exports": {
package/plugin.js CHANGED
@@ -8,7 +8,7 @@ export const discoverModules = (dir) =>
8
8
  .map((f) => [f.replace(/\.js$/, ""), true]),
9
9
  );
10
10
 
11
- export default async function (eleventyConfig, userOptions) {
11
+ export default async function ($config, userOptions) {
12
12
  //```<!--section:code,def-options-->```js
13
13
  const defaultOptions = { mdAutoRawTags: false };
14
14
  //```<!--section:code-->```js
@@ -31,7 +31,7 @@ export default async function (eleventyConfig, userOptions) {
31
31
  try {
32
32
  if (filterName == "fetch") await import("@11ty/eleventy-fetch");
33
33
  const filterFunc = (await import("./filters/" + filterName + ".js")).default;
34
- eleventyConfig.addFilter(filterName, filterFunc);
34
+ $config.addFilter(filterName, filterFunc);
35
35
  } catch (error) {
36
36
  console.log("^ N/A ^");
37
37
  }
@@ -44,7 +44,7 @@ export default async function (eleventyConfig, userOptions) {
44
44
  console.log("Loading feature: " + featureName + "...");
45
45
  try {
46
46
  const featureConfig = (await import("./features/" + featureName + ".js")).default;
47
- featureConfig(eleventyConfig);
47
+ featureConfig($config);
48
48
  } catch (error) {
49
49
  console.log("^ N/A ^");
50
50
  }
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "private": true,
3
- "name": "do",
3
+ "name": "scripts",
4
4
  "scripts": {
5
5
  "=== START": "with-tw: 1) `&` for parallel run 2) `tw` is last to stay alive 3) trap/wait for graceful exit",
6
- "start": "npm run 11ty -- --serve --incremental",
6
+ "start": "npm run ba -- --serve --incremental",
7
7
  "start:with-tw": "trap 'kill 0' INT; npm start & npm run tw -- --watch & wait",
8
8
  "=== STAGE": "1) `rm -r` w/o trailing slash to avoid symlink catastrophe! 2) `;` to bypass no dir errors",
9
9
  "stage": "rm -r ../_site; npm run build && serve ../_site/",
10
10
  "=== BUILD": "`;` to make `tw` optional",
11
- "build": "npm run tw; npm run 11ty",
11
+ "build": "npm run tw; npm run ba",
12
12
  "=== INNER": "commands written so that extra arguments can be passed",
13
- "11ty": "cd ../ && NODE_OPTIONS='--preserve-symlinks' eleventy ${ELTY_OPTIONS}",
14
- "tw": "[ -z \"$TW_OPTIONS\" ] && exit 0; cd ../ && tailwindcss ${TW_OPTIONS}",
15
- "dev:blades": "cd ../ && npm link @anyblades/eleventy-blades-base && cd ./node_modules/@anyblades/ && ln -sf ./eleventy-blades-base/node_modules/@anyblades/*blades* ./ && cd eleventy-blades-base && npm link @anyblades/blades @anyblades/eleventy-blades"
13
+ "ba": "cd ../ && NODE_OPTIONS=--preserve-symlinks buildawesome ${BA_OPTIONS:-$ELTY_OPTIONS}",
14
+ "tw": "[ -z \"$TW_OPTIONS\" ] && exit 0; cd ../ && tailwindcss ${TW_OPTIONS}"
16
15
  }
17
- }
16
+ }