-
Notifications
You must be signed in to change notification settings - Fork 36
feat: radon Plugin #63
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d08c8bd The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Someone is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (1.86%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #63 +/- ##
========================================
- Coverage 6.43% 1.86% -4.57%
========================================
Files 468 501 +33
Lines 21500 74425 +52925
Branches 734 767 +33
========================================
+ Hits 1383 1387 +4
- Misses 19767 72659 +52892
- Partials 350 379 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
} | ||
|
||
const DEFAULT_OPTIONS: Required<Pick<RadonPluginOptions, 'enablePolyfill'>> = { | ||
enablePolyfill: true, |
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.
If you use require.resolve to load react-native and read its version from package.json, then the system can determine the flag automatically instead of receiving it from the user.
config: { | ||
babel: { | ||
plugins: [ | ||
[path.resolve(__dirname, './lib/RNpolyfill/polyfill_babel.cjs'), mergedOptions] |
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.
Since __dirname is prone to break due to mismatches between development and distribution targets, it should also be registered in the exports field and its exact path should be obtained using require.resolve.
packages/plugin-radon/package.json
Outdated
"vitest": "^3.1.3" | ||
}, | ||
"peerDependencies": { | ||
"react": "*", |
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.
Please review the peer configuration again.
format: ['cjs'], | ||
dts: false, | ||
minify: true, | ||
external: ['fs', 'path', '@babel/core', '@babel/template', '@babel/types'], |
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.
If the peerDeps are configured correctly, external will be evaluated automatically, so that field is unnecessary.
packages/plugin-radon/src/babel.js
Outdated
const content = fs.readFileSync(routerGenPath, 'utf8'); | ||
const routes = []; | ||
|
||
const importRegex = /import\s+\{\s*Route\s+as\s+_(\w+)Route\s*\}\s+from\s+['"]\.\.\/pages\/([^'"]+)['"]/g; |
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.
If you use the TypeScript API, you can retrieve this based on the AST. AST-based traversal seems like a better approach.
config: { | ||
babel: { | ||
plugins: [ | ||
[path.resolve(__dirname, './babel.cjs'), { |
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.
This part shouldn’t run at granite build
, so make sure it’s not included in the build.
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"./dist/*": "./dist/*", |
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.
example
"./dist/*": "./dist/*", | |
"./polyfill.js": "./dist/~~/~~", |
please update spec |
90f0f16
to
8e26f20
Compare
8e26f20
to
d08c8bd
Compare
No description provided.