chore: reshuffle some code (#10967)

* remove superfluous .d.ts file

* remove main/main-client.js to index-client.js

* move main/main-server.js to index-server.js

* move main/public.d.ts to index.d.ts

* move ambient.d.ts

* fix

* fix
pull/10968/head
Rich Harris 7 months ago committed by GitHub
parent de6a802435
commit eaa243d2da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -16,13 +16,13 @@
"*.d.ts",
"README.md"
],
"module": "src/main/main-client.js",
"main": "src/main/main-client.js",
"module": "src/index-client.js",
"main": "src/index-client.js",
"exports": {
".": {
"types": "./types/index.d.ts",
"browser": "./src/main/main-client.js",
"default": "./src/main/main-server.js"
"browser": "./src/index-client.js",
"default": "./src/index-server.js"
},
"./package.json": "./package.json",
"./action": {

@ -22,7 +22,7 @@ fs.writeFileSync(`${dir}/types/compiler/interfaces.d.ts`, "import '../index.js';
await createBundle({
output: `${dir}/types/index.d.ts`,
modules: {
[pkg.name]: `${dir}/src/main/public.d.ts`,
[pkg.name]: `${dir}/src/index.d.ts`,
[`${pkg.name}/action`]: `${dir}/src/action/public.d.ts`,
[`${pkg.name}/animate`]: `${dir}/src/animate/public.d.ts`,
[`${pkg.name}/compiler`]: `${dir}/src/compiler/index.js`,

@ -1,6 +1,6 @@
import { current_component_context, untrack } from '../internal/client/runtime.js';
import { is_array } from '../internal/client/utils.js';
import { user_effect } from '../internal/index.js';
import { current_component_context, untrack } from './internal/client/runtime.js';
import { is_array } from './internal/client/utils.js';
import { user_effect } from './internal/index.js';
/**
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
@ -13,7 +13,7 @@ import { user_effect } from '../internal/index.js';
*
* https://svelte.dev/docs/svelte#onmount
* @template T
* @param {() => import('./private.js').NotFunction<T> | Promise<import('./private.js').NotFunction<T>> | (() => any)} fn
* @param {() => import('./internal/types').NotFunction<T> | Promise<import('./internal/types').NotFunction<T>> | (() => any)} fn
* @returns {void}
*/
export function onMount(fn) {
@ -81,7 +81,7 @@ function create_custom_event(type, detail, { bubbles = false, cancelable = false
*
* https://svelte.dev/docs/svelte#createeventdispatcher
* @template {Record<string, any>} [EventMap = any]
* @returns {import('./public.js').EventDispatcher<EventMap>}
* @returns {import('./index.js').EventDispatcher<EventMap>}
*/
export function createEventDispatcher() {
const component_context = current_component_context;
@ -161,7 +161,7 @@ export function afterUpdate(fn) {
/**
* Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
* @param {import('../internal/client/types.js').ComponentContext} context
* @param {import('./internal/client/types.js').ComponentContext} context
*/
function init_update_callbacks(context) {
return (context.u ??= { a: [], b: [], m: [] });
@ -182,4 +182,4 @@ export {
getContext,
getAllContexts,
setContext
} from '../internal/index.js';
} from './internal/index.js';

@ -1,4 +1,4 @@
import { current_component_context } from '../internal/client/runtime.js';
import { current_component_context } from './internal/client/runtime.js';
export {
createEventDispatcher,
@ -13,7 +13,7 @@ export {
unmount,
untrack,
createRoot
} from './main-client.js';
} from './index-client.js';
/** @returns {void} */
export function onMount() {}

@ -222,5 +222,5 @@ export interface EventDispatcher<EventMap extends Record<string, any>> {
): boolean;
}
export * from './main-client.js';
export * from './index-client.js';
import './ambient.js';

@ -149,7 +149,6 @@ export function text(anchor) {
return node;
}
/*#__NO_SIDE_EFFECTS__*/
export const comment = template('<!>', TEMPLATE_FRAGMENT);
/**

@ -97,7 +97,7 @@ export function createRoot() {
* @template {Record<string, any>} Props
* @template {Record<string, any>} Exports
* @template {Record<string, any>} Events
* @param {import('../../main/public.js').ComponentType<import('../../main/public.js').SvelteComponent<Props, Events>>} component
* @param {import('../../index.js').ComponentType<import('../../index.js').SvelteComponent<Props, Events>>} component
* @param {{
* target: Document | Element | ShadowRoot;
* props?: Props;
@ -119,7 +119,7 @@ export function mount(component, options) {
* @template {Record<string, any>} Props
* @template {Record<string, any>} Exports
* @template {Record<string, any>} Events
* @param {import('../../main/public.js').ComponentType<import('../../main/public.js').SvelteComponent<Props, Events>>} component
* @param {import('../../index.js').ComponentType<import('../../index.js').SvelteComponent<Props, Events>>} component
* @param {{
* target: Document | Element | ShadowRoot;
* props?: Props;
@ -180,7 +180,7 @@ export function hydrate(component, options) {
* @template {Record<string, any>} Props
* @template {Record<string, any>} Exports
* @template {Record<string, any>} Events
* @param {import('../../main/public.js').ComponentType<import('../../main/public.js').SvelteComponent<Props, Events>>} Component
* @param {import('../../index.js').ComponentType<import('../../index.js').SvelteComponent<Props, Events>>} Component
* @param {{
* target: Document | Element | ShadowRoot;
* anchor: Node;

@ -1,4 +1,2 @@
/**
* Anything except a function
*/
/** Anything except a function */
export type NotFunction<T> = T extends Function ? never : T;

@ -15,8 +15,8 @@ export { createClassComponent };
* @template {Record<string, any>} Events
* @template {Record<string, any>} Slots
*
* @param {import('../main/public.js').SvelteComponent<Props, Events, Slots>} component
* @returns {typeof import('../main/public.js').SvelteComponent<Props, Events, Slots> & Exports}
* @param {import('../index.js').SvelteComponent<Props, Events, Slots>} component
* @returns {typeof import('../index.js').SvelteComponent<Props, Events, Slots> & Exports}
*/
export function asClassComponent(component) {
const component_constructor = as_class_component(component);

@ -1,5 +1,5 @@
import { render_effect, effect_root } from '../internal/client/reactivity/effects.js';
import { flushSync } from '../main/main-client.js';
import { flushSync } from '../index-client.js';
import { ReactiveMap } from './map.js';
import { assert, test } from 'vitest';

@ -1,5 +1,5 @@
import { render_effect, effect_root } from '../internal/client/reactivity/effects.js';
import { flushSync } from '../main/main-client.js';
import { flushSync } from '../index-client.js';
import { ReactiveSet } from './set.js';
import { assert, test } from 'vitest';

@ -120,7 +120,7 @@ async function run_test(
let build_result_ssr;
if (hydrate) {
const ssr_entry = path.resolve(__dirname, '../../src/main/main-server.js');
const ssr_entry = path.resolve(__dirname, '../../src/index-server.js');
build_result_ssr = await build({
entryPoints: [`${__dirname}/driver-ssr.js`],

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -1,4 +1,4 @@
import { flushSync } from '../../../../src/main/main-client';
import { flushSync } from '../../../../src/index-client';
import { test } from '../../test';
export default test({

@ -16,7 +16,7 @@
"checkJs": true,
"paths": {
"acorn-typescript": ["./src/compiler/phases/1-parse/ambient.d.ts"],
"svelte": ["./src/main/public.d.ts"],
"svelte": ["./src/index.d.ts"],
"svelte/action": ["./src/action/public.d.ts"],
"svelte/compiler": ["./src/compiler/public.d.ts"],
"svelte/internal": ["./src/internal/index.js"],

@ -287,9 +287,7 @@ declare module 'svelte' {
* @deprecated Use `$effect` instead see https://svelte-5-preview.vercel.app/docs/deprecations#beforeupdate-and-afterupdate
* */
export function afterUpdate(fn: () => void): void;
/**
* Anything except a function
*/
/** Anything except a function */
type NotFunction<T> = T extends Function ? never : T;
/**
* @deprecated Use `mount` or `hydrate` instead

Loading…
Cancel
Save