format: apply repo prettier (3.8.1) to the folded skills tree
963 markdown files reformatted with the repository's pinned prettier so pnpm format:check covers the folded tree like every other repo file. The formatter's embedded-language pass also normalized code fences (TS semicolons, closed HTML tags in examples, lowercased CSS hex colors, one renumbered list that skipped an index). Alphanumeric token deltas vs the fold commit were audited file-by-file; all are formatter-equivalent markup normalizations plus the four sanitized skills.
This commit is contained in:
@@ -13,11 +13,11 @@ tsdown, built on Rolldown, supports plugins from multiple ecosystems to extend a
|
||||
Native plugins designed for Rolldown:
|
||||
|
||||
```ts
|
||||
import RolldownPlugin from 'rolldown-plugin-something'
|
||||
import RolldownPlugin from 'rolldown-plugin-something';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [RolldownPlugin()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Compatibility:** ✅ Full support
|
||||
@@ -27,16 +27,17 @@ export default defineConfig({
|
||||
Universal plugins that work across bundlers:
|
||||
|
||||
```ts
|
||||
import UnpluginPlugin from 'unplugin-something'
|
||||
import UnpluginPlugin from 'unplugin-something';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [UnpluginPlugin.rolldown()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Compatibility:** ✅ Most unplugin-* plugins work
|
||||
**Compatibility:** ✅ Most unplugin-\* plugins work
|
||||
|
||||
**Examples:**
|
||||
|
||||
- `unplugin-vue-components`
|
||||
- `unplugin-auto-import`
|
||||
- `unplugin-icons`
|
||||
@@ -46,11 +47,11 @@ export default defineConfig({
|
||||
Most Rollup plugins work with tsdown:
|
||||
|
||||
```ts
|
||||
import RollupPlugin from '@rollup/plugin-something'
|
||||
import RollupPlugin from '@rollup/plugin-something';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [RollupPlugin()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Compatibility:** ✅ High compatibility
|
||||
@@ -58,7 +59,7 @@ export default defineConfig({
|
||||
**Type Issues:** May cause TypeScript errors - use type casting:
|
||||
|
||||
```ts
|
||||
import RollupPlugin from 'rollup-plugin-something'
|
||||
import RollupPlugin from 'rollup-plugin-something';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -67,7 +68,7 @@ export default defineConfig({
|
||||
// Or cast to any
|
||||
RollupPlugin() as any,
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### 4. Vite Plugins
|
||||
@@ -75,14 +76,14 @@ export default defineConfig({
|
||||
Some Vite plugins may work:
|
||||
|
||||
```ts
|
||||
import VitePlugin from 'vite-plugin-something'
|
||||
import VitePlugin from 'vite-plugin-something';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
// @ts-expect-error Vite plugin type mismatch
|
||||
VitePlugin(),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Compatibility:** ⚠️ Limited - only if not using Vite-specific APIs
|
||||
@@ -94,30 +95,26 @@ export default defineConfig({
|
||||
### Basic Plugin Usage
|
||||
|
||||
```ts
|
||||
import { defineConfig } from 'tsdown'
|
||||
import SomePlugin from 'some-plugin'
|
||||
import { defineConfig } from 'tsdown';
|
||||
import SomePlugin from 'some-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
plugins: [SomePlugin()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Multiple Plugins
|
||||
|
||||
```ts
|
||||
import PluginA from 'plugin-a'
|
||||
import PluginB from 'plugin-b'
|
||||
import PluginC from 'plugin-c'
|
||||
import PluginA from 'plugin-a';
|
||||
import PluginB from 'plugin-b';
|
||||
import PluginC from 'plugin-c';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
plugins: [
|
||||
PluginA(),
|
||||
PluginB({ option: true }),
|
||||
PluginC(),
|
||||
],
|
||||
})
|
||||
plugins: [PluginA(), PluginB({ option: true }), PluginC()],
|
||||
});
|
||||
```
|
||||
|
||||
### Conditional Plugins
|
||||
@@ -125,12 +122,10 @@ export default defineConfig({
|
||||
```ts
|
||||
export default defineConfig((options) => ({
|
||||
entry: ['src/index.ts'],
|
||||
plugins: [
|
||||
SomePlugin(),
|
||||
options.watch && DevPlugin(),
|
||||
!options.watch && ProdPlugin(),
|
||||
].filter(Boolean),
|
||||
}))
|
||||
plugins: [SomePlugin(), options.watch && DevPlugin(), !options.watch && ProdPlugin()].filter(
|
||||
Boolean,
|
||||
),
|
||||
}));
|
||||
```
|
||||
|
||||
## Common Plugin Patterns
|
||||
@@ -138,37 +133,37 @@ export default defineConfig((options) => ({
|
||||
### JSON Import
|
||||
|
||||
```ts
|
||||
import json from '@rollup/plugin-json'
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [json()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Node Resolve
|
||||
|
||||
```ts
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [nodeResolve()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### CommonJS
|
||||
|
||||
```ts
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [commonjs()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Replace
|
||||
|
||||
```ts
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import replace from '@rollup/plugin-replace';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -177,13 +172,13 @@ export default defineConfig({
|
||||
__VERSION__: JSON.stringify('1.0.0'),
|
||||
}),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Auto Import
|
||||
|
||||
```ts
|
||||
import AutoImport from 'unplugin-auto-import/rolldown'
|
||||
import AutoImport from 'unplugin-auto-import/rolldown';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -192,13 +187,13 @@ export default defineConfig({
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
}),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Vue Components
|
||||
|
||||
```ts
|
||||
import Components from 'unplugin-vue-components/rolldown'
|
||||
import Components from 'unplugin-vue-components/rolldown';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -206,7 +201,7 @@ export default defineConfig({
|
||||
dts: 'src/components.d.ts',
|
||||
}),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Framework-Specific Plugins
|
||||
@@ -214,7 +209,7 @@ export default defineConfig({
|
||||
### React
|
||||
|
||||
```ts
|
||||
import react from '@vitejs/plugin-react'
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.tsx'],
|
||||
@@ -222,13 +217,13 @@ export default defineConfig({
|
||||
// @ts-expect-error Vite plugin
|
||||
react(),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Vue
|
||||
|
||||
```ts
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
@@ -236,13 +231,13 @@ export default defineConfig({
|
||||
// @ts-expect-error Vite plugin
|
||||
vue(),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Solid
|
||||
|
||||
```ts
|
||||
import solid from 'vite-plugin-solid'
|
||||
import solid from 'vite-plugin-solid';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.tsx'],
|
||||
@@ -250,13 +245,13 @@ export default defineConfig({
|
||||
// @ts-expect-error Vite plugin
|
||||
solid(),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Svelte
|
||||
|
||||
```ts
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
@@ -264,7 +259,7 @@ export default defineConfig({
|
||||
// @ts-expect-error Vite plugin
|
||||
svelte(),
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Writing Custom Plugins
|
||||
@@ -274,7 +269,7 @@ Follow Rolldown's plugin development guide:
|
||||
### Basic Plugin Structure
|
||||
|
||||
```ts
|
||||
import type { Plugin } from 'rolldown'
|
||||
import type { Plugin } from 'rolldown';
|
||||
|
||||
function myPlugin(): Plugin {
|
||||
return {
|
||||
@@ -286,23 +281,23 @@ function myPlugin(): Plugin {
|
||||
return {
|
||||
code: transformCode(code),
|
||||
map: null,
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// Other hooks...
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Using Custom Plugin
|
||||
|
||||
```ts
|
||||
import { myPlugin } from './my-plugin'
|
||||
import { myPlugin } from './my-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [myPlugin()],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Plugin Configuration
|
||||
@@ -318,11 +313,11 @@ Plugins run in the order they're defined:
|
||||
```ts
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
PluginA(), // Runs first
|
||||
PluginB(), // Runs second
|
||||
PluginC(), // Runs last
|
||||
PluginA(), // Runs first
|
||||
PluginB(), // Runs second
|
||||
PluginC(), // Runs last
|
||||
],
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
@@ -339,7 +334,7 @@ plugins: [
|
||||
|
||||
// Option 2: as any
|
||||
SomePlugin() as any,
|
||||
]
|
||||
];
|
||||
```
|
||||
|
||||
### Plugin Not Working
|
||||
|
||||
Reference in New Issue
Block a user