Skip to content

Commit 54d0b12

Browse files
Add sourceURL comment
1 parent 0f9db34 commit 54d0b12

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/utils/build.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ function prefixPlugin (prefixMessage) {
6161
}
6262
}
6363

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

6675
/**
@@ -81,6 +90,7 @@ export async function rollupScript (params) {
8190
supportsMozProxies = false
8291
} = params
8392

93+
const suffixMessage = `/*# sourceURL=duckduckgo-privacy-protection.js?scope=${name} */`
8494
// The code is using a global, that we define here which means once tree shaken we get a browser specific output.
8595
const mozProxies = supportsMozProxies
8696

@@ -101,7 +111,8 @@ export async function rollupScript (params) {
101111
'import.meta.injectName': JSON.stringify(platform)
102112
}
103113
}),
104-
prefixPlugin(prefixMessage)
114+
prefixPlugin(prefixMessage),
115+
suffixPlugin(suffixMessage)
105116
]
106117

107118
const bundle = await rollup.rollup({

0 commit comments

Comments
 (0)