@lssm/tool.tsdown 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/index.js +144 -0
- package/package.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@lssm/tool.tsdown
|
|
2
|
+
|
|
3
|
+
Shared tsup config presets for the monorepo.
|
|
4
|
+
|
|
5
|
+
Usage in a package:
|
|
6
|
+
|
|
7
|
+
1. Add peer dependency tsup if not present
|
|
8
|
+
2. Create `tsup.config.js` extending a preset
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
// tsup.config.js
|
|
12
|
+
import { defineConfig } from 'tsup';
|
|
13
|
+
import { reactLibrary } from '@lssm/tool.tsdown';
|
|
14
|
+
|
|
15
|
+
export default defineConfig((options) => ({
|
|
16
|
+
...reactLibrary,
|
|
17
|
+
entry: ['src'],
|
|
18
|
+
}));
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For Node libraries:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { defineConfig } from 'tsup';
|
|
25
|
+
import { nodeLib } from '@lssm/tool.tsdown';
|
|
26
|
+
|
|
27
|
+
export default defineConfig(() => ({
|
|
28
|
+
...nodeLib,
|
|
29
|
+
entry: ['src'],
|
|
30
|
+
}));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Override per-package as needed (externals, entry, minify, etc.).
|
package/index.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
|
+
|
|
3
|
+
const obfuscation = defineConfig({
|
|
4
|
+
minify: {
|
|
5
|
+
compress: {
|
|
6
|
+
dropConsole: false,
|
|
7
|
+
dropDebugger: true,
|
|
8
|
+
unused: true,
|
|
9
|
+
},
|
|
10
|
+
mangle: {
|
|
11
|
+
toplevel: true,
|
|
12
|
+
keepNames: false,
|
|
13
|
+
},
|
|
14
|
+
codegen: {
|
|
15
|
+
removeWhitespace: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const base = defineConfig({
|
|
21
|
+
exports: {
|
|
22
|
+
all: true,
|
|
23
|
+
devExports: false,
|
|
24
|
+
},
|
|
25
|
+
clean: true,
|
|
26
|
+
sourcemap: false,
|
|
27
|
+
format: ['esm'],
|
|
28
|
+
// format: ['esm', 'cjs'],
|
|
29
|
+
// format: ['esm'],
|
|
30
|
+
target: 'esnext',
|
|
31
|
+
// Let packages add their own externals; keep common ones minimal.
|
|
32
|
+
external: [],
|
|
33
|
+
|
|
34
|
+
dts: true,
|
|
35
|
+
// bundle: false,
|
|
36
|
+
unbundle: true,
|
|
37
|
+
splitting: false,
|
|
38
|
+
// treeshake: false,
|
|
39
|
+
|
|
40
|
+
entry: [
|
|
41
|
+
'src/**/*.ts',
|
|
42
|
+
'src/**/*.tsx',
|
|
43
|
+
'!src/**/*.test.ts',
|
|
44
|
+
'!src/**/*.test.tsx',
|
|
45
|
+
'!src/**/__tests__/**',
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const sharedExternal = [
|
|
50
|
+
'next',
|
|
51
|
+
'next/headers',
|
|
52
|
+
'next/navigation',
|
|
53
|
+
'next/link',
|
|
54
|
+
'react',
|
|
55
|
+
'react-dom',
|
|
56
|
+
'react-native',
|
|
57
|
+
'server-only',
|
|
58
|
+
'@lssm/lib.ui-kit-web',
|
|
59
|
+
'@lssm/lib.ui-kit',
|
|
60
|
+
'@lssm/lib.ui-kit/*',
|
|
61
|
+
'@lssm/lib.ui-kit-web/*',
|
|
62
|
+
'@lssm/lib.ui-kit-web/ui/*',
|
|
63
|
+
'lucide-react',
|
|
64
|
+
'lucide-react-native',
|
|
65
|
+
'react-native',
|
|
66
|
+
'react-native-safe-area-context',
|
|
67
|
+
'expo',
|
|
68
|
+
'expo-router',
|
|
69
|
+
'@prisma/adapter-pg',
|
|
70
|
+
'pg',
|
|
71
|
+
'graphql',
|
|
72
|
+
'elysia',
|
|
73
|
+
'posthog-node',
|
|
74
|
+
'posthog-js',
|
|
75
|
+
'posthog',
|
|
76
|
+
'posthog-browser',
|
|
77
|
+
'posthog-react',
|
|
78
|
+
'posthog-react-native',
|
|
79
|
+
'jotai',
|
|
80
|
+
'jotai-tanstack-query',
|
|
81
|
+
'@tanstack/query-core',
|
|
82
|
+
'@tanstack/react-query',
|
|
83
|
+
'@tanstack/react-query-devtools',
|
|
84
|
+
'@sentry/nextjs',
|
|
85
|
+
'react-map-gl',
|
|
86
|
+
'react-map-gl/maplibre',
|
|
87
|
+
'maplibre-gl',
|
|
88
|
+
'node:buffer',
|
|
89
|
+
'node:timers/promises',
|
|
90
|
+
'node:crypto',
|
|
91
|
+
'node:assert',
|
|
92
|
+
'node:url',
|
|
93
|
+
'@google-cloud/secret-manager',
|
|
94
|
+
'@google-cloud/storage',
|
|
95
|
+
'@google-cloud/pubsub',
|
|
96
|
+
'googleapis',
|
|
97
|
+
'postmark',
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
export const reactLibrary = defineConfig({
|
|
101
|
+
...base,
|
|
102
|
+
format: ['esm'],
|
|
103
|
+
external: [...sharedExternal],
|
|
104
|
+
minify: false,
|
|
105
|
+
platform: 'browser',
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export const moduleLibrary = defineConfig({
|
|
109
|
+
...base,
|
|
110
|
+
format: ['esm'],
|
|
111
|
+
external: [...sharedExternal],
|
|
112
|
+
platform: 'neutral',
|
|
113
|
+
exports: {
|
|
114
|
+
all: true,
|
|
115
|
+
devExports: false,
|
|
116
|
+
},
|
|
117
|
+
skipNodeModulesBundle: true,
|
|
118
|
+
...obfuscation,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export const nodeLib = defineConfig({
|
|
122
|
+
...base,
|
|
123
|
+
format: ['esm'],
|
|
124
|
+
// format: ['esm', 'cjs'],
|
|
125
|
+
platform: 'node',
|
|
126
|
+
external: [...sharedExternal],
|
|
127
|
+
...obfuscation,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const nodeDatabaseLib = defineConfig({
|
|
131
|
+
...base,
|
|
132
|
+
format: ['esm'],
|
|
133
|
+
platform: 'node',
|
|
134
|
+
// platform: 'neutral',
|
|
135
|
+
unbundle: true,
|
|
136
|
+
external: [...sharedExternal],
|
|
137
|
+
...obfuscation,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export default defineConfig((_options) => ({
|
|
141
|
+
...base,
|
|
142
|
+
...obfuscation,
|
|
143
|
+
// Packages can still provide their own local tsup.config to override.
|
|
144
|
+
}));
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lssm/tool.tsdown",
|
|
3
|
+
"version": "0.10.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Shared tsdown config presets for LSSM monorepo",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"tsdown": "^0.16.6"
|
|
15
|
+
}
|
|
16
|
+
}
|