Skip to content

Commit 1129f4f

Browse files
amrbashirJonasKruckenberglucasfernog
authored
refactor: simplify api.js bundling (#4277)
Co-authored-by: Jonas Kruckenberg <iterpre@protonmail.com> Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent d4cac20 commit 1129f4f

15 files changed

Lines changed: 669 additions & 2322 deletions

File tree

.changes/api-node14.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"api": minor
3+
---
4+
5+
**Breaking change:** Node.js v12 is no longer supported.

core/tauri/scripts/bundle.global.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/tauri/scripts/bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

core/tauri/src/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ impl<R: Runtime> WindowManager<R> {
903903
}
904904

905905
let bundle_script = if with_global_tauri {
906-
include_str!("../scripts/bundle.js")
906+
include_str!("../scripts/bundle.global.js")
907907
} else {
908908
""
909909
};

tooling/api/babel.config.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

tooling/api/package.json

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"./package.json": "./package.json"
1212
},
1313
"scripts": {
14-
"build": "rimraf ./dist && rollup -c --silent && node ./scripts/after-build.cjs",
14+
"build": "yarn tsup && node ./scripts/after-build.cjs",
1515
"npm-pack": "yarn build && cd ./dist && npm pack",
1616
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly",
1717
"lint": "eslint --ext ts \"./src/**/*.ts\"",
@@ -36,19 +36,11 @@
3636
"access": "public"
3737
},
3838
"engines": {
39-
"node": ">= 12.22.0",
39+
"node": ">= 14.6.0",
4040
"npm": ">= 6.6.0",
4141
"yarn": ">= 1.19.1"
4242
},
4343
"devDependencies": {
44-
"@babel/core": "7.19.3",
45-
"@babel/preset-env": "7.19.3",
46-
"@babel/preset-typescript": "7.18.6",
47-
"@rollup/plugin-babel": "5.3.1",
48-
"@rollup/plugin-commonjs": "22.0.2",
49-
"@rollup/plugin-node-resolve": "13.3.0",
50-
"@rollup/plugin-sucrase": "4.0.4",
51-
"@rollup/plugin-typescript": "8.5.0",
5244
"@typescript-eslint/eslint-plugin": "5.38.1",
5345
"@typescript-eslint/parser": "5.38.1",
5446
"eslint": "8.24.0",
@@ -60,11 +52,7 @@
6052
"eslint-plugin-promise": "6.0.1",
6153
"eslint-plugin-security": "1.5.0",
6254
"prettier": "2.7.1",
63-
"regenerator-runtime": "0.13.9",
64-
"rimraf": "3.0.2",
65-
"rollup": "2.79.1",
66-
"rollup-plugin-terser": "7.0.2",
67-
"tslib": "2.4.0",
55+
"tsup": "6.0.1",
6856
"typedoc": "0.23.15",
6957
"typedoc-plugin-markdown": "3.13.6",
7058
"typedoc-plugin-mdn-links": "2.0.0",

tooling/api/rollup.config.js

Lines changed: 0 additions & 103 deletions
This file was deleted.

tooling/api/scripts/after-build.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const modules = readdirSync('src')
1212

1313
const outputPkg = {
1414
...pkg,
15+
devDependencies: {},
1516
exports: Object.assign(
1617
{},
1718
...modules.map((mod) => {

tooling/api/src/bundle.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

tooling/api/src/index.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,42 @@
1313
* @module
1414
*/
1515

16-
export * from './bundle'
16+
import * as app from './app'
17+
import * as cli from './cli'
18+
import * as clipboard from './clipboard'
19+
import * as dialog from './dialog'
20+
import * as event from './event'
21+
import * as fs from './fs'
22+
import * as globalShortcut from './globalShortcut'
23+
import * as http from './http'
24+
import * as notification from './notification'
25+
import * as path from './path'
26+
import * as process from './process'
27+
import * as shell from './shell'
28+
import * as tauri from './tauri'
29+
import * as updater from './updater'
30+
import * as window from './window'
31+
import * as os from './os'
32+
33+
/** @ignore */
34+
const invoke = tauri.invoke
35+
36+
export {
37+
invoke,
38+
app,
39+
cli,
40+
clipboard,
41+
dialog,
42+
event,
43+
fs,
44+
globalShortcut,
45+
http,
46+
notification,
47+
path,
48+
process,
49+
shell,
50+
tauri,
51+
updater,
52+
window,
53+
os
54+
}

0 commit comments

Comments
 (0)