File tree Expand file tree Collapse file tree 4 files changed +24
-14
lines changed Expand file tree Collapse file tree 4 files changed +24
-14
lines changed Original file line number Diff line number Diff line change 3434 "lerna" : " 4.0.0" ,
3535 "prettier" : " 2.8.7" ,
3636 "ts-jest" : " 28.0.8" ,
37- "typescript" : " 4.3.5 "
37+ "typescript" : " 4.9.4 "
3838 },
3939 "overrides" : {
4040 "gifwrap" : " ^0.10.1"
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ export const loadSVG = (svg: string) => {
1616 } )
1717}
1818
19+ export function isError ( error : unknown ) : error is NodeJS . ErrnoException {
20+ return error instanceof Error
21+ }
22+
1923export async function locateFiles ( input : string ) : Promise < string [ ] > {
2024 const enhancedInput = expandTilde ( input )
2125 let globPattern = enhancedInput
@@ -34,8 +38,10 @@ export async function locateFiles(input: string): Promise<string[]> {
3438 globPattern = `${ path . resolve ( enhancedInput ) } /*`
3539 }
3640 } catch ( err ) {
37- if ( err . code !== 'ENOENT' ) {
38- throw err
41+ if ( isError ( err ) && err instanceof TypeError ) {
42+ if ( err . code === 'ENOENT' ) {
43+ throw err
44+ }
3945 }
4046 }
4147
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import chalk from 'chalk'
1212import { Palette } from '@vibrant/color'
1313import { OptionDefinition } from 'command-line-args'
1414
15- import { locateFiles } from './helpers'
15+ import { isError , locateFiles } from './helpers'
1616
1717export { loadSVG , parseColor } from './helpers'
1818
@@ -143,10 +143,12 @@ export async function resolvePlugins(
143143
144144 return { ...plugin , Plugin : Plugin . default }
145145 } catch ( err ) {
146- if ( err . code === 'MODULE_NOT_FOUND' ) {
147- throw new Error (
148- `Unable to load plugin "${ moduleName } ". Try installing it via:\n\n npm install ${ moduleName } `
149- )
146+ if ( isError ( err ) && err instanceof TypeError ) {
147+ if ( err . code === 'MODULE_NOT_FOUND' ) {
148+ throw new Error (
149+ `Unable to load plugin "${ moduleName } ". Try installing it via:\n\n npm install ${ moduleName } `
150+ )
151+ }
150152 }
151153 throw err
152154 }
@@ -215,8 +217,10 @@ async function processFile({
215217 }
216218 } )
217219 } catch ( err ) {
218- if ( err . name !== 'UnsupportedTerminalError' ) {
219- throw err
220+ if ( isError ( err ) && err instanceof TypeError ) {
221+ if ( err . name === 'UnsupportedTerminalError' ) {
222+ throw err
223+ }
220224 }
221225 }
222226 }
Original file line number Diff line number Diff line change @@ -10743,10 +10743,10 @@ typedarray@^0.0.6:
1074310743 resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1074410744 integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
1074510745
10746- typescript@4.3.5 :
10747- version "4.3.5 "
10748- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5 .tgz#4d1c37cc16e893973c45a06886b7113234f119f4 "
10749- integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA ==
10746+ typescript@4.9.4 :
10747+ version "4.9.4 "
10748+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4 .tgz#a2a3d2756c079abda241d75f149df9d561091e78 "
10749+ integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg ==
1075010750
1075110751typical@^4.0.0 :
1075210752 version "4.0.0"
You can’t perform that action at this time.
0 commit comments