@lightspeed-js/core 0.1.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/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/compile.js +1494 -0
- package/dist/index.js +3060 -0
- package/dist/ssg.js +3620 -0
- package/dist/types/build.d.ts +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/src/agent/index.d.ts +175 -0
- package/dist/types/src/cli/commands/agent.d.ts +9 -0
- package/dist/types/src/cli/commands/build.d.ts +2 -0
- package/dist/types/src/cli/commands/create.d.ts +2 -0
- package/dist/types/src/cli/commands/dev.d.ts +2 -0
- package/dist/types/src/cli/commands/index.d.ts +3 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/types/commands.d.ts +11 -0
- package/dist/types/src/cli/types/index.d.ts +1 -0
- package/dist/types/src/cli/utils/commands.d.ts +5 -0
- package/dist/types/src/cli/utils/index.d.ts +1 -0
- package/dist/types/src/compile/expressions.d.ts +76 -0
- package/dist/types/src/compile/index.d.ts +44 -0
- package/dist/types/src/compile/logic.d.ts +101 -0
- package/dist/types/src/manifest.d.ts +148 -0
- package/dist/types/src/marker.d.ts +85 -0
- package/dist/types/src/parser/index.d.ts +2 -0
- package/dist/types/src/parser/layout.d.ts +32 -0
- package/dist/types/src/parser/lsp.d.ts +56 -0
- package/dist/types/src/parser/route.d.ts +87 -0
- package/dist/types/src/parser/style-source-node.d.ts +19 -0
- package/dist/types/src/parser/style.d.ts +20 -0
- package/dist/types/src/parser/template.d.ts +32 -0
- package/dist/types/src/parser/test.d.ts +1 -0
- package/dist/types/src/runtime/bindings/BindingEvaluator.d.ts +174 -0
- package/dist/types/src/runtime/bindings/index.d.ts +2 -0
- package/dist/types/src/runtime/compiler/ImportTransformer.d.ts +11 -0
- package/dist/types/src/runtime/compiler/index.d.ts +1 -0
- package/dist/types/src/runtime/components/ComponentInstance.d.ts +110 -0
- package/dist/types/src/runtime/components/ComponentRegistry.d.ts +11 -0
- package/dist/types/src/runtime/components/index.d.ts +3 -0
- package/dist/types/src/runtime/components/types/index.d.ts +34 -0
- package/dist/types/src/runtime/core.d.ts +251 -0
- package/dist/types/src/runtime/diagnostics.d.ts +33 -0
- package/dist/types/src/runtime/dom/ForBlock.d.ts +127 -0
- package/dist/types/src/runtime/dom/Mounter.d.ts +223 -0
- package/dist/types/src/runtime/dom/StyleManager.d.ts +57 -0
- package/dist/types/src/runtime/dom/hydration.d.ts +35 -0
- package/dist/types/src/runtime/dom/index.d.ts +7 -0
- package/dist/types/src/runtime/events/EventBinder.d.ts +18 -0
- package/dist/types/src/runtime/events/index.d.ts +1 -0
- package/dist/types/src/runtime/globals/GlobalFunctions.d.ts +24 -0
- package/dist/types/src/runtime/globals/index.d.ts +1 -0
- package/dist/types/src/runtime/helpers.d.ts +141 -0
- package/dist/types/src/runtime/index.d.ts +16 -0
- package/dist/types/src/runtime/reactive/ReactiveProxy.d.ts +63 -0
- package/dist/types/src/runtime/reactive/UpdateScheduler.d.ts +9 -0
- package/dist/types/src/runtime/reactive/index.d.ts +2 -0
- package/dist/types/src/runtime/signals/SignalManager.d.ts +10 -0
- package/dist/types/src/runtime/signals/index.d.ts +3 -0
- package/dist/types/src/runtime/signals/signals.d.ts +16 -0
- package/dist/types/src/runtime/signals/types/index.d.ts +1 -0
- package/dist/types/src/runtime/signals/types/signals.d.ts +7 -0
- package/dist/types/src/runtime/state/Cell.d.ts +68 -0
- package/dist/types/src/runtime/state/CellManager.d.ts +101 -0
- package/dist/types/src/runtime/state/index.d.ts +4 -0
- package/dist/types/src/specifiers.d.ts +16 -0
- package/dist/types/src/ssg/index.d.ts +21 -0
- package/dist/types/src/ssg/rebuild.d.ts +49 -0
- package/dist/types/src/ssg/render.d.ts +104 -0
- package/dist/types/src/types/lsp.d.ts +22 -0
- package/dist/types/src/types/optional.d.ts +14 -0
- package/dist/types/src/types/virtual.d.ts +4 -0
- package/dist/types/src/vite/csp.d.ts +12 -0
- package/dist/types/src/vite/index.d.ts +2 -0
- package/dist/types/src/vite/layout.d.ts +17 -0
- package/dist/types/src/vite/plugin.d.ts +69 -0
- package/dist/types/src/vite/routes.d.ts +139 -0
- package/dist/types/test/adopted-styles.test.d.ts +1 -0
- package/dist/types/test/adoption.test.d.ts +1 -0
- package/dist/types/test/agent.test.d.ts +1 -0
- package/dist/types/test/audit.test.d.ts +1 -0
- package/dist/types/test/bindings.test.d.ts +1 -0
- package/dist/types/test/branches-in-loops.test.d.ts +1 -0
- package/dist/types/test/build.test.d.ts +1 -0
- package/dist/types/test/buildtime.test.d.ts +1 -0
- package/dist/types/test/built.test.d.ts +1 -0
- package/dist/types/test/cell-props.test.d.ts +1 -0
- package/dist/types/test/comments.test.d.ts +1 -0
- package/dist/types/test/compile-expressions.test.d.ts +1 -0
- package/dist/types/test/compile-logic.test.d.ts +1 -0
- package/dist/types/test/components.test.d.ts +1 -0
- package/dist/types/test/composition.test.d.ts +1 -0
- package/dist/types/test/declared-needs.test.d.ts +1 -0
- package/dist/types/test/diagnostics.test.d.ts +1 -0
- package/dist/types/test/dynamic.test.d.ts +1 -0
- package/dist/types/test/example.test.d.ts +1 -0
- package/dist/types/test/faq.test.d.ts +1 -0
- package/dist/types/test/flatten-nested.test.d.ts +1 -0
- package/dist/types/test/html-binding.test.d.ts +1 -0
- package/dist/types/test/hydration-report.test.d.ts +1 -0
- package/dist/types/test/hydration.test.d.ts +1 -0
- package/dist/types/test/layout-resolution.test.d.ts +1 -0
- package/dist/types/test/layout.test.d.ts +1 -0
- package/dist/types/test/lazy.test.d.ts +1 -0
- package/dist/types/test/manifest.test.d.ts +1 -0
- package/dist/types/test/model-props.test.d.ts +1 -0
- package/dist/types/test/model.test.d.ts +1 -0
- package/dist/types/test/mounting.test.d.ts +1 -0
- package/dist/types/test/needs.test.d.ts +1 -0
- package/dist/types/test/nested-rows.test.d.ts +1 -0
- package/dist/types/test/on-mounted.test.d.ts +1 -0
- package/dist/types/test/on-update.test.d.ts +1 -0
- package/dist/types/test/page-island.test.d.ts +1 -0
- package/dist/types/test/pages.test.d.ts +1 -0
- package/dist/types/test/reactivity.test.d.ts +1 -0
- package/dist/types/test/rebuild-keeps-logic.test.d.ts +1 -0
- package/dist/types/test/rebuild.test.d.ts +1 -0
- package/dist/types/test/reenumerate.test.d.ts +1 -0
- package/dist/types/test/refresh.test.d.ts +1 -0
- package/dist/types/test/refs.test.d.ts +1 -0
- package/dist/types/test/reorder.test.d.ts +1 -0
- package/dist/types/test/route.test.d.ts +1 -0
- package/dist/types/test/routes-build.test.d.ts +1 -0
- package/dist/types/test/routes-dev.test.d.ts +1 -0
- package/dist/types/test/routes-emit.test.d.ts +1 -0
- package/dist/types/test/routes-runtime.test.d.ts +1 -0
- package/dist/types/test/setup.d.ts +59 -0
- package/dist/types/test/show.test.d.ts +1 -0
- package/dist/types/test/skeleton-adoption.test.d.ts +1 -0
- package/dist/types/test/slots.test.d.ts +1 -0
- package/dist/types/test/specifiers.test.d.ts +1 -0
- package/dist/types/test/ssg.test.d.ts +1 -0
- package/dist/types/test/state.test.d.ts +1 -0
- package/dist/types/test/static-islands.test.d.ts +1 -0
- package/dist/types/test/stats.test.d.ts +1 -0
- package/dist/types/test/structural.test.d.ts +1 -0
- package/dist/types/test/style-sources.test.d.ts +1 -0
- package/dist/types/test/styles.test.d.ts +1 -0
- package/dist/types/test/surgical-rebuild.test.d.ts +1 -0
- package/dist/types/test/tables.test.d.ts +1 -0
- package/dist/types/test/unmount.test.d.ts +1 -0
- package/dist/types/test/verbatim.test.d.ts +1 -0
- package/dist/vite.js +5655 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nick Paustian
|
|
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
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# @lightspeed-js/core
|
|
2
|
+
|
|
3
|
+
Lightspeed is a compile-first framework for **islands of reactivity**: pages are static HTML generated at build time, and only the parts that need JavaScript hydrate. Components are single-file `.lsp` files with `<view>`, `<logic>` and `<style>` blocks, compiled by a Vite plugin.
|
|
4
|
+
|
|
5
|
+
> Early release (0.x). The API may change between minor versions.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @lightspeed-js/core
|
|
11
|
+
npm install -D vite typescript
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Works with Vite 6, 7 and 8.
|
|
15
|
+
|
|
16
|
+
## Set up
|
|
17
|
+
|
|
18
|
+
`vite.config.ts`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { defineConfig } from 'vite'
|
|
22
|
+
import { lightspeedPlugin } from '@lightspeed-js/core/vite'
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
plugins: [lightspeedPlugin({ typescript: true })],
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`src/main.ts`:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { createLightspeedApp } from '@lightspeed-js/core'
|
|
33
|
+
import { components } from 'virtual:lightspeed/components'
|
|
34
|
+
|
|
35
|
+
const app = createLightspeedApp()
|
|
36
|
+
app.useComponents(components)
|
|
37
|
+
app.hydrate()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Pages are `.html` files at the project root (or in `routes/`) that use components as tags, e.g. `<Header />`. Components live in `src/components/*.lsp`.
|
|
41
|
+
|
|
42
|
+
## A component
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<view>
|
|
46
|
+
<button class="counter" @click="state.count++">Clicked {{ state.count }} times</button>
|
|
47
|
+
</view>
|
|
48
|
+
|
|
49
|
+
<logic lang="ts">
|
|
50
|
+
import { reactive } from '@lightspeed-js/core'
|
|
51
|
+
|
|
52
|
+
const state = reactive({ count: 0 })
|
|
53
|
+
</logic>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.counter { padding: 0.5rem 1rem; }
|
|
57
|
+
</style>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Entry points
|
|
61
|
+
|
|
62
|
+
| Import | For |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `@lightspeed-js/core` | Runtime: `createLightspeedApp`, `reactive`, `shared`, `defineProps`, lifecycle hooks |
|
|
65
|
+
| `@lightspeed-js/core/vite` | The Vite plugin |
|
|
66
|
+
| `@lightspeed-js/core/ssg` | Static site generation |
|
|
67
|
+
| `@lightspeed-js/core/compile` | Compile components outside a Vite build (e.g. tests, a CMS) |
|
|
68
|
+
|
|
69
|
+
## Upgrading from the unpublished `lightspeed` package
|
|
70
|
+
|
|
71
|
+
Code importing `'lightspeed'` keeps working: component logic accepts both names, and the Vite plugin maps `'lightspeed'` to `@lightspeed-js/core`. Only `vite.config.ts` must change, because Node loads it before the plugin runs: import from `'@lightspeed-js/core/vite'`. New code should use `@lightspeed-js/core`.
|
|
72
|
+
|
|
73
|
+
## Licence
|
|
74
|
+
|
|
75
|
+
MIT
|