Home / File/ shared.ts — svelte Source File

shared.ts — svelte Source File

Architecture documentation for shared.ts, a typescript file in the svelte codebase. 19 imports, 3 dependents.

File typescript BuildSystem QualityControl 19 imports 3 dependents 7 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831["shared.ts"]
  e97e8c41_1b06_4e9a_29f3_64dbb37dee3c["helpers.js"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> e97e8c41_1b06_4e9a_29f3_64dbb37dee3c
  40a894df_04e7_906d_8c12_9e2e7b588e57["compile_directory"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> 40a894df_04e7_906d_8c12_9e2e7b588e57
  7e13368c_af2f_099c_e7e1_de404629548f["html_equal.js"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> 7e13368c_af2f_099c_e7e1_de404629548f
  3f18e7a4_4010_5e33_35ee_c53c8401ca03["assert_html_equal"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> 3f18e7a4_4010_5e33_35ee_c53c8401ca03
  1c541d89_49ad_09df_1b04_218f8bcb99e8["assert_html_equal_with_options"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> 1c541d89_49ad_09df_1b04_218f8bcb99e8
  e34c4197_0d2d_5f9c_9313_0d10c3cf054c["animation-helpers.js"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> e34c4197_0d2d_5f9c_9313_0d10c3cf054c
  b2df78f1_f7aa_6fef_0a5c_4dcf959880ff["../suite.js"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> b2df78f1_f7aa_6fef_0a5c_4dcf959880ff
  d8e42d9d_2e3c_635c_19d3_b946a4341c0f["batch.js"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> d8e42d9d_2e3c_635c_19d3_b946a4341c0f
  a199a3f7_5497_5329_2c7c_fc4555548da6["clear"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> a199a3f7_5497_5329_2c7c_fc4555548da6
  f3948b0d_b92a_0767_ba6c_832767f4e2bb["hydration.js"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> f3948b0d_b92a_0767_ba6c_832767f4e2bb
  f596e027_a951_36c9_7695_83acc4f0d6b9["node:fs"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> f596e027_a951_36c9_7695_83acc4f0d6b9
  a9500014_cd8e_60cf_ba5b_777e383da035["promises"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> a9500014_cd8e_60cf_ba5b_777e383da035
  2db0e77d_ac2f_3ebe_a623_89635ba685ad["tinyglobby"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> 2db0e77d_ac2f_3ebe_a623_89635ba685ad
  0089bc1e_86a8_7436_5025_0d4d65a18542["legacy"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> 0089bc1e_86a8_7436_5025_0d4d65a18542
  style 2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as fs from 'node:fs';
import { setImmediate } from 'node:timers/promises';
import { globSync } from 'tinyglobby';
import { createClassComponent } from 'svelte/legacy';
import { proxy } from 'svelte/internal/client';
import { flushSync, hydrate, mount, unmount } from 'svelte';
import { render } from 'svelte/server';
import { afterAll, assert, beforeAll, beforeEach } from 'vitest';
import { async_mode, compile_directory, fragments } from '../helpers.js';
import { assert_html_equal, assert_html_equal_with_options } from '../html_equal.js';
import { raf } from '../animation-helpers.js';
import type { CompileOptions } from '#compiler';
import { suite_with_variants, type BaseTest } from '../suite.js';
import { clear } from '../../src/internal/client/reactivity/batch.js';
import { hydrating } from '../../src/internal/client/dom/hydration.js';

type Assert = typeof import('vitest').assert & {
	htmlEqual(a: string, b: string, description?: string): void;
	htmlEqualWithOptions(
		a: string,
		b: string,
		opts: {
			preserveComments: boolean;
			withoutNormalizeHtml: boolean;
		},
		description?: string
	): void;
};

// TODO remove this shim when we can
// @ts-expect-error
Promise.withResolvers = () => {
	let resolve;
	let reject;

	const promise = new Promise((f, r) => {
		resolve = f;
		reject = r;
	});

	return { promise, resolve, reject };
};

export interface RuntimeTest<Props extends Record<string, any> = Record<string, any>>
	extends BaseTest {
	/** Use e.g. `mode: ['client']` to indicate that this test should never run in server/hydrate modes */
	mode?: Array<'server' | 'async-server' | 'client' | 'hydrate'>;
	/** Temporarily skip specific modes, without skipping the entire test */
	skip_mode?: Array<'server' | 'async-server' | 'client' | 'hydrate'>;
	/** Skip if running with process.env.SVELTE_NO_ASYNC */
	skip_no_async?: boolean;
	/** Skip if running without process.env.SVELTE_NO_ASYNC */
	skip_async?: boolean;
	html?: string;
	ssrHtml?: string;
	compileOptions?: Partial<CompileOptions>;
	props?: Props;
	server_props?: Props;
	id_prefix?: string;
	before_test?: () => void;
// ... (549 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does shared.ts do?
shared.ts is a source file in the svelte codebase, written in typescript. It belongs to the BuildSystem domain, QualityControl subdomain.
What functions are defined in shared.ts?
shared.ts defines 7 function(s): Promise, args, common_setup, ok, run_test_variant, runtime_suite, unhandled_rejection_handler.
What does shared.ts depend on?
shared.ts imports 19 module(s): #compiler, ../suite.js, animation-helpers.js, assert_html_equal, assert_html_equal_with_options, batch.js, clear, client, and 11 more.
What files import shared.ts?
shared.ts is imported by 3 file(s): test.ts, test.ts, test.ts.
Where is shared.ts in the architecture?
shared.ts is located at packages/svelte/tests/runtime-legacy/shared.ts (domain: BuildSystem, subdomain: QualityControl, directory: packages/svelte/tests/runtime-legacy).

Analyze Your Own Codebase

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

Try Supermodel Free