ticbuild 1.0.11 → 1.0.13
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/README.md +323 -5
- package/dist/backend/importUtils.d.ts +1 -0
- package/dist/backend/importUtils.d.ts.map +1 -1
- package/dist/backend/importUtils.js +4 -0
- package/dist/backend/importUtils.js.map +1 -1
- package/dist/backend/importers/LuaCodeImporter.d.ts +4 -1
- package/dist/backend/importers/LuaCodeImporter.d.ts.map +1 -1
- package/dist/backend/importers/LuaCodeImporter.js +6 -3
- package/dist/backend/importers/LuaCodeImporter.js.map +1 -1
- package/dist/backend/luaPreprocessor.d.ts +11 -0
- package/dist/backend/luaPreprocessor.d.ts.map +1 -1
- package/dist/backend/luaPreprocessor.js +131 -45
- package/dist/backend/luaPreprocessor.js.map +1 -1
- package/dist/backend/sourceMap.d.ts +31 -0
- package/dist/backend/sourceMap.d.ts.map +1 -0
- package/dist/backend/sourceMap.js +155 -0
- package/dist/backend/sourceMap.js.map +1 -0
- package/dist/backend/sourceMap.test.d.ts +2 -0
- package/dist/backend/sourceMap.test.d.ts.map +1 -0
- package/dist/backend/sourceMap.test.js +36 -0
- package/dist/backend/sourceMap.test.js.map +1 -0
- package/dist/backend/symbolIndex.d.ts +67 -0
- package/dist/backend/symbolIndex.d.ts.map +1 -0
- package/dist/backend/symbolIndex.js +905 -0
- package/dist/backend/symbolIndex.js.map +1 -0
- package/dist/backend/symbolIndex.test.d.ts +2 -0
- package/dist/backend/symbolIndex.test.d.ts.map +1 -0
- package/dist/backend/symbolIndex.test.js +198 -0
- package/dist/backend/symbolIndex.test.js.map +1 -0
- package/dist/backend/tic80Controller/discovery.d.ts +19 -0
- package/dist/backend/tic80Controller/discovery.d.ts.map +1 -0
- package/dist/backend/tic80Controller/discovery.js +181 -0
- package/dist/backend/tic80Controller/discovery.js.map +1 -0
- package/dist/backend/tic80Controller/discovery.test.d.ts +2 -0
- package/dist/backend/tic80Controller/discovery.test.d.ts.map +1 -0
- package/dist/backend/tic80Controller/discovery.test.js +132 -0
- package/dist/backend/tic80Controller/discovery.test.js.map +1 -0
- package/dist/buildInfo.d.ts +4 -4
- package/dist/buildInfo.js +4 -4
- package/dist/frontend/core.d.ts.map +1 -1
- package/dist/frontend/core.js +10 -0
- package/dist/frontend/core.js.map +1 -1
- package/dist/frontend/terminal.d.ts +10 -0
- package/dist/frontend/terminal.d.ts.map +1 -0
- package/dist/frontend/terminal.js +321 -0
- package/dist/frontend/terminal.js.map +1 -0
- package/dist/frontend/terminal.test.d.ts +2 -0
- package/dist/frontend/terminal.test.d.ts.map +1 -0
- package/dist/frontend/terminal.test.js +15 -0
- package/dist/frontend/terminal.test.js.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/obj/build.log +5 -5
- package/dist/utils/console.d.ts.map +1 -1
- package/dist/utils/console.js +15 -7
- package/dist/utils/console.js.map +1 -1
- package/dist/utils/help.d.ts +3 -0
- package/dist/utils/help.d.ts.map +1 -1
- package/dist/utils/help.js +15 -0
- package/dist/utils/help.js.map +1 -1
- package/dist/utils/lua/lua_doc.d.ts +4 -0
- package/dist/utils/lua/lua_doc.d.ts.map +1 -0
- package/dist/utils/lua/lua_doc.js +31 -0
- package/dist/utils/lua/lua_doc.js.map +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +10 -0
- package/dist/utils/utils.js.map +1 -1
- package/package.json +1 -1
- package/templates/TIC-80-ticbuild/tic80.exe +0 -0
- package/templates/builtins/tic80.lua +316 -0
- package/templates/help/disco.txt +11 -0
- package/templates/help/main.txt +3 -0
- package/templates/help/terminal.txt +18 -0
- package/templates/help/tic80.txt +5 -1
- package/templates/help/tt.txt +17 -0
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@ A build & watch system for TIC-80 cart development.
|
|
|
5
5
|
|
|
6
6
|
* Multi-file Lua dev system
|
|
7
7
|
* Watch system: live-update a running tic80 when dependent files are updated.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Rich Lua preprocessing
|
|
8
|
+
* Sprites, music, map data import from existing carts
|
|
9
|
+
* Lua preprocessing (`#include`, `#macro`, `#if`, et al)
|
|
11
10
|
* Code size up to 512kb
|
|
12
|
-
*
|
|
11
|
+
* Timing and profiling information
|
|
12
|
+
* Encoding, importing tools
|
|
13
13
|
|
|
14
14
|
## Links
|
|
15
15
|
|
|
@@ -596,6 +596,324 @@ allowed (this is an error).
|
|
|
596
596
|
And for the code chunk alone, if code is larger than 1 bank, it gets automatically
|
|
597
597
|
split across multiple banks.
|
|
598
598
|
|
|
599
|
+
|
|
600
|
+
# Symbol / intellisense database / map / index
|
|
601
|
+
|
|
602
|
+
Builds shall output a JSON index that can be used for intellisense / code inspection.
|
|
603
|
+
|
|
604
|
+
## Models
|
|
605
|
+
|
|
606
|
+
- `ProjectIndex` (top-level index for the whole project)
|
|
607
|
+
- `FileIndex` - per-file
|
|
608
|
+
- `Symbol` - of type function/variable/etc..
|
|
609
|
+
- `Scope` - defines which symbols are relevant where, defines a hierarchy.
|
|
610
|
+
- `Span` - defines a text range in a file, offset byte-based (start,length). Don't use line:col because intermediate processing is awkward and complex, and even sometimes ambiguous
|
|
611
|
+
when combining files with newline at ends.
|
|
612
|
+
|
|
613
|
+
There's some redundancy in the index for the sake of efficient lookups (easy to write
|
|
614
|
+
during gen; awkward to jump around when doing lookups)
|
|
615
|
+
|
|
616
|
+
## Stable symbol IDs
|
|
617
|
+
|
|
618
|
+
ids should be at least a bit descriptive, plus be useful as identity
|
|
619
|
+
across the project.
|
|
620
|
+
|
|
621
|
+
`sym:src/util/math.lua+134:clamp`
|
|
622
|
+
|
|
623
|
+
- `sym:` for sanity
|
|
624
|
+
- `src/util/math.lua` relative path to file where it's declared
|
|
625
|
+
- `+134` byte offset in file
|
|
626
|
+
- `:clamp` symbol name.
|
|
627
|
+
|
|
628
|
+
## minifier interaction
|
|
629
|
+
|
|
630
|
+
No interaction necessary. Minifier runs after preprocessor stuff and we basically
|
|
631
|
+
don't expect the user to interact with minified code in any way that would interact
|
|
632
|
+
with this index system.
|
|
633
|
+
|
|
634
|
+
## preprocessor interaction
|
|
635
|
+
|
|
636
|
+
The indexer will see 1 huge preprocessed Lua file before minification. The preprocessor
|
|
637
|
+
needs to be able to provide a translation from preprocessed locations -> original
|
|
638
|
+
locations.
|
|
639
|
+
|
|
640
|
+
It's effectively a span-based mapping from preprocessed lua to sources.
|
|
641
|
+
|
|
642
|
+
So the indexer sees 1 huge file, but symbols within it can refer to other files.
|
|
643
|
+
|
|
644
|
+
Example 2 source files:
|
|
645
|
+
|
|
646
|
+
```lua
|
|
647
|
+
-- utils.lua
|
|
648
|
+
function log(msg)
|
|
649
|
+
print(msg)
|
|
650
|
+
end
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
```lua
|
|
654
|
+
-- math.lua
|
|
655
|
+
--#include "./utils.lua"
|
|
656
|
+
function clamp(value, min, max)
|
|
657
|
+
return math.min(math.max(value, min), max);
|
|
658
|
+
end
|
|
659
|
+
```
|
|
660
|
+
```lua
|
|
661
|
+
-- main.lua
|
|
662
|
+
|
|
663
|
+
--#include "./math.lua"
|
|
664
|
+
function TIC()
|
|
665
|
+
end
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
What the indexer sees:
|
|
669
|
+
|
|
670
|
+
```lua
|
|
671
|
+
function log(msg)
|
|
672
|
+
print(msg)
|
|
673
|
+
end
|
|
674
|
+
function clamp(value, min, max)
|
|
675
|
+
return math.min(math.max(value, min), max);
|
|
676
|
+
end
|
|
677
|
+
function TIC()
|
|
678
|
+
end
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
So when you're editing `main.lua` and type `clam` and auto-complete, `clamp` shall
|
|
682
|
+
be shown, and upon `F12` to go to definition, it should refer to `math.lua:2` -
|
|
683
|
+
just after the `--#include`.
|
|
684
|
+
|
|
685
|
+
The indexer however will see this as `(expanded lua):4`. The indexer will accept a source
|
|
686
|
+
map to translate its locations to "real" source locations.
|
|
687
|
+
|
|
688
|
+
## macros & other preprocessor interaction
|
|
689
|
+
|
|
690
|
+
```lua
|
|
691
|
+
--#if DEBUG
|
|
692
|
+
--#macro CLAMP(x, lo, hi)
|
|
693
|
+
((x) < (lo) and (lo) or (x) > (hi) and (hi) or (x))
|
|
694
|
+
--#endmacro
|
|
695
|
+
--#endif
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
We should emit the `CLAMP` macro symbol. So the preprocessor should be able to
|
|
699
|
+
emit global symbols as well (they're not really global symbols but in our index
|
|
700
|
+
it can be)
|
|
701
|
+
|
|
702
|
+
## Overloads
|
|
703
|
+
|
|
704
|
+
Overwrite symbol with latest (largest offset in preprocessed file) incarnation.
|
|
705
|
+
|
|
706
|
+
```lua
|
|
707
|
+
function xyz(a) end -- this will not appear in the index; it's superceded by...
|
|
708
|
+
function xyz(b) end -- ... this one.
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
## pipeline
|
|
712
|
+
|
|
713
|
+
`original sources -> preprocessor -> indexer`
|
|
714
|
+
|
|
715
|
+
Preprocessor outputs:
|
|
716
|
+
|
|
717
|
+
- a big lua file
|
|
718
|
+
- source map
|
|
719
|
+
- emitted pp symbols
|
|
720
|
+
|
|
721
|
+
The indexer will accept a source mapper which it uses to generate the correct
|
|
722
|
+
index output json.
|
|
723
|
+
|
|
724
|
+
Doing this as a post step adds too much extra plumbing. Better to just give the indexer
|
|
725
|
+
the resources to get it right the first time.
|
|
726
|
+
|
|
727
|
+
## Source Map
|
|
728
|
+
|
|
729
|
+
internally the structure is effectively a bunch of segments and define where they came from.
|
|
730
|
+
|
|
731
|
+
```jsonc
|
|
732
|
+
{
|
|
733
|
+
"preprocessedFile": { "byteLength": 12345, "hash": "sha1:..." },
|
|
734
|
+
"segments": [
|
|
735
|
+
{ "ppBegin": 0, "ppEnd": 53, "originalFile": "src/utils.lua", "originalOffset": 0 },
|
|
736
|
+
{ "ppBegin": 53, "ppEnd": 150, "originalFile": "src/math.lua", "originalOffset": 24 },
|
|
737
|
+
{ "ppBegin": 150, "ppEnd": 200, "originalFile": "src/main.lua", "originalOffset": 18 }
|
|
738
|
+
]
|
|
739
|
+
}
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
The map functional interface is effectively just
|
|
743
|
+
|
|
744
|
+
```ts
|
|
745
|
+
interface ISourceMap {
|
|
746
|
+
preprocessedOffsetToOriginal(expandedByteOffset)
|
|
747
|
+
: { file, fileByteOffset } | null;
|
|
748
|
+
}
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
## Cross-file scopes vs. spans
|
|
752
|
+
|
|
753
|
+
Technically a scope can span multiple files. So a single `range` can't be always accurate.
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
```lua
|
|
757
|
+
-- logsignature.lua
|
|
758
|
+
function log(msg)
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
```lua
|
|
762
|
+
-- main.lua
|
|
763
|
+
--#include "./logsignature.lua" -- ugh don't ever do this.
|
|
764
|
+
print(msg)
|
|
765
|
+
end
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
What the indexer sees (preprocessed output):
|
|
769
|
+
|
|
770
|
+
```lua
|
|
771
|
+
function log(msg)
|
|
772
|
+
print(msg)
|
|
773
|
+
end
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
Maybe there are some more sensible examples where this might actually be handy,
|
|
777
|
+
but anyway in this case the scope isn't really clear and i don't care to support this
|
|
778
|
+
except for making sure things don't totally break.
|
|
779
|
+
|
|
780
|
+
Well maybe a more obvious example is global scope, which in theory includes all
|
|
781
|
+
the files which are included (though start/end will still get calculated as being
|
|
782
|
+
in main.lua).
|
|
783
|
+
|
|
784
|
+
So maybe it's fine to just force all ranges to be described as being in a single
|
|
785
|
+
file. It's not trivial to have cross-file ranges because there's currently no
|
|
786
|
+
sense of file ordering. and adding complexity to support this is not ... no.
|
|
787
|
+
|
|
788
|
+
## built-in symbols
|
|
789
|
+
|
|
790
|
+
For the built-in TIC-80 symbols, we can make a Lua file that would generate
|
|
791
|
+
the respective symbols in an index. Bundle it with ticbuild and during index,
|
|
792
|
+
feed it silently at the start of processing. This lua should just have stubs with
|
|
793
|
+
correct signatures and doc comments // enough info to produce the correct index.
|
|
794
|
+
|
|
795
|
+
## example annotated symbol index file
|
|
796
|
+
|
|
797
|
+
```jsonc
|
|
798
|
+
|
|
799
|
+
// PROJECT INDEX
|
|
800
|
+
{
|
|
801
|
+
"schemaVersion": 1,
|
|
802
|
+
"generatedAt": "2026-02-08T12:34:56.000Z",
|
|
803
|
+
"projectRoot": "c:\\abs\\path\\to\\project",
|
|
804
|
+
|
|
805
|
+
"files": {
|
|
806
|
+
"src/main.lua": { /* FileIndex (see below) */ },
|
|
807
|
+
"src/util/math.lua": { /* FileIndex */ }
|
|
808
|
+
},
|
|
809
|
+
|
|
810
|
+
// convenience indices; easier lookups; points to the canonical location.
|
|
811
|
+
"globalIndex": {// Global cross-file indexes
|
|
812
|
+
"symbolsByName": {
|
|
813
|
+
"TIC": [
|
|
814
|
+
{ "file": "src/main.lua", "symbolId": "sym:src/main.lua#12" }
|
|
815
|
+
],
|
|
816
|
+
"clamp": [
|
|
817
|
+
{ "file": "src/util/math.lua", "symbolId": "sym:src/util/math.lua#3" } ]
|
|
818
|
+
},
|
|
819
|
+
// more ?
|
|
820
|
+
},
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// PER-FILE INDEX
|
|
824
|
+
{
|
|
825
|
+
"hash": "<content-hash>", // allow caching
|
|
826
|
+
"path": "\\path\\to\\file.lua", // relative to project root
|
|
827
|
+
|
|
828
|
+
// scopes for locals, for completion + hover + signature help context.
|
|
829
|
+
"scopes": [
|
|
830
|
+
{
|
|
831
|
+
"scopeId": "scope:src/main.lua#1",
|
|
832
|
+
// | "file"
|
|
833
|
+
// | "function"
|
|
834
|
+
// | "for"
|
|
835
|
+
// | "do"
|
|
836
|
+
// | "if"
|
|
837
|
+
// | "while"
|
|
838
|
+
// ...
|
|
839
|
+
"kind": "file",
|
|
840
|
+
"range": { /*...*/ },
|
|
841
|
+
// symbols declared in immediate scope body. make fast lookup by name
|
|
842
|
+
// by making it a Record<symbolName, pointer>
|
|
843
|
+
"declaredSymbolIds": {
|
|
844
|
+
"x": "sym:src/main.lua+12:x",
|
|
845
|
+
"y": "sym:src/main.lua+13:y"},
|
|
846
|
+
"parentScopeId": null
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"scopeId": "scope:src/main.lua+14",
|
|
850
|
+
"kind": "function",
|
|
851
|
+
"range": { /*...*/ },
|
|
852
|
+
"declaredSymbolIds": { /*... */ },
|
|
853
|
+
"parentScopeId": "scope:src/main.lua+9"
|
|
854
|
+
}
|
|
855
|
+
],
|
|
856
|
+
|
|
857
|
+
"symbols": {
|
|
858
|
+
"sym:src/main.lua#12": { /* Symbol (see below) */ },
|
|
859
|
+
"sym:src/main.lua#13": { /* Symbol */ }
|
|
860
|
+
},
|
|
861
|
+
|
|
862
|
+
// more convenience to know "what symbol is under the cursor":
|
|
863
|
+
"symbolSpans": [
|
|
864
|
+
{ "symbolId": "sym:src/main.lua#12", "range": { /*...*/ } },
|
|
865
|
+
{ "symbolId": "sym:src/main.lua#4#x", "range": { /*...*/ } }
|
|
866
|
+
]
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// PER-SYMBOL INDEX
|
|
870
|
+
{
|
|
871
|
+
"symbolId": "sym:src/util/math.lua#3",
|
|
872
|
+
"name": "clamp",
|
|
873
|
+
// | "localVariable"
|
|
874
|
+
// | "globalVariable"
|
|
875
|
+
// | "macro" -- i mean, not sure if there's going to be functional difference between this & function
|
|
876
|
+
// | "function"
|
|
877
|
+
// | "param"
|
|
878
|
+
// | "field" -- not sure this will be relevant because we don't capture table shapes / types
|
|
879
|
+
// | "type" -- not sure this will be relevant because we don't capture table shapes / types
|
|
880
|
+
"kind": "function",
|
|
881
|
+
"range": { /*...*/ }, // full span of the declaration statement (for function, the whole body of the function)
|
|
882
|
+
"selectionRange": { /*...*/ }, // just name, for definition UX
|
|
883
|
+
|
|
884
|
+
// parsed luadoc/emmylua docs
|
|
885
|
+
"doc": {
|
|
886
|
+
"name": "...", // probably should never use this; if it differs from the real name then more likely a bad copy/paste.
|
|
887
|
+
"description": "...",
|
|
888
|
+
"type": "...",
|
|
889
|
+
"returnType": "...",
|
|
890
|
+
"returnDescription": "...",
|
|
891
|
+
},
|
|
892
|
+
|
|
893
|
+
"scopeId": "scope:src/util/math.lua#1",
|
|
894
|
+
// "local" confines to scope
|
|
895
|
+
// "global"
|
|
896
|
+
"visibility": "local",
|
|
897
|
+
|
|
898
|
+
// for LuaDoc / EmmyLua, this could point to its doc
|
|
899
|
+
// without doc comments, basically everything is guesswork; it's probably
|
|
900
|
+
// worth it in order to for example understand types. Without
|
|
901
|
+
// doc comments we just kinda can't touch types.
|
|
902
|
+
// "docId": "doc:src/util/math.lua#3",
|
|
903
|
+
|
|
904
|
+
// For signature help & hover
|
|
905
|
+
"callable": {
|
|
906
|
+
"isColonMethod": false, // declared as `function T:foo()` for example
|
|
907
|
+
"params": [
|
|
908
|
+
"sym:src/util/math.lua@4(1):x",
|
|
909
|
+
"sym:src/util/math.lua@4(3):min",
|
|
910
|
+
"sym:src/util/math.lua@4(7):max",
|
|
911
|
+
],
|
|
912
|
+
},
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
```
|
|
916
|
+
|
|
599
917
|
# FAQ
|
|
600
918
|
|
|
601
|
-
|
|
919
|
+
gotta be asked questions in order to answer them.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ImportDefinition } from "./manifestTypes";
|
|
2
2
|
import { TicbuildProjectCore } from "./projectCore";
|
|
3
3
|
import { Tic80CartChunkTypeKey } from "../utils/tic80/tic80";
|
|
4
|
+
export declare function IsImportReference(value: string): boolean;
|
|
4
5
|
export type ImportReference = {
|
|
5
6
|
importName: string;
|
|
6
7
|
chunkSpec?: Tic80CartChunkTypeKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importUtils.d.ts","sourceRoot":"","sources":["../../src/backend/importUtils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAwB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,EAAE,CAAC,CAAC;IACR,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CAuBvE;AAUD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAmCvC;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAoBnC"}
|
|
1
|
+
{"version":3,"file":"importUtils.d.ts","sourceRoot":"","sources":["../../src/backend/importUtils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAwB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,EAAE,CAAC,CAAC;IACR,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CAuBvE;AAUD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAmCvC;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAoBnC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsImportReference = IsImportReference;
|
|
3
4
|
exports.parseImportReference = parseImportReference;
|
|
4
5
|
exports.loadBinaryImportData = loadBinaryImportData;
|
|
5
6
|
exports.loadTextImportData = loadTextImportData;
|
|
@@ -7,6 +8,9 @@ const fileSystem_1 = require("../utils/fileSystem");
|
|
|
7
8
|
const codecRegistry_1 = require("../utils/encoding/codecRegistry");
|
|
8
9
|
const manifestTypes_1 = require("./manifestTypes");
|
|
9
10
|
const tic80_1 = require("../utils/tic80/tic80");
|
|
11
|
+
function IsImportReference(value) {
|
|
12
|
+
return value.startsWith("import:");
|
|
13
|
+
}
|
|
10
14
|
function parseImportReference(reference) {
|
|
11
15
|
if (!reference.startsWith("import:")) {
|
|
12
16
|
throw new Error(`Import reference must start with "import:": ${reference}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importUtils.js","sourceRoot":"","sources":["../../src/backend/importUtils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"importUtils.js","sourceRoot":"","sources":["../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iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC1D,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,MAAM,IAAA,8BAAiB,EAAC,YAAY,CAAC,CAAC;IACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tic80CartChunkTypeKey } from "../../utils/tic80/tic80";
|
|
2
2
|
import { ExternalDependency, ImportedResourceBase, ResourceViewBase } from "../ImportedResourceTypes";
|
|
3
|
+
import { LuaPreprocessResult } from "../luaPreprocessor";
|
|
3
4
|
import { ImportDefinition } from "../manifestTypes";
|
|
4
5
|
import { TicbuildProjectCore } from "../projectCore";
|
|
5
6
|
export type LuaCodeArtifacts = {
|
|
@@ -36,12 +37,14 @@ export declare class LuaCodeResource extends ImportedResourceBase {
|
|
|
36
37
|
view: LuaCodeResourceView;
|
|
37
38
|
filePath: string;
|
|
38
39
|
dependencies: string[];
|
|
39
|
-
|
|
40
|
+
preprocessResult: LuaPreprocessResult;
|
|
41
|
+
constructor(filePath: string, inputSource: string, preprocessedSource: string, dependencies: string[], preprocessResult: LuaPreprocessResult);
|
|
40
42
|
dump(): void;
|
|
41
43
|
getCodeArtifacts(project: TicbuildProjectCore): LuaCodeArtifacts;
|
|
42
44
|
getCodeSizeStats(project: TicbuildProjectCore): LuaCodeSizeStats;
|
|
43
45
|
getView(project: TicbuildProjectCore, chunks?: Tic80CartChunkTypeKey[]): LuaCodeResourceView;
|
|
44
46
|
getDependencyList(): ExternalDependency[];
|
|
47
|
+
getPreprocessResult(): LuaPreprocessResult;
|
|
45
48
|
}
|
|
46
49
|
export declare function importLuaCode(project: TicbuildProjectCore, spec: ImportDefinition): Promise<LuaCodeResource>;
|
|
47
50
|
//# sourceMappingURL=LuaCodeImporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LuaCodeImporter.d.ts","sourceRoot":"","sources":["../../../src/backend/importers/LuaCodeImporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LuaCodeImporter.d.ts","sourceRoot":"","sources":["../../../src/backend/importers/LuaCodeImporter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAqB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAoBrD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,UAAU,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAA2B;IACxD,OAAO,CAAC,mBAAmB,CAAwB;gBAEvC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM;IAK3D,eAAe,CACb,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,qBAAqB,EAChC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAClC,UAAU;IAqBb,sBAAsB,IAAI,qBAAqB,EAAE;IAGjD,qBAAqB,IAAI,qBAAqB,EAAE;IAKhD,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,gBAAgB;IAY5D,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,gBAAgB;IAW5D,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,aAAa;CAwBtB;AAUD,qBAAa,eAAgB,SAAQ,oBAAoB;IACvD,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,mBAAmB,CAAC;gBAGpC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,EAC1B,YAAY,EAAE,MAAM,EAAE,EACtB,gBAAgB,EAAE,mBAAmB;IASvC,IAAI,IAAI,IAAI;IAQZ,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,gBAAgB;IAIhE,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,gBAAgB;IAIhE,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE;IAUtE,iBAAiB,IAAI,kBAAkB,EAAE;IAQzC,mBAAmB,IAAI,mBAAmB;CAG3C;AAGD,wBAAsB,aAAa,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAQlH"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// loads a Lua code file.
|
|
3
|
-
// phase 2 we will do preprocessing, validation, macros...
|
|
4
3
|
// sub assets are not supported.
|
|
5
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
5
|
exports.LuaCodeResource = exports.LuaCodeResourceView = void 0;
|
|
@@ -148,11 +147,12 @@ function buildMinificationOptions(overrides) {
|
|
|
148
147
|
return options;
|
|
149
148
|
}
|
|
150
149
|
class LuaCodeResource extends ImportedResourceTypes_1.ImportedResourceBase {
|
|
151
|
-
constructor(filePath, inputSource, preprocessedSource, dependencies) {
|
|
150
|
+
constructor(filePath, inputSource, preprocessedSource, dependencies, preprocessResult) {
|
|
152
151
|
super();
|
|
153
152
|
this.view = new LuaCodeResourceView(inputSource, preprocessedSource);
|
|
154
153
|
this.filePath = filePath;
|
|
155
154
|
this.dependencies = dependencies;
|
|
155
|
+
this.preprocessResult = preprocessResult;
|
|
156
156
|
}
|
|
157
157
|
dump() {
|
|
158
158
|
console.log(`LuaCodeResource dump for file: ${this.filePath}`);
|
|
@@ -183,6 +183,9 @@ class LuaCodeResource extends ImportedResourceTypes_1.ImportedResourceBase {
|
|
|
183
183
|
reason: path === this.filePath ? "Imported Lua code file" : "Lua preprocessor dependency",
|
|
184
184
|
}));
|
|
185
185
|
}
|
|
186
|
+
getPreprocessResult() {
|
|
187
|
+
return this.preprocessResult;
|
|
188
|
+
}
|
|
186
189
|
}
|
|
187
190
|
exports.LuaCodeResource = LuaCodeResource;
|
|
188
191
|
// spec is assumed to be in the project.
|
|
@@ -191,6 +194,6 @@ async function importLuaCode(project, spec) {
|
|
|
191
194
|
const textContent = await (0, fileSystem_1.readTextFileAsync)(path); // reads as utf-8 text, but NB: tic80 only supports ASCII.
|
|
192
195
|
const preprocessResult = await (0, luaPreprocessor_1.preprocessLuaCode)(project, textContent, path);
|
|
193
196
|
const preprocessedSource = preprocessResult.code;
|
|
194
|
-
return new LuaCodeResource(path, textContent, preprocessedSource, preprocessResult.dependencies);
|
|
197
|
+
return new LuaCodeResource(path, textContent, preprocessedSource, preprocessResult.dependencies, preprocessResult);
|
|
195
198
|
}
|
|
196
199
|
//# sourceMappingURL=LuaCodeImporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LuaCodeImporter.js","sourceRoot":"","sources":["../../../src/backend/importers/LuaCodeImporter.ts"],"names":[],"mappings":";AAAA,yBAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"LuaCodeImporter.js","sourceRoot":"","sources":["../../../src/backend/importers/LuaCodeImporter.ts"],"names":[],"mappings":";AAAA,yBAAyB;AACzB,gCAAgC;;;AA6OhC,sCAQC;AAnPD,yCAAwC;AACxC,uDAA2D;AAC3D,uEAAsE;AACtE,iEAAoF;AAEpF,6CAAiD;AACjD,oEAAsG;AACtG,wDAA4E;AAI5E,MAAM,cAAc,GAA4B;IAC9C,aAAa,EAAE,IAAI;IACnB,yBAAyB;IACzB,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,OAAO;IACrB,aAAa,EAAE,GAAG;IAClB,wBAAwB,EAAE,IAAI;IAC9B,oBAAoB,EAAE,IAAI;IAC1B,aAAa,EAAE,IAAI;IACnB,qBAAqB,EAAE,IAAI;IAC3B,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,KAAK;IAC5B,mBAAmB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAC1C,iBAAiB,EAAE,KAAK;IACxB,sBAAsB,EAAE,EAAE;CAClB,CAAC;AAgBX,MAAa,mBAAoB,SAAQ,wCAAgB;IAOvD,YAAY,WAAmB,EAAE,kBAA0B;QACzD,KAAK,EAAE,CAAC;QALF,yBAAoB,GAAkB,IAAI,CAAC;QAC3C,0BAAqB,GAAsB,IAAI,CAAC;QAChD,wBAAmB,GAAmB,IAAI,CAAC;QAIjD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IACD,eAAe,CACb,OAA4B,EAC5B,SAAgC,EAChC,OAAmC;QAEnC,2CAA2C;QAC3C,gCAAgC;QAChC,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,iBAAiB,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,mEAAmE,C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ACN,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAzDD,0CAyDC;AAED,wCAAwC;AACjC,KAAK,UAAU,aAAa,CAAC,OAA4B,EAAE,IAAsB;IACtF,MAAM,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,MAAM,IAAA,8BAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,0DAA0D;IAE7G,MAAM,gBAAgB,GAAG,MAAM,IAAA,mCAAiB,EAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAC7E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,IAAI,CAAC;IAEjD,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AACrH,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { TicbuildProjectCore } from "./projectCore";
|
|
2
|
+
import { LuaPreprocessorSourceMap } from "./sourceMap";
|
|
2
3
|
export type LuaPreprocessorValue = string | number | boolean;
|
|
3
4
|
export type LuaPreprocessResult = {
|
|
4
5
|
code: string;
|
|
5
6
|
dependencies: string[];
|
|
7
|
+
sourceMap: LuaPreprocessorSourceMap;
|
|
8
|
+
preprocessorSymbols: PreprocessorSymbol[];
|
|
9
|
+
};
|
|
10
|
+
export type PreprocessorSymbol = {
|
|
11
|
+
name: string;
|
|
12
|
+
kind: "macro";
|
|
13
|
+
sourceFile: string;
|
|
14
|
+
offset: number;
|
|
15
|
+
params: string[];
|
|
16
|
+
docLines?: string[];
|
|
6
17
|
};
|
|
7
18
|
export declare function preprocessLuaCode(project: TicbuildProjectCore, source: string, filePath: string): Promise<LuaPreprocessResult>;
|
|
8
19
|
//# sourceMappingURL=luaPreprocessor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"luaPreprocessor.d.ts","sourceRoot":"","sources":["../../src/backend/luaPreprocessor.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"luaPreprocessor.d.ts","sourceRoot":"","sources":["../../src/backend/luaPreprocessor.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,EAEL,wBAAwB,EACzB,MAAM,aAAa,CAAC;AASrB,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,wBAAwB,CAAC;IACpC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA0BF,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAqB9B"}
|