Skip to content

Commit 4958e4a

Browse files
authored
fix: regression triple slash including in .d.ts (#1794)
* fix: regression triple slash including in `d.ts` * fix: remove unnecesary file
1 parent bf2a635 commit 4958e4a

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function createConfig(format, _output, plugins = []) {
174174
declaration: shouldEmitDeclarations,
175175
declarationMap: shouldEmitDeclarations
176176
},
177-
exclude: ['**/test', 'test-dts', 'e2e', 'scripts']
177+
exclude: ['**/test', 'test-dts', 'e2e', 'scripts', '*.config.ts']
178178
}
179179
})
180180
// we only need to check TS and generate declarations once for each build.

scripts/postprocess.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function replaceWithCompositionApi(source: string, target: string) {
88
)
99
}
1010

11-
async function main() {
11+
async function replaceVueI18nBridge() {
1212
let source = await fs.readFile(
1313
path.resolve(
1414
__dirname,
@@ -37,6 +37,39 @@ async function main() {
3737
)
3838
}
3939

40+
const RE_TRIPLE_SLASH_REFERENCE = /\/\/\/ <reference types="([^"]*)" \/>/
41+
42+
function replaceTripleSlashReference(source: string) {
43+
return source
44+
.replace(RE_TRIPLE_SLASH_REFERENCE, ``)
45+
.replace(RE_TRIPLE_SLASH_REFERENCE, '')
46+
}
47+
48+
async function replaceMessageCompiler() {
49+
let source = await fs.readFile(
50+
path.resolve(
51+
__dirname,
52+
'../packages/message-compiler/dist/message-compiler.d.ts'
53+
),
54+
'utf8'
55+
)
56+
57+
source = replaceTripleSlashReference(source)
58+
59+
await fs.writeFile(
60+
path.resolve(
61+
__dirname,
62+
'../packages/message-compiler/dist/message-compiler.d.ts'
63+
),
64+
source
65+
)
66+
}
67+
68+
async function main() {
69+
await replaceVueI18nBridge()
70+
await replaceMessageCompiler()
71+
}
72+
4073
main().catch(err => {
4174
console.error(err)
4275
process.exit(1)

0 commit comments

Comments
 (0)