Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

feat(pipe): use jsdom everywhere #349

Merged
merged 1 commit into from
Jun 6, 2019
Merged

feat(pipe): use jsdom everywhere #349

merged 1 commit into from
Jun 6, 2019

Conversation

tripodsan
Copy link
Contributor

@tripodsan tripodsan commented May 29, 2019

see #337, see #336

Improvements

  • remove the use of htast and hast where possible
  • the VDOM transformer now directly transforms the mdast to hast to dom. before it used to create the jsdom via a html-string roundtrip.

BREAKING CHANGES:

  • remove htast from context.content schema
  • remove hast from context.response schema
  • add document from to context.response schema
  • context.htast and context.response.hast is no longer generated
  • mdast to jsdom transformation handlers can only return hast (not string, not vdom)
  • html postprocessing pipeline step was renamed from hast to post
  • mixing inline html and markdown no longer works (eg: <em>This is **strong**</em>)

Further Work

I think that we should generate the jsdom directly from the mdast. this would even speed up the transformation more. currently, there is no utility available for this. we would need to copy major parts of mdast-util-to-hast.

@tripodsan tripodsan force-pushed the jsdom branch 2 times, most recently from 5e3bc2c to 0b5cf22 Compare May 29, 2019 09:58
@tripodsan

This comment has been minimized.

.before(responsive)
// todo: responsive used to operate on the htast, therefore ignored if content.document was used
// todo: there is similar logic in the image-handler during jsdom creation....
// .before(responsive)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trieloff WDYT?

* THIS SOFTWARE.
*/

// This was copied from https://github.com/syntax-tree/hast-util-to-dom/blob/master/src/index.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgtm-com

This comment has been minimized.

@ramboz

This comment has been minimized.

@tripodsan

This comment has been minimized.

@tripodsan tripodsan force-pushed the jsdom branch 2 times, most recently from 19843a7 to ad72e5e Compare May 30, 2019 04:09
@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #349 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #349   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          47     47           
  Lines        1041   1059   +18     
=====================================
+ Hits         1041   1059   +18
Impacted Files Coverage Δ
src/utils/embed-handler.js 100% <ø> (ø) ⬆️
src/html/make-html.js 100% <ø> (ø) ⬆️
src/utils/heading-handler.js 100% <ø> (ø) ⬆️
src/utils/hast-util-to-dom.js 100% <100%> (ø)
src/defaults/html.pipe.js 100% <100%> (ø) ⬆️
src/html/html-to-vdom.js 100% <100%> (ø)
src/utils/image-handler.js 100% <100%> (ø) ⬆️
src/html/stringify-response.js 100% <100%> (ø)
src/html/add-headers.js 100% <100%> (ø) ⬆️
src/html/static-asset-links.js 100% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e88b8f6...7c16fda. Read the comment docs.

@tripodsan tripodsan force-pushed the jsdom branch 3 times, most recently from 5d38943 to 9dc890c Compare May 30, 2019 06:01
@ramboz
Copy link
Contributor

ramboz commented May 30, 2019

@tripodsan Alright. I'll review this tomorrow

@tripodsan tripodsan marked this pull request as ready for review June 3, 2019 07:19
@tripodsan tripodsan requested review from trieloff and koraa June 4, 2019 02:48
@tripodsan tripodsan merged commit d0e25c3 into master Jun 6, 2019
@tripodsan tripodsan deleted the jsdom branch June 6, 2019 02:42
adobe-bot pushed a commit that referenced this pull request Jun 6, 2019
# [2.3.0](v2.2.0...v2.3.0) (2019-06-06)

### Features

* **pipe:** use jsdom everywhere ([#349](#349)) ([d0e25c3](d0e25c3))
@adobe-bot
Copy link

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants