-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Update roadmap #90
Comments
Re TypeScript I'd like to ask that we avoid requiring a build step (so |
Okay, that's a good point. I remember reading that npm planned to add/already had support to build packages from Git branches but I don't know how it works. I'll keep That's actually the reason why I published releases of my fork when I wanted to use it in other projects (instead of pointing to a git hash) so I understand the pain. Edit: Edit2: Using npm inside a vanilla JS package, the following command adds the dependency and builds it transparently: |
To be honest another issue for me personally is that I'm not a TypeScript developer. I'm OK with Edit: For the record I'm only one maintainer here, others may feel differently than I do. Just being honest about my criteria for me participating in maintenance of a module. |
I'd definitely like to see the path.join used over string concatenation first but also I'm wondering what other breaking changes you have planned. Keep in mind |
Agreed, string concatenation can be part of the initial release. I thought that we could release multiple I planned two breaking changes:
They don't have to be part of the same major version. A possibility would be for The wrapper update would be "nice to have" but isn't a high priority compared to the fixes. |
I'd definitely like to see the path and string concatenation handled first (path.join / path.resolve for paths and JS template literals for strings). Once that's done I'm likely to do a fresh review of the whole repo. Many of your PR's I did not review as new code but as modified code knowing there would be follow-ups, so I'm likely to do a follow-up PR to deal with that sort of thing (I'll CC you in the PR). One thing about this release, how were you planning to test these releases? Currently you can create a package.json containing: {
"devDependencies": {
"nyc": "^14.1.1",
"spawn-wrap": "istanbuljs/spawn-wrap#master"
}
} This would allow you to test the |
You make a good point. I thought that you were planning to publish |
well at a certain point spawn-wrap master will be tagged I do plan to publish a |
@demurgos any chance you could make the |
@coreyfarrell I'll send the PRs tomorrow, with |
2.0.0-beta.0 is now published to the npm |
Hi,
Last year I did some work on
spawn-wrap
on my fork to support hooking the Node inspector into Node processes deep in the process tree. I eventually built a library dedicated to this use case, but myspawn-wrap
fork still had a lot of work put into it to fix some issues and provide new features. I would like to merge the changes so others can benefit from them. I started sending small PRs, this issue is intended to give the outline of the changes I made and discuss them in a larger scope.There were many small changes that together improved the reliability of the lib and fixed various Windows issues: using safe path manipulation functions, escaping the values more explicitly, reducing the number of extra files (no
settings.json
), avoiding mutations of the user-supplied options object, etc. One of the intended goals is to reduce the amount of patches to Node internals. It does not remove all internal patches (see #89).There were also some larger changes:
Provide an API that does not patches the internals. This allows to spawn concurrent sub-processes with different options without interference. This is achieved by creating a context (options + shims) and then using it to create a spawn function. This function rewrites its arguments to inject the wrapping logic and forwards the arguments to the native spawn function. The general idea is the following:
Add static type checks with Typescript. The library is stable now so it would benefit from being annotated and checked. Using types helped me a lot to understand how spawn-wrap works: I coud annotate what were the expected values and what each function returned. As a bonus it enables better autocompletion and documentation for the consumers. I wrote a small post about it: it's definitely worth it for a stable lib.
The only breaking change I eventually introduced was a simplification of how the wrapper code is executed. I looked into all the dependent packages and how they use spawn-wrap. They fall into two categories: they either want to ensure some VM options are enabled or run some code before/after the user code. For the second case, the wrapper code often receives some config from the root process but the current design makes this use case hard (it involves pushing and poping args or env vars). Starting the user-code from the wrapper uses a
runMain
function exported byspawn-wrap
, but this function does not work outside of the wrapper. I eventually settled on a design where the wrapper may export a function, the shim then calls it with a config object containing data from the parent process and a method to start the user code. See the migration section on my forkFinally, the largest of all changes was adding support for dynamic arguments (Dynamically create child_process args. #47). This allows a very powerful abstraction were the root process can watch process creations at any depth in the process tree, modify their arguments, directly read their stdin/stdout/stderr, etc. This is built on top of the current static version using some IPC. Ultimately, I don't think it should be merged here: it is great but too complex. It could be published as a separate package depending on
spawn-wrap
for users needing this kind of control.I opened a PR (#77) with all those changes, but it should not be merged: it's just to show you the code I ended up with. Instead, I am extracting the changes one by one and sending small PRs. This allows to discuss each change individually and catch errors (thanks for the reviews).
My first step was to update the requirements and remove legacy code. This is almost done. I'll send a PR soon to split the library into smaller modules so it's better to see the structure of the lib at a glance. At this point, the library should still be functionally the same: it would be a good point to do a release and check that the refactoring did not break anything. The main change would be the increased minimum Node version.
Once this is done, I'd like to merge new features: encapsulations with contexts and static type checks. This is also the step were I added most of the minor fixes.
Then, depending on the discussions, I'd propose the new API were the wrapper module exports a function called by the shim.
/cc @bcoe @JaKXz @coreyfarrell
The text was updated successfully, but these errors were encountered: