Home / File/ download.js — svelte Source File

download.js — svelte Source File

Architecture documentation for download.js, a javascript file in the svelte codebase. 5 imports, 0 dependents.

File javascript Compiler Parser 5 imports 20 functions

Entity Profile

Dependency Diagram

graph LR
  65d20932_41e6_eeee_7338_5dd0682e5e42["download.js"]
  f596e027_a951_36c9_7695_83acc4f0d6b9["node:fs"]
  65d20932_41e6_eeee_7338_5dd0682e5e42 --> f596e027_a951_36c9_7695_83acc4f0d6b9
  f8929fbd_6327_2bb8_f43b_31a3db2e4d74["node:path"]
  65d20932_41e6_eeee_7338_5dd0682e5e42 --> f8929fbd_6327_2bb8_f43b_31a3db2e4d74
  a91e5194_42a3_b3ed_4280_e7cc42897b45["node:util"]
  65d20932_41e6_eeee_7338_5dd0682e5e42 --> a91e5194_42a3_b3ed_4280_e7cc42897b45
  e3192c44_2236_3f27_3156_57dc06a450bd["node:child_process"]
  65d20932_41e6_eeee_7338_5dd0682e5e42 --> e3192c44_2236_3f27_3156_57dc06a450bd
  51a000b7_7786_2338_73e8_985cdfc2d85c["playwright"]
  65d20932_41e6_eeee_7338_5dd0682e5e42 --> 51a000b7_7786_2338_73e8_985cdfc2d85c
  style 65d20932_41e6_eeee_7338_5dd0682e5e42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs';
import path from 'node:path';
import { parseArgs } from 'node:util';
import { execSync } from 'node:child_process';
import { chromium } from 'playwright';

const { values, positionals } = parseArgs({
	options: {
		'create-test': {
			type: 'string'
		}
	},
	allowPositionals: true
});

const create_test_name = values['create-test'] ?? null;
const url_arg = positionals[0];

if (!url_arg) {
	console.error(`Missing URL argument`);
	process.exit(1);
}

const base_dir = import.meta.dirname;

/**
 * Check if the argument is a local directory path
 * @param {string} arg
 * @returns {boolean}
 */
function is_local_directory(arg) {
	try {
		return fs.existsSync(arg) && fs.statSync(arg).isDirectory();
	} catch {
		return false;
	}
}

// Check if it's a local directory first (before URL parsing)
const is_local = is_local_directory(url_arg);

const resolved_test_path = ['runtime-runes', 'runtime-legacy']
	.map((d) => path.resolve(`${base_dir}/../../../packages/svelte/tests/${d}/samples/${url_arg}`))
	.find(fs.existsSync);

/** @type {URL | null} */
let url = null;

if (!is_local && !resolved_test_path) {
	try {
		url = new URL(url_arg);
	} catch (e) {
		console.error(`${url_arg} is not a valid URL or local directory`);
		process.exit(1);
	}
}

/**
 * Check if URL is a GitHub repository URL
 * @param {URL} url
// ... (680 more lines)

Domain

Subdomains

Dependencies

  • node:child_process
  • node:fs
  • node:path
  • node:util
  • playwright

Frequently Asked Questions

What does download.js do?
download.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 download.js?
download.js defines 20 function(s): build_route_tree, clone_github_repo, clone_stackblitz_github_project, convert_sveltekit_project, convert_vite_project, detect_project_type, download_stackblitz_project, extract_stackblitz_github_info, get_all_files, get_child_routes, and 10 more.
What does download.js depend on?
download.js imports 5 module(s): node:child_process, node:fs, node:path, node:util, playwright.
Where is download.js in the architecture?
download.js is located at playgrounds/sandbox/scripts/download.js (domain: Compiler, subdomain: Parser, directory: playgrounds/sandbox/scripts).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free