Skip to content

Commit 0021144

Browse files
authored
Fork sax (#1369)
There was a lot of PR with switching to another xml parser because sax is not maintained for almost 4 years already. Though switching parser to solve a few problems may introduce many new bugs. This is why we decided to fork sax and maintain own version. For initial release I removed node streams support which allows to get rid from some magic in browser bundle build config and got rid from String.fromCodePoint polyfill. Forked package is here https://github.com/svg/sax
1 parent 797a8e8 commit 0021144

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

lib/svgo/svg2js.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var SAX = require('sax'),
3+
var SAX = require('@trysound/sax'),
44
JSAPI = require('./jsAPI.js'),
55
CSSClassList = require('./css-class-list'),
66
CSSStyleDeclaration = require('./css-style-declaration'),

package-lock.json

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@
8989
]
9090
},
9191
"dependencies": {
92+
"@trysound/sax": "0.1.0",
9293
"chalk": "^4.1.0",
9394
"commander": "^7.1.0",
9495
"css-select": "^3.1.2",
9596
"css-select-base-adapter": "^0.1.1",
9697
"css-tree": "^1.1.2",
9798
"csso": "^4.2.0",
98-
"sax": "~1.2.4",
9999
"stable": "^0.1.8"
100100
},
101101
"devDependencies": {

rollup.config.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
plugins: [
1515
{
1616
resolveId(importee, importer) {
17-
if (['os', 'stream', 'string_decoder'].includes(importee)) {
17+
if (importee === 'os') {
1818
return importee;
1919
}
2020
// see https://github.com/csstree/csstree/pull/152
@@ -26,12 +26,6 @@ export default {
2626
if (id === 'os') {
2727
return `export var EOL = '\\n'`;
2828
}
29-
if (id === 'stream') {
30-
return `export function Stream(){}`;
31-
}
32-
if (id === 'string_decoder') {
33-
return `export default null`;
34-
}
3529
},
3630
},
3731
nodeResolve({ browser: true, preferBuiltins: false }),

0 commit comments

Comments
 (0)