posthtml / posthtml-loader

PostHTML for Webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feat]: publish version 1.0.0

Scrum opened this issue · comments

@michael-ciniawsky Hi, why you not publish version 1.0.0 ?
now publish version 0.11.0 have bug.

The v1.0.0 is still blocked by

result.messages Support

posthtml

posthtml/posthtml#195 (Needs rework/rebase, maybe the tree.error, tree.warning API should be removed for now* and only add result.messages && message { type: 'dependency', file: 'path/to/file.html' } etc)

* There is still no location info on the tree, but that is a separate issue for things 'needed' in core

poshtml-loader

https://github.com/posthtml/posthtml-loader/blob/master/index.js#L79-L91

HTML Imports

poshtml-loader

https://github.com/posthtml/posthtml-loader/blob/master/index.js#L96-L98 (Rework module.exports (CJS) => export default (ESM))

posthtml-include

posthtml/posthtml-include#16 (Needs rework)

file.html

<body>
  <include src="path/to/include.html">
  <div>Content</div>
<body>

=> posthtml-loader =>

file.html (webpack Module)

import HTML__IMPORT___{idx} from './path/to/include.html'

export default `
<body>
  ${HTML__IMPORT___${idx}}  // => Contents of <include src=""path/to/include.html">
  <div>Content</div>
</body>
`

So webpackcan resolve and dedupe the HTML Imports as ES2015 Modules

Assets (Resolving)

posthtml-url (?)

file.html

<body>
  <img src="path/to/img.png">
  <div>Content</div>
<body>

So webpack can resolve the various asset file paths via the loader this.addDependency() && result.messages

=> posthtml-loader =>

file.html (webpack Module)

// This import will be provided by the file-loader then => e.g '[hash].png'
import HTML__URL___{idx} from './path/to/img.png'

export default `
<body>
  <img src='${HTML__URL___${idx}}'> // => __webpack_public_path + 3257te32f.png
  <div>Content</div>
</body>
`

So webpack can watch them by adding the include file paths via the loader this.addDependency() && result.messages

What is the current bug, so we can release a minor/path before v1.0.0

ℹ️ I would like to present posthtml-loader v1.0.0 as replacement for html-loader (which currently has a bad design) and eventually merge it into html-loader in the intermediate future if accepted :)

Hi, @michael-ciniawsky

What is the current bug, so we can release a minor/path before v1.0.0

https://github.com/posthtml/posthtml-loader/blob/v0.10.3/lib/index.js#L19 - not call parser.

posthtml/posthtml#195 (Needs rework/rebase, maybe the tree.error, tree.warning API should be removed for now* and only add result.messages && message { type: 'dependency', file: 'path/to/file.html' } etc)

This should not be related to the current package and should not disrupt the overall structure posthtml. I propose to put it in a separate package posthtml-api - it will expand the native api posthtml without affecting its architecture, which is very good.

Everything else seems very interesting to me, but it takes time for implementation.

IMPORTANT

Please, if you do not have the time, give me permission to this package in npm so that I can take your achievements in a separate branch and temporarily return this repository to the current state and fix it.

Please do not disappear for a long time, let us know that you are all right.