@atlaspack/packager-svg 2.12.1-dev.3450 → 2.12.1-dev.3478
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/package.json +6 -6
- package/src/SVGPackager.js +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/packager-svg",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
3
|
+
"version": "2.12.1-dev.3478+5fd2da535",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"source": "src/SVGPackager.js",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">= 16.0.0",
|
|
16
|
-
"parcel": "^2.12.1-dev.
|
|
16
|
+
"parcel": "^2.12.1-dev.3478+5fd2da535"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/plugin": "2.12.1-dev.
|
|
20
|
-
"@atlaspack/types": "2.12.1-dev.
|
|
21
|
-
"@atlaspack/utils": "2.12.1-dev.
|
|
19
|
+
"@atlaspack/plugin": "2.12.1-dev.3478+5fd2da535",
|
|
20
|
+
"@atlaspack/types": "2.12.1-dev.3478+5fd2da535",
|
|
21
|
+
"@atlaspack/utils": "2.12.1-dev.3478+5fd2da535",
|
|
22
22
|
"posthtml": "^0.16.4"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "5fd2da535ecbe096d57e03aec15e80bb1d7601f7"
|
|
25
25
|
}
|
package/src/SVGPackager.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
export default (new Packager({
|
|
16
16
|
async package({bundle, bundleGraph, getInlineBundleContents}) {
|
|
17
17
|
const assets = [];
|
|
18
|
-
bundle.traverseAssets(asset => {
|
|
18
|
+
bundle.traverseAssets((asset) => {
|
|
19
19
|
assets.push(asset);
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -48,8 +48,8 @@ export default (new Packager({
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
let {html: svg} = await posthtml([
|
|
51
|
-
tree => insertBundleReferences(referencedBundles, tree),
|
|
52
|
-
tree =>
|
|
51
|
+
(tree) => insertBundleReferences(referencedBundles, tree),
|
|
52
|
+
(tree) =>
|
|
53
53
|
replaceInlineAssetContent(bundleGraph, getInlineBundleContents, tree),
|
|
54
54
|
]).process(code, options);
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ export default (new Packager({
|
|
|
58
58
|
bundleGraph,
|
|
59
59
|
contents: svg,
|
|
60
60
|
relative: false,
|
|
61
|
-
getReplacement: contents => contents.replace(/"/g, '"'),
|
|
61
|
+
getReplacement: (contents) => contents.replace(/"/g, '"'),
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
return replaceInlineReferences({
|
|
@@ -81,7 +81,7 @@ async function replaceInlineAssetContent(
|
|
|
81
81
|
tree,
|
|
82
82
|
) {
|
|
83
83
|
const inlineNodes = [];
|
|
84
|
-
tree.walk(node => {
|
|
84
|
+
tree.walk((node) => {
|
|
85
85
|
if (node.attrs && node.attrs['data-parcel-key']) {
|
|
86
86
|
inlineNodes.push(node);
|
|
87
87
|
}
|
|
@@ -124,7 +124,7 @@ async function getAssetContent(
|
|
|
124
124
|
let inlineBundle: ?Bundle;
|
|
125
125
|
bundleGraph.traverseBundles((bundle, context, {stop}) => {
|
|
126
126
|
const entryAssets = bundle.getEntryAssets();
|
|
127
|
-
if (entryAssets.some(a => a.uniqueKey === assetId)) {
|
|
127
|
+
if (entryAssets.some((a) => a.uniqueKey === assetId)) {
|
|
128
128
|
inlineBundle = bundle;
|
|
129
129
|
stop();
|
|
130
130
|
}
|
|
@@ -162,7 +162,7 @@ function insertBundleReferences(siblingBundles, tree) {
|
|
|
162
162
|
|
|
163
163
|
tree.unshift(...stylesheets);
|
|
164
164
|
if (scripts.length > 0) {
|
|
165
|
-
tree.match({tag: 'svg'}, node => {
|
|
165
|
+
tree.match({tag: 'svg'}, (node) => {
|
|
166
166
|
node.content.unshift(...scripts);
|
|
167
167
|
});
|
|
168
168
|
}
|