run.js — svelte Source File
Architecture documentation for run.js, a javascript file in the svelte codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 40c11420_ba58_e356_99ba_bf343caa1509["run.js"] f596e027_a951_36c9_7695_83acc4f0d6b9["node:fs"] 40c11420_ba58_e356_99ba_bf343caa1509 --> f596e027_a951_36c9_7695_83acc4f0d6b9 f8929fbd_6327_2bb8_f43b_31a3db2e4d74["node:path"] 40c11420_ba58_e356_99ba_bf343caa1509 --> f8929fbd_6327_2bb8_f43b_31a3db2e4d74 1cb33a46_d09d_1289_a578_521205c56653["node:url"] 40c11420_ba58_e356_99ba_bf343caa1509 --> 1cb33a46_d09d_1289_a578_521205c56653 a91e5194_42a3_b3ed_4280_e7cc42897b45["node:util"] 40c11420_ba58_e356_99ba_bf343caa1509 --> a91e5194_42a3_b3ed_4280_e7cc42897b45 2db0e77d_ac2f_3ebe_a623_89635ba685ad["tinyglobby"] 40c11420_ba58_e356_99ba_bf343caa1509 --> 2db0e77d_ac2f_3ebe_a623_89635ba685ad a8d49317_f479_a216_78e7_48c9e32499d5["compiler"] 40c11420_ba58_e356_99ba_bf343caa1509 --> a8d49317_f479_a216_78e7_48c9e32499d5 style 40c11420_ba58_e356_99ba_bf343caa1509 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import { globSync } from 'tinyglobby';
import { compile, compileModule, parse, print, 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 PRINT = false;
const argv = parseArgs({ options: { runes: { type: 'boolean' } }, args: process.argv.slice(2) });
const cwd = fileURLToPath(new URL('.', import.meta.url)).slice(0, -1);
// empty output directory
if (fs.existsSync(`${cwd}/output`)) {
for (const file of fs.readdirSync(`${cwd}/output`)) {
if (file === '.gitkeep') continue;
try {
fs.rmSync(`${cwd}/output/${file}`, { recursive: true });
} catch {}
}
}
/** @param {string} dir */
function mkdirp(dir) {
try {
fs.mkdirSync(dir, { recursive: true });
} catch {}
}
/**
* @param {string} file
* @param {string} contents
*/
function write(file, contents) {
mkdirp(path.dirname(file));
fs.writeFileSync(file, contents);
}
const svelte_modules = globSync('**/*.svelte', { cwd: `${cwd}/src` });
const js_modules = globSync('**/*.js', { cwd: `${cwd}/src` });
for (const generate of /** @type {const} */ (['client', 'server'])) {
console.error(`\n--- generating ${generate} ---\n`);
for (const file of svelte_modules) {
const input = `${cwd}/src/${file}`;
const source = fs.readFileSync(input, 'utf-8');
const output_js = `${cwd}/output/${generate}/${file}.js`;
const output_map = `${cwd}/output/${generate}/${file}.js.map`;
const output_css = `${cwd}/output/${generate}/${file}.css`;
mkdirp(path.dirname(output_js));
// ... (104 more lines)
Domain
Subdomains
Dependencies
- compiler
- node:fs
- node:path
- node:url
- node:util
- tinyglobby
Source
Frequently Asked Questions
What does run.js do?
run.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Parser subdomain.
What functions are defined in run.js?
run.js defines 2 function(s): mkdirp, write.
What does run.js depend on?
run.js imports 6 module(s): compiler, node:fs, node:path, node:url, node:util, tinyglobby.
Where is run.js in the architecture?
run.js is located at playgrounds/sandbox/run.js (domain: Compiler, subdomain: Parser, directory: playgrounds/sandbox).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free