Skip to content

Commit 7da740e

Browse files
Add sourceURL comment (#472)
1 parent 88125b2 commit 7da740e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/utils/build.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ function prefixPlugin (prefixMessage) {
6262
}
6363
}
6464

65+
function suffixPlugin (suffixMessage) {
66+
return {
67+
name: 'suffix-plugin',
68+
renderChunk (code) {
69+
return `${code}\n${suffixMessage}`
70+
}
71+
}
72+
}
73+
6574
const prefixMessage = '/*! © DuckDuckGo ContentScopeScripts protections https://github.com/duckduckgo/content-scope-scripts/ */'
6675

6776
/**
@@ -89,6 +98,7 @@ export async function rollupScript (params) {
8998
const trackerLookupData = readFileSync('./build/tracker-lookup.json', 'utf8')
9099
trackerLookup = trackerLookupData
91100
}
101+
const suffixMessage = `/*# sourceURL=duckduckgo-privacy-protection.js?scope=${name} */`
92102
// The code is using a global, that we define here which means once tree shaken we get a browser specific output.
93103
const mozProxies = supportsMozProxies
94104
const plugins = [
@@ -113,6 +123,10 @@ export async function rollupScript (params) {
113123
prefixPlugin(prefixMessage)
114124
]
115125

126+
if (platform === 'firefox') {
127+
plugins.push(suffixPlugin(suffixMessage))
128+
}
129+
116130
const bundle = await rollup.rollup({
117131
input: scriptPath,
118132
plugins

0 commit comments

Comments
 (0)