-
Notifications
You must be signed in to change notification settings - Fork 6
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
[internal] Add more injection points #121
Conversation
a331ba9
to
bbe728b
Compare
84950be
to
74d2575
Compare
@@ -24,12 +24,14 @@ | |||
}, | |||
"dependencies": { | |||
"async-retry": "1.3.3", | |||
"chalk": "2.3.1" | |||
"chalk": "2.3.1", | |||
"glob": "11.0.0" |
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.
FYI node now supports OOTB glob (but it requires specific node version)
I'm not asking to change it, but just sharing knowledge hehehe
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.
Oh that's super nice, I didn't know.
I'm planning on bumping node version at some point this quarter.
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.
Edit: it's still experimental TIL – link
![image](https://private-user-images.githubusercontent.com/22725671/404233419-8d37a217-7a54-4bd4-976d-81a3281e683a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTA2NzUsIm5iZiI6MTczOTM1MDM3NSwicGF0aCI6Ii8yMjcyNTY3MS80MDQyMzM0MTktOGQzN2EyMTctN2E1NC00YmQ0LTk3NmQtODFhMzI4MWU2ODNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDA4NTI1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUyMTgwNTI4MWI5MWI3NzRlYzZjODE1NGNmNDY3OWJkYTcxYzY0YmMzMjhkYjExZmRiYTM1N2U0MTdjYWFjMTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.nKAr4x3LRVkZLN0KvKchgpHRVSLOHa9ZUxJulcl_oN8)
if (!filepath.includes('*')) { | ||
return [filepath]; |
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.
I don't think this is enough to know if this is a valid path / something that has to be globed. For instance hello.{js,ts}
has to go through glob
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.
It's a subset of glob for eslint.
From the link in the comment above, it only support *
and /**/
.
entryPaths.push( | ||
...Object.entries(entryPoints).map(([name, filepath]) => ({ name, path: filepath })), |
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.
Idk if this can happen, but if entryPoints
is null
, this will crash (typeof null is object)
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.
Good catch, it can happen (according to the types).
// Resolve all the paths. | ||
const proms = entryPaths | ||
.flatMap((entry) => | ||
getAllEntryFiles(entry.path).map<[{ name?: string; path: string }, string]>((p) => [ |
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.
Pro tip: you can label tuples (not a request for change, just knowledge sharing):
getAllEntryFiles(entry.path).map<[entry: { name?: string; path: string }, path: string]>((p) => [
}, | ||
...rollupPlugin(), |
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.
You may want to put ...rollupPlugin()
before config(config) {
to avoid having a field name config
in rollupPlugin()
overriding your config
onResolve: jest.fn(), | ||
onLoad: jest.fn(), | ||
onDispose: jest.fn(), | ||
...options, |
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.
You may want to move ...options
to the 1st element to avoid being able to override the other fields. And if you want that to be its behavior, you should add a comment saying "All the methods before can be overridden in options
" or something like that
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.
Changed options
for overrides
.
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.
🔥
[tests] A better sandboxing of tests and builds
What and why?
Here we are again, rewriting the injection plugin for the 18th time.
We'd need to inject code banner and footer, but also within the context of the bundle, being able to add new
import
instructions for instance.Especially for [rum] Inject browser sdk
How?
Some small update and fixes:
Big refactor of the injection plugin:
START
,MIDDLE
andEND
.Note
Tests are refactored in #123