आपके framework के लिए JavaScript obfuscation

आपके stack के लिए कौन-सा package install करें, वह कहाँ hook होता है, और क्या लिखता है।

AfterPack आपके bundler द्वारा बनाए गए JavaScript को obfuscate करता है। अपने stack के लिए package install करें और आपका सामान्य build obfuscated output देना शुरू कर देता है। बाकी हर स्थिति के लिए, build output पर npx afterpack@latest चलाएँ।

Framework तालिका

FrameworkPackageकैसे wire करेंकहाँ चलता हैBuild output
Next.js@afterpack/nextwithAfterpack(config)runAfterProductionCompile, next build के अंदर, Next के chunks लिखने के बाद.next/static/chunks, out/
Vite@afterpack/viteplugins में afterpackVite()generateBundle, pipeline मेंbuild.outDir
Webpack@afterpack/webpacknew AfterpackWebpackPlugin()compilation.hooks.processAssets, pipeline मेंoutput.path
Rollup@afterpack/rollupplugins में afterpackRollup()generateBundle, pipeline मेंoutput.dir या output.file
esbuild@afterpack/esbuildplugins में afterpackEsbuild()onEnd, esbuild के लिखने के बादoutdir या outfile
Astro@afterpack/astrointegrations में afterpack()Astro की Vite config के अंदर @afterpack/vitedist/
Svelte@afterpack/svelteplugins में afterpackSvelte()@afterpack/vitedist/
SvelteKit@afterpack/sveltekitsveltekit() के बाद afterpackSveltekit()@afterpack/viteadapter का output (build/)
Vue 3@afterpack/vuevue() के बाद afterpackVue()@afterpack/vitedist/
Nuxt 3@afterpack/nuxtmodules: ["@afterpack/nuxt"]Nuxt की Vite config पर @afterpack/vite.output/public/_nuxt/
Angular v17+@afterpack/angularpostbuild script में afterpackAngular()एक postbuild pass, ng build के लिखने के बादdist/<app>/browser
Electron@afterpack/electronelectron-vite के चारों ओर withAfterpack(config)तीनों legs पर @afterpack/vite, एक seedहर leg का out/
Parcel@afterpack/parcel-optimizer.parcelrc की optimizers में एक entryएक Parcel 2 Optimizer, हर bundle पर, pipeline मेंParcel का distDir

Astro, Svelte, SvelteKit, Vue, Nuxt और Angular @afterpack/vite install करते हैं, या वही shared pass चलाते हैं, इसलिए आपको इसे हाथ से wire नहीं करना पड़ता।

बिना plugin

Stackरास्ता
Remix / React Router v7Vite पर बना है: @afterpack/vite या CLI इस्तेमाल करें।
सादा JShook करने के लिए कोई bundler नहीं: npx afterpack@latest <dir>।

हर integration क्या करता है

Defaults Quickstart पर दिए हैं। उनके अलावा, हर plugin और CLI का यह व्यवहार साझा है:

  • Build mode अपने आप पहचाना जाता है। NODE_ENV=production या CI=true production चुनता है, जो source-map emission को बंद कर देता है। Ship किया गया map obfuscation को उलट देता है।
  • वही artifacts। gitignored .afterpack/ में एक संयुक्त protectionMap.html, और maps चालू होने पर हर फ़ाइल के बगल में एक .map। .afterpack/ की अपनी .gitignore होती है; आपकी .gitignore में कभी बदलाव नहीं किया जाता। build.backup के दो रूप हैं: CLI हर run पर आपकी मूल फ़ाइलों की प्रतिलिपि .afterpack/backup/ में रखता है, और जो plugin disk पर फ़ाइलें obfuscate करता है (@afterpack/next, @afterpack/esbuild, @afterpack/angular) वह आपके माँगने पर output के बगल में एक .backup.<hash> फ़ाइल लिखता है। In-pipeline plugins के पास कोई emitted फ़ाइल नहीं होती जिसके बगल में backup रखा जा सके, और माँगने पर वे चेतावनी देते हैं।
  • Run छोड़ने के लिए एक switch। build.autorun: false plugin को install रखता है और engine को छोड़ देता है।
  • Directives आपके source से plugin पढ़ता है, हर उस integration पर जिसके पास उन्हें पढ़ने का hook है। Angular इस key को सीधे अस्वीकार कर देता है: उसका builder sealed है, इसलिए pass को केवल पहले से minified output ही दिखता है। CLI भी इसी वजह से इसे अस्वीकार करता है।

आगे

  • Quickstart: एक stack चुनें और build करें।
  • Builds और CI: seeds, dev बनाम production, वही bytes promote करना।
  • Configuration: हर option और उसे कहाँ सेट करें।