@afterpack/integration-utils 0.2.2 → 0.2.3
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/index.cjs +3 -18
- package/dist/index.d.cts +1 -12
- package/dist/index.d.ts +1 -12
- package/dist/index.js +3 -18
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1196,15 +1196,6 @@ const CONFIG_KEYS = [
|
|
|
1196
1196
|
item: { kind: "boolean" },
|
|
1197
1197
|
default: "true"
|
|
1198
1198
|
},
|
|
1199
|
-
{
|
|
1200
|
-
path: "allowUnobfuscated",
|
|
1201
|
-
shape: "scalar",
|
|
1202
|
-
scope: "program",
|
|
1203
|
-
tier: "free",
|
|
1204
|
-
surface: "build",
|
|
1205
|
-
item: { kind: "boolean" },
|
|
1206
|
-
default: "false"
|
|
1207
|
-
},
|
|
1208
1199
|
{
|
|
1209
1200
|
path: "key",
|
|
1210
1201
|
shape: "scalar",
|
|
@@ -1558,7 +1549,6 @@ function toPluginOptions(config) {
|
|
|
1558
1549
|
backup: read("build.backup"),
|
|
1559
1550
|
mode: read("build.mode")
|
|
1560
1551
|
}),
|
|
1561
|
-
allowUnobfuscated: read("allowUnobfuscated"),
|
|
1562
1552
|
telemetry: set({ enabled: read("telemetry.enabled") })
|
|
1563
1553
|
},
|
|
1564
1554
|
seed: read("seed"),
|
|
@@ -3813,7 +3803,7 @@ function fmtElapsed(ms) {
|
|
|
3813
3803
|
function formatPassSummary(input, style, colorGlyph = (glyph) => glyph) {
|
|
3814
3804
|
const head = style === "cli" ? colorGlyph("✓") : `[${input.label}]`;
|
|
3815
3805
|
const files = input.fileCount === 1 ? "file" : "files";
|
|
3816
|
-
const tail =
|
|
3806
|
+
const tail = input.noOpCount > 0 ? ` · ${input.noOpCount} no-op (unchanged)` : "";
|
|
3817
3807
|
return `${head} Protected ${input.fileCount} ${files} · ${fmtBytes(input.inputBytes)} → ${fmtBytes(input.outputBytes)}${tail} · ${fmtElapsed(input.elapsedMs)}`;
|
|
3818
3808
|
}
|
|
3819
3809
|
|
|
@@ -4156,7 +4146,7 @@ function fileFailure(f, source) {
|
|
|
4156
4146
|
if (reason) return reason;
|
|
4157
4147
|
return f.status === "failure" ? "empty output" : `the engine reported status "${sanitizeServerText(f.status, 32)}"`;
|
|
4158
4148
|
}
|
|
4159
|
-
if (
|
|
4149
|
+
if (f.unobfuscated === true) return "the engine could not obfuscate it and returned the original source — update @afterpack/core";
|
|
4160
4150
|
if (f.code === "" && source.trim() !== "") return sanitizeServerText(f.error) || "empty output";
|
|
4161
4151
|
return null;
|
|
4162
4152
|
}
|
|
@@ -4356,7 +4346,6 @@ async function runObfuscationPass(options) {
|
|
|
4356
4346
|
const outputs = [];
|
|
4357
4347
|
let inputBytes = 0;
|
|
4358
4348
|
let outputBytes = 0;
|
|
4359
|
-
const unobfuscatedFiles = [];
|
|
4360
4349
|
let noOp = 0;
|
|
4361
4350
|
const transformedFiles = [];
|
|
4362
4351
|
const verified = [];
|
|
@@ -4367,8 +4356,7 @@ async function runObfuscationPass(options) {
|
|
|
4367
4356
|
if (failure !== null) throw new Error(prefix(`failed to obfuscate ${f.path}: ${failure}`));
|
|
4368
4357
|
inputBytes += Buffer.byteLength(source);
|
|
4369
4358
|
outputBytes += Buffer.byteLength(f.code);
|
|
4370
|
-
if (f.
|
|
4371
|
-
else if (f.code === source) noOp += 1;
|
|
4359
|
+
if (f.code === source) noOp += 1;
|
|
4372
4360
|
else transformedFiles.push(f.path);
|
|
4373
4361
|
if (policy.protectionMap && f.protectionMap != null) protectionMapDocs.push(f.protectionMap);
|
|
4374
4362
|
verified.push({
|
|
@@ -4376,8 +4364,6 @@ async function runObfuscationPass(options) {
|
|
|
4376
4364
|
source
|
|
4377
4365
|
});
|
|
4378
4366
|
}
|
|
4379
|
-
if (unobfuscatedFiles.length > 0) if (artifactOptions.allowUnobfuscated === true) for (const name of unobfuscatedFiles) logger.warn(prefix(`${name} could not be obfuscated and SHIPPED AS CLEARTEXT (allowUnobfuscated:true). This is an engine bug — please report it.`));
|
|
4380
|
-
else throw new Error(prefix(`${unobfuscatedFiles.length} file(s) could not be obfuscated and would ship as cleartext: ${unobfuscatedFiles.join(", ")} — fix the engine or set allowUnobfuscated:true`));
|
|
4381
4367
|
const writtenFiles = [];
|
|
4382
4368
|
const emittedFiles = [];
|
|
4383
4369
|
for (const { result: f, source } of verified) {
|
|
@@ -4461,7 +4447,6 @@ async function runObfuscationPass(options) {
|
|
|
4461
4447
|
fileCount: files.length,
|
|
4462
4448
|
inputBytes,
|
|
4463
4449
|
outputBytes,
|
|
4464
|
-
unobfuscatedCount: unobfuscatedFiles.length,
|
|
4465
4450
|
noOpCount: noOp,
|
|
4466
4451
|
elapsedMs: totalMs
|
|
4467
4452
|
}, style, options.colorGlyph) + seedSuffix);
|
package/dist/index.d.cts
CHANGED
|
@@ -459,16 +459,6 @@ declare const CONFIG_KEYS: readonly [{
|
|
|
459
459
|
readonly kind: "boolean";
|
|
460
460
|
};
|
|
461
461
|
readonly default: "true";
|
|
462
|
-
}, {
|
|
463
|
-
readonly path: "allowUnobfuscated";
|
|
464
|
-
readonly shape: "scalar";
|
|
465
|
-
readonly scope: "program";
|
|
466
|
-
readonly tier: "free";
|
|
467
|
-
readonly surface: "build";
|
|
468
|
-
readonly item: {
|
|
469
|
-
readonly kind: "boolean";
|
|
470
|
-
};
|
|
471
|
-
readonly default: "false";
|
|
472
462
|
}, {
|
|
473
463
|
readonly path: "key";
|
|
474
464
|
readonly shape: "scalar";
|
|
@@ -606,7 +596,6 @@ interface AfterpackArtifactOptions {
|
|
|
606
596
|
backup?: boolean;
|
|
607
597
|
mode?: BuildMode;
|
|
608
598
|
};
|
|
609
|
-
allowUnobfuscated?: boolean;
|
|
610
599
|
telemetry?: {
|
|
611
600
|
enabled?: boolean;
|
|
612
601
|
};
|
|
@@ -976,7 +965,7 @@ interface EngineFileResult {
|
|
|
976
965
|
protectionMap?: ProtectionMap;
|
|
977
966
|
status: "success" | "failure";
|
|
978
967
|
error?: string;
|
|
979
|
-
unobfuscated
|
|
968
|
+
unobfuscated?: boolean;
|
|
980
969
|
diagnostics?: EngineDiagnostic[];
|
|
981
970
|
}
|
|
982
971
|
interface EngineBatchResult {
|
package/dist/index.d.ts
CHANGED
|
@@ -459,16 +459,6 @@ declare const CONFIG_KEYS: readonly [{
|
|
|
459
459
|
readonly kind: "boolean";
|
|
460
460
|
};
|
|
461
461
|
readonly default: "true";
|
|
462
|
-
}, {
|
|
463
|
-
readonly path: "allowUnobfuscated";
|
|
464
|
-
readonly shape: "scalar";
|
|
465
|
-
readonly scope: "program";
|
|
466
|
-
readonly tier: "free";
|
|
467
|
-
readonly surface: "build";
|
|
468
|
-
readonly item: {
|
|
469
|
-
readonly kind: "boolean";
|
|
470
|
-
};
|
|
471
|
-
readonly default: "false";
|
|
472
462
|
}, {
|
|
473
463
|
readonly path: "key";
|
|
474
464
|
readonly shape: "scalar";
|
|
@@ -606,7 +596,6 @@ interface AfterpackArtifactOptions {
|
|
|
606
596
|
backup?: boolean;
|
|
607
597
|
mode?: BuildMode;
|
|
608
598
|
};
|
|
609
|
-
allowUnobfuscated?: boolean;
|
|
610
599
|
telemetry?: {
|
|
611
600
|
enabled?: boolean;
|
|
612
601
|
};
|
|
@@ -976,7 +965,7 @@ interface EngineFileResult {
|
|
|
976
965
|
protectionMap?: ProtectionMap;
|
|
977
966
|
status: "success" | "failure";
|
|
978
967
|
error?: string;
|
|
979
|
-
unobfuscated
|
|
968
|
+
unobfuscated?: boolean;
|
|
980
969
|
diagnostics?: EngineDiagnostic[];
|
|
981
970
|
}
|
|
982
971
|
interface EngineBatchResult {
|
package/dist/index.js
CHANGED
|
@@ -907,15 +907,6 @@ const CONFIG_KEYS = [
|
|
|
907
907
|
item: { kind: "boolean" },
|
|
908
908
|
default: "true"
|
|
909
909
|
},
|
|
910
|
-
{
|
|
911
|
-
path: "allowUnobfuscated",
|
|
912
|
-
shape: "scalar",
|
|
913
|
-
scope: "program",
|
|
914
|
-
tier: "free",
|
|
915
|
-
surface: "build",
|
|
916
|
-
item: { kind: "boolean" },
|
|
917
|
-
default: "false"
|
|
918
|
-
},
|
|
919
910
|
{
|
|
920
911
|
path: "key",
|
|
921
912
|
shape: "scalar",
|
|
@@ -1269,7 +1260,6 @@ function toPluginOptions(config) {
|
|
|
1269
1260
|
backup: read("build.backup"),
|
|
1270
1261
|
mode: read("build.mode")
|
|
1271
1262
|
}),
|
|
1272
|
-
allowUnobfuscated: read("allowUnobfuscated"),
|
|
1273
1263
|
telemetry: set({ enabled: read("telemetry.enabled") })
|
|
1274
1264
|
},
|
|
1275
1265
|
seed: read("seed"),
|
|
@@ -3524,7 +3514,7 @@ function fmtElapsed(ms) {
|
|
|
3524
3514
|
function formatPassSummary(input, style, colorGlyph = (glyph) => glyph) {
|
|
3525
3515
|
const head = style === "cli" ? colorGlyph("✓") : `[${input.label}]`;
|
|
3526
3516
|
const files = input.fileCount === 1 ? "file" : "files";
|
|
3527
|
-
const tail =
|
|
3517
|
+
const tail = input.noOpCount > 0 ? ` · ${input.noOpCount} no-op (unchanged)` : "";
|
|
3528
3518
|
return `${head} Protected ${input.fileCount} ${files} · ${fmtBytes(input.inputBytes)} → ${fmtBytes(input.outputBytes)}${tail} · ${fmtElapsed(input.elapsedMs)}`;
|
|
3529
3519
|
}
|
|
3530
3520
|
|
|
@@ -3867,7 +3857,7 @@ function fileFailure(f, source) {
|
|
|
3867
3857
|
if (reason) return reason;
|
|
3868
3858
|
return f.status === "failure" ? "empty output" : `the engine reported status "${sanitizeServerText(f.status, 32)}"`;
|
|
3869
3859
|
}
|
|
3870
|
-
if (
|
|
3860
|
+
if (f.unobfuscated === true) return "the engine could not obfuscate it and returned the original source — update @afterpack/core";
|
|
3871
3861
|
if (f.code === "" && source.trim() !== "") return sanitizeServerText(f.error) || "empty output";
|
|
3872
3862
|
return null;
|
|
3873
3863
|
}
|
|
@@ -4067,7 +4057,6 @@ async function runObfuscationPass(options) {
|
|
|
4067
4057
|
const outputs = [];
|
|
4068
4058
|
let inputBytes = 0;
|
|
4069
4059
|
let outputBytes = 0;
|
|
4070
|
-
const unobfuscatedFiles = [];
|
|
4071
4060
|
let noOp = 0;
|
|
4072
4061
|
const transformedFiles = [];
|
|
4073
4062
|
const verified = [];
|
|
@@ -4078,8 +4067,7 @@ async function runObfuscationPass(options) {
|
|
|
4078
4067
|
if (failure !== null) throw new Error(prefix(`failed to obfuscate ${f.path}: ${failure}`));
|
|
4079
4068
|
inputBytes += Buffer.byteLength(source);
|
|
4080
4069
|
outputBytes += Buffer.byteLength(f.code);
|
|
4081
|
-
if (f.
|
|
4082
|
-
else if (f.code === source) noOp += 1;
|
|
4070
|
+
if (f.code === source) noOp += 1;
|
|
4083
4071
|
else transformedFiles.push(f.path);
|
|
4084
4072
|
if (policy.protectionMap && f.protectionMap != null) protectionMapDocs.push(f.protectionMap);
|
|
4085
4073
|
verified.push({
|
|
@@ -4087,8 +4075,6 @@ async function runObfuscationPass(options) {
|
|
|
4087
4075
|
source
|
|
4088
4076
|
});
|
|
4089
4077
|
}
|
|
4090
|
-
if (unobfuscatedFiles.length > 0) if (artifactOptions.allowUnobfuscated === true) for (const name of unobfuscatedFiles) logger.warn(prefix(`${name} could not be obfuscated and SHIPPED AS CLEARTEXT (allowUnobfuscated:true). This is an engine bug — please report it.`));
|
|
4091
|
-
else throw new Error(prefix(`${unobfuscatedFiles.length} file(s) could not be obfuscated and would ship as cleartext: ${unobfuscatedFiles.join(", ")} — fix the engine or set allowUnobfuscated:true`));
|
|
4092
4078
|
const writtenFiles = [];
|
|
4093
4079
|
const emittedFiles = [];
|
|
4094
4080
|
for (const { result: f, source } of verified) {
|
|
@@ -4172,7 +4158,6 @@ async function runObfuscationPass(options) {
|
|
|
4172
4158
|
fileCount: files.length,
|
|
4173
4159
|
inputBytes,
|
|
4174
4160
|
outputBytes,
|
|
4175
|
-
unobfuscatedCount: unobfuscatedFiles.length,
|
|
4176
4161
|
noOpCount: noOp,
|
|
4177
4162
|
elapsedMs: totalMs
|
|
4178
4163
|
}, style, options.colorGlyph) + seedSuffix);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afterpack/integration-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Internal shared code for the AfterPack CLI and framework plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
29
|
-
"@afterpack/protection-map": "0.2.
|
|
29
|
+
"@afterpack/protection-map": "0.2.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "2.4.4",
|