File tree Expand file tree Collapse file tree 5 files changed +17
-17
lines changed
Expand file tree Collapse file tree 5 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 1515 "test:coverage" : " jest --forceExit --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura --coverageReporters=html --coverageReporters=json"
1616 },
1717 "dependencies" : {
18- "@iarna/ toml" : " 2.2.5 " ,
18+ "smol- toml" : " ^1.6.1 " ,
1919 "@yarnpkg/fslib" : " 2.10.1" ,
2020 "@yarnpkg/libzip" : " 2.2.4" ,
2121 "chalk" : " ^4.1.2" ,
Original file line number Diff line number Diff line change 88 * Python files.
99 */
1010
11- import * as TOML from '@iarna/ toml' ;
11+ import * as TOML from 'smol- toml' ;
1212import * as JSONC from 'jsonc-parser' ;
1313import {
1414 AbstractCancellationTokenSource ,
@@ -1072,9 +1072,9 @@ export class AnalyzerService {
10721072 private _parsePyprojectTomlFile ( pyprojectPath : string ) : object | undefined {
10731073 return this . _attemptParseFile ( pyprojectPath , ( fileContents , attemptCount ) => {
10741074 try {
1075- const configObj = TOML . parse ( fileContents ) ;
1076- if ( configObj && configObj . tool && ( configObj . tool as TOML . JsonMap ) . pyright ) {
1077- return ( configObj . tool as TOML . JsonMap ) . pyright as object ;
1075+ const configObj = TOML . parse ( fileContents ) as Record < string , any > ;
1076+ if ( configObj && configObj . tool && configObj . tool . pyright ) {
1077+ return configObj . tool . pyright as object ;
10781078 }
10791079 } catch ( e : any ) {
10801080 this . _console . error ( `Pyproject file parse attempt ${ attemptCount } error: ${ JSON . stringify ( e ) } ` ) ;
Original file line number Diff line number Diff line change 4646 "webpack-cli" : " ^4.9.1"
4747 },
4848 "dependencies" : {
49- "@iarna/ toml" : " ^2.2.5 " ,
49+ "smol- toml" : " ^1.6.1 " ,
5050 "command-exists" : " ^1.2.9" ,
5151 "commander" : " ^9.2.0" ,
5252 "diff" : " ^5.0.0" ,
Original file line number Diff line number Diff line change 1- import * as TOML from '@iarna/ toml' ;
1+ import * as TOML from 'smol- toml' ;
22import * as JSONC from 'jsonc-parser' ;
33import { findPythonSearchPaths , getTypeShedFallbackPath } from 'pyright-internal/analyzer/pythonPathUtils' ;
44
@@ -427,14 +427,14 @@ export class ScipPyrightConfig {
427427 return this . _attemptParseFile ( pyprojectPath , ( fileContents , attemptCount ) => {
428428 try {
429429 // First, try and load tool.scip section
430- const configObj = TOML . parse ( fileContents ) ;
431- if ( configObj && configObj . tool && ( configObj . tool as TOML . JsonMap ) . scip ) {
432- return ( configObj . tool as TOML . JsonMap ) . scip as object ;
430+ const configObj = TOML . parse ( fileContents ) as Record < string , any > ;
431+ if ( configObj && configObj . tool && configObj . tool . scip ) {
432+ return configObj . tool . scip as object ;
433433 }
434434
435435 // Fall back to tool.pyright section
436- if ( configObj && configObj . tool && ( configObj . tool as TOML . JsonMap ) . pyright ) {
437- return ( configObj . tool as TOML . JsonMap ) . pyright as object ;
436+ if ( configObj && configObj . tool && configObj . tool . pyright ) {
437+ return configObj . tool . pyright as object ;
438438 }
439439 } catch ( e : any ) {
440440 this . _console . error ( `Pyproject file parse attempt ${ attemptCount } error: ${ JSON . stringify ( e ) } ` ) ;
Original file line number Diff line number Diff line change 11import * as child_process from 'child_process' ;
22import * as path from 'path' ;
3- import * as TOML from '@iarna/ toml' ;
3+ import * as TOML from 'smol- toml' ;
44import { Event } from 'vscode-languageserver/lib/common/api' ;
55
66import { Program } from 'pyright-internal/analyzer/program' ;
@@ -39,18 +39,18 @@ export class Indexer {
3939 try {
4040 const pyprojectTomlContents = getPyprojectTomlContents ( ) ;
4141 if ( pyprojectTomlContents ) {
42- const tomlMap = TOML . parse ( pyprojectTomlContents ) ;
42+ const tomlMap = TOML . parse ( pyprojectTomlContents ) as Record < string , any > ;
4343 // See: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#specification
44- let project = tomlMap [ 'project' ] as TOML . JsonMap | undefined ;
44+ let project = tomlMap [ 'project' ] ;
4545 if ( project ) {
4646 name = project [ 'name' ] ;
4747 version = project [ 'version' ] ;
4848 }
4949 if ( ! name || ! version ) {
5050 // See: https://python-poetry.org/docs/pyproject/
51- let tool = tomlMap [ 'tool' ] as TOML . JsonMap | undefined ;
51+ let tool = tomlMap [ 'tool' ] ;
5252 if ( tool ) {
53- let toolPoetry = tool [ 'poetry' ] as TOML . JsonMap | undefined ;
53+ let toolPoetry = tool [ 'poetry' ] ;
5454 if ( toolPoetry ) {
5555 name = name ?? toolPoetry [ 'name' ] ;
5656 version = version ?? toolPoetry [ 'version' ] ;
You can’t perform that action at this time.
0 commit comments