@afterpack/rollup 0.2.7 → 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 +8 -6
- package/dist/index.cjs +2 -1
- package/dist/index.js +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -29,8 +29,8 @@ output directory is left untouched.
|
|
|
29
29
|
Each build writes a protection receipt to `.afterpack/receipts/`, one per output directory
|
|
30
30
|
(`.afterpack/receipts/dist.json` for `dist`). `.afterpack/` sits next to your project's lockfile,
|
|
31
31
|
`afterpack.json` or `.git` (failing those, its `package.json`), otherwise beside the build
|
|
32
|
-
directory, so the receipt never ships with your build. Run `npx afterpack verify dist` in
|
|
33
|
-
deploy step to check that what you ship is what was obfuscated.
|
|
32
|
+
directory, so the receipt never ships with your build. Run `npx afterpack@latest verify dist` in
|
|
33
|
+
your deploy step to check that what you ship is what was obfuscated.
|
|
34
34
|
|
|
35
35
|
## Options
|
|
36
36
|
|
|
@@ -45,7 +45,7 @@ afterpackRollup({ preset: "hard", seed: "git" });
|
|
|
45
45
|
| [`identifiers.reserved`][identifiers.reserved] | names never to rename | none |
|
|
46
46
|
| [`paths.exclude`][paths.exclude] | globs for files to leave untouched | none |
|
|
47
47
|
| [`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 Rollup emits a map |
|
|
48
|
-
| [`protectionMap.enabled`][protectionMap.enabled] | write the Protection Map | on when `output.sourcemap` is set |
|
|
48
|
+
| [`protectionMap.enabled`][protectionMap.enabled] | write the Protection Map | on when `output.sourcemap` is set, outside CI |
|
|
49
49
|
| [`build.autorun`][build.autorun] | `false` turns AfterPack off | `true` |
|
|
50
50
|
|
|
51
51
|
Dotted names are nested objects: `sourceMap.enabled` is `{ sourceMap: { enabled: true } }`. Every
|
|
@@ -63,9 +63,11 @@ other option is in the [configuration reference](https://www.afterpack.dev/docs/
|
|
|
63
63
|
a region are a [Pro](https://www.afterpack.dev/docs/pro) feature. In a multi-module bundle they need
|
|
64
64
|
`output.sourcemap: true`. Without it, the plugin skips them and tells you.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
outside your output directory; that directory carries its own
|
|
68
|
-
|
|
66
|
+
When `output.sourcemap` is set, the [Protection Map](https://www.afterpack.dev/docs/protection-map)
|
|
67
|
+
is written to `.afterpack/`, outside your output directory; that directory carries its own
|
|
68
|
+
`.gitignore` and self-ignores. Without source maps, or in CI, it is off unless
|
|
69
|
+
`protectionMap.enabled` is `true`. It contains your original source, so never publish or commit
|
|
70
|
+
it.
|
|
69
71
|
|
|
70
72
|
Options can also live in `afterpack.json` or in `AFTERPACK_*` environment variables. The options
|
|
71
73
|
object wins over the environment, which wins over the file. An unknown or misspelled key fails the
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ const __afterpack_core = __toESM(require("@afterpack/core"));
|
|
|
27
27
|
const __afterpack_integration_utils = __toESM(require("@afterpack/integration-utils"));
|
|
28
28
|
|
|
29
29
|
//#region src/index.ts
|
|
30
|
-
const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates Rollup's own 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.";
|
|
30
|
+
const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates Rollup's own 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.";
|
|
31
31
|
function outputDir(options) {
|
|
32
32
|
return options.dir ?? (options.file ? (0, node_path.dirname)(options.file) : void 0);
|
|
33
33
|
}
|
|
@@ -153,6 +153,7 @@ function afterpackRollup(options = {}) {
|
|
|
153
153
|
...(0, __afterpack_integration_utils.passSettings)(resolved),
|
|
154
154
|
sourceType: (0, __afterpack_integration_utils.sourceTypeForBundle)(outputOptions.format, entries.values()),
|
|
155
155
|
hasBundlerSourcemap: Boolean(outputOptions.sourcemap),
|
|
156
|
+
receipt: { bundler: "rollup" },
|
|
156
157
|
messages: { autoEnableBundlerSourcemap: "protectionMap:true but no bundler sourcemap was found; set `output.sourcemap: true` so future builds can render original source in the map." }
|
|
157
158
|
});
|
|
158
159
|
const obfuscated = new Set();
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { processBatch, version } from "@afterpack/core";
|
|
|
4
4
|
import { applyBundleOutput, collectBundleJs, createTelemetryReporter, passSettings, prepareHashSalt, readEngineVersion, regenerateCompressedSiblings, reportPolicySaltBits, resolveClientIdentity, resolvePluginConfig, runObfuscationPass, saltSettings, scanDirectives, sourceTypeForBundle, stripBundleCssSourceMaps, unsaltedAssetsWarning, writeDeferredProtectionReceipt } from "@afterpack/integration-utils";
|
|
5
5
|
|
|
6
6
|
//#region src/index.ts
|
|
7
|
-
const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates Rollup's own 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.";
|
|
7
|
+
const PATHS_INCLUDE_UNSUPPORTED = "this plugin obfuscates Rollup's own 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.";
|
|
8
8
|
function outputDir(options) {
|
|
9
9
|
return options.dir ?? (options.file ? dirname(options.file) : void 0);
|
|
10
10
|
}
|
|
@@ -130,6 +130,7 @@ function afterpackRollup(options = {}) {
|
|
|
130
130
|
...passSettings(resolved),
|
|
131
131
|
sourceType: sourceTypeForBundle(outputOptions.format, entries.values()),
|
|
132
132
|
hasBundlerSourcemap: Boolean(outputOptions.sourcemap),
|
|
133
|
+
receipt: { bundler: "rollup" },
|
|
133
134
|
messages: { autoEnableBundlerSourcemap: "protectionMap:true but no bundler sourcemap was found; set `output.sourcemap: true` so future builds can render original source in the map." }
|
|
134
135
|
});
|
|
135
136
|
const obfuscated = new Set();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afterpack/rollup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Rollup plugin for AfterPack: obfuscate your JavaScript output during the Rollup build",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"rollup": "^3.0.0 || ^4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@afterpack/core": "~0.
|
|
32
|
-
"@afterpack/integration-utils": "0.
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"rollup": "^4.0.0",
|
|
38
38
|
"tsdown": "^0.11.0",
|
|
39
39
|
"typescript": "^5.0.0",
|
|
40
|
-
"vitest": "^
|
|
40
|
+
"vitest": "^4.1.12"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18"
|