Skip to content
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

Make exported symbols on exports enumerable #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andsens
Copy link

@andsens andsens commented Dec 4, 2024

For reference: oven-sh/bun#4432 (comment)

Currently bun cannot import triple-beam symbols because of this issue.

It's probably a good idea to make the exports enumerable anyways.

EDIT: Replaces #18

@andsens
Copy link
Author

andsens commented Dec 4, 2024

Workaround for people using bun:

patches/[email protected]
diff --git a/config/index.js b/config/index.js
index 96b6566d640c6daa3f6e75835619deabd006eb97..6e21e1e561ce0383c0ee1615c940f3c4cdcd5f67 100644
--- a/config/index.js
+++ b/config/index.js
@@ -12,6 +12,7 @@
  * @type {Object}
  */
 Object.defineProperty(exports, 'cli', {
+  enumerable: true,
   value: require('./cli')
 });
 
@@ -20,6 +21,7 @@ Object.defineProperty(exports, 'cli', {
  * @type {Object}
  */
 Object.defineProperty(exports, 'npm', {
+  enumerable: true,
   value: require('./npm')
 });
 
@@ -28,5 +30,6 @@ Object.defineProperty(exports, 'npm', {
  * @type {Object}
  */
 Object.defineProperty(exports, 'syslog', {
+  enumerable: true,
   value: require('./syslog')
 });
diff --git a/index.js b/index.js
index cf89cf0639480e602f5e42a0e808691d8e48526a..d0bf22afe98ef77eb4621bc66b253308e12ef3e9 100644
--- a/index.js
+++ b/index.js
@@ -9,6 +9,7 @@
  * @type {Symbol}
  */
 Object.defineProperty(exports, 'LEVEL', {
+  enumerable: true,
   value: Symbol.for('level')
 });
 
@@ -21,6 +22,7 @@ Object.defineProperty(exports, 'LEVEL', {
  * @type {Symbol}
  */
 Object.defineProperty(exports, 'MESSAGE', {
+  enumerable: true,
   value: Symbol.for('message')
 });
 
@@ -32,6 +34,7 @@ Object.defineProperty(exports, 'MESSAGE', {
  * @type {Symbol}
  */
 Object.defineProperty(exports, 'SPLAT', {
+  enumerable: true,
   value: Symbol.for('splat')
 });
 
@@ -42,5 +45,6 @@ Object.defineProperty(exports, 'SPLAT', {
  * @type {Object}
  */
 Object.defineProperty(exports, 'configs', {
+  enumerable: true,
   value: require('./config')
 });

Reference the patch in your package.json with

{
  "patchedDependencies": {
    "[email protected]": "patches/[email protected]"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant