Ver código fonte

feat(cli): force runtime resolution in pkg builds

imccyu 1 mês atrás
pai
commit
c917a4e0bd
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      apps/cli/src/profile-boot.ts

+ 3 - 2
apps/cli/src/profile-boot.ts

@@ -265,7 +265,7 @@ export interface RunProfileOptions {
   patchFiles: readonly string[]
   patchFiles: readonly string[]
   /** The invocation's inner arguments, handed to the tree through `ctx.cmdlineArgs`. */
   /** The invocation's inner arguments, handed to the tree through `ctx.cmdlineArgs`. */
   args: readonly string[]
   args: readonly string[]
-  /** Module fallback backend; production launchers omit it and retain link materialization. */
+  /** Module fallback backend; pkg executables always use runtime resolution. */
   resolutionMode?: ProfileResolutionMode
   resolutionMode?: ProfileResolutionMode
 }
 }
 
 
@@ -301,7 +301,8 @@ export async function runProfile(options: RunProfileOptions): Promise<{ ctx: Con
     (message) => { process.stderr.write(`${NAME}: ${message}\n`) },
     (message) => { process.stderr.write(`${NAME}: ${message}\n`) },
   )
   )
 
 
-  const resolutionMode = options.resolutionMode ?? 'link'
+  const packaged = (process as NodeJS.Process & { pkg?: unknown }).pkg !== undefined
+  const resolutionMode = packaged ? 'runtime' : options.resolutionMode ?? 'link'
   const composed = await composeProfile(
   const composed = await composeProfile(
     options.profile, options.patchFiles, resolutionMode, options.fromDefaultProfile,
     options.profile, options.patchFiles, resolutionMode, options.fromDefaultProfile,
   )
   )