1- import svelte from " rollup-plugin-svelte" ;
2- import resolve from " @rollup/plugin-node-resolve" ;
3- import commonjs from " @rollup/plugin-commonjs" ;
4- import terser from " @rollup/plugin-terser" ;
5- import sveltePreprocess from " svelte-preprocess" ;
6- import typescript from " @rollup/plugin-typescript" ;
7- import json from " @rollup/plugin-json" ;
1+ import svelte from ' rollup-plugin-svelte' ;
2+ import resolve from ' @rollup/plugin-node-resolve' ;
3+ import commonjs from ' @rollup/plugin-commonjs' ;
4+ import terser from ' @rollup/plugin-terser' ;
5+ import sveltePreprocess from ' svelte-preprocess' ;
6+ import typescript from ' @rollup/plugin-typescript' ;
7+ import json from ' @rollup/plugin-json' ;
88import { svelteSVG } from 'rollup-plugin-svelte-svg' ;
99import builtins from 'rollup-plugin-node-builtins' ;
1010import path from 'path' ;
1111import fs from 'fs' ;
1212import css from 'rollup-plugin-css-only' ;
13- import { fileURLToPath } from 'url' ;
13+ import { fileURLToPath } from 'url' ;
1414
15- import tailwindcss from " tailwindcss" ;
16- import autoprefixer from " autoprefixer" ;
15+ import tailwindcss from ' tailwindcss' ;
16+ import autoprefixer from ' autoprefixer' ;
1717
1818const production = ! process . env . ROLLUP_WATCH ;
1919
@@ -22,61 +22,68 @@ const __filename = fileURLToPath(import.meta.url);
2222const __dirname = path . dirname ( __filename ) ;
2323
2424export default fs
25- . readdirSync ( path . join ( __dirname , "webviews" , "pages" ) )
26- . map ( ( input ) => {
27- const name = input . split ( "." ) [ 0 ] ;
28- return {
29- input : "webviews/pages/" + input ,
30- output : {
31- sourcemap : ! production ,
32- format : "iife" ,
33- name : "app" ,
34- file : "out/compiled/" + name + ".js" ,
35- assetFileNames : name + '.css' ,
25+ . readdirSync ( path . join ( __dirname , 'webviews' , 'pages' ) )
26+ . map ( ( input ) => {
27+ const name = input . split ( '.' ) [ 0 ] ;
28+ return {
29+ input : 'webviews/pages/' + input ,
30+ output : {
31+ sourcemap : ! production ,
32+ format : 'iife' ,
33+ name : 'app' ,
34+ file : 'out/compiled/' + name + '.js' ,
35+ assetFileNames : name + '.css' ,
36+ } ,
37+ onwarn : function ( message ) {
38+ if ( message . code !== 'EVAL' ) {
39+ console . log ( JSON . stringify ( message ) ) ;
40+ throw new Error ( message ) ;
41+ }
42+ } ,
43+ plugins : [
44+ svelte ( {
45+ compilerOptions : {
46+ // enable run-time checks when not in production
47+ dev : ! production ,
48+ } ,
49+ preprocess : sveltePreprocess ( {
50+ sourceMap : ! production ,
51+ postcss : {
52+ plugins : [ tailwindcss , autoprefixer ] ,
3653 } ,
37- onwarn : function ( message ) {
38- if ( message . code !== 'EVAL' ) {
39- console . log ( JSON . stringify ( message ) ) ;
40- throw new Error ( message ) ;
41- }
42- } ,
43- plugins : [
44- svelte ( {
45- compilerOptions : {
46- // enable run-time checks when not in production
47- dev : ! production ,
48- } ,
49- preprocess : sveltePreprocess ( {
50- sourceMap : ! production ,
51- postcss : {
52- plugins : [ tailwindcss , autoprefixer ] ,
53- } ,
54- } ) ,
55- emitCss : production ,
56- } ) ,
57- css ( ) ,
58- json ( ) ,
59- resolve ( {
60- browser : true ,
61- dedupe : [ "svelte" ] ,
62- preferBuiltins : false
63- } ) ,
64- commonjs ( ) ,
65- builtins ( ) ,
66- svelteSVG ( {
67- // optional SVGO options
68- // pass empty object to enable defaults
69- svgo : { } ,
70- } ) ,
71- production && terser ( ) ,
72- typescript ( {
73- tsconfig : "webviews/tsconfig.json" ,
74- sourceMap : ! production ,
75- inlineSources : ! production ,
76- } ) ,
77- ] ,
78- watch : {
79- clearScreen : false ,
80- } ,
81- } ;
82- } ) ;
54+ } ) ,
55+ emitCss : production ,
56+ } ) ,
57+ css ( ) ,
58+ json ( ) ,
59+ resolve ( {
60+ browser : true ,
61+ dedupe : [ 'svelte' ] ,
62+ preferBuiltins : false ,
63+ } ) ,
64+ commonjs ( ) ,
65+ builtins ( ) ,
66+ svelteSVG ( {
67+ // optional SVGO options
68+ // pass empty object to enable defaults
69+ svgo : { } ,
70+ } ) ,
71+ production && terser ( ) ,
72+ typescript ( {
73+ tsconfig : 'webviews/tsconfig.json' ,
74+ sourceMap : ! production ,
75+ inlineSources : ! production ,
76+ exclude : [
77+ '__mocks__' ,
78+ '.github' ,
79+ 'eslint.config.mjs' ,
80+ 'jest.config.mjs' ,
81+ 'test/**' ,
82+ ] ,
83+ } ) ,
84+ ] ,
85+ watch : {
86+ clearScreen : false ,
87+ } ,
88+ } ;
89+ } ) ;
0 commit comments