|
1 | 1 | import { readFile } from 'node:fs/promises'; |
2 | | -import { isAbsolute, join, resolve } from 'node:path'; |
| 2 | +import { join, resolve } from 'node:path'; |
3 | 3 |
|
4 | 4 | import type { TargetRegistry } from '../adapters/registry.ts'; |
5 | 5 | import { digest } from '../core/digest.ts'; |
@@ -64,18 +64,11 @@ interface LaunchCandidate { |
64 | 64 | readonly target: string; |
65 | 65 | } |
66 | 66 |
|
67 | | -const normalizedStdioArgument = ( |
| 67 | +const normalizedStdioEntry = ( |
68 | 68 | value: string, |
69 | 69 | artifactRoot: string, |
70 | 70 | cwd: string, |
71 | 71 | ): string => { |
72 | | - if ( |
73 | | - !isAbsolute(value) && |
74 | | - !value.startsWith('./') && |
75 | | - !value.startsWith('../') && |
76 | | - !value.includes('/') && |
77 | | - !value.includes('\\') |
78 | | - ) return value; |
79 | 72 | const resolved = resolve(cwd, value); |
80 | 73 | return isInsideOrEqual(artifactRoot, resolved) ? resolved : value; |
81 | 74 | }; |
@@ -137,10 +130,12 @@ const launchIdentityOf = async ( |
137 | 130 | const cwd = resolved.cwd === undefined |
138 | 131 | ? artifactRoot |
139 | 132 | : assertInside(artifactRoot, resolve(artifactRoot, resolved.cwd)); |
| 133 | + const [entry, ...args] = resolved.args; |
140 | 134 | return digest({ |
141 | | - args: resolved.args.map((argument) => normalizedStdioArgument(argument, artifactRoot, cwd)), |
| 135 | + args, |
142 | 136 | command: resolved.command, |
143 | 137 | cwd, |
| 138 | + entry: entry === undefined ? null : normalizedStdioEntry(entry, artifactRoot, cwd), |
144 | 139 | env: resolved.env ?? {}, |
145 | 140 | kind: 'stdio', |
146 | 141 | }); |
|
0 commit comments