Skip to content

Commit

Permalink
chore(scan): remove unused dependencies (#193)
Browse files Browse the repository at this point in the history
Removes unused dependencies from the `scan` package:

- `@babel/generator` - not used
- `@clack/core` - not used directly, already pulled in via
  `@clack/prompts`
- `estree-walker` - not used
- `tsx` - not used

At the root of the monorepo:

- `@vercel/style-guide` - doesn't seem to be referenced anywhere

Also changes a couple of FS paths to use `__dirname` in case `tsup` is
ever run from another `cwd`.

This should drop a big chunk of the install size, re #178. Specifically
since we drop `tsx` which is ~400KB.

Co-authored-by: RobPruzan <[email protected]>
  • Loading branch information
43081j and RobPruzan authored Jan 18, 2025
1 parent 85e0f3c commit 9f9dbe1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 92 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
},
"packageManager": "[email protected]",
"dependencies": {
"@vercel/speed-insights": "^1.1.0"
}
}
7 changes: 1 addition & 6 deletions packages/scan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,29 +215,24 @@
},
"dependencies": {
"@babel/core": "^7.26.0",
"@babel/generator": "^7.26.2",
"@babel/types": "^7.26.0",
"@clack/core": "^0.3.5",
"@clack/prompts": "^0.8.2",
"@preact/signals": "^1.3.1",
"@rollup/pluginutils": "^5.1.3",
"@types/node": "^20.17.9",
"bippy": "0.2.7",
"esbuild": "^0.24.0",
"estree-walker": "^3.0.3",
"kleur": "^4.1.5",
"mri": "^1.2.0",
"playwright": "^1.49.0",
"preact": "^10.25.1",
"tsx": "^4.0.0"
"preact": "^10.25.1"
},
"devDependencies": {
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
"@remix-run/react": "*",
"@types/babel__core": "^7.20.5",
"@types/react": "^18.0.0",
"@types/react-router": "^5.1.0",
"@vercel/style-guide": "^6.0.0",
"clsx": "^2.1.1",
"es-module-lexer": "^1.5.4",
"next": "*",
Expand Down
24 changes: 12 additions & 12 deletions packages/scan/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ const banner = `/**
void (async () => {
await init;

if (fs.existsSync(DIST_PATH)) {
fs.rmSync(DIST_PATH, { recursive: true });
}
fs.mkdirSync(DIST_PATH, { recursive: true });

const code = fs.readFileSync('./src/core/index.ts', 'utf8');
const code = fs.readFileSync(
path.join(__dirname, './src/core/index.ts'),
'utf8',
);
const [_, allExports] = parse(code);
const names: Array<string> = [];
for (const exportItem of allExports) {
Expand All @@ -75,9 +73,15 @@ void (async () => {

setTimeout(() => {
for (const ext of ['js', 'mjs', 'global.js']) {
fs.writeFileSync(`./dist/rsc-shim.${ext}`, script);
fs.writeFileSync(path.join(__dirname, `./dist/rsc-shim.${ext}`), script);
}
for (const ext of ['d.mts', 'd.ts']) {
fs.writeFileSync(
path.join(__dirname, `./dist/rsc-shim.${ext}`),
`export {}`,
);
}
}, 500);
}, 500); // for some reason it clears the file if we don't wait
})();

export default defineConfig([
Expand Down Expand Up @@ -105,7 +109,6 @@ export default defineConfig([
'next',
'next/navigation',
'react-router',
'react-router-dom',
'@remix-run/react',
],
esbuildPlugins: [workerPlugin],
Expand Down Expand Up @@ -163,7 +166,6 @@ export default defineConfig([
'next',
'next/navigation',
'react-router',
'react-router-dom',
'@remix-run/react',
'preact',
'@preact/signals',
Expand Down Expand Up @@ -215,12 +217,10 @@ export default defineConfig([
target: 'esnext',
external: [
'unplugin',
'estree-walker',
'@rollup/pluginutils',
'@babel/types',
'@babel/parser',
'@babel/traverse',
'@babel/generator',
'@babel/core',
'rollup',
'webpack',
Expand Down
77 changes: 4 additions & 73 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9f9dbe1

Please sign in to comment.