From cf5c34592eaefb6715c61d1393888b2a26050574 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Sat, 27 Feb 2021 18:00:56 +0800 Subject: [PATCH] add typings script to prepack --- package.json | 2 +- src/snapshot.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5c177d94..1881d217 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/snapshot.ts b/src/snapshot.ts index ad220d06..09991b14 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -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);