Skip to content

Commit

Permalink
chore: move svelte/internal to svelte/internal/client
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Mar 28, 2024
1 parent eaa243d commit d7c0522
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 92 deletions.
4 changes: 2 additions & 2 deletions packages/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"./elements": {
"types": "./elements.d.ts"
},
"./internal": {
"default": "./src/internal/index.js"
"./internal/client": {
"default": "./src/internal/client/index.js"
},
"./internal/disclose-version": {
"default": "./src/internal/disclose-version.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function client_component(source, analysis, options) {
options,
scope: analysis.module.scope,
scopes: analysis.template.scopes,
hoisted: [b.import_all('$', 'svelte/internal')],
hoisted: [b.import_all('$', 'svelte/internal/client')],
node: /** @type {any} */ (null), // populated by the root node
// these should be set by create_block - if they're called outside, it's a bug
get before_init() {
Expand Down Expand Up @@ -582,6 +582,6 @@ export function client_module(analysis, options) {
return {
type: 'Program',
sourceType: 'module',
body: [b.import_all('$', 'svelte/internal'), ...module.body]
body: [b.import_all('$', 'svelte/internal/client'), ...module.body]
};
}
4 changes: 2 additions & 2 deletions packages/svelte/src/index-client.js
Original file line number Diff line number Diff line change
@@ -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 { user_effect } from './internal/client/index.js';

/**
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
Expand Down Expand Up @@ -182,4 +182,4 @@ export {
getContext,
getAllContexts,
setContext
} from './internal/index.js';
} from './internal/client/index.js';
72 changes: 72 additions & 0 deletions packages/svelte/src/internal/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
export {
get,
invalidate_inner_signals,
flushSync,
tick,
untrack,
update,
update_pre,
value_or_fallback,
exclude_from_object,
pop,
push,
inspect,
unwrap,
freeze,
deep_read,
deep_read_state,
getAllContexts,
getContext,
setContext,
hasContext
} from './runtime.js';
export * from './dev/ownership.js';
export { await_block as await } from './dom/blocks/await.js';
export { if_block as if } from './dom/blocks/if.js';
export { key_block as key } from './dom/blocks/key.js';
export * from './dom/blocks/css-props.js';
export * from './dom/blocks/each.js';
export * from './dom/blocks/html.js';
export * from './dom/blocks/snippet.js';
export * from './dom/blocks/svelte-component.js';
export * from './dom/blocks/svelte-element.js';
export * from './dom/blocks/svelte-head.js';
export * from './dom/elements/actions.js';
export * from './dom/elements/attributes.js';
export * from './dom/elements/class.js';
export * from './dom/elements/events.js';
export * from './dom/elements/misc.js';
export * from './dom/elements/style.js';
export * from './dom/elements/transitions.js';
export * from './dom/elements/bindings/input.js';
export * from './dom/elements/bindings/media.js';
export * from './dom/elements/bindings/navigator.js';
export * from './dom/elements/bindings/props.js';
export * from './dom/elements/bindings/select.js';
export * from './dom/elements/bindings/size.js';
export * from './dom/elements/bindings/this.js';
export * from './dom/elements/bindings/universal.js';
export * from './dom/elements/bindings/window.js';
export * from './dom/legacy/event-modifiers.js';
export * from './dom/legacy/lifecycle.js';
export * from './dom/legacy/misc.js';
export * from './dom/template.js';
export * from './reactivity/deriveds.js';
export * from './reactivity/effects.js';
export * from './reactivity/sources.js';
export * from './reactivity/equality.js';
export * from './reactivity/props.js';
export * from './reactivity/store.js';
export * from './render.js';
export * from './validate.js';
export { raf } from './timing.js';
export { proxy, unstate } from './proxy.js';
export { create_custom_element } from './dom/elements/custom-element.js';
export {
child,
first_child,
sibling,
$window as window,
$document as document
} from './dom/operations.js';
export { noop } from '../common.js';
72 changes: 0 additions & 72 deletions packages/svelte/src/internal/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/svelte/src/legacy/legacy-client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { define_property } from '../internal/client/utils.js';
import * as $ from '../internal/index.js';
import * as $ from '../internal/client/index.js';

/**
* Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/tests/animation-helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { raf as svelte_raf } from 'svelte/internal';
import { raf as svelte_raf } from 'svelte/internal/client';

export const raf = {
animations: new Set(),
Expand Down
3 changes: 1 addition & 2 deletions packages/svelte/tests/runtime-legacy/shared.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as fs from 'node:fs';
import { setImmediate } from 'node:timers/promises';
import glob from 'tiny-glob/sync.js';
// import { clear_loops, flush, set_now, set_raf } from 'svelte/internal';
import * as $ from 'svelte/internal';
import * as $ from 'svelte/internal/client';
import { createClassComponent } from 'svelte/legacy';
import { render } from 'svelte/server';
import { afterAll, assert, beforeAll } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

export default function Bind_this($$anchor, $$props) {
$.push($$props, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

export default function Class_state_field_constructor_assignment($$anchor, $$props) {
$.push($$props, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// main.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

var root = $.template(`<div></div> <svg></svg> <custom-element></custom-element> <div></div> <svg></svg> <custom-element></custom-element>`, 3);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

export default function Each_string_template($$anchor, $$props) {
$.push($$props, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* index.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

export const object = $.proxy({ ok: true });
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

export default function Function_prop_no_getter($$anchor, $$props) {
$.push($$props, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

var root = $.template(`<h1>hello world</h1>`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

function reset(_, str, tpl) {
$.set(str, '');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// index.svelte (Svelte VERSION)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
import * as $ from "svelte/internal/client";

export default function Svelte_element($$anchor, $$props) {
$.push($$props, true);
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"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"],
"svelte/internal/client": ["./src/internal/client/index.js"],
"svelte/legacy": ["./src/legacy/legacy-client.js"],
"svelte/motion": ["./src/motion/public.d.ts"],
"svelte/server": ["./src/server/index.js"],
Expand Down

0 comments on commit d7c0522

Please sign in to comment.