@afterpack/webpack 0.2.6 → 1.0.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/README.md CHANGED
@@ -31,8 +31,8 @@ each chunk before AfterPack rewrites it, so the recorded hashes would not match
31
31
  Each build writes a protection receipt to `.afterpack/receipts/`, one per output directory
32
32
  (`.afterpack/receipts/dist.json` for `dist`). `.afterpack/` sits next to your project's lockfile,
33
33
  `afterpack.json` or `.git` (failing those, its `package.json`), otherwise beside the build
34
- directory, so the receipt never ships with your build. Run `npx afterpack verify dist` in your
35
- deploy step to check that what you ship is what was obfuscated.
34
+ directory, so the receipt never ships with your build. Run `npx afterpack@latest verify dist` in
35
+ your deploy step to check that what you ship is what was obfuscated.
36
36
 
37
37
  ## Options
38
38
 
@@ -47,7 +47,7 @@ new AfterpackWebpackPlugin({ preset: "hard", seed: "git" });
47
47
  | [`identifiers.reserved`][identifiers.reserved] | names never to rename | none |
48
48
  | [`paths.exclude`][paths.exclude] | globs for files to leave untouched | none |
49
49
  | [`sourceMap.enabled`][sourceMap.enabled] | write source maps for the obfuscated output; off also drops the build's CSS maps | off; on in development mode (`build.mode` or `NODE_ENV=development`) when webpack emits a map |
50
- | [`protectionMap.enabled`][protectionMap.enabled] | write the Protection Map | on when `devtool` emits source maps |
50
+ | [`protectionMap.enabled`][protectionMap.enabled] | write the Protection Map | on when `devtool` emits source maps, outside CI |
51
51
  | [`build.autorun`][build.autorun] | `false` turns AfterPack off | `true` |
52
52
 
53
53
  Dotted names are nested objects: `sourceMap.enabled` is `{ sourceMap: { enabled: true } }`. Every
@@ -65,9 +65,11 @@ other option is in the [configuration reference](https://www.afterpack.dev/docs/
65
65
  a region are a [Pro](https://www.afterpack.dev/docs/pro) feature. They need a `devtool` that emits
66
66
  source maps, such as `"source-map"`. Without one, the plugin skips them and tells you.
67
67
 
68
- The [Protection Map](https://www.afterpack.dev/docs/protection-map) is written to `.afterpack/`,
69
- outside webpack's output; that directory carries its own `.gitignore` and self-ignores. It contains
70
- your original source, so never deploy or commit it.
68
+ When `devtool` emits source maps, the
69
+ [Protection Map](https://www.afterpack.dev/docs/protection-map) is written to `.afterpack/`, outside
70
+ webpack's output; that directory carries its own `.gitignore` and self-ignores. Without source
71
+ maps, or in CI, it is off unless `protectionMap.enabled` is `true`. It contains your original
72
+ source, so never deploy or commit it.
71
73
 
72
74
  Options can also live in `afterpack.json` or in `AFTERPACK_*` environment variables. The options
73
75
  object wins over the environment, which wins over the file. An unknown or misspelled key fails the
package/dist/index.cjs CHANGED
@@ -33,7 +33,7 @@ const EMITTED_JS_RE = /\.(?:js|mjs|cjs)$/;
33
33
  const SOURCE_MODULE_RE = /\.(?:m?[jt]sx?)$/;
34
34
  const CSS_MAP_RE = /\.css\.map$/;
35
35
  const SRI_CONFLICT = "[afterpack-webpack] webpack-subresource-integrity is not compatible with AfterPack. It hashes each chunk for its <script integrity=...> before AfterPack obfuscates, so the browser would block every script, and it taps the same RealContentHash.updateHash bail hook AfterPack needs to rename obfuscated chunks. Remove the SubresourceIntegrityPlugin, or remove AfterPack.";
36
- const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the assets webpack's own chunks claim, in the pipeline — there is no output-directory walk for a glob to re-admit anything into. Use `npx afterpack <dir> --paths.include=...` for a disk walk, or drop the key.";
36
+ const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the assets webpack's own chunks claim, in the pipeline — there is no output-directory walk for a glob to re-admit anything into. Use `npx afterpack@latest <dir> --paths.include=...` for a disk walk, or drop the key.";
37
37
  function isEmittedJs(name) {
38
38
  return !name.includes(".hot-update.") && EMITTED_JS_RE.test(name);
39
39
  }
@@ -263,6 +263,7 @@ var AfterpackWebpackPlugin = class {
263
263
  }),
264
264
  sourceType: (0, __afterpack_integration_utils.sourceTypeForOutputFormat)(outputModule ? "module" : void 0),
265
265
  hasBundlerSourcemap: typeof devtool === "string" && devtool.includes("source-map"),
266
+ receipt: { bundler: "webpack" },
266
267
  messages: { autoEnableBundlerSourcemap: "protectionMap:true but no bundler sourcemap was found; set `devtool: 'source-map'` so future builds can render original source in the map." }
267
268
  });
268
269
  const { RawSource } = compiler.webpack.sources;
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ const EMITTED_JS_RE = /\.(?:js|mjs|cjs)$/;
10
10
  const SOURCE_MODULE_RE = /\.(?:m?[jt]sx?)$/;
11
11
  const CSS_MAP_RE = /\.css\.map$/;
12
12
  const SRI_CONFLICT = "[afterpack-webpack] webpack-subresource-integrity is not compatible with AfterPack. It hashes each chunk for its <script integrity=...> before AfterPack obfuscates, so the browser would block every script, and it taps the same RealContentHash.updateHash bail hook AfterPack needs to rename obfuscated chunks. Remove the SubresourceIntegrityPlugin, or remove AfterPack.";
13
- const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the assets webpack's own chunks claim, in the pipeline — there is no output-directory walk for a glob to re-admit anything into. Use `npx afterpack <dir> --paths.include=...` for a disk walk, or drop the key.";
13
+ const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the assets webpack's own chunks claim, in the pipeline — there is no output-directory walk for a glob to re-admit anything into. Use `npx afterpack@latest <dir> --paths.include=...` for a disk walk, or drop the key.";
14
14
  function isEmittedJs(name) {
15
15
  return !name.includes(".hot-update.") && EMITTED_JS_RE.test(name);
16
16
  }
@@ -240,6 +240,7 @@ var AfterpackWebpackPlugin = class {
240
240
  }),
241
241
  sourceType: sourceTypeForOutputFormat(outputModule ? "module" : void 0),
242
242
  hasBundlerSourcemap: typeof devtool === "string" && devtool.includes("source-map"),
243
+ receipt: { bundler: "webpack" },
243
244
  messages: { autoEnableBundlerSourcemap: "protectionMap:true but no bundler sourcemap was found; set `devtool: 'source-map'` so future builds can render original source in the map." }
244
245
  });
245
246
  const { RawSource } = compiler.webpack.sources;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afterpack/webpack",
3
- "version": "0.2.6",
3
+ "version": "1.0.0",
4
4
  "description": "webpack plugin for AfterPack: obfuscate your production JavaScript during the webpack build",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -28,15 +28,15 @@
28
28
  "webpack": "^5.0.0"
29
29
  },
30
30
  "dependencies": {
31
- "@afterpack/core": "~0.2.7",
32
- "@afterpack/integration-utils": "0.2.6"
31
+ "@afterpack/core": "~1.0.0",
32
+ "@afterpack/integration-utils": "1.0.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@biomejs/biome": "2.4.4",
36
36
  "@types/node": "^22.0.0",
37
37
  "tsdown": "^0.11.0",
38
38
  "typescript": "^5.0.0",
39
- "vitest": "^2.0.0",
39
+ "vitest": "^4.1.12",
40
40
  "webpack": "^5.0.0"
41
41
  },
42
42
  "engines": {