Skip to content

Commit 2eaceba

Browse files
committed
build: bundle @babel/types
1 parent c9d5296 commit 2eaceba

File tree

4 files changed

+51
-4
lines changed

4 files changed

+51
-4
lines changed

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,32 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22+
23+
---
24+
25+
Third party library "@babel/types" bundled.
26+
27+
"""
28+
MIT License
29+
30+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
31+
32+
Permission is hereby granted, free of charge, to any person obtaining
33+
a copy of this software and associated documentation files (the
34+
"Software"), to deal in the Software without restriction, including
35+
without limitation the rights to use, copy, modify, merge, publish,
36+
distribute, sublicense, and/or sell copies of the Software, and to
37+
permit persons to whom the Software is furnished to do so, subject to
38+
the following conditions:
39+
40+
The above copyright notice and this permission notice shall be
41+
included in all copies or substantial portions of the Software.
42+
43+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
44+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
46+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
47+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
48+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
49+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50+
"""

build.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineBuildConfig } from "unbuild";
22
import { rm, glob } from "node:fs/promises";
3+
import { transform } from "esbuild";
34

45
export default defineBuildConfig({
56
declaration: true,
@@ -12,7 +13,25 @@ export default defineBuildConfig({
1213
externals: [
1314
"@babel/core", // This is a type-only dependency
1415
],
16+
rollup: {
17+
inlineDependencies: [
18+
"@babel/types",
19+
"@babel/helper-validator-identifier",
20+
"@babel/helper-string-parser",
21+
],
22+
},
1523
hooks: {
24+
"rollup:options"(ctx, opts) {
25+
opts.plugins.push({
26+
name: "selective-minify",
27+
async transform(code, id) {
28+
if (id.includes(`node_modules/@babel/`)) {
29+
const res = await transform(code, { minify: true });
30+
return res.code;
31+
}
32+
},
33+
});
34+
},
1635
async "build:done"() {
1736
for await (const file of glob("dist/**/*.d.ts")) {
1837
await rm(file);

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"web:build": "nuxi generate web"
4040
},
4141
"dependencies": {
42-
"@babel/types": "^7.26.9",
4342
"citty": "^0.1.6",
4443
"defu": "^6.1.4",
4544
"jiti": "^2.4.2",

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)