feat(create-rslib): add svelte template and related-doc#1653
Open
elecmonkey wants to merge 20 commits into
Open
feat(create-rslib): add svelte template and related-doc#1653elecmonkey wants to merge 20 commits into
elecmonkey wants to merge 20 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class Svelte library scaffolding to create-rslib and documents the recommended Rslib + Svelte setup (Svelte 5, ESM output, CSS handling, and local .d.ts generation).
Changes:
- Add
svelte-js/svelte-tstemplates tocreate-rslib, including a TS helper plugin that generates.svelte.d.tsviasvelte2tsx. - Add
rstesttool overlays for Svelte templates (JS/TS) with basic component tests running inhappy-dom. - Add new Svelte solution docs (EN/ZH) and register them in the solution navigation meta.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/zh/guide/solution/svelte.mdx | New Chinese Svelte solution guide covering config, output, and d.ts generation. |
| website/docs/zh/guide/solution/_meta.json | Add svelte to solution nav ordering (ZH). |
| website/docs/en/guide/solution/svelte.mdx | New English Svelte solution guide covering config, output, and d.ts generation. |
| website/docs/en/guide/solution/_meta.json | Add svelte to solution nav ordering (EN). |
| packages/create-rslib/src/index.ts | Register Svelte templates in CLI template list and tool mapping. |
| packages/create-rslib/test/index.test.ts | Add create/validate coverage for Svelte templates (with/without rstest). |
| packages/create-rslib/test/helper.ts | Add Svelte-specific assertions for generated project structure/deps/exports. |
| packages/create-rslib/template-svelte-ts/tsconfig.json | TS config for the Svelte TS template (extends @tsconfig/svelte). |
| packages/create-rslib/template-svelte-ts/svelte.config.ts | Svelte TS config using svelte-preprocess. |
| packages/create-rslib/template-svelte-ts/src/index.ts | Svelte TS template entry exporting the example component. |
| packages/create-rslib/template-svelte-ts/src/Button.svelte | Example Svelte 5 component using runes + props callback. |
| packages/create-rslib/template-svelte-ts/scripts/rslib-plugin-svelte-dts.ts | Post-build helper plugin to emit .d.ts via svelte2tsx.emitDts. |
| packages/create-rslib/template-svelte-ts/rslib.config.ts | Rslib config for Svelte TS template (web target, plugin-svelte, custom dts). |
| packages/create-rslib/template-svelte-ts/package.json | Svelte TS template deps/exports/scripts (including check). |
| packages/create-rslib/template-svelte-js/svelte.config.js | Minimal Svelte config for JS template. |
| packages/create-rslib/template-svelte-js/src/index.js | Svelte JS template entry exporting the example component. |
| packages/create-rslib/template-svelte-js/src/Button.svelte | Example Svelte 5 component for JS template. |
| packages/create-rslib/template-svelte-js/rslib.config.mjs | Rslib config for Svelte JS template (web target, plugin-svelte). |
| packages/create-rslib/template-svelte-js/package.json | Svelte JS template deps/exports/scripts. |
| packages/create-rslib/template-rstest/svelte-ts/tests/index.test.ts | Svelte TS rstest overlay tests for the Button component. |
| packages/create-rslib/template-rstest/svelte-ts/rstest.config.ts | rstest config for Svelte TS overlay (happy-dom). |
| packages/create-rslib/template-rstest/svelte-ts/package.json | rstest overlay deps/scripts for Svelte TS. |
| packages/create-rslib/template-rstest/svelte-js/tests/index.test.js | Svelte JS rstest overlay tests for the Button component. |
| packages/create-rslib/template-rstest/svelte-js/rstest.config.js | rstest config for Svelte JS overlay (happy-dom). |
| packages/create-rslib/template-rstest/svelte-js/package.json | rstest overlay deps/scripts for Svelte JS. |
Deploying rslib with
|
| Latest commit: |
7b525eb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://414bd2a3.rslib.pages.dev |
| Branch Preview URL: | https://feat-create-rslib-svelte-tem.rslib.pages.dev |
|
|
||
| const require = createRequire(import.meta.url); | ||
|
|
||
| export interface SvelteDtsPluginOptions { |
Contributor
There was a problem hiding this comment.
Why directly import EmitDtsConfig type from svelte2tsx
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Clarify the Svelte guide links by pointing the package reference at svelte2tsx and the option reference at emitDts config.
Remove svelte.config files from the Svelte templates so generated projects only keep configuration that is actually used.
01b7812 to
7b525eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Svelte support to
create-rslib, including Svelte 5 TypeScript and JavaScript templates, Rstest integration, localsvelte2tsxdeclaration generation, and Svelte-specific documentation.Close #1360