-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(launchpad): support default export (#20383)
Co-authored-by: David Munechika <david.munechika@gatech.edu> Co-authored-by: ElevateBart <ledouxb@gmail.com> Co-authored-by: Barthélémy Ledoux <bart@cypress.io>
- Loading branch information
1 parent
e9125f4
commit 7a02925
Showing
22 changed files
with
223 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/data-context/src/sources/migration/parserUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { parse, ParserOptions } from '@babel/parser' | ||
import { visit } from 'recast' | ||
import type * as bt from '@babel/types' | ||
|
||
const babelParserOptions: ParserOptions = { | ||
sourceType: 'module', | ||
strictMode: false, | ||
tokens: true, | ||
plugins: [ | ||
'decorators-legacy', | ||
'doExpressions', | ||
'objectRestSpread', | ||
'classProperties', | ||
'classPrivateProperties', | ||
'classPrivateMethods', | ||
'exportDefaultFrom', | ||
'exportNamespaceFrom', | ||
'asyncGenerators', | ||
'functionBind', | ||
'functionSent', | ||
'dynamicImport', | ||
'numericSeparator', | ||
'optionalChaining', | ||
'importMeta', | ||
'bigInt', | ||
'optionalCatchBinding', | ||
'throwExpressions', | ||
'nullishCoalescingOperator', | ||
'typescript', | ||
], | ||
} | ||
|
||
export function hasDefaultExport (src: string): boolean { | ||
const ast = parse(src, babelParserOptions) as bt.File | ||
|
||
let hasDefault = false | ||
|
||
visit(ast, { | ||
visitExportDefaultDeclaration () { | ||
hasDefault = true | ||
|
||
return false | ||
}, | ||
}) | ||
|
||
return hasDefault | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7a02925
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: