File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ import virtual from '@rollup/plugin-virtual';
5
5
import { nodeResolve } from '@rollup/plugin-node-resolve' ;
6
6
import { compile } from 'svelte/compiler' ;
7
7
8
+ /**
9
+ * @param {string } entry
10
+ */
8
11
async function bundle_code ( entry ) {
9
12
const bundle = await rollup ( {
10
13
input : '__entry__' ,
Original file line number Diff line number Diff line change @@ -54,11 +54,23 @@ for (const category of fs.readdirSync('messages')) {
54
54
}
55
55
}
56
56
57
+ /**
58
+ * @param {string } name
59
+ * @param {string } dest
60
+ */
57
61
function transform ( name , dest ) {
58
62
const source = fs
59
63
. readFileSync ( new URL ( `./templates/${ name } .js` , import . meta. url ) , 'utf-8' )
60
64
. replace ( / \r \n / g, '\n' ) ;
61
65
66
+ /**
67
+ * @type {Array<{
68
+ * type: string;
69
+ * value: string;
70
+ * start: number;
71
+ * end: number
72
+ * }>}
73
+ */
62
74
const comments = [ ] ;
63
75
64
76
let ast = acorn . parse ( source , {
@@ -135,6 +147,7 @@ function transform(name, dest) {
135
147
136
148
for ( const code in category ) {
137
149
const { messages } = category [ code ] ;
150
+ /** @type {string[] } */
138
151
const vars = [ ] ;
139
152
140
153
const group = messages . map ( ( text , i ) => {
@@ -225,7 +238,7 @@ function transform(name, dest) {
225
238
Block ( node , context ) {
226
239
if ( ! node . value . includes ( 'PARAMETER' ) ) return ;
227
240
228
- const value = node . value
241
+ const value = /** @type { string } */ ( node . value )
229
242
. split ( '\n' )
230
243
. map ( ( line ) => {
231
244
if ( line === ' * MESSAGE' ) {
Original file line number Diff line number Diff line change 31
31
}
32
32
},
33
33
"include" : [
34
- " ./src" ,
34
+ " ./*.js" ,
35
+ " ./scripts/" ,
36
+ " ./src/" ,
35
37
" ./tests/*/test.ts" ,
36
38
" ./tests/runtime-browser/test-ssr.ts" ,
37
39
" ./tests/*/samples/*/_config.js"
38
40
],
39
- "exclude" : [" ./src/compiler/optimizer" ]
41
+ "exclude" : [" ./scripts/process-messages/templates/ " , " ./ src/compiler/optimizer/ " ]
40
42
}
You can’t perform that action at this time.
0 commit comments