@rsvelte/cli 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +62 -2
- package/bin/rsvelte.js +31 -0
- package/package.json +43 -5
- package/platforms.json +7 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @rsvelte/cli
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1b50998: `rsvelte format` takes the options of the nearest oxfmt or Prettier configuration unless `rsvelte.config` names them. It refuses a configuration it cannot honor and writes nothing. When the Svelte formatter cannot print an option yet, it leaves the Svelte files and exits with 2.
|
|
8
|
+
- 1b50998: `rsvelte lint` and `rsvelte format` skip the files that `.gitignore`, `.git/info/exclude` and `.ignore` exclude. `rsvelte format` also skips what `.prettierignore` lists. A `.gitignore` counts only inside a Git repository, and a file named on the command line is still read.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 4f3a68e: `rsvelte typecheck` accepts `bind:this` on a generic component, as svelte-check does.
|
|
13
|
+
- afb93f4: `rsvelte typecheck` types the `load` functions and endpoints of SvelteKit files as svelte-check does, so their untyped parameters are no longer implicitly `any`. It also types form actions and the hooks files.
|
|
14
|
+
- 1b50998: `rsvelte typecheck` passes over a TypeScript older than 7.1 instead of stopping at it. When it finds no type checker, it prints the command that installs tsrs with the project's package manager.
|
|
15
|
+
- 656fa37: `rsvelte typecheck` no longer reports every file as outside `rootDir` (TS6059) in a project that sets `outDir` but not `rootDir`.
|
|
16
|
+
- c162947: `rsvelte lint` reports `@typescript-eslint/no-unused-vars` in TypeScript files as typescript-eslint does. Signature parameters, parameter properties and what an ambient context declares count as used, and a `typeof` does not.
|
|
17
|
+
|
|
18
|
+
## 0.1.0
|
|
19
|
+
|
|
20
|
+
- The first release: `rsvelte lint`, `rsvelte format` and `rsvelte typecheck`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuichiro Yamashita
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# rsvelte
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
rsvelte lints, formats and type checks Svelte 5 and TypeScript files with native programs
|
|
4
|
+
built from Rust. This release is experimental.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install --save-dev @rsvelte/cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Use
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npx @rsvelte/cli lint [<path>...]
|
|
16
|
+
npx @rsvelte/cli format [<path>...] [--check]
|
|
17
|
+
npx @rsvelte/cli typecheck
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`npx` runs the project's copy, or downloads one when the project has none. In `package.json`
|
|
21
|
+
scripts, the command is `rsvelte`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"scripts": {
|
|
26
|
+
"lint": "rsvelte lint",
|
|
27
|
+
"format": "rsvelte format",
|
|
28
|
+
"typecheck": "rsvelte typecheck"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Without a path, `lint` and `format` read every file below the current directory, except
|
|
34
|
+
`node_modules`. `format` writes the files it changes. With `--check`, it lists them and
|
|
35
|
+
writes nothing.
|
|
36
|
+
|
|
37
|
+
`typecheck` checks the project of `tsconfig.json` in the current directory and reports the
|
|
38
|
+
type errors that svelte-check reports. It runs a TypeScript 7 type checker from the project's
|
|
39
|
+
`node_modules`. Install one of these:
|
|
40
|
+
|
|
41
|
+
- [tsrs](https://www.npmjs.com/package/tsrs) (recommended): `npm install --save-dev tsrs`
|
|
42
|
+
- TypeScript 7.1 or newer (`typescript`, or `@typescript/native-preview`)
|
|
43
|
+
|
|
44
|
+
Each command exits with 1 when it finds an error, and with 2 when it cannot run.
|
|
45
|
+
|
|
46
|
+
## Configure
|
|
47
|
+
|
|
48
|
+
rsvelte reads `rsvelte.config.json` (or `.js`, `.ts` and the other module extensions) from
|
|
49
|
+
the current directory or the nearest parent directory that has one. Each plugin reads its
|
|
50
|
+
options from `plugins`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"plugins": {
|
|
55
|
+
"svelte.lint": { "rules": { "no-unused-vars": "warn" } },
|
|
56
|
+
"typescript.check": { "tsconfig": "tsconfig.app.json" }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/bin/rsvelte.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Starts the rsvelte program that npm installed for this machine, with the same arguments, and
|
|
3
|
+
// exits as it does. The package of each platform is in platforms.json beside this directory.
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const platforms = JSON.parse(readFileSync(new URL('../platforms.json', import.meta.url), 'utf8'));
|
|
10
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
11
|
+
const name = platforms[platform];
|
|
12
|
+
if (!name) {
|
|
13
|
+
console.error(`rsvelte: there is no build for ${platform}`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
let program;
|
|
17
|
+
try {
|
|
18
|
+
program = require.resolve(`${name}/rsvelte${process.platform === 'win32' ? '.exe' : ''}`);
|
|
19
|
+
} catch {
|
|
20
|
+
console.error(
|
|
21
|
+
`rsvelte: ${name} is not installed; install @rsvelte/cli again, with optional dependencies`,
|
|
22
|
+
);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const run = spawnSync(program, process.argv.slice(2), { stdio: 'inherit' });
|
|
26
|
+
if (run.error) {
|
|
27
|
+
console.error(`rsvelte: ${program}: ${run.error.message}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
if (run.signal) process.kill(process.pid, run.signal);
|
|
31
|
+
process.exit(run.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@rsvelte/cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Lint, format and type check Svelte and TypeScript, fast",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"svelte",
|
|
7
|
+
"lint",
|
|
8
|
+
"format",
|
|
9
|
+
"typecheck",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/baseballyama/rsvelte.git"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"bin": {
|
|
19
|
+
"rsvelte": "bin/rsvelte.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin",
|
|
23
|
+
"platforms.json",
|
|
24
|
+
"CHANGELOG.md"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"optionalDependencies": {
|
|
30
|
+
"@rsvelte/cli-darwin-arm64": "0.2.0",
|
|
31
|
+
"@rsvelte/cli-darwin-x64": "0.2.0",
|
|
32
|
+
"@rsvelte/cli-linux-arm64-gnu": "0.2.0",
|
|
33
|
+
"@rsvelte/cli-linux-x64-gnu": "0.2.0",
|
|
34
|
+
"@rsvelte/cli-win32-x64-msvc": "0.2.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"tsrs": ">=7.1.0-beta.tsrs2 <7.2.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"tsrs": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|