Skip to content

Commit

Permalink
fix(core): don’t include source maps for injected
Browse files Browse the repository at this point in the history
  • Loading branch information
blakebyrnes committed Aug 14, 2023
1 parent 26f627b commit 0c2ee0d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core/lib/InjectedScripts.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import * as fs from 'fs';
import { IPage } from '@ulixee/unblocked-specification/agent/browser/IPage';
import { stringifiedTypeSerializerClass } from '@ulixee/commons/lib/TypeSerializer';
import IDevtoolsSession from '@ulixee/unblocked-specification/agent/browser/IDevtoolsSession';
import { IPage } from '@ulixee/unblocked-specification/agent/browser/IPage';
import * as fs from 'fs';

const pageScripts = {
domStorage: fs.readFileSync(`${__dirname}/../injected-scripts/domStorage.js`, 'utf8'),
indexedDbRestore: fs.readFileSync(`${__dirname}/../injected-scripts/indexedDbRestore.js`, 'utf8'),
indexedDbRestore: fs
.readFileSync(`${__dirname}/../injected-scripts/indexedDbRestore.js`, 'utf8')
.replace(/# sourceMappingURL=.*\.js\.map/g, ''),
interactReplayer: fs.readFileSync(`${__dirname}/../injected-scripts/interactReplayer.js`, 'utf8'),
DomAssertions: fs.readFileSync(`${__dirname}/../injected-scripts/DomAssertions.js`, 'utf8'),
Fetcher: fs.readFileSync(`${__dirname}/../injected-scripts/Fetcher.js`, 'utf8'),
Expand All @@ -30,7 +32,7 @@ window.HERO = {
Fetcher,
DomAssertions,
};
`;
`.replace(/# sourceMappingURL=.*\.js\.map/g, '');

const injectedScript = `(function installInjectedScripts() {
${heroIncludes}
Expand All @@ -40,7 +42,7 @@ ${heroIncludes}
})('${pageEventsCallbackName}');
${pageScripts.domStorage}
})();`;
})();`.replace(/# sourceMappingURL=.*\.js\.map/g, '');

const showInteractionScript = `(function installInteractionsScript() {
const exports = {}; // workaround for ts adding an exports variable
Expand All @@ -56,7 +58,7 @@ if (!('getNodeById' in window)) {
}
${pageScripts.interactReplayer};
})();`;
})();`.replace(/# sourceMappingURL=.*\.js\.map/g, '');

const installedSymbol = Symbol('InjectedScripts.Installed');

Expand Down

0 comments on commit 0c2ee0d

Please sign in to comment.