Skip to content

Commit f620cbe

Browse files
committed
fix: bumpup svelte
1 parent 0e0b9a9 commit f620cbe

File tree

9 files changed

+70
-48
lines changed

9 files changed

+70
-48
lines changed

.changeset/tasty-eggs-jam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte-jsx-snippet": minor
3+
---
4+
5+
Bumpup svelte

packages/svelte-jsx-snippet/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@
5454
},
5555
"homepage": "https://github.com/ssssota/svelte-jsx-snippet#readme",
5656
"devDependencies": {
57-
"svelte": "5.0.0-next.132",
57+
"svelte": "5.0.0-next.136",
5858
"svelte-jsx-snippet": "workspace:*",
5959
"typescript": "^5.4.5",
6060
"vite": "^5.0.3",
6161
"vite-plugin-doctest": "^1.0.0",
6262
"vitest": "^1.2.0"
6363
},
6464
"peerDependencies": {
65-
"svelte": ">=5.0.0-next.132"
65+
"svelte": ">=5.0.0-next.136"
6666
}
6767
}

packages/svelte-jsx-snippet/src/index-server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FunctionComponent } from "./jsx-runtime/types";
33
import { ComponentType, SvelteComponent } from "svelte";
44
import { jsx as _jsx } from "./jsx-runtime/index-server";
55
import { hydrationMarkerE, hydrationMarkerS } from "./constants";
6+
import { add_snippet_symbol } from "./utils";
67

78
export const jsx$ = <P extends Record<string, unknown>, S extends keyof P>(
89
Component: ComponentType<SvelteComponent<P>>,
@@ -16,14 +17,14 @@ export const jsx$ = <P extends Record<string, unknown>, S extends keyof P>(
1617
}
1718
return [
1819
key,
19-
$.add_snippet_symbol(($$payload: { out: string }) => {
20+
add_snippet_symbol(($$payload: { out: string }) => {
2021
$$payload.out += String(value);
2122
}),
2223
] as const;
2324
}
2425
return [key, value] as const;
2526
});
26-
return $.add_snippet_symbol(($$payload: { out: string }) => {
27+
return add_snippet_symbol(($$payload: { out: string }) => {
2728
$$payload.out += hydrationMarkerS;
2829
(Component as any)($$payload, Object.fromEntries(propertyEntries));
2930
$$payload.out += hydrationMarkerE;

packages/svelte-jsx-snippet/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as $ from "svelte/internal/client";
22
import type { FunctionComponent } from "./jsx-runtime/types";
33
import type { ComponentType, SvelteComponent } from "svelte";
44
import { jsx as _jsx, Fragment } from "./jsx-runtime";
5+
import { add_snippet_symbol } from "./utils";
56

67
/**
78
* Convert a Svelte component to a JSX function component
@@ -31,14 +32,14 @@ export const jsx$ = <P extends Record<string, unknown>, S extends keyof P>(
3132
const template = $.template(value, 1);
3233
return [
3334
key,
34-
$.add_snippet_symbol(($$anchor: unknown) => {
35+
add_snippet_symbol(($$anchor: unknown) => {
3536
$.append($$anchor, template());
3637
}),
3738
] as const;
3839
}
3940
return [key, value] as const;
4041
});
41-
return $.add_snippet_symbol(($$anchor: unknown) => {
42+
return add_snippet_symbol(($$anchor: unknown) => {
4243
const fragment = $.comment();
4344
const root = $.first_child(fragment);
4445

packages/svelte-jsx-snippet/src/jsx-runtime/index-server.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import type { Snippet } from "svelte";
2-
import * as $ from "svelte/internal/server";
3-
import { buildChildList, isVoidElement, renderProps } from "../utils";
2+
import {
3+
add_snippet_symbol,
4+
buildChildList,
5+
isVoidElement,
6+
renderProps,
7+
} from "../utils";
48
import type { FunctionComponent, JsxDevOpts } from "./types";
59
import { FRAGMENT, hydrationMarkerE, hydrationMarkerS } from "../constants";
610

@@ -14,7 +18,7 @@ const jsxDEV = <T extends string | FunctionComponent<any>>(
1418
_opts?: JsxDevOpts,
1519
_ctx?: unknown,
1620
): Snippet<[]> => {
17-
return $.add_snippet_symbol(($$payload: { out: string }) => {
21+
return add_snippet_symbol(($$payload: { out: string }) => {
1822
const { children, ...rest } = props;
1923
const childList = buildChildList(children);
2024
if (type === FRAGMENT || type === Fragment) {

packages/svelte-jsx-snippet/src/jsx-runtime/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import type { Snippet } from "svelte";
22
import type { SvelteHTMLElements } from "svelte/elements";
33
import * as $ from "svelte/internal/client";
4-
import { buildChildList, isVoidElement, renderProps } from "../utils";
4+
import {
5+
add_snippet_symbol,
6+
buildChildList,
7+
isVoidElement,
8+
renderProps,
9+
} from "../utils";
510
import type { FunctionComponent, JSXChildren, JsxDevOpts } from "./types";
611
import { FRAGMENT, TEMPLATE_FRAGMENT, injectMarker } from "../constants";
712

@@ -33,7 +38,7 @@ const jsxDEV = <T extends string | FunctionComponent<any>>(
3338
: `<${type}${renderProps(rest)}>${childrenContent}</${type}>`
3439
: injectMarker;
3540
const template = $.template(content, fragment ? TEMPLATE_FRAGMENT : 0);
36-
return $.add_snippet_symbol(($$anchor: unknown) => {
41+
return add_snippet_symbol(($$anchor: unknown) => {
3742
const root = template();
3843

3944
if (fragment || rootIsHtml) {

packages/svelte-jsx-snippet/src/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { escape } from "svelte/internal/server";
22

3+
const snippet_symbol = Symbol.for("svelte.snippet");
4+
export function add_snippet_symbol(fn: (...args: any[]) => any) {
5+
fn[snippet_symbol] = true;
6+
return fn;
7+
}
8+
39
const voidElementSet = new Set([
410
"area",
511
"base",

pnpm-lock.yaml

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@testing-library/svelte": "^5.1.0",
2121
"jsdom": "^24.0.0",
2222
"mizu.css": "^0.1.2",
23-
"svelte": "^5.0.0-next.132",
23+
"svelte": "^5.0.0-next.136",
2424
"svelte-check": "^3.6.0",
2525
"svelte-jsx-snippet": "workspace:*",
2626
"tslib": "^2.4.1",

0 commit comments

Comments
 (0)