jso-protector 0.4.4 → 0.4.6

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.6 - 2026-08-31
4
+
5
+ Documentation only. No behaviour changes.
6
+
7
+ - **The README said you needed an API key to use this package.** Since 0.4.5
8
+ that is false for a first run, and it was the first thing anyone read on
9
+ npmjs.com - so the page was arguing against the feature the release shipped.
10
+ The quickstart now says no account is needed, "What you need" answers
11
+ "nothing, to start", and the payment section describes the free tier and where
12
+ it ends instead of claiming the package unlocks nothing on its own.
13
+ - The quickstart installs `javascriptobfuscator-com` and calls
14
+ `javascriptobfuscator`, the current names.
15
+
16
+ ## 0.4.5 - 2026-08-31
17
+
18
+ - **The first command now works without an account.** With no credentials at
19
+ all the CLI sends the request anonymously and the service runs it on the free
20
+ tier - up to 20 files and 200 KB per request, no VM protection, rate limited
21
+ per IP. You get real protected output instead of an error, and the run says
22
+ so on stderr. `javascriptobfuscator login` switches to your plan.
23
+ - Half-configured credentials are still an error. Only *no* credentials means
24
+ anonymous, so a key that stopped resolving cannot silently downgrade a paid
25
+ build to the free tier.
26
+
3
27
  ## 0.4.4 - 2026-08-31
4
28
 
5
29
  - **`javascriptobfuscator login` saves your credentials once, for every project
package/README.md CHANGED
@@ -9,20 +9,29 @@ Node API, and plugins for webpack, Vite, Rollup, esbuild, Next.js, Metro, and
9
9
  the rest of the toolchain.
10
10
 
11
11
  ```bash
12
- npm install --save-dev jso-protector
13
- npx jso-protector --input dist --output dist-protected
12
+ npm install --save-dev javascriptobfuscator-com
13
+ npx javascriptobfuscator --input dist --output dist-protected
14
14
  ```
15
15
 
16
+ **No account needed to try it.** With no credentials configured the run uses the
17
+ free tier - up to 20 files and 200 KB per request, rate limited, no VM
18
+ protection - and tells you so. `npx javascriptobfuscator login` switches to your
19
+ plan when you need more.
20
+
16
21
  That protects every JavaScript file in `dist/` and writes the result to
17
22
  `dist-protected/`. Nothing else in your build has to change.
18
23
 
19
24
  ## What you need
20
25
 
21
- An API key and password from your [javascriptobfuscator.com](https://javascriptobfuscator.com/)
22
- dashboard, passed as `--api-key` / `--api-password` or read from the
23
- `JSO_API_KEY` and `JSO_API_PASSWORD` environment variables. Run
24
- `npx jso-protector --doctor` to check credentials, paths, and file matching
25
- before you wire it into CI.
26
+ Nothing, to start. A run with no credentials goes to the free tier.
27
+
28
+ Beyond it - more than 20 files or 200 KB in one request, compression, renaming,
29
+ control-flow flattening, VM protection - you need a key and password from your
30
+ [javascriptobfuscator.com](https://javascriptobfuscator.com/) dashboard. Run
31
+ `npx javascriptobfuscator login` to sign in once and store them, or pass
32
+ `--api-key` / `--api-password`, or set `JSO_API_KEY` and `JSO_API_PASSWORD`.
33
+ Run `npx javascriptobfuscator --doctor` to check credentials, paths, and file
34
+ matching before you wire it into CI.
26
35
 
27
36
  ## Already using another obfuscator?
28
37
 
@@ -318,7 +327,9 @@ internal remediation.
318
327
 
319
328
  ## Payment and API Access
320
329
 
321
- `jso-protector` is a localhost developer client for the paid JavaScript Obfuscator service: it drives the hosted API by default, or the bundled `jso-local` protector with `--local`. The npm package does not unlock protection by itself and does not contain payment logic.
330
+ This package is a client. It drives the hosted API by default, or the bundled `jso-local` protector with `--local`. Protection itself, billing and every plan limit live on the server, never in this package.
331
+
332
+ A request with no credentials is served on the **free tier**: up to 20 files and 200 KB per request, rate limited per IP, no VM protection. Everything above that is a paid plan, enforced server-side.
322
333
 
323
334
  Payment and account enforcement stay on `javascriptobfuscator.com`:
324
335
 
@@ -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
- const preset = normalizePresetName(args.preset || config.preset || jsConfuserCompatibility.preset || compatibility.preset || (webPreset && webPreset.preset) || "standard");
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
  }
@@ -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.4
42
+ npm install --save-dev javascriptobfuscator-com@0.4.6
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.4",
3
+ "version": "0.4.6",
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",