typenative 0.0.21 → 0.1.1
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/.github/workflows/ci.yml +29 -0
- package/.github/workflows/npm-publish-github-packages.yml +3 -3
- package/CHANGELOG.md +81 -0
- package/CONTRIBUTION.md +130 -0
- package/README.md +258 -183
- package/bin/index.js +2 -3
- package/bin/parse-node.js +2 -2
- package/bin/transpiler.js +6914 -1686
- package/conformance.md +651 -0
- package/package.json +10 -41
- package/tsparser/main.go +2 -2
- package/tsparser/tsparser.exe +2 -2
- package/TODO.md +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typenative",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Build native applications using Typescript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,41 +10,11 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"watch": "tsc --watch",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"test3_node": "tsc test/test3.spec.ts && node test/test3.spec.js && rimraf test/test3.spec.js",
|
|
19
|
-
"test4": "node ./bin/index --source test/test4.spec.ts --script",
|
|
20
|
-
"test5": "node ./bin/index --source test/test5.spec.ts --script",
|
|
21
|
-
"test6": "node ./bin/index --source test/test6.spec.ts --script",
|
|
22
|
-
"test7": "node ./bin/index --source test/test7.spec.ts --script",
|
|
23
|
-
"test8": "node ./bin/index --source test/test8.spec.ts --script",
|
|
24
|
-
"test9": "node ./bin/index --source test/test9.spec.ts --script",
|
|
25
|
-
"test10": "node ./bin/index --source test/test10.spec.ts --script",
|
|
26
|
-
"test11": "node ./bin/index --source test/test11.spec.ts --script",
|
|
27
|
-
"test12": "node ./bin/index --source test/test12.spec.ts --script",
|
|
28
|
-
"test13": "node ./bin/index --source test/test13.spec.ts --script",
|
|
29
|
-
"test14": "node ./bin/index --source test/test14.spec.ts --script",
|
|
30
|
-
"test15": "node ./bin/index --source test/test15.spec.ts --script",
|
|
31
|
-
"test16": "node ./bin/index --source test/test16.spec.ts --script",
|
|
32
|
-
"test17": "node ./bin/index --source test/test17.spec.ts --script",
|
|
33
|
-
"test18": "node ./bin/index --source test/test18.spec.ts --script",
|
|
34
|
-
"test19": "node ./bin/index --source test/test19.spec.ts --script",
|
|
35
|
-
"test20": "node ./bin/index --source test/Test20.spec.ts --script",
|
|
36
|
-
"test21": "node ./bin/index --source test/Test21.spec.ts --script",
|
|
37
|
-
"test22": "node ./bin/index --source test/Test22.spec.ts --script",
|
|
38
|
-
"test23": "node ./bin/index --source test/Test23.spec.ts --script",
|
|
39
|
-
"test24": "node ./bin/index --source test/Test24.spec.ts --script",
|
|
40
|
-
"test25": "node ./bin/index --source test/Test25.spec.ts --script",
|
|
41
|
-
"test25_export": "node ./bin/index --source test/Test25-export.spec.ts --script",
|
|
42
|
-
"test26": "node ./bin/index --source test/Test26.spec.ts --script",
|
|
43
|
-
"test27": "node ./bin/index --source test/Test27.spec.ts --script",
|
|
44
|
-
"test28": "node ./bin/index --source test/test28.spec.ts --script",
|
|
45
|
-
"test29": "node ./bin/index --source test/test29.spec.ts --script",
|
|
46
|
-
"test30": "node ./bin/index --source test/test30.spec.ts --script",
|
|
47
|
-
"test32": "node ./bin/cli.js --source test/test31.spec.ts --script"
|
|
13
|
+
"build:native": "node scripts/build-native.mjs",
|
|
14
|
+
"conformance": "node scripts/conformance.mjs",
|
|
15
|
+
"conformance:parallel": "node scripts/conformance-parallel.mjs",
|
|
16
|
+
"test": "npm run conformance",
|
|
17
|
+
"release": "npm publish"
|
|
48
18
|
},
|
|
49
19
|
"repository": {
|
|
50
20
|
"type": "git",
|
|
@@ -57,13 +27,12 @@
|
|
|
57
27
|
},
|
|
58
28
|
"homepage": "https://github.com/danisss9/typenative#readme",
|
|
59
29
|
"devDependencies": {
|
|
60
|
-
"@types/inquirer": "^9.0.
|
|
61
|
-
"@types/node": "^
|
|
62
|
-
"execa": "^9.6.1",
|
|
30
|
+
"@types/inquirer": "^9.0.10",
|
|
31
|
+
"@types/node": "^24.19.2",
|
|
63
32
|
"rimraf": "^6.1.3"
|
|
64
33
|
},
|
|
65
34
|
"dependencies": {
|
|
66
|
-
"inquirer": "^
|
|
67
|
-
"typescript": "^
|
|
35
|
+
"inquirer": "^14.2.3",
|
|
36
|
+
"typescript": "^6.0.3"
|
|
68
37
|
}
|
|
69
38
|
}
|
package/tsparser/main.go
CHANGED
|
@@ -187,9 +187,9 @@ func serializeField(name string, v reflect.Value) (string, any, bool) {
|
|
|
187
187
|
case reflect.Bool:
|
|
188
188
|
return lowerFirst(name), v.Bool(), true
|
|
189
189
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
|
190
|
-
// Operator fields hold token kinds; emit the kind name (matches the
|
|
190
|
+
// Operator/Token fields hold token kinds; emit the kind name (matches the
|
|
191
191
|
// Node producer, which converts ts.SyntaxKind numbers to names)
|
|
192
|
-
if name == "operator" { // prelude lowercased the field name
|
|
192
|
+
if name == "operator" || name == "token" { // prelude lowercased the field name
|
|
193
193
|
kind := ast.Kind(v.Int())
|
|
194
194
|
return lowerFirst(name), strings.TrimPrefix(kind.String(), "Kind"), true
|
|
195
195
|
}
|
package/tsparser/tsparser.exe
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/tsparser/tsparser.exe
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 37234176 bytes
|
|
4
|
+
sha256: ce98ee3136dc50c07e1d3c12ace366c7f7180982c7cc14615ac614ab34fc63ae
|
package/TODO.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Self-Hosting Roadmap
|
|
2
|
-
|
|
3
|
-
Goal: TypeNative transpiles itself into a native Go binary (1.0 milestone).
|
|
4
|
-
|
|
5
|
-
## Done
|
|
6
|
-
- [x] node:fs mappings (read/write/append/exists/mkdir/readdir/copy/rm) via Go helpers
|
|
7
|
-
- [x] node:url (fileURLToPath/pathToFileURL), node:os (platform/homedir/tmpdir)
|
|
8
|
-
- [x] node:child_process (spawnSync-shaped sync API, stdio-inherit runs)
|
|
9
|
-
- [x] node:readline sync `question` (stdin prompts in native binaries)
|
|
10
|
-
- [x] Go helper-function registry emitted into the main output file
|
|
11
|
-
- [x] Per-file import scoping (imports registered after function-body visits)
|
|
12
|
-
- [x] Unbraced if/else-if/else statements, `%`/`%=` → math.Mod
|
|
13
|
-
- [x] nanoid/fs-extra/execa removed from src; inquirer isolated in Node-only cli.ts
|
|
14
|
-
- [x] Transpilable core: src/index.ts (run/createProject), src/prompt.ts, src/main.ts (self-host entry)
|
|
15
|
-
|
|
16
|
-
## Done (phase 3a/3b)
|
|
17
|
-
- [x] tsparser/ Go tool: parses TS via buke/typescript-go-internal (no JS runtime),
|
|
18
|
-
emits normalized JSON AST (kind + TS-spec field names)
|
|
19
|
-
- [x] src/parse-node.ts: Node adapter (typescript npm pkg → same JSON shape)
|
|
20
|
-
- [x] Verified byte-identical AST signatures across all 32 test specs AND all
|
|
21
|
-
compiler sources (incl. transpiler.ts, 521k-char signature)
|
|
22
|
-
|
|
23
|
-
- [x] ts shim converted to plain isX() functions + string kind literals
|
|
24
|
-
(object-literal shim was itself untranspilable)
|
|
25
|
-
- [x] Phase 3c: transpiler.ts no longer imports `typescript` — consumes the JSON AST
|
|
26
|
-
via an injected parse function (ts shim keeps predicate call sites); operator
|
|
27
|
-
tokens, process.env, stdin-exec mappings added; verified identical Go output
|
|
28
|
-
via npm parser and Go-parser paths on all 33 test specs
|
|
29
|
-
- [ ] Phase 4: dogfood src/transpiler.ts (2.6k lines): regex /g semantics,
|
|
30
|
-
String.replace with function replacer, JSON.parse result typing, object spread,
|
|
31
|
-
Array.includes on untyped values, default-import namespace stripping (ts.x → x)
|
|
32
|
-
- [ ] import.meta.url lowering
|
|
33
|
-
- [ ] Phase 5: stage-1/stage-2 bootstrap + run test suite through the native binary
|
|
34
|
-
- [ ] Phase 5: CI self-hosting job; README/CHANGELOG updates
|