@litsx/typescript 0.6.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/README.md +85 -0
- package/dist/authored-semantics.cjs +18567 -0
- package/dist/authored-semantics.cjs.map +1 -0
- package/dist/editor-session.cjs +1345 -0
- package/dist/editor-session.cjs.map +1 -0
- package/dist/index.cjs +841 -0
- package/dist/index.cjs.map +1 -0
- package/dist/litsx-tsc.js +18025 -0
- package/dist/typecheck.cjs +931 -0
- package/dist/typecheck.cjs.map +1 -0
- package/dist/virtualization.cjs +113 -0
- package/dist/virtualization.cjs.map +1 -0
- package/package.json +76 -0
- package/src/authored-semantics.js +1543 -0
- package/src/editor-session.js +1360 -0
- package/src/index.js +844 -0
- package/src/litsx-tsc.js +4 -0
- package/src/typecheck.js +535 -0
- package/src/virtualization.js +125 -0
- package/tsserver-plugin.cjs +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @litsx/typescript
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@litsx/typescript)
|
|
4
|
+
[](../../RELEASING.md)
|
|
5
|
+
[](./package.json)
|
|
6
|
+
[](../../RELEASING.md)
|
|
7
|
+
|
|
8
|
+
TypeScript language-service support for LitSX-authored JSX.
|
|
9
|
+
|
|
10
|
+
The plugin exists to make editor tooling tolerate Lit-flavoured JSX attributes such as:
|
|
11
|
+
|
|
12
|
+
- `@click={handle}`
|
|
13
|
+
- `.value={model.value}`
|
|
14
|
+
- `?disabled={busy}`
|
|
15
|
+
|
|
16
|
+
## Scope
|
|
17
|
+
|
|
18
|
+
The plugin virtualizes prefixed JSX attribute names into TypeScript-safe names for the language service and then remaps the results back to the authored LitSX syntax.
|
|
19
|
+
|
|
20
|
+
It provides:
|
|
21
|
+
|
|
22
|
+
- tolerance for `@event`, `.prop` and `?attr` in `.jsx`, `.tsx`, `.litsx`, and `.litsx.jsx`
|
|
23
|
+
- remapped diagnostics and quick info spans
|
|
24
|
+
- filtered completions that hide the internal `__litsx_*` names
|
|
25
|
+
- contextual completions for `@event`, `.prop` and `?attr`
|
|
26
|
+
- authored diagnostics for obviously invalid Lit bindings
|
|
27
|
+
- a `litsx-tsc` CLI path for virtualized type-checking when authored source uses Lit<sup>sx</sup>-specific syntax that plain `tsc` cannot parse directly
|
|
28
|
+
|
|
29
|
+
It does not provide:
|
|
30
|
+
|
|
31
|
+
- exhaustive DOM/custom-element semantics for every tag
|
|
32
|
+
- editor refactors or quick-fixes
|
|
33
|
+
- remapped rename/find-references flows
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"compilerOptions": {
|
|
40
|
+
"jsx": "react-jsx",
|
|
41
|
+
"jsxImportSource": "@litsx/core",
|
|
42
|
+
"plugins": [
|
|
43
|
+
{ "name": "@litsx/typescript" }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For a workspace using the local package directly, the same shape works in `tsconfig.json`:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"compilerOptions": {
|
|
54
|
+
"jsx": "react-jsx",
|
|
55
|
+
"jsxImportSource": "@litsx/core",
|
|
56
|
+
"plugins": [
|
|
57
|
+
{
|
|
58
|
+
"name": "@litsx/typescript"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
VS Code picks this up through the bundled TypeScript server when the workspace is using the project `tsconfig.json`.
|
|
66
|
+
|
|
67
|
+
## Exports
|
|
68
|
+
|
|
69
|
+
- `@litsx/typescript`
|
|
70
|
+
- `@litsx/typescript/editor-session`
|
|
71
|
+
- `@litsx/typescript/virtualization`
|
|
72
|
+
- `@litsx/typescript/typecheck`
|
|
73
|
+
|
|
74
|
+
The `virtualization` entrypoint exposes the standalone source virtualization helper used internally by the plugin.
|
|
75
|
+
The `editor-session` entrypoint exposes a project-backed editor service for integrations such as VS Code extensions that need LitSX-aware diagnostics, hover, and completions outside the tsserver plugin host. It complements the tsserver plugin rather than replacing it.
|
|
76
|
+
|
|
77
|
+
## CLI Typecheck
|
|
78
|
+
|
|
79
|
+
If a project wants CLI type-checking for authored syntax such as `@click`, `.value`, `?disabled`, or `static styles = ...`, use the virtualized wrapper instead of calling plain `tsc` directly:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
litsx-tsc -p tsconfig.json --noEmit
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This is a toolchain/CI concern, not a replacement for the editor plugin. The editor DX still comes from the tsserver plugin.
|