Skip to content

Commit 37ac91e

Browse files
authored
perf: bundle create-vite (#9034)
1 parent c89de3a commit 37ac91e

11 files changed

+916
-567
lines changed

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ module.exports = defineConfig({
178178
}
179179
},
180180
{
181-
files: ['*.js'],
181+
files: ['*.js', '*.mjs', '*.cjs'],
182182
rules: {
183183
'@typescript-eslint/explicit-module-boundary-types': 'off'
184184
}

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"eslint-plugin-import": "^2.26.0",
6868
"eslint-plugin-node": "^11.1.0",
6969
"execa": "^6.1.0",
70+
"fast-glob": "^3.2.11",
7071
"fs-extra": "^10.1.0",
7172
"lint-staged": "^13.0.3",
7273
"minimist": "^1.2.6",
@@ -76,8 +77,10 @@
7677
"pnpm": "^7.9.5",
7778
"prettier": "2.7.1",
7879
"prompts": "^2.4.2",
80+
"resolve": "^1.22.1",
7981
"rimraf": "^3.0.2",
8082
"rollup": "~2.78.0",
83+
"rollup-plugin-license": "^2.8.1",
8184
"semver": "^7.3.7",
8285
"simple-git-hooks": "^2.8.0",
8386
"tslib": "^2.4.0",

packages/create-vite/LICENSE

+274
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# create-vite license
2+
create-vite is released under the MIT license:
3+
14
MIT License
25

36
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
@@ -19,3 +22,274 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1922
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2023
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2124
SOFTWARE.
25+
26+
# Licenses of bundled dependencies
27+
The published create-vite artifact additionally contains code with the following licenses:
28+
ISC, MIT
29+
30+
# Bundled dependencies:
31+
## cross-spawn
32+
License: MIT
33+
By: André Cruz
34+
Repository: [email protected]:moxystudio/node-cross-spawn.git
35+
36+
> The MIT License (MIT)
37+
>
38+
> Copyright (c) 2018 Made With MOXY Lda <[email protected]>
39+
>
40+
> Permission is hereby granted, free of charge, to any person obtaining a copy
41+
> of this software and associated documentation files (the "Software"), to deal
42+
> in the Software without restriction, including without limitation the rights
43+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44+
> copies of the Software, and to permit persons to whom the Software is
45+
> furnished to do so, subject to the following conditions:
46+
>
47+
> The above copyright notice and this permission notice shall be included in
48+
> all copies or substantial portions of the Software.
49+
>
50+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
56+
> THE SOFTWARE.
57+
58+
---------------------------------------
59+
60+
## isexe
61+
License: ISC
62+
By: Isaac Z. Schlueter
63+
Repository: git+https://github.com/isaacs/isexe.git
64+
65+
> The ISC License
66+
>
67+
> Copyright (c) Isaac Z. Schlueter and Contributors
68+
>
69+
> Permission to use, copy, modify, and/or distribute this software for any
70+
> purpose with or without fee is hereby granted, provided that the above
71+
> copyright notice and this permission notice appear in all copies.
72+
>
73+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
74+
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
75+
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
76+
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
77+
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
78+
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
79+
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
80+
81+
---------------------------------------
82+
83+
## kleur
84+
License: MIT
85+
By: Luke Edwards
86+
Repository: lukeed/kleur
87+
88+
> The MIT License (MIT)
89+
>
90+
> Copyright (c) Luke Edwards <[email protected]> (lukeed.com)
91+
>
92+
> Permission is hereby granted, free of charge, to any person obtaining a copy
93+
> of this software and associated documentation files (the "Software"), to deal
94+
> in the Software without restriction, including without limitation the rights
95+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
96+
> copies of the Software, and to permit persons to whom the Software is
97+
> furnished to do so, subject to the following conditions:
98+
>
99+
> The above copyright notice and this permission notice shall be included in
100+
> all copies or substantial portions of the Software.
101+
>
102+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
103+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
105+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
106+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
107+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
108+
> THE SOFTWARE.
109+
110+
---------------------------------------
111+
112+
## kolorist
113+
License: MIT
114+
By: Marvin Hagemeister
115+
Repository: https://github.com/marvinhagemeister/kolorist.git
116+
117+
> The MIT License (MIT)
118+
>
119+
> Copyright (c) 2020-present Marvin Hagemeister
120+
>
121+
> Permission is hereby granted, free of charge, to any person obtaining a copy
122+
> of this software and associated documentation files (the "Software"), to deal
123+
> in the Software without restriction, including without limitation the rights
124+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125+
> copies of the Software, and to permit persons to whom the Software is
126+
> furnished to do so, subject to the following conditions:
127+
>
128+
> The above copyright notice and this permission notice shall be included in all
129+
> copies or substantial portions of the Software.
130+
>
131+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
134+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
135+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
136+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
137+
> SOFTWARE.
138+
139+
---------------------------------------
140+
141+
## minimist
142+
License: MIT
143+
By: James Halliday
144+
Repository: git://github.com/substack/minimist.git
145+
146+
> This software is released under the MIT license:
147+
>
148+
> Permission is hereby granted, free of charge, to any person obtaining a copy of
149+
> this software and associated documentation files (the "Software"), to deal in
150+
> the Software without restriction, including without limitation the rights to
151+
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
152+
> the Software, and to permit persons to whom the Software is furnished to do so,
153+
> subject to the following conditions:
154+
>
155+
> The above copyright notice and this permission notice shall be included in all
156+
> copies or substantial portions of the Software.
157+
>
158+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
159+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
160+
> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
161+
> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
162+
> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
163+
> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
164+
165+
---------------------------------------
166+
167+
## path-key
168+
License: MIT
169+
By: Sindre Sorhus
170+
Repository: sindresorhus/path-key
171+
172+
> MIT License
173+
>
174+
> Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
175+
>
176+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
177+
>
178+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
179+
>
180+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
181+
182+
---------------------------------------
183+
184+
## prompts
185+
License: MIT
186+
By: Terkel Gjervig
187+
Repository: terkelg/prompts
188+
189+
> MIT License
190+
>
191+
> Copyright (c) 2018 Terkel Gjervig Nielsen
192+
>
193+
> Permission is hereby granted, free of charge, to any person obtaining a copy
194+
> of this software and associated documentation files (the "Software"), to deal
195+
> in the Software without restriction, including without limitation the rights
196+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
197+
> copies of the Software, and to permit persons to whom the Software is
198+
> furnished to do so, subject to the following conditions:
199+
>
200+
> The above copyright notice and this permission notice shall be included in all
201+
> copies or substantial portions of the Software.
202+
>
203+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
204+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
205+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
206+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
207+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
208+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
209+
> SOFTWARE.
210+
211+
---------------------------------------
212+
213+
## shebang-command
214+
License: MIT
215+
By: Kevin Mårtensson
216+
Repository: kevva/shebang-command
217+
218+
> MIT License
219+
>
220+
> Copyright (c) Kevin Mårtensson <[email protected]> (github.com/kevva)
221+
>
222+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
223+
>
224+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
225+
>
226+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
227+
228+
---------------------------------------
229+
230+
## shebang-regex
231+
License: MIT
232+
By: Sindre Sorhus
233+
Repository: sindresorhus/shebang-regex
234+
235+
> MIT License
236+
>
237+
> Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
238+
>
239+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
240+
>
241+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
242+
>
243+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
244+
245+
---------------------------------------
246+
247+
## sisteransi
248+
License: MIT
249+
By: Terkel Gjervig
250+
Repository: https://github.com/terkelg/sisteransi
251+
252+
> MIT License
253+
>
254+
> Copyright (c) 2018 Terkel Gjervig Nielsen
255+
>
256+
> Permission is hereby granted, free of charge, to any person obtaining a copy
257+
> of this software and associated documentation files (the "Software"), to deal
258+
> in the Software without restriction, including without limitation the rights
259+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
260+
> copies of the Software, and to permit persons to whom the Software is
261+
> furnished to do so, subject to the following conditions:
262+
>
263+
> The above copyright notice and this permission notice shall be included in all
264+
> copies or substantial portions of the Software.
265+
>
266+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
267+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
268+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
269+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
270+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
271+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
272+
> SOFTWARE.
273+
274+
---------------------------------------
275+
276+
## which
277+
License: ISC
278+
By: Isaac Z. Schlueter
279+
Repository: git://github.com/isaacs/node-which.git
280+
281+
> The ISC License
282+
>
283+
> Copyright (c) Isaac Z. Schlueter and Contributors
284+
>
285+
> Permission to use, copy, modify, and/or distribute this software for any
286+
> purpose with or without fee is hereby granted, provided that the above
287+
> copyright notice and this permission notice appear in all copies.
288+
>
289+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
290+
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
291+
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
292+
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
293+
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
294+
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
295+
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

packages/create-vite/build.config.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import path from 'node:path'
2+
import url from 'node:url'
3+
import { defineBuildConfig } from 'unbuild'
4+
import licensePlugin from '../../scripts/rollupLicensePlugin.mjs'
5+
6+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
7+
8+
export default defineBuildConfig({
9+
entries: ['src/index'],
10+
clean: true,
11+
rollup: {
12+
inlineDependencies: true,
13+
esbuild: {
14+
minify: true
15+
}
16+
},
17+
alias: {
18+
// we can always use non-transpiled code since we support 14.18.0+
19+
prompts: 'prompts/lib/index.js'
20+
},
21+
hooks: {
22+
'rollup:options'(ctx, options) {
23+
if (!options.plugins) {
24+
options.plugins = []
25+
}
26+
options.plugins.push(
27+
licensePlugin(
28+
path.resolve(__dirname, './LICENSE'),
29+
'create-vite license',
30+
'create-vite'
31+
)
32+
)
33+
}
34+
}
35+
})

0 commit comments

Comments
 (0)