Skip to content

Commit 7f998d0

Browse files
fix(api): distribution (#1582)
Co-authored-by: Amr Bashir <48618675+amrbashir@users.noreply.github.com>
1 parent 7506a52 commit 7f998d0

5 files changed

Lines changed: 65 additions & 19 deletions

File tree

.changes/api-package-fix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"api": patch
3+
---
4+
5+
Fixes distribution of the `@tauri-apps/api` package for older bundlers.

tooling/api/package.json

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,71 @@
22
"name": "@tauri-apps/api",
33
"version": "1.0.0-beta-rc.2",
44
"description": "Tauri API definitions",
5-
"main": "./index.js",
6-
"typings": "./index.d.ts",
5+
"type": "module",
76
"exports": {
8-
".": "./index.js",
9-
"./app": "./app.js",
10-
"./cli": "./cli.js",
11-
"./dialog": "./dialog.js",
12-
"./event": "./event.js",
13-
"./updater": "./updater.js",
14-
"./fs": "./fs.js",
15-
"./path": "./path.js",
16-
"./http": "./http.js",
17-
"./notification": "./notification.js",
18-
"./tauri": "./tauri.js",
19-
"./window": "./window.js",
20-
"./shell": "./shell.js",
21-
"./globalShortcut": "./globalShortcut.js"
7+
".": {
8+
"import": "./index.js",
9+
"require": "./index.cjs"
10+
},
11+
"./app": {
12+
"import": "./app.js",
13+
"require": "./app.cjs"
14+
},
15+
"./cli": {
16+
"import": "./cli.js",
17+
"require": "./cli.cjs"
18+
},
19+
"./dialog": {
20+
"import": "./dialog.js",
21+
"require": "./dialog.cjs"
22+
},
23+
"./event": {
24+
"import": "./event.js",
25+
"require": "./event.cjs"
26+
},
27+
"./updater": {
28+
"import": "./updater.js",
29+
"require": "./updater.cjs"
30+
},
31+
"./fs": {
32+
"import": "./fs.js",
33+
"require": "./fs.cjs"
34+
},
35+
"./path": {
36+
"import": "./path.js",
37+
"require": "./path.cjs"
38+
},
39+
"./http": {
40+
"import": "./http.js",
41+
"require": "./http.cjs"
42+
},
43+
"./notification": {
44+
"import": "./notification.js",
45+
"require": "./notification.cjs"
46+
},
47+
"./window": {
48+
"import": "./window.js",
49+
"require": "./window.cjs"
50+
},
51+
"./shell": {
52+
"import": "./shell.js",
53+
"require": "./shell.cjs"
54+
},
55+
"./globalShortcut": {
56+
"import": "./globalShortcut.js",
57+
"require": "./globalShortcut.cjs"
58+
},
59+
"./tauri": {
60+
"import": "./tauri.js",
61+
"require": "./tauri.cjs"
62+
}
2263
},
2364
"funding": {
2465
"type": "opencollective",
2566
"url": "https://opencollective.com/tauri"
2667
},
2768
"scripts": {
28-
"build": "rimraf ./dist && rollup -c --silent && copyfiles package.json LICENSE* CHANGELOG.md dist",
69+
"build": "rimraf ./dist && rollup -c --silent && copyfiles -f package.json LICENSE* CHANGELOG.md src/*.ts dist && copyfiles -f src/helpers/*.ts dist/helpers",
2970
"npm-pack": "yarn build && cd ./dist && npm pack",
3071
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly",
3172
"lint": "eslint --ext ts \"./src/**/*.ts\"",

tooling/api/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ export default [
3434
output: [
3535
{
3636
dir: 'dist/',
37-
entryFileNames: '[name].js',
37+
entryFileNames: '[name].cjs',
3838
format: 'cjs',
3939
exports: 'named',
4040
globals: {}
4141
},
4242
{
4343
dir: 'dist/',
44-
entryFileNames: '[name].mjs',
44+
entryFileNames: '[name].js',
4545
format: 'esm',
4646
exports: 'named',
4747
globals: {}

0 commit comments

Comments
 (0)