Skip to content

Commit

Permalink
Remove babel from build toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Sep 22, 2023
1 parent a6fc6bf commit 558903b
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 45 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
^\.vscode$
^\.madgerc$
^\.prettierrc\.yml$
^babel\.config\.json$
^jest\.config\.js$
^package\.json$
^tsconfig\.json$
Expand Down
15 changes: 0 additions & 15 deletions babel.config.json

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"caniuse-lite": "^1.0.30001312",
"core-js": "^3.13.0",
"esbuild": "^0.15.10",
"esbuild-plugin-babel": "https://github.com/schloerke/esbuild-plugin-babel#patch-2",
"esbuild-plugin-globals": "^0.1.1",
"esbuild-plugin-sass": "^1.0.1",
"eslint": "^8.24.0",
Expand Down
7 changes: 0 additions & 7 deletions srcts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ All config files are located in the root folder to avoid opening two separate VS
* Used by `prettier` to know how to adjust code when a file is saved in VSCode or within `eslint`'s linting process.
* `yarnrc.yml`
* Notifies `yarn` to use `yarn` v2, install `./node_modules` folder for `esbuild`, and any CLI plugins.
* `babel.config.json`
* Used within `babel` transpilation of TypeScript -> JavaScript -> polyfilled JavaScript.
* Noteable options set:
* `"useBuiltIns": "usage"` - `core-js` polyfills are only added as they are _used_.
* `"corejs": "3.9"` - This number should match the installed `core-js` number.
* `"ignore":["node_modules/core-js"]` - The `core-js` library is directly ignored to [avoid being processed by `babel`](https://github.com/zloirock/core-js/issues/743#issuecomment-571983318).
* `jest.config.js`
* Used to configure [`jest` testing](https://jestjs.io/)
* `package.json`
Expand All @@ -168,7 +162,6 @@ All config files are located in the root folder to avoid opening two separate VS
* `tsconfig.json` -
* TypeScript config file
* Notable options set:
* `target: ES5` - Compile to es5, so babel has an easier job.
* `preserveConstEnums: false` - Do no preserve enum values into the final code. (If true, produces bloat / unused code)
* `isolatedModules: true` & `esModuleInterop: true` - Requested by `esbuild`. This [allows for `esbuild`](https://esbuild.github.io/content-types/#typescript) to safely compile the files in parallel

Expand Down
8 changes: 2 additions & 6 deletions srcts/build/_build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import { basename } from "path";
// @ts-ignore; Type definitions are not found. This occurs when `strict: true` in tsconfig.json
import readcontrol from "readcontrol";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore; Type definitions are not found. This occurs when `strict: true` in tsconfig.json
import babelPlugin from "esbuild-plugin-babel";

const outDir = "./inst/www/shared/";

type ShinyDesc = { version: string; package: string; license: string };
Expand Down Expand Up @@ -79,7 +75,7 @@ async function build(
return esbuildBuild({
incremental: incremental,
watch: watch,
target: "es5",
target: "es2020",
preserveSymlinks: true,
...opts,
}).then((x) => {
Expand All @@ -88,4 +84,4 @@ async function build(
});
}

export { outDir, build, shinyDesc, banner, babelPlugin };
export { outDir, build, shinyDesc, banner };
3 changes: 1 addition & 2 deletions srcts/build/extras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

// - TypeScript -----------------------------------------------------------

import { banner, build, outDir, babelPlugin } from "./_build";
import { banner, build, outDir } from "./_build";

build({
bundle: true,
sourcemap: true,
minify: true,
plugins: [babelPlugin()],
banner: banner,
entryPoints: [
"srcts/extras/shiny-autoreload.ts",
Expand Down
3 changes: 1 addition & 2 deletions srcts/build/shiny.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// yarn build
// ```

import { banner, build, outDir, shinyDesc, babelPlugin } from "./_build";
import { banner, build, outDir, shinyDesc } from "./_build";
import globalsPlugin from "esbuild-plugin-globals";
import type { BuildOptions } from "esbuild";
import { verifyJqueryImport } from "./_jquery";
Expand All @@ -18,7 +18,6 @@ const opts: BuildOptions = {
//// Loaded dynamically. MUST use `window.strftime` within code
// strftime: "window.strftime",
}),
babelPlugin(),
],
define: {
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
12 changes: 1 addition & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ __metadata:
peerDependenciesMeta:
jquery-ui:
optional: true
checksum: ba260ba5804c16b1455ff79f9d00ce860e12ae36e29d7a5f702da6b384c9454497421b8e06fe683d10fac53e2dc6ec008da4fa129a153cbbfe5396e027eb4247
checksum: 8718ebda1068894fc1267459b603f492045723ed1000fdbe798f2fab78fed8536b1906f56c53e9bd0ff9dce24aed176045618d0a1eddcf48f7d0313ad4ad67e9
languageName: node
linkType: hard

Expand Down Expand Up @@ -2220,7 +2220,6 @@ __metadata:
caniuse-lite: ^1.0.30001312
core-js: ^3.13.0
esbuild: ^0.15.10
esbuild-plugin-babel: "https://github.com/schloerke/esbuild-plugin-babel#patch-2"
esbuild-plugin-globals: ^0.1.1
esbuild-plugin-sass: ^1.0.1
eslint: ^8.24.0
Expand Down Expand Up @@ -4224,15 +4223,6 @@ __metadata:
languageName: node
linkType: hard

"esbuild-plugin-babel@https://github.com/schloerke/esbuild-plugin-babel#patch-2":
version: 0.2.3
resolution: "esbuild-plugin-babel@https://github.com/schloerke/esbuild-plugin-babel.git#commit=40106e72776cf4e2e4da8e52926632ceed378da0"
peerDependencies:
"@babel/core": ^7.0.0
checksum: c89e123bc1944efcee5628ea6d8cb878384a4de5c19b4b598b660c03dd6429dd11e9120b5cbf54722331c69cb3bc25183b63ef1c28174ed44787228a44a58684
languageName: node
linkType: hard

"esbuild-plugin-globals@npm:^0.1.1":
version: 0.1.1
resolution: "esbuild-plugin-globals@npm:0.1.1"
Expand Down

0 comments on commit 558903b

Please sign in to comment.