Skip to content

Commit 2d4621a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into destructuring-rest-patterns
2 parents e2349f0 + 3d7833e commit 2d4621a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+6262
-1871
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: node_js
2-
node_js:
3-
- stable
2+
node_js: "8.5.0"
43

54
script:
65
- npm run build

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 0.20.0
4+
- Added support for `string.repeat`, `string.padStart` and `string.padEnd`.
5+
- Added automatic variable renaming for invalid Lua identifiers.
6+
- Fixed `/** @tupleReturn */` not working for function types (i.e `myFunc: () => [number, number]`)
7+
- Various improvements to source map output format.
8+
- Various small code tweaks and improvements.
9+
10+
## 0.19.0
11+
- **BREAKING CHANGE:** All tstl-specific options should now be inside the "tstl" section in tsconfig.json (see README.md). **Root-level options are no longer supported**.
12+
- Added a compiler API to programmatically invoke TypeScriptToLua, and to modify or extend the default transpiler. More info on the [Compiler API wiki page](<https://github.com/TypeScriptToLua/TypeScriptToLua/wiki/TypeScriptToLua-API>).
13+
- Added support for [class decorators](https://www.typescriptlang.org/docs/handbook/decorators.html#class-decorators).
14+
- Added support for the [@luaTable directive](https://github.com/TypeScriptToLua/TypeScriptToLua/wiki/Compiler-Directives#luatable) which will force a class to be transpiled as vanilla lua table.
15+
- Added support for NaN, Infinity and related number functions.
16+
- Added support for string.startsWith, string.endsWith and improved string.replace implementation.
17+
- Added support for Symbol.hasInstance.
18+
19+
- Hoisting now also considers imports.
20+
- Various improvements to iterators and arrays, they also work with the spread operator now.
21+
- Fixed an issue with parameters that had `false` as default value.
22+
323
## 0.18.0
424
* Added support for setting array length. Doing `array.length = x` will set the length of the array to `x` (or shorter, if the starting array was shorter!).
525
* Added the `.name` property to all transpiled classes, so `class.name` will contain the classname as string.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ Changelog can be found in [CHANGELOG.md](https://github.com/TypeScriptToLua/Type
4242
{
4343
"compilerOptions": {
4444
"target": "esnext",
45-
"lib": ["es2015", "es2016", "es2017", "es2018", "esnext"],
45+
"lib": ["esnext"],
4646
"strict": true
4747
},
4848
"tstl": {
49-
"luaTarget": "JIT"
49+
"luaTarget": "JIT"
5050
}
5151
}
5252
```

appveyor.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Test against the latest version of this Node.js version
22
environment:
3-
nodejs_version: "8"
3+
nodejs_version: "8.5.0"
44

55
# Do not build feature branch with open Pull Requests
66
skip_branch_with_pr: true
@@ -13,15 +13,17 @@ cache:
1313
install:
1414
# Get the latest stable version of Node.js or io.js
1515
- ps: Install-Product node $env:nodejs_version
16-
# install modules
16+
# Upgrade npm
17+
- npm install --global npm@6
18+
# Install modules
1719
- npm ci
1820

1921
# Post-install test scripts.
2022
test_script:
2123
# Output useful info for debugging.
2224
- node --version
2325
- npm --version
24-
# run tests
26+
# Run tests
2527
- npm run build
2628
- npm test
2729

build_lualib.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
import * as fs from "fs";
2-
import * as glob from "glob";
32
import * as path from "path";
43
import * as ts from "typescript";
54
import * as tstl from "./src";
65
import { LuaLib } from "./src/LuaLib";
76

8-
const options: tstl.CompilerOptions = {
9-
skipLibCheck: true,
10-
types: [],
11-
target: ts.ScriptTarget.ESNext,
12-
lib: ["lib.esnext.d.ts"],
13-
14-
outDir: path.join(__dirname, "./dist/lualib"),
15-
rootDir: path.join(__dirname, "./src/lualib"),
16-
17-
luaLibImport: tstl.LuaLibImportKind.None,
18-
luaTarget: tstl.LuaTarget.Lua51,
19-
noHeader: true,
20-
};
21-
22-
// TODO: Check diagnostics
23-
const { emitResult } = tstl.transpileFiles(glob.sync("./src/lualib/**/*.ts"), options);
7+
const configFileName = path.resolve(__dirname, "src/lualib/tsconfig.json");
8+
const { emitResult, diagnostics } = tstl.transpileProject(configFileName);
249
emitResult.forEach(({ name, text }) => ts.sys.writeFile(name, text));
2510

26-
const bundlePath = path.join(__dirname, "./dist/lualib/lualib_bundle.lua");
11+
const reportDiagnostic = tstl.createDiagnosticReporter(true);
12+
diagnostics.forEach(reportDiagnostic);
13+
14+
const bundlePath = path.join(__dirname, "dist/lualib/lualib_bundle.lua");
2715
if (fs.existsSync(bundlePath)) {
2816
fs.unlinkSync(bundlePath);
2917
}

0 commit comments

Comments
 (0)