Skip to content

Document the new JS API#3183

Merged
nex3 merged 5 commits intomainfrom
new-api-docs
Nov 30, 2021
Merged

Document the new JS API#3183
nex3 merged 5 commits intomainfrom
new-api-docs

Conversation

@nex3
Copy link
Contributor

@nex3 nex3 commented Oct 8, 2021

This shouldn't be merged until the new API is supported by Dart Sass.

@nex3 nex3 force-pushed the new-api-docs branch 2 times, most recently from 66fb5e9 to 2d60c25 Compare October 13, 2021 02:40
@nex3 nex3 changed the title [WIP] Document the new JS API Document the new JS API Oct 13, 2021
@nex3 nex3 requested a review from jathak October 13, 2021 02:41
@nex3 nex3 marked this pull request as ready for review October 13, 2021 02:41
@nex3 nex3 requested review from Awjin and removed request for jathak October 13, 2021 02:41
* Unlike [[message]], this does *not* include representations of [[span]] or
* [[sassStack]].
*/
sassMessage: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

@nex3 should those be typed as readonly properties ? AFAICT, dart-sass implements them as getters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good call.


/** Additional options specific to compiling from a string. */
export type StringOptions<sync extends 'sync' | 'async'> = Options<sync> & {
export interface StringOptionsWithoutImporter<sync extends 'sync' | 'async'>
Copy link
Contributor

Choose a reason for hiding this comment

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

should this type have importer?: never to ensure that passing an importer option gets typed as StringOptionsWithImporter and reports a missing url if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out this doesn't work because StringOptionsWithImporter extends StringOptionsWithoutImporter. But that superclass relationship should provide pretty decent error messages on its own.

@nex3 nex3 changed the base branch from main to js-api-improvements November 12, 2021 21:40
nex3 added 2 commits November 12, 2021 13:41
This takes more advantage of overloads rather than using factory
constructors or methods with different names.
@nex3 nex3 force-pushed the js-api-improvements branch from e7a659a to a50c1bb Compare November 12, 2021 21:42
Base automatically changed from js-api-improvements to main November 30, 2021 00:10
@nex3 nex3 merged commit b192519 into main Nov 30, 2021
@nex3 nex3 deleted the new-api-docs branch November 30, 2021 23:32
mirisuzanne pushed a commit that referenced this pull request Feb 10, 2022
mirisuzanne added a commit that referenced this pull request Feb 10, 2022
* main: (149 commits)
  Add the sourceMapIncludeSources option in the new JS API (#3226)
  Fix the toc tool to insert the toc (#3225)
  Fix some incorrect documentation/typings in LegacyPluginThis.options (#3246)
  Add a type annotation for the top-level NULL field (#3243)
  Add type annotations for the top-level TRUE and FALSE fields (#3241)
  Add type annotations for the sass.types.Error class (#3238)
  Add a type declaration for LegacyPluginThis.options.context (#3236)
  Make LegacyAsyncFunction type more usable (#3237)
  Allow SassFunction signatures to be checked on return (#3220)
  Make LegacyFileOptions.data optional (#3215)
  Use the URL type from the DOM definitions, not from Node (#3214)
  Document the new JS API (#3183)
  Make the new JS API a bit more idiomatic (#3200)
  Update immutable-js dep. (#3195)
  Add a code example for Logger.silent (#3192)
  Update dependencies (#3193)
  Replace FileImporterResult with a plain URL (#3180)
  Convert explicit compatiblity HTML into a nicer @-tag
  Convert explicit "Heads up" HTML into nicer-looking Markdown
  Automatically handle absolute file: URLs for FileImporters (#3181)
  ...
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.

3 participants