Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type of HtmlTransformer plugins attribute #3403

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

aschrab
Copy link
Contributor

@aschrab aschrab commented Aug 4, 2024

While plugins should be ordered, this attribute seems to be used as a map from an extension to that list of plugins rather than the list itself; as indicated in the getPlugins() method.

In my site I don't do any configuration of this, just using the defaults. While trying to update to Eleventy 3 I was running into errors

Problem writing Eleventy templates:

  1. Having trouble writing to "./public/css/base.css", "./public/css/base.css.map" from "./pages/styles.11ty.js" (via EleventyTemplateError)
  2. Transform @11ty/eleventy/html-transformer encountered an error when transforming ./pages/styles.11ty.js. (via EleventyTransformError)
  3. plugins is not iterable (via TypeError)

Original error stack trace: TypeError: plugins is not iterable
at HtmlTransformer._getPosthtmlInstance (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js:39:39)
at HtmlTransformer.transformContent (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js:142:42)
at Object. (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/defaultConfig.js:125:13)
at Object.fn (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkGroup.js:37:23)
at TransformsUtil.runAll (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Util/TransformsUtil.js:36:30)

The main problem seemed to be writing ./public/css/base.css.map. When getPlugins was called for that it was finding the map method for Array which it could not iterate over.

While plugins should be ordered, this attribute seems to be used as a
map from an extension to that list of plugins rather than the list
itself; as indicated in the `getPlugins()` method.

In my site I don't do any configuration of this, just using the
defaults. While trying to update to Eleventy 3 I was running into errors

> Problem writing Eleventy templates:
> 1. Having trouble writing to "./public/css/base.css", "./public/css/base.css.map" from "./pages/styles.11ty.js" (via EleventyTemplateError)
> 2. Transform `@11ty/eleventy/html-transformer` encountered an error when transforming ./pages/styles.11ty.js. (via EleventyTransformError)
> 3. plugins is not iterable (via TypeError)
>
> Original error stack trace: TypeError: plugins is not iterable
>     at HtmlTransformer._getPosthtmlInstance (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js:39:39)
>     at HtmlTransformer.transformContent (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js:142:42)
>     at Object.<anonymous> (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/defaultConfig.js:125:13)
>     at Object.fn (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkGroup.js:37:23)
>     at TransformsUtil.runAll (file:///home/ats/vc/personal/web/node_modules/.pnpm/github.com+11ty+eleventy@c39e896/node_modules/@11ty/eleventy/src/Util/TransformsUtil.js:36:30)

The main problem seemed to be writing `./public/css/base.css.map`. When
getPlugins was called for that it was finding the `map` method for Array
which it could not iterate over.
@zachleat zachleat self-requested a review August 8, 2024 17:02
@zachleat zachleat merged commit 3676a49 into 11ty:main Aug 8, 2024
@zachleat zachleat added this to the Eleventy 3.0.0 milestone Aug 8, 2024
@zachleat
Copy link
Member

zachleat commented Aug 8, 2024

Thank you! This will ship with 3.0.0-canary.19, 3.0.0-beta.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants