Skip to content

Commit b7dd254

Browse files
authored
Bump to es2022 and use top-level await (#346)
Slightly simpler revision of #344 that was pointed out on discord
1 parent 6141921 commit b7dd254

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

build.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ esbuild.build({
55
entryPoints: ["./src/index.tsx"],
66
bundle: true,
77
minify: true,
8-
target: ["es2020"],
8+
target: ["es2022"],
99
outdir: "lonboard/static/",
1010
format: "esm",
1111
// Ref https://github.com/manzt/anywidget/issues/369#issuecomment-1792376003

src/index.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { useState, useEffect } from "react";
33
import { createRender, useModelState, useModel } from "@anywidget/react";
4-
import type { Initialize, InitializeProps, Render } from "@anywidget/types";
4+
import type { Initialize, Render } from "@anywidget/types";
55
import Map from "react-map-gl/maplibre";
66
import DeckGL from "@deck.gl/react/typed";
77
import type { Layer } from "@deck.gl/core/typed";
@@ -12,6 +12,8 @@ import { getTooltip } from "./tooltip/index.js";
1212
import { loadChildModels } from "./util.js";
1313
import { v4 as uuidv4 } from "uuid";
1414

15+
await initParquetWasm();
16+
1517
const DEFAULT_INITIAL_VIEW_STATE = {
1618
latitude: 10,
1719
longitude: 0,
@@ -139,13 +141,8 @@ function App() {
139141
);
140142
}
141143

142-
async function initialize({}: InitializeProps) {
143-
await initParquetWasm();
144-
}
145-
146-
const module: { render: Render; initialize: Initialize } = {
144+
const module: { render: Render; initialize?: Initialize } = {
147145
render: createRender(App),
148-
initialize,
149146
};
150147

151148
export default module;

tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
"include": ["src/**/*"],
33
"exclude": ["node_modules"],
44
"compilerOptions": {
5-
// Note: setting these two to NodeNext this breaks typing for apache-arrow
65
"moduleResolution": "node",
7-
// "module": "NodeNext",
6+
"module": "ES2022",
87
"outDir": "./dist",
98
"allowJs": true,
10-
"target": "ES2020",
9+
"target": "ES2022",
1110
"declaration": true,
1211
"noEmit": false,
1312
"noEmitOnError": false,

0 commit comments

Comments
 (0)