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

MediaWiki 1.42, online doc. URLs, and fixes #42

Merged
merged 17 commits into from
May 30, 2024

Conversation

Derugon
Copy link
Collaborator

@Derugon Derugon commented Apr 24, 2024

MediaWiki 1.42 is expected to be released in may or june, so this PR contains (supposedly) all type and JSdoc changes related to it. This release also comes with a JS documentation overall, with a lot of small description, type, and url changes, which makes this PR way bigger (and harder to review, I'm sorry, I recommend looking at changes commit by commit) than it should be.

This PR also contains some other changes from oversights of previous PRs (unrelated to 1.42) and addition of deprecated/removed declarations since 1.39 (current LTS release).

All changes are liste below, breaking changes are annotated with ⚠.

MediaWiki 1.42 update

Added:

  • mw.tempUserCreated module
  • mw.user.getFirstRegistration
  • mw.util.isInfinity

Modified:

  • new mw.Api().loadMessagesIfMissing now accepts a single string message key as argument
  • default argument of mw.cookie.get/getCrossSite is now explicitely typed (in JSdoc) with string|null, instead of any
  • mw.loader.impl/implement/register/state are now annotated private
  • mw.Map is no longer annotated private (and described as internal)
  • body argument of new mw.Rest().post is now optional

Compatibility with MediaWiki 1.39 (LTS)

  • Add various @since annotations for declarations added or modified with 1.40 and 1.41.
  • Add declarations removed in 1.40 and 1.41, with a @deprecate annotation:
    • isoDate/url tablesorter parsers, up to 1.40.
    • mw.language.commafy, up to 1.40.
    • jquery.tipsy ResourceLoader module, up to 1.41.

Miscellaneous changes

  • Add jquery.cookie module (which contains $.cookie, $.removeCookie)
  • Add missing mw.loader.addSource, mw.templates, and script property of a RL module declarations
  • Make mw.libs and mw.widgets namespaces instead of records ⚠
  • Add pluralRuleParser library
    • related to the modification above
  • Add missing JSdoc to mw.experiments and mw.Rest.Options.ajax
  • Move namespace mw.errorLogger to its own file
  • Fix mw.notify taking a JS global NotificationOptions as argument (not targetting the MediaWiki implementation) ⚠
  • Sort members lexicographically
    • where it was not the case, namely in ColorUtil/mw.Api/mw.Rest interfaces and mw.template namespace

JSdoc update

  • Some @typedef have been added to the original JSdoc in 1.42, either as file-local declarations or global declarations in the mw namespace, so update some interfaces to share similar names (and declaration location) with online types.
    • rename ApiOptions/ForeignApiOptions/ForeignRestOptions/RestOptions to mw.Api.Options/mw.ForeignApi.Options/mw.ForeignRest.Options/mw.Rest.Options and make all properties optional ⚠
      • ApiOptions/ForeignApiOptions/RestOptions were exported, so to prevent breaking things, exports are just deprecated for now
    • rename UserInfo to mw.Api.UserInfo
      • was exported from user.d.ts, so to prevent breaking things, the export is just deprecated for now
    • rename WatchStatus to mw.Api.WatchedPage
    • rename NotificationOptions to mw.notification.NotificationOptions
    • rename ResultInfo to ResponseMetaData (in searchSuggest.d.ts)
    • rename CompiledTemplate/Compiler to TemplateRenderer/TemplateCompiler (in template.d.ts)
      • also require that any template has a render method.
    • rename UriOptions to mw.Uri.UriOptions and make all properties optional
    • rename ImageUrlData to ResizeableThumbnailUrl (in util.d.ts)
    • add mw.Api.EditTransform
    • add mw.cookie.CookieOptions
    • add ResponseFunction (in searchSuggest.d.ts)
    • add TitleExistenceStore (in Title.d.ts)
  • Fix various small inconsistencies with punctuation, links, indent, and code blocks, either from 1.42 updates to original JSdoc, or oversights from previous PRs.

URLs update

  • Update doc.wikimedia.org URLs to new format
    • most of the URLs used in JSdoc are currently broken
    • URLs to undocumented (usually private) members are removed, since these did not link to anything
  • Add missing doc.wikimedia.org URLs
    • documentation for mw.hook events is now generated, so also add URLs to their associated section
  • Use Special:MyLanguage in URLs of wikis that use subpages for translations
    • mostly URLs to www.mediawiki.org
  • Use {@link some-url …} syntax consistently in JSdoc
    • replace uses of […](some-url), <some-url>, or plain some-url

Adrien LESÉNÉCHAL added 8 commits April 24, 2024 09:53
- add `$.cookie`, `$.removeCookie`, `mw.loader.addSource`, `mw.templates`, `mw.user.getFirstRegistration`, `mw.util.isInfinity`
- `new mw.Api().loadMessagesIfMissing` now accepts a single `string` message key as argument
- `mw.loader.impl`/`implement`/`register`/`state` are now annotated private
- `mw.Map` is no longer annotated private
- `body` argument of `new mw.Rest().post` is now optional
- various small jsdoc fixes, either from 1.42 updates or oversights from previous PR
- synchronize `mw.cookie.get` TS type with JSdoc: only allow `string|null` as argument
- fix `mw.notify` not targetting the mw implementation of `NotificationOptions`
- add missing JSdoc to `mw.experiments` and `mw.Rest.Options.ajax`
- add missing code block language annotations
so library and widget types can be specified in this package (or other ones)
missed some imports in the previous commits
Update JSdoc of `mw.template` based on MW 1.42.
Some interface declarations for `TemplateCompiler` and `TemplateRenderer` were also added in JSdoc, so use these types.
- update types of `mw.template`, based on interfaces in MW 1.42 JSdoc
- update `doc.wikimedia.org` urls to new format (with migration of source code from jsduck to jsdoc), almost all urls are currently broken
- remove `doc.wikimedia.org` urls to private members (that linked to nothing, since jsdoc of private members is not generated)
- add missing `doc.wikimedia.org` urls
- add `doc.wikimedia.org` urls for specific `mw.hook` events, since their jsdoc is now generated
- use `Special:MyLanguage` when possible with wiki urls
- use `{@link some-url …}` consistently, instead of `[…](some-url)`, `<some-url>`, or plain `some-url`
consistency
@Derugon Derugon changed the title Update to MW 1.42 & doc fixes MediaWiki 1.42, online doc. URLs, and fixes Apr 26, 2024
mistakes from previous commits
@Derugon Derugon marked this pull request as ready for review April 26, 2024 10:26
AnYiEE added a commit to AnYiEE/types-mediawiki-renovate that referenced this pull request Apr 30, 2024
mw/hook.d.ts Outdated Show resolved Hide resolved
mw/index.d.ts Show resolved Hide resolved
mw/index.d.ts Show resolved Hide resolved
Adrien LESÉNÉCHAL added 2 commits April 30, 2024 14:18
- fix remaining `NotificationOptions` issues
- move remaining Options objects to their own interfaces, so descriptions in some code editors (like VSC) only show relenvant information about the the object itself, not all of its methods and properties. This includes `JQuery.textSelection`, `mw.requestIdleCallback`, and `mw.Title.newFromUserInput` options.
- synchronize `TableSorterOptions` with online doc: change its name and make all its properties optional
- remove redundant jsdoc in `mw.experiments` and empty `@see` annotation in `mw.hook`
- fix some jsdoc link, indent & type inconsistencies
AnYiEE added a commit to AnYiEE/types-mediawiki-renovate that referenced this pull request May 7, 2024
*/
no: string;

/**
* Title text to use for the 'No' button.
* Optional title text to use for the 'No' button.
*/
noTitle: string | undefined;
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 be noTitle?: string instead?

Suggested change
noTitle: string | undefined;
noTitle?: string;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry for the late response. Yeah, that's a mistake, thank you very much, this is applied in the latest commit. defaultOptions has all its properties required (and set to undefined if missing), so I suggest either we keep it as a special case, or we use noTitle?: string | undefined; to match both use cases.

*/
yes: string;

/**
* Title text to use for the 'Yes' button.
* Optional title text to use for the 'Yes' button.
*/
yesTitle: string | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Suggested change
yesTitle: string | undefined;
yesTitle?: string;

AnYiEE added a commit to AnYiEE/types-mediawiki-renovate that referenced this pull request May 19, 2024
Adrien LESÉNÉCHAL added 2 commits May 27, 2024 12:12
- fix `$().confirmable` not allowing omitting some option properties
- update some jQuery plugin URLs, changed since 1.42 release
Adrien LESÉNÉCHAL added 3 commits May 28, 2024 15:50
The `resizeUrl` method may be missing, in which case the method is specified and `null`
for consistency, missed small interfaces from previous commits wikimedia-gadgets@0680f01
Also simplify `RequiredOrUndefined` type
- add various `@since`/`@deprecated` annotations for declarations added/modified/deprecated/removed with 1.40/1.41/1.42
- add `isoDate`/`url` tablesorter parsers, removed since 1.40
- add `jquery.tipsy` RL module, removed since 1.41
- add `mw.language.commafy`, removed since 1.40
- add missing `script` property of a RL module (not added recently, just an oversight)
@siddharthvp siddharthvp linked an issue May 28, 2024 that may be closed by this pull request
@siddharthvp
Copy link
Member

Can you also update the package version to 1.8.0?

@siddharthvp
Copy link
Member

Thanks. This looks thorough as usual!

I sent you an invite for commit access to this repo a month ago, but it expired. I am sending it again. Also, you may want to link your git email with GitHub to get credited in the contributors page

@siddharthvp siddharthvp merged commit 3796925 into wikimedia-gadgets:main May 30, 2024
1 check passed
AnYiEE added a commit to AnYiEE/types-mediawiki-renovate that referenced this pull request May 30, 2024
@jwbth
Copy link

jwbth commented May 31, 2024

Btw I submitted a patch to doc.wikimedia.org that fixes most redirects from old docs, it's merged but not online yet.

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.

Allow to extend widgets and libs
5 participants