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:
@@ -23,7 +23,7 @@ tsdown --sourcemap inline
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
sourcemap: true,
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Source Map Types
|
||||
@@ -34,15 +34,17 @@ Generates separate `.map` files:
|
||||
|
||||
```ts
|
||||
export default defineConfig({
|
||||
sourcemap: true, // or 'external'
|
||||
})
|
||||
sourcemap: true, // or 'external'
|
||||
});
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
- `dist/index.mjs`
|
||||
- `dist/index.mjs.map`
|
||||
|
||||
**Pros:**
|
||||
|
||||
- Smaller bundle size
|
||||
- Can be excluded from production
|
||||
- Faster parsing
|
||||
@@ -54,17 +56,20 @@ Embeds source maps in the bundle:
|
||||
```ts
|
||||
export default defineConfig({
|
||||
sourcemap: 'inline',
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
- `dist/index.mjs` (includes source map as data URL)
|
||||
|
||||
**Pros:**
|
||||
|
||||
- Single file deployment
|
||||
- Guaranteed to be available
|
||||
|
||||
**Cons:**
|
||||
|
||||
- Larger bundle size
|
||||
- Exposed in production
|
||||
|
||||
@@ -75,14 +80,16 @@ Generates map files without reference comment:
|
||||
```ts
|
||||
export default defineConfig({
|
||||
sourcemap: 'hidden',
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
- `dist/index.mjs` (no `//# sourceMappingURL` comment)
|
||||
- `dist/index.mjs.map`
|
||||
|
||||
**Use when:**
|
||||
|
||||
- You want maps for error reporting tools
|
||||
- But don't want them exposed to users
|
||||
|
||||
@@ -110,9 +117,9 @@ This also generates `.d.ts.map` files for TypeScript declarations.
|
||||
```ts
|
||||
export default defineConfig((options) => ({
|
||||
entry: ['src/index.ts'],
|
||||
sourcemap: options.watch, // Only in dev
|
||||
sourcemap: options.watch, // Only in dev
|
||||
minify: !options.watch,
|
||||
}))
|
||||
}));
|
||||
```
|
||||
|
||||
### Production with External Maps
|
||||
@@ -121,9 +128,9 @@ export default defineConfig((options) => ({
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
format: ['esm', 'cjs'],
|
||||
sourcemap: true, // External maps
|
||||
sourcemap: true, // External maps
|
||||
minify: true,
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
Deploy maps to separate error reporting service.
|
||||
@@ -135,7 +142,7 @@ export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
format: ['esm'],
|
||||
sourcemap: 'inline',
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Per-Format Source Maps
|
||||
@@ -148,10 +155,10 @@ export default defineConfig({
|
||||
sourcemap: true,
|
||||
},
|
||||
iife: {
|
||||
sourcemap: 'inline', // Inline for browser
|
||||
sourcemap: 'inline', // Inline for browser
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### TypeScript Library with Declaration Maps
|
||||
@@ -162,12 +169,13 @@ export default defineConfig({
|
||||
format: ['esm', 'cjs'],
|
||||
sourcemap: true,
|
||||
dts: {
|
||||
sourcemap: true, // Enable declaration maps
|
||||
sourcemap: true, // Enable declaration maps
|
||||
},
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
- `dist/index.mjs` + `dist/index.mjs.map`
|
||||
- `dist/index.cjs` + `dist/index.cjs.map`
|
||||
- `dist/index.d.ts` + `dist/index.d.ts.map`
|
||||
@@ -188,12 +196,12 @@ export default defineConfig({
|
||||
|
||||
## Performance Impact
|
||||
|
||||
| Type | Bundle Size | Parse Speed | Debugging |
|
||||
|------|-------------|-------------|-----------|
|
||||
| None | Smallest | Fastest | Hard |
|
||||
| External | Small | Fast | Easy |
|
||||
| Inline | Largest | Slower | Easy |
|
||||
| Hidden | Small | Fast | Tools only |
|
||||
| Type | Bundle Size | Parse Speed | Debugging |
|
||||
| -------- | ----------- | ----------- | ---------- |
|
||||
| None | Smallest | Fastest | Hard |
|
||||
| External | Small | Fast | Easy |
|
||||
| Inline | Largest | Slower | Easy |
|
||||
| Hidden | Small | Fast | Tools only |
|
||||
|
||||
## CLI Examples
|
||||
|
||||
@@ -225,16 +233,16 @@ tsdown --no-sourcemap
|
||||
export default defineConfig({
|
||||
sourcemap: true,
|
||||
minify: false,
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Production Build
|
||||
|
||||
```ts
|
||||
export default defineConfig({
|
||||
sourcemap: 'external', // Upload to error service
|
||||
sourcemap: 'external', // Upload to error service
|
||||
minify: true,
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Browser Library
|
||||
@@ -243,9 +251,9 @@ export default defineConfig({
|
||||
export default defineConfig({
|
||||
format: ['iife'],
|
||||
platform: 'browser',
|
||||
sourcemap: 'inline', // Self-contained
|
||||
sourcemap: 'inline', // Self-contained
|
||||
globalName: 'MyLib',
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### Node.js CLI Tool
|
||||
@@ -256,7 +264,7 @@ export default defineConfig({
|
||||
platform: 'node',
|
||||
sourcemap: true,
|
||||
shims: true,
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
@@ -274,8 +282,8 @@ Use external source maps instead of inline:
|
||||
|
||||
```ts
|
||||
export default defineConfig({
|
||||
sourcemap: true, // Not 'inline'
|
||||
})
|
||||
sourcemap: true, // Not 'inline'
|
||||
});
|
||||
```
|
||||
|
||||
### Source Not Found
|
||||
|
||||
Reference in New Issue
Block a user