add typings script to prepack

This commit is contained in:
Yanzhen Yu
2021-02-27 18:00:56 +08:00
parent 4bf3073d80
commit cf5c34592e
2 changed files with 6 additions and 2 deletions

View File

@@ -4,7 +4,7 @@
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer",
"scripts": {
"prepare": "npm run prepack",
"prepack": "npm run bundle",
"prepack": "npm run bundle && npm run typings",
"test": "cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.ts",
"bundle": "rollup --config",
"typings": "tsc -d --declarationDir typings"

View File

@@ -165,7 +165,11 @@ export function transformAttribute(
// relative path in attribute
if (name === 'src' || ((name === 'href' || name === 'xlink:href') && value)) {
return absoluteToDoc(doc, value);
} else if (name === 'background' && value && (tagName === 'table' || tagName == 'td' || tagName == 'th')) {
} else if (
name === 'background' &&
value &&
(tagName === 'table' || tagName === 'td' || tagName === 'th')
) {
return absoluteToDoc(doc, value);
} else if (name === 'srcset' && value) {
return getAbsoluteSrcsetString(doc, value);