@skillstech/thunderlang 0.5.8 → 0.5.10
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 +63 -0
- package/dist/core.cjs +1581 -149
- package/dist/index.cjs +1094 -110
- package/dist/learn.cjs +1535 -127
- package/package.json +1 -1
- package/src/core.d.ts +1 -1
- package/src/core.mjs +1 -1
- package/src/emit.mjs +1 -1
- package/src/model.mjs +44 -19
- package/src/read-repo.d.mts +7 -0
- package/src/read-repo.mjs +21 -0
- package/src/read.mjs +29 -8
- package/src/same.mjs +2 -2
- package/src/sql.mjs +387 -0
- package/src/steps.mjs +531 -22
- package/src/things-langs.mjs +352 -0
- package/src/thunderize.mjs +3 -4
- package/src/visual.d.mts +1 -1
- package/src/visual.mjs +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
# 0.5.10
|
|
2
|
+
|
|
3
|
+
**Language: SQL.** Thunder reads `.sql` files: tables become Data or Things (columns in words, defaults, always
|
|
4
|
+
set, what they point to), `CREATE TYPE … AS ENUM` becomes Choices, `CHECK` and `UNIQUE` become rules the table
|
|
5
|
+
enforces (a No stops the row: "Refused by the database"), and views, functions, procedures (PL/pgSQL), and triggers
|
|
6
|
+
become steps. PostgreSQL first; MySQL, SQLite, and SQL Server where their syntax agrees. Spec section 9 updated.
|
|
7
|
+
|
|
8
|
+
**Read once.** `readFiles(files)` (in `/core`) reads every file once; `thunderModel`, `thunderizeFiles`, and
|
|
9
|
+
`sameMeaning` reuse each file's `reading`, with identical results. On Django (2,376 files) the three stages together
|
|
10
|
+
take 3.8 s reading once, against 11.6 s when each stage reads. The model no longer checks every Thing against every
|
|
11
|
+
member when it tidies empty classes (13.3 s to 3.4 s on Django). `scripts/perf.mjs` reports both totals.
|
|
12
|
+
|
|
13
|
+
**Language: Big Picture in all ten languages.** Classes, structs, records, data classes, and enums become Things,
|
|
14
|
+
Data, and Choices in Java, C#, Kotlin, PHP, Go, Rust, and Ruby, as they already did in Python, TypeScript, and
|
|
15
|
+
JavaScript: what each knows (with its kind in words and how it starts, from constructors, `init`, `__construct`,
|
|
16
|
+
`initialize`, Go `NewX`, and Rust `new`), its choices, its doc comment, and what it can do. Go methods with a
|
|
17
|
+
receiver and Rust `impl` blocks belong to their type although they are written outside it. Interfaces and traits
|
|
18
|
+
are contracts, not Things. Empty error classes are left out (errors show where they stop a path); other empty classes
|
|
19
|
+
are records. Checked on cobra, log, MediatR, gson, timber, guzzle, and sinatra.
|
|
20
|
+
|
|
21
|
+
**Language: Details for web handlers.** What follows a guard that can stop only happens on its other side (an
|
|
22
|
+
action's answer says "when Is org set? Yes", not "Always"), and a returned object names its keys ("Gives back org,
|
|
23
|
+
repos, avg, and failing").
|
|
24
|
+
**Language: functions inside functions, values chosen by if / match / when, do … while, and Go select are read.**
|
|
25
|
+
Fewer steps are left as code ("Not read yet"); see docs/language-audit.md for the numbers on 11 open-source repos
|
|
26
|
+
(formik branches shown 52% → 91%, timber 73% → 91%, cobra 64% → 81%).
|
|
27
|
+
- Functions written inside a function show their own steps under the step that holds them (marked `nested: true`):
|
|
28
|
+
React `useEffect` ("When this first shows on screen, and whenever user id changes", "Every time this is drawn on
|
|
29
|
+
screen", cleanup "When this is taken off the screen, cleans up"), `useMemo` ("Works out full name and remembers
|
|
30
|
+
it until user changes"), `useCallback` and `use…Callback` ("Defines how handle save works"), inner functions and
|
|
31
|
+
Python inner `def`s, Go `go func() {…}()` ("Starts these steps running alongside, without waiting for them") and
|
|
32
|
+
`defer func() {…}()` ("At the end, runs these steps"), Go function values, Java/C# lambdas, Rust closures,
|
|
33
|
+
Kotlin trailing lambdas (`user?.let { … }` reads "If user is set", `repeat(3)` "Repeats 3 times"), Ruby `do`
|
|
34
|
+
blocks, `setTimeout` ("After 300 milliseconds"), event listeners (`Whenever "click" happens`) and promise
|
|
35
|
+
callbacks ("When load is done", "If load goes wrong"). `return new Promise((resolve) => { … })` reads "Makes a
|
|
36
|
+
new Promise with these steps", then "Returns a new Promise". Python `with`, C# `using`/`lock` and Java
|
|
37
|
+
`synchronized` blocks show their steps (Java `synchronized (x) {` is no longer read as a function).
|
|
38
|
+
- `if` used as a value reads like a ternary: Kotlin `val x = if (a) b else c`, Rust `let x = if a { b } else { c }`,
|
|
39
|
+
Ruby `x = if a then b else c end` ("Sets bonus to 5 if score is more than 90, otherwise 0"). Over several lines
|
|
40
|
+
it reads as the question, each side ending in "Sets label to …" (or "Returns …" for `return if` / `return when`).
|
|
41
|
+
- The arms of a Rust `match`, Kotlin `when`, C# `switch` expression and PHP `match` are read one by one, each with
|
|
42
|
+
what it does: "When it is from 0 to 49" → "Sets label to "fail"", "When it is stop or halt", "Otherwise".
|
|
43
|
+
Kotlin `when (x) {` reads "Chooses by x" (was "If x is set").
|
|
44
|
+
- `do { … } while (cond)` reads "Runs once, then repeats while …" with its steps (was "Calls do" plus a separate
|
|
45
|
+
loop with no steps). `for (; i < n; i++)` reads "Repeats while i is less than n".
|
|
46
|
+
- Go `select` reads "Waits for whichever of these is ready first" (with `default`: "Checks which of these is ready,
|
|
47
|
+
without waiting"); its cases read "When msg arrives from ch", "When ctx is cancelled or times out", "When 5
|
|
48
|
+
seconds have passed", "When 1 can be sent to out", "If none is ready yet". `fallthrough` reads "Carries on into
|
|
49
|
+
the next case too". `switch {` reads "Checks these cases in order" and its cases "When age is more than 65".
|
|
50
|
+
- A `case 'a':` / `default:` label is a statement of its own, so the first step of every case is shown (it was
|
|
51
|
+
folded into the label). A bare `{ … }` block inside a case is read in place.
|
|
52
|
+
- Also fixed: a Python comprehension filter (`[i for i in xs if keep(i)]`) is no longer read as "If keep(i)]";
|
|
53
|
+
an `if` condition written over several lines is read whole; `(x as T).then(…)` keeps its parentheses;
|
|
54
|
+
`delete registry[name]` reads "Removes name from registry"; Ruby `else "value"` on one line keeps its value.
|
|
55
|
+
|
|
56
|
+
# 0.5.9
|
|
57
|
+
|
|
58
|
+
**Language: redirects say where the person goes.** A redirect reads "Sends the person to /login" (or "the Google
|
|
59
|
+
auth URL", "the dashboard page") instead of "Gives back the result of redirect", and has its own step kind,
|
|
60
|
+
`redirect` (mark ↪), in `THUNDER_VISUAL.does`. Fastify and Express `redirect`, `Response`/`NextResponse.redirect`,
|
|
61
|
+
Flask/Django/Next `redirect(...)`, `HttpResponseRedirect`, FastAPI `RedirectResponse`, Laravel `redirect()->route()`.
|
|
62
|
+
Found by OpenThunder on its own sign-in route.
|
|
63
|
+
|
|
1
64
|
# 0.5.8
|
|
2
65
|
|
|
3
66
|
**Language: Details is a fact sheet.** `readLevel(model, 'details', id)` now gives what you need to check before you
|