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

Create package exports #906

Merged
merged 4 commits into from
Jul 8, 2021
Merged

Create package exports #906

merged 4 commits into from
Jul 8, 2021

Conversation

inlined
Copy link
Member

@inlined inlined commented Jun 24, 2021

Update library to have proper package exports, which have a few advantages:

  1. We now can import files without the "lib" prefix
  2. We can now expose cleanly separated package versions irrespective of the underlying file layout

This change exports all previously documented entrypoints to the SDK: the root, lib/logger and lib/logger/compat. In addition, the logger entrypoints no longer need 'lib': firebase-functions/logger and firebase-functions/logger/compat now work as well. Finally, the entire existing SDK (aside from logger, which is versionless) can be accessed at firebase-functions/v1. We will start implementing v2 shortly.

This PR will break undefined behavior. Customers who previously imported sub-files like firebase-functions/lib/providers/https will no longer be able to do so. They can instead say import {https} from 'firebase-functions'. This is an already approved change and is not considered breaking, so there will be no major version bump.

@google-cla google-cla bot added the cla: yes label Jun 24, 2021
@inlined inlined requested review from joehan and taeold June 24, 2021 20:39
@@ -23,6 +23,14 @@
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"exports": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are missing .js extensions here, i.e.

"./logger": "./lib/logger.js",
"./logger/compat": "./lib/logger/compat.js",
"./lib/logger": "./lib/logger.js",
"./lib/logger/compat": "./lib/logger/compat.js"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add them, though they're clearly not necessary since tests pass. AFAICT it just shortens the lookup process since it doesn't guess lib/logger.js before the (new) lib/logger/index.js.

@inlined inlined merged commit 33a68ea into master Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants