@atlaspack/transformer-html 2.12.1-dev.3367 → 2.12.1-dev.3398
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.
- package/lib/inline.js +9 -9
- package/package.json +6 -6
- package/src/inline.js +9 -9
package/lib/inline.js
CHANGED
@@ -35,7 +35,7 @@ function extractInlineAssets(asset, ast) {
|
|
35
35
|
let parts = [];
|
36
36
|
let hasModuleScripts = false;
|
37
37
|
(0, _posthtml().default)().walk.call(program, node => {
|
38
|
-
let
|
38
|
+
let parcelKey = (0, _rust().hashString)(`${asset.id}:${key++}`);
|
39
39
|
if (node.tag === 'script' || node.tag === 'style') {
|
40
40
|
let value = node.content && node.content.join('');
|
41
41
|
if (value != null) {
|
@@ -98,8 +98,8 @@ function extractInlineAssets(asset, ast) {
|
|
98
98
|
}
|
99
99
|
|
100
100
|
// allow a script/style tag to declare its key
|
101
|
-
if (node.attrs['data-
|
102
|
-
|
101
|
+
if (node.attrs['data-parcel-key']) {
|
102
|
+
parcelKey = node.attrs['data-parcel-key'];
|
103
103
|
}
|
104
104
|
|
105
105
|
// Inform packager to remove type, since CSS and JS are the defaults.
|
@@ -107,18 +107,18 @@ function extractInlineAssets(asset, ast) {
|
|
107
107
|
delete node.attrs.type;
|
108
108
|
}
|
109
109
|
|
110
|
-
// insert
|
111
|
-
node.attrs['data-
|
110
|
+
// insert parcelId to allow us to retrieve node during packaging
|
111
|
+
node.attrs['data-parcel-key'] = parcelKey;
|
112
112
|
asset.setAST(ast); // mark dirty
|
113
113
|
|
114
114
|
asset.addDependency({
|
115
|
-
specifier:
|
115
|
+
specifier: parcelKey,
|
116
116
|
specifierType: 'esm'
|
117
117
|
});
|
118
118
|
parts.push({
|
119
119
|
type,
|
120
120
|
content: value,
|
121
|
-
uniqueKey:
|
121
|
+
uniqueKey: parcelKey,
|
122
122
|
bundleBehavior: 'inline',
|
123
123
|
env,
|
124
124
|
meta: {
|
@@ -139,7 +139,7 @@ function extractInlineAssets(asset, ast) {
|
|
139
139
|
let style = attrs === null || attrs === void 0 ? void 0 : attrs.style;
|
140
140
|
if (attrs != null && style != null) {
|
141
141
|
attrs.style = asset.addDependency({
|
142
|
-
specifier:
|
142
|
+
specifier: parcelKey,
|
143
143
|
specifierType: 'esm'
|
144
144
|
});
|
145
145
|
asset.setAST(ast); // mark dirty
|
@@ -147,7 +147,7 @@ function extractInlineAssets(asset, ast) {
|
|
147
147
|
parts.push({
|
148
148
|
type: 'css',
|
149
149
|
content: style,
|
150
|
-
uniqueKey:
|
150
|
+
uniqueKey: parcelKey,
|
151
151
|
bundleBehavior: 'inline',
|
152
152
|
meta: {
|
153
153
|
type: 'attr',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaspack/transformer-html",
|
3
|
-
"version": "2.12.1-dev.
|
3
|
+
"version": "2.12.1-dev.3398+81c73b3cd",
|
4
4
|
"license": "MIT",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -13,12 +13,12 @@
|
|
13
13
|
"source": "src/HTMLTransformer.js",
|
14
14
|
"engines": {
|
15
15
|
"node": ">= 16.0.0",
|
16
|
-
"
|
16
|
+
"parcel": "^2.12.1-dev.3398+81c73b3cd"
|
17
17
|
},
|
18
18
|
"dependencies": {
|
19
|
-
"@atlaspack/diagnostic": "2.12.1-dev.
|
20
|
-
"@atlaspack/plugin": "2.12.1-dev.
|
21
|
-
"@atlaspack/rust": "2.12.1-dev.
|
19
|
+
"@atlaspack/diagnostic": "2.12.1-dev.3398+81c73b3cd",
|
20
|
+
"@atlaspack/plugin": "2.12.1-dev.3398+81c73b3cd",
|
21
|
+
"@atlaspack/rust": "2.12.1-dev.3398+81c73b3cd",
|
22
22
|
"nullthrows": "^1.1.1",
|
23
23
|
"posthtml": "^0.16.5",
|
24
24
|
"posthtml-parser": "^0.10.1",
|
@@ -26,5 +26,5 @@
|
|
26
26
|
"semver": "^7.5.2",
|
27
27
|
"srcset": "4"
|
28
28
|
},
|
29
|
-
"gitHead": "
|
29
|
+
"gitHead": "81c73b3cdf93adf8b0013be9fed5422579bd5910"
|
30
30
|
}
|
package/src/inline.js
CHANGED
@@ -31,7 +31,7 @@ export default function extractInlineAssets(
|
|
31
31
|
let parts: Array<TransformerResult> = [];
|
32
32
|
let hasModuleScripts = false;
|
33
33
|
PostHTML().walk.call(program, (node: PostHTMLNode) => {
|
34
|
-
let
|
34
|
+
let parcelKey = hashString(`${asset.id}:${key++}`);
|
35
35
|
if (node.tag === 'script' || node.tag === 'style') {
|
36
36
|
let value = node.content && node.content.join('');
|
37
37
|
if (value != null) {
|
@@ -108,8 +108,8 @@ export default function extractInlineAssets(
|
|
108
108
|
}
|
109
109
|
|
110
110
|
// allow a script/style tag to declare its key
|
111
|
-
if (node.attrs['data-
|
112
|
-
|
111
|
+
if (node.attrs['data-parcel-key']) {
|
112
|
+
parcelKey = node.attrs['data-parcel-key'];
|
113
113
|
}
|
114
114
|
|
115
115
|
// Inform packager to remove type, since CSS and JS are the defaults.
|
@@ -117,19 +117,19 @@ export default function extractInlineAssets(
|
|
117
117
|
delete node.attrs.type;
|
118
118
|
}
|
119
119
|
|
120
|
-
// insert
|
121
|
-
node.attrs['data-
|
120
|
+
// insert parcelId to allow us to retrieve node during packaging
|
121
|
+
node.attrs['data-parcel-key'] = parcelKey;
|
122
122
|
asset.setAST(ast); // mark dirty
|
123
123
|
|
124
124
|
asset.addDependency({
|
125
|
-
specifier:
|
125
|
+
specifier: parcelKey,
|
126
126
|
specifierType: 'esm',
|
127
127
|
});
|
128
128
|
|
129
129
|
parts.push({
|
130
130
|
type,
|
131
131
|
content: value,
|
132
|
-
uniqueKey:
|
132
|
+
uniqueKey: parcelKey,
|
133
133
|
bundleBehavior: 'inline',
|
134
134
|
env,
|
135
135
|
meta: {
|
@@ -151,7 +151,7 @@ export default function extractInlineAssets(
|
|
151
151
|
let style = attrs?.style;
|
152
152
|
if (attrs != null && style != null) {
|
153
153
|
attrs.style = asset.addDependency({
|
154
|
-
specifier:
|
154
|
+
specifier: parcelKey,
|
155
155
|
specifierType: 'esm',
|
156
156
|
});
|
157
157
|
asset.setAST(ast); // mark dirty
|
@@ -159,7 +159,7 @@ export default function extractInlineAssets(
|
|
159
159
|
parts.push({
|
160
160
|
type: 'css',
|
161
161
|
content: style,
|
162
|
-
uniqueKey:
|
162
|
+
uniqueKey: parcelKey,
|
163
163
|
bundleBehavior: 'inline',
|
164
164
|
meta: {
|
165
165
|
type: 'attr',
|