Skip to content

Commit 60dc0f8

Browse files
committed
Add lua-types to the playground
1 parent 8173512 commit 60dc0f8

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"@types/webpack-env": "^1.15.1",
4545
"fengari-web": "^0.1.4",
4646
"highlight.js": "^9.18.0",
47+
"lua-types": "^2.7.0",
4748
"monaco-editor": "^0.19.3",
4849
"renderjson": "^1.4.0",
4950
"typescript-to-lua": "^0.31.0"

src/playground/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ function addLibsFromContext(context: __WebpackModuleApi.RequireContext) {
8787
}
8888

8989
addLibsFromContext(require.context("!!raw-loader!typescript/lib/", false, /lib(\.es(.+))?\.d\.ts$/));
90+
addLibsFromContext(require.context("!!raw-loader!lua-types/core", true, /\.d\.ts$/));
91+
// TODO: Generate it from lua-types/special/5.3.d.ts
92+
for (const module of [
93+
require("!!raw-loader!lua-types/special/5.2-plus.d.ts"),
94+
require("!!raw-loader!lua-types/special/5.2-plus-or-jit.d.ts"),
95+
require("!!raw-loader!lua-types/special/5.3-plus.d.ts"),
96+
require("!!raw-loader!lua-types/special/5.4-pre.d.ts"),
97+
]) {
98+
monaco.languages.typescript.typescriptDefaults.addExtraLib(module.default);
99+
}
90100

91101
const tsEditor = monaco.editor.create(tsEditorContainer, {
92102
value: getInitialCode(),

yarn.lock

+8
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,13 @@ fsevents@~2.1.2:
36683668
languageName: node
36693669
linkType: hard
36703670

3671+
"lua-types@npm:^2.7.0":
3672+
version: 2.7.0
3673+
resolution: "lua-types@npm:2.7.0"
3674+
checksum: 14199d9449e8a066a0ef87c608b85b9ee96617a326e02e0f466996cdc013909e46e5323eb223aafb1bfc1b136234d87e460d1221a7b04ab6a3927e4ba6fdf618
3675+
languageName: node
3676+
linkType: hard
3677+
36713678
"make-dir@npm:^2.0.0":
36723679
version: 2.1.0
36733680
resolution: "make-dir@npm:2.1.0"
@@ -6347,6 +6354,7 @@ resolve@^1.13.1:
63476354
highlight.js: ^9.18.0
63486355
html-loader: ^0.5.5
63496356
html-webpack-plugin: ^3.2.0
6357+
lua-types: ^2.7.0
63506358
monaco-editor: ^0.19.3
63516359
pnp-webpack-plugin: ^1.5.0
63526360
prettier: ^1.19.1

0 commit comments

Comments
 (0)