@afterpack/integration-utils 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/dist/index.cjs +44 -5
- package/dist/index.js +44 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2297,7 +2297,7 @@ function reportNotices(raw, logger, prefix = (m) => m) {
|
|
|
2297
2297
|
|
|
2298
2298
|
//#endregion
|
|
2299
2299
|
//#region src/compat.ts
|
|
2300
|
-
const MIN_CORE_VERSION = "0.
|
|
2300
|
+
const MIN_CORE_VERSION = "1.0.0";
|
|
2301
2301
|
const SOURCE_TYPE_MIN_CORE_VERSION = "0.2.3";
|
|
2302
2302
|
const FILE_SOURCE_TYPE_MIN_CORE_VERSION = "0.2.5";
|
|
2303
2303
|
const CORE_PACKAGE = "@afterpack/core";
|
|
@@ -2327,15 +2327,43 @@ function ownPackage(moduleUrl) {
|
|
|
2327
2327
|
return null;
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
+
function corePackageJsonPath(moduleUrl) {
|
|
2331
|
+
const require$1 = (0, node_module.createRequire)(moduleUrl);
|
|
2332
|
+
try {
|
|
2333
|
+
return require$1.resolve(`${CORE_PACKAGE}/package.json`);
|
|
2334
|
+
} catch {}
|
|
2335
|
+
try {
|
|
2336
|
+
let dir = (0, node_path.dirname)(require$1.resolve(CORE_PACKAGE));
|
|
2337
|
+
for (;;) {
|
|
2338
|
+
const path = findUpward(dir, "package.json");
|
|
2339
|
+
if (!path) return null;
|
|
2340
|
+
if (readPackageJson(path)?.name === CORE_PACKAGE) return path;
|
|
2341
|
+
const parent = (0, node_path.dirname)((0, node_path.dirname)(path));
|
|
2342
|
+
if (parent === (0, node_path.dirname)(path)) return null;
|
|
2343
|
+
dir = parent;
|
|
2344
|
+
}
|
|
2345
|
+
} catch {
|
|
2346
|
+
return null;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2330
2349
|
function installedCoreVersion(moduleUrl) {
|
|
2331
2350
|
try {
|
|
2332
|
-
const path = (
|
|
2333
|
-
const pkg = readPackageJson(path);
|
|
2351
|
+
const path = corePackageJsonPath(moduleUrl);
|
|
2352
|
+
const pkg = path ? readPackageJson(path) : null;
|
|
2334
2353
|
return pkg?.name === CORE_PACKAGE ? safeVersionString(pkg.version) : null;
|
|
2335
2354
|
} catch {
|
|
2336
2355
|
return null;
|
|
2337
2356
|
}
|
|
2338
2357
|
}
|
|
2358
|
+
function installedEngineVersion(packageVersion, engineVersion) {
|
|
2359
|
+
const pkg = safeVersionString(packageVersion);
|
|
2360
|
+
const engine = safeVersionString(engineVersion);
|
|
2361
|
+
if (pkg === null) return engine;
|
|
2362
|
+
if (engine === null) return pkg;
|
|
2363
|
+
const a = releaseTriple(pkg);
|
|
2364
|
+
const b = releaseTriple(engine);
|
|
2365
|
+
return a && b && a.every((part, i) => part === b[i]) ? pkg : engine;
|
|
2366
|
+
}
|
|
2339
2367
|
const identities = new Map();
|
|
2340
2368
|
function resolveClientIdentity(moduleUrl) {
|
|
2341
2369
|
const key = String(moduleUrl);
|
|
@@ -5564,6 +5592,10 @@ function removeBundlerSourceMaps(input) {
|
|
|
5564
5592
|
removeSourceMaps(bundlerMapsToRemove(input), label);
|
|
5565
5593
|
if (sweepDir$1 != null && !policy.sourceMap) stripCssSourceMappingURLs(collectStylesheets(sweepDir$1));
|
|
5566
5594
|
}
|
|
5595
|
+
function describeEngine(source, version) {
|
|
5596
|
+
if (source === "cloud") return version ? `cloud engine ${version}` : "the cloud engine";
|
|
5597
|
+
return version ? `engine ${version}` : null;
|
|
5598
|
+
}
|
|
5567
5599
|
function describeLevel(preset, complexity) {
|
|
5568
5600
|
if (complexity === void 0) return `preset "${preset ?? DEFAULT_PRESET}"`;
|
|
5569
5601
|
if (preset === void 0) return `complexity target ${complexity}`;
|
|
@@ -5751,7 +5783,12 @@ async function runObfuscationPass(options) {
|
|
|
5751
5783
|
input.source = source;
|
|
5752
5784
|
}
|
|
5753
5785
|
}
|
|
5754
|
-
|
|
5786
|
+
const localEngineDisplay = installedEngineVersion(options.client?.coreVersion ?? null, localEngineVersion);
|
|
5787
|
+
const announcedEngine = isCloudBuild(env) ? describeEngine("cloud", saltEngine?.probedCloudVersion ?? null) : describeEngine("local", localEngineDisplay);
|
|
5788
|
+
if (style !== "cli") {
|
|
5789
|
+
const engineClause = announcedEngine ? ` with ${announcedEngine}` : "";
|
|
5790
|
+
logger.log(prefix(`obfuscating ${inputs.length} file(s) at ${describeLevel(options.preset, options.complexity)}${engineClause} ...`));
|
|
5791
|
+
}
|
|
5755
5792
|
const engineStartedAt = Date.now();
|
|
5756
5793
|
const prepMs = engineStartedAt - passStartedAt;
|
|
5757
5794
|
const context = buildContext(git, {
|
|
@@ -5977,6 +6014,8 @@ async function runObfuscationPass(options) {
|
|
|
5977
6014
|
};
|
|
5978
6015
|
const summaryVerbosity = resolveDiagnosticsVerbosity(options.diagnostics);
|
|
5979
6016
|
const seedSuffix = summaryVerbosity === "all" ? ` · seed ${seed} (${resolvedSeed.mismatch ? "MISMATCH" : resolvedSeed.origin})` : "";
|
|
6017
|
+
const ranEngine = engineSource === null ? null : describeEngine(engineSource, engineSource === "cloud" ? safeVersionString(batch.engineVersion) : localEngineDisplay);
|
|
6018
|
+
const engineSuffix = ranEngine !== null && (style === "cli" || ranEngine !== announcedEngine) ? ` · ${ranEngine}` : "";
|
|
5980
6019
|
logger.log(formatPassSummary({
|
|
5981
6020
|
label,
|
|
5982
6021
|
fileCount: files.length,
|
|
@@ -5984,7 +6023,7 @@ async function runObfuscationPass(options) {
|
|
|
5984
6023
|
outputBytes,
|
|
5985
6024
|
noOpCount: noOp,
|
|
5986
6025
|
elapsedMs: totalMs
|
|
5987
|
-
}, style, options.colorGlyph) + seedSuffix);
|
|
6026
|
+
}, style, options.colorGlyph) + engineSuffix + seedSuffix);
|
|
5988
6027
|
return {
|
|
5989
6028
|
fileCount: files.length,
|
|
5990
6029
|
protectionMapPath,
|
package/dist/index.js
CHANGED
|
@@ -2009,7 +2009,7 @@ function reportNotices(raw, logger, prefix = (m) => m) {
|
|
|
2009
2009
|
|
|
2010
2010
|
//#endregion
|
|
2011
2011
|
//#region src/compat.ts
|
|
2012
|
-
const MIN_CORE_VERSION = "0.
|
|
2012
|
+
const MIN_CORE_VERSION = "1.0.0";
|
|
2013
2013
|
const SOURCE_TYPE_MIN_CORE_VERSION = "0.2.3";
|
|
2014
2014
|
const FILE_SOURCE_TYPE_MIN_CORE_VERSION = "0.2.5";
|
|
2015
2015
|
const CORE_PACKAGE = "@afterpack/core";
|
|
@@ -2039,15 +2039,43 @@ function ownPackage(moduleUrl) {
|
|
|
2039
2039
|
return null;
|
|
2040
2040
|
}
|
|
2041
2041
|
}
|
|
2042
|
+
function corePackageJsonPath(moduleUrl) {
|
|
2043
|
+
const require = createRequire(moduleUrl);
|
|
2044
|
+
try {
|
|
2045
|
+
return require.resolve(`${CORE_PACKAGE}/package.json`);
|
|
2046
|
+
} catch {}
|
|
2047
|
+
try {
|
|
2048
|
+
let dir = dirname(require.resolve(CORE_PACKAGE));
|
|
2049
|
+
for (;;) {
|
|
2050
|
+
const path = findUpward(dir, "package.json");
|
|
2051
|
+
if (!path) return null;
|
|
2052
|
+
if (readPackageJson(path)?.name === CORE_PACKAGE) return path;
|
|
2053
|
+
const parent = dirname(dirname(path));
|
|
2054
|
+
if (parent === dirname(path)) return null;
|
|
2055
|
+
dir = parent;
|
|
2056
|
+
}
|
|
2057
|
+
} catch {
|
|
2058
|
+
return null;
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2042
2061
|
function installedCoreVersion(moduleUrl) {
|
|
2043
2062
|
try {
|
|
2044
|
-
const path =
|
|
2045
|
-
const pkg = readPackageJson(path);
|
|
2063
|
+
const path = corePackageJsonPath(moduleUrl);
|
|
2064
|
+
const pkg = path ? readPackageJson(path) : null;
|
|
2046
2065
|
return pkg?.name === CORE_PACKAGE ? safeVersionString(pkg.version) : null;
|
|
2047
2066
|
} catch {
|
|
2048
2067
|
return null;
|
|
2049
2068
|
}
|
|
2050
2069
|
}
|
|
2070
|
+
function installedEngineVersion(packageVersion, engineVersion) {
|
|
2071
|
+
const pkg = safeVersionString(packageVersion);
|
|
2072
|
+
const engine = safeVersionString(engineVersion);
|
|
2073
|
+
if (pkg === null) return engine;
|
|
2074
|
+
if (engine === null) return pkg;
|
|
2075
|
+
const a = releaseTriple(pkg);
|
|
2076
|
+
const b = releaseTriple(engine);
|
|
2077
|
+
return a && b && a.every((part, i) => part === b[i]) ? pkg : engine;
|
|
2078
|
+
}
|
|
2051
2079
|
const identities = new Map();
|
|
2052
2080
|
function resolveClientIdentity(moduleUrl) {
|
|
2053
2081
|
const key = String(moduleUrl);
|
|
@@ -5276,6 +5304,10 @@ function removeBundlerSourceMaps(input) {
|
|
|
5276
5304
|
removeSourceMaps(bundlerMapsToRemove(input), label);
|
|
5277
5305
|
if (sweepDir$1 != null && !policy.sourceMap) stripCssSourceMappingURLs(collectStylesheets(sweepDir$1));
|
|
5278
5306
|
}
|
|
5307
|
+
function describeEngine(source, version) {
|
|
5308
|
+
if (source === "cloud") return version ? `cloud engine ${version}` : "the cloud engine";
|
|
5309
|
+
return version ? `engine ${version}` : null;
|
|
5310
|
+
}
|
|
5279
5311
|
function describeLevel(preset, complexity) {
|
|
5280
5312
|
if (complexity === void 0) return `preset "${preset ?? DEFAULT_PRESET}"`;
|
|
5281
5313
|
if (preset === void 0) return `complexity target ${complexity}`;
|
|
@@ -5463,7 +5495,12 @@ async function runObfuscationPass(options) {
|
|
|
5463
5495
|
input.source = source;
|
|
5464
5496
|
}
|
|
5465
5497
|
}
|
|
5466
|
-
|
|
5498
|
+
const localEngineDisplay = installedEngineVersion(options.client?.coreVersion ?? null, localEngineVersion);
|
|
5499
|
+
const announcedEngine = isCloudBuild(env) ? describeEngine("cloud", saltEngine?.probedCloudVersion ?? null) : describeEngine("local", localEngineDisplay);
|
|
5500
|
+
if (style !== "cli") {
|
|
5501
|
+
const engineClause = announcedEngine ? ` with ${announcedEngine}` : "";
|
|
5502
|
+
logger.log(prefix(`obfuscating ${inputs.length} file(s) at ${describeLevel(options.preset, options.complexity)}${engineClause} ...`));
|
|
5503
|
+
}
|
|
5467
5504
|
const engineStartedAt = Date.now();
|
|
5468
5505
|
const prepMs = engineStartedAt - passStartedAt;
|
|
5469
5506
|
const context = buildContext(git, {
|
|
@@ -5689,6 +5726,8 @@ async function runObfuscationPass(options) {
|
|
|
5689
5726
|
};
|
|
5690
5727
|
const summaryVerbosity = resolveDiagnosticsVerbosity(options.diagnostics);
|
|
5691
5728
|
const seedSuffix = summaryVerbosity === "all" ? ` · seed ${seed} (${resolvedSeed.mismatch ? "MISMATCH" : resolvedSeed.origin})` : "";
|
|
5729
|
+
const ranEngine = engineSource === null ? null : describeEngine(engineSource, engineSource === "cloud" ? safeVersionString(batch.engineVersion) : localEngineDisplay);
|
|
5730
|
+
const engineSuffix = ranEngine !== null && (style === "cli" || ranEngine !== announcedEngine) ? ` · ${ranEngine}` : "";
|
|
5692
5731
|
logger.log(formatPassSummary({
|
|
5693
5732
|
label,
|
|
5694
5733
|
fileCount: files.length,
|
|
@@ -5696,7 +5735,7 @@ async function runObfuscationPass(options) {
|
|
|
5696
5735
|
outputBytes,
|
|
5697
5736
|
noOpCount: noOp,
|
|
5698
5737
|
elapsedMs: totalMs
|
|
5699
|
-
}, style, options.colorGlyph) + seedSuffix);
|
|
5738
|
+
}, style, options.colorGlyph) + engineSuffix + seedSuffix);
|
|
5700
5739
|
return {
|
|
5701
5740
|
fileCount: files.length,
|
|
5702
5741
|
protectionMapPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afterpack/integration-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Internal shared code for the AfterPack CLI and framework plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
29
|
-
"@afterpack/protection-map": "0.
|
|
29
|
+
"@afterpack/protection-map": "1.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@biomejs/biome": "2.4.4",
|
|
33
33
|
"@types/node": "^22.0.0",
|
|
34
34
|
"tsdown": "^0.11.0",
|
|
35
35
|
"typescript": "^5.0.0",
|
|
36
|
-
"vitest": "^
|
|
36
|
+
"vitest": "^4.1.12"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=18"
|