We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1af017 commit d9e5ad7Copy full SHA for d9e5ad7
rollup/rollup-plugin-remove-vscode-declare-module.ts
@@ -9,20 +9,15 @@ const plugin: PluginImpl<{}> = () => {
9
if (id.endsWith('@types/vscode/index.d.ts')) {
10
const lines = code.split('\n')
11
let index = lines.indexOf('declare module \'vscode\' {')
12
+ if (index < 0) throw new Error('Module declaration not found')
13
+
14
lines.splice(index, 1)
- if (index >= 0) {
- let end = false
15
- while (!end) {
16
- if (lines[index] === '}') {
17
- lines.splice(index, 1)
18
- end = true
19
- } else {
20
- // unindent
21
- lines[index] = lines[index].slice(4)
22
- }
23
- index++
24
+ for (; lines[index] !== '}'; index++) {
+ // unindent
+ lines[index] = lines[index].slice(4)
25
}
+ lines.splice(index, 1)
26
return lines.join('\n')
27
28
return code
0 commit comments