azot 5.0.0-alpha.10 → 5.0.0-alpha.11
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/dist/azt.cjs +1 -1
- package/dist/azt.mjs +1 -1
- package/package.json +1 -1
package/dist/azt.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./chunk-350yNsax.cjs`);let t=require(`node:util`),n=require(`node:fs`),r=require(`node:path`);r=e.n(r);let i=require(`tsdown`),a=require(`node:crypto`),o=require(`javascript-obfuscator`);o=e.n(o);const s=Buffer.from(`STX`,`utf8`),c=(e,t,r)=>{let i=(0,a.randomBytes)(32),o=(0,a.randomBytes)(16),c=(0,n.readFileSync)(t),l=(0,a.createCipheriv)(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(c),l.final()]),d=(0,a.publicEncrypt)(e,i),f=Buffer.concat([s,o,d,u]);return r&&(0,n.writeFileSync)(r,f),{aesIv:o,encryptedAesKey:d,encryptedCode:u}},l=(e,t,r)=>{let i=(0,n.readFileSync)(t),o=s.byteLength;if(!i.subarray(0,o).equals(s))throw Error(`Incorrect file format`);let c=o,l=c+16,u=l+512,d=i.subarray(c,l),f=i.subarray(l,u),p=i.subarray(u),m=(0,a.createDecipheriv)(`aes-256-cbc`,(0,a.privateDecrypt)(e,f),d),h=Buffer.concat([m.update(p),m.final()]).toString(`utf8`);return r&&(0,n.writeFileSync)(r,h),h},u=(e,t)=>{let r=(0,n.readFileSync)(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=o.default.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let a=i.getObfuscatedCode();return(0,n.writeFileSync)(t||e,a),a},d=(0,t.parseArgs)({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),f=()=>{let e=[process.cwd(),r.default.join(process.cwd(),`src`),r.default.join(process.cwd(),`lib`)];for(let t of e){let e=(0,n.readdirSync)(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`]).has(r.default.extname(e))),i=e=>r.default.basename(e,r.default.extname(e)),a=e.find(e=>i(e)===`index`)||e.find(e=>i(e)===`main`)||e[0];if(a)return r.default.join(t,a)}};(async()=>{let[e,...t]=d.positionals,a=d.values.input||t[0]||f();if(!a)throw Error(`No entry file found`);if(e===`build`||e===`pack`){let t=typeof d.values.minify==`boolean`?d.values.minify:!0;await(0,i.build)({entry:a.replace(process.cwd(),`.`).replace(r.default.sep,`/`),format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:d.values.watch,minify:t})
|
|
2
|
+
const e=require(`./chunk-350yNsax.cjs`);let t=require(`node:util`),n=require(`node:fs`),r=require(`node:path`);r=e.n(r);let i=require(`tsdown`),a=require(`node:crypto`),o=require(`javascript-obfuscator`);o=e.n(o);const s=Buffer.from(`STX`,`utf8`),c=(e,t,r)=>{let i=(0,a.randomBytes)(32),o=(0,a.randomBytes)(16),c=(0,n.readFileSync)(t),l=(0,a.createCipheriv)(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(c),l.final()]),d=(0,a.publicEncrypt)(e,i),f=Buffer.concat([s,o,d,u]);return r&&(0,n.writeFileSync)(r,f),{aesIv:o,encryptedAesKey:d,encryptedCode:u}},l=(e,t,r)=>{let i=(0,n.readFileSync)(t),o=s.byteLength;if(!i.subarray(0,o).equals(s))throw Error(`Incorrect file format`);let c=o,l=c+16,u=l+512,d=i.subarray(c,l),f=i.subarray(l,u),p=i.subarray(u),m=(0,a.createDecipheriv)(`aes-256-cbc`,(0,a.privateDecrypt)(e,f),d),h=Buffer.concat([m.update(p),m.final()]).toString(`utf8`);return r&&(0,n.writeFileSync)(r,h),h},u=(e,t)=>{let r=(0,n.readFileSync)(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=o.default.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let a=i.getObfuscatedCode();return(0,n.writeFileSync)(t||e,a),a},d=(0,t.parseArgs)({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),f=()=>{let e=[process.cwd(),r.default.join(process.cwd(),`src`),r.default.join(process.cwd(),`lib`)];for(let t of e){let e=(0,n.readdirSync)(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`,`.cjs`,`.mjs`]).has(r.default.extname(e))),i=e=>r.default.basename(e,r.default.extname(e)),a=e.find(e=>i(e)===`index`)||e.find(e=>i(e)===`main`)||e[0];if(a)return r.default.join(t,a)}};(async()=>{let[e,...t]=d.positionals,a=d.values.input||t[0]||f();if(!a)throw Error(`No entry file found`);if(e===`build`||e===`pack`){let t=typeof d.values.minify==`boolean`?d.values.minify:!0;await(0,i.build)({entry:a.replace(process.cwd(),`.`).replace(r.default.sep,`/`),format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:d.values.watch,minify:t});let o=d.values.format??`cjs`;d.values.input=r.default.join(process.cwd(),`dist`,r.default.basename(a).replace(/\.ts$/,`.${o}`));let s=require(r.default.join(process.cwd(),`package.json`));if((typeof d.values.obfuscate==`boolean`?d.values.obfuscate:s.private)&&u(d.values.input,d.values.input),d.values.encrypt||e===`pack`){let e=(0,n.readFileSync)(d.values.key||r.default.join(__dirname,`../public.pem`),`utf8`),t=d.values.output||d.values.input.replace(/\.js$/,`-${s.version}.stx`);c(e,d.values.input,t),(0,n.rmSync)(d.values.input)}}else if(e===`decrypt`)l((0,n.readFileSync)(d.values.key||r.default.join(__dirname,`../private.pem`),`utf8`),a,d.values.output||a.replace(/\.stx$/,`.js`)),d.values.input&&(0,n.rmSync)(d.values.input);else if(e===`dev`||e===`develop`||!e){let e=typeof d.values.minify==`boolean`?d.values.minify:!1;await(0,i.build)({entry:a,format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:!0,minify:e})}})();
|
package/dist/azt.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e}from"./chunk-DtROqxiw.mjs";import{parseArgs as t}from"node:util";import{readFileSync as n,readdirSync as r,rmSync as i,writeFileSync as a}from"node:fs";import o from"node:path";import{build as s}from"tsdown";import{createCipheriv as c,createDecipheriv as l,privateDecrypt as u,publicEncrypt as d,randomBytes as f}from"node:crypto";import p from"javascript-obfuscator";const m=Buffer.from(`STX`,`utf8`),h=(e,t,r)=>{let i=f(32),o=f(16),s=n(t),l=c(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(s),l.final()]),p=d(e,i),h=Buffer.concat([m,o,p,u]);return r&&a(r,h),{aesIv:o,encryptedAesKey:p,encryptedCode:u}},g=(e,t,r)=>{let i=n(t),o=m.byteLength;if(!i.subarray(0,o).equals(m))throw Error(`Incorrect file format`);let s=o,c=s+16,d=c+512,f=i.subarray(s,c),p=i.subarray(c,d),h=i.subarray(d),g=l(`aes-256-cbc`,u(e,p),f),_=Buffer.concat([g.update(h),g.final()]).toString(`utf8`);return r&&a(r,_),_},_=(e,t)=>{let r=n(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=p.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let o=i.getObfuscatedCode();return a(t||e,o),o},v=t({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),y=()=>{let e=[process.cwd(),o.join(process.cwd(),`src`),o.join(process.cwd(),`lib`)];for(let t of e){let e=r(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`]).has(o.extname(e))),n=e=>o.basename(e,o.extname(e)),i=e.find(e=>n(e)===`index`)||e.find(e=>n(e)===`main`)||e[0];if(i)return o.join(t,i)}};(async()=>{let[t,...r]=v.positionals,a=v.values.input||r[0]||y();if(!a)throw Error(`No entry file found`);if(t===`build`||t===`pack`){let r=typeof v.values.minify==`boolean`?v.values.minify:!0;await s({entry:a.replace(process.cwd(),`.`).replace(o.sep,`/`),format:v.values.format??`cjs`,platform:`node`,target:`node22`,watch:v.values.watch,minify:r})
|
|
2
|
+
import{n as e}from"./chunk-DtROqxiw.mjs";import{parseArgs as t}from"node:util";import{readFileSync as n,readdirSync as r,rmSync as i,writeFileSync as a}from"node:fs";import o from"node:path";import{build as s}from"tsdown";import{createCipheriv as c,createDecipheriv as l,privateDecrypt as u,publicEncrypt as d,randomBytes as f}from"node:crypto";import p from"javascript-obfuscator";const m=Buffer.from(`STX`,`utf8`),h=(e,t,r)=>{let i=f(32),o=f(16),s=n(t),l=c(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(s),l.final()]),p=d(e,i),h=Buffer.concat([m,o,p,u]);return r&&a(r,h),{aesIv:o,encryptedAesKey:p,encryptedCode:u}},g=(e,t,r)=>{let i=n(t),o=m.byteLength;if(!i.subarray(0,o).equals(m))throw Error(`Incorrect file format`);let s=o,c=s+16,d=c+512,f=i.subarray(s,c),p=i.subarray(c,d),h=i.subarray(d),g=l(`aes-256-cbc`,u(e,p),f),_=Buffer.concat([g.update(h),g.final()]).toString(`utf8`);return r&&a(r,_),_},_=(e,t)=>{let r=n(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=p.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let o=i.getObfuscatedCode();return a(t||e,o),o},v=t({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),y=()=>{let e=[process.cwd(),o.join(process.cwd(),`src`),o.join(process.cwd(),`lib`)];for(let t of e){let e=r(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`,`.cjs`,`.mjs`]).has(o.extname(e))),n=e=>o.basename(e,o.extname(e)),i=e.find(e=>n(e)===`index`)||e.find(e=>n(e)===`main`)||e[0];if(i)return o.join(t,i)}};(async()=>{let[t,...r]=v.positionals,a=v.values.input||r[0]||y();if(!a)throw Error(`No entry file found`);if(t===`build`||t===`pack`){let r=typeof v.values.minify==`boolean`?v.values.minify:!0;await s({entry:a.replace(process.cwd(),`.`).replace(o.sep,`/`),format:v.values.format??`cjs`,platform:`node`,target:`node22`,watch:v.values.watch,minify:r});let c=v.values.format??`cjs`;v.values.input=o.join(process.cwd(),`dist`,o.basename(a).replace(/\.ts$/,`.${c}`));let l=e(o.join(process.cwd(),`package.json`));if((typeof v.values.obfuscate==`boolean`?v.values.obfuscate:l.private)&&_(v.values.input,v.values.input),v.values.encrypt||t===`pack`){let e=n(v.values.key||o.join(__dirname,`../public.pem`),`utf8`),t=v.values.output||v.values.input.replace(/\.js$/,`-${l.version}.stx`);h(e,v.values.input,t),i(v.values.input)}}else if(t===`decrypt`)g(n(v.values.key||o.join(__dirname,`../private.pem`),`utf8`),a,v.values.output||a.replace(/\.stx$/,`.js`)),v.values.input&&i(v.values.input);else if(t===`dev`||t===`develop`||!t){let e=typeof v.values.minify==`boolean`?v.values.minify:!1;await s({entry:a,format:v.values.format??`cjs`,platform:`node`,target:`node22`,watch:!0,minify:e})}})();export{};
|