@afterpack/wasm 1.0.2 → 1.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/dist/api.js CHANGED
@@ -63,6 +63,11 @@ const RETRYABLE_BACKOFF_SECONDS = [1, 4, 16];
63
63
  const DEFAULT_RETRY_AFTER_SECONDS = 60;
64
64
  const MAX_RETRY_AFTER_SECONDS = 120;
65
65
  const REQUEST_TIMEOUT_MS = 330_000;
66
+ function withBuildSeed(config) {
67
+ const seed = config?.seed;
68
+ const pinned = typeof seed === "number" || (typeof seed === "string" && seed.trim() !== "");
69
+ return pinned && config ? config : { ...config, seed: randomSeed() };
70
+ }
66
71
  function sleep(ms) {
67
72
  return new Promise((resolve) => setTimeout(resolve, ms));
68
73
  }
@@ -391,7 +396,7 @@ export async function obfuscateAll(files, config, context) {
391
396
  const paths = files.map((file, i) => enginePath(file, i, files.length));
392
397
  const sources = files.map((file) => sourceToString(file.source));
393
398
  const kinds = fileSourceTypes(files);
394
- const build = config?.seed === undefined ? { ...config, seed: randomSeed() } : config;
399
+ const build = withBuildSeed(config);
395
400
  const key = configKey(build);
396
401
  if (key !== null) {
397
402
  return obfuscateAllCloud(files, paths, sources, kinds, key, build, context);
@@ -51,8 +51,8 @@ export interface RegionConfig {
51
51
  export interface AfterpackConfig {
52
52
  /** The random seed. Unset, every build produces different output; set it to reproduce a build. */
53
53
  seed?: number | string;
54
- /** Your AfterPack Pro key. Set, the build runs in AfterPack's cloud. https://www.afterpack.dev/docs/pro */
55
- key?: string;
54
+ /** Your AfterPack Pro key. Set, the build runs in AfterPack's cloud; `null` builds locally on Free with no key lookup. https://www.afterpack.dev/docs/pro */
55
+ key?: string | null;
56
56
  /** A named protection level. Defaults to `light`. */
57
57
  preset?: Preset;
58
58
  /** Whether the input is an ES module or a classic script. `auto` (the default) decides from the source, treating an `.mjs` path as a module. Set `module` for module output that has no `import`/`export`. A file's own `sourceType` overrides it. */
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "1.0.2-rc.202610262322";
1
+ export declare const PACKAGE_VERSION = "1.1.0-rc.202611271035";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = "1.0.2-rc.202610262322";
1
+ export const PACKAGE_VERSION = "1.1.0-rc.202611271035";
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afterpack/wasm",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "The AfterPack JavaScript obfuscator as WebAssembly, for Cloudflare Workers and Node",
5
5
  "type": "module",
6
6
  "main": "./dist/node.js",
package/readme.md CHANGED
@@ -98,8 +98,8 @@ Without a key, all of Free runs inside your Worker or Node process, with every p
98
98
 
99
99
  | Measure | Bytes | |
100
100
  |---|---:|---|
101
- | Raw `.wasm` | 4,739,971 | 4.52 MiB |
102
- | Gzipped | 1,347,905 | 1.29 MiB |
101
+ | Raw `.wasm` | 4,642,946 | 4.43 MiB |
102
+ | Gzipped | 1,301,220 | 1.24 MiB |
103
103
 
104
104
  This fits Cloudflare's Worker size limit on both the free and paid plans. CPU time is the tighter limit: the free plan allows 10 ms per request, and obfuscating a 185 KB bundle at `complexity: 8` takes about 263 ms on an Apple M-series laptop. Plan on Workers Paid for real bundles.
105
105