ticbuild 1.0.22 → 1.0.23
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 +1057 -199
- package/dist/backend/ImportedResourceTypes.d.ts +22 -10
- package/dist/backend/ImportedResourceTypes.d.ts.map +1 -1
- package/dist/backend/ImportedResourceTypes.js +42 -13
- package/dist/backend/ImportedResourceTypes.js.map +1 -1
- package/dist/backend/assembly.d.ts +11 -0
- package/dist/backend/assembly.d.ts.map +1 -0
- package/dist/backend/assembly.js +150 -0
- package/dist/backend/assembly.js.map +1 -0
- package/dist/backend/assetBanking.test.d.ts +2 -0
- package/dist/backend/assetBanking.test.d.ts.map +1 -0
- package/dist/backend/assetBanking.test.js +242 -0
- package/dist/backend/assetBanking.test.js.map +1 -0
- package/dist/backend/codeBanking.test.js +7 -5
- package/dist/backend/codeBanking.test.js.map +1 -1
- package/dist/backend/codeSnippetProcessor.d.ts +78 -0
- package/dist/backend/codeSnippetProcessor.d.ts.map +1 -0
- package/dist/backend/codeSnippetProcessor.js +241 -0
- package/dist/backend/codeSnippetProcessor.js.map +1 -0
- package/dist/backend/codeSnippetProcessor.test.d.ts +2 -0
- package/dist/backend/codeSnippetProcessor.test.d.ts.map +1 -0
- package/dist/backend/codeSnippetProcessor.test.js +221 -0
- package/dist/backend/codeSnippetProcessor.test.js.map +1 -0
- package/dist/backend/importReference.d.ts +4 -0
- package/dist/backend/importReference.d.ts.map +1 -0
- package/dist/backend/importReference.js +43 -0
- package/dist/backend/importReference.js.map +1 -0
- package/dist/backend/importResources.d.ts +3 -1
- package/dist/backend/importResources.d.ts.map +1 -1
- package/dist/backend/importResources.js +124 -36
- package/dist/backend/importResources.js.map +1 -1
- package/dist/backend/importResources.test.d.ts +2 -0
- package/dist/backend/importResources.test.d.ts.map +1 -0
- package/dist/backend/importResources.test.js +87 -0
- package/dist/backend/importResources.test.js.map +1 -0
- package/dist/backend/importSources.d.ts +51 -0
- package/dist/backend/importSources.d.ts.map +1 -0
- package/dist/backend/importSources.js +261 -0
- package/dist/backend/importSources.js.map +1 -0
- package/dist/backend/importSources.test.d.ts +2 -0
- package/dist/backend/importSources.test.d.ts.map +1 -0
- package/dist/backend/importSources.test.js +271 -0
- package/dist/backend/importSources.test.js.map +1 -0
- package/dist/backend/importUtils.d.ts +5 -10
- package/dist/backend/importUtils.d.ts.map +1 -1
- package/dist/backend/importUtils.js +13 -48
- package/dist/backend/importUtils.js.map +1 -1
- package/dist/backend/importers/CodeDeclarationAnalysis.d.ts +37 -0
- package/dist/backend/importers/CodeDeclarationAnalysis.d.ts.map +1 -0
- package/dist/backend/importers/CodeDeclarationAnalysis.js +288 -0
- package/dist/backend/importers/CodeDeclarationAnalysis.js.map +1 -0
- package/dist/backend/importers/CodeResource.d.ts +90 -0
- package/dist/backend/importers/CodeResource.d.ts.map +1 -0
- package/dist/backend/importers/CodeResource.js +480 -0
- package/dist/backend/importers/CodeResource.js.map +1 -0
- package/dist/backend/importers/CodeResource.test.d.ts +2 -0
- package/dist/backend/importers/CodeResource.test.d.ts.map +1 -0
- package/dist/backend/importers/CodeResource.test.js +106 -0
- package/dist/backend/importers/CodeResource.test.js.map +1 -0
- package/dist/backend/importers/LuaAssetTypeScriptModules.d.ts +38 -0
- package/dist/backend/importers/LuaAssetTypeScriptModules.d.ts.map +1 -0
- package/dist/backend/importers/LuaAssetTypeScriptModules.js +437 -0
- package/dist/backend/importers/LuaAssetTypeScriptModules.js.map +1 -0
- package/dist/backend/importers/LuaCodeImporter.d.ts +9 -49
- package/dist/backend/importers/LuaCodeImporter.d.ts.map +1 -1
- package/dist/backend/importers/LuaCodeImporter.js +28 -255
- package/dist/backend/importers/LuaCodeImporter.js.map +1 -1
- package/dist/backend/importers/LuaCodeImporter.test.js +89 -46
- package/dist/backend/importers/LuaCodeImporter.test.js.map +1 -1
- package/dist/backend/importers/LuaTypeCatalog.d.ts +26 -0
- package/dist/backend/importers/LuaTypeCatalog.d.ts.map +1 -0
- package/dist/backend/importers/LuaTypeCatalog.js +185 -0
- package/dist/backend/importers/LuaTypeCatalog.js.map +1 -0
- package/dist/backend/importers/ManifestCodeTypeScriptModules.d.ts +10 -0
- package/dist/backend/importers/ManifestCodeTypeScriptModules.d.ts.map +1 -0
- package/dist/backend/importers/ManifestCodeTypeScriptModules.js +31 -0
- package/dist/backend/importers/ManifestCodeTypeScriptModules.js.map +1 -0
- package/dist/backend/importers/TypeScriptBuildConstants.d.ts +6 -0
- package/dist/backend/importers/TypeScriptBuildConstants.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptBuildConstants.js +79 -0
- package/dist/backend/importers/TypeScriptBuildConstants.js.map +1 -0
- package/dist/backend/importers/TypeScriptCodeImporter.d.ts +26 -0
- package/dist/backend/importers/TypeScriptCodeImporter.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptCodeImporter.js +57 -0
- package/dist/backend/importers/TypeScriptCodeImporter.js.map +1 -0
- package/dist/backend/importers/TypeScriptCodeImporter.test.d.ts +2 -0
- package/dist/backend/importers/TypeScriptCodeImporter.test.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptCodeImporter.test.js +1795 -0
- package/dist/backend/importers/TypeScriptCodeImporter.test.js.map +1 -0
- package/dist/backend/importers/TypeScriptConstantPlugin.d.ts +8 -0
- package/dist/backend/importers/TypeScriptConstantPlugin.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptConstantPlugin.js +412 -0
- package/dist/backend/importers/TypeScriptConstantPlugin.js.map +1 -0
- package/dist/backend/importers/TypeScriptDeclarationSources.d.ts +19 -0
- package/dist/backend/importers/TypeScriptDeclarationSources.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptDeclarationSources.js +119 -0
- package/dist/backend/importers/TypeScriptDeclarationSources.js.map +1 -0
- package/dist/backend/importers/TypeScriptDeclarationSyntax.d.ts +8 -0
- package/dist/backend/importers/TypeScriptDeclarationSyntax.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptDeclarationSyntax.js +29 -0
- package/dist/backend/importers/TypeScriptDeclarationSyntax.js.map +1 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.d.ts +23 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.js +553 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.js.map +1 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.test.d.ts +2 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.test.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.test.js +29 -0
- package/dist/backend/importers/TypeScriptLuaDeclarations.test.js.map +1 -0
- package/dist/backend/importers/TypeScriptManifestModules.d.ts +36 -0
- package/dist/backend/importers/TypeScriptManifestModules.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptManifestModules.js +347 -0
- package/dist/backend/importers/TypeScriptManifestModules.js.map +1 -0
- package/dist/backend/importers/TypeScriptNamedTypes.d.ts +22 -0
- package/dist/backend/importers/TypeScriptNamedTypes.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptNamedTypes.js +193 -0
- package/dist/backend/importers/TypeScriptNamedTypes.js.map +1 -0
- package/dist/backend/importers/TypeScriptProgram.d.ts +24 -0
- package/dist/backend/importers/TypeScriptProgram.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptProgram.js +141 -0
- package/dist/backend/importers/TypeScriptProgram.js.map +1 -0
- package/dist/backend/importers/TypeScriptStaticLinker.d.ts +17 -0
- package/dist/backend/importers/TypeScriptStaticLinker.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptStaticLinker.js +702 -0
- package/dist/backend/importers/TypeScriptStaticLinker.js.map +1 -0
- package/dist/backend/importers/TypeScriptTranspilationOptions.d.ts +3 -0
- package/dist/backend/importers/TypeScriptTranspilationOptions.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptTranspilationOptions.js +82 -0
- package/dist/backend/importers/TypeScriptTranspilationOptions.js.map +1 -0
- package/dist/backend/importers/TypeScriptTranspiler.d.ts +13 -0
- package/dist/backend/importers/TypeScriptTranspiler.d.ts.map +1 -0
- package/dist/backend/importers/TypeScriptTranspiler.js +241 -0
- package/dist/backend/importers/TypeScriptTranspiler.js.map +1 -0
- package/dist/backend/importers/binaryResourceImporter.d.ts +5 -14
- package/dist/backend/importers/binaryResourceImporter.d.ts.map +1 -1
- package/dist/backend/importers/binaryResourceImporter.js +6 -34
- package/dist/backend/importers/binaryResourceImporter.js.map +1 -1
- package/dist/backend/importers/textResourceImporter.d.ts +5 -15
- package/dist/backend/importers/textResourceImporter.d.ts.map +1 -1
- package/dist/backend/importers/textResourceImporter.js +6 -36
- package/dist/backend/importers/textResourceImporter.js.map +1 -1
- package/dist/backend/importers/tic80CartImporter.d.ts +12 -15
- package/dist/backend/importers/tic80CartImporter.d.ts.map +1 -1
- package/dist/backend/importers/tic80CartImporter.js +49 -84
- package/dist/backend/importers/tic80CartImporter.js.map +1 -1
- package/dist/backend/importers/tsconfigUtils.d.ts +10 -0
- package/dist/backend/importers/tsconfigUtils.d.ts.map +1 -0
- package/dist/backend/importers/tsconfigUtils.js +152 -0
- package/dist/backend/importers/tsconfigUtils.js.map +1 -0
- package/dist/backend/luaEncode.d.ts +4 -4
- package/dist/backend/luaEncode.d.ts.map +1 -1
- package/dist/backend/luaEncode.js +39 -39
- package/dist/backend/luaEncode.js.map +1 -1
- package/dist/backend/luaEncode.test.js +68 -0
- package/dist/backend/luaEncode.test.js.map +1 -1
- package/dist/backend/luaPreprocessor.d.ts +18 -1
- package/dist/backend/luaPreprocessor.d.ts.map +1 -1
- package/dist/backend/luaPreprocessor.js +581 -232
- package/dist/backend/luaPreprocessor.js.map +1 -1
- package/dist/backend/luaPreprocessor.test.js +293 -12
- package/dist/backend/luaPreprocessor.test.js.map +1 -1
- package/dist/backend/luaPreprocessorSyntax.d.ts +25 -0
- package/dist/backend/luaPreprocessorSyntax.d.ts.map +1 -0
- package/dist/backend/luaPreprocessorSyntax.js +74 -0
- package/dist/backend/luaPreprocessorSyntax.js.map +1 -0
- package/dist/backend/luaPreprocessorSyntax.test.d.ts +2 -0
- package/dist/backend/luaPreprocessorSyntax.test.d.ts.map +1 -0
- package/dist/backend/luaPreprocessorSyntax.test.js +30 -0
- package/dist/backend/luaPreprocessorSyntax.test.js.map +1 -0
- package/dist/backend/manifestLoader.test.js +174 -1
- package/dist/backend/manifestLoader.test.js.map +1 -1
- package/dist/backend/manifestTypes.d.ts +127 -65
- package/dist/backend/manifestTypes.d.ts.map +1 -1
- package/dist/backend/manifestTypes.js +3 -0
- package/dist/backend/manifestTypes.js.map +1 -1
- package/dist/backend/preprocessorDefines.d.ts +4 -0
- package/dist/backend/preprocessorDefines.d.ts.map +1 -0
- package/dist/backend/preprocessorDefines.js +15 -0
- package/dist/backend/preprocessorDefines.js.map +1 -0
- package/dist/backend/project.d.ts +8 -2
- package/dist/backend/project.d.ts.map +1 -1
- package/dist/backend/project.js +159 -115
- package/dist/backend/project.js.map +1 -1
- package/dist/backend/project.test.d.ts +2 -0
- package/dist/backend/project.test.d.ts.map +1 -0
- package/dist/backend/project.test.js +196 -0
- package/dist/backend/project.test.js.map +1 -0
- package/dist/backend/projectCore.d.ts +6 -4
- package/dist/backend/projectCore.d.ts.map +1 -1
- package/dist/backend/projectCore.js +36 -44
- package/dist/backend/projectCore.js.map +1 -1
- package/dist/backend/projectCore.test.d.ts +2 -0
- package/dist/backend/projectCore.test.d.ts.map +1 -0
- package/dist/backend/projectCore.test.js +12 -0
- package/dist/backend/projectCore.test.js.map +1 -0
- package/dist/backend/projectEnvironment.d.ts +8 -0
- package/dist/backend/projectEnvironment.d.ts.map +1 -0
- package/dist/backend/projectEnvironment.js +70 -0
- package/dist/backend/projectEnvironment.js.map +1 -0
- package/dist/backend/projectEnvironment.test.d.ts +2 -0
- package/dist/backend/projectEnvironment.test.d.ts.map +1 -0
- package/dist/backend/projectEnvironment.test.js +90 -0
- package/dist/backend/projectEnvironment.test.js.map +1 -0
- package/dist/backend/projectFiles.d.ts +32 -0
- package/dist/backend/projectFiles.d.ts.map +1 -0
- package/dist/backend/projectFiles.js +148 -0
- package/dist/backend/projectFiles.js.map +1 -0
- package/dist/backend/projectFiles.test.d.ts +2 -0
- package/dist/backend/projectFiles.test.d.ts.map +1 -0
- package/dist/backend/projectFiles.test.js +136 -0
- package/dist/backend/projectFiles.test.js.map +1 -0
- package/dist/backend/sourceMap.d.ts +40 -3
- package/dist/backend/sourceMap.d.ts.map +1 -1
- package/dist/backend/sourceMap.js +333 -64
- package/dist/backend/sourceMap.js.map +1 -1
- package/dist/backend/sourceMap.test.js +81 -0
- package/dist/backend/sourceMap.test.js.map +1 -1
- package/dist/backend/sourceMapLookup.d.ts +36 -0
- package/dist/backend/sourceMapLookup.d.ts.map +1 -0
- package/dist/backend/sourceMapLookup.js +170 -0
- package/dist/backend/sourceMapLookup.js.map +1 -0
- package/dist/backend/sourceMapLookup.test.d.ts +2 -0
- package/dist/backend/sourceMapLookup.test.d.ts.map +1 -0
- package/dist/backend/sourceMapLookup.test.js +132 -0
- package/dist/backend/sourceMapLookup.test.js.map +1 -0
- package/dist/backend/sourceMapV3.d.ts +8 -0
- package/dist/backend/sourceMapV3.d.ts.map +1 -0
- package/dist/backend/sourceMapV3.js +212 -0
- package/dist/backend/sourceMapV3.js.map +1 -0
- package/dist/backend/sourceMapV3.test.d.ts +2 -0
- package/dist/backend/sourceMapV3.test.d.ts.map +1 -0
- package/dist/backend/sourceMapV3.test.js +109 -0
- package/dist/backend/sourceMapV3.test.js.map +1 -0
- package/dist/backend/symbolIndex.d.ts +2 -12
- package/dist/backend/symbolIndex.d.ts.map +1 -1
- package/dist/backend/symbolIndex.js +18 -107
- package/dist/backend/symbolIndex.js.map +1 -1
- package/dist/backend/symbolIndex.test.js +6 -1
- package/dist/backend/symbolIndex.test.js.map +1 -1
- package/dist/backend/tic80Controller/customController.d.ts +7 -1
- package/dist/backend/tic80Controller/customController.d.ts.map +1 -1
- package/dist/backend/tic80Controller/customController.js +25 -11
- package/dist/backend/tic80Controller/customController.js.map +1 -1
- package/dist/backend/tic80Controller/customController.test.js +17 -4
- package/dist/backend/tic80Controller/customController.test.js.map +1 -1
- package/dist/backend/tic80Controller/remotingClient.d.ts.map +1 -1
- package/dist/backend/tic80Controller/remotingClient.js +2 -1
- package/dist/backend/tic80Controller/remotingClient.js.map +1 -1
- package/dist/backend/tic80Controller/remotingProtocol.d.ts +2 -0
- package/dist/backend/tic80Controller/remotingProtocol.d.ts.map +1 -1
- package/dist/backend/tic80Controller/remotingProtocol.js +19 -0
- package/dist/backend/tic80Controller/remotingProtocol.js.map +1 -1
- package/dist/backend/tic80Controller/remotingProtocol.test.js +16 -0
- package/dist/backend/tic80Controller/remotingProtocol.test.js.map +1 -1
- package/dist/backend/tic80Controller/scriptErrorProtocol.d.ts +41 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.d.ts.map +1 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.js +98 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.js.map +1 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.test.d.ts +2 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.test.d.ts.map +1 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.test.js +78 -0
- package/dist/backend/tic80Controller/scriptErrorProtocol.test.js.map +1 -0
- package/dist/backend/tic80Controller/tic80Controller.d.ts +7 -0
- package/dist/backend/tic80Controller/tic80Controller.d.ts.map +1 -1
- package/dist/backend/tic80Controller/vanillaController.d.ts +3 -5
- package/dist/backend/tic80Controller/vanillaController.d.ts.map +1 -1
- package/dist/backend/tic80Controller/vanillaController.js +19 -18
- package/dist/backend/tic80Controller/vanillaController.js.map +1 -1
- package/dist/backend/tic80Controller/vanillaController.test.d.ts +2 -0
- package/dist/backend/tic80Controller/vanillaController.test.d.ts.map +1 -0
- package/dist/backend/tic80Controller/vanillaController.test.js +36 -0
- package/dist/backend/tic80Controller/vanillaController.test.js.map +1 -0
- package/dist/backend/tic80Resolver.d.ts +2 -0
- package/dist/backend/tic80Resolver.d.ts.map +1 -1
- package/dist/backend/tic80Resolver.js +15 -47
- package/dist/backend/tic80Resolver.js.map +1 -1
- package/dist/backend/tic80Resolver.test.d.ts +2 -0
- package/dist/backend/tic80Resolver.test.d.ts.map +1 -0
- package/dist/backend/tic80Resolver.test.js +34 -0
- package/dist/backend/tic80Resolver.test.js.map +1 -0
- package/dist/benchmarks/luaMinifiers.d.ts +50 -0
- package/dist/benchmarks/luaMinifiers.d.ts.map +1 -0
- package/dist/benchmarks/luaMinifiers.js +219 -0
- package/dist/benchmarks/luaMinifiers.js.map +1 -0
- package/dist/benchmarks/luaMinifiers.test.d.ts +2 -0
- package/dist/benchmarks/luaMinifiers.test.d.ts.map +1 -0
- package/dist/benchmarks/luaMinifiers.test.js +68 -0
- package/dist/benchmarks/luaMinifiers.test.js.map +1 -0
- package/dist/buildInfo.d.ts +7 -4
- package/dist/buildInfo.d.ts.map +1 -1
- package/dist/buildInfo.js +7 -4
- package/dist/buildInfo.js.map +1 -1
- package/dist/frontend/build.d.ts.map +1 -1
- package/dist/frontend/build.js +3 -5
- package/dist/frontend/build.js.map +1 -1
- package/dist/frontend/buildReporter.d.ts +10 -2
- package/dist/frontend/buildReporter.d.ts.map +1 -1
- package/dist/frontend/buildReporter.js +4 -1
- package/dist/frontend/buildReporter.js.map +1 -1
- package/dist/frontend/buildReporter.test.js +51 -2
- package/dist/frontend/buildReporter.test.js.map +1 -1
- package/dist/frontend/cartUsage.d.ts +20 -0
- package/dist/frontend/cartUsage.d.ts.map +1 -0
- package/dist/frontend/cartUsage.js +103 -0
- package/dist/frontend/cartUsage.js.map +1 -0
- package/dist/frontend/codeBankPlacement.test.d.ts +2 -0
- package/dist/frontend/codeBankPlacement.test.d.ts.map +1 -0
- package/dist/frontend/codeBankPlacement.test.js +89 -0
- package/dist/frontend/codeBankPlacement.test.js.map +1 -0
- package/dist/frontend/codeBankWarnings.test.js +1 -0
- package/dist/frontend/codeBankWarnings.test.js.map +1 -1
- package/dist/frontend/core.d.ts +7 -2
- package/dist/frontend/core.d.ts.map +1 -1
- package/dist/frontend/core.js +301 -300
- package/dist/frontend/core.js.map +1 -1
- package/dist/frontend/init.d.ts +1 -0
- package/dist/frontend/init.d.ts.map +1 -1
- package/dist/frontend/init.js +34 -11
- package/dist/frontend/init.js.map +1 -1
- package/dist/frontend/init.test.d.ts +2 -0
- package/dist/frontend/init.test.d.ts.map +1 -0
- package/dist/frontend/init.test.js +190 -0
- package/dist/frontend/init.test.js.map +1 -0
- package/dist/frontend/inspect.d.ts +2 -0
- package/dist/frontend/inspect.d.ts.map +1 -0
- package/dist/frontend/inspect.js +62 -0
- package/dist/frontend/inspect.js.map +1 -0
- package/dist/frontend/inspect.test.d.ts +2 -0
- package/dist/frontend/inspect.test.d.ts.map +1 -0
- package/dist/frontend/inspect.test.js +126 -0
- package/dist/frontend/inspect.test.js.map +1 -0
- package/dist/frontend/luaCodeArtifacts.test.js +39 -1
- package/dist/frontend/luaCodeArtifacts.test.js.map +1 -1
- package/dist/frontend/packageInstaller.d.ts +2 -0
- package/dist/frontend/packageInstaller.d.ts.map +1 -0
- package/dist/frontend/packageInstaller.js +59 -0
- package/dist/frontend/packageInstaller.js.map +1 -0
- package/dist/frontend/parseOptions.d.ts +4 -1
- package/dist/frontend/parseOptions.d.ts.map +1 -1
- package/dist/frontend/parseOptions.js +13 -8
- package/dist/frontend/parseOptions.js.map +1 -1
- package/dist/frontend/parseOptions.test.d.ts +2 -0
- package/dist/frontend/parseOptions.test.d.ts.map +1 -0
- package/dist/frontend/parseOptions.test.js +65 -0
- package/dist/frontend/parseOptions.test.js.map +1 -0
- package/dist/frontend/projectFiles.d.ts +4 -0
- package/dist/frontend/projectFiles.d.ts.map +1 -0
- package/dist/frontend/projectFiles.js +95 -0
- package/dist/frontend/projectFiles.js.map +1 -0
- package/dist/frontend/projectFiles.test.d.ts +2 -0
- package/dist/frontend/projectFiles.test.d.ts.map +1 -0
- package/dist/frontend/projectFiles.test.js +106 -0
- package/dist/frontend/projectFiles.test.js.map +1 -0
- package/dist/frontend/run.d.ts.map +1 -1
- package/dist/frontend/run.js +3 -1
- package/dist/frontend/run.js.map +1 -1
- package/dist/frontend/scriptErrorPresentation.d.ts +9 -0
- package/dist/frontend/scriptErrorPresentation.d.ts.map +1 -0
- package/dist/frontend/scriptErrorPresentation.js +76 -0
- package/dist/frontend/scriptErrorPresentation.js.map +1 -0
- package/dist/frontend/scriptErrorPresentation.test.d.ts +2 -0
- package/dist/frontend/scriptErrorPresentation.test.d.ts.map +1 -0
- package/dist/frontend/scriptErrorPresentation.test.js +137 -0
- package/dist/frontend/scriptErrorPresentation.test.js.map +1 -0
- package/dist/frontend/scriptErrorSourceMapper.d.ts +15 -0
- package/dist/frontend/scriptErrorSourceMapper.d.ts.map +1 -0
- package/dist/frontend/scriptErrorSourceMapper.js +177 -0
- package/dist/frontend/scriptErrorSourceMapper.js.map +1 -0
- package/dist/frontend/scriptErrorSourceMapper.test.d.ts +2 -0
- package/dist/frontend/scriptErrorSourceMapper.test.d.ts.map +1 -0
- package/dist/frontend/scriptErrorSourceMapper.test.js +189 -0
- package/dist/frontend/scriptErrorSourceMapper.test.js.map +1 -0
- package/dist/frontend/terminal.d.ts +28 -2
- package/dist/frontend/terminal.d.ts.map +1 -1
- package/dist/frontend/terminal.js +465 -25
- package/dist/frontend/terminal.js.map +1 -1
- package/dist/frontend/terminal.test.js +563 -0
- package/dist/frontend/terminal.test.js.map +1 -1
- package/dist/frontend/typescriptExample.test.d.ts +2 -0
- package/dist/frontend/typescriptExample.test.d.ts.map +1 -0
- package/dist/frontend/typescriptExample.test.js +92 -0
- package/dist/frontend/typescriptExample.test.js.map +1 -0
- package/dist/frontend/watch.d.ts.map +1 -1
- package/dist/frontend/watch.js +160 -39
- package/dist/frontend/watch.js.map +1 -1
- package/dist/frontend/watch.test.js +3 -1
- package/dist/frontend/watch.test.js.map +1 -1
- package/dist/index.js +61 -20
- package/dist/index.js.map +1 -1
- package/dist/obj/build.jsonl +5 -0
- package/dist/obj/build.log +11 -5
- package/dist/obj/build.trace.json +89 -0
- package/dist/obj/resolvedManifest.ticbuild.jsonc +4 -3
- package/dist/obj/variables.json +2 -2
- package/dist/projectFileInventory.d.ts +40 -0
- package/dist/projectFileInventory.d.ts.map +1 -0
- package/dist/projectFileInventory.js +36 -0
- package/dist/projectFileInventory.js.map +1 -0
- package/dist/utils/console.d.ts +1 -1
- package/dist/utils/console.d.ts.map +1 -1
- package/dist/utils/console.js +1 -1
- package/dist/utils/console.js.map +1 -1
- package/dist/utils/encoding/base64.d.ts +3 -0
- package/dist/utils/encoding/base64.d.ts.map +1 -0
- package/dist/utils/encoding/base64.js +51 -0
- package/dist/utils/encoding/base64.js.map +1 -0
- package/dist/utils/encoding/codecRegistry.d.ts +69 -12
- package/dist/utils/encoding/codecRegistry.d.ts.map +1 -1
- package/dist/utils/encoding/codecRegistry.js +6 -0
- package/dist/utils/encoding/codecRegistry.js.map +1 -1
- package/dist/utils/encoding/hex.d.ts.map +1 -1
- package/dist/utils/encoding/hex.js +3 -0
- package/dist/utils/encoding/hex.js.map +1 -1
- package/dist/utils/encoding/lz.d.ts +25 -5
- package/dist/utils/encoding/lz.d.ts.map +1 -1
- package/dist/utils/encoding/lz.js +160 -48
- package/dist/utils/encoding/lz.js.map +1 -1
- package/dist/utils/encoding/lz.test.d.ts +2 -0
- package/dist/utils/encoding/lz.test.d.ts.map +1 -0
- package/dist/utils/encoding/lz.test.js +95 -0
- package/dist/utils/encoding/lz.test.js.map +1 -0
- package/dist/utils/encoding/payloadOutput.d.ts +4 -0
- package/dist/utils/encoding/payloadOutput.d.ts.map +1 -0
- package/dist/utils/encoding/payloadOutput.js +12 -0
- package/dist/utils/encoding/payloadOutput.js.map +1 -0
- package/dist/utils/encoding/payloadOutput.test.d.ts +2 -0
- package/dist/utils/encoding/payloadOutput.test.d.ts.map +1 -0
- package/dist/utils/encoding/payloadOutput.test.js +21 -0
- package/dist/utils/encoding/payloadOutput.test.js.map +1 -0
- package/dist/utils/encoding/payloadTextEncoding.d.ts +6 -0
- package/dist/utils/encoding/payloadTextEncoding.d.ts.map +1 -0
- package/dist/utils/encoding/payloadTextEncoding.js +39 -0
- package/dist/utils/encoding/payloadTextEncoding.js.map +1 -0
- package/dist/utils/encoding/payloadTextEncoding.test.d.ts +2 -0
- package/dist/utils/encoding/payloadTextEncoding.test.d.ts.map +1 -0
- package/dist/utils/encoding/payloadTextEncoding.test.js +31 -0
- package/dist/utils/encoding/payloadTextEncoding.test.js.map +1 -0
- package/dist/utils/errorHandling.d.ts +1 -0
- package/dist/utils/errorHandling.d.ts.map +1 -1
- package/dist/utils/errorHandling.js +4 -0
- package/dist/utils/errorHandling.js.map +1 -1
- package/dist/utils/errorHandling.test.d.ts +2 -0
- package/dist/utils/errorHandling.test.d.ts.map +1 -0
- package/dist/utils/errorHandling.test.js +17 -0
- package/dist/utils/errorHandling.test.js.map +1 -0
- package/dist/utils/fileSystem.d.ts +3 -1
- package/dist/utils/fileSystem.d.ts.map +1 -1
- package/dist/utils/fileSystem.js +16 -16
- package/dist/utils/fileSystem.js.map +1 -1
- package/dist/utils/help.d.ts +2 -1
- package/dist/utils/help.d.ts.map +1 -1
- package/dist/utils/help.js +8 -3
- package/dist/utils/help.js.map +1 -1
- package/dist/utils/lua/LuaCATS.d.ts +31 -0
- package/dist/utils/lua/LuaCATS.d.ts.map +1 -0
- package/dist/utils/lua/LuaCATS.js +159 -0
- package/dist/utils/lua/LuaCATS.js.map +1 -0
- package/dist/utils/lua/LuaCATS_declarations.d.ts +22 -0
- package/dist/utils/lua/LuaCATS_declarations.d.ts.map +1 -0
- package/dist/utils/lua/LuaCATS_declarations.js +107 -0
- package/dist/utils/lua/LuaCATS_declarations.js.map +1 -0
- package/dist/utils/lua/LuaCATS_declarations.test.d.ts +2 -0
- package/dist/utils/lua/LuaCATS_declarations.test.d.ts.map +1 -0
- package/dist/utils/lua/LuaCATS_declarations.test.js +38 -0
- package/dist/utils/lua/LuaCATS_declarations.test.js.map +1 -0
- package/dist/utils/lua/LuaCATS_types.d.ts +52 -0
- package/dist/utils/lua/LuaCATS_types.d.ts.map +1 -0
- package/dist/utils/lua/LuaCATS_types.js +202 -0
- package/dist/utils/lua/LuaCATS_types.js.map +1 -0
- package/dist/utils/lua/LuaCATS_types.test.d.ts +2 -0
- package/dist/utils/lua/LuaCATS_types.test.d.ts.map +1 -0
- package/dist/utils/lua/LuaCATS_types.test.js +38 -0
- package/dist/utils/lua/LuaCATS_types.test.js.map +1 -0
- package/dist/utils/lua/lua_alias_expressions.d.ts +2 -0
- package/dist/utils/lua/lua_alias_expressions.d.ts.map +1 -1
- package/dist/utils/lua/lua_alias_expressions.js +12 -1
- package/dist/utils/lua/lua_alias_expressions.js.map +1 -1
- package/dist/utils/lua/lua_alias_literals.d.ts +2 -0
- package/dist/utils/lua/lua_alias_literals.d.ts.map +1 -1
- package/dist/utils/lua/lua_alias_literals.js +12 -1
- package/dist/utils/lua/lua_alias_literals.js.map +1 -1
- package/dist/utils/lua/lua_alias_shared.d.ts +0 -1
- package/dist/utils/lua/lua_alias_shared.d.ts.map +1 -1
- package/dist/utils/lua/lua_alias_shared.js +60 -56
- package/dist/utils/lua/lua_alias_shared.js.map +1 -1
- package/dist/utils/lua/lua_ast.d.ts +0 -1
- package/dist/utils/lua/lua_ast.d.ts.map +1 -1
- package/dist/utils/lua/lua_ast.js +0 -6
- package/dist/utils/lua/lua_ast.js.map +1 -1
- package/dist/utils/lua/lua_ast_printer.d.ts +55 -0
- package/dist/utils/lua/lua_ast_printer.d.ts.map +1 -0
- package/dist/utils/lua/lua_ast_printer.js +1043 -0
- package/dist/utils/lua/lua_ast_printer.js.map +1 -0
- package/dist/utils/lua/lua_ast_provenance.d.ts +13 -0
- package/dist/utils/lua/lua_ast_provenance.d.ts.map +1 -0
- package/dist/utils/lua/lua_ast_provenance.js +67 -0
- package/dist/utils/lua/lua_ast_provenance.js.map +1 -0
- package/dist/utils/lua/lua_ast_rewrite.d.ts +20 -0
- package/dist/utils/lua/lua_ast_rewrite.d.ts.map +1 -0
- package/dist/utils/lua/lua_ast_rewrite.js +198 -0
- package/dist/utils/lua/lua_ast_rewrite.js.map +1 -0
- package/dist/utils/lua/lua_binding_optimizations.test.d.ts +2 -0
- package/dist/utils/lua/lua_binding_optimizations.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_binding_optimizations.test.js +247 -0
- package/dist/utils/lua/lua_binding_optimizations.test.js.map +1 -0
- package/dist/utils/lua/lua_canonicalization_rules.test.d.ts +2 -0
- package/dist/utils/lua/lua_canonicalization_rules.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_canonicalization_rules.test.js +194 -0
- package/dist/utils/lua/lua_canonicalization_rules.test.js.map +1 -0
- package/dist/utils/lua/lua_constant_literals.d.ts +7 -0
- package/dist/utils/lua/lua_constant_literals.d.ts.map +1 -0
- package/dist/utils/lua/lua_constant_literals.js +39 -0
- package/dist/utils/lua/lua_constant_literals.js.map +1 -0
- package/dist/utils/lua/lua_control_flow_invert_negated_if.d.ts +3 -0
- package/dist/utils/lua/lua_control_flow_invert_negated_if.d.ts.map +1 -0
- package/dist/utils/lua/lua_control_flow_invert_negated_if.js +37 -0
- package/dist/utils/lua/lua_control_flow_invert_negated_if.js.map +1 -0
- package/dist/utils/lua/lua_control_flow_remove_false_while.d.ts +3 -0
- package/dist/utils/lua/lua_control_flow_remove_false_while.d.ts.map +1 -0
- package/dist/utils/lua/lua_control_flow_remove_false_while.js +26 -0
- package/dist/utils/lua/lua_control_flow_remove_false_while.js.map +1 -0
- package/dist/utils/lua/lua_control_flow_resolve_constant_if.d.ts +3 -0
- package/dist/utils/lua/lua_control_flow_resolve_constant_if.d.ts.map +1 -0
- package/dist/utils/lua/lua_control_flow_resolve_constant_if.js +83 -0
- package/dist/utils/lua/lua_control_flow_resolve_constant_if.js.map +1 -0
- package/dist/utils/lua/lua_debug.d.ts +16 -0
- package/dist/utils/lua/lua_debug.d.ts.map +1 -0
- package/dist/utils/lua/lua_debug.js +42 -0
- package/dist/utils/lua/lua_debug.js.map +1 -0
- package/dist/utils/lua/lua_debug.test.d.ts +2 -0
- package/dist/utils/lua/lua_debug.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_debug.test.js +24 -0
- package/dist/utils/lua/lua_debug.test.js.map +1 -0
- package/dist/utils/lua/lua_doc.d.ts +15 -0
- package/dist/utils/lua/lua_doc.d.ts.map +1 -1
- package/dist/utils/lua/lua_doc.js +96 -0
- package/dist/utils/lua/lua_doc.js.map +1 -1
- package/dist/utils/lua/lua_doc_types.d.ts +36 -0
- package/dist/utils/lua/lua_doc_types.d.ts.map +1 -0
- package/dist/utils/lua/lua_doc_types.js +122 -0
- package/dist/utils/lua/lua_doc_types.js.map +1 -0
- package/dist/utils/lua/lua_doc_types.test.d.ts +2 -0
- package/dist/utils/lua/lua_doc_types.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_doc_types.test.js +33 -0
- package/dist/utils/lua/lua_doc_types.test.js.map +1 -0
- package/dist/utils/lua/lua_expression_effects.d.ts +3 -0
- package/dist/utils/lua/lua_expression_effects.d.ts.map +1 -0
- package/dist/utils/lua/lua_expression_effects.js +33 -0
- package/dist/utils/lua/lua_expression_effects.js.map +1 -0
- package/dist/utils/lua/lua_fundamentals.d.ts +4 -0
- package/dist/utils/lua/lua_fundamentals.d.ts.map +1 -1
- package/dist/utils/lua/lua_fundamentals.js +35 -3
- package/dist/utils/lua/lua_fundamentals.js.map +1 -1
- package/dist/utils/lua/lua_inline_immutable_aliases.d.ts +3 -0
- package/dist/utils/lua/lua_inline_immutable_aliases.d.ts.map +1 -0
- package/dist/utils/lua/lua_inline_immutable_aliases.js +124 -0
- package/dist/utils/lua/lua_inline_immutable_aliases.js.map +1 -0
- package/dist/utils/lua/lua_inline_immutable_scalars.d.ts +3 -0
- package/dist/utils/lua/lua_inline_immutable_scalars.d.ts.map +1 -0
- package/dist/utils/lua/lua_inline_immutable_scalars.js +230 -0
- package/dist/utils/lua/lua_inline_immutable_scalars.js.map +1 -0
- package/dist/utils/lua/lua_inline_single_use_expressions.d.ts +3 -0
- package/dist/utils/lua/lua_inline_single_use_expressions.d.ts.map +1 -0
- package/dist/utils/lua/lua_inline_single_use_expressions.js +105 -0
- package/dist/utils/lua/lua_inline_single_use_expressions.js.map +1 -0
- package/dist/utils/lua/lua_lexical_bindings.d.ts +25 -0
- package/dist/utils/lua/lua_lexical_bindings.d.ts.map +1 -0
- package/dist/utils/lua/lua_lexical_bindings.js +233 -0
- package/dist/utils/lua/lua_lexical_bindings.js.map +1 -0
- package/dist/utils/lua/lua_local_budget.test.js +12 -1
- package/dist/utils/lua/lua_local_budget.test.js.map +1 -1
- package/dist/utils/lua/lua_optimizer.d.ts +10 -0
- package/dist/utils/lua/lua_optimizer.d.ts.map +1 -0
- package/dist/utils/lua/lua_optimizer.js +128 -0
- package/dist/utils/lua/lua_optimizer.js.map +1 -0
- package/dist/utils/lua/lua_optimizer.test.d.ts +2 -0
- package/dist/utils/lua/lua_optimizer.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_optimizer.test.js +262 -0
- package/dist/utils/lua/lua_optimizer.test.js.map +1 -0
- package/dist/utils/lua/lua_optimizer_fingerprint.d.ts +3 -0
- package/dist/utils/lua/lua_optimizer_fingerprint.d.ts.map +1 -0
- package/dist/utils/lua/lua_optimizer_fingerprint.js +50 -0
- package/dist/utils/lua/lua_optimizer_fingerprint.js.map +1 -0
- package/dist/utils/lua/lua_optimizer_rules.d.ts +3 -0
- package/dist/utils/lua/lua_optimizer_rules.d.ts.map +1 -0
- package/dist/utils/lua/lua_optimizer_rules.js +57 -0
- package/dist/utils/lua/lua_optimizer_rules.js.map +1 -0
- package/dist/utils/lua/lua_optimizer_types.d.ts +55 -0
- package/dist/utils/lua/lua_optimizer_types.d.ts.map +1 -0
- package/dist/utils/lua/lua_optimizer_types.js +31 -0
- package/dist/utils/lua/lua_optimizer_types.js.map +1 -0
- package/dist/utils/lua/lua_pack_locals.d.ts +2 -0
- package/dist/utils/lua/lua_pack_locals.d.ts.map +1 -1
- package/dist/utils/lua/lua_pack_locals.js +58 -14
- package/dist/utils/lua/lua_pack_locals.js.map +1 -1
- package/dist/utils/lua/lua_print_trace.d.ts +4 -0
- package/dist/utils/lua/lua_print_trace.d.ts.map +1 -0
- package/dist/utils/lua/lua_print_trace.js +166 -0
- package/dist/utils/lua/lua_print_trace.js.map +1 -0
- package/dist/utils/lua/lua_printer.d.ts +11 -0
- package/dist/utils/lua/lua_printer.d.ts.map +1 -0
- package/dist/utils/lua/lua_printer.js +105 -0
- package/dist/utils/lua/lua_printer.js.map +1 -0
- package/dist/utils/lua/lua_printer_lexemes.d.ts +22 -0
- package/dist/utils/lua/lua_printer_lexemes.d.ts.map +1 -0
- package/dist/utils/lua/lua_printer_lexemes.js +111 -0
- package/dist/utils/lua/lua_printer_lexemes.js.map +1 -0
- package/dist/utils/lua/lua_printer_tight2.d.ts +2 -0
- package/dist/utils/lua/lua_printer_tight2.d.ts.map +1 -0
- package/dist/utils/lua/lua_printer_tight2.js +64 -0
- package/dist/utils/lua/lua_printer_tight2.js.map +1 -0
- package/dist/utils/lua/lua_printer_traceable.d.ts +2 -0
- package/dist/utils/lua/lua_printer_traceable.d.ts.map +1 -0
- package/dist/utils/lua/lua_printer_traceable.js +107 -0
- package/dist/utils/lua/lua_printer_traceable.js.map +1 -0
- package/dist/utils/lua/lua_printer_types.d.ts +7 -0
- package/dist/utils/lua/lua_printer_types.d.ts.map +1 -0
- package/dist/utils/lua/lua_printer_types.js +3 -0
- package/dist/utils/lua/lua_printer_types.js.map +1 -0
- package/dist/utils/lua/lua_processor.d.ts +15 -72
- package/dist/utils/lua/lua_processor.d.ts.map +1 -1
- package/dist/utils/lua/lua_processor.js +177 -1205
- package/dist/utils/lua/lua_processor.js.map +1 -1
- package/dist/utils/lua/lua_processor.test.js +450 -101
- package/dist/utils/lua/lua_processor.test.js.map +1 -1
- package/dist/utils/lua/lua_remove_dead_stores.d.ts +3 -0
- package/dist/utils/lua/lua_remove_dead_stores.d.ts.map +1 -0
- package/dist/utils/lua/lua_remove_dead_stores.js +108 -0
- package/dist/utils/lua/lua_remove_dead_stores.js.map +1 -0
- package/dist/utils/lua/lua_remove_self_assignments.d.ts +3 -0
- package/dist/utils/lua/lua_remove_self_assignments.d.ts.map +1 -0
- package/dist/utils/lua/lua_remove_self_assignments.js +40 -0
- package/dist/utils/lua/lua_remove_self_assignments.js.map +1 -0
- package/dist/utils/lua/lua_remove_unused_for_variables.d.ts +3 -0
- package/dist/utils/lua/lua_remove_unused_for_variables.d.ts.map +1 -0
- package/dist/utils/lua/lua_remove_unused_for_variables.js +40 -0
- package/dist/utils/lua/lua_remove_unused_for_variables.js.map +1 -0
- package/dist/utils/lua/lua_remove_unused_functions.d.ts +2 -0
- package/dist/utils/lua/lua_remove_unused_functions.d.ts.map +1 -1
- package/dist/utils/lua/lua_remove_unused_functions.js +29 -6
- package/dist/utils/lua/lua_remove_unused_functions.js.map +1 -1
- package/dist/utils/lua/lua_remove_unused_locals.d.ts +2 -0
- package/dist/utils/lua/lua_remove_unused_locals.d.ts.map +1 -1
- package/dist/utils/lua/lua_remove_unused_locals.js +72 -289
- package/dist/utils/lua/lua_remove_unused_locals.js.map +1 -1
- package/dist/utils/lua/lua_remove_unused_parameters.d.ts +3 -0
- package/dist/utils/lua/lua_remove_unused_parameters.d.ts.map +1 -0
- package/dist/utils/lua/lua_remove_unused_parameters.js +124 -0
- package/dist/utils/lua/lua_remove_unused_parameters.js.map +1 -0
- package/dist/utils/lua/lua_rename_allowed_globals.d.ts +3 -0
- package/dist/utils/lua/lua_rename_allowed_globals.d.ts.map +1 -1
- package/dist/utils/lua/lua_rename_allowed_globals.js +78 -41
- package/dist/utils/lua/lua_rename_allowed_globals.js.map +1 -1
- package/dist/utils/lua/lua_rename_allowed_table_keys.d.ts +2 -0
- package/dist/utils/lua/lua_rename_allowed_table_keys.d.ts.map +1 -1
- package/dist/utils/lua/lua_rename_allowed_table_keys.js +57 -20
- package/dist/utils/lua/lua_rename_allowed_table_keys.js.map +1 -1
- package/dist/utils/lua/lua_rename_table_fields.d.ts +2 -0
- package/dist/utils/lua/lua_rename_table_fields.d.ts.map +1 -1
- package/dist/utils/lua/lua_rename_table_fields.js +15 -2
- package/dist/utils/lua/lua_rename_table_fields.js.map +1 -1
- package/dist/utils/lua/lua_renamer.d.ts +2 -0
- package/dist/utils/lua/lua_renamer.d.ts.map +1 -1
- package/dist/utils/lua/lua_renamer.js +146 -157
- package/dist/utils/lua/lua_renamer.js.map +1 -1
- package/dist/utils/lua/lua_scalar_simplification.test.d.ts +2 -0
- package/dist/utils/lua/lua_scalar_simplification.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_scalar_simplification.test.js +293 -0
- package/dist/utils/lua/lua_scalar_simplification.test.js.map +1 -0
- package/dist/utils/lua/lua_scope_name_reuse.test.d.ts +2 -0
- package/dist/utils/lua/lua_scope_name_reuse.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_scope_name_reuse.test.js +159 -0
- package/dist/utils/lua/lua_scope_name_reuse.test.js.map +1 -0
- package/dist/utils/lua/lua_simplify.d.ts +2 -0
- package/dist/utils/lua/lua_simplify.d.ts.map +1 -1
- package/dist/utils/lua/lua_simplify.js +236 -500
- package/dist/utils/lua/lua_simplify.js.map +1 -1
- package/dist/utils/lua/lua_source_mapping.test.d.ts +2 -0
- package/dist/utils/lua/lua_source_mapping.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_source_mapping.test.js +182 -0
- package/dist/utils/lua/lua_source_mapping.test.js.map +1 -0
- package/dist/utils/lua/lua_string_literal.test.d.ts +2 -0
- package/dist/utils/lua/lua_string_literal.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_string_literal.test.js +70 -0
- package/dist/utils/lua/lua_string_literal.test.js.map +1 -0
- package/dist/utils/lua/lua_strip_comments.d.ts +3 -0
- package/dist/utils/lua/lua_strip_comments.d.ts.map +1 -0
- package/dist/utils/lua/lua_strip_comments.js +15 -0
- package/dist/utils/lua/lua_strip_comments.js.map +1 -0
- package/dist/utils/lua/lua_symbol_collision.test.d.ts +2 -0
- package/dist/utils/lua/lua_symbol_collision.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_symbol_collision.test.js +55 -0
- package/dist/utils/lua/lua_symbol_collision.test.js.map +1 -0
- package/dist/utils/lua/lua_symbols.d.ts +19 -0
- package/dist/utils/lua/lua_symbols.d.ts.map +1 -0
- package/dist/utils/lua/lua_symbols.js +258 -0
- package/dist/utils/lua/lua_symbols.js.map +1 -0
- package/dist/utils/lua/lua_symbols.test.d.ts +2 -0
- package/dist/utils/lua/lua_symbols.test.d.ts.map +1 -0
- package/dist/utils/lua/lua_symbols.test.js +75 -0
- package/dist/utils/lua/lua_symbols.test.js.map +1 -0
- package/dist/utils/lua/lua_syntax_bare_table_key.d.ts +3 -0
- package/dist/utils/lua/lua_syntax_bare_table_key.d.ts.map +1 -0
- package/dist/utils/lua/lua_syntax_bare_table_key.js +55 -0
- package/dist/utils/lua/lua_syntax_bare_table_key.js.map +1 -0
- package/dist/utils/lua/lua_syntax_member_access.d.ts +3 -0
- package/dist/utils/lua/lua_syntax_member_access.d.ts.map +1 -0
- package/dist/utils/lua/lua_syntax_member_access.js +40 -0
- package/dist/utils/lua/lua_syntax_member_access.js.map +1 -0
- package/dist/utils/lua/lua_syntax_omit_local_nil.d.ts +3 -0
- package/dist/utils/lua/lua_syntax_omit_local_nil.d.ts.map +1 -0
- package/dist/utils/lua/lua_syntax_omit_local_nil.js +32 -0
- package/dist/utils/lua/lua_syntax_omit_local_nil.js.map +1 -0
- package/dist/utils/lua/lua_syntax_remove_redundant_do.d.ts +3 -0
- package/dist/utils/lua/lua_syntax_remove_redundant_do.d.ts.map +1 -0
- package/dist/utils/lua/lua_syntax_remove_redundant_do.js +50 -0
- package/dist/utils/lua/lua_syntax_remove_redundant_do.js.map +1 -0
- package/dist/utils/lua/lua_transform_map.d.ts +36 -0
- package/dist/utils/lua/lua_transform_map.d.ts.map +1 -0
- package/dist/utils/lua/lua_transform_map.js +205 -0
- package/dist/utils/lua/lua_transform_map.js.map +1 -0
- package/dist/utils/lua/lua_utils.d.ts +2 -4
- package/dist/utils/lua/lua_utils.d.ts.map +1 -1
- package/dist/utils/lua/lua_utils.js +100 -37
- package/dist/utils/lua/lua_utils.js.map +1 -1
- package/dist/utils/templates.d.ts +1 -0
- package/dist/utils/templates.d.ts.map +1 -1
- package/dist/utils/templates.js +4 -0
- package/dist/utils/templates.js.map +1 -1
- package/dist/utils/tic80/cartLoader.d.ts.map +1 -1
- package/dist/utils/tic80/cartLoader.js +7 -5
- package/dist/utils/tic80/cartLoader.js.map +1 -1
- package/dist/utils/tic80/cartLoader.test.d.ts +2 -0
- package/dist/utils/tic80/cartLoader.test.d.ts.map +1 -0
- package/dist/utils/tic80/cartLoader.test.js +100 -0
- package/dist/utils/tic80/cartLoader.test.js.map +1 -0
- package/dist/utils/tic80/cartWriter.d.ts +2 -2
- package/dist/utils/tic80/cartWriter.d.ts.map +1 -1
- package/dist/utils/tic80/cartWriter.js +22 -17
- package/dist/utils/tic80/cartWriter.js.map +1 -1
- package/dist/utils/tic80/launch.d.ts +1 -1
- package/dist/utils/tic80/launch.d.ts.map +1 -1
- package/dist/utils/tic80/launch.js +2 -1
- package/dist/utils/tic80/launch.js.map +1 -1
- package/dist/utils/tic80/tic80.d.ts +52 -50
- package/dist/utils/tic80/tic80.d.ts.map +1 -1
- package/dist/utils/tic80/tic80.js +11 -7
- package/dist/utils/tic80/tic80.js.map +1 -1
- package/dist/utils/traceProfiler.d.ts +86 -0
- package/dist/utils/traceProfiler.d.ts.map +1 -0
- package/dist/utils/traceProfiler.js +241 -0
- package/dist/utils/traceProfiler.js.map +1 -0
- package/dist/utils/traceProfiler.test.d.ts +2 -0
- package/dist/utils/traceProfiler.test.d.ts.map +1 -0
- package/dist/utils/traceProfiler.test.js +236 -0
- package/dist/utils/traceProfiler.test.js.map +1 -0
- package/dist/utils/utils.d.ts +5 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +35 -0
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/windowPosition.d.ts.map +1 -1
- package/dist/utils/windowPosition.js +2 -1
- package/dist/utils/windowPosition.js.map +1 -1
- package/package.json +31 -4
- package/scripts/benchmark-lua-minifiers.js +221 -0
- package/scripts/benchmark-lz-configs.js +247 -0
- package/scripts/gen-build-info.js +6 -0
- package/templates/TIC-80-ticbuild/tic80.exe +0 -0
- package/templates/declarations/tic80.d.ts +233 -0
- package/templates/env.template +11 -0
- package/templates/gitignore.template +7 -3
- package/templates/help/build.txt +2 -0
- package/templates/help/init.txt +3 -1
- package/templates/help/inspect.txt +14 -0
- package/templates/help/main.txt +3 -1
- package/templates/help/project.txt +27 -0
- package/templates/help/run.txt +4 -3
- package/templates/help/terminal.txt +32 -18
- package/templates/help/watch.txt +19 -5
- package/templates/minimal/project.ticbuild.jsonc +2 -1
- package/templates/piggybossa/project.ticbuild.jsonc +2 -1
- package/templates/pointsphere/project.ticbuild.jsonc +9 -15
- package/templates/pointsphere/src/palette.lua +5 -3
- package/templates/typescript/.luarc.json +5 -0
- package/templates/typescript/.vscode/extensions.json +3 -0
- package/templates/typescript/eslint.config.mjs +28 -0
- package/templates/typescript/package.json +22 -0
- package/templates/typescript/project.ticbuild.jsonc +28 -0
- package/templates/typescript/src/main.ts +6 -0
- package/templates/typescript/tsconfig.json +10 -0
- package/templates/vscode_extensions.template.json +3 -0
- package/templates/vscode_settings.template.json +3 -0
- package/ticbuild.schema.json +274 -110
- package/dist/backend/ImportedResource.d.ts +0 -11
- package/dist/backend/ImportedResource.d.ts.map +0 -1
- package/dist/backend/ImportedResource.js +0 -53
- package/dist/backend/ImportedResource.js.map +0 -1
- package/dist/backend/importers/luaImporter.d.ts +0 -1
- package/dist/backend/importers/luaImporter.d.ts.map +0 -1
- package/dist/backend/importers/luaImporter.js +0 -3
- package/dist/backend/importers/luaImporter.js.map +0 -1
- package/dist/backend/loadAllImports.d.ts +0 -1
- package/dist/backend/loadAllImports.d.ts.map +0 -1
- package/dist/backend/loadAllImports.js +0 -3
- package/dist/backend/loadAllImports.js.map +0 -1
- package/dist/backend/tic80Controller/externalController.d.ts +0 -18
- package/dist/backend/tic80Controller/externalController.d.ts.map +0 -1
- package/dist/backend/tic80Controller/externalController.js +0 -68
- package/dist/backend/tic80Controller/externalController.js.map +0 -1
- package/dist/backend/tic80Controller/internalController.d.ts +0 -13
- package/dist/backend/tic80Controller/internalController.d.ts.map +0 -1
- package/dist/backend/tic80Controller/internalController.js +0 -44
- package/dist/backend/tic80Controller/internalController.js.map +0 -1
- package/dist/frontend/manifestSchemaSync.test.d.ts +0 -2
- package/dist/frontend/manifestSchemaSync.test.d.ts.map +0 -1
- package/dist/frontend/manifestSchemaSync.test.js +0 -127
- package/dist/frontend/manifestSchemaSync.test.js.map +0 -1
- package/dist/frontend/repl.d.ts +0 -7
- package/dist/frontend/repl.d.ts.map +0 -1
- package/dist/frontend/repl.js +0 -271
- package/dist/frontend/repl.js.map +0 -1
- package/dist/utils/lua/luaUtils.d.ts +0 -1
- package/dist/utils/lua/luaUtils.d.ts.map +0 -1
- package/dist/utils/lua/luaUtils.js +0 -3
- package/dist/utils/lua/luaUtils.js.map +0 -1
- package/templates/help/repl.txt +0 -46
|
@@ -1,545 +1,281 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simplifyExpressionsRule = void 0;
|
|
3
4
|
exports.simplifyExpressionsInAST = simplifyExpressionsInAST;
|
|
5
|
+
const lua_ast_provenance_1 = require("./lua_ast_provenance");
|
|
6
|
+
const lua_ast_rewrite_1 = require("./lua_ast_rewrite");
|
|
7
|
+
const lua_constant_literals_1 = require("./lua_constant_literals");
|
|
8
|
+
const lua_printer_1 = require("./lua_printer");
|
|
4
9
|
const lua_utils_1 = require("./lua_utils");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
case "LocalStatement": {
|
|
11
|
-
stmt.variables.forEach(v => {
|
|
12
|
-
if (v.type === "Identifier")
|
|
13
|
-
out.add(v.name);
|
|
14
|
-
});
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
case "AssignmentStatement": {
|
|
18
|
-
stmt.variables.forEach(v => {
|
|
19
|
-
if (v.type === "Identifier")
|
|
20
|
-
out.add(v.name);
|
|
21
|
-
});
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
case "ForNumericStatement": {
|
|
25
|
-
if (stmt.variable.type === "Identifier")
|
|
26
|
-
out.add(stmt.variable.name);
|
|
27
|
-
stmt.body.forEach(s => collectWrites(s, out));
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
case "ForGenericStatement": {
|
|
31
|
-
stmt.variables.forEach(v => {
|
|
32
|
-
if (v.type === "Identifier")
|
|
33
|
-
out.add(v.name);
|
|
34
|
-
});
|
|
35
|
-
stmt.body.forEach(s => collectWrites(s, out));
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
case "WhileStatement":
|
|
39
|
-
case "RepeatStatement":
|
|
40
|
-
case "IfStatement":
|
|
41
|
-
case "DoStatement":
|
|
42
|
-
case "FunctionDeclaration": {
|
|
43
|
-
// Recurse into bodies/clauses to collect inner writes.
|
|
44
|
-
const bodies = [];
|
|
45
|
-
if (stmt.type === "WhileStatement" || stmt.type === "DoStatement") {
|
|
46
|
-
bodies.push(stmt.body);
|
|
47
|
-
}
|
|
48
|
-
else if (stmt.type === "RepeatStatement") {
|
|
49
|
-
bodies.push(stmt.body);
|
|
50
|
-
}
|
|
51
|
-
else if (stmt.type === "IfStatement") {
|
|
52
|
-
stmt.clauses.forEach(c => bodies.push(c.body));
|
|
53
|
-
}
|
|
54
|
-
else if (stmt.type === "FunctionDeclaration") {
|
|
55
|
-
bodies.push(stmt.body);
|
|
56
|
-
}
|
|
57
|
-
bodies.forEach(b => b.forEach(s => collectWrites(s, out)));
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
default:
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function collectBlockWrites(body) {
|
|
65
|
-
const writes = new Set();
|
|
66
|
-
body.forEach(stmt => collectWrites(stmt, writes));
|
|
67
|
-
return writes;
|
|
10
|
+
const comparisonOperators = new Set(["==", "~=", "<", "<=", ">", ">="]);
|
|
11
|
+
function makeNumericLiteral(value, source) {
|
|
12
|
+
if (!Number.isFinite(value) || Object.is(value, -0))
|
|
13
|
+
return null;
|
|
14
|
+
return (0, lua_ast_provenance_1.inheritLuaNodeOrigin)({ type: "NumericLiteral", value, raw: String(value) }, source);
|
|
68
15
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
16
|
+
function makeBooleanLiteral(value, source) {
|
|
17
|
+
return (0, lua_ast_provenance_1.inheritLuaNodeOrigin)({
|
|
18
|
+
type: "BooleanLiteral",
|
|
19
|
+
value,
|
|
20
|
+
raw: value ? "true" : "false",
|
|
21
|
+
}, source);
|
|
71
22
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
23
|
+
function makeStringLiteral(value, source) {
|
|
24
|
+
return (0, lua_ast_provenance_1.inheritLuaNodeOrigin)({
|
|
25
|
+
type: "StringLiteral",
|
|
26
|
+
value,
|
|
27
|
+
raw: JSON.stringify(value),
|
|
28
|
+
}, source);
|
|
74
29
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
30
|
+
function numericValue(literal) {
|
|
31
|
+
return literal.type === "NumericLiteral" && Number.isFinite(literal.value)
|
|
32
|
+
? literal.value
|
|
33
|
+
: null;
|
|
77
34
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
35
|
+
function stringLiteral(literal) {
|
|
36
|
+
return literal.type === "StringLiteral" ? literal : null;
|
|
80
37
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
38
|
+
function numericPairIsExact(left, right) {
|
|
39
|
+
return (!Number.isInteger(left) || Number.isSafeInteger(left)) &&
|
|
40
|
+
(!Number.isInteger(right) || Number.isSafeInteger(right));
|
|
83
41
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
42
|
+
function tightExpressionLength(expression) {
|
|
43
|
+
const statement = {
|
|
44
|
+
type: "ReturnStatement",
|
|
45
|
+
arguments: [expression],
|
|
46
|
+
};
|
|
47
|
+
const chunk = { type: "Chunk", body: [statement] };
|
|
48
|
+
return (0, lua_printer_1.unparseLua)(chunk, {
|
|
49
|
+
maxIndentLevel: 0,
|
|
50
|
+
lineBehavior: "tight2",
|
|
51
|
+
maxLineLength: Number.MAX_SAFE_INTEGER,
|
|
52
|
+
}).trim().slice("return ".length).length;
|
|
86
53
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return { ...lit };
|
|
95
|
-
case "StringLiteral": {
|
|
96
|
-
const str = lit;
|
|
97
|
-
return { type: "StringLiteral", value: str.value, raw: str.raw };
|
|
98
|
-
}
|
|
99
|
-
default:
|
|
100
|
-
return lit;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function isLiteral(expr) {
|
|
104
|
-
if (!expr)
|
|
105
|
-
return false;
|
|
106
|
-
switch (expr.type) {
|
|
107
|
-
case "NumericLiteral":
|
|
108
|
-
case "BooleanLiteral":
|
|
109
|
-
case "NilLiteral":
|
|
110
|
-
case "StringLiteral":
|
|
111
|
-
return true;
|
|
112
|
-
default:
|
|
113
|
-
return false;
|
|
54
|
+
function isProvablyBooleanExpression(expression) {
|
|
55
|
+
if (expression.type === "BooleanLiteral")
|
|
56
|
+
return true;
|
|
57
|
+
if (expression.type === "UnaryExpression")
|
|
58
|
+
return expression.operator === "not";
|
|
59
|
+
if (expression.type === "BinaryExpression") {
|
|
60
|
+
return comparisonOperators.has(expression.operator);
|
|
114
61
|
}
|
|
62
|
+
return expression.type === "LogicalExpression" &&
|
|
63
|
+
isProvablyBooleanExpression(expression.left) &&
|
|
64
|
+
isProvablyBooleanExpression(expression.right);
|
|
115
65
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
66
|
+
function makeNotExpression(argument, source) {
|
|
67
|
+
return (0, lua_ast_provenance_1.inheritLuaNodeOrigin)({
|
|
68
|
+
type: "UnaryExpression",
|
|
69
|
+
operator: "not",
|
|
70
|
+
argument,
|
|
71
|
+
}, source);
|
|
122
72
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (a.type === "StringLiteral" && b.type === "StringLiteral")
|
|
131
|
-
return (0, lua_utils_1.stringValue)(a) === (0, lua_utils_1.stringValue)(b);
|
|
132
|
-
return false;
|
|
73
|
+
function makeComplementaryEquality(expression, source) {
|
|
74
|
+
return (0, lua_ast_provenance_1.inheritLuaNodeOrigin)({
|
|
75
|
+
type: "BinaryExpression",
|
|
76
|
+
operator: expression.operator === "==" ? "~=" : "==",
|
|
77
|
+
left: expression.left,
|
|
78
|
+
right: expression.right,
|
|
79
|
+
}, source);
|
|
133
80
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return false;
|
|
139
|
-
return true;
|
|
81
|
+
function useIfShorter(original, candidate) {
|
|
82
|
+
return tightExpressionLength(candidate) < tightExpressionLength(original)
|
|
83
|
+
? candidate
|
|
84
|
+
: original;
|
|
140
85
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
86
|
+
function simplifyBooleanComparison(expression) {
|
|
87
|
+
if (expression.operator !== "==" && expression.operator !== "~=")
|
|
88
|
+
return expression;
|
|
89
|
+
const leftIsBooleanLiteral = expression.left.type === "BooleanLiteral";
|
|
90
|
+
const rightIsBooleanLiteral = expression.right.type === "BooleanLiteral";
|
|
91
|
+
if (leftIsBooleanLiteral === rightIsBooleanLiteral)
|
|
92
|
+
return expression;
|
|
93
|
+
const literal = (leftIsBooleanLiteral ? expression.left : expression.right);
|
|
94
|
+
const compared = leftIsBooleanLiteral ? expression.right : expression.left;
|
|
95
|
+
if (!isProvablyBooleanExpression(compared))
|
|
96
|
+
return expression;
|
|
97
|
+
const negate = expression.operator === "==" ? !literal.value : literal.value;
|
|
98
|
+
const candidate = negate ? makeNotExpression(compared, expression) : compared;
|
|
99
|
+
return useIfShorter(expression, candidate);
|
|
143
100
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
101
|
+
function literalsEqual(left, right) {
|
|
102
|
+
if (left.type === "NilLiteral")
|
|
103
|
+
return right.type === "NilLiteral";
|
|
104
|
+
if (left.type === "BooleanLiteral" && right.type === "BooleanLiteral") {
|
|
105
|
+
return left.value === right.value;
|
|
106
|
+
}
|
|
107
|
+
if (left.type === "NumericLiteral" && right.type === "NumericLiteral") {
|
|
108
|
+
return numericPairIsExact(left.value, right.value) ? left.value === right.value : null;
|
|
109
|
+
}
|
|
110
|
+
if (left.type === "StringLiteral" && right.type === "StringLiteral") {
|
|
111
|
+
const leftValue = (0, lua_utils_1.stringValue)(left);
|
|
112
|
+
const rightValue = (0, lua_utils_1.stringValue)(right);
|
|
113
|
+
return leftValue === null || rightValue === null ? null : leftValue === rightValue;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
146
116
|
}
|
|
147
|
-
function
|
|
117
|
+
function foldNumericBinary(operator, left, right, source) {
|
|
118
|
+
const a = numericValue(left);
|
|
119
|
+
const b = numericValue(right);
|
|
120
|
+
if (a === null || b === null)
|
|
121
|
+
return null;
|
|
122
|
+
if (!numericPairIsExact(a, b))
|
|
123
|
+
return null;
|
|
124
|
+
let result;
|
|
148
125
|
switch (operator) {
|
|
149
|
-
case "+":
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
return null;
|
|
161
|
-
return makeNumericLiteral(a - b);
|
|
162
|
-
}
|
|
163
|
-
case "*": {
|
|
164
|
-
const a = toNumber(left);
|
|
165
|
-
const b = toNumber(right);
|
|
166
|
-
if (a == null || b == null)
|
|
167
|
-
return null;
|
|
168
|
-
return makeNumericLiteral(a * b);
|
|
169
|
-
}
|
|
170
|
-
case "/": {
|
|
171
|
-
const a = toNumber(left);
|
|
172
|
-
const b = toNumber(right);
|
|
173
|
-
if (a == null || b == null)
|
|
174
|
-
return null;
|
|
175
|
-
return makeNumericLiteral(a / b);
|
|
176
|
-
}
|
|
177
|
-
case "//": {
|
|
178
|
-
const a = toNumber(left);
|
|
179
|
-
const b = toNumber(right);
|
|
180
|
-
if (a == null || b == null)
|
|
181
|
-
return null;
|
|
182
|
-
return makeNumericLiteral(Math.floor(a / b));
|
|
183
|
-
}
|
|
184
|
-
case "%": {
|
|
185
|
-
const a = toNumber(left);
|
|
186
|
-
const b = toNumber(right);
|
|
187
|
-
if (a == null || b == null)
|
|
188
|
-
return null;
|
|
189
|
-
return makeNumericLiteral(a - Math.floor(a / b) * b);
|
|
190
|
-
}
|
|
191
|
-
case "^": {
|
|
192
|
-
const a = toNumber(left);
|
|
193
|
-
const b = toNumber(right);
|
|
194
|
-
if (a == null || b == null)
|
|
195
|
-
return null;
|
|
196
|
-
return makeNumericLiteral(Math.pow(a, b));
|
|
197
|
-
}
|
|
198
|
-
case "..": {
|
|
199
|
-
const s1 = toStringLiteral(left);
|
|
200
|
-
const s2 = toStringLiteral(right);
|
|
201
|
-
if (!s1 || !s2)
|
|
202
|
-
return null;
|
|
203
|
-
const v1 = (0, lua_utils_1.stringValue)(s1);
|
|
204
|
-
const v2 = (0, lua_utils_1.stringValue)(s2);
|
|
205
|
-
if (v1 == null || v2 == null)
|
|
206
|
-
return null;
|
|
207
|
-
return makeStringLiteral(v1 + v2);
|
|
208
|
-
}
|
|
209
|
-
case "==":
|
|
210
|
-
return makeBooleanLiteral(literalEquals(left, right));
|
|
211
|
-
case "~=":
|
|
212
|
-
return makeBooleanLiteral(!literalEquals(left, right));
|
|
213
|
-
case "<": {
|
|
214
|
-
const a = toNumber(left);
|
|
215
|
-
const b = toNumber(right);
|
|
216
|
-
if (a == null || b == null)
|
|
217
|
-
return null;
|
|
218
|
-
return makeBooleanLiteral(a < b);
|
|
219
|
-
}
|
|
220
|
-
case "<=": {
|
|
221
|
-
const a = toNumber(left);
|
|
222
|
-
const b = toNumber(right);
|
|
223
|
-
if (a == null || b == null)
|
|
126
|
+
case "+":
|
|
127
|
+
result = a + b;
|
|
128
|
+
break;
|
|
129
|
+
case "-":
|
|
130
|
+
result = a - b;
|
|
131
|
+
break;
|
|
132
|
+
case "*":
|
|
133
|
+
result = a * b;
|
|
134
|
+
break;
|
|
135
|
+
case "/":
|
|
136
|
+
if (b === 0)
|
|
224
137
|
return null;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
case "
|
|
228
|
-
|
|
229
|
-
const b = toNumber(right);
|
|
230
|
-
if (a == null || b == null)
|
|
138
|
+
result = a / b;
|
|
139
|
+
break;
|
|
140
|
+
case "//":
|
|
141
|
+
if (b === 0)
|
|
231
142
|
return null;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
case "
|
|
235
|
-
|
|
236
|
-
const b = toNumber(right);
|
|
237
|
-
if (a == null || b == null)
|
|
143
|
+
result = Math.floor(a / b);
|
|
144
|
+
break;
|
|
145
|
+
case "%":
|
|
146
|
+
if (b === 0)
|
|
238
147
|
return null;
|
|
239
|
-
|
|
240
|
-
|
|
148
|
+
result = a - Math.floor(a / b) * b;
|
|
149
|
+
break;
|
|
150
|
+
case "^":
|
|
151
|
+
result = Math.pow(a, b);
|
|
152
|
+
break;
|
|
241
153
|
default:
|
|
242
154
|
return null;
|
|
243
155
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
case "Identifier": {
|
|
248
|
-
const replacement = scope.env.get(expr.name);
|
|
249
|
-
return replacement ? cloneLiteral(replacement) : expr;
|
|
250
|
-
}
|
|
251
|
-
case "UnaryExpression": {
|
|
252
|
-
expr.argument = simplifyExpression(expr.argument, scope);
|
|
253
|
-
if (isLiteral(expr.argument)) {
|
|
254
|
-
if (expr.operator === "-") {
|
|
255
|
-
const n = toNumber(expr.argument);
|
|
256
|
-
if (n != null)
|
|
257
|
-
return makeNumericLiteral(-n);
|
|
258
|
-
}
|
|
259
|
-
else if (expr.operator === "not") {
|
|
260
|
-
return makeBooleanLiteral(!isTruthy(expr.argument));
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return expr;
|
|
264
|
-
}
|
|
265
|
-
case "BinaryExpression": {
|
|
266
|
-
expr.left = simplifyExpression(expr.left, scope);
|
|
267
|
-
expr.right = simplifyExpression(expr.right, scope);
|
|
268
|
-
if (isLiteral(expr.left) && isLiteral(expr.right)) {
|
|
269
|
-
const folded = foldBinary(expr.operator, expr.left, expr.right);
|
|
270
|
-
if (folded)
|
|
271
|
-
return folded;
|
|
272
|
-
}
|
|
273
|
-
return expr;
|
|
274
|
-
}
|
|
275
|
-
case "LogicalExpression": {
|
|
276
|
-
expr.left = simplifyExpression(expr.left, scope);
|
|
277
|
-
if (isLiteral(expr.left)) {
|
|
278
|
-
if (expr.operator === "and") {
|
|
279
|
-
if (!isTruthy(expr.left))
|
|
280
|
-
return cloneLiteral(expr.left);
|
|
281
|
-
expr.right = simplifyExpression(expr.right, scope);
|
|
282
|
-
return expr.right;
|
|
283
|
-
}
|
|
284
|
-
else if (expr.operator === "or") {
|
|
285
|
-
if (isTruthy(expr.left))
|
|
286
|
-
return cloneLiteral(expr.left);
|
|
287
|
-
expr.right = simplifyExpression(expr.right, scope);
|
|
288
|
-
return expr.right;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
expr.right = simplifyExpression(expr.right, scope);
|
|
292
|
-
if (isLiteral(expr.left) && isLiteral(expr.right)) {
|
|
293
|
-
const result = expr.operator === "and" ? (isTruthy(expr.left) ? expr.right : expr.left) :
|
|
294
|
-
(isTruthy(expr.left) ? expr.left : expr.right);
|
|
295
|
-
return isLiteral(result) ? cloneLiteral(result) : result;
|
|
296
|
-
}
|
|
297
|
-
return expr;
|
|
298
|
-
}
|
|
299
|
-
case "CallExpression": {
|
|
300
|
-
expr.base = simplifyExpression(expr.base, scope);
|
|
301
|
-
expr.arguments = expr.arguments.map(arg => simplifyExpression(arg, scope));
|
|
302
|
-
return expr;
|
|
303
|
-
}
|
|
304
|
-
case "TableCallExpression": {
|
|
305
|
-
expr.base = simplifyExpression(expr.base, scope);
|
|
306
|
-
expr.arguments = simplifyExpression(expr.arguments, scope);
|
|
307
|
-
return expr;
|
|
308
|
-
}
|
|
309
|
-
case "StringCallExpression": {
|
|
310
|
-
expr.base = simplifyExpression(expr.base, scope);
|
|
311
|
-
return expr;
|
|
312
|
-
}
|
|
313
|
-
case "MemberExpression": {
|
|
314
|
-
expr.base = simplifyExpression(expr.base, scope);
|
|
315
|
-
return expr;
|
|
316
|
-
}
|
|
317
|
-
case "IndexExpression": {
|
|
318
|
-
expr.base = simplifyExpression(expr.base, scope);
|
|
319
|
-
expr.index = simplifyExpression(expr.index, scope);
|
|
320
|
-
return expr;
|
|
321
|
-
}
|
|
322
|
-
case "TableConstructorExpression": {
|
|
323
|
-
expr.fields.forEach(field => {
|
|
324
|
-
if (field.type === "TableKey") {
|
|
325
|
-
if (field.key)
|
|
326
|
-
field.key = simplifyExpression(field.key, scope);
|
|
327
|
-
if (field.value)
|
|
328
|
-
field.value = simplifyExpression(field.value, scope);
|
|
329
|
-
}
|
|
330
|
-
else if (field.type === "TableKeyString") {
|
|
331
|
-
if (field.value)
|
|
332
|
-
field.value = simplifyExpression(field.value, scope);
|
|
333
|
-
}
|
|
334
|
-
else if (field.type === "TableValue" && field.value) {
|
|
335
|
-
field.value = simplifyExpression(field.value, scope);
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
return expr;
|
|
339
|
-
}
|
|
340
|
-
case "FunctionDeclaration": {
|
|
341
|
-
const bodyScope = freshScope();
|
|
342
|
-
for (const param of expr.parameters) {
|
|
343
|
-
if (param.type === "Identifier")
|
|
344
|
-
bodyScope.locals.add(param.name);
|
|
345
|
-
}
|
|
346
|
-
simplifyBlock(expr.body, bodyScope);
|
|
347
|
-
return expr;
|
|
348
|
-
}
|
|
349
|
-
default:
|
|
350
|
-
return expr;
|
|
156
|
+
if (Number.isInteger(a) && Number.isInteger(b) &&
|
|
157
|
+
operator !== "/" && operator !== "^" && !Number.isSafeInteger(result)) {
|
|
158
|
+
return null;
|
|
351
159
|
}
|
|
160
|
+
return makeNumericLiteral(result, source);
|
|
352
161
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
162
|
+
function foldBinary(expression) {
|
|
163
|
+
const { left, right, operator } = expression;
|
|
164
|
+
if (!(0, lua_constant_literals_1.isLuaScalarLiteral)(left) || !(0, lua_constant_literals_1.isLuaScalarLiteral)(right))
|
|
165
|
+
return null;
|
|
166
|
+
const numeric = foldNumericBinary(operator, left, right, expression);
|
|
167
|
+
if (numeric)
|
|
168
|
+
return numeric;
|
|
169
|
+
if (operator === "..") {
|
|
170
|
+
const leftString = stringLiteral(left);
|
|
171
|
+
const rightString = stringLiteral(right);
|
|
172
|
+
if (!leftString || !rightString)
|
|
173
|
+
return null;
|
|
174
|
+
const leftValue = (0, lua_utils_1.stringValue)(leftString);
|
|
175
|
+
const rightValue = (0, lua_utils_1.stringValue)(rightString);
|
|
176
|
+
return leftValue === null || rightValue === null
|
|
177
|
+
? null
|
|
178
|
+
: makeStringLiteral(leftValue + rightValue, expression);
|
|
179
|
+
}
|
|
180
|
+
if (operator === "==" || operator === "~=") {
|
|
181
|
+
const equal = literalsEqual(left, right);
|
|
182
|
+
if (equal === null)
|
|
183
|
+
return null;
|
|
184
|
+
return makeBooleanLiteral(operator === "==" ? equal : !equal, expression);
|
|
185
|
+
}
|
|
186
|
+
const a = numericValue(left);
|
|
187
|
+
const b = numericValue(right);
|
|
188
|
+
if (a === null || b === null || !numericPairIsExact(a, b))
|
|
189
|
+
return null;
|
|
190
|
+
switch (operator) {
|
|
191
|
+
case "<":
|
|
192
|
+
return makeBooleanLiteral(a < b, expression);
|
|
193
|
+
case "<=":
|
|
194
|
+
return makeBooleanLiteral(a <= b, expression);
|
|
195
|
+
case ">":
|
|
196
|
+
return makeBooleanLiteral(a > b, expression);
|
|
197
|
+
case ">=":
|
|
198
|
+
return makeBooleanLiteral(a >= b, expression);
|
|
385
199
|
default:
|
|
386
|
-
return
|
|
200
|
+
return null;
|
|
387
201
|
}
|
|
388
202
|
}
|
|
389
|
-
function
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return;
|
|
399
|
-
scope.locals.add(variable.name);
|
|
400
|
-
const initExpr = simplifiedInit ? simplifiedInit[idx] : undefined;
|
|
401
|
-
const literal = initExpr ? (isLiteral(initExpr) ? initExpr : null) : (defaultMissingToNil ? makeNilLiteral() : null);
|
|
402
|
-
if (literal)
|
|
403
|
-
scope.env.set(variable.name, literal);
|
|
404
|
-
else
|
|
405
|
-
scope.env.delete(variable.name);
|
|
406
|
-
});
|
|
407
|
-
break;
|
|
408
|
-
}
|
|
409
|
-
case "AssignmentStatement": {
|
|
410
|
-
const originalInit = stmt.init.slice();
|
|
411
|
-
const simplifiedInit = originalInit.map((expr, idx) => {
|
|
412
|
-
const variable = stmt.variables[idx];
|
|
413
|
-
if (variable && variable.type === "Identifier" && expr) {
|
|
414
|
-
const rhsUsesLhs = referencesIdentifier(expr, variable.name);
|
|
415
|
-
if (rhsUsesLhs) {
|
|
416
|
-
const scoped = cloneScope(scope);
|
|
417
|
-
scoped.env.delete(variable.name);
|
|
418
|
-
return simplifyExpression(expr, scoped);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return simplifyExpression(expr, scope);
|
|
422
|
-
});
|
|
423
|
-
stmt.init = simplifiedInit;
|
|
424
|
-
const defaultMissingToNil = missingInitDefaultsToNil(simplifiedInit);
|
|
425
|
-
stmt.variables.forEach((variable, idx) => {
|
|
426
|
-
if (variable.type !== "Identifier")
|
|
427
|
-
return;
|
|
428
|
-
if (!scope.locals.has(variable.name)) {
|
|
429
|
-
scope.env.delete(variable.name);
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
const initExpr = simplifiedInit[idx];
|
|
433
|
-
// If RHS references the LHS (self-update) or is non-literal, drop from env.
|
|
434
|
-
const rhsUsesLhs = originalInit[idx] && referencesIdentifier(originalInit[idx], variable.name);
|
|
435
|
-
const literal = !rhsUsesLhs && initExpr ? (isLiteral(initExpr) ? initExpr : null) :
|
|
436
|
-
(!initExpr && defaultMissingToNil ? makeNilLiteral() : null);
|
|
437
|
-
if (literal)
|
|
438
|
-
scope.env.set(variable.name, literal);
|
|
439
|
-
else
|
|
440
|
-
scope.env.delete(variable.name);
|
|
441
|
-
});
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
case "CallStatement": {
|
|
445
|
-
stmt.expression = simplifyExpression(stmt.expression, scope);
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
case "ReturnStatement": {
|
|
449
|
-
stmt.arguments = stmt.arguments.map(arg => simplifyExpression(arg, scope));
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
case "IfStatement": {
|
|
453
|
-
const writes = new Set();
|
|
454
|
-
for (const clause of stmt.clauses) {
|
|
455
|
-
if (clause.type !== "ElseClause" && clause.condition)
|
|
456
|
-
clause.condition = simplifyExpression(clause.condition, scope);
|
|
457
|
-
const innerScope = cloneScope(scope);
|
|
458
|
-
simplifyBlock(clause.body, innerScope);
|
|
459
|
-
clause.body.forEach(s => collectWrites(s, writes));
|
|
203
|
+
function foldExpression(expression) {
|
|
204
|
+
if (expression.type === "UnaryExpression") {
|
|
205
|
+
if (expression.operator === "not" && (0, lua_constant_literals_1.isLuaScalarLiteral)(expression.argument)) {
|
|
206
|
+
return makeBooleanLiteral(!(0, lua_constant_literals_1.isLuaTruthyLiteral)(expression.argument), expression);
|
|
207
|
+
}
|
|
208
|
+
if (expression.operator === "-" && (0, lua_constant_literals_1.isLuaScalarLiteral)(expression.argument)) {
|
|
209
|
+
const value = numericValue(expression.argument);
|
|
210
|
+
if (value !== null && (!Number.isInteger(value) || Number.isSafeInteger(value))) {
|
|
211
|
+
return makeNumericLiteral(-value, expression) ?? expression;
|
|
460
212
|
}
|
|
461
|
-
writes.forEach(name => scope.env.delete(name));
|
|
462
|
-
break;
|
|
463
213
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
condScope.env = new Map(); // avoid propagating locals into loop conditions
|
|
469
|
-
stmt.condition = simplifyExpression(stmt.condition, condScope);
|
|
470
|
-
const inner = cloneScope(scope);
|
|
471
|
-
simplifyBlock(stmt.body, inner);
|
|
472
|
-
bodyWrites.forEach(name => scope.env.delete(name));
|
|
473
|
-
break;
|
|
214
|
+
if (expression.operator === "not" &&
|
|
215
|
+
expression.argument.type === "BinaryExpression" &&
|
|
216
|
+
(expression.argument.operator === "==" || expression.argument.operator === "~=")) {
|
|
217
|
+
return useIfShorter(expression, makeComplementaryEquality(expression.argument, expression));
|
|
474
218
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const condScope = cloneScope(scope);
|
|
481
|
-
condScope.env = new Map();
|
|
482
|
-
stmt.condition = simplifyExpression(stmt.condition, condScope);
|
|
483
|
-
bodyWrites.forEach(name => scope.env.delete(name));
|
|
484
|
-
break;
|
|
219
|
+
if (expression.operator === "not" &&
|
|
220
|
+
expression.argument.type === "UnaryExpression" &&
|
|
221
|
+
expression.argument.operator === "not" &&
|
|
222
|
+
isProvablyBooleanExpression(expression.argument.argument)) {
|
|
223
|
+
return useIfShorter(expression, expression.argument.argument);
|
|
485
224
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
const bodyScope = cloneScope(scope);
|
|
494
|
-
if (stmt.variable.type === "Identifier") {
|
|
495
|
-
bodyScope.locals.add(stmt.variable.name);
|
|
496
|
-
bodyScope.env.delete(stmt.variable.name);
|
|
497
|
-
scope.env.delete(stmt.variable.name); // do not treat loop var as const outside
|
|
225
|
+
}
|
|
226
|
+
if (expression.type === "BinaryExpression") {
|
|
227
|
+
const folded = foldBinary(expression);
|
|
228
|
+
if (folded) {
|
|
229
|
+
if ((folded.type === "NumericLiteral" || folded.type === "StringLiteral") &&
|
|
230
|
+
tightExpressionLength(folded) > tightExpressionLength(expression)) {
|
|
231
|
+
return expression;
|
|
498
232
|
}
|
|
499
|
-
|
|
500
|
-
bodyWrites.forEach(name => scope.env.delete(name));
|
|
501
|
-
break;
|
|
233
|
+
return folded;
|
|
502
234
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
bodyWrites.forEach(name => scope.env.delete(name));
|
|
517
|
-
break;
|
|
518
|
-
}
|
|
519
|
-
case "FunctionDeclaration": {
|
|
520
|
-
const bodyScope = freshScope();
|
|
521
|
-
stmt.parameters.forEach(param => {
|
|
522
|
-
if (param.type === "Identifier")
|
|
523
|
-
bodyScope.locals.add(param.name);
|
|
524
|
-
});
|
|
525
|
-
simplifyBlock(stmt.body, bodyScope);
|
|
526
|
-
break;
|
|
235
|
+
return simplifyBooleanComparison(expression);
|
|
236
|
+
}
|
|
237
|
+
if (expression.type === "LogicalExpression") {
|
|
238
|
+
if ((0, lua_constant_literals_1.isLuaScalarLiteral)(expression.left)) {
|
|
239
|
+
const leftIsTruthy = (0, lua_constant_literals_1.isLuaTruthyLiteral)(expression.left);
|
|
240
|
+
if (expression.operator === "and") {
|
|
241
|
+
return leftIsTruthy
|
|
242
|
+
? expression.right
|
|
243
|
+
: (0, lua_constant_literals_1.cloneLuaScalarLiteral)(expression.left, expression);
|
|
244
|
+
}
|
|
245
|
+
return leftIsTruthy
|
|
246
|
+
? (0, lua_constant_literals_1.cloneLuaScalarLiteral)(expression.left, expression)
|
|
247
|
+
: expression.right;
|
|
527
248
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
249
|
+
if (isProvablyBooleanExpression(expression.left) &&
|
|
250
|
+
expression.right.type === "BooleanLiteral" &&
|
|
251
|
+
((expression.operator === "and" && expression.right.value) ||
|
|
252
|
+
(expression.operator === "or" && !expression.right.value))) {
|
|
253
|
+
return useIfShorter(expression, expression.left);
|
|
531
254
|
}
|
|
532
|
-
default:
|
|
533
|
-
break;
|
|
534
255
|
}
|
|
256
|
+
return expression;
|
|
535
257
|
}
|
|
536
|
-
function
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
258
|
+
function simplifyExpressions(ast) {
|
|
259
|
+
return (0, lua_ast_rewrite_1.rewriteLuaAst)(ast, {
|
|
260
|
+
expression(expression) {
|
|
261
|
+
const folded = foldExpression(expression);
|
|
262
|
+
return { expression: folded, changed: folded !== expression };
|
|
263
|
+
},
|
|
264
|
+
});
|
|
540
265
|
}
|
|
541
266
|
function simplifyExpressionsInAST(ast) {
|
|
542
|
-
|
|
267
|
+
simplifyExpressions(ast);
|
|
543
268
|
return ast;
|
|
544
269
|
}
|
|
270
|
+
exports.simplifyExpressionsRule = {
|
|
271
|
+
id: "reduce.simplify-expressions",
|
|
272
|
+
family: "simplify",
|
|
273
|
+
description: "Fold constant and provably equivalent scalar expressions",
|
|
274
|
+
defaultEnabled: (options) => options.simplifyExpressions,
|
|
275
|
+
hooks: {
|
|
276
|
+
reduce(context) {
|
|
277
|
+
return { changed: simplifyExpressions(context.ast) };
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
};
|
|
545
281
|
//# sourceMappingURL=lua_simplify.js.map
|