Commit Graph
83 Commits
Author SHA1 Message Date
Zef Hemel 26ba11b362 lint fixes 2025-11-07 16:29:19 +01:00
Zef Hemel 125c11721a New Share, Library, Repositories support 2025-11-07 16:28:20 +01:00
Zef Hemel 7cec9b6121 Lua: introduce net.* APIs and deprecate http.request in favor of new
net.proxyFetch API

Introduces foundation support for URIs (net.readURI, net.writeURI).
2025-11-07 10:51:17 +01:00
Zef Hemel f65abb4704 Lua: start of crypto.* API 2025-11-07 10:49:13 +01:00
Zef Hemel 4a34b6c6a3 Properly map JS call return value in Lua 2025-11-07 10:47:56 +01:00
Zef Hemel 44a9ae6c0e Support deletion of keys in YAML patch library 2025-11-07 10:47:11 +01:00
Zef Hemel f0d13b2d60 Lua: index.tag sanity check 2025-11-07 10:46:40 +01:00
Zef Hemel 63bb23f8fb Service bus (services API) implementation 2025-11-07 10:46:14 +01:00
Zef Hemel cc317d8451 Sanity check on KV key building (checking for string type) 2025-11-07 10:43:57 +01:00
Zef Hemel 732c6a5589 Loading of plugs is no longer restricted to _plug
Builtin plugs are generated under Library/Std/Plugs path now.
2025-11-07 10:43:25 +01:00
Matouš Jan FialkaandGitHub 3422a9fa20 Add Space Lua benchmarks based on Deno.bench aligned to Deno.test (#1649)
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-11-05 15:06:33 +01:00
Zef Hemel 1b28f04bdf A few refinements for Lua APIs 2025-10-31 17:07:40 +01:00
Zef Hemel 5654a6bc6d config.insert syscall 2025-10-31 09:13:24 +01:00
Zef Hemel f28815d642 Fixes #1622 2025-10-30 15:48:19 +01:00
Zef Hemel c3aea2cf8c When a Lua error occurs, report it and jump to source of occurance (best
effort)
2025-10-30 15:35:34 +01:00
Zef Hemel 000b76a6f7 Support adding additional content to <head> using the SB_HEAD_HTML env
variable
2025-10-30 11:42:08 +01:00
Zef Hemel 4c8dc704b7 Support embedded widgets and markdown with dom.* API 2025-10-29 09:30:48 +01:00
Zef Hemel dbe80bed8c Nicer error in case of empty Lua expression n directive 2025-10-29 08:56:08 +01:00
Zef Hemel 1838cc4eb1 Encryption auth redirect 2025-10-23 09:18:51 +02:00
Zef Hemel 18bea2e113 Client: Clean command 2025-10-23 09:03:57 +02:00
Zef HemelandGitHub 272f293ddb Optional client encryption (#1640)
Implements #1268
2025-10-22 15:35:37 +02:00
Matouš Jan FialkaandGitHub cd6f4e9c58 Space Lua: Align .. (concatenation) operator (#1648)
* Make fallback accept only strings and numbers (as per standard Lua).

* Remove `luaToString` from the fallback. It fits well presentation
  purposes but is too complicated for strict semantic checking in the
  evaluator and also wrongly coersed non-string and non-number value.
  It may also return a promise but we require synchronous error path.

* Concatenating `nil` now throws "attempt to concatenate nil value" as
  per standard Lua.

* Other types throw "attempt to concatenate a non-string or non-number"
  which is simplified message diverting from standard Lua which throws
  typed error but we do not strictly need that for Space Lua (and can be
  easily added anytime in the future).

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-22 10:41:26 +02:00
Matouš Jan FialkaandGitHub 4b9829c59c Space Lua: Add rawget and rawequal functions (#1647)
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-21 13:41:36 +02:00
Matouš Jan FialkaandGitHub 9292ae4b74 Space Lua: Align length features with standard Lua (#1637)
* Align `#` operator and `__len` metamethod with Lua and add `rawlen` function

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-21 09:55:38 +02:00
Zef Hemel 82800ad9bc No longer supress errors coming from event handlers 2025-10-20 19:50:55 +02:00
Matouš Jan FialkaandGitHub b363bd7e59 Fix serious truthiness evaluation flaws. (#1644)
In Lua, only the last expression in an argument list preserves multiple
results and all earlier expressions yield exactly one value (their first).

For example:

```
f(a(), b(), c())
```

where

```
a -> (1,2)
b -> (3,4)
c -> (5,6)
```

becomes

```
f(1, 3, 5, 6)
```

which matches Lua behaviour (tested in version 5.4).

Changes:

* Function argument lists keep multiple results only from the last
  argument.

* Fixes failing truthiness tests (`true and ret_one_two()`).

Sidenote: the `truthiness_test.lua` was not called at all because of
my obvious copy/paste typo (the `arithmetical_test.lua` was called twice
instead; now fixed too and both test suites pass ok).
2025-10-20 17:34:45 +02:00
Matouš Jan FialkaandGitHub 27339c98f6 Space Lua: Align arithmetic model with standard Lua (#1611)
* Align Space Lua arithmetic model with standard Lua
* Add missing __unm and __bnot metamethods
- add new basic tests
- add helper for negative tests
* Add comments for ASCII numeric constants

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-16 08:41:47 +02:00
Matouš Jan FialkaandGitHub cb4f392c05 Add huge constant and type() function to the math API (#1632)
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-16 08:27:56 +02:00
Matouš Jan FialkaandGitHub aa1e61b646 Space Lua: Add load function (#1631)
* Add `load` Lua builtin

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-16 08:19:37 +02:00
onespacemanandGitHub c797273028 Expose codemirror's toggleComment command (#1635) 2025-10-16 08:18:46 +02:00
Matouš Jan FialkaandGitHub 0856e3fda2 Space Lua: Fix truthiness semantic deviation (#1630)
* Space Lua: Fix truthiness semantic deviation

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-15 09:15:44 +02:00
numanandGitHub afebdcf64c fix: bottom search bar dark mode styles (#1614) 2025-10-11 20:12:11 +02:00
Zef Hemel 3fa9c82add Fixes #1598
Lua: Implements %u in os.date()
2025-10-10 09:11:14 +02:00
Zef Hemel 5c4c71df8e Fixes #1608
Status code is now passed via x-proxy-status-code header
2025-10-10 08:51:24 +02:00
MrMugameandGitHub 00af994d69 Fix navigation for Autolinks and clean up code (#1607) 2025-10-10 08:42:25 +02:00
Zef Hemel 18e78e5006 Lua: fix key deletion in tables 2025-10-09 09:19:58 +02:00
Zef Hemel 83aa5bc349 Fix in content type handling of http.request 2025-10-08 08:59:28 +02:00
Zef Hemel b126320c5a Better readOnly checking, making sure that tag pages are never saved,
for instance
2025-10-07 14:33:54 +02:00
Zef Hemel f9527c8238 Lua: allow passing in a number to tonumber 2025-10-07 09:07:12 +02:00
Zef Hemel ad94c95c18 Lint 2025-10-06 17:22:49 +02:00
Zef Hemel dde3433b87 Some tag page improvements:
* More efficient
* Now also exposes data objects

New markdown.objectToTable syscall to turn a list of objects into a
markdown table.
2025-10-06 17:22:10 +02:00
Zef Hemel 51e1eaf817 /.proxy enhancements
Now cleanly separates request and response headers for the request and
response of the http request from the ones that SB needs/serves itself.
2025-10-06 14:38:00 +02:00
Zef Hemel fff65f9094 Fixes #1593
Lua widget output can now be selected
2025-10-06 10:35:05 +02:00
Matouš Jan FialkaandGitHub e91bec71c0 Fix Lua arithmetic model (#1587)
This patch fixes the Lua arithmetic model at parser level only. Runtime
level fixtures are left for future work.

MOTIVATION

Space Lua treats all numbers as IEEE-754 doubles (JS semantics), so it
preserves negative zero. Lua uses integers and floats. The literal "-0"
in Lua is parsed as unary minus applied to the integer literal "0",
which yields the integer "0" (no sign). This difference flips the sign
of the divisor in "1/-0" and "-1/-0". Although it could be fixed without
touching the parser by changing only unary minus evaluation, this commit
goes a little further and provides integer vs float differenciating at
the parser level as well uses it to fix the unary minus evaluation.

Extensive tests are added to test this exact change works and the Space
Lua arithmetic model is aligned with Lua. Note that things like `-(expr)`
in general may still produce results inconsistent with Lua. This cannot
be fixed at parser level and must be fixed at runtime level which will
need far more complex change to the Space Lua interpreter code. Therefor
these cases we omitted from the tests.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-03 16:31:00 +02:00
Matouš Jan FialkaandGitHub 9967cf1fd1 Space Lua: Remove unary plus (#1585)
* Improve documentation on string to number conversion (plus minor fixes of typos)
* Update Lua grammar to disallow unary plus

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-03 08:28:36 +02:00
Zef Hemel df7eff1e3d make fmt 2025-10-01 17:14:54 +02:00
Zef Hemel b333d4ac36 Remove redundant disk_space_primitives 2025-10-01 17:14:46 +02:00
Matouš Jan FialkaandGitHub 80f31da16b Fix arithmetic coercion - refactored and enhanced (#1576)
The Lua 5.4 compatible `tonumber` implementation completely reworked

- custom char-by-char parser (no regexes)
- proper Lua space handling
- support for heximal integers and floats
- support for scientific float notation
- extended tests
- updated website docs

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-01 11:30:58 +02:00
Zef Hemel 26d9d5bdf0 Restructure standard library and improve documentation
Refactor Library/Std into subfolders for APIs, Infrastructure, Editor,
Widgets, etc. Add more documentation and descriptions. Update references
throughout website and docs.
2025-10-01 11:22:31 +02:00
Zef Hemel 6ca64f1e3f Bring back the page:saved event 2025-10-01 08:36:16 +02:00