From 4df1d37ddc54242c339765f22fb90ba2e9e3a99a Mon Sep 17 00:00:00 2001 From: dave caruso Date: Thu, 1 Jun 2023 21:16:47 -0400 Subject: Bundle and minify `.exports.js` files. (#3036) * move all exports.js into src/js * finalize the sort of this * and it works * add test.ts to gitignore * okay * convert some to ts just to show * finish up * fixup makefile * minify syntax in dev * finish rebase * dont minify all modules * merge * finish rebase merge * flaky test that hangs --- src/js/node/path.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/js/node/path.js (limited to 'src/js/node/path.js') diff --git a/src/js/node/path.js b/src/js/node/path.js new file mode 100644 index 000000000..bcdd1f7f7 --- /dev/null +++ b/src/js/node/path.js @@ -0,0 +1,50 @@ +// Hardcoded module "node:path" +export const createModule = obj => Object.assign(Object.create(null), obj); + +function bound(obj) { + var result = createModule({ + basename: obj.basename.bind(obj), + dirname: obj.dirname.bind(obj), + extname: obj.extname.bind(obj), + format: obj.format.bind(obj), + isAbsolute: obj.isAbsolute.bind(obj), + join: obj.join.bind(obj), + normalize: obj.normalize.bind(obj), + parse: obj.parse.bind(obj), + relative: obj.relative.bind(obj), + resolve: obj.resolve.bind(obj), + toNamespacedPath: obj.toNamespacedPath.bind(obj), + sep: obj.sep, + delimiter: obj.delimiter, + }); + result.default = result; + return result; +} +var path = bound(Bun._Path()); + +export var posix = bound(Bun._Path(false)); +export var win32 = bound(Bun._Path(true)); + +path.win32 = win32; +path.posix = posix; + +export var { + basename, + dirname, + extname, + format, + isAbsolute, + join, + normalize, + parse, + relative, + resolve, + toNamespacedPath, + sep, + delimiter, + __esModule, +} = path; + +path[Symbol.for("CommonJS")] = 0; +path.__esModule = true; +export default path; -- cgit v1.2.3