@afterpack/vite 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 @@ anything you want protected.
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 @@ afterpackVite({ 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; on in development mode (`build.mode` or `NODE_ENV=development`) when Vite emits a map |
50
- | [`protectionMap.enabled`][protectionMap.enabled] | write the Protection Map | on when Vite emits source maps |
50
+ | [`protectionMap.enabled`][protectionMap.enabled] | write the Protection Map | on when Vite 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
@@ -61,8 +61,10 @@ other option is in the [configuration reference](https://www.afterpack.dev/docs/
61
61
  [protectionMap.enabled]: https://www.afterpack.dev/docs/config#protectionMap-enabled
62
62
  [build.autorun]: https://www.afterpack.dev/docs/config#build-autorun
63
63
 
64
- The [Protection Map](https://www.afterpack.dev/docs/protection-map) is written to `.afterpack/`,
65
- which carries its own `.gitignore` and self-ignores. It contains your original source, so never
64
+ When Vite emits source maps, the [Protection Map](https://www.afterpack.dev/docs/protection-map)
65
+ is written to `.afterpack/`, which carries its own `.gitignore` and self-ignores. Without source
66
+ maps, or in CI, it is off unless `protectionMap.enabled` is `true`, which also turns on
67
+ `build.sourcemap` when your config leaves it unset. It contains your original source, so never
66
68
  deploy or commit it.
67
69
 
68
70
  Options can also live in `afterpack.json` or in `AFTERPACK_*` environment variables. The options
package/dist/index.cjs CHANGED
@@ -28,7 +28,7 @@ const __afterpack_integration_utils = __toESM(require("@afterpack/integration-ut
28
28
 
29
29
  //#region src/index.ts
30
30
  const LOCAL_KEYS = ["leg", "projectRoot"];
31
- const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the bundler's own output bundle, 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.";
31
+ const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the bundler's own output bundle, 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.";
32
32
  function afterpackVite(options = {}) {
33
33
  const resolved = (0, __afterpack_integration_utils.resolvePluginConfig)({
34
34
  label: "afterpack-vite",
@@ -178,6 +178,7 @@ function afterpackVite(options = {}) {
178
178
  ...(0, __afterpack_integration_utils.passSettings)(resolved),
179
179
  sourceType: (0, __afterpack_integration_utils.sourceTypeForBundle)(outputOptions.format, entries.values()),
180
180
  hasBundlerSourcemap: buildSourcemap,
181
+ receipt: { bundler: "vite" },
181
182
  messages: { autoEnableBundlerSourcemap: "protectionMap:true but no bundler sourcemap was found; enabled build.sourcemap so future builds can render original source in the map." }
182
183
  });
183
184
  const obfuscated = new Set();
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { applyBundleOutput, collectBundleJs, createTelemetryReporter, passSettin
5
5
 
6
6
  //#region src/index.ts
7
7
  const LOCAL_KEYS = ["leg", "projectRoot"];
8
- const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the bundler's own output bundle, 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.";
8
+ const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates the bundler's own output bundle, 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.";
9
9
  function afterpackVite(options = {}) {
10
10
  const resolved = resolvePluginConfig({
11
11
  label: "afterpack-vite",
@@ -155,6 +155,7 @@ function afterpackVite(options = {}) {
155
155
  ...passSettings(resolved),
156
156
  sourceType: sourceTypeForBundle(outputOptions.format, entries.values()),
157
157
  hasBundlerSourcemap: buildSourcemap,
158
+ receipt: { bundler: "vite" },
158
159
  messages: { autoEnableBundlerSourcemap: "protectionMap:true but no bundler sourcemap was found; enabled build.sourcemap so future builds can render original source in the map." }
159
160
  });
160
161
  const obfuscated = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afterpack/vite",
3
- "version": "0.2.6",
3
+ "version": "1.0.0",
4
4
  "description": "Vite plugin for AfterPack: obfuscate your production JavaScript during vite build",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -25,19 +25,19 @@
25
25
  "dist"
26
26
  ],
27
27
  "peerDependencies": {
28
- "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
28
+ "vite": "^6.0.0 || ^7.0.0 || ^8.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
- "vite": "^8.0.12",
40
- "vitest": "^2.0.0"
39
+ "vite": "^8.3.4",
40
+ "vitest": "^4.1.12"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=18"