Skip to content

Commit d49e2ae

Browse files
authored
chore: explicit reexports (#10970)
* explicit re-exports * explicit re-exports * regenerate types
1 parent 8a758d8 commit d49e2ae

File tree

22 files changed

+192
-182
lines changed

22 files changed

+192
-182
lines changed

packages/svelte/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@
137137
"knip": {
138138
"entry": [
139139
"src/*/index.js",
140-
"src/*/public.d.ts"
140+
"src/index-client.ts",
141+
"src/index-server.ts",
142+
"src/index.d.ts"
141143
],
142144
"project": [
143145
"src/**"

packages/svelte/src/compiler/phases/2-analyze/utils/push_array.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export function client_component(source, analysis, options) {
275275

276276
const setter = b.set(key, [
277277
b.stmt(b.call(b.id(name), b.id('$$value'))),
278-
b.stmt(b.call('$.flushSync'))
278+
b.stmt(b.call('$.flush_sync'))
279279
]);
280280

281281
if (analysis.runes && binding.initial) {

packages/svelte/src/compiler/utils/mapped_code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export function merge_with_preprocessor_map(result, options, source_name) {
412412
* @param {string} from
413413
* @param {string} to
414414
*/
415-
export function get_relative_path(from, to) {
415+
function get_relative_path(from, to) {
416416
// Don't use node's utils here to ensure the compiler is usable in a browser environment
417417
const from_parts = from.split(/[/\\]/);
418418
const to_parts = to.split(/[/\\]/);

packages/svelte/src/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export const DOMBooleanAttributes = [
9595
];
9696

9797
export const namespace_svg = 'http://www.w3.org/2000/svg';
98-
export const namespace_html = 'http://www.w3.org/1999/xhtml';
9998

10099
// while `input` is also an interactive element, it is never moved by the browser, so we don't need to check for it
101100
export const interactive_elements = new Set([

packages/svelte/src/index-client.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { current_component_context, untrack } from './internal/client/runtime.js';
1+
import { current_component_context, flush_sync, untrack } from './internal/client/runtime.js';
22
import { is_array } from './internal/client/utils.js';
33
import { user_effect } from './internal/client/index.js';
44

@@ -167,19 +167,24 @@ function init_update_callbacks(context) {
167167
return (context.u ??= { a: [], b: [], m: [] });
168168
}
169169

170-
// TODO bring implementations in here
171-
// (except probably untrack — do we want to expose that, if there's also a rune?)
170+
/**
171+
* Synchronously flushes any pending state changes and those that result from it.
172+
* @param {() => void} [fn]
173+
* @returns {void}
174+
*/
175+
export function flushSync(fn) {
176+
flush_sync(fn);
177+
}
178+
179+
export { unstate } from './internal/client/proxy.js';
180+
181+
export { hydrate, mount, unmount } from './internal/client/render.js';
182+
172183
export {
173-
flushSync,
174-
mount,
175-
hydrate,
176-
tick,
177-
unmount,
178-
untrack,
179-
unstate,
180-
createRoot,
181-
hasContext,
182184
getContext,
183185
getAllContexts,
184-
setContext
185-
} from './internal/client/index.js';
186+
hasContext,
187+
setContext,
188+
tick,
189+
untrack
190+
} from './internal/client/runtime.js';

packages/svelte/src/index-server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export {
1111
setContext,
1212
tick,
1313
unmount,
14-
untrack,
15-
createRoot
14+
untrack
1615
} from './index-client.js';
1716

1817
/** @returns {void} */

packages/svelte/src/internal/client/dev/ownership.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const boundaries = {};
99
const chrome_pattern = /at (?:.+ \()?(.+):(\d+):(\d+)\)?$/;
1010
const firefox_pattern = /@(.+):(\d+):(\d+)$/;
1111

12-
export function get_stack() {
12+
function get_stack() {
1313
const stack = new Error().stack;
1414
if (!stack) return null;
1515

packages/svelte/src/internal/client/dom/blocks/await.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { is_promise } from '../../../common.js';
22
import {
33
current_component_context,
4-
flushSync,
4+
flush_sync,
55
set_current_component_context,
66
set_current_effect,
77
set_current_reaction
@@ -48,7 +48,7 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
4848

4949
// without this, the DOM does not update until two ticks after the promise,
5050
// resolves which is unexpected behaviour (and somewhat irksome to test)
51-
flushSync();
51+
flush_sync();
5252

5353
return e;
5454
}

packages/svelte/src/internal/client/dom/elements/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function split_srcset(srcset) {
273273
* @param {string | undefined | null} srcset
274274
* @returns {boolean}
275275
*/
276-
export function srcset_url_equal(element, srcset) {
276+
function srcset_url_equal(element, srcset) {
277277
var element_urls = split_srcset(element.srcset);
278278
var urls = split_srcset(srcset ?? '');
279279

0 commit comments

Comments
 (0)