@skillstech/thunderlang 1.2.0 → 1.4.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 +190 -0
- package/dist/core.cjs +6718 -1232
- package/dist/index.cjs +17490 -12204
- package/dist/learn.cjs +5866 -497
- package/package.json +6 -2
- package/src/cli-home.mjs +1 -1
- package/src/cli.mjs +54 -6
- package/src/core/ThunderRuntime.cs +1367 -0
- package/src/core/check.mjs +158 -2
- package/src/core/cli.mjs +148 -8
- package/src/core/csharp-run.mjs +184 -0
- package/src/core/diagnostics.mjs +13 -1
- package/src/core/engine-core.mjs +285 -2
- package/src/core/engine-values.mjs +1 -1
- package/src/core/format.mjs +191 -3
- package/src/core/go-run.mjs +106 -0
- package/src/core/index.mjs +2 -1
- package/src/core/java/thunder/T.java +6 -0
- package/src/core/java/thunder/ThunderRuntime.java +1374 -0
- package/src/core/java-run.mjs +89 -0
- package/src/core/parser.mjs +331 -5
- package/src/core/project.mjs +31 -6
- package/src/core/react-run.mjs +96 -0
- package/src/core/runtime-go/thunder_runtime.go +3038 -0
- package/src/core/runtime-react.mjs +133 -0
- package/src/core/rust/thunder_runtime.rs +1645 -0
- package/src/core/rust-run.mjs +192 -0
- package/src/core/screen-values.mjs +30 -0
- package/src/core/target-csharp.mjs +484 -0
- package/src/core/target-go.mjs +555 -0
- package/src/core/target-java.mjs +587 -0
- package/src/core/target-react.mjs +270 -0
- package/src/core/target-rust.mjs +534 -0
- package/src/core/target-typescript.mjs +2 -2
- package/src/core.d.ts +59 -0
- package/src/core.mjs +14 -0
- package/src/emit.mjs +1 -1
- package/src/faithful.mjs +34 -1
- package/src/flow/access.mjs +1451 -0
- package/src/flow/ts-parse.mjs +772 -0
- package/src/index.d.ts +3 -0
- package/src/index.mjs +3 -0
- package/src/libraries.mjs +32 -4
- package/src/model.mjs +72 -9
- package/src/passport-cli.mjs +101 -0
- package/src/passport-fs.d.mts +9 -0
- package/src/passport-fs.mjs +180 -0
- package/src/passport.d.mts +46 -0
- package/src/passport.mjs +255 -0
- package/src/program.d.mts +31 -0
- package/src/program.mjs +14 -0
- package/src/read-level.mjs +48 -2
- package/src/read-repo-fs.mjs +3 -1
- package/src/read.mjs +64 -5
- package/src/replay-cli.mjs +123 -0
- package/src/review.mjs +31 -3
- package/src/say-less.mjs +168 -13
- package/src/screens.mjs +833 -0
- package/src/steps.mjs +443 -20
- package/src/term.mjs +43 -0
- package/src/things-langs.mjs +20 -3
- package/src/write-across-cli.mjs +143 -0
- package/src/write-across.mjs +168 -0
package/src/emit.mjs
CHANGED
|
@@ -30,7 +30,7 @@ export function notesSummary(ast) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const COMPILER_VERSION = '1.
|
|
33
|
+
export const COMPILER_VERSION = '1.4.0';
|
|
34
34
|
export const PROOF_SCHEMA_VERSION = '0.1.0';
|
|
35
35
|
// Identifies which ecosystem product emitted this proof. Consumed by SkillsTech
|
|
36
36
|
// Certified to key cert proofs to the compiler. Stable slug per the coordination bus.
|
package/src/faithful.mjs
CHANGED
|
@@ -128,10 +128,43 @@ export function accountsFor(code, said, tree = null) {
|
|
|
128
128
|
const bare = stripQuoted(String(said).replace(/`[^`]*`/g, 'Q'));
|
|
129
129
|
if (/&&|\|\||[!=]==?|<=|>=|\s[<>]\s|^\s*[<>]|\bis is\b/.test(bare)) return false;
|
|
130
130
|
const c = tree && tree.kind !== 'code' ? exprCounts(tree) : codeCounts(code), w = wordCounts(said);
|
|
131
|
-
|
|
131
|
+
// C#'s String.IsNullOrEmpty / IsNullOrWhiteSpace asks two things in one call (null, or empty): its "or" is in the
|
|
132
|
+
// name, so "x is empty or missing" keeps the code's logic exactly.
|
|
133
|
+
const named = (String(code).match(/\bIsNullOr(?:Empty|WhiteSpace)\s*\(/g) || []).length;
|
|
134
|
+
return c.neg === w.neg && c.logic + named === w.logic && w.compare >= c.compare;
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
/** A piece of code shown as code: in backticks, shortened visibly when it is long. */
|
|
135
138
|
export const asCodeWords = (code, n = 120) => { const t = String(code).replace(/\s+/g, ' ').trim(); return `\`${t.length > n ? `${t.slice(0, n - 1)}…` : t}\``; };
|
|
136
139
|
/** True when a condition's words are the code itself (the gate fell back). */
|
|
137
140
|
export const isCodeWords = (said) => /^`[^]*`$/.test(String(said).trim());
|
|
141
|
+
|
|
142
|
+
/** A Python import in words (the reader's form in steps.mjs, checked by say-less): null when it is not one plain import. */
|
|
143
|
+
export function pythonImportSays(code) {
|
|
144
|
+
const t = String(code).trim().replace(/\s*#.*$/, '');
|
|
145
|
+
const named = (x) => { const m = /^([A-Za-z_]\w*)(?:\s+as\s+([A-Za-z_]\w*))?$/.exec(x.trim()); return m ? (m[2] && m[2] !== m[1] ? `${m[1]} (called ${m[2]} here)` : m[1]) : null; };
|
|
146
|
+
const list = (xs) => (xs.length <= 1 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs.at(-1)}`);
|
|
147
|
+
let m;
|
|
148
|
+
if ((m = /^import\s+([A-Za-z_][\w.]*)(?:\s+as\s+([A-Za-z_]\w*))?$/.exec(t))) return `Loads the ${m[1]} module${m[2] && m[2] !== m[1] ? `, called ${m[2]} here` : ''}`;
|
|
149
|
+
if ((m = /^from\s+(\.?)([A-Za-z_][\w.]*)?\s+import\s+\(?([^()*]+?)\)?$/.exec(t))) {
|
|
150
|
+
const names = m[3].split(',').map((x) => x.trim()).filter(Boolean).map(named);
|
|
151
|
+
if (!names.length || names.some((x) => !x) || (!m[1] && !m[2])) return null;
|
|
152
|
+
const from = m[1] ? (m[2] ? `the ${m[2]} module in this package` : 'this package') : `the ${m[2]} module`;
|
|
153
|
+
return `Loads ${list(names)} from ${from}`;
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A Python slice (or the last item) in words, `{x}` standing for the list: `[1:]` "{x} without the first 1", `[:3]`
|
|
160
|
+
* "the first 3 of {x}", `[-2:]` "the last 2 of {x}", `[:-1]` "{x} without the last 1", `[-1]` "the last of {x}". Null
|
|
161
|
+
* for anything else (both ends, a step, or a name for an end). Used by the reader and by say-less's check.
|
|
162
|
+
*/
|
|
163
|
+
export function sliceWords(start, end, single) {
|
|
164
|
+
if (single != null) return single === '-1' ? 'the last of {x}' : null;
|
|
165
|
+
const n = (x) => (x == null || x === '' ? null : Number(x));
|
|
166
|
+
const a = n(start), b = n(end);
|
|
167
|
+
if (a != null && b == null) return a > 0 ? `{x} without the first ${a}` : a < 0 ? `the last ${-a} of {x}` : null;
|
|
168
|
+
if (a == null && b != null) return b > 0 ? `the first ${b} of {x}` : b < 0 ? `{x} without the last ${-b}` : null;
|
|
169
|
+
return null;
|
|
170
|
+
}
|