@@ -3656,7 +3656,7 @@ test(
36563656const fs = require("node:fs");
36573657const path = require("node:path");
36583658const args = process.argv.slice(2);
3659- fs.appendFileSync(${ JSON . stringify ( logPath ) } , JSON.stringify({ args, cwd: process.cwd(), cache: process.env.XDG_CACHE_HOME, jitiFsCache: process.env.JITI_FS_CACHE, offline: process.env.npm_config_offline }) + "\\n");
3659+ fs.appendFileSync(${ JSON . stringify ( logPath ) } , JSON.stringify({ args, cwd: process.cwd(), cache: process.env.XDG_CACHE_HOME, jitiFsCache: process.env.JITI_FS_CACHE, offline: process.env.PNPM_CONFIG_OFFLINE, legacyOffline: process.env. npm_config_offline, registry: process.env.PNPM_CONFIG_REGISTRY }) + "\\n");
36603660if (args[0] === "install") {
36613661 fs.mkdirSync("node_modules", { recursive: true });
36623662 if (process.cwd().includes(".__clawsweeper_pnpm_helper_cache__")) {
@@ -3678,7 +3678,13 @@ if (args[0] === "install") {
36783678 }
36793679}
36803680if (args.at(-1) === "first" || args.at(-1) === "second") {
3681- const marker = path.join(process.env.XDG_CACHE_HOME, "pnpm", "dlx", "a6769c4cf56f1a323ac28af3b6359f2b", "marker");
3681+ const registry = process.env.PNPM_CONFIG_REGISTRY;
3682+ const cacheKey = require("node:crypto")
3683+ .createHash("sha256")
3684+ .update(JSON.stringify([["[email protected] "], [["@jsr", "https://npm.jsr.io/"], ["default", registry]]])) 3685+ .digest("hex")
3686+ .slice(0, 32);
3687+ const marker = path.join(process.env.XDG_CACHE_HOME, "pnpm", "dlx", cacheKey, "marker");
36823688 if (fs.readFileSync(marker, "utf8") !== "frozen helper") process.exit(42);
36833689 const knip = path.join(path.dirname(marker), "pinned", "node_modules", ".bin", "knip");
36843690 if (!fs.readFileSync(knip, "utf8").includes("JITI_FS_CACHE=0")) process.exit(43);
@@ -3751,6 +3757,8 @@ if (args[0] === "enable") {
37513757 assert . equal ( validations [ 0 ] . cache , validations [ 1 ] . cache ) ;
37523758 assert . ok ( validations . every ( ( { jitiFsCache } ) => jitiFsCache === undefined ) ) ;
37533759 assert . ok ( validations . every ( ( { offline } ) => offline === "true" ) ) ;
3760+ assert . ok ( validations . every ( ( { legacyOffline } ) => legacyOffline === "true" ) ) ;
3761+ assert . ok ( validations . every ( ( { registry } ) => registry === "https://registry.npmjs.org/" ) ) ;
37543762
37553763 withCommandOverridesUnset ( [ "corepack" , "pnpm" ] , ( ) =>
37563764 withPathOnlyPrefix ( hostBin , ( ) => {
@@ -3765,6 +3773,18 @@ if (args[0] === "enable") {
37653773 process . env . npm_config_registry = "https://registry.example.invalid:8443/" ;
37663774 try {
37673775 prepareTargetToolchain ( cwd , options , [ "pnpm check:changed" ] ) ;
3776+ assert . deepEqual ( runAllowedValidationCommands ( [ "pnpm first" ] , cwd , options ) , [
3777+ "pnpm first" ,
3778+ ] ) ;
3779+ const customValidation = fs
3780+ . readFileSync ( logPath , "utf8" )
3781+ . trim ( )
3782+ . split ( / \r ? \n / )
3783+ . map ( ( line ) => JSON . parse ( line ) )
3784+ . findLast ( ( { args } ) => args . at ( - 1 ) === "first" ) ;
3785+ assert . equal ( customValidation . registry , "https://registry.example.invalid:8443/" ) ;
3786+ assert . equal ( customValidation . offline , "true" ) ;
3787+ assert . equal ( customValidation . legacyOffline , "true" ) ;
37683788 } finally {
37693789 restoreEnv ( "npm_config_registry" , previousRegistry ) ;
37703790 }
@@ -3789,6 +3809,11 @@ if (args[0] === "enable") {
37893809 fs . writeFileSync ( path . join ( cwd , "README.md" ) , "# Docs-only repair\n" ) ;
37903810 git ( cwd , "add" , "README.md" ) ;
37913811 prepareTargetToolchain ( cwd , options , [ "pnpm check:changed" ] ) ;
3812+ const untrackedSource = path . join ( cwd , "src" , "new-feature" , "new.ts" ) ;
3813+ fs . mkdirSync ( path . dirname ( untrackedSource ) , { recursive : true } ) ;
3814+ fs . writeFileSync ( untrackedSource , "export const untracked = true;\n" ) ;
3815+ prepareTargetToolchain ( cwd , options , [ "pnpm check:changed" ] ) ;
3816+ fs . rmSync ( untrackedSource ) ;
37923817 const subsequentPrefetches = fs
37933818 . readFileSync ( logPath , "utf8" )
37943819 . split ( / \r ? \n / )
@@ -3800,7 +3825,7 @@ if (args[0] === "enable") {
38003825 invocation . cwd . includes ( ".__clawsweeper_pnpm_helper_cache__" )
38013826 ) ;
38023827 } ) . length ;
3803- assert . equal ( subsequentPrefetches , previousPrefetches ) ;
3828+ assert . equal ( subsequentPrefetches , previousPrefetches + 1 ) ;
38043829 } ) ,
38053830 ) ;
38063831 } ,
0 commit comments