@11ty/eleventy-plugin-webc 0.10.1 → 0.11.0

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.
@@ -18,6 +18,7 @@ module.exports = function(eleventyConfig, options = {}) {
18
18
 
19
19
  options = Object.assign({
20
20
  components: "_components/**/*.webc", // glob for no-import global components
21
+ scopedHelpers: ["css", "js", "html"],
21
22
  useTransform: false, // global transform
22
23
  transformData: {}, // extra global data for transforms specifically
23
24
  }, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@11ty/eleventy-plugin-webc",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "WebC support for Eleventy adds for Single File Web Components",
5
5
  "main": "eleventyWebcPlugin.js",
6
6
  "scripts": {
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@11ty/eleventy": "^2.0.0",
46
46
  "@11ty/eleventy-plugin-bundle": "^1.0.4",
47
- "@11ty/webc": "^0.10.0"
47
+ "@11ty/webc": "^0.11.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "ava": "^5.2.0",
@@ -25,6 +25,7 @@ module.exports = function(eleventyConfig, options = {}) {
25
25
  let globalComponentManager;
26
26
  let componentsMap = false; // cache the glob search
27
27
  let moduleScript;
28
+ let scopedHelpers = new Set(options.scopedHelpers);
28
29
 
29
30
  eleventyConfig.on("eleventy.before", async () => {
30
31
  // For ESM in CJS
@@ -96,15 +97,15 @@ module.exports = function(eleventyConfig, options = {}) {
96
97
  // Add Eleventy JavaScript Functions as WebC helpers
97
98
  // Note that Universal Filters and Shortcodes populate into javascriptFunctions and will be present here
98
99
  for(let helperName in this.config.javascriptFunctions) {
99
- page.setHelper(helperName, this.config.javascriptFunctions[helperName]);
100
+ page.setHelper(helperName, this.config.javascriptFunctions[helperName], scopedHelpers.has(helperName));
100
101
  }
101
102
 
102
103
  // Support both casings (I prefer getCss, but yeah)
103
- page.setHelper("getCss", (url, bucket) => this.config.javascriptFunctions.getBundle("css", bucket));
104
- page.setHelper("getCSS", (url, bucket) => this.config.javascriptFunctions.getBundle("css", bucket));
104
+ page.setHelper("getCss", (url, bucket) => this.config.javascriptFunctions.getBundle("css", bucket), scopedHelpers.has("getCss"));
105
+ page.setHelper("getCSS", (url, bucket) => this.config.javascriptFunctions.getBundle("css", bucket), scopedHelpers.has("getCSS"));
105
106
 
106
- page.setHelper("getJs", (url, bucket) => this.config.javascriptFunctions.getBundle("js", bucket));
107
- page.setHelper("getJS", (url, bucket) => this.config.javascriptFunctions.getBundle("js", bucket));
107
+ page.setHelper("getJs", (url, bucket) => this.config.javascriptFunctions.getBundle("js", bucket), scopedHelpers.has("getJs"));
108
+ page.setHelper("getJS", (url, bucket) => this.config.javascriptFunctions.getBundle("js", bucket), scopedHelpers.has("getJS"));
108
109
 
109
110
  page.setTransform("11ty", async function(content) {
110
111
  let syntax = this["11ty:type"];