-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(launchpad): support default export #20383
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a86faf6
fix requirePlugins template
davidmunechika 2abedf4
use static import
davidmunechika 66d664b
remove import
davidmunechika 254b1ed
Merge branch '10.0-release' into unify-1073-config-migration
davidmunechika ee4d6be
Merge branch '10.0-release' into unify-1073-config-migration
lmiller1990 3c6aff8
chore: support default export
lmiller1990 0a37e49
fix tests
lmiller1990 89d2e6b
update test project package.json
lmiller1990 3ceb826
update snapshots
lmiller1990 735ec62
update path for requiring plugins
lmiller1990 49112ca
fix test
lmiller1990 cabfb13
Merge remote-tracking branch 'origin/10.0-release' into lmiller1990/U…
lmiller1990 e4475ea
revert change to path
lmiller1990 74b4dc0
fix expected output
lmiller1990 c73c73d
docs
lmiller1990 8c53883
update
lmiller1990 5db5474
fix snapshot
lmiller1990 98c9df1
update tests
lmiller1990 1c2761f
add ts plugin
lmiller1990 6050467
fix test for CI
lmiller1990 e1b019b
fix default export logic
lmiller1990 4f012a2
refactor: use visit to clarify the code
elevatebart f8a99b4
Merge branch '10.0-release' into lmiller1990/UNIFY-1073
7b131be
Merge remote-tracking branch 'origin/10.0-release' into lmiller1990/U…
lmiller1990 96f6eda
rebase
lmiller1990 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These were all wrong, how the heck did this get merged? This is why I don't generally like snapshots; they don't test behavior.