Skip to content

Commit b6471d0

Browse files
committed
fix #2230
1 parent 5142612 commit b6471d0

File tree

6 files changed

+115
-27
lines changed

6 files changed

+115
-27
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@babel/plugin-transform-react-jsx": "7.23.4",
4444
"@babel/preset-env": "7.23.5",
4545
"@babel/preset-typescript": "7.23.3",
46+
"@rollup/plugin-babel": "^6.0.4",
4647
"@rollup/plugin-json": "4.1.0",
4748
"@rollup/plugin-node-resolve": "7.1.1",
4849
"@rollup/plugin-replace": "2.3.3",
@@ -90,6 +91,7 @@
9091
"rollup": "1.32.1",
9192
"rollup-plugin-babel": "4.4.0",
9293
"rollup-plugin-commonjs": "10.1.0",
94+
"rollup-plugin-dts": "^6.1.1",
9395
"rollup-plugin-filesize": "9.1.2",
9496
"rollup-plugin-license": "3.2.0",
9597
"rollup-plugin-terser": "7.0.2",

packages/docsearch-react/button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { DocSearchButton } from './dist/esm/DocSearchButton.js';
1+
export { DocSearchButton } from './dist/esm';

packages/docsearch-react/modal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { DocSearchModal } from './dist/esm/DocSearchModal.js';
1+
export { DocSearchModal } from './dist/esm';

packages/docsearch-react/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
"jsdelivr": "dist/umd/index.js",
2626
"scripts": {
2727
"build:clean": "rm -rf ./dist",
28-
"build:esm": "babel src --root-mode upward --extensions '.ts,.tsx' --out-dir dist/esm",
29-
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/esm",
30-
"build:umd": "rollup --config",
31-
"build": "yarn build:clean && yarn build:umd && yarn build:esm && yarn build:types",
28+
"build:clean-types": "rm -rf ./dist/esm/types",
29+
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/esm/types",
30+
"build": "yarn build:clean && yarn build:types && rollup --config && yarn build:clean-types",
3231
"on:change": "concurrently \"yarn build:esm\" \"yarn build:types\"",
3332
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\""
3433
},
Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
1+
import { babel } from '@rollup/plugin-babel';
12
import replace from '@rollup/plugin-replace';
3+
import dts from 'rollup-plugin-dts';
24

35
import { plugins } from '../../rollup.base.config';
46
import { getBundleBanner } from '../../scripts/getBundleBanner';
57

68
import pkg from './package.json';
79

8-
export default {
9-
input: 'src/index.ts',
10-
external: ['react', 'react-dom'],
11-
output: {
12-
globals: {
13-
react: 'React',
14-
'react-dom': 'ReactDOM',
15-
},
16-
file: 'dist/umd/index.js',
17-
format: 'umd',
18-
sourcemap: true,
19-
name: pkg.name,
20-
banner: getBundleBanner(pkg),
10+
export default [
11+
{
12+
input: 'src/index.ts',
13+
external: ['react', 'react-dom'],
14+
output: [
15+
{
16+
globals: {
17+
react: 'React',
18+
'react-dom': 'ReactDOM',
19+
},
20+
file: 'dist/umd/index.js',
21+
format: 'umd',
22+
sourcemap: true,
23+
name: pkg.name,
24+
banner: getBundleBanner(pkg),
25+
},
26+
{ dir: 'dist/esm', format: 'es' },
27+
],
28+
plugins: [
29+
...plugins,
30+
replace({
31+
'process.env.NODE_ENV': JSON.stringify('production'),
32+
}),
33+
babel({ babelHelpers: 'bundled' }),
34+
],
2135
},
22-
plugins: [
23-
...plugins,
24-
replace({
25-
'process.env.NODE_ENV': JSON.stringify('production'),
26-
}),
27-
],
28-
};
36+
{
37+
input: 'dist/esm/types/index.d.ts',
38+
output: [{ file: 'dist/esm/index.d.ts', format: 'es' }],
39+
plugins: [dts()],
40+
},
41+
];

yarn.lock

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,14 @@
446446
dependencies:
447447
"@babel/highlight" "^7.22.5"
448448

449+
"@babel/code-frame@^7.24.2":
450+
version "7.24.7"
451+
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465"
452+
integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==
453+
dependencies:
454+
"@babel/highlight" "^7.24.7"
455+
picocolors "^1.0.0"
456+
449457
"@babel/compat-data@^7.13.11":
450458
version "7.14.7"
451459
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.7.tgz#7b047d7a3a89a67d2258dc61f604f098f1bc7e08"
@@ -1484,6 +1492,11 @@
14841492
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193"
14851493
integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==
14861494

1495+
"@babel/helper-validator-identifier@^7.24.7":
1496+
version "7.24.7"
1497+
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db"
1498+
integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==
1499+
14871500
"@babel/helper-validator-option@^7.12.17":
14881501
version "7.12.17"
14891502
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831"
@@ -1647,6 +1660,16 @@
16471660
chalk "^2.0.0"
16481661
js-tokens "^4.0.0"
16491662

1663+
"@babel/highlight@^7.24.7":
1664+
version "7.24.7"
1665+
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d"
1666+
integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==
1667+
dependencies:
1668+
"@babel/helper-validator-identifier" "^7.24.7"
1669+
chalk "^2.4.2"
1670+
js-tokens "^4.0.0"
1671+
picocolors "^1.0.0"
1672+
16501673
"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.12.7", "@babel/parser@^7.13.0", "@babel/parser@^7.7.0":
16511674
version "7.13.4"
16521675
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.4.tgz#340211b0da94a351a6f10e63671fa727333d13ab"
@@ -4267,7 +4290,7 @@
42674290
"@docusaurus/theme-search-algolia" "2.4.1"
42684291
"@docusaurus/types" "2.4.1"
42694292

4270-
"@docusaurus/[email protected]", "react-loadable@npm:@docusaurus/[email protected]":
4293+
"@docusaurus/[email protected]":
42714294
version "5.5.2"
42724295
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
42734296
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
@@ -6615,6 +6638,14 @@
66156638
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.20.tgz#111b5db0f501aa89b05076fa31f0ea0e0c292cd3"
66166639
integrity sha512-88p7+M0QGxKpmnkfXjS4V26AnoC/eiqZutE8GLdaI5X12NY75bXSdTY9NkmYb2Xyk1O+MmkuO6Frmsj84V6I8Q==
66176640

6641+
"@rollup/plugin-babel@^6.0.4":
6642+
version "6.0.4"
6643+
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-6.0.4.tgz#bd698e351fa9aa9619fcae780aea2a603d98e4c4"
6644+
integrity sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw==
6645+
dependencies:
6646+
"@babel/helper-module-imports" "^7.18.6"
6647+
"@rollup/pluginutils" "^5.0.1"
6648+
66186649
66196650
version "4.1.0"
66206651
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
@@ -6650,6 +6681,15 @@
66506681
estree-walker "^1.0.1"
66516682
picomatch "^2.2.2"
66526683

6684+
"@rollup/pluginutils@^5.0.1":
6685+
version "5.1.0"
6686+
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0"
6687+
integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==
6688+
dependencies:
6689+
"@types/estree" "^1.0.0"
6690+
estree-walker "^2.0.2"
6691+
picomatch "^2.3.1"
6692+
66536693
"@sideway/address@^4.1.3":
66546694
version "4.1.3"
66556695
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.3.tgz#d93cce5d45c5daec92ad76db492cc2ee3c64ab27"
@@ -7020,6 +7060,11 @@
70207060
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40"
70217061
integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==
70227062

7063+
"@types/estree@^1.0.0":
7064+
version "1.0.5"
7065+
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
7066+
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
7067+
70237068
"@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.18":
70247069
version "4.17.28"
70257070
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz#c47def9f34ec81dc6328d0b1b5303d1ec98d86b8"
@@ -12410,6 +12455,11 @@ estree-walker@^1.0.1:
1241012455
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700"
1241112456
integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==
1241212457

12458+
estree-walker@^2.0.2:
12459+
version "2.0.2"
12460+
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
12461+
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
12462+
1241312463
esutils@^2.0.2:
1241412464
version "2.0.3"
1241512465
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@@ -16484,6 +16534,13 @@ magic-string@^0.25.2, magic-string@^0.25.5:
1648416534
dependencies:
1648516535
sourcemap-codec "^1.4.4"
1648616536

16537+
magic-string@^0.30.10:
16538+
version "0.30.10"
16539+
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.10.tgz#123d9c41a0cb5640c892b041d4cfb3bd0aa4b39e"
16540+
integrity sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==
16541+
dependencies:
16542+
"@jridgewell/sourcemap-codec" "^1.4.15"
16543+
1648716544
magic-string@~0.30.0:
1648816545
version "0.30.5"
1648916546
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.5.tgz#1994d980bd1c8835dc6e78db7cbd4ae4f24746f9"
@@ -20147,6 +20204,14 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
2014720204
dependencies:
2014820205
"@babel/runtime" "^7.10.3"
2014920206

20207+
"react-loadable@npm:@docusaurus/[email protected]":
20208+
version "5.5.2"
20209+
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
20210+
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
20211+
dependencies:
20212+
"@types/react" "*"
20213+
prop-types "^15.6.2"
20214+
2015020215
react-refresh@^0.9.0:
2015120216
version "0.9.0"
2015220217
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.9.0.tgz#71863337adc3e5c2f8a6bfddd12ae3bfe32aafbf"
@@ -20937,6 +21002,15 @@ [email protected]:
2093721002
resolve "^1.11.0"
2093821003
rollup-pluginutils "^2.8.1"
2093921004

21005+
rollup-plugin-dts@^6.1.1:
21006+
version "6.1.1"
21007+
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-6.1.1.tgz#46b33f4d1d7f4e66f1171ced9b282ac11a15a254"
21008+
integrity sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==
21009+
dependencies:
21010+
magic-string "^0.30.10"
21011+
optionalDependencies:
21012+
"@babel/code-frame" "^7.24.2"
21013+
2094021014
2094121015
version "9.1.2"
2094221016
resolved "https://registry.yarnpkg.com/rollup-plugin-filesize/-/rollup-plugin-filesize-9.1.2.tgz#958eea26880698d0bc008fa9d214657ee180b934"

0 commit comments

Comments
 (0)