Skip to content

Commit b0cddda

Browse files
feat: add umd bundle (#457)
1 parent 1ac52f8 commit b0cddda

File tree

4 files changed

+81
-3
lines changed

4 files changed

+81
-3
lines changed

packages/babel-plugin-jsx/babel.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ module.exports = {
55
],
66
plugins: [
77
/* eslint-disable-next-line global-require */
8-
[require('./dist/index.js'), { optimize: true, isCustomElement: (tag) => /^x-/.test(tag) }],
8+
[
9+
!process.env.MODE
10+
? require('./dist/index.js')
11+
: require('./dist/vue-jsx.min.js'),
12+
{
13+
optimize: true,
14+
isCustomElement: (tag) => /^x-/.test(tag)
15+
},
16+
],
917
],
1018
};

packages/babel-plugin-jsx/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
"homepage": "https://github.com/vuejs/jsx-next/tree/dev/packages/babel-plugin-jsx#readme",
77
"license": "MIT",
88
"main": "dist/index.js",
9+
"unpkg": "dist/vue-jsx.min.js",
910
"repository": {
1011
"type": "git",
1112
"url": "git+https://github.com/vuejs/jsx-next.git"
1213
},
1314
"scripts": {
14-
"build": "tsc",
15+
"build": "rm -rf dist && tsc && rollup -c rollup.config.js",
1516
"lint": "eslint 'src/*.ts'",
16-
"test": "yarn build && jest --coverage",
17+
"test": "yarn build && jest --coverage && jest --clearCache && MODE=umd jest --coverage",
1718
"prepublishOnly": "yarn build"
1819
},
1920
"bugs": {
@@ -42,8 +43,11 @@
4243
"@typescript-eslint/parser": "^4.0.1",
4344
"@vue/compiler-dom": "3.0.5",
4445
"@vue/test-utils": "2.0.0-beta.2",
46+
"esbuild": "^0.12.9",
4547
"jest": "^26.0.1",
4648
"regenerator-runtime": "^0.13.5",
49+
"rollup": "^2.52.2",
50+
"rollup-plugin-esbuild": "^4.5.0",
4751
"ts-jest": "^26.1.3",
4852
"typescript": "^4.2.3",
4953
"vue": "3.0.7"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import esbuild from 'rollup-plugin-esbuild'
2+
3+
export default {
4+
input: 'src/index.ts',
5+
output: [
6+
{
7+
file: `dist/vue-jsx.min.js`,
8+
format: 'umd',
9+
name: `vue-jsx`,
10+
},
11+
],
12+
plugins: [
13+
esbuild({
14+
minify: true,
15+
}),
16+
],
17+
}

yarn.lock

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,14 @@
20322032
"@octokit/openapi-types" "^2.0.0"
20332033
"@types/node" ">= 8"
20342034

2035+
"@rollup/pluginutils@^4.1.0":
2036+
version "4.1.0"
2037+
resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.1.0.tgz#0dcc61c780e39257554feb7f77207dceca13c838"
2038+
integrity sha512-TrBhfJkFxA+ER+ew2U2/fHbebhLT/l/2pRk0hfj9KusXUuRXd2v0R58AfaZK9VXDQ4TogOSEmICVrQAA3zFnHQ==
2039+
dependencies:
2040+
estree-walker "^2.0.1"
2041+
picomatch "^2.2.2"
2042+
20352043
"@sinonjs/commons@^1.7.0":
20362044
version "1.8.1"
20372045
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217"
@@ -4713,6 +4721,11 @@ es6-promisify@^5.0.0:
47134721
dependencies:
47144722
es6-promise "^4.0.3"
47154723

4724+
esbuild@^0.12.9:
4725+
version "0.12.9"
4726+
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.12.9.tgz#bed4e7087c286cd81d975631f77d47feb1660070"
4727+
integrity sha512-MWRhAbMOJ9RJygCrt778rz/qNYgA4ZVj6aXnNPxFjs7PmIpb0fuB9Gmg5uWrr6n++XKwwm/RmSz6RR5JL2Ocsw==
4728+
47164729
escalade@^3.1.1:
47174730
version "3.1.1"
47184731
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
@@ -5397,6 +5410,11 @@ fsevents@~2.1.2:
53975410
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e"
53985411
integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==
53995412

5413+
fsevents@~2.3.2:
5414+
version "2.3.2"
5415+
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
5416+
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
5417+
54005418
function-bind@^1.1.1:
54015419
version "1.1.1"
54025420
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
@@ -6902,6 +6920,11 @@ jest@^26.0.1:
69026920
import-local "^3.0.2"
69036921
jest-cli "^26.6.3"
69046922

6923+
joycon@^3.0.1:
6924+
version "3.0.1"
6925+
resolved "https://registry.npmjs.org/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf"
6926+
integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA==
6927+
69056928
js-tokens@^4.0.0:
69066929
version "4.0.0"
69076930
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@@ -7011,6 +7034,11 @@ json5@^1.0.1:
70117034
dependencies:
70127035
minimist "^1.2.0"
70137036

7037+
jsonc-parser@^3.0.0:
7038+
version "3.0.0"
7039+
resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22"
7040+
integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==
7041+
70147042
jsonfile@^4.0.0:
70157043
version "4.0.0"
70167044
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
@@ -8537,6 +8565,11 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1:
85378565
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad"
85388566
integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==
85398567

8568+
picomatch@^2.2.2:
8569+
version "2.3.0"
8570+
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
8571+
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
8572+
85408573
pify@^2.0.0, pify@^2.3.0:
85418574
version "2.3.0"
85428575
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
@@ -9327,6 +9360,22 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
93279360
hash-base "^3.0.0"
93289361
inherits "^2.0.1"
93299362

9363+
rollup-plugin-esbuild@^4.5.0:
9364+
version "4.5.0"
9365+
resolved "https://registry.npmjs.org/rollup-plugin-esbuild/-/rollup-plugin-esbuild-4.5.0.tgz#0fbcb6d2d651d87dc540c4fc3b2db669f48da1f0"
9366+
integrity sha512-ieUd3AoYWsN6Tfp0LBNnC+QpdhKjDEaH4NK3ghuEXOH56/7TAtD+hMbD9vSWZgsGSbaqCkrn4j6PaUj1vOSt1g==
9367+
dependencies:
9368+
"@rollup/pluginutils" "^4.1.0"
9369+
joycon "^3.0.1"
9370+
jsonc-parser "^3.0.0"
9371+
9372+
rollup@^2.52.2:
9373+
version "2.52.2"
9374+
resolved "https://registry.npmjs.org/rollup/-/rollup-2.52.2.tgz#a7e90d10ddae3e8472c2857bd9f44b09ef34a47a"
9375+
integrity sha512-4RlFC3k2BIHlUsJ9mGd8OO+9Lm2eDF5P7+6DNQOp5sx+7N/1tFM01kELfbxlMX3MxT6owvLB1ln4S3QvvQlbUA==
9376+
optionalDependencies:
9377+
fsevents "~2.3.2"
9378+
93309379
rsvp@^4.8.4:
93319380
version "4.8.5"
93329381
resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734"

0 commit comments

Comments
 (0)