extract-youtube 1.0.1

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/vite.config.ts ADDED
@@ -0,0 +1,64 @@
1
+ import { defineConfig } from 'vite';
2
+ import { resolve } from 'path';
3
+ import { readFileSync } from 'fs';
4
+
5
+ // Read package.json for external dependencies
6
+ const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
7
+
8
+ export default defineConfig({
9
+ build: {
10
+ lib: {
11
+ entry: resolve(__dirname, 'src/index.ts'),
12
+ name: 'YouTubeTranscriptApi',
13
+ formats: ['es', 'cjs'],
14
+ fileName: (format) => `index.${format === 'es' ? 'mjs' : 'cjs'}`,
15
+ },
16
+ rollupOptions: {
17
+ // Externalize dependencies to avoid bundling them
18
+ external: [
19
+ ...Object.keys(pkg.dependencies || {}),
20
+ 'node:http',
21
+ 'node:https',
22
+ 'node:url',
23
+ 'node:stream',
24
+ 'node:buffer',
25
+ 'node:util',
26
+ ],
27
+ output: {
28
+ // Preserve module structure for better tree-shaking
29
+ preserveModules: false,
30
+ exports: 'named',
31
+ // Provide global names for UMD/IIFE builds
32
+ globals: {
33
+ 'node-fetch': 'fetch',
34
+ 'fast-xml-parser': 'XMLParser',
35
+ 'html-entities': 'htmlEntities',
36
+ 'https-proxy-agent': 'HttpsProxyAgent',
37
+ },
38
+ },
39
+ },
40
+ minify: 'terser',
41
+ terserOptions: {
42
+ compress: {
43
+ drop_console: false,
44
+ drop_debugger: true,
45
+ pure_funcs: ['console.debug'],
46
+ },
47
+ mangle: {
48
+ safari10: true,
49
+ },
50
+ format: {
51
+ comments: false,
52
+ },
53
+ },
54
+ // Generate source maps for debugging
55
+ sourcemap: true,
56
+ // Target modern environments
57
+ target: 'es2020',
58
+ // Emit declaration files
59
+ emitAssets: true,
60
+ },
61
+ resolve: {
62
+ extensions: ['.ts', '.js'],
63
+ },
64
+ });