Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Clean up options and fix test code #878

Closed
wants to merge 2 commits into from

Conversation

echo304
Copy link
Contributor

@echo304 echo304 commented Aug 9, 2017

  • Clean up options and create new prepack-options.js file
  • Add PartialEvaluatorOptions type which contains only sourceMaps
  • Fix test code related to above change

#841

@echo304 echo304 changed the title clean up options and fix test code Clean up options and fix test code Aug 9, 2017
Copy link
Contributor

@NTillmann NTillmann left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for doing this work. I have just some small requests...

import type { ErrorHandler } from "./errors.js";
import type { SerializerOptions, RealmOptions } from "./options";

export type Compatibility = "browser" | "jsc-600-1-4-17" | "node-source-maps" | "node-cli";
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't redefine, import from "./options";

import type { SerializerOptions, RealmOptions } from "./options";

export type Compatibility = "browser" | "jsc-600-1-4-17" | "node-source-maps" | "node-cli";
export const CompatibilityValues = ["browser", "jsc-600-1-4-17", "node-source-maps", "node-cli"];
Copy link
Contributor

Choose a reason for hiding this comment

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

Dead, please remove.

return {
compatibility,
debugNames,
errorHandler: errorHandler,
Copy link
Contributor

Choose a reason for hiding this comment

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

simplify to errorHandler,

let result: SerializerOptions = {
delayInitializations,
delayUnsupportedRequires,
initializeMoreModules: speculate,
Copy link
Contributor

Choose a reason for hiding this comment

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

Another silly naming discrepancy that should be addressed eventually. If that's harmonized, then the Options datatype could be truly the union SerializerOptions | RealmOptions | PartialEvaluatorOptions, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call 👍

export type Compatibility = "browser" | "jsc-600-1-4-17" | "node-source-maps" | "node-cli";
export const CompatibilityValues = ["browser", "jsc-600-1-4-17", "node-source-maps", "node-cli"];

export type Options = {|
Copy link
Contributor

Choose a reason for hiding this comment

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

You could rename this type to PrepackOptions, or CombinedPrepackOptions, to make it a bit more clear what this type represents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let's pick PrepackOptions

@NTillmann
Copy link
Contributor

Awesome! @cblappert, do you think this might break any internal tooling?

Copy link
Contributor

@cblappert cblappert left a comment

Choose a reason for hiding this comment

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

Looks great, I'll do the import as I'll have to rename the arguments internally as well.

@facebook-github-bot
Copy link

@cblappert has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

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

Successfully merging this pull request may close these issues.

4 participants