V3 changes #68
Replies: 2 comments 2 replies
-
I reckon for the splitting, just adding an additional function of const cookies = setCookieParser.parse(setCookieParser.splitCookieString(res.headers.get('set-cookie'))).reduce((obj, c) => { obj[c.name] = c; return obj}) Just adding the |
Beta Was this translation helpful? Give feedback.
-
Hello, just a note about CJS/ESM . yes ESM is great, but shipping only in ESM will force other lib to migrate to ESM to (wich can be a really hard work) ... so, please keep CJS/ESM . Else, I've done multiple libraries that export CJS/ESM, here is an example, in general I'm using esbuild to build it (because I can create a script to call it, but other options exists) (and if he can compile typescript really fast, he doesn't typecheck, so when I want to typecheck I call Here is the little esbuild script : https://github.com/thib3113/node-crowdsec/blob/main/packages/crowdsec-client/esbuild.js I just setup up some options, and create links file that will reexport another parts (I also generate a pkg.ts to export the current version, but you can remove this) . and finally some configs in package.json : https://github.com/thib3113/node-crowdsec/blob/main/packages/crowdsec-client/package.json#L5-L8 + https://github.com/thib3113/node-crowdsec/blob/main/packages/crowdsec-client/package.json#L27-L39 And here is the result : https://www.npmjs.com/package/crowdsec-client?activeTab=code about size, yes using CJS and ESM consume more space ... but, if you use a bundler for your code, it will remove the unused files, so in general will use the ESM files, and remove the cjs . npm show a size of 275 kB, but when it was bundled, bundlephobia return a size of 15kB |
Beta Was this translation helpful? Give feedback.
-
I'm thinking about the changes I'd like to see in a version 3. The two big ones that I'd like to get in are:
Things I'm considering but haven't yet decided one way or the other:
Splitparse()
intoparseToArray()
andparseToMap()
to make for simpler typing? (Or support all 3?)Beta Was this translation helpful? Give feedback.
All reactions