@mytechtoday/augment-extensions 2.5.0 → 3.1.0
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/AGENTS.md +2 -1
- package/README.md +27 -1357
- package/augment-extensions/coding-standards/bash/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/css/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/go/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/html/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/html-css-js/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/js/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/php/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/powershell/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/python/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/react/CHANGELOG.md +50 -50
- package/augment-extensions/coding-standards/typescript/CHANGELOG.md +39 -39
- package/augment-extensions/coding-standards/typescript/VERSION +2 -2
- package/augment-extensions/coding-standards/typescript/examples/biome.json +199 -199
- package/augment-extensions/coding-standards/typescript/examples/eslint-flat-config.js +166 -166
- package/augment-extensions/coding-standards/typescript/examples/monorepo-config/README.md +47 -47
- package/augment-extensions/coding-standards/typescript/examples/monorepo-config/package.json +37 -37
- package/augment-extensions/coding-standards/typescript/examples/monorepo-config/pnpm-workspace.yaml +5 -5
- package/augment-extensions/coding-standards/typescript/examples/monorepo-config/tsconfig.base.json +50 -50
- package/augment-extensions/coding-standards/typescript/examples/monorepo-config/turbo.json +47 -47
- package/augment-extensions/coding-standards/typescript/examples/vitest-setup.ts +198 -198
- package/augment-extensions/coding-standards/typescript/metadata.json +46 -46
- package/augment-extensions/coding-standards/typescript/rules/architecture.md +1096 -1096
- package/augment-extensions/coding-standards/typescript/rules/error-handling.md +1174 -1174
- package/augment-extensions/coding-standards/typescript/rules/modern-features.md +625 -625
- package/augment-extensions/coding-standards/typescript/rules/monorepo.md +745 -745
- package/augment-extensions/coding-standards/typescript/rules/security-performance.md +850 -850
- package/augment-extensions/coding-standards/typescript/rules/testing.md +918 -918
- package/augment-extensions/coding-standards/typescript/rules/tooling.md +1071 -1071
- package/augment-extensions/coding-standards/typescript/rules/type-patterns.md +750 -750
- package/augment-extensions/domain-rules/api-design/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/database/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/dracula/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/monokai/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/nord/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/one-dark/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/one-light/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/mcp/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/security/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/seo-sales-marketing/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/software-architecture/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/wordpress/CHANGELOG.md +50 -50
- package/augment-extensions/domain-rules/wordpress-plugin/CHANGELOG.md +50 -50
- package/augment-extensions/examples/design-patterns/CHANGELOG.md +50 -50
- package/augment-extensions/examples/gutenberg-block-plugin/CHANGELOG.md +50 -50
- package/augment-extensions/examples/rest-api-plugin/CHANGELOG.md +50 -50
- package/augment-extensions/examples/woocommerce-extension/CHANGELOG.md +50 -50
- package/augment-extensions/workflows/adr-support/CHANGELOG.md +50 -50
- package/augment-extensions/workflows/database/CHANGELOG.md +50 -50
- package/augment-extensions/workflows/wordpress-plugin/CHANGELOG.md +50 -50
- package/cli/AGENTS.md +21 -21
- package/cli/dist/analysis/ast-parser.d.ts +11 -31
- package/cli/dist/analysis/ast-parser.d.ts.map +1 -1
- package/cli/dist/analysis/ast-parser.js +28 -77
- package/cli/dist/analysis/ast-parser.js.map +1 -1
- package/cli/dist/analysis/complexity-analyzer.d.ts +4 -22
- package/cli/dist/analysis/complexity-analyzer.d.ts.map +1 -1
- package/cli/dist/analysis/complexity-analyzer.js +68 -96
- package/cli/dist/analysis/complexity-analyzer.js.map +1 -1
- package/cli/dist/analysis/dependency-analyzer.d.ts +1 -15
- package/cli/dist/analysis/dependency-analyzer.d.ts.map +1 -1
- package/cli/dist/analysis/dependency-analyzer.js +163 -116
- package/cli/dist/analysis/dependency-analyzer.js.map +1 -1
- package/cli/dist/analysis/security-scanner.d.ts +0 -5
- package/cli/dist/analysis/security-scanner.d.ts.map +1 -1
- package/cli/dist/analysis/security-scanner.js +88 -180
- package/cli/dist/analysis/security-scanner.js.map +1 -1
- package/cli/dist/analysis/types.d.ts +1 -40
- package/cli/dist/analysis/types.d.ts.map +1 -1
- package/cli/dist/cli.js +18 -39
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/code-analysis.d.ts +0 -5
- package/cli/dist/commands/code-analysis.d.ts.map +1 -1
- package/cli/dist/commands/code-analysis.js +114 -133
- package/cli/dist/commands/code-analysis.js.map +1 -1
- package/cli/dist/commands/gui.d.ts +4 -0
- package/cli/dist/commands/gui.d.ts.map +1 -1
- package/cli/dist/commands/gui.js +45 -6
- package/cli/dist/commands/gui.js.map +1 -1
- package/cli/dist/commands/link.d.ts.map +1 -1
- package/cli/dist/commands/link.js +2 -2
- package/cli/dist/commands/link.js.map +1 -1
- package/cli/dist/commands/search.d.ts.map +1 -1
- package/cli/dist/commands/search.js +20 -79
- package/cli/dist/commands/search.js.map +1 -1
- package/cli/dist/commands/show.js +8 -32
- package/cli/dist/commands/show.js.map +1 -1
- package/cli/dist/commands/unlink.d.ts.map +1 -1
- package/cli/dist/commands/unlink.js +5 -4
- package/cli/dist/commands/unlink.js.map +1 -1
- package/cli/dist/commands/update.d.ts.map +1 -1
- package/cli/dist/commands/update.js +6 -2
- package/cli/dist/commands/update.js.map +1 -1
- package/cli/dist/commands/upgrade.d.ts +0 -8
- package/cli/dist/commands/upgrade.d.ts.map +1 -1
- package/cli/dist/commands/upgrade.js +16 -34
- package/cli/dist/commands/upgrade.js.map +1 -1
- package/cli/dist/commands/use.d.ts +0 -8
- package/cli/dist/commands/use.d.ts.map +1 -1
- package/cli/dist/commands/use.js +22 -46
- package/cli/dist/commands/use.js.map +1 -1
- package/cli/dist/commands/version-info.d.ts +0 -8
- package/cli/dist/commands/version-info.d.ts.map +1 -1
- package/cli/dist/commands/version-info.js +13 -37
- package/cli/dist/commands/version-info.js.map +1 -1
- package/cli/dist/core/module-loader.d.ts +3 -43
- package/cli/dist/core/module-loader.d.ts.map +1 -1
- package/cli/dist/core/module-loader.js +8 -55
- package/cli/dist/core/module-loader.js.map +1 -1
- package/cli/dist/index.d.ts +0 -4
- package/cli/dist/index.d.ts.map +1 -1
- package/cli/dist/index.js +0 -5
- package/cli/dist/index.js.map +1 -1
- package/cli/dist/utils/ai-prompts.js +124 -124
- package/cli/dist/utils/config-loader.d.ts +3 -39
- package/cli/dist/utils/config-loader.d.ts.map +1 -1
- package/cli/dist/utils/config-loader.js +20 -64
- package/cli/dist/utils/config-loader.js.map +1 -1
- package/cli/dist/utils/extractCommandHelp.d.ts +10 -1
- package/cli/dist/utils/extractCommandHelp.d.ts.map +1 -1
- package/cli/dist/utils/extractCommandHelp.js +83 -15
- package/cli/dist/utils/extractCommandHelp.js.map +1 -1
- package/cli/dist/utils/module-system.d.ts.map +1 -1
- package/cli/dist/utils/module-system.js +10 -4
- package/cli/dist/utils/module-system.js.map +1 -1
- package/package.json +137 -136
- package/augment-extensions/workflows/beads/CHANGELOG.md +0 -51
- package/augment-extensions/workflows/beads/README.md +0 -135
- package/augment-extensions/workflows/beads/examples/complete-workflow-example.md +0 -278
- package/augment-extensions/workflows/beads/metadata.json +0 -23
- package/augment-extensions/workflows/beads/module.json +0 -55
- package/augment-extensions/workflows/beads/rules/best-practices.md +0 -398
- package/augment-extensions/workflows/beads/rules/file-format.md +0 -327
- package/augment-extensions/workflows/beads/rules/manual-setup.md +0 -315
- package/augment-extensions/workflows/beads/rules/workflow.md +0 -326
- package/augment-extensions/workflows/beads-integration/CHANGELOG.md +0 -51
- package/augment-extensions/workflows/beads-integration/IMPLEMENTATION-STATUS.md +0 -145
- package/augment-extensions/workflows/beads-integration/README.md +0 -143
- package/augment-extensions/workflows/beads-integration/config/defaults.json +0 -32
- package/augment-extensions/workflows/beads-integration/config/schema.json +0 -140
- package/augment-extensions/workflows/beads-integration/examples/basic-task-generation.md +0 -293
- package/augment-extensions/workflows/beads-integration/metadata.json +0 -30
- package/augment-extensions/workflows/beads-integration/module.json +0 -75
- package/augment-extensions/workflows/beads-integration/rules/core-rules.md +0 -219
- package/augment-extensions/workflows/beads-integration/rules/effectiveness-standards.md +0 -256
- package/augment-extensions/workflows/beads-integration/rules/task-generation.md +0 -607
- package/augment-extensions/writing-standards/literature/shakespeare/ANNOUNCEMENT.md +0 -176
- package/augment-extensions/writing-standards/literature/shakespeare/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/literature/shakespeare/CHARACTER-THEME-VALIDATION-REPORT.md +0 -465
- package/augment-extensions/writing-standards/literature/shakespeare/DRAMA-VALIDATION-REPORT.md +0 -217
- package/augment-extensions/writing-standards/literature/shakespeare/LANGUAGE-VALIDATION-REPORT.md +0 -195
- package/augment-extensions/writing-standards/literature/shakespeare/PHASE6-VALIDATION-REPORT.md +0 -359
- package/augment-extensions/writing-standards/literature/shakespeare/README.md +0 -126
- package/augment-extensions/writing-standards/literature/shakespeare/examples/annotated-sonnets/sonnet-130.md +0 -225
- package/augment-extensions/writing-standards/literature/shakespeare/examples/annotated-sonnets/sonnet-18.md +0 -188
- package/augment-extensions/writing-standards/literature/shakespeare/examples/annotated-sonnets/sonnet-73.md +0 -215
- package/augment-extensions/writing-standards/literature/shakespeare/examples/exercises/character-worksheet.md +0 -407
- package/augment-extensions/writing-standards/literature/shakespeare/examples/exercises/iambic-pentameter-practice.md +0 -470
- package/augment-extensions/writing-standards/literature/shakespeare/examples/exercises/sonnet-writing-exercise.md +0 -360
- package/augment-extensions/writing-standards/literature/shakespeare/examples/exercises/theme-analysis-template.md +0 -527
- package/augment-extensions/writing-standards/literature/shakespeare/examples/exercises/verse-analysis-exercise.md +0 -426
- package/augment-extensions/writing-standards/literature/shakespeare/examples/scene-examples/hamlet-to-be-or-not-to-be.md +0 -316
- package/augment-extensions/writing-standards/literature/shakespeare/examples/scene-examples/king-lear-storm-scene.md +0 -576
- package/augment-extensions/writing-standards/literature/shakespeare/examples/scene-examples/macbeth-tomorrow-and-tomorrow.md +0 -448
- package/augment-extensions/writing-standards/literature/shakespeare/examples/scene-examples/much-ado-benedick-eavesdropping.md +0 -496
- package/augment-extensions/writing-standards/literature/shakespeare/examples/scene-examples/romeo-juliet-balcony.md +0 -287
- package/augment-extensions/writing-standards/literature/shakespeare/examples/scene-examples/twelfth-night-malvolio-letter.md +0 -653
- package/augment-extensions/writing-standards/literature/shakespeare/metadata.json +0 -60
- package/augment-extensions/writing-standards/literature/shakespeare/module.json +0 -72
- package/augment-extensions/writing-standards/literature/shakespeare/rules/character-themes/character-development.md +0 -608
- package/augment-extensions/writing-standards/literature/shakespeare/rules/character-themes/thematic-elements.md +0 -471
- package/augment-extensions/writing-standards/literature/shakespeare/rules/drama/comedy.md +0 -763
- package/augment-extensions/writing-standards/literature/shakespeare/rules/drama/history-plays.md +0 -507
- package/augment-extensions/writing-standards/literature/shakespeare/rules/drama/scene-construction.md +0 -870
- package/augment-extensions/writing-standards/literature/shakespeare/rules/drama/tragedy.md +0 -743
- package/augment-extensions/writing-standards/literature/shakespeare/rules/language/elizabethan-english.md +0 -400
- package/augment-extensions/writing-standards/literature/shakespeare/rules/language/rhetoric-wordplay.md +0 -602
- package/augment-extensions/writing-standards/literature/shakespeare/rules/language/vocabulary-guide.md +0 -662
- package/augment-extensions/writing-standards/literature/shakespeare/rules/poetry/iambic-pentameter.md +0 -447
- package/augment-extensions/writing-standards/literature/shakespeare/rules/poetry/narrative-poetry.md +0 -453
- package/augment-extensions/writing-standards/literature/shakespeare/rules/poetry/sonnets.md +0 -435
- package/augment-extensions/writing-standards/literature/shakespeare/rules/poetry/verse-forms.md +0 -565
- package/augment-extensions/writing-standards/screenplay/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/README.md +0 -392
- package/augment-extensions/writing-standards/screenplay/_templates/README.md +0 -121
- package/augment-extensions/writing-standards/screenplay/_templates/genre-template.md +0 -153
- package/augment-extensions/writing-standards/screenplay/_templates/style-template.md +0 -243
- package/augment-extensions/writing-standards/screenplay/_templates/theme-template.md +0 -213
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/MIGRATION.md +0 -213
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/README.md +0 -309
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/REFACTORING-SUMMARY.md +0 -99
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/module.json +0 -33
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/monty-python/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/monty-python/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/monty-python/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/monty-python/rules/monty-python.md +0 -243
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/saturday-night-live/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/saturday-night-live/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/saturday-night-live/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/comedy-formats/saturday-night-live/rules/saturday-night-live.md +0 -153
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/README.md +0 -127
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/alfred-hitchcock/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/alfred-hitchcock/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/alfred-hitchcock/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/alfred-hitchcock/rules/alfred-hitchcock.md +0 -168
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/ari-aster/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/ari-aster/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/ari-aster/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/ari-aster/rules/ari-aster.md +0 -414
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brad-bird/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brad-bird/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brad-bird/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brad-bird/rules/brad-bird.md +0 -362
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brian-de-palma/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brian-de-palma/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brian-de-palma/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/brian-de-palma/rules/brian-de-palma.md +0 -445
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/buster-keaton/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/buster-keaton/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/buster-keaton/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/buster-keaton/rules/buster-keaton.md +0 -508
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/christopher-nolan/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/christopher-nolan/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/christopher-nolan/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/christopher-nolan/rules/christopher-nolan.md +0 -147
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/clint-eastwood/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/clint-eastwood/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/clint-eastwood/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/clint-eastwood/rules/clint-eastwood.md +0 -639
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/coen-brothers/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/coen-brothers/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/coen-brothers/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/coen-brothers/rules/coen-brothers.md +0 -167
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/darren-aronofsky/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/darren-aronofsky/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/darren-aronofsky/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/darren-aronofsky/rules/darren-aronofsky.md +0 -474
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-fincher/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-fincher/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-fincher/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-fincher/rules/david-fincher.md +0 -203
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-lynch/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-lynch/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-lynch/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/david-lynch/rules/david-lynch.md +0 -136
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/denis-villeneuve/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/denis-villeneuve/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/denis-villeneuve/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/denis-villeneuve/rules/denis-villeneuve.md +0 -131
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/francis-ford-coppola/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/francis-ford-coppola/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/francis-ford-coppola/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/francis-ford-coppola/rules/francis-ford-coppola.md +0 -190
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gary-marshall/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gary-marshall/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gary-marshall/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gary-marshall/rules/gary-marshall.md +0 -181
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-a-romero/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-a-romero/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-a-romero/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-a-romero/rules/george-a-romero.md +0 -391
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-lucas/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-lucas/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-lucas/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/george-lucas/rules/george-lucas.md +0 -129
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/guillermo-del-toro/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/guillermo-del-toro/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/guillermo-del-toro/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/guillermo-del-toro/rules/guillermo-del-toro.md +0 -350
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gus-van-sant/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gus-van-sant/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gus-van-sant/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/gus-van-sant/rules/gus-van-sant.md +0 -353
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/james-ivory-ismail-merchant/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/james-ivory-ismail-merchant/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/james-ivory-ismail-merchant/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/james-ivory-ismail-merchant/rules/james-ivory-ismail-merchant.md +0 -164
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jim-jarmusch/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jim-jarmusch/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jim-jarmusch/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jim-jarmusch/rules/jim-jarmusch.md +0 -426
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-carpenter/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-carpenter/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-carpenter/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-carpenter/rules/john-carpenter.md +0 -450
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-ford/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-ford/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-ford/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-ford/rules/john-ford.md +0 -429
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-huston/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-huston/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-huston/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-huston/rules/john-huston.md +0 -357
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-landis/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-landis/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-landis/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/john-landis/rules/john-landis.md +0 -483
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jonathan-demme/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jonathan-demme/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jonathan-demme/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/jonathan-demme/rules/jonathan-demme.md +0 -394
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/joseph-l-mankiewicz/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/joseph-l-mankiewicz/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/joseph-l-mankiewicz/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/joseph-l-mankiewicz/rules/joseph-l-mankiewicz.md +0 -406
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kathryn-bigelow/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kathryn-bigelow/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kathryn-bigelow/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kathryn-bigelow/rules/kathryn-bigelow.md +0 -443
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kelly-reichardt/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kelly-reichardt/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kelly-reichardt/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kelly-reichardt/rules/kelly-reichardt.md +0 -365
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kevin-smith/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kevin-smith/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kevin-smith/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/kevin-smith/rules/kevin-smith.md +0 -546
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/linda-shayne/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/linda-shayne/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/linda-shayne/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/linda-shayne/rules/linda-shayne.md +0 -341
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/martin-scorsese/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/martin-scorsese/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/martin-scorsese/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/martin-scorsese/rules/martin-scorsese.md +0 -188
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mel-brooks/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mel-brooks/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mel-brooks/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mel-brooks/rules/mel-brooks.md +0 -215
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/metadata.json +0 -25
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-curtiz/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-curtiz/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-curtiz/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-curtiz/rules/michael-curtiz.md +0 -429
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-mann/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-mann/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-mann/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/michael-mann/rules/michael-mann.md +0 -416
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mike-nichols/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mike-nichols/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mike-nichols/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/mike-nichols/rules/mike-nichols.md +0 -383
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/module.json +0 -410
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/orson-welles/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/orson-welles/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/orson-welles/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/orson-welles/rules/orson-welles.md +0 -400
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/park-chan-wook/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/park-chan-wook/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/park-chan-wook/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/park-chan-wook/rules/park-chan-wook.md +0 -357
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/paul-thomas-anderson/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/paul-thomas-anderson/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/paul-thomas-anderson/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/paul-thomas-anderson/rules/paul-thomas-anderson.md +0 -143
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/penny-marshall/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/penny-marshall/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/penny-marshall/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/penny-marshall/rules/penny-marshall.md +0 -139
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/peter-bogdanovich/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/peter-bogdanovich/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/peter-bogdanovich/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/peter-bogdanovich/rules/peter-bogdanovich.md +0 -411
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/quentin-tarantino/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/quentin-tarantino/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/quentin-tarantino/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/quentin-tarantino/rules/quentin-tarantino.md +0 -178
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/richard-linklater/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/richard-linklater/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/richard-linklater/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/richard-linklater/rules/richard-linklater.md +0 -463
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/rob-reiner/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/rob-reiner/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/rob-reiner/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/rob-reiner/rules/rob-reiner.md +0 -470
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-altman/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-altman/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-altman/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-altman/rules/robert-altman.md +0 -447
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-eggers/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-eggers/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-eggers/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-eggers/rules/robert-eggers.md +0 -361
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-zemeckis/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-zemeckis/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-zemeckis/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/robert-zemeckis/rules/robert-zemeckis.md +0 -489
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sam-peckinpah/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sam-peckinpah/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sam-peckinpah/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sam-peckinpah/rules/sam-peckinpah.md +0 -475
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sidney-lumet/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sidney-lumet/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sidney-lumet/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sidney-lumet/rules/sidney-lumet.md +0 -387
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/spike-lee/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/spike-lee/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/spike-lee/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/spike-lee/rules/spike-lee.md +0 -500
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-donen-gene-kelly/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-donen-gene-kelly/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-donen-gene-kelly/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-donen-gene-kelly/rules/stanley-donen-gene-kelly.md +0 -406
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-kubrick/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-kubrick/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-kubrick/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/stanley-kubrick/rules/stanley-kubrick.md +0 -183
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steve-martin/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steve-martin/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steve-martin/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steve-martin/rules/steve-martin.md +0 -138
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steven-spielberg/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steven-spielberg/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steven-spielberg/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/steven-spielberg/rules/steven-spielberg.md +0 -179
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sydney-pollack/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sydney-pollack/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sydney-pollack/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/sydney-pollack/rules/sydney-pollack.md +0 -356
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/terry-gilliam/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/terry-gilliam/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/terry-gilliam/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/terry-gilliam/rules/terry-gilliam.md +0 -546
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tim-burton/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tim-burton/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tim-burton/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tim-burton/rules/tim-burton.md +0 -356
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tobe-hooper/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tobe-hooper/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tobe-hooper/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/tobe-hooper/rules/tobe-hooper.md +0 -596
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/wes-anderson/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/wes-anderson/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/wes-anderson/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/wes-anderson/rules/wes-anderson.md +0 -146
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/william-friedkin/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/william-friedkin/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/william-friedkin/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/directors/william-friedkin/rules/william-friedkin.md +0 -378
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/examples/style-applications.md +0 -740
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/blue-ruin/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/blue-ruin/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/blue-ruin/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/blue-ruin/rules/blue-ruin.md +0 -721
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/module.json +0 -27
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/films/rules/blue-ruin.md.bak +0 -667
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/fast-and-furious/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/fast-and-furious/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/fast-and-furious/module.json +0 -17
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/fast-and-furious/rules/the-fast-and-furious-saga.md +0 -427
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/harry-potter/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/harry-potter/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/harry-potter/module.json +0 -17
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/harry-potter/rules/harry-potter.md +0 -170
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/james-bond/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/james-bond/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/james-bond/module.json +0 -17
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/james-bond/rules/james-bond.md +0 -440
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/john-wick/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/john-wick/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/john-wick/module.json +0 -17
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/john-wick/rules/john-wick.md +0 -375
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/lord-of-the-rings/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/lord-of-the-rings/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/lord-of-the-rings/module.json +0 -17
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/lord-of-the-rings/rules/lord-of-the-rings.md +0 -437
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/mcu/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/mcu/metadata.json +0 -25
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/mcu/module.json +0 -29
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/mcu/rules/mcu-avengers.md +0 -985
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/mcu/rules/mcu-avengers.md.bak +0 -933
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/metadata.json +0 -25
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/module.json +0 -93
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/metadata.json +0 -33
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/module.json +0 -46
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek-deep-space-nine.md +0 -146
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek-enterprise.md +0 -149
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek-strange-new-world.md +0 -156
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek-the-next-generation.md +0 -163
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek-tos.md +0 -148
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek-voyager.md +0 -148
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-trek/rules/star-trek.md +0 -163
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-wars/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-wars/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-wars/module.json +0 -17
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/franchises/star-wars/rules/star-wars.md +0 -213
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/metadata.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/module.json +0 -128
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/joseph-campbell/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/joseph-campbell/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/joseph-campbell/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/joseph-campbell/rules/joseph-campbell.md +0 -178
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/narrative-theory/module.json +0 -27
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/bruckheimer-and-simpson/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/bruckheimer-and-simpson/metadata.json +0 -24
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/bruckheimer-and-simpson/module.json +0 -50
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/bruckheimer-and-simpson/rules/bruckheimer-and-simpson.md +0 -376
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/metadata.json +0 -23
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/producers/module.json +0 -26
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/blue-ruin.md +0 -667
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/christopher-nolan.md +0 -126
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/coen-brothers.md +0 -154
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/david-lynch.md +0 -124
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/denis-villeneuve.md +0 -119
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/francis-ford-coppola.md +0 -176
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/george-lucas.md +0 -116
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/joseph-campbell.md +0 -167
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/martin-scorsese.md +0 -174
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/mcu-avengers.md +0 -933
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/monty-python.md +0 -231
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/quentin-tarantino.md +0 -167
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/saturday-night-live.md +0 -141
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/stanley-kubrick.md +0 -169
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/star-wars.md +0 -200
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/steven-spielberg.md +0 -165
- package/augment-extensions/writing-standards/screenplay/cinematic-styles/rules/wes-anderson.md +0 -134
- package/augment-extensions/writing-standards/screenplay/commercials/CHARACTER-COUNT-TRACKING.md +0 -226
- package/augment-extensions/writing-standards/screenplay/commercials/CONFIGURATION.md +0 -327
- package/augment-extensions/writing-standards/screenplay/commercials/README.md +0 -223
- package/augment-extensions/writing-standards/screenplay/commercials/REFACTORING-SUMMARY.md +0 -193
- package/augment-extensions/writing-standards/screenplay/commercials/REFERENCES.md +0 -157
- package/augment-extensions/writing-standards/screenplay/commercials/VALIDATION-REPORT.md +0 -109
- package/augment-extensions/writing-standards/screenplay/commercials/examples/.gitkeep +0 -0
- package/augment-extensions/writing-standards/screenplay/commercials/module.json +0 -111
- package/augment-extensions/writing-standards/screenplay/commercials/rules/.gitkeep +0 -0
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercial-audience.md +0 -343
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercial-formats.md +0 -396
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercial-persuasion.md +0 -387
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercial-scripts.md +0 -531
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercial-techniques.md +0 -912
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercial-types.md +0 -700
- package/augment-extensions/writing-standards/screenplay/commercials/rules/commercials.md +0 -285
- package/augment-extensions/writing-standards/screenplay/commercials/scripts/validate-character-count.ts +0 -284
- package/augment-extensions/writing-standards/screenplay/examples/aaa-hollywood-scene.fountain +0 -164
- package/augment-extensions/writing-standards/screenplay/examples/beat-sheet-example.yaml +0 -95
- package/augment-extensions/writing-standards/screenplay/examples/character-profile-example.yaml +0 -116
- package/augment-extensions/writing-standards/screenplay/examples/commercial-30sec.fountain +0 -151
- package/augment-extensions/writing-standards/screenplay/examples/independent-monologue.fountain +0 -67
- package/augment-extensions/writing-standards/screenplay/examples/news-segment.fountain +0 -142
- package/augment-extensions/writing-standards/screenplay/examples/plot-outline-example.yaml +0 -184
- package/augment-extensions/writing-standards/screenplay/examples/tv-episode-teaser.fountain +0 -204
- package/augment-extensions/writing-standards/screenplay/genres/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/genres/README.md +0 -181
- package/augment-extensions/writing-standards/screenplay/genres/examples/.gitkeep +0 -2
- package/augment-extensions/writing-standards/screenplay/genres/metadata.json +0 -43
- package/augment-extensions/writing-standards/screenplay/genres/module.json +0 -70
- package/augment-extensions/writing-standards/screenplay/genres/rules/.gitkeep +0 -2
- package/augment-extensions/writing-standards/screenplay/genres/rules/action.md +0 -399
- package/augment-extensions/writing-standards/screenplay/genres/rules/adventure.md +0 -407
- package/augment-extensions/writing-standards/screenplay/genres/rules/animation.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/biographical.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/comedy.md +0 -401
- package/augment-extensions/writing-standards/screenplay/genres/rules/documentary.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/drama.md +0 -409
- package/augment-extensions/writing-standards/screenplay/genres/rules/fantasy.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/historical.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/horror.md +0 -268
- package/augment-extensions/writing-standards/screenplay/genres/rules/musical.md +0 -294
- package/augment-extensions/writing-standards/screenplay/genres/rules/mystery.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/noir.md +0 -294
- package/augment-extensions/writing-standards/screenplay/genres/rules/romance.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/sci-fi.md +0 -289
- package/augment-extensions/writing-standards/screenplay/genres/rules/superhero.md +0 -293
- package/augment-extensions/writing-standards/screenplay/genres/rules/thriller.md +0 -294
- package/augment-extensions/writing-standards/screenplay/genres/rules/western.md +0 -293
- package/augment-extensions/writing-standards/screenplay/metadata.json +0 -65
- package/augment-extensions/writing-standards/screenplay/module.json +0 -171
- package/augment-extensions/writing-standards/screenplay/rules/aaa-hollywood-films.md +0 -339
- package/augment-extensions/writing-standards/screenplay/rules/ai-integration-testing.md +0 -329
- package/augment-extensions/writing-standards/screenplay/rules/character-development.md +0 -169
- package/augment-extensions/writing-standards/screenplay/rules/commercials.md +0 -437
- package/augment-extensions/writing-standards/screenplay/rules/dialogue-writing.md +0 -263
- package/augment-extensions/writing-standards/screenplay/rules/diversity-inclusion.md +0 -261
- package/augment-extensions/writing-standards/screenplay/rules/examples-guide.md +0 -315
- package/augment-extensions/writing-standards/screenplay/rules/file-organization.md +0 -213
- package/augment-extensions/writing-standards/screenplay/rules/formatting-validation.md +0 -413
- package/augment-extensions/writing-standards/screenplay/rules/fountain-format.md +0 -372
- package/augment-extensions/writing-standards/screenplay/rules/independent-films.md +0 -374
- package/augment-extensions/writing-standards/screenplay/rules/live-tv-productions.md +0 -443
- package/augment-extensions/writing-standards/screenplay/rules/narrative-structures.md +0 -207
- package/augment-extensions/writing-standards/screenplay/rules/news-broadcasts.md +0 -444
- package/augment-extensions/writing-standards/screenplay/rules/pacing-timing.md +0 -331
- package/augment-extensions/writing-standards/screenplay/rules/quality-review-checklist.md +0 -334
- package/augment-extensions/writing-standards/screenplay/rules/quick-reference.md +0 -299
- package/augment-extensions/writing-standards/screenplay/rules/screen-continuity.md +0 -263
- package/augment-extensions/writing-standards/screenplay/rules/streaming-content.md +0 -412
- package/augment-extensions/writing-standards/screenplay/rules/trope-management.md +0 -370
- package/augment-extensions/writing-standards/screenplay/rules/tv-series.md +0 -374
- package/augment-extensions/writing-standards/screenplay/rules/universal-formatting.md +0 -339
- package/augment-extensions/writing-standards/screenplay/rules/vscode-integration.md +0 -277
- package/augment-extensions/writing-standards/screenplay/rules/web-content.md +0 -393
- package/augment-extensions/writing-standards/screenplay/schemas/beat-sheet.json +0 -332
- package/augment-extensions/writing-standards/screenplay/schemas/character-profile.json +0 -247
- package/augment-extensions/writing-standards/screenplay/schemas/feature-selection.json +0 -200
- package/augment-extensions/writing-standards/screenplay/schemas/plot-outline.json +0 -233
- package/augment-extensions/writing-standards/screenplay/schemas/screenplay-config.json +0 -245
- package/augment-extensions/writing-standards/screenplay/schemas/trope-inventory.json +0 -221
- package/augment-extensions/writing-standards/screenplay/styles/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/styles/README.md +0 -159
- package/augment-extensions/writing-standards/screenplay/styles/examples/.gitkeep +0 -2
- package/augment-extensions/writing-standards/screenplay/styles/examples/style-applications.md +0 -1449
- package/augment-extensions/writing-standards/screenplay/styles/metadata.json +0 -38
- package/augment-extensions/writing-standards/screenplay/styles/module.json +0 -64
- package/augment-extensions/writing-standards/screenplay/styles/rules/.gitkeep +0 -2
- package/augment-extensions/writing-standards/screenplay/styles/rules/dialogue-centric.md +0 -520
- package/augment-extensions/writing-standards/screenplay/styles/rules/ensemble.md +0 -499
- package/augment-extensions/writing-standards/screenplay/styles/rules/epic.md +0 -497
- package/augment-extensions/writing-standards/screenplay/styles/rules/experimental.md +0 -492
- package/augment-extensions/writing-standards/screenplay/styles/rules/flashback.md +0 -509
- package/augment-extensions/writing-standards/screenplay/styles/rules/linear.md +0 -490
- package/augment-extensions/writing-standards/screenplay/styles/rules/minimalist.md +0 -499
- package/augment-extensions/writing-standards/screenplay/styles/rules/non-linear.md +0 -501
- package/augment-extensions/writing-standards/screenplay/styles/rules/poetic.md +0 -499
- package/augment-extensions/writing-standards/screenplay/styles/rules/realistic.md +0 -498
- package/augment-extensions/writing-standards/screenplay/styles/rules/satirical.md +0 -499
- package/augment-extensions/writing-standards/screenplay/styles/rules/surreal.md +0 -508
- package/augment-extensions/writing-standards/screenplay/styles/rules/voice-over.md +0 -500
- package/augment-extensions/writing-standards/screenplay/themes/CHANGELOG.md +0 -51
- package/augment-extensions/writing-standards/screenplay/themes/README.md +0 -158
- package/augment-extensions/writing-standards/screenplay/themes/examples/.gitkeep +0 -2
- package/augment-extensions/writing-standards/screenplay/themes/examples/common-mistakes-and-fixes.md +0 -643
- package/augment-extensions/writing-standards/screenplay/themes/examples/complete-scene-example.md +0 -311
- package/augment-extensions/writing-standards/screenplay/themes/examples/individual-theme-examples.md +0 -562
- package/augment-extensions/writing-standards/screenplay/themes/examples/multi-theme-weaving.md +0 -538
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-application-guide.md +0 -432
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-integration-across-acts.md +0 -637
- package/augment-extensions/writing-standards/screenplay/themes/metadata.json +0 -47
- package/augment-extensions/writing-standards/screenplay/themes/module.json +0 -66
- package/augment-extensions/writing-standards/screenplay/themes/rules/.gitkeep +0 -2
- package/augment-extensions/writing-standards/screenplay/themes/rules/ambition.md +0 -458
- package/augment-extensions/writing-standards/screenplay/themes/rules/betrayal.md +0 -490
- package/augment-extensions/writing-standards/screenplay/themes/rules/environment.md +0 -458
- package/augment-extensions/writing-standards/screenplay/themes/rules/fate.md +0 -459
- package/augment-extensions/writing-standards/screenplay/themes/rules/friendship.md +0 -491
- package/augment-extensions/writing-standards/screenplay/themes/rules/growth.md +0 -491
- package/augment-extensions/writing-standards/screenplay/themes/rules/identity.md +0 -490
- package/augment-extensions/writing-standards/screenplay/themes/rules/isolation.md +0 -464
- package/augment-extensions/writing-standards/screenplay/themes/rules/justice.md +0 -461
- package/augment-extensions/writing-standards/screenplay/themes/rules/love.md +0 -489
- package/augment-extensions/writing-standards/screenplay/themes/rules/power.md +0 -494
- package/augment-extensions/writing-standards/screenplay/themes/rules/redemption.md +0 -483
- package/augment-extensions/writing-standards/screenplay/themes/rules/revenge.md +0 -489
- package/augment-extensions/writing-standards/screenplay/themes/rules/survival.md +0 -496
- package/augment-extensions/writing-standards/screenplay/themes/rules/technology.md +0 -463
- package/augment-extensions/writing-standards/screenplay/utils/__tests__/file-organization.test.ts +0 -169
- package/augment-extensions/writing-standards/screenplay/utils/file-organization.ts +0 -165
- package/cli/dist/__test_health-checker.d.ts +0 -2
- package/cli/dist/__test_health-checker.d.ts.map +0 -1
- package/cli/dist/__test_health-checker.js +0 -4
- package/cli/dist/__test_health-checker.js.map +0 -1
- package/cli/dist/__test_hook-system.d.ts +0 -2
- package/cli/dist/__test_hook-system.d.ts.map +0 -1
- package/cli/dist/__test_hook-system.js +0 -4
- package/cli/dist/__test_hook-system.js.map +0 -1
- package/cli/dist/__test_rule-install-hooks.d.ts +0 -2
- package/cli/dist/__test_rule-install-hooks.d.ts.map +0 -1
- package/cli/dist/__test_rule-install-hooks.js +0 -4
- package/cli/dist/__test_rule-install-hooks.js.map +0 -1
- package/cli/dist/__test_template-engine.d.ts +0 -2
- package/cli/dist/__test_template-engine.d.ts.map +0 -1
- package/cli/dist/__test_template-engine.js +0 -4
- package/cli/dist/__test_template-engine.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/error-detector.d.ts +0 -92
- package/cli/dist/commands/generate-shot-list/error-detector.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/error-detector.js +0 -131
- package/cli/dist/commands/generate-shot-list/error-detector.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/error-recovery.d.ts +0 -85
- package/cli/dist/commands/generate-shot-list/error-recovery.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/error-recovery.js +0 -208
- package/cli/dist/commands/generate-shot-list/error-recovery.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/errors.d.ts +0 -52
- package/cli/dist/commands/generate-shot-list/errors.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/errors.js +0 -287
- package/cli/dist/commands/generate-shot-list/errors.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/exit-codes.d.ts +0 -42
- package/cli/dist/commands/generate-shot-list/exit-codes.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/exit-codes.js +0 -83
- package/cli/dist/commands/generate-shot-list/exit-codes.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/base-formatter.d.ts +0 -48
- package/cli/dist/commands/generate-shot-list/formatter/base-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/base-formatter.js +0 -115
- package/cli/dist/commands/generate-shot-list/formatter/base-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/csv-formatter.d.ts +0 -45
- package/cli/dist/commands/generate-shot-list/formatter/csv-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/csv-formatter.js +0 -110
- package/cli/dist/commands/generate-shot-list/formatter/csv-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/html-formatter.d.ts +0 -38
- package/cli/dist/commands/generate-shot-list/formatter/html-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/html-formatter.js +0 -82
- package/cli/dist/commands/generate-shot-list/formatter/html-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/html-template.d.ts +0 -11
- package/cli/dist/commands/generate-shot-list/formatter/html-template.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/html-template.js +0 -628
- package/cli/dist/commands/generate-shot-list/formatter/html-template.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/index.d.ts +0 -13
- package/cli/dist/commands/generate-shot-list/formatter/index.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/index.js +0 -41
- package/cli/dist/commands/generate-shot-list/formatter/index.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.d.ts +0 -35
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.js +0 -134
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.d.ts +0 -38
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.js +0 -111
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.d.ts +0 -53
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.js +0 -302
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/txt-formatter.d.ts +0 -37
- package/cli/dist/commands/generate-shot-list/formatter/txt-formatter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/txt-formatter.js +0 -125
- package/cli/dist/commands/generate-shot-list/formatter/txt-formatter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/types.d.ts +0 -75
- package/cli/dist/commands/generate-shot-list/formatter/types.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/formatter/types.js +0 -8
- package/cli/dist/commands/generate-shot-list/formatter/types.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/ai-blocking-extractor.d.ts +0 -58
- package/cli/dist/commands/generate-shot-list/generator/ai-blocking-extractor.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/ai-blocking-extractor.js +0 -275
- package/cli/dist/commands/generate-shot-list/generator/ai-blocking-extractor.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/ai-entity-extractor.d.ts +0 -41
- package/cli/dist/commands/generate-shot-list/generator/ai-entity-extractor.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/ai-entity-extractor.js +0 -155
- package/cli/dist/commands/generate-shot-list/generator/ai-entity-extractor.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/context-builder.d.ts +0 -166
- package/cli/dist/commands/generate-shot-list/generator/context-builder.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/context-builder.js +0 -965
- package/cli/dist/commands/generate-shot-list/generator/context-builder.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/index.d.ts +0 -163
- package/cli/dist/commands/generate-shot-list/generator/index.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/index.js +0 -909
- package/cli/dist/commands/generate-shot-list/generator/index.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.d.ts +0 -46
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.js +0 -171
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/scene-segmenter.d.ts +0 -49
- package/cli/dist/commands/generate-shot-list/generator/scene-segmenter.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/scene-segmenter.js +0 -130
- package/cli/dist/commands/generate-shot-list/generator/scene-segmenter.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/types.d.ts +0 -135
- package/cli/dist/commands/generate-shot-list/generator/types.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/types.js +0 -8
- package/cli/dist/commands/generate-shot-list/generator/types.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/validator.d.ts +0 -73
- package/cli/dist/commands/generate-shot-list/generator/validator.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/generator/validator.js +0 -284
- package/cli/dist/commands/generate-shot-list/generator/validator.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/help-text.d.ts +0 -11
- package/cli/dist/commands/generate-shot-list/help-text.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/help-text.js +0 -214
- package/cli/dist/commands/generate-shot-list/help-text.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/index.d.ts +0 -25
- package/cli/dist/commands/generate-shot-list/logger/index.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/index.js +0 -98
- package/cli/dist/commands/generate-shot-list/logger/index.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/jsonl-writer.d.ts +0 -53
- package/cli/dist/commands/generate-shot-list/logger/jsonl-writer.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/jsonl-writer.js +0 -183
- package/cli/dist/commands/generate-shot-list/logger/jsonl-writer.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/shot-list-logger.d.ts +0 -43
- package/cli/dist/commands/generate-shot-list/logger/shot-list-logger.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/shot-list-logger.js +0 -142
- package/cli/dist/commands/generate-shot-list/logger/shot-list-logger.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/types.d.ts +0 -145
- package/cli/dist/commands/generate-shot-list/logger/types.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/logger/types.js +0 -8
- package/cli/dist/commands/generate-shot-list/logger/types.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/docx-parser.d.ts +0 -29
- package/cli/dist/commands/generate-shot-list/parser/docx-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/docx-parser.js +0 -111
- package/cli/dist/commands/generate-shot-list/parser/docx-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/finaldraft-parser.d.ts +0 -18
- package/cli/dist/commands/generate-shot-list/parser/finaldraft-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/finaldraft-parser.js +0 -184
- package/cli/dist/commands/generate-shot-list/parser/finaldraft-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/fountain-parser.d.ts +0 -33
- package/cli/dist/commands/generate-shot-list/parser/fountain-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/fountain-parser.js +0 -250
- package/cli/dist/commands/generate-shot-list/parser/fountain-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/index.d.ts +0 -25
- package/cli/dist/commands/generate-shot-list/parser/index.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/index.js +0 -168
- package/cli/dist/commands/generate-shot-list/parser/index.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/markdown-parser.d.ts +0 -21
- package/cli/dist/commands/generate-shot-list/parser/markdown-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/markdown-parser.js +0 -197
- package/cli/dist/commands/generate-shot-list/parser/markdown-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/pdf-parser.d.ts +0 -24
- package/cli/dist/commands/generate-shot-list/parser/pdf-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/pdf-parser.js +0 -84
- package/cli/dist/commands/generate-shot-list/parser/pdf-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/plaintext-parser.d.ts +0 -29
- package/cli/dist/commands/generate-shot-list/parser/plaintext-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/plaintext-parser.js +0 -213
- package/cli/dist/commands/generate-shot-list/parser/plaintext-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/rtf-parser.d.ts +0 -28
- package/cli/dist/commands/generate-shot-list/parser/rtf-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/rtf-parser.js +0 -143
- package/cli/dist/commands/generate-shot-list/parser/rtf-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/types.d.ts +0 -136
- package/cli/dist/commands/generate-shot-list/parser/types.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/parser/types.js +0 -22
- package/cli/dist/commands/generate-shot-list/parser/types.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/schema/shot-list.schema.json +0 -341
- package/cli/dist/commands/generate-shot-list/schema/validator.d.ts +0 -55
- package/cli/dist/commands/generate-shot-list/schema/validator.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/schema/validator.js +0 -180
- package/cli/dist/commands/generate-shot-list/schema/validator.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/guideline-parser.d.ts +0 -36
- package/cli/dist/commands/generate-shot-list/style/guideline-parser.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/guideline-parser.js +0 -108
- package/cli/dist/commands/generate-shot-list/style/guideline-parser.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/index.d.ts +0 -39
- package/cli/dist/commands/generate-shot-list/style/index.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/index.js +0 -85
- package/cli/dist/commands/generate-shot-list/style/index.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/style-loader.d.ts +0 -35
- package/cli/dist/commands/generate-shot-list/style/style-loader.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/style-loader.js +0 -178
- package/cli/dist/commands/generate-shot-list/style/style-loader.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/style-merger.d.ts +0 -36
- package/cli/dist/commands/generate-shot-list/style/style-merger.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/style-merger.js +0 -123
- package/cli/dist/commands/generate-shot-list/style/style-merger.js.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/types.d.ts +0 -105
- package/cli/dist/commands/generate-shot-list/style/types.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list/style/types.js +0 -8
- package/cli/dist/commands/generate-shot-list/style/types.js.map +0 -1
- package/cli/dist/commands/generate-shot-list.d.ts +0 -15
- package/cli/dist/commands/generate-shot-list.d.ts.map +0 -1
- package/cli/dist/commands/generate-shot-list.js +0 -288
- package/cli/dist/commands/generate-shot-list.js.map +0 -1
- package/cli/dist/gui/app.d.ts +0 -17
- package/cli/dist/gui/app.d.ts.map +0 -1
- package/cli/dist/gui/app.js +0 -79
- package/cli/dist/gui/app.js.map +0 -1
- package/cli/dist/gui/components/preview-pane.d.ts +0 -40
- package/cli/dist/gui/components/preview-pane.d.ts.map +0 -1
- package/cli/dist/gui/components/preview-pane.js +0 -90
- package/cli/dist/gui/components/preview-pane.js.map +0 -1
- package/cli/dist/gui/components/search-filter.d.ts +0 -26
- package/cli/dist/gui/components/search-filter.d.ts.map +0 -1
- package/cli/dist/gui/components/search-filter.js +0 -168
- package/cli/dist/gui/components/search-filter.js.map +0 -1
- package/cli/dist/gui/components/status-bar.d.ts +0 -22
- package/cli/dist/gui/components/status-bar.d.ts.map +0 -1
- package/cli/dist/gui/components/status-bar.js +0 -58
- package/cli/dist/gui/components/status-bar.js.map +0 -1
- package/cli/dist/gui/components/tree-navigator.d.ts +0 -30
- package/cli/dist/gui/components/tree-navigator.d.ts.map +0 -1
- package/cli/dist/gui/components/tree-navigator.js +0 -133
- package/cli/dist/gui/components/tree-navigator.js.map +0 -1
- package/cli/dist/gui/components/version-selector.d.ts +0 -27
- package/cli/dist/gui/components/version-selector.d.ts.map +0 -1
- package/cli/dist/gui/components/version-selector.js +0 -110
- package/cli/dist/gui/components/version-selector.js.map +0 -1
- package/cli/dist/gui/hooks/use-version-loader.d.ts +0 -25
- package/cli/dist/gui/hooks/use-version-loader.d.ts.map +0 -1
- package/cli/dist/gui/hooks/use-version-loader.js +0 -116
- package/cli/dist/gui/hooks/use-version-loader.js.map +0 -1
- package/cli/dist/gui/index.d.ts +0 -15
- package/cli/dist/gui/index.d.ts.map +0 -1
- package/cli/dist/gui/index.js +0 -39
- package/cli/dist/gui/index.js.map +0 -1
- package/cli/dist/gui/layouts/main-layout.d.ts +0 -14
- package/cli/dist/gui/layouts/main-layout.d.ts.map +0 -1
- package/cli/dist/gui/layouts/main-layout.js +0 -205
- package/cli/dist/gui/layouts/main-layout.js.map +0 -1
- package/cli/dist/gui/state/navigation-state.d.ts +0 -39
- package/cli/dist/gui/state/navigation-state.d.ts.map +0 -1
- package/cli/dist/gui/state/navigation-state.js +0 -151
- package/cli/dist/gui/state/navigation-state.js.map +0 -1
- package/cli/dist/gui/state/selection-state.d.ts +0 -36
- package/cli/dist/gui/state/selection-state.d.ts.map +0 -1
- package/cli/dist/gui/state/selection-state.js +0 -132
- package/cli/dist/gui/state/selection-state.js.map +0 -1
- package/cli/dist/gui/theme.d.ts +0 -50
- package/cli/dist/gui/theme.d.ts.map +0 -1
- package/cli/dist/gui/theme.js +0 -73
- package/cli/dist/gui/theme.js.map +0 -1
- package/cli/dist/parsers/php-parser.d.ts +0 -127
- package/cli/dist/parsers/php-parser.d.ts.map +0 -1
- package/cli/dist/parsers/php-parser.js +0 -290
- package/cli/dist/parsers/php-parser.js.map +0 -1
- package/cli/dist/utils/help.d.ts +0 -13
- package/cli/dist/utils/help.d.ts.map +0 -1
- package/cli/dist/utils/help.js +0 -137
- package/cli/dist/utils/help.js.map +0 -1
- package/cli/dist/webview/inspection-webview-provider.d.ts +0 -49
- package/cli/dist/webview/inspection-webview-provider.d.ts.map +0 -1
- package/cli/dist/webview/inspection-webview-provider.js +0 -386
- package/cli/dist/webview/inspection-webview-provider.js.map +0 -1
|
@@ -1,850 +1,850 @@
|
|
|
1
|
-
# Security and Performance Best Practices
|
|
2
|
-
|
|
3
|
-
Comprehensive guide to security and performance optimization in TypeScript applications.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
- [Security Headers in Next.js](#security-headers-in-nextjs)
|
|
7
|
-
- [Type-Safe Runtime Validation](#type-safe-runtime-validation)
|
|
8
|
-
- [Memoization Patterns](#memoization-patterns)
|
|
9
|
-
- [Bundle Analysis](#bundle-analysis)
|
|
10
|
-
- [Tree-Shaking Optimization](#tree-shaking-optimization)
|
|
11
|
-
- [Performance Monitoring](#performance-monitoring)
|
|
12
|
-
- [Best Practices](#best-practices)
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Security Headers in Next.js
|
|
17
|
-
|
|
18
|
-
### Overview
|
|
19
|
-
|
|
20
|
-
Security headers protect your application from common web vulnerabilities like XSS, clickjacking, and MIME sniffing.
|
|
21
|
-
|
|
22
|
-
### Configuration
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
// next.config.js
|
|
26
|
-
const securityHeaders = [
|
|
27
|
-
{
|
|
28
|
-
key: 'X-DNS-Prefetch-Control',
|
|
29
|
-
value: 'on'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
key: 'Strict-Transport-Security',
|
|
33
|
-
value: 'max-age=63072000; includeSubDomains; preload'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
key: 'X-Frame-Options',
|
|
37
|
-
value: 'SAMEORIGIN'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
key: 'X-Content-Type-Options',
|
|
41
|
-
value: 'nosniff'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
key: 'X-XSS-Protection',
|
|
45
|
-
value: '1; mode=block'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
key: 'Referrer-Policy',
|
|
49
|
-
value: 'origin-when-cross-origin'
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
key: 'Permissions-Policy',
|
|
53
|
-
value: 'camera=(), microphone=(), geolocation=()'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
key: 'Content-Security-Policy',
|
|
57
|
-
value: [
|
|
58
|
-
"default-src 'self'",
|
|
59
|
-
"script-src 'self' 'unsafe-eval' 'unsafe-inline'",
|
|
60
|
-
"style-src 'self' 'unsafe-inline'",
|
|
61
|
-
"img-src 'self' data: https:",
|
|
62
|
-
"font-src 'self' data:",
|
|
63
|
-
"connect-src 'self' https:",
|
|
64
|
-
"frame-ancestors 'none'"
|
|
65
|
-
].join('; ')
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
module.exports = {
|
|
70
|
-
async headers() {
|
|
71
|
-
return [
|
|
72
|
-
{
|
|
73
|
-
source: '/:path*',
|
|
74
|
-
headers: securityHeaders
|
|
75
|
-
}
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Content Security Policy (CSP)
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
// lib/csp.ts
|
|
85
|
-
export const generateCSP = () => {
|
|
86
|
-
const nonce = Buffer.from(crypto.randomUUID()).toString('base64');
|
|
87
|
-
|
|
88
|
-
const csp = [
|
|
89
|
-
`default-src 'self'`,
|
|
90
|
-
`script-src 'self' 'nonce-${nonce}' 'strict-dynamic'`,
|
|
91
|
-
`style-src 'self' 'unsafe-inline'`,
|
|
92
|
-
`img-src 'self' data: https:`,
|
|
93
|
-
`font-src 'self' data:`,
|
|
94
|
-
`connect-src 'self' https:`,
|
|
95
|
-
`frame-ancestors 'none'`,
|
|
96
|
-
`base-uri 'self'`,
|
|
97
|
-
`form-action 'self'`
|
|
98
|
-
].join('; ');
|
|
99
|
-
|
|
100
|
-
return { csp, nonce };
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// middleware.ts
|
|
104
|
-
import { NextResponse } from 'next/server';
|
|
105
|
-
import type { NextRequest } from 'next/server';
|
|
106
|
-
import { generateCSP } from './lib/csp';
|
|
107
|
-
|
|
108
|
-
export function middleware(request: NextRequest) {
|
|
109
|
-
const { csp, nonce } = generateCSP();
|
|
110
|
-
|
|
111
|
-
const response = NextResponse.next();
|
|
112
|
-
response.headers.set('Content-Security-Policy', csp);
|
|
113
|
-
response.headers.set('X-Nonce', nonce);
|
|
114
|
-
|
|
115
|
-
return response;
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Environment Variables Security
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
// lib/env.ts
|
|
123
|
-
import { z } from 'zod';
|
|
124
|
-
|
|
125
|
-
const envSchema = z.object({
|
|
126
|
-
// Public variables (exposed to client)
|
|
127
|
-
NEXT_PUBLIC_API_URL: z.string().url(),
|
|
128
|
-
NEXT_PUBLIC_APP_NAME: z.string(),
|
|
129
|
-
|
|
130
|
-
// Private variables (server-only)
|
|
131
|
-
DATABASE_URL: z.string().url(),
|
|
132
|
-
API_SECRET_KEY: z.string().min(32),
|
|
133
|
-
JWT_SECRET: z.string().min(32),
|
|
134
|
-
|
|
135
|
-
// Optional with defaults
|
|
136
|
-
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
137
|
-
PORT: z.coerce.number().default(3000)
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
export const env = envSchema.parse(process.env);
|
|
141
|
-
|
|
142
|
-
// Type-safe environment variables
|
|
143
|
-
export type Env = z.infer<typeof envSchema>;
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Sanitizing User Input
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
import DOMPurify from 'isomorphic-dompurify';
|
|
150
|
-
|
|
151
|
-
// Sanitize HTML content
|
|
152
|
-
export function sanitizeHTML(dirty: string): string {
|
|
153
|
-
return DOMPurify.sanitize(dirty, {
|
|
154
|
-
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'a', 'p'],
|
|
155
|
-
ALLOWED_ATTR: ['href']
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Usage in component
|
|
160
|
-
function UserContent({ content }: { content: string }) {
|
|
161
|
-
const clean = sanitizeHTML(content);
|
|
162
|
-
return <div dangerouslySetInnerHTML={{ __html: clean }} />;
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Type-Safe Runtime Validation
|
|
169
|
-
|
|
170
|
-
### Using Zod
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
import { z } from 'zod';
|
|
174
|
-
|
|
175
|
-
// Define schema
|
|
176
|
-
const userSchema = z.object({
|
|
177
|
-
id: z.number().positive(),
|
|
178
|
-
name: z.string().min(1).max(100),
|
|
179
|
-
email: z.string().email(),
|
|
180
|
-
age: z.number().min(18).max(120).optional(),
|
|
181
|
-
role: z.enum(['admin', 'user', 'guest']),
|
|
182
|
-
createdAt: z.coerce.date()
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// Infer TypeScript type from schema
|
|
186
|
-
type User = z.infer<typeof userSchema>;
|
|
187
|
-
|
|
188
|
-
// Validate data
|
|
189
|
-
function validateUser(data: unknown): User {
|
|
190
|
-
return userSchema.parse(data); // Throws on invalid data
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Safe validation
|
|
194
|
-
function safeValidateUser(data: unknown): User | null {
|
|
195
|
-
const result = userSchema.safeParse(data);
|
|
196
|
-
return result.success ? result.data : null;
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### API Route Validation
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
// app/api/users/route.ts
|
|
204
|
-
import { z } from 'zod';
|
|
205
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
206
|
-
|
|
207
|
-
const createUserSchema = z.object({
|
|
208
|
-
name: z.string().min(1).max(100),
|
|
209
|
-
email: z.string().email(),
|
|
210
|
-
password: z.string().min(8).max(100)
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
export async function POST(request: NextRequest) {
|
|
214
|
-
try {
|
|
215
|
-
const body = await request.json();
|
|
216
|
-
const validatedData = createUserSchema.parse(body);
|
|
217
|
-
|
|
218
|
-
// Create user with validated data
|
|
219
|
-
const user = await createUser(validatedData);
|
|
220
|
-
|
|
221
|
-
return NextResponse.json(user, { status: 201 });
|
|
222
|
-
} catch (error) {
|
|
223
|
-
if (error instanceof z.ZodError) {
|
|
224
|
-
return NextResponse.json(
|
|
225
|
-
{ errors: error.errors },
|
|
226
|
-
{ status: 400 }
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
return NextResponse.json(
|
|
230
|
-
{ error: 'Internal server error' },
|
|
231
|
-
{ status: 500 }
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Form Validation with React Hook Form
|
|
238
|
-
|
|
239
|
-
```typescript
|
|
240
|
-
import { useForm } from 'react-hook-form';
|
|
241
|
-
import { zodResolver } from '@hookform/resolvers/zod';
|
|
242
|
-
import { z } from 'zod';
|
|
243
|
-
|
|
244
|
-
const formSchema = z.object({
|
|
245
|
-
name: z.string().min(1, 'Name is required'),
|
|
246
|
-
email: z.string().email('Invalid email address'),
|
|
247
|
-
age: z.coerce.number().min(18, 'Must be 18 or older')
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
type FormData = z.infer<typeof formSchema>;
|
|
251
|
-
|
|
252
|
-
function UserForm() {
|
|
253
|
-
const {
|
|
254
|
-
register,
|
|
255
|
-
handleSubmit,
|
|
256
|
-
formState: { errors }
|
|
257
|
-
} = useForm<FormData>({
|
|
258
|
-
resolver: zodResolver(formSchema)
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
const onSubmit = (data: FormData) => {
|
|
262
|
-
// Data is type-safe and validated
|
|
263
|
-
console.log(data);
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<form onSubmit={handleSubmit(onSubmit)}>
|
|
268
|
-
<input {...register('name')} />
|
|
269
|
-
{errors.name && <span>{errors.name.message}</span>}
|
|
270
|
-
|
|
271
|
-
<input {...register('email')} />
|
|
272
|
-
{errors.email && <span>{errors.email.message}</span>}
|
|
273
|
-
|
|
274
|
-
<input {...register('age')} type="number" />
|
|
275
|
-
{errors.age && <span>{errors.age.message}</span>}
|
|
276
|
-
|
|
277
|
-
<button type="submit">Submit</button>
|
|
278
|
-
</form>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## Memoization Patterns
|
|
286
|
-
|
|
287
|
-
### React.memo
|
|
288
|
-
|
|
289
|
-
```typescript
|
|
290
|
-
import { memo } from 'react';
|
|
291
|
-
|
|
292
|
-
interface UserCardProps {
|
|
293
|
-
user: {
|
|
294
|
-
id: number;
|
|
295
|
-
name: string;
|
|
296
|
-
email: string;
|
|
297
|
-
};
|
|
298
|
-
onDelete: (id: number) => void;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Memoize component to prevent unnecessary re-renders
|
|
302
|
-
export const UserCard = memo(function UserCard({ user, onDelete }: UserCardProps) {
|
|
303
|
-
return (
|
|
304
|
-
<div>
|
|
305
|
-
<h3>{user.name}</h3>
|
|
306
|
-
<p>{user.email}</p>
|
|
307
|
-
<button onClick={() => onDelete(user.id)}>Delete</button>
|
|
308
|
-
</div>
|
|
309
|
-
);
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
// Custom comparison function
|
|
313
|
-
export const UserCardWithCustomCompare = memo(
|
|
314
|
-
UserCard,
|
|
315
|
-
(prevProps, nextProps) => {
|
|
316
|
-
return prevProps.user.id === nextProps.user.id &&
|
|
317
|
-
prevProps.user.name === nextProps.user.name;
|
|
318
|
-
}
|
|
319
|
-
);
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### useMemo
|
|
323
|
-
|
|
324
|
-
```typescript
|
|
325
|
-
import { useMemo } from 'react';
|
|
326
|
-
|
|
327
|
-
function ExpensiveComponent({ items }: { items: Item[] }) {
|
|
328
|
-
// Memoize expensive computation
|
|
329
|
-
const sortedItems = useMemo(() => {
|
|
330
|
-
console.log('Sorting items...');
|
|
331
|
-
return items.sort((a, b) => a.name.localeCompare(b.name));
|
|
332
|
-
}, [items]);
|
|
333
|
-
|
|
334
|
-
// Memoize filtered data
|
|
335
|
-
const activeItems = useMemo(() => {
|
|
336
|
-
return sortedItems.filter((item) => item.active);
|
|
337
|
-
}, [sortedItems]);
|
|
338
|
-
|
|
339
|
-
return (
|
|
340
|
-
<ul>
|
|
341
|
-
{activeItems.map((item) => (
|
|
342
|
-
<li key={item.id}>{item.name}</li>
|
|
343
|
-
))}
|
|
344
|
-
</ul>
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### useCallback
|
|
350
|
-
|
|
351
|
-
```typescript
|
|
352
|
-
import { useCallback, useState } from 'react';
|
|
353
|
-
|
|
354
|
-
function ParentComponent() {
|
|
355
|
-
const [count, setCount] = useState(0);
|
|
356
|
-
const [items, setItems] = useState<Item[]>([]);
|
|
357
|
-
|
|
358
|
-
// Memoize callback to prevent child re-renders
|
|
359
|
-
const handleDelete = useCallback((id: number) => {
|
|
360
|
-
setItems((prev) => prev.filter((item) => item.id !== id));
|
|
361
|
-
}, []);
|
|
362
|
-
|
|
363
|
-
const handleAdd = useCallback((item: Item) => {
|
|
364
|
-
setItems((prev) => [...prev, item]);
|
|
365
|
-
}, []);
|
|
366
|
-
|
|
367
|
-
return (
|
|
368
|
-
<div>
|
|
369
|
-
<button onClick={() => setCount(count + 1)}>Count: {count}</button>
|
|
370
|
-
<ItemList items={items} onDelete={handleDelete} onAdd={handleAdd} />
|
|
371
|
-
</div>
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Memoization with Lodash
|
|
377
|
-
|
|
378
|
-
```typescript
|
|
379
|
-
import memoize from 'lodash/memoize';
|
|
380
|
-
|
|
381
|
-
// Memoize expensive function
|
|
382
|
-
const fibonacci = memoize((n: number): number => {
|
|
383
|
-
if (n <= 1) return n;
|
|
384
|
-
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
// Memoize with custom resolver
|
|
388
|
-
const getUserById = memoize(
|
|
389
|
-
async (id: number) => {
|
|
390
|
-
const response = await fetch(`/api/users/${id}`);
|
|
391
|
-
return response.json();
|
|
392
|
-
},
|
|
393
|
-
(id) => `user-${id}` // Custom cache key
|
|
394
|
-
);
|
|
395
|
-
|
|
396
|
-
// Clear cache
|
|
397
|
-
getUserById.cache.clear();
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
---
|
|
401
|
-
|
|
402
|
-
## Bundle Analysis
|
|
403
|
-
|
|
404
|
-
### Next.js Bundle Analyzer
|
|
405
|
-
|
|
406
|
-
```bash
|
|
407
|
-
# Install bundle analyzer
|
|
408
|
-
npm install -D @next/bundle-analyzer
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
```typescript
|
|
412
|
-
// next.config.js
|
|
413
|
-
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|
414
|
-
enabled: process.env.ANALYZE === 'true'
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
module.exports = withBundleAnalyzer({
|
|
418
|
-
// Your Next.js config
|
|
419
|
-
});
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
```bash
|
|
423
|
-
# Analyze bundle
|
|
424
|
-
ANALYZE=true npm run build
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Webpack Bundle Analyzer
|
|
428
|
-
|
|
429
|
-
```bash
|
|
430
|
-
npm install -D webpack-bundle-analyzer
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
```typescript
|
|
434
|
-
// webpack.config.js
|
|
435
|
-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
436
|
-
|
|
437
|
-
module.exports = {
|
|
438
|
-
plugins: [
|
|
439
|
-
new BundleAnalyzerPlugin({
|
|
440
|
-
analyzerMode: 'static',
|
|
441
|
-
openAnalyzer: false,
|
|
442
|
-
reportFilename: 'bundle-report.html'
|
|
443
|
-
})
|
|
444
|
-
]
|
|
445
|
-
};
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### Analyzing Bundle Size
|
|
449
|
-
|
|
450
|
-
```typescript
|
|
451
|
-
// package.json
|
|
452
|
-
{
|
|
453
|
-
"scripts": {
|
|
454
|
-
"analyze": "ANALYZE=true next build",
|
|
455
|
-
"analyze:server": "BUNDLE_ANALYZE=server next build",
|
|
456
|
-
"analyze:browser": "BUNDLE_ANALYZE=browser next build"
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
---
|
|
462
|
-
|
|
463
|
-
## Tree-Shaking Optimization
|
|
464
|
-
|
|
465
|
-
### ES Modules
|
|
466
|
-
|
|
467
|
-
```typescript
|
|
468
|
-
// ✅ Good: Named exports (tree-shakeable)
|
|
469
|
-
export const add = (a: number, b: number) => a + b;
|
|
470
|
-
export const subtract = (a: number, b: number) => a - b;
|
|
471
|
-
export const multiply = (a: number, b: number) => a * b;
|
|
472
|
-
|
|
473
|
-
// Import only what you need
|
|
474
|
-
import { add, subtract } from './math';
|
|
475
|
-
|
|
476
|
-
// ❌ Bad: Default export (not tree-shakeable)
|
|
477
|
-
export default {
|
|
478
|
-
add: (a: number, b: number) => a + b,
|
|
479
|
-
subtract: (a: number, b: number) => a - b,
|
|
480
|
-
multiply: (a: number, b: number) => a * b
|
|
481
|
-
};
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
### Side-Effect Free Code
|
|
485
|
-
|
|
486
|
-
```typescript
|
|
487
|
-
// package.json
|
|
488
|
-
{
|
|
489
|
-
"sideEffects": false // Enables aggressive tree-shaking
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// Or specify files with side effects
|
|
493
|
-
{
|
|
494
|
-
"sideEffects": [
|
|
495
|
-
"*.css",
|
|
496
|
-
"*.scss",
|
|
497
|
-
"./src/polyfills.ts"
|
|
498
|
-
]
|
|
499
|
-
}
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
### Dynamic Imports
|
|
503
|
-
|
|
504
|
-
```typescript
|
|
505
|
-
// Code splitting with dynamic imports
|
|
506
|
-
const HeavyComponent = lazy(() => import('./HeavyComponent'));
|
|
507
|
-
|
|
508
|
-
function App() {
|
|
509
|
-
return (
|
|
510
|
-
<Suspense fallback={<Loading />}>
|
|
511
|
-
<HeavyComponent />
|
|
512
|
-
</Suspense>
|
|
513
|
-
);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// Conditional loading
|
|
517
|
-
async function loadAnalytics() {
|
|
518
|
-
if (process.env.NODE_ENV === 'production') {
|
|
519
|
-
const analytics = await import('./analytics');
|
|
520
|
-
analytics.init();
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### Barrel File Optimization
|
|
526
|
-
|
|
527
|
-
```typescript
|
|
528
|
-
// ❌ Bad: Barrel file imports everything
|
|
529
|
-
// utils/index.ts
|
|
530
|
-
export * from './string';
|
|
531
|
-
export * from './number';
|
|
532
|
-
export * from './date';
|
|
533
|
-
|
|
534
|
-
// ✅ Good: Direct imports
|
|
535
|
-
import { capitalize } from './utils/string';
|
|
536
|
-
import { formatNumber } from './utils/number';
|
|
537
|
-
|
|
538
|
-
// Or use named re-exports
|
|
539
|
-
// utils/index.ts
|
|
540
|
-
export { capitalize, lowercase } from './string';
|
|
541
|
-
export { formatNumber, parseNumber } from './number';
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
### Lodash Tree-Shaking
|
|
545
|
-
|
|
546
|
-
```typescript
|
|
547
|
-
// ❌ Bad: Imports entire lodash
|
|
548
|
-
import _ from 'lodash';
|
|
549
|
-
_.debounce(fn, 300);
|
|
550
|
-
|
|
551
|
-
// ✅ Good: Import specific function
|
|
552
|
-
import debounce from 'lodash/debounce';
|
|
553
|
-
debounce(fn, 300);
|
|
554
|
-
|
|
555
|
-
// ✅ Better: Use lodash-es (ES modules)
|
|
556
|
-
import { debounce } from 'lodash-es';
|
|
557
|
-
debounce(fn, 300);
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
### Next.js Optimization
|
|
561
|
-
|
|
562
|
-
```typescript
|
|
563
|
-
// next.config.js
|
|
564
|
-
module.exports = {
|
|
565
|
-
// Enable SWC minification
|
|
566
|
-
swcMinify: true,
|
|
567
|
-
|
|
568
|
-
// Optimize images
|
|
569
|
-
images: {
|
|
570
|
-
formats: ['image/avif', 'image/webp'],
|
|
571
|
-
minimumCacheTTL: 60
|
|
572
|
-
},
|
|
573
|
-
|
|
574
|
-
// Experimental features
|
|
575
|
-
experimental: {
|
|
576
|
-
optimizeCss: true,
|
|
577
|
-
optimizePackageImports: ['@mui/material', 'lodash']
|
|
578
|
-
},
|
|
579
|
-
|
|
580
|
-
// Webpack configuration
|
|
581
|
-
webpack: (config, { isServer }) => {
|
|
582
|
-
if (!isServer) {
|
|
583
|
-
config.optimization.splitChunks = {
|
|
584
|
-
chunks: 'all',
|
|
585
|
-
cacheGroups: {
|
|
586
|
-
default: false,
|
|
587
|
-
vendors: false,
|
|
588
|
-
commons: {
|
|
589
|
-
name: 'commons',
|
|
590
|
-
chunks: 'all',
|
|
591
|
-
minChunks: 2
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
return config;
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
---
|
|
602
|
-
|
|
603
|
-
## Performance Monitoring
|
|
604
|
-
|
|
605
|
-
### Web Vitals
|
|
606
|
-
|
|
607
|
-
```typescript
|
|
608
|
-
// app/layout.tsx
|
|
609
|
-
import { Analytics } from '@vercel/analytics/react';
|
|
610
|
-
import { SpeedInsights } from '@vercel/speed-insights/next';
|
|
611
|
-
|
|
612
|
-
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
613
|
-
return (
|
|
614
|
-
<html lang="en">
|
|
615
|
-
<body>
|
|
616
|
-
{children}
|
|
617
|
-
<Analytics />
|
|
618
|
-
<SpeedInsights />
|
|
619
|
-
</body>
|
|
620
|
-
</html>
|
|
621
|
-
);
|
|
622
|
-
}
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### Custom Performance Tracking
|
|
626
|
-
|
|
627
|
-
```typescript
|
|
628
|
-
// lib/performance.ts
|
|
629
|
-
export function measurePerformance(name: string, fn: () => void) {
|
|
630
|
-
const start = performance.now();
|
|
631
|
-
fn();
|
|
632
|
-
const end = performance.now();
|
|
633
|
-
console.log(`${name} took ${end - start}ms`);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// Usage
|
|
637
|
-
measurePerformance('Data processing', () => {
|
|
638
|
-
processLargeDataset(data);
|
|
639
|
-
});
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
### React Profiler
|
|
643
|
-
|
|
644
|
-
```typescript
|
|
645
|
-
import { Profiler, ProfilerOnRenderCallback } from 'react';
|
|
646
|
-
|
|
647
|
-
const onRenderCallback: ProfilerOnRenderCallback = (
|
|
648
|
-
id,
|
|
649
|
-
phase,
|
|
650
|
-
actualDuration,
|
|
651
|
-
baseDuration,
|
|
652
|
-
startTime,
|
|
653
|
-
commitTime
|
|
654
|
-
) => {
|
|
655
|
-
console.log({
|
|
656
|
-
id,
|
|
657
|
-
phase,
|
|
658
|
-
actualDuration,
|
|
659
|
-
baseDuration,
|
|
660
|
-
startTime,
|
|
661
|
-
commitTime
|
|
662
|
-
});
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
function App() {
|
|
666
|
-
return (
|
|
667
|
-
<Profiler id="App" onRender={onRenderCallback}>
|
|
668
|
-
<YourComponent />
|
|
669
|
-
</Profiler>
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
|
-
```
|
|
673
|
-
|
|
674
|
-
### Lighthouse CI
|
|
675
|
-
|
|
676
|
-
```yaml
|
|
677
|
-
# .github/workflows/lighthouse.yml
|
|
678
|
-
name: Lighthouse CI
|
|
679
|
-
on: [push]
|
|
680
|
-
jobs:
|
|
681
|
-
lighthouse:
|
|
682
|
-
runs-on: ubuntu-latest
|
|
683
|
-
steps:
|
|
684
|
-
- uses: actions/checkout@v3
|
|
685
|
-
- uses: actions/setup-node@v3
|
|
686
|
-
- run: npm ci
|
|
687
|
-
- run: npm run build
|
|
688
|
-
- run: npm install -g @lhci/cli
|
|
689
|
-
- run: lhci autorun
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
```javascript
|
|
693
|
-
// lighthouserc.js
|
|
694
|
-
module.exports = {
|
|
695
|
-
ci: {
|
|
696
|
-
collect: {
|
|
697
|
-
startServerCommand: 'npm run start',
|
|
698
|
-
url: ['http://localhost:3000/'],
|
|
699
|
-
numberOfRuns: 3
|
|
700
|
-
},
|
|
701
|
-
assert: {
|
|
702
|
-
assertions: {
|
|
703
|
-
'categories:performance': ['error', { minScore: 0.9 }],
|
|
704
|
-
'categories:accessibility': ['error', { minScore: 0.9 }],
|
|
705
|
-
'categories:best-practices': ['error', { minScore: 0.9 }],
|
|
706
|
-
'categories:seo': ['error', { minScore: 0.9 }]
|
|
707
|
-
}
|
|
708
|
-
},
|
|
709
|
-
upload: {
|
|
710
|
-
target: 'temporary-public-storage'
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
```
|
|
715
|
-
|
|
716
|
-
---
|
|
717
|
-
|
|
718
|
-
## Best Practices
|
|
719
|
-
|
|
720
|
-
### 1. Always Validate External Data
|
|
721
|
-
|
|
722
|
-
```typescript
|
|
723
|
-
// ✅ Good: Validate API responses
|
|
724
|
-
async function fetchUser(id: number) {
|
|
725
|
-
const response = await fetch(`/api/users/${id}`);
|
|
726
|
-
const data = await response.json();
|
|
727
|
-
return userSchema.parse(data); // Validate with Zod
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
// ❌ Bad: Trust external data
|
|
731
|
-
async function fetchUser(id: number) {
|
|
732
|
-
const response = await fetch(`/api/users/${id}`);
|
|
733
|
-
return response.json(); // No validation
|
|
734
|
-
}
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
### 2. Use Security Headers
|
|
738
|
-
|
|
739
|
-
```typescript
|
|
740
|
-
// ✅ Good: Comprehensive security headers
|
|
741
|
-
const securityHeaders = [
|
|
742
|
-
{ key: 'X-Frame-Options', value: 'SAMEORIGIN' },
|
|
743
|
-
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
|
744
|
-
{ key: 'Strict-Transport-Security', value: 'max-age=63072000' }
|
|
745
|
-
];
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
### 3. Memoize Expensive Computations
|
|
749
|
-
|
|
750
|
-
```typescript
|
|
751
|
-
// ✅ Good: Memoize expensive operations
|
|
752
|
-
const sortedData = useMemo(() => {
|
|
753
|
-
return data.sort((a, b) => a.value - b.value);
|
|
754
|
-
}, [data]);
|
|
755
|
-
|
|
756
|
-
// ❌ Bad: Recompute on every render
|
|
757
|
-
const sortedData = data.sort((a, b) => a.value - b.value);
|
|
758
|
-
```
|
|
759
|
-
|
|
760
|
-
### 4. Use Dynamic Imports for Code Splitting
|
|
761
|
-
|
|
762
|
-
```typescript
|
|
763
|
-
// ✅ Good: Dynamic import
|
|
764
|
-
const Chart = lazy(() => import('./Chart'));
|
|
765
|
-
|
|
766
|
-
// ❌ Bad: Static import for large component
|
|
767
|
-
import Chart from './Chart';
|
|
768
|
-
```
|
|
769
|
-
|
|
770
|
-
### 5. Optimize Bundle Size
|
|
771
|
-
|
|
772
|
-
```typescript
|
|
773
|
-
// ✅ Good: Import specific functions
|
|
774
|
-
import { debounce } from 'lodash-es';
|
|
775
|
-
|
|
776
|
-
// ❌ Bad: Import entire library
|
|
777
|
-
import _ from 'lodash';
|
|
778
|
-
```
|
|
779
|
-
|
|
780
|
-
### 6. Monitor Performance
|
|
781
|
-
|
|
782
|
-
```typescript
|
|
783
|
-
// ✅ Good: Track performance metrics
|
|
784
|
-
export function reportWebVitals(metric: NextWebVitalsMetric) {
|
|
785
|
-
console.log(metric);
|
|
786
|
-
// Send to analytics
|
|
787
|
-
}
|
|
788
|
-
```
|
|
789
|
-
|
|
790
|
-
---
|
|
791
|
-
|
|
792
|
-
## Common Pitfalls
|
|
793
|
-
|
|
794
|
-
### ❌ Trusting User Input
|
|
795
|
-
|
|
796
|
-
```typescript
|
|
797
|
-
// Never trust user input
|
|
798
|
-
function renderHTML(userInput: string) {
|
|
799
|
-
return <div dangerouslySetInnerHTML={{ __html: userInput }} />; // ❌ XSS vulnerability
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
// Always sanitize
|
|
803
|
-
function renderHTML(userInput: string) {
|
|
804
|
-
const clean = DOMPurify.sanitize(userInput);
|
|
805
|
-
return <div dangerouslySetInnerHTML={{ __html: clean }} />; // ✅ Safe
|
|
806
|
-
}
|
|
807
|
-
```
|
|
808
|
-
|
|
809
|
-
### ❌ Over-Memoization
|
|
810
|
-
|
|
811
|
-
```typescript
|
|
812
|
-
// Don't memoize everything
|
|
813
|
-
const value = useMemo(() => x + y, [x, y]); // ❌ Unnecessary for simple operations
|
|
814
|
-
|
|
815
|
-
// Only memoize expensive computations
|
|
816
|
-
const value = x + y; // ✅ Simple operation
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
### ❌ Ignoring Bundle Size
|
|
820
|
-
|
|
821
|
-
```typescript
|
|
822
|
-
// Check bundle size regularly
|
|
823
|
-
npm run analyze
|
|
824
|
-
|
|
825
|
-
// Use bundle size limits
|
|
826
|
-
// package.json
|
|
827
|
-
{
|
|
828
|
-
"bundlesize": [
|
|
829
|
-
{
|
|
830
|
-
"path": "./dist/*.js",
|
|
831
|
-
"maxSize": "100 kB"
|
|
832
|
-
}
|
|
833
|
-
]
|
|
834
|
-
}
|
|
835
|
-
```
|
|
836
|
-
|
|
837
|
-
---
|
|
838
|
-
|
|
839
|
-
## References
|
|
840
|
-
|
|
841
|
-
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
|
842
|
-
- [Next.js Security Headers](https://nextjs.org/docs/advanced-features/security-headers)
|
|
843
|
-
- [Zod Documentation](https://zod.dev)
|
|
844
|
-
- [React Performance Optimization](https://react.dev/learn/render-and-commit)
|
|
845
|
-
- [Web Vitals](https://web.dev/vitals/)
|
|
846
|
-
- [Lighthouse CI](https://github.com/GoogleChrome/lighthouse-ci)
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1
|
+
# Security and Performance Best Practices
|
|
2
|
+
|
|
3
|
+
Comprehensive guide to security and performance optimization in TypeScript applications.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
- [Security Headers in Next.js](#security-headers-in-nextjs)
|
|
7
|
+
- [Type-Safe Runtime Validation](#type-safe-runtime-validation)
|
|
8
|
+
- [Memoization Patterns](#memoization-patterns)
|
|
9
|
+
- [Bundle Analysis](#bundle-analysis)
|
|
10
|
+
- [Tree-Shaking Optimization](#tree-shaking-optimization)
|
|
11
|
+
- [Performance Monitoring](#performance-monitoring)
|
|
12
|
+
- [Best Practices](#best-practices)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Security Headers in Next.js
|
|
17
|
+
|
|
18
|
+
### Overview
|
|
19
|
+
|
|
20
|
+
Security headers protect your application from common web vulnerabilities like XSS, clickjacking, and MIME sniffing.
|
|
21
|
+
|
|
22
|
+
### Configuration
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// next.config.js
|
|
26
|
+
const securityHeaders = [
|
|
27
|
+
{
|
|
28
|
+
key: 'X-DNS-Prefetch-Control',
|
|
29
|
+
value: 'on'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'Strict-Transport-Security',
|
|
33
|
+
value: 'max-age=63072000; includeSubDomains; preload'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: 'X-Frame-Options',
|
|
37
|
+
value: 'SAMEORIGIN'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: 'X-Content-Type-Options',
|
|
41
|
+
value: 'nosniff'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: 'X-XSS-Protection',
|
|
45
|
+
value: '1; mode=block'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: 'Referrer-Policy',
|
|
49
|
+
value: 'origin-when-cross-origin'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: 'Permissions-Policy',
|
|
53
|
+
value: 'camera=(), microphone=(), geolocation=()'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'Content-Security-Policy',
|
|
57
|
+
value: [
|
|
58
|
+
"default-src 'self'",
|
|
59
|
+
"script-src 'self' 'unsafe-eval' 'unsafe-inline'",
|
|
60
|
+
"style-src 'self' 'unsafe-inline'",
|
|
61
|
+
"img-src 'self' data: https:",
|
|
62
|
+
"font-src 'self' data:",
|
|
63
|
+
"connect-src 'self' https:",
|
|
64
|
+
"frame-ancestors 'none'"
|
|
65
|
+
].join('; ')
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
module.exports = {
|
|
70
|
+
async headers() {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
source: '/:path*',
|
|
74
|
+
headers: securityHeaders
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Content Security Policy (CSP)
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// lib/csp.ts
|
|
85
|
+
export const generateCSP = () => {
|
|
86
|
+
const nonce = Buffer.from(crypto.randomUUID()).toString('base64');
|
|
87
|
+
|
|
88
|
+
const csp = [
|
|
89
|
+
`default-src 'self'`,
|
|
90
|
+
`script-src 'self' 'nonce-${nonce}' 'strict-dynamic'`,
|
|
91
|
+
`style-src 'self' 'unsafe-inline'`,
|
|
92
|
+
`img-src 'self' data: https:`,
|
|
93
|
+
`font-src 'self' data:`,
|
|
94
|
+
`connect-src 'self' https:`,
|
|
95
|
+
`frame-ancestors 'none'`,
|
|
96
|
+
`base-uri 'self'`,
|
|
97
|
+
`form-action 'self'`
|
|
98
|
+
].join('; ');
|
|
99
|
+
|
|
100
|
+
return { csp, nonce };
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// middleware.ts
|
|
104
|
+
import { NextResponse } from 'next/server';
|
|
105
|
+
import type { NextRequest } from 'next/server';
|
|
106
|
+
import { generateCSP } from './lib/csp';
|
|
107
|
+
|
|
108
|
+
export function middleware(request: NextRequest) {
|
|
109
|
+
const { csp, nonce } = generateCSP();
|
|
110
|
+
|
|
111
|
+
const response = NextResponse.next();
|
|
112
|
+
response.headers.set('Content-Security-Policy', csp);
|
|
113
|
+
response.headers.set('X-Nonce', nonce);
|
|
114
|
+
|
|
115
|
+
return response;
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Environment Variables Security
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// lib/env.ts
|
|
123
|
+
import { z } from 'zod';
|
|
124
|
+
|
|
125
|
+
const envSchema = z.object({
|
|
126
|
+
// Public variables (exposed to client)
|
|
127
|
+
NEXT_PUBLIC_API_URL: z.string().url(),
|
|
128
|
+
NEXT_PUBLIC_APP_NAME: z.string(),
|
|
129
|
+
|
|
130
|
+
// Private variables (server-only)
|
|
131
|
+
DATABASE_URL: z.string().url(),
|
|
132
|
+
API_SECRET_KEY: z.string().min(32),
|
|
133
|
+
JWT_SECRET: z.string().min(32),
|
|
134
|
+
|
|
135
|
+
// Optional with defaults
|
|
136
|
+
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
137
|
+
PORT: z.coerce.number().default(3000)
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const env = envSchema.parse(process.env);
|
|
141
|
+
|
|
142
|
+
// Type-safe environment variables
|
|
143
|
+
export type Env = z.infer<typeof envSchema>;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Sanitizing User Input
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import DOMPurify from 'isomorphic-dompurify';
|
|
150
|
+
|
|
151
|
+
// Sanitize HTML content
|
|
152
|
+
export function sanitizeHTML(dirty: string): string {
|
|
153
|
+
return DOMPurify.sanitize(dirty, {
|
|
154
|
+
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'a', 'p'],
|
|
155
|
+
ALLOWED_ATTR: ['href']
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Usage in component
|
|
160
|
+
function UserContent({ content }: { content: string }) {
|
|
161
|
+
const clean = sanitizeHTML(content);
|
|
162
|
+
return <div dangerouslySetInnerHTML={{ __html: clean }} />;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Type-Safe Runtime Validation
|
|
169
|
+
|
|
170
|
+
### Using Zod
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { z } from 'zod';
|
|
174
|
+
|
|
175
|
+
// Define schema
|
|
176
|
+
const userSchema = z.object({
|
|
177
|
+
id: z.number().positive(),
|
|
178
|
+
name: z.string().min(1).max(100),
|
|
179
|
+
email: z.string().email(),
|
|
180
|
+
age: z.number().min(18).max(120).optional(),
|
|
181
|
+
role: z.enum(['admin', 'user', 'guest']),
|
|
182
|
+
createdAt: z.coerce.date()
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Infer TypeScript type from schema
|
|
186
|
+
type User = z.infer<typeof userSchema>;
|
|
187
|
+
|
|
188
|
+
// Validate data
|
|
189
|
+
function validateUser(data: unknown): User {
|
|
190
|
+
return userSchema.parse(data); // Throws on invalid data
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Safe validation
|
|
194
|
+
function safeValidateUser(data: unknown): User | null {
|
|
195
|
+
const result = userSchema.safeParse(data);
|
|
196
|
+
return result.success ? result.data : null;
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### API Route Validation
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
// app/api/users/route.ts
|
|
204
|
+
import { z } from 'zod';
|
|
205
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
206
|
+
|
|
207
|
+
const createUserSchema = z.object({
|
|
208
|
+
name: z.string().min(1).max(100),
|
|
209
|
+
email: z.string().email(),
|
|
210
|
+
password: z.string().min(8).max(100)
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export async function POST(request: NextRequest) {
|
|
214
|
+
try {
|
|
215
|
+
const body = await request.json();
|
|
216
|
+
const validatedData = createUserSchema.parse(body);
|
|
217
|
+
|
|
218
|
+
// Create user with validated data
|
|
219
|
+
const user = await createUser(validatedData);
|
|
220
|
+
|
|
221
|
+
return NextResponse.json(user, { status: 201 });
|
|
222
|
+
} catch (error) {
|
|
223
|
+
if (error instanceof z.ZodError) {
|
|
224
|
+
return NextResponse.json(
|
|
225
|
+
{ errors: error.errors },
|
|
226
|
+
{ status: 400 }
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
return NextResponse.json(
|
|
230
|
+
{ error: 'Internal server error' },
|
|
231
|
+
{ status: 500 }
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Form Validation with React Hook Form
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
import { useForm } from 'react-hook-form';
|
|
241
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
242
|
+
import { z } from 'zod';
|
|
243
|
+
|
|
244
|
+
const formSchema = z.object({
|
|
245
|
+
name: z.string().min(1, 'Name is required'),
|
|
246
|
+
email: z.string().email('Invalid email address'),
|
|
247
|
+
age: z.coerce.number().min(18, 'Must be 18 or older')
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
type FormData = z.infer<typeof formSchema>;
|
|
251
|
+
|
|
252
|
+
function UserForm() {
|
|
253
|
+
const {
|
|
254
|
+
register,
|
|
255
|
+
handleSubmit,
|
|
256
|
+
formState: { errors }
|
|
257
|
+
} = useForm<FormData>({
|
|
258
|
+
resolver: zodResolver(formSchema)
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const onSubmit = (data: FormData) => {
|
|
262
|
+
// Data is type-safe and validated
|
|
263
|
+
console.log(data);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
268
|
+
<input {...register('name')} />
|
|
269
|
+
{errors.name && <span>{errors.name.message}</span>}
|
|
270
|
+
|
|
271
|
+
<input {...register('email')} />
|
|
272
|
+
{errors.email && <span>{errors.email.message}</span>}
|
|
273
|
+
|
|
274
|
+
<input {...register('age')} type="number" />
|
|
275
|
+
{errors.age && <span>{errors.age.message}</span>}
|
|
276
|
+
|
|
277
|
+
<button type="submit">Submit</button>
|
|
278
|
+
</form>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Memoization Patterns
|
|
286
|
+
|
|
287
|
+
### React.memo
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { memo } from 'react';
|
|
291
|
+
|
|
292
|
+
interface UserCardProps {
|
|
293
|
+
user: {
|
|
294
|
+
id: number;
|
|
295
|
+
name: string;
|
|
296
|
+
email: string;
|
|
297
|
+
};
|
|
298
|
+
onDelete: (id: number) => void;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Memoize component to prevent unnecessary re-renders
|
|
302
|
+
export const UserCard = memo(function UserCard({ user, onDelete }: UserCardProps) {
|
|
303
|
+
return (
|
|
304
|
+
<div>
|
|
305
|
+
<h3>{user.name}</h3>
|
|
306
|
+
<p>{user.email}</p>
|
|
307
|
+
<button onClick={() => onDelete(user.id)}>Delete</button>
|
|
308
|
+
</div>
|
|
309
|
+
);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// Custom comparison function
|
|
313
|
+
export const UserCardWithCustomCompare = memo(
|
|
314
|
+
UserCard,
|
|
315
|
+
(prevProps, nextProps) => {
|
|
316
|
+
return prevProps.user.id === nextProps.user.id &&
|
|
317
|
+
prevProps.user.name === nextProps.user.name;
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### useMemo
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
import { useMemo } from 'react';
|
|
326
|
+
|
|
327
|
+
function ExpensiveComponent({ items }: { items: Item[] }) {
|
|
328
|
+
// Memoize expensive computation
|
|
329
|
+
const sortedItems = useMemo(() => {
|
|
330
|
+
console.log('Sorting items...');
|
|
331
|
+
return items.sort((a, b) => a.name.localeCompare(b.name));
|
|
332
|
+
}, [items]);
|
|
333
|
+
|
|
334
|
+
// Memoize filtered data
|
|
335
|
+
const activeItems = useMemo(() => {
|
|
336
|
+
return sortedItems.filter((item) => item.active);
|
|
337
|
+
}, [sortedItems]);
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<ul>
|
|
341
|
+
{activeItems.map((item) => (
|
|
342
|
+
<li key={item.id}>{item.name}</li>
|
|
343
|
+
))}
|
|
344
|
+
</ul>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### useCallback
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
import { useCallback, useState } from 'react';
|
|
353
|
+
|
|
354
|
+
function ParentComponent() {
|
|
355
|
+
const [count, setCount] = useState(0);
|
|
356
|
+
const [items, setItems] = useState<Item[]>([]);
|
|
357
|
+
|
|
358
|
+
// Memoize callback to prevent child re-renders
|
|
359
|
+
const handleDelete = useCallback((id: number) => {
|
|
360
|
+
setItems((prev) => prev.filter((item) => item.id !== id));
|
|
361
|
+
}, []);
|
|
362
|
+
|
|
363
|
+
const handleAdd = useCallback((item: Item) => {
|
|
364
|
+
setItems((prev) => [...prev, item]);
|
|
365
|
+
}, []);
|
|
366
|
+
|
|
367
|
+
return (
|
|
368
|
+
<div>
|
|
369
|
+
<button onClick={() => setCount(count + 1)}>Count: {count}</button>
|
|
370
|
+
<ItemList items={items} onDelete={handleDelete} onAdd={handleAdd} />
|
|
371
|
+
</div>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Memoization with Lodash
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
import memoize from 'lodash/memoize';
|
|
380
|
+
|
|
381
|
+
// Memoize expensive function
|
|
382
|
+
const fibonacci = memoize((n: number): number => {
|
|
383
|
+
if (n <= 1) return n;
|
|
384
|
+
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Memoize with custom resolver
|
|
388
|
+
const getUserById = memoize(
|
|
389
|
+
async (id: number) => {
|
|
390
|
+
const response = await fetch(`/api/users/${id}`);
|
|
391
|
+
return response.json();
|
|
392
|
+
},
|
|
393
|
+
(id) => `user-${id}` // Custom cache key
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
// Clear cache
|
|
397
|
+
getUserById.cache.clear();
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Bundle Analysis
|
|
403
|
+
|
|
404
|
+
### Next.js Bundle Analyzer
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
# Install bundle analyzer
|
|
408
|
+
npm install -D @next/bundle-analyzer
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
// next.config.js
|
|
413
|
+
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|
414
|
+
enabled: process.env.ANALYZE === 'true'
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
module.exports = withBundleAnalyzer({
|
|
418
|
+
// Your Next.js config
|
|
419
|
+
});
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# Analyze bundle
|
|
424
|
+
ANALYZE=true npm run build
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Webpack Bundle Analyzer
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
npm install -D webpack-bundle-analyzer
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
// webpack.config.js
|
|
435
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
436
|
+
|
|
437
|
+
module.exports = {
|
|
438
|
+
plugins: [
|
|
439
|
+
new BundleAnalyzerPlugin({
|
|
440
|
+
analyzerMode: 'static',
|
|
441
|
+
openAnalyzer: false,
|
|
442
|
+
reportFilename: 'bundle-report.html'
|
|
443
|
+
})
|
|
444
|
+
]
|
|
445
|
+
};
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Analyzing Bundle Size
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
// package.json
|
|
452
|
+
{
|
|
453
|
+
"scripts": {
|
|
454
|
+
"analyze": "ANALYZE=true next build",
|
|
455
|
+
"analyze:server": "BUNDLE_ANALYZE=server next build",
|
|
456
|
+
"analyze:browser": "BUNDLE_ANALYZE=browser next build"
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Tree-Shaking Optimization
|
|
464
|
+
|
|
465
|
+
### ES Modules
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
// ✅ Good: Named exports (tree-shakeable)
|
|
469
|
+
export const add = (a: number, b: number) => a + b;
|
|
470
|
+
export const subtract = (a: number, b: number) => a - b;
|
|
471
|
+
export const multiply = (a: number, b: number) => a * b;
|
|
472
|
+
|
|
473
|
+
// Import only what you need
|
|
474
|
+
import { add, subtract } from './math';
|
|
475
|
+
|
|
476
|
+
// ❌ Bad: Default export (not tree-shakeable)
|
|
477
|
+
export default {
|
|
478
|
+
add: (a: number, b: number) => a + b,
|
|
479
|
+
subtract: (a: number, b: number) => a - b,
|
|
480
|
+
multiply: (a: number, b: number) => a * b
|
|
481
|
+
};
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Side-Effect Free Code
|
|
485
|
+
|
|
486
|
+
```typescript
|
|
487
|
+
// package.json
|
|
488
|
+
{
|
|
489
|
+
"sideEffects": false // Enables aggressive tree-shaking
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// Or specify files with side effects
|
|
493
|
+
{
|
|
494
|
+
"sideEffects": [
|
|
495
|
+
"*.css",
|
|
496
|
+
"*.scss",
|
|
497
|
+
"./src/polyfills.ts"
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Dynamic Imports
|
|
503
|
+
|
|
504
|
+
```typescript
|
|
505
|
+
// Code splitting with dynamic imports
|
|
506
|
+
const HeavyComponent = lazy(() => import('./HeavyComponent'));
|
|
507
|
+
|
|
508
|
+
function App() {
|
|
509
|
+
return (
|
|
510
|
+
<Suspense fallback={<Loading />}>
|
|
511
|
+
<HeavyComponent />
|
|
512
|
+
</Suspense>
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Conditional loading
|
|
517
|
+
async function loadAnalytics() {
|
|
518
|
+
if (process.env.NODE_ENV === 'production') {
|
|
519
|
+
const analytics = await import('./analytics');
|
|
520
|
+
analytics.init();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Barrel File Optimization
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
// ❌ Bad: Barrel file imports everything
|
|
529
|
+
// utils/index.ts
|
|
530
|
+
export * from './string';
|
|
531
|
+
export * from './number';
|
|
532
|
+
export * from './date';
|
|
533
|
+
|
|
534
|
+
// ✅ Good: Direct imports
|
|
535
|
+
import { capitalize } from './utils/string';
|
|
536
|
+
import { formatNumber } from './utils/number';
|
|
537
|
+
|
|
538
|
+
// Or use named re-exports
|
|
539
|
+
// utils/index.ts
|
|
540
|
+
export { capitalize, lowercase } from './string';
|
|
541
|
+
export { formatNumber, parseNumber } from './number';
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### Lodash Tree-Shaking
|
|
545
|
+
|
|
546
|
+
```typescript
|
|
547
|
+
// ❌ Bad: Imports entire lodash
|
|
548
|
+
import _ from 'lodash';
|
|
549
|
+
_.debounce(fn, 300);
|
|
550
|
+
|
|
551
|
+
// ✅ Good: Import specific function
|
|
552
|
+
import debounce from 'lodash/debounce';
|
|
553
|
+
debounce(fn, 300);
|
|
554
|
+
|
|
555
|
+
// ✅ Better: Use lodash-es (ES modules)
|
|
556
|
+
import { debounce } from 'lodash-es';
|
|
557
|
+
debounce(fn, 300);
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### Next.js Optimization
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
// next.config.js
|
|
564
|
+
module.exports = {
|
|
565
|
+
// Enable SWC minification
|
|
566
|
+
swcMinify: true,
|
|
567
|
+
|
|
568
|
+
// Optimize images
|
|
569
|
+
images: {
|
|
570
|
+
formats: ['image/avif', 'image/webp'],
|
|
571
|
+
minimumCacheTTL: 60
|
|
572
|
+
},
|
|
573
|
+
|
|
574
|
+
// Experimental features
|
|
575
|
+
experimental: {
|
|
576
|
+
optimizeCss: true,
|
|
577
|
+
optimizePackageImports: ['@mui/material', 'lodash']
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
// Webpack configuration
|
|
581
|
+
webpack: (config, { isServer }) => {
|
|
582
|
+
if (!isServer) {
|
|
583
|
+
config.optimization.splitChunks = {
|
|
584
|
+
chunks: 'all',
|
|
585
|
+
cacheGroups: {
|
|
586
|
+
default: false,
|
|
587
|
+
vendors: false,
|
|
588
|
+
commons: {
|
|
589
|
+
name: 'commons',
|
|
590
|
+
chunks: 'all',
|
|
591
|
+
minChunks: 2
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
return config;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
## Performance Monitoring
|
|
604
|
+
|
|
605
|
+
### Web Vitals
|
|
606
|
+
|
|
607
|
+
```typescript
|
|
608
|
+
// app/layout.tsx
|
|
609
|
+
import { Analytics } from '@vercel/analytics/react';
|
|
610
|
+
import { SpeedInsights } from '@vercel/speed-insights/next';
|
|
611
|
+
|
|
612
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
613
|
+
return (
|
|
614
|
+
<html lang="en">
|
|
615
|
+
<body>
|
|
616
|
+
{children}
|
|
617
|
+
<Analytics />
|
|
618
|
+
<SpeedInsights />
|
|
619
|
+
</body>
|
|
620
|
+
</html>
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### Custom Performance Tracking
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
// lib/performance.ts
|
|
629
|
+
export function measurePerformance(name: string, fn: () => void) {
|
|
630
|
+
const start = performance.now();
|
|
631
|
+
fn();
|
|
632
|
+
const end = performance.now();
|
|
633
|
+
console.log(`${name} took ${end - start}ms`);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// Usage
|
|
637
|
+
measurePerformance('Data processing', () => {
|
|
638
|
+
processLargeDataset(data);
|
|
639
|
+
});
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### React Profiler
|
|
643
|
+
|
|
644
|
+
```typescript
|
|
645
|
+
import { Profiler, ProfilerOnRenderCallback } from 'react';
|
|
646
|
+
|
|
647
|
+
const onRenderCallback: ProfilerOnRenderCallback = (
|
|
648
|
+
id,
|
|
649
|
+
phase,
|
|
650
|
+
actualDuration,
|
|
651
|
+
baseDuration,
|
|
652
|
+
startTime,
|
|
653
|
+
commitTime
|
|
654
|
+
) => {
|
|
655
|
+
console.log({
|
|
656
|
+
id,
|
|
657
|
+
phase,
|
|
658
|
+
actualDuration,
|
|
659
|
+
baseDuration,
|
|
660
|
+
startTime,
|
|
661
|
+
commitTime
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
function App() {
|
|
666
|
+
return (
|
|
667
|
+
<Profiler id="App" onRender={onRenderCallback}>
|
|
668
|
+
<YourComponent />
|
|
669
|
+
</Profiler>
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
### Lighthouse CI
|
|
675
|
+
|
|
676
|
+
```yaml
|
|
677
|
+
# .github/workflows/lighthouse.yml
|
|
678
|
+
name: Lighthouse CI
|
|
679
|
+
on: [push]
|
|
680
|
+
jobs:
|
|
681
|
+
lighthouse:
|
|
682
|
+
runs-on: ubuntu-latest
|
|
683
|
+
steps:
|
|
684
|
+
- uses: actions/checkout@v3
|
|
685
|
+
- uses: actions/setup-node@v3
|
|
686
|
+
- run: npm ci
|
|
687
|
+
- run: npm run build
|
|
688
|
+
- run: npm install -g @lhci/cli
|
|
689
|
+
- run: lhci autorun
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
```javascript
|
|
693
|
+
// lighthouserc.js
|
|
694
|
+
module.exports = {
|
|
695
|
+
ci: {
|
|
696
|
+
collect: {
|
|
697
|
+
startServerCommand: 'npm run start',
|
|
698
|
+
url: ['http://localhost:3000/'],
|
|
699
|
+
numberOfRuns: 3
|
|
700
|
+
},
|
|
701
|
+
assert: {
|
|
702
|
+
assertions: {
|
|
703
|
+
'categories:performance': ['error', { minScore: 0.9 }],
|
|
704
|
+
'categories:accessibility': ['error', { minScore: 0.9 }],
|
|
705
|
+
'categories:best-practices': ['error', { minScore: 0.9 }],
|
|
706
|
+
'categories:seo': ['error', { minScore: 0.9 }]
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
upload: {
|
|
710
|
+
target: 'temporary-public-storage'
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
## Best Practices
|
|
719
|
+
|
|
720
|
+
### 1. Always Validate External Data
|
|
721
|
+
|
|
722
|
+
```typescript
|
|
723
|
+
// ✅ Good: Validate API responses
|
|
724
|
+
async function fetchUser(id: number) {
|
|
725
|
+
const response = await fetch(`/api/users/${id}`);
|
|
726
|
+
const data = await response.json();
|
|
727
|
+
return userSchema.parse(data); // Validate with Zod
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// ❌ Bad: Trust external data
|
|
731
|
+
async function fetchUser(id: number) {
|
|
732
|
+
const response = await fetch(`/api/users/${id}`);
|
|
733
|
+
return response.json(); // No validation
|
|
734
|
+
}
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
### 2. Use Security Headers
|
|
738
|
+
|
|
739
|
+
```typescript
|
|
740
|
+
// ✅ Good: Comprehensive security headers
|
|
741
|
+
const securityHeaders = [
|
|
742
|
+
{ key: 'X-Frame-Options', value: 'SAMEORIGIN' },
|
|
743
|
+
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
|
744
|
+
{ key: 'Strict-Transport-Security', value: 'max-age=63072000' }
|
|
745
|
+
];
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### 3. Memoize Expensive Computations
|
|
749
|
+
|
|
750
|
+
```typescript
|
|
751
|
+
// ✅ Good: Memoize expensive operations
|
|
752
|
+
const sortedData = useMemo(() => {
|
|
753
|
+
return data.sort((a, b) => a.value - b.value);
|
|
754
|
+
}, [data]);
|
|
755
|
+
|
|
756
|
+
// ❌ Bad: Recompute on every render
|
|
757
|
+
const sortedData = data.sort((a, b) => a.value - b.value);
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
### 4. Use Dynamic Imports for Code Splitting
|
|
761
|
+
|
|
762
|
+
```typescript
|
|
763
|
+
// ✅ Good: Dynamic import
|
|
764
|
+
const Chart = lazy(() => import('./Chart'));
|
|
765
|
+
|
|
766
|
+
// ❌ Bad: Static import for large component
|
|
767
|
+
import Chart from './Chart';
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
### 5. Optimize Bundle Size
|
|
771
|
+
|
|
772
|
+
```typescript
|
|
773
|
+
// ✅ Good: Import specific functions
|
|
774
|
+
import { debounce } from 'lodash-es';
|
|
775
|
+
|
|
776
|
+
// ❌ Bad: Import entire library
|
|
777
|
+
import _ from 'lodash';
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
### 6. Monitor Performance
|
|
781
|
+
|
|
782
|
+
```typescript
|
|
783
|
+
// ✅ Good: Track performance metrics
|
|
784
|
+
export function reportWebVitals(metric: NextWebVitalsMetric) {
|
|
785
|
+
console.log(metric);
|
|
786
|
+
// Send to analytics
|
|
787
|
+
}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
## Common Pitfalls
|
|
793
|
+
|
|
794
|
+
### ❌ Trusting User Input
|
|
795
|
+
|
|
796
|
+
```typescript
|
|
797
|
+
// Never trust user input
|
|
798
|
+
function renderHTML(userInput: string) {
|
|
799
|
+
return <div dangerouslySetInnerHTML={{ __html: userInput }} />; // ❌ XSS vulnerability
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// Always sanitize
|
|
803
|
+
function renderHTML(userInput: string) {
|
|
804
|
+
const clean = DOMPurify.sanitize(userInput);
|
|
805
|
+
return <div dangerouslySetInnerHTML={{ __html: clean }} />; // ✅ Safe
|
|
806
|
+
}
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
### ❌ Over-Memoization
|
|
810
|
+
|
|
811
|
+
```typescript
|
|
812
|
+
// Don't memoize everything
|
|
813
|
+
const value = useMemo(() => x + y, [x, y]); // ❌ Unnecessary for simple operations
|
|
814
|
+
|
|
815
|
+
// Only memoize expensive computations
|
|
816
|
+
const value = x + y; // ✅ Simple operation
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### ❌ Ignoring Bundle Size
|
|
820
|
+
|
|
821
|
+
```typescript
|
|
822
|
+
// Check bundle size regularly
|
|
823
|
+
npm run analyze
|
|
824
|
+
|
|
825
|
+
// Use bundle size limits
|
|
826
|
+
// package.json
|
|
827
|
+
{
|
|
828
|
+
"bundlesize": [
|
|
829
|
+
{
|
|
830
|
+
"path": "./dist/*.js",
|
|
831
|
+
"maxSize": "100 kB"
|
|
832
|
+
}
|
|
833
|
+
]
|
|
834
|
+
}
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
---
|
|
838
|
+
|
|
839
|
+
## References
|
|
840
|
+
|
|
841
|
+
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
|
842
|
+
- [Next.js Security Headers](https://nextjs.org/docs/advanced-features/security-headers)
|
|
843
|
+
- [Zod Documentation](https://zod.dev)
|
|
844
|
+
- [React Performance Optimization](https://react.dev/learn/render-and-commit)
|
|
845
|
+
- [Web Vitals](https://web.dev/vitals/)
|
|
846
|
+
- [Lighthouse CI](https://github.com/GoogleChrome/lighthouse-ci)
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|