build: set up tsdown for dual build#147
Conversation
There was a problem hiding this comment.
this is a great size improvement!! it looks really good

however, fdir is currently compatible with at least node 12 (and probably even node 10 but i'm not sure i haven't checked), and this is currently breaking that compatibility due an import at the top of the file with the node: protocol
i've suggested a tiny config change that should ensure compatibility
|
it looks like |
Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>
However, |
|
Regarding node compat in general: There is no note in the docs (besides "any version") nor the engine field. This would be good to document 🤔 |
|
@TheAlexLichter tsdown 0.12.5 seems to have fixed the |
|
@SuperchupuDev Done! |
SuperchupuDev
left a comment
There was a problem hiding this comment.
something should probably be done for createRequire only being on node 12.2 and up and not 12.0.0, but i don't really think anyone is running strictly node 12.0.0. (also the fact that latest version started using a node 14 api breaking compat anyways). thank you!
|
wait, as much as i love pnpm you should probably remove the pnpm lockfile added in your last commit (i suppose by accident?) since this repo is configured to use npm |
Sorry, yes by accident. Muscle memory was too strong here :D |
e201b78 to
3a80f5f
Compare
|
After building with tsdown dual format, the import time for fdir decreased from 9~10 ms to ~6 ms. |
Co-Authored-By: sxzz <sxzz@sxzz.moe>
|
@thecodrr do you mind taking a look at this and releasing a new version afterwards? (which would include a fix in main that hasn't been released yet) 🙏 |
Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>
|
@thecodrr Hey! 👋 Is there anything missing or something that is blocking the PR? |
|
it looks like unrelated, do you mind setting the i've just locally tested node 10-12 in main and 12 is definitely the minimum version as everything else below breaks due to class initialization stuff |
|
This is ready for merge. I think the |
|
I'm seeing an issue when fdir@6.5.0 is bundled using esbuild. Generated code: // ../../../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
var import_module = require("module");
var import_path2 = require("path");
var nativeFs = __toESM(require("fs"), 1);
var import_meta2 = {};
var __require = /* @__PURE__ */ (0, import_module.createRequire)(import_meta2.url);
function cleanPath(path14) {
let normalized = (0, import_path2.normalize)(path14);
if (normalized.length > 1 && normalized[normalized.length - 1] === import_path2.sep) normalized = normalized.substring(0, normalized.length - 1);
return normalized;
}error: |

Resolves #146
I've used
tsdownas fast builder which will dual-build the library, generate .d.ts files, generates exports for the package.json and eventually runs publint.Generated types were manually checked by me via attw