@parcel/transformer-posthtml 2.0.0-rc.0 → 2.0.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.
|
@@ -36,7 +36,7 @@ function _posthtml() {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function _posthtmlParser() {
|
|
39
|
-
const data =
|
|
39
|
+
const data = require("posthtml-parser");
|
|
40
40
|
|
|
41
41
|
_posthtmlParser = function () {
|
|
42
42
|
return data;
|
|
@@ -46,7 +46,7 @@ function _posthtmlParser() {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function _posthtmlRender() {
|
|
49
|
-
const data =
|
|
49
|
+
const data = require("posthtml-render");
|
|
50
50
|
|
|
51
51
|
_posthtmlRender = function () {
|
|
52
52
|
return data;
|
|
@@ -156,9 +156,10 @@ var _default = new (_plugin().Transformer)({
|
|
|
156
156
|
return {
|
|
157
157
|
type: 'posthtml',
|
|
158
158
|
version: '0.4.1',
|
|
159
|
-
program: (0, _posthtmlParser().
|
|
159
|
+
program: (0, _posthtmlParser().parser)(await asset.getCode(), {
|
|
160
160
|
lowerCaseAttributeNames: true,
|
|
161
|
-
sourceLocations: true
|
|
161
|
+
sourceLocations: true,
|
|
162
|
+
xmlMode: asset.type === 'xhtml'
|
|
162
163
|
})
|
|
163
164
|
};
|
|
164
165
|
},
|
|
@@ -199,10 +200,13 @@ var _default = new (_plugin().Transformer)({
|
|
|
199
200
|
},
|
|
200
201
|
|
|
201
202
|
generate({
|
|
202
|
-
ast
|
|
203
|
+
ast,
|
|
204
|
+
asset
|
|
203
205
|
}) {
|
|
204
206
|
return {
|
|
205
|
-
content: (0, _posthtmlRender().
|
|
207
|
+
content: (0, _posthtmlRender().render)(ast.program, {
|
|
208
|
+
closingSingleTag: asset.type === 'xhtml' ? 'slash' : undefined
|
|
209
|
+
})
|
|
206
210
|
};
|
|
207
211
|
}
|
|
208
212
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-posthtml",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"source": "src/PostHTMLTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "^2.0.0
|
|
20
|
+
"parcel": "^2.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/plugin": "2.0.0
|
|
24
|
-
"@parcel/utils": "2.0.0
|
|
23
|
+
"@parcel/plugin": "^2.0.0",
|
|
24
|
+
"@parcel/utils": "^2.0.0",
|
|
25
25
|
"nullthrows": "^1.1.1",
|
|
26
|
-
"posthtml": "^0.16.
|
|
27
|
-
"posthtml-parser": "^0.
|
|
28
|
-
"posthtml-render": "^
|
|
26
|
+
"posthtml": "^0.16.5",
|
|
27
|
+
"posthtml-parser": "^0.10.1",
|
|
28
|
+
"posthtml-render": "^3.0.0",
|
|
29
29
|
"semver": "^5.4.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "84da50ae6943bff9741e2fc76d2f4968074cbbd6"
|
|
32
32
|
}
|
|
@@ -4,8 +4,8 @@ import {Transformer} from '@parcel/plugin';
|
|
|
4
4
|
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import posthtml from 'posthtml';
|
|
7
|
-
import parse from 'posthtml-parser';
|
|
8
|
-
import render from 'posthtml-render';
|
|
7
|
+
import {parser as parse} from 'posthtml-parser';
|
|
8
|
+
import {render} from 'posthtml-render';
|
|
9
9
|
import nullthrows from 'nullthrows';
|
|
10
10
|
import semver from 'semver';
|
|
11
11
|
import {relativePath} from '@parcel/utils';
|
|
@@ -88,6 +88,7 @@ export default (new Transformer({
|
|
|
88
88
|
program: parse(await asset.getCode(), {
|
|
89
89
|
lowerCaseAttributeNames: true,
|
|
90
90
|
sourceLocations: true,
|
|
91
|
+
xmlMode: asset.type === 'xhtml',
|
|
91
92
|
}),
|
|
92
93
|
};
|
|
93
94
|
},
|
|
@@ -123,9 +124,11 @@ export default (new Transformer({
|
|
|
123
124
|
return [asset];
|
|
124
125
|
},
|
|
125
126
|
|
|
126
|
-
generate({ast}) {
|
|
127
|
+
generate({ast, asset}) {
|
|
127
128
|
return {
|
|
128
|
-
content: render(ast.program
|
|
129
|
+
content: render(ast.program, {
|
|
130
|
+
closingSingleTag: asset.type === 'xhtml' ? 'slash' : undefined,
|
|
131
|
+
}),
|
|
129
132
|
};
|
|
130
133
|
},
|
|
131
134
|
}): Transformer);
|