Files
bun.sh/src/js/node/path.ts
dave caruso c2a77cf7ec Rewrite built-in modules to use CommonJS over ESM (#3814)
* stfdsafsd

sadffdsa

stuff

finish commonjs stuff

asdf

not done but work

not done but work

not done yet but this is how far i am

remove files

lol

update built files

uncomment everything in events lol

export default

stuff

* afdsafsd

* its not perfect but almost done

* okay

* cool

* remove temp file

* finish rebase

* revert settings.json

* a

* ch-ch-ch-ch-changes

* okay

* remove this check in release for now

* sxdcfghnjm,

* lkjhgf

* fmt

* filename can be null

* Update NodeModuleModule.h

* weee

* fmt

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-02 16:27:36 -07:00

32 lines
886 B
TypeScript

// Hardcoded module "node:path"
function bound(obj) {
const toNamespacedPath = obj.toNamespacedPath.bind(obj);
const result = {
resolve: obj.resolve.bind(obj),
normalize: obj.normalize.bind(obj),
isAbsolute: obj.isAbsolute.bind(obj),
join: obj.join.bind(obj),
relative: obj.relative.bind(obj),
toNamespacedPath,
dirname: obj.dirname.bind(obj),
basename: obj.basename.bind(obj),
extname: obj.extname.bind(obj),
format: obj.format.bind(obj),
parse: obj.parse.bind(obj),
sep: obj.sep,
delimiter: obj.delimiter,
win32: undefined,
posix: undefined,
_makeLong: toNamespacedPath,
};
return result;
}
const posix: any = bound(Bun._Path(false));
const win32: any = bound(Bun._Path(true));
posix.win32 = win32.win32 = win32;
posix.posix = win32.posix = posix;
export default process.platform === "win32" ? win32 : posix;