jso-protector 0.4.4 → 0.4.5
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/CHANGELOG.md +11 -0
- package/bin/jso-protector.js +42 -14
- package/examples/README.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.5 - 2026-08-31
|
|
4
|
+
|
|
5
|
+
- **The first command now works without an account.** With no credentials at
|
|
6
|
+
all the CLI sends the request anonymously and the service runs it on the free
|
|
7
|
+
tier - up to 20 files and 200 KB per request, no VM protection, rate limited
|
|
8
|
+
per IP. You get real protected output instead of an error, and the run says
|
|
9
|
+
so on stderr. `javascriptobfuscator login` switches to your plan.
|
|
10
|
+
- Half-configured credentials are still an error. Only *no* credentials means
|
|
11
|
+
anonymous, so a key that stopped resolving cannot silently downgrade a paid
|
|
12
|
+
build to the free tier.
|
|
13
|
+
|
|
3
14
|
## 0.4.4 - 2026-08-31
|
|
4
15
|
|
|
5
16
|
- **`javascriptobfuscator login` saves your credentials once, for every project
|
package/bin/jso-protector.js
CHANGED
|
@@ -29,6 +29,15 @@ const SOURCE_MAP_COMMENT_LINE_PATTERN = /^[ \t]*\/\/[#@]\s*sourceMappingURL=.*(?
|
|
|
29
29
|
const SOURCE_MAP_COMMENT_BLOCK_PATTERN = /[ \t]*\/\*[#@]\s*sourceMappingURL=[\s\S]*?\*\/[ \t]*(?:\r?\n)?/g;
|
|
30
30
|
|
|
31
31
|
const PRESET_OPTIONS = {
|
|
32
|
+
// Free tier. Exactly the transforms that are ungated server-side - anything
|
|
33
|
+
// else (compression, MoveStrings, DeepObfuscate, renaming, VM ...) requires a
|
|
34
|
+
// paid plan, so a preset containing them turns an anonymous first run into a
|
|
35
|
+
// plan-gate error instead of a protected file.
|
|
36
|
+
free: {
|
|
37
|
+
IdentityStyle: "v2abcd",
|
|
38
|
+
EncodeStrings: true,
|
|
39
|
+
ReplaceNames: true
|
|
40
|
+
},
|
|
32
41
|
standard: {
|
|
33
42
|
EncodeStrings: true,
|
|
34
43
|
MoveStrings: true,
|
|
@@ -2325,7 +2334,22 @@ function mergeConfig(config, args = {}) {
|
|
|
2325
2334
|
const webPreset = loadWebPreset(config, args, baseDir);
|
|
2326
2335
|
const compatibility = translateJavascriptObfuscatorConfigOptions(config);
|
|
2327
2336
|
const jsConfuserCompatibility = translateJsConfuserConfigOptions(config);
|
|
2328
|
-
|
|
2337
|
+
// Credentials saved by `javascriptobfuscator login`. Deliberately LAST in the
|
|
2338
|
+
// chain: an explicit flag, a project config, or a CI environment variable must
|
|
2339
|
+
// always win over a developer's machine-wide login.
|
|
2340
|
+
let _stored;
|
|
2341
|
+
const storedCredentials = () => {
|
|
2342
|
+
if (_stored === undefined) {
|
|
2343
|
+
try { _stored = require("../credentials.js").readStored() || {}; }
|
|
2344
|
+
catch (err) { _stored = {}; }
|
|
2345
|
+
}
|
|
2346
|
+
return _stored;
|
|
2347
|
+
};
|
|
2348
|
+
|
|
2349
|
+
const explicitPreset = args.preset || config.preset || jsConfuserCompatibility.preset || compatibility.preset || (webPreset && webPreset.preset);
|
|
2350
|
+
const noCredentials = !(args.apiKey || config.apiKey || readEnv(["JSO_API_KEY", "JAVASCRIPT_OBFUSCATOR_API_KEY"]) || storedCredentials().apiKey)
|
|
2351
|
+
&& !(args.apiPassword || config.apiPassword || readEnv(["JSO_API_PASSWORD", "JAVASCRIPT_OBFUSCATOR_API_PASSWORD"]) || storedCredentials().apiPassword);
|
|
2352
|
+
const preset = normalizePresetName(explicitPreset || (noCredentials ? "free" : "standard"));
|
|
2329
2353
|
const output = args.output || config.output || getCompatibilityDefaultOutput(args, config, baseDir) || "dist-protected";
|
|
2330
2354
|
const convenienceOptions = mapConvenienceOptions(config, args);
|
|
2331
2355
|
const options = {
|
|
@@ -2342,18 +2366,6 @@ function mergeConfig(config, args = {}) {
|
|
|
2342
2366
|
reservedNames: (args.reservedNames && args.reservedNames.length) ? args.reservedNames : config.reservedNames
|
|
2343
2367
|
});
|
|
2344
2368
|
|
|
2345
|
-
// Credentials saved by `javascriptobfuscator login`. Deliberately LAST in the
|
|
2346
|
-
// chain: an explicit flag, a project config, or a CI environment variable must
|
|
2347
|
-
// always win over a developer's machine-wide login.
|
|
2348
|
-
let _stored;
|
|
2349
|
-
const storedCredentials = () => {
|
|
2350
|
-
if (_stored === undefined) {
|
|
2351
|
-
try { _stored = require("../credentials.js").readStored() || {}; }
|
|
2352
|
-
catch (err) { _stored = {}; }
|
|
2353
|
-
}
|
|
2354
|
-
return _stored;
|
|
2355
|
-
};
|
|
2356
|
-
|
|
2357
2369
|
const merged = {
|
|
2358
2370
|
mode: args.mode || config.mode || readEnv(["NODE_ENV"]) || null,
|
|
2359
2371
|
endpoint: args.endpoint || config.endpoint || readEnv(["JSO_ENDPOINT", "JAVASCRIPT_OBFUSCATOR_ENDPOINT"]) || DEFAULT_ENDPOINT,
|
|
@@ -2462,7 +2474,7 @@ function loadWebPreset(config, args, baseDir) {
|
|
|
2462
2474
|
function normalizePresetName(value) {
|
|
2463
2475
|
const name = String(value || "standard").toLowerCase();
|
|
2464
2476
|
if (!Object.prototype.hasOwnProperty.call(PRESET_OPTIONS, name)) {
|
|
2465
|
-
throw new Error(`Unknown preset "${value}". Use standard, balanced, or maximum.`);
|
|
2477
|
+
throw new Error(`Unknown preset "${value}". Use free, standard, balanced, or maximum.`);
|
|
2466
2478
|
}
|
|
2467
2479
|
return name;
|
|
2468
2480
|
}
|
|
@@ -4680,7 +4692,16 @@ function normalizeName(name) {
|
|
|
4680
4692
|
return String(name || "").replace(/\\/g, "/");
|
|
4681
4693
|
}
|
|
4682
4694
|
|
|
4695
|
+
// With NO credentials at all the request is sent anonymously: the service runs
|
|
4696
|
+
// it on the free tier (20 files / 200 KB, no VM, rate limited per IP) so a first
|
|
4697
|
+
// command produces real protected output instead of an error. Half-configured is
|
|
4698
|
+
// still an error, because that is a mistake rather than a choice.
|
|
4699
|
+
function isAnonymousRun(config) {
|
|
4700
|
+
return !config.apiKey && !config.apiPassword;
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4683
4703
|
function assertReady(config) {
|
|
4704
|
+
if (isAnonymousRun(config)) return;
|
|
4684
4705
|
if (!config.apiKey) throw new Error("Missing API key. Run `javascriptobfuscator login` to sign in and save credentials, or create a key at https://javascriptobfuscator.com/dashboard/APIKeys.aspx and set JSO_API_KEY.");
|
|
4685
4706
|
if (!config.apiPassword) throw new Error("Missing API password. Run `javascriptobfuscator login` to sign in and save credentials, or copy it from https://javascriptobfuscator.com/dashboard/APIKeys.aspx and set JSO_API_PASSWORD.");
|
|
4686
4707
|
}
|
|
@@ -12290,6 +12311,13 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
12290
12311
|
}
|
|
12291
12312
|
|
|
12292
12313
|
assertReady(config);
|
|
12314
|
+
// Say plainly that this run is unauthenticated. Someone whose credentials
|
|
12315
|
+
// silently stopped resolving must not think they are on their paid plan.
|
|
12316
|
+
if (isAnonymousRun(config) && !args.json) {
|
|
12317
|
+
process.stderr.write(
|
|
12318
|
+
"No credentials found - running on the free tier (up to 20 files, 200 KB per request, no VM protection)." + "\n" +
|
|
12319
|
+
"Run `javascriptobfuscator login` to use your plan." + "\n\n");
|
|
12320
|
+
}
|
|
12293
12321
|
if (!files.length) {
|
|
12294
12322
|
throw new Error("No matching input files found.");
|
|
12295
12323
|
}
|
package/examples/README.md
CHANGED
|
@@ -39,7 +39,7 @@ published as `javascriptobfuscator-com`; `jso-protector` is the former name and
|
|
|
39
39
|
is deprecated but still updated:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npm install --save-dev javascriptobfuscator-com@0.4.
|
|
42
|
+
npm install --save-dev javascriptobfuscator-com@0.4.5
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Repository contributors can instead use the existing `file:../..` development
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jso-protector",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Obfuscate and protect JavaScript in your build or CI: dependency-free CLI, Node API, and webpack/Vite/Rollup/esbuild/Next.js/Metro plugins, with one-command migration from javascript-obfuscator and JS-Confuser configs.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "JavaScript Obfuscator",
|