| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -5,6 +5,13 @@ import { parseArgs } from 'node:util';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { globSync } from 'tinyglobby';
 | 
					 | 
					 | 
					 | 
					import { globSync } from 'tinyglobby';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { compile, compileModule, parse, migrate } from 'svelte/compiler';
 | 
					 | 
					 | 
					 | 
					import { compile, compileModule, parse, migrate } from 'svelte/compiler';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					// toggle these to change what gets written to sandbox/output
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					const AST = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					const MIGRATE = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					const FROM_HTML = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					const FROM_TREE = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					const DEV = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const argv = parseArgs({ options: { runes: { type: 'boolean' } }, args: process.argv.slice(2) });
 | 
					 | 
					 | 
					 | 
					const argv = parseArgs({ options: { runes: { type: 'boolean' } }, args: process.argv.slice(2) });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const cwd = fileURLToPath(new URL('.', import.meta.url)).slice(0, -1);
 | 
					 | 
					 | 
					 | 
					const cwd = fileURLToPath(new URL('.', import.meta.url)).slice(0, -1);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -51,6 +58,7 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							mkdirp(path.dirname(output_js));
 | 
					 | 
					 | 
					 | 
							mkdirp(path.dirname(output_js));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (generate === 'client') {
 | 
					 | 
					 | 
					 | 
							if (generate === 'client') {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								if (AST) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									const ast = parse(source, {
 | 
					 | 
					 | 
					 | 
									const ast = parse(source, {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										modern: true
 | 
					 | 
					 | 
					 | 
										modern: true
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									});
 | 
					 | 
					 | 
					 | 
									});
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -63,7 +71,9 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											'\t'
 | 
					 | 
					 | 
					 | 
											'\t'
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										)
 | 
					 | 
					 | 
					 | 
										)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									);
 | 
					 | 
					 | 
					 | 
									);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								if (MIGRATE) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									try {
 | 
					 | 
					 | 
					 | 
									try {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										const migrated = migrate(source);
 | 
					 | 
					 | 
					 | 
										const migrated = migrate(source);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										write(`${cwd}/output/migrated/${file}`, migrated.code);
 | 
					 | 
					 | 
					 | 
										write(`${cwd}/output/migrated/${file}`, migrated.code);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -71,9 +81,14 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										console.warn(`Error migrating ${file}`, e);
 | 
					 | 
					 | 
					 | 
										console.warn(`Error migrating ${file}`, e);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									}
 | 
					 | 
					 | 
					 | 
									}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}
 | 
					 | 
					 | 
					 | 
								}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							const compiled = compile(source, {
 | 
					 | 
					 | 
					 | 
							let from_html;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								dev: false,
 | 
					 | 
					 | 
					 | 
							let from_tree;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if (generate === 'server' || FROM_HTML) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								from_html = compile(source, {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									dev: DEV,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									filename: input,
 | 
					 | 
					 | 
					 | 
									filename: input,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									generate,
 | 
					 | 
					 | 
					 | 
									generate,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									runes: argv.values.runes,
 | 
					 | 
					 | 
					 | 
									runes: argv.values.runes,
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -82,17 +97,13 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									}
 | 
					 | 
					 | 
					 | 
									}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								});
 | 
					 | 
					 | 
					 | 
								});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							for (const warning of compiled.warnings) {
 | 
					 | 
					 | 
					 | 
								write(output_js, from_html.js.code + '\n//# sourceMappingURL=' + path.basename(output_map));
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								console.warn(warning.code);
 | 
					 | 
					 | 
					 | 
								write(output_map, from_html.js.map.toString());
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								console.warn(warning.frame);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							}
 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							write(output_js, compiled.js.code + '\n//# sourceMappingURL=' + path.basename(output_map));
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							write(output_map, compiled.js.map.toString());
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// generate with fragments: 'tree'
 | 
					 | 
					 | 
					 | 
							// generate with fragments: 'tree'
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (generate === 'client') {
 | 
					 | 
					 | 
					 | 
							if (generate === 'client' && FROM_TREE) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								const compiled = compile(source, {
 | 
					 | 
					 | 
					 | 
								from_tree = compile(source, {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									dev: false,
 | 
					 | 
					 | 
					 | 
									dev: false,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									filename: input,
 | 
					 | 
					 | 
					 | 
									filename: input,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									generate,
 | 
					 | 
					 | 
					 | 
									generate,
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -106,14 +117,23 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								const output_js = `${cwd}/output/${generate}/${file}.tree.js`;
 | 
					 | 
					 | 
					 | 
								const output_js = `${cwd}/output/${generate}/${file}.tree.js`;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								const output_map = `${cwd}/output/${generate}/${file}.tree.js.map`;
 | 
					 | 
					 | 
					 | 
								const output_map = `${cwd}/output/${generate}/${file}.tree.js.map`;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								write(output_js, compiled.js.code + '\n//# sourceMappingURL=' + path.basename(output_map));
 | 
					 | 
					 | 
					 | 
								write(output_js, from_tree.js.code + '\n//# sourceMappingURL=' + path.basename(output_map));
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								write(output_map, compiled.js.map.toString());
 | 
					 | 
					 | 
					 | 
								write(output_map, from_tree.js.map.toString());
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							const compiled = from_html ?? from_tree;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if (compiled) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								for (const warning of compiled.warnings) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									console.warn(warning.code);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									console.warn(warning.frame);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}
 | 
					 | 
					 | 
					 | 
								}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if (compiled.css) {
 | 
					 | 
					 | 
					 | 
								if (compiled.css) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									write(output_css, compiled.css.code);
 | 
					 | 
					 | 
					 | 
									write(output_css, compiled.css.code);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}
 | 
					 | 
					 | 
					 | 
								}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							}
 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for (const file of js_modules) {
 | 
					 | 
					 | 
					 | 
						for (const file of js_modules) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							const input = `${cwd}/src/${file}`;
 | 
					 | 
					 | 
					 | 
							const input = `${cwd}/src/${file}`;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |