-
Notifications
You must be signed in to change notification settings - Fork 273
Fix #245 CJS resolution failure #346
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"private": true, | ||
"type": "commonjs", | ||
"scripts": { | ||
"start:cjs": "node index.cjs", | ||
"start:esm": "node index.mjs" | ||
"start:cjs": "node --no-experimental-require-module index.cjs", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this option is necessary to turn the esmodule interop option off There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it! sounds good :) |
||
"start:esm": "node --no-experimental-require-module index.mjs" | ||
}, | ||
"dependencies": { | ||
"@openai/agents": "latest" | ||
"@openai/agents": "latest", | ||
"typescript": "^5.9.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,67 +14,49 @@ | |
}, | ||
"exports": { | ||
".": { | ||
"require": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to repeat types and default under require; simplified much |
||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "default" works too but "import" works with clearer intention with ESModule |
||
}, | ||
"./model": { | ||
"require": { | ||
"types": "./dist/model.d.ts", | ||
"default": "./dist/model.js" | ||
}, | ||
"types": "./dist/model.d.ts", | ||
"default": "./dist/model.mjs" | ||
"require": "./dist/model.js", | ||
"import": "./dist/model.mjs" | ||
}, | ||
"./utils": { | ||
"require": { | ||
"types": "./dist/utils/index.d.ts", | ||
"default": "./dist/utils/index.js" | ||
}, | ||
"types": "./dist/utils/index.d.ts", | ||
"default": "./dist/utils/index.mjs" | ||
"require": "./dist/utils/index.js", | ||
"import": "./dist/utils/index.mjs" | ||
}, | ||
"./extensions": { | ||
"require": { | ||
"types": "./dist/extensions/index.d.ts", | ||
"default": "./dist/extensions/index.js" | ||
}, | ||
"types": "./dist/extensions/index.d.ts", | ||
"default": "./dist/extensions/index.mjs" | ||
"require": "./dist/extensions/index.js", | ||
"import": "./dist/extensions/index.mjs" | ||
}, | ||
"./types": { | ||
"require": { | ||
"types": "./dist/types/index.d.ts", | ||
"default": "./dist/types/index.js" | ||
}, | ||
"types": "./dist/types/index.d.ts", | ||
"default": "./dist/types/index.mjs" | ||
"require": "./dist/types/index.js", | ||
"import": "./dist/types/index.mjs" | ||
}, | ||
"./_shims": { | ||
"workerd": { | ||
"require": "./dist/shims/shims-workerd.js", | ||
"types": "./dist/shims/shims-workerd.d.ts", | ||
"default": "./dist/shims/shims-workerd.mjs" | ||
"require": "./dist/shims/shims-workerd.js", | ||
"import": "./dist/shims/shims-workerd.mjs" | ||
}, | ||
"browser": { | ||
"require": "./dist/shims/shims-browser.js", | ||
"types": "./dist/shims/shims-browser.d.ts", | ||
"default": "./dist/shims/shims-browser.mjs" | ||
"require": "./dist/shims/shims-browser.js", | ||
"import": "./dist/shims/shims-browser.mjs" | ||
}, | ||
"node": { | ||
"require": "./dist/shims/shims-node.js", | ||
"types": "./dist/shims/shims-node.d.ts", | ||
"default": "./dist/shims/shims-node.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/shims/shims-node.d.ts", | ||
"default": "./dist/shims/shims-node.js" | ||
"require": "./dist/shims/shims-node.js", | ||
"import": "./dist/shims/shims-node.mjs" | ||
}, | ||
"types": "./dist/shims/shims-node.d.ts", | ||
"default": "./dist/shims/shims-node.mjs" | ||
"types": "./dist/shims/shims.d.ts", | ||
"require": "./dist/shims/shims.js", | ||
"import": "./dist/shims/shims.mjs" | ||
} | ||
}, | ||
"keywords": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,39 +11,33 @@ | |
"exports": { | ||
".": { | ||
"browser": { | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
}, | ||
"./_shims": { | ||
"workerd": { | ||
"require": "./dist/shims/shims-workerd.js", | ||
"types": "./dist/shims/shims-workerd.d.ts", | ||
"default": "./dist/shims/shims-workerd.mjs" | ||
"require": "./dist/shims/shims-workerd.js", | ||
"import": "./dist/shims/shims-workerd.mjs" | ||
}, | ||
"browser": { | ||
"require": "./dist/shims/shims-browser.js", | ||
"types": "./dist/shims/shims-browser.d.ts", | ||
"default": "./dist/shims/shims-browser.mjs" | ||
"require": "./dist/shims/shims-browser.js", | ||
"import": "./dist/shims/shims-browser.mjs" | ||
}, | ||
"node": { | ||
"require": "./dist/shims/shims-node.js", | ||
"types": "./dist/shims/shims-node.d.ts", | ||
"default": "./dist/shims/shims-node.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/shims/shims-node.d.ts", | ||
"default": "./dist/shims/shims-node.js" | ||
"require": "./dist/shims/shims-node.js", | ||
"import": "./dist/shims/shims-node.mjs" | ||
}, | ||
"types": "./dist/shims/shims-node.d.ts", | ||
"default": "./dist/shims/shims-node.mjs" | ||
"types": "./dist/shims/shims.d.ts", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shims/shims is just a reference to shims/shims-node, but there is no downside of this change |
||
"require": "./dist/shims/shims.js", | ||
"import": "./dist/shims/shims.mjs" | ||
} | ||
}, | ||
"typesVersions": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"targets": [ | ||
{ "extname": ".js", "module": "es2022", "moduleResolution": "node" }, | ||
{ "extname": ".js", "module": "commonjs", "moduleResolution": "node" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *.js files are CJS compat; *.mjs are ESModule compat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the .js ---> CJS / .mjs --> ESM flip is clear. wondering if will we align each There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. I've revised package.json files to be simpler and clearer to use "require" and "import". Verified the behavior with the integration tests, plus did additional manual tests with a simple project too. |
||
{ "extname": ".mjs", "module": "esnext" } | ||
], | ||
"projects": [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove all the pre-set node options too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, makes sense ..will prevent hidden loader/interop from leaking in