File tree Expand file tree Collapse file tree
packages/http-client-python/eng/scripts/setup Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,21 +14,14 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
1414const compiledPath = join ( __dirname , "../../../dist/scripts/setup/install.js" ) ;
1515
1616try {
17+ await import ( "./install.ts" ) ;
18+ } catch ( err ) {
19+ if ( err ?. code !== "ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING" ) {
20+ throw err ;
21+ }
1722 if ( existsSync ( compiledPath ) ) {
18- // Installed from npm package: use pre-compiled JavaScript.
19- // Use pathToFileURL so Windows absolute paths (D:\...) are valid ESM URLs.
2023 await import ( pathToFileURL ( compiledPath ) . href ) ;
2124 } else {
22- // Development context: TypeScript source works via native type stripping.
23- await import ( "./install.ts" ) ;
24- }
25- } catch ( err ) {
26- if ( err ?. code === "ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING" ) {
27- // Running from node_modules without pre-compiled JS — this shouldn't
28- // happen for a properly built package, but fail gracefully rather than
29- // blocking the install.
3025 console . log ( "Python environment setup skipped: run 'npm run build' first." ) ; // eslint-disable-line no-console
31- } else {
32- throw err ;
3326 }
3427}
Original file line number Diff line number Diff line change @@ -14,21 +14,14 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
1414const compiledPath = join ( __dirname , "../../../dist/scripts/setup/prepare.js" ) ;
1515
1616try {
17+ await import ( "./prepare.ts" ) ;
18+ } catch ( err ) {
19+ if ( err ?. code !== "ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING" ) {
20+ throw err ;
21+ }
1722 if ( existsSync ( compiledPath ) ) {
18- // Installed from npm package: use pre-compiled JavaScript.
19- // Use pathToFileURL so Windows absolute paths (D:\...) are valid ESM URLs.
2023 await import ( pathToFileURL ( compiledPath ) . href ) ;
2124 } else {
22- // Development context: TypeScript source works via native type stripping.
23- await import ( "./prepare.ts" ) ;
24- }
25- } catch ( err ) {
26- if ( err ?. code === "ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING" ) {
27- // Running from node_modules without pre-compiled JS — this shouldn't
28- // happen for a properly built package, but fail gracefully rather than
29- // blocking the install.
3025 console . log ( "Python environment prepare skipped: run 'npm run build' first." ) ; // eslint-disable-line no-console
31- } else {
32- throw err ;
3326 }
3427}
You can’t perform that action at this time.
0 commit comments