Skip to content

Update console.build.js to set a value on window #5979

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

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

c4mb0t
Copy link
Contributor

@c4mb0t c4mb0t commented Feb 8, 2022

This change updates the console.build.js script that is used internally at Google to build the Firestore SDK.
Use of eval is removed and instead the code is exported using the global window.

@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2022

⚠️ No Changeset found

Latest commit: 56d5fb3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@hsubox76 hsubox76 self-requested a review February 8, 2022 01:34
@hsubox76
Copy link
Contributor

hsubox76 commented Feb 8, 2022

Hi, can you provide some context for this change? Is this a request from the Console team?

@c4mb0t
Copy link
Contributor Author

c4mb0t commented Feb 8, 2022

Hello, for context please see the email thread "Eval in firestore_web_sdk".


async function build() {
const es5Bundle = await rollup.rollup(es5InputOptions);
const {
output: [{ code }]
} = await es5Bundle.generate(es5OutputOptions);

const output = `${PREFIX}${JSON.stringify(String(code))}${POSTFIX}`;
const output = `${String(code)}${POSTFIX}`;
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 that you need a newline or at least whitespace before ${POSTFIX} in order to match the code change in the CL. I guess the code always ends with a ; so it's probably okay either way, but just in case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Through experimentation, I am seeing that code ends with both a semicolon and newline. Do you think we should add another one?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably fine, I guess there was no newline in the previous version because it was JSON.stringified.

@hsubox76 hsubox76 merged commit 6c8eabf into firebase:master Feb 9, 2022
@firebase firebase locked and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants