Skip to content

Commit 8cd4b7b

Browse files
committed
Update package version to 0.0.7, enhance README with updated import paths for inline Svelte plugin, and refactor plugin structure to improve exports and organization.
1 parent 2f1c2cf commit 8cd4b7b

File tree

7 files changed

+18
-8
lines changed

7 files changed

+18
-8
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ yarn add -D @hvniel/vite-plugin-svelte-inline-component
4646
```ts
4747
import { defineConfig } from "vite";
4848
import { sveltekit } from "@sveltejs/kit/vite";
49-
import { inlineSveltePlugin } from "@hvniel/vite-plugin-svelte-inline-component";
49+
import inlineSveltePlugin from "@hvniel/vite-plugin-svelte-inline-component/plugin";
5050

5151
export default defineConfig(({ mode }) => ({
5252
plugins: [mode === "test" && inlineSveltePlugin(), sveltekit()],
@@ -79,6 +79,7 @@ Just like regular Svelte files, you can use `<script context="module">` (or `<sc
7979
The plugin makes any named exports available as properties on the component itself.
8080

8181
```tsx
82+
import { html, type InlineSnippet } from "@hvniel/vite-plugin-svelte-inline-component";
8283
const ComponentWithSnippets = html`
8384
<script lang="ts" module>
8485
// These snippets will be attached to the component export
@@ -112,8 +113,7 @@ const renderer = render(anchor => {
112113
To make TypeScript aware of your named exports, you'll need to use a type assertion.
113114

114115
```ts
115-
import type { InlineSnippet } from "@hvniel/vite-plugin-svelte-inline-component";
116-
116+
import { html, type InlineSnippet } from "@hvniel/vite-plugin-svelte-inline-component";
117117
const defaultExport = html`
118118
<script module>
119119
export { element };
@@ -142,6 +142,7 @@ Here’s a sample test that proves reactivity with **Svelte 5 runes** works out
142142

143143
```tsx
144144
import { render } from "vitest-browser-svelte";
145+
import { html, type InlineSnippet } from "@hvniel/vite-plugin-svelte-inline-component";
145146

146147
it("supports reactive components", async () => {
147148
const ReactiveComponent = html`

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hvniel/vite-plugin-svelte-inline-component",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"license": "MIT",
55
"author": "Haniel Ubogu <https://github.com/HanielU>",
66
"repository": {
@@ -34,6 +34,10 @@
3434
"types": "./dist/index.d.ts",
3535
"svelte": "./dist/index.js",
3636
"default": "./dist/index.js"
37+
},
38+
"./plugin": {
39+
"types": "./dist/plugin/index.d.ts",
40+
"default": "./dist/plugin/index.js"
3741
}
3842
},
3943
"peerDependencies": {

src/app.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// See https://svelte.dev/docs/kit/types#app.d.ts
22
// for information about these interfaces
33
declare global {
4-
const html: import("inline").InlineComponent;
54
namespace App {
65
// interface Error {}
76
// interface Locals {}

src/lib/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { default as inlineSveltePlugin } from "./plugins/inline-component.js";
21
export type InlineComponent = (
32
_strings: TemplateStringsArray,
43
..._vals: unknown[]
@@ -8,3 +7,10 @@ export type InlineSnippet<T = unknown> = (
87
anchor: import("svelte").ComponentInternals,
98
...props: (() => T)[]
109
) => void;
10+
11+
export const html: InlineComponent = () => {
12+
return {} as any;
13+
};
14+
export const svelte: InlineComponent = () => {
15+
return {} as any;
16+
};
File renamed without changes.

src/plugin.svelte.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect } from "vitest";
22
import { render } from "vitest-browser-svelte";
33
import SimpleComponentParent from "./plugin.svelte";
4-
import type { InlineSnippet } from "inline";
4+
import { html, type InlineSnippet } from "inline";
55
import { page } from "@vitest/browser/context";
66

77
/* svelte:imports

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { sveltekit } from "@sveltejs/kit/vite";
22
import { defineConfig } from "vite";
3-
import { inlineSveltePlugin } from "./src/lib/index.js";
3+
import inlineSveltePlugin from "./src/lib/plugin/index.js";
44

55
export default defineConfig(({ mode }) => {
66
return {

0 commit comments

Comments
 (0)