Commit graph

86 commits

Author SHA1 Message Date
MusikAnimal 7d3482f89e Isolate build step to CM6 library and restructure files to work with RL
CodeMirror 6 requires the use of NPM, but we can still bundle all CM
packages into one file, and then everything else (i.e. our code) is
managed by ResourceLoader as per usual. This makes contribution
considerably easier as we no longer need a build step for each change.

CM5 files are now under resources/legacy, and the CM6 files are moved to
the root of the resources/ directory. Only one file,
codemirror.bundle.js, is managed by Rollup, while everything else is RL.
The Rollup output for now is put under resources/lib/ alongside the CM5
upstream files.

This patch is *mostly* renames of files, along with changing ECMAScript
Module (ESM) syntax into the CommonJS style that ResourceLoader prefers.
We also remove more modern JS syntax (i.e. private class methods) that
we were able to use before because we had a build step with Babel.

This patch should effectively make no user-facing changes, or to the
ResourceLoader modules we offer in Extension:CodeMirror.

Finally, bump version in extension.json to 6, to match the upstream lib,
and add Bhsd as an author :-)

Bug: T368053
Change-Id: Ie258e49f5df8db23a7344ac3c4c9300aaa991042
2024-07-31 22:45:48 -04:00
Ed Sanders 17fefeb8fb build: Update jsdoc-wmf-theme to 1.1.0
Bug: T368081
Change-Id: I188c5549415f4620bb95df2e285c5519bc97ead1
2024-06-26 12:09:52 +01:00
Ed Sanders 6958b99f2e build: Update eslint-config-wikimedia to 0.28.2 and autofix
Change-Id: I622f53bf5f56782b7a0529cdc6bb27c1315ff5a0
2024-06-17 13:02:26 +00:00
libraryupgrader f98b120974 build: Updating braces to 3.0.3
* https://github.com/advisories/GHSA-grv7-fg5c-xmjg

Change-Id: I637259940dcc6d3a3c1bec1cd6d75a671db921f9
2024-06-11 02:56:45 +00:00
James D. Forrester 0c7044e764 .nvmrc: Update version from 18.17.0 to 18.20.2
Change-Id: Ie6b0918ff7cd627e9323e5f447c993f6b1448d8f
2024-05-30 22:04:13 -04:00
libraryupgrader 31815d8036 build: Updating grunt-banana-checker to 0.13.0
Change-Id: Ieeb3108280f96193a45dd8e5c5472ee97a985388
2024-05-18 03:53:50 +00:00
libraryupgrader 477da344c0 build: Updating grunt-banana-checker to 0.12.0
Change-Id: I2fda64fe3eeb5f681911ddd5454d0409405dceb6
2024-05-10 02:24:46 +00:00
libraryupgrader 8ea2953375 build: Updating dependencies
composer:
* mediawiki/minus-x: 1.1.1 → 1.1.3

npm:
* jsdoc-wmf-theme: 1.0.0 → 1.0.1

Change-Id: Id3d2d7b46648c8ea139ef8a72c12fb0861915922
2024-05-08 07:35:28 +00:00
libraryupgrader 888593d412 build: Updating ejs to 3.1.10
* https://github.com/advisories/GHSA-ghr5-ch3p-vcr6

Change-Id: I6ca8243e3b40258207a01f0e8a91a7ddc0db47fb
2024-05-02 03:03:36 +00:00
libraryupgrader f34db5db7f build: Updating dependencies
composer:
* php-parallel-lint/php-parallel-lint: 1.3.2 → 1.4.0

npm:
* jsdoc-wmf-theme: 0.0.13 → 1.0.0

Change-Id: Id6718e5acc928c5d0aae6d143d49b73afcf33bd9
2024-04-25 03:43:10 +00:00
Taavi Väänänen 5c71833728 build: Update eslint-config-wikimedia to 0.27.0
Change-Id: I71646291ecf6ba22dd5a0e45f44ea54eacfa6bfc
2024-04-24 11:46:59 +00:00
MusikAnimal d652f3d2a2 CM6: Add jsdoc build step, fix JSDoc annotations, and add @stable tags
There is a known bug with JSDoc and using `export default`. These must
be separate statements for JSDoc to parse properly.
See https://github.com/jsdoc/jsdoc/issues/1132

Update README; change log now lives on the wiki.

Bug: T359986
Depends-On: I58a0766e35eddaf7bebe2c080757bb09963d8555
Change-Id: Ibc2212ef9eab512511b13a99ecc2ccbda8c52ece
2024-03-26 13:35:47 -04:00
MusikAnimal ca02360228 CM6: Switch to using Rollup instead of Webpack; make RL-compatible
See https://w.wiki/9Twh for example usage with ResourceLoader.

Webpack is retired in favor of Rollup, which allows us to convert the
ECMAScript Modules into CommonJS modules for use by ResourceLoader.
We now have a file in dist/ for each RL module that we want to offer,
including the 'lib' module which includes the CM library itself.

Because Rollup has no knowledge of the ResourceLoader module registry,
the generated output requires other modules via relative path, when it
needs to be the RL module name. To get around this, we do a crude
find/replace after the files are generated. Hacky, but necessary to make
CodeMirror usable by gadgets and scripts that don't also want
WikiEditor.

Add new RL modules 'ext.CodeMirror.v6.lib' (vendor code) and
'ext.CodeMirror.v6' (the main CodeMirror class, sans WikiEditor).

Clean up extension.json, listing the v6 modules beneath the old ones.

Bug: T214989
Change-Id: Ide716247e545cf2bdd977bea645729564ebbe6e2
2024-03-19 22:48:52 -04:00
libraryupgrader b19d4c3383 build: Updating bundlesize to 0.18.2
Change-Id: I746631d5890930cf7d37673d88ce00e49d68c973
2024-03-15 22:32:23 +00:00
libraryupgrader 3a6c805135 build: Updating follow-redirects to 1.15.6
* https://github.com/advisories/GHSA-cxjh-pqwp-8mfp

Change-Id: I21a0b0aee97783e57e3860276df6eab3850ac9b6
2024-03-15 00:44:16 +00:00
bhsd e4eb2846c9 fix scroll behavior of CodeMirror 6
Previously, the CM6 editor always scrolls into view, which is annoying during preview. With this patch, the CM6 editor only scrolls to the selection while the whole webpage does not scroll. In addition, the editor's scroll position will be memorized when previewing.

This patch requires an update of the @codemirror/view package.

Bug: T212899
Bug: T254962
Change-Id: I7f5e4694fa55c380958fa60ff6b3341bea1d2f02
2024-03-01 13:01:11 +08:00
libraryupgrader 1651e7e3e2 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: I9cf51b23b89c9fea0b777c7abb9104f23e8647d0
2024-02-10 07:28:15 +00:00
James D. Forrester 75127a79e3 .nvmrc: Update now we're using Node 18
This also necessitated switching to a newer version of
babel-loader that is compatible with Node 18's SSL stack.

Change-Id: Ic9b65ced978fd91a3c0e50ab94cd59556c355ba9
2024-01-11 11:05:51 -05:00
MusikAnimal c670344851 Implement core MediaWiki stream parser for CodeMirror 6
This is more or less a exact port of the old stream parser, with the big
notable change being that all configuration-related code lives in a
separate class, CodeMirrorModeMediaWikiConfig. A smaller change is that
closing HTML tags that are marked as errors now have the ending '>'
character highlighted red, when it didn't before.

Integration with other extensions and modes is saved for a future patch
(T348684). This means <nowiki>, <ref> and other extension-supplied
markup is not yet highlighted.

The entry point for WikiEditor integration is now at
ext.CodeMirror.v6.WikiEditor.init.js, which needs to first require the
virtual file set via the DataScript (PHP) class. This can't be
integrated into the CM6 code because it needs to be precompiled before
ResourceLoader can use it (T281781).

Known issues, to be addressed separately:

* No support for TagModes / PluginModes (T348684)
* Identical adjacent tokens produce excess markup (T352917)
* Section headings do not have line-level styling (T351686)

Bug: T348019
Change-Id: I8f8a81f362bed60dea14ecde9487a2b0c89225e8
2024-01-02 23:18:32 -05:00
MusikAnimal 62485151c2 CodeMirrorWikiEditor: add bracketMatching as default extension
By default, this feature highlights unmatched brackets when the cursor
is placed over it. This can be disabled, but seems useful so we'll add
it as one of the new features in README and see how users react.

Bug: T348019
Change-Id: Ie6af715e40aeb8217a7c4dfe0c6e6a3dcfa725d5
2023-12-06 01:46:58 -05:00
MusikAnimal 75fa1ec8c7 Bump Node dependencies and fix deprecations and linting failures
Bumps the following, which will be needed by subsequent patches:

* stylelint-config-wikimedia = 0.16.1
* webpack = 5.89.0
* webpack-cli = 5.1.4
* @babel/preset-env = 7.3.0

Change-Id: Icd44ad126f11365ee1215672cee66868e79c8978
2023-12-06 00:43:15 -05:00
MusikAnimal 880c690a10 CodeMirror6: add new modules, feature flag, and URL query parameter
Add a new $wgCodeMirrorV6 temporary feature flag that when enabled,
will load the 'ext.CodeMirror.v6.WikiEditor' module that is built
against CodeMirror 6. You can also pass in the ?cm6enable=1 query
parameter to force use of CodeMirror 6. This is currently only
implemented for the 2010 editor.

Due to packaging constraints with CodeMirror 6, we now use Webpack to
bundle the files, which are then used by ResourceLoader. This is similar
to what is done for Extension:Popups, MobileFrontend, among other
extensions.

A new generic class CodeMirror can be used on other areas where syntax
highlighting is desirable, but not necessarily for editing (i.e. without
WikiEditor).

This commit merely lays the foundation for CodeMirror 6 and updates
WikiEditor to use it. The actual MediaWiki syntax highlighting will come
with a future commit.

With the new Webpack build, the Gruntfile was removed and the tasks
moved to npm commands.

Bug: T317243
Change-Id: I2239d2449b2db3b638551f847eb4eff1aafa6276
2023-10-09 19:51:24 -04:00
WMDE-Fisch e6852a47f8 [build] Bump wdio-mediawiki to v2.3.0
Change-Id: I87225bc7cb311b6bbeb57f56e9ed4715f4958f76
2023-09-22 16:01:38 +00:00
Ed Sanders 21c121b898 build: Update linters
Change-Id: I49eb2de402a8c89065968cf927a2ca6a361ca684
2023-09-13 14:02:43 +01:00
James D. Forrester 9e9a38d6fc Refactor CodeMirror WebdriverIO tests from sync to async mode
Bug: T300205
Change-Id: Idfcfc984833ca6ca6c09500cd4715a4e5504f84e
2023-06-06 10:49:22 +02:00
libraryupgrader c898ddf371 build: Updating npm dependencies
* grunt-banana-checker: 0.10.0 → 0.11.0
* stylelint-config-wikimedia: 0.14.0 → 0.15.0

Change-Id: I952b7bd8671bd684446b90d92d2b0ba2837b3cc8
2023-06-01 02:55:40 +00:00
libraryupgrader 025910fccd build: Updating eslint-config-wikimedia to 0.25.0
Change-Id: I1eab6254c50272e4b794eb60721cc52eae319ad9
2023-05-04 01:35:40 +00:00
libraryupgrader fc5ad37762 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.0 → 0.12.1

npm:
* grunt-eslint: 24.0.0 → 24.0.1

Change-Id: I6a871fed872d8314e82cd083db2ab98ba683d63a
2023-04-29 01:27:19 +00:00
libraryupgrader d4d29ace60 build: Updating npm dependencies
* grunt: 1.5.3 → 1.6.1
* stylelint-config-wikimedia: 0.13.1 → 0.14.0

Change-Id: Ib5ce0735dfac337882d65155b767adc773f0691b
2023-03-27 19:38:31 +00:00
Umherirrender 818245a30f build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0

Change-Id: I576c1693596280e56b05ea6f485c1a995167112c
2023-03-25 22:37:01 +01:00
libraryupgrader 381a119559 build: Updating http-cache-semantics to 4.1.1
* https://github.com/advisories/GHSA-rc47-6667-2j5j

Change-Id: I414aadd53d2ec5228b77ccb70e97d934f2d50419
2023-02-02 23:45:16 +00:00
libraryupgrader 9f6de44d25 build: Updating ua-parser-js to 0.7.33
* https://github.com/advisories/GHSA-fhg7-m89q-25r3

Change-Id: Ib87b1e8e4a6835fa47f4330e518cd239f29183b3
2023-01-26 10:09:13 +00:00
Peter Wangai 070ba2cf9b selenium: Remove webdriverio npm package from the CodeMirror extension
The `webdriverio` package does not need to be an explicit dependency.
It is a dependency of `@wdio/cli`.

Bug: T325059
Change-Id: I74db4da791a3a9da5e130bf5e676264c8aff28ef
2023-01-11 15:36:51 +03:00
libraryupgrader baa0bde13c build: Updating qs to 6.5.3
* https://github.com/advisories/GHSA-hrpp-h998-j3pp

Change-Id: Iec46b8b599c47210777df445bc305a3246c35831
2022-12-07 01:14:39 +00:00
libraryupgrader d6983e8a53 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 39.0.0 → 40.0.1

npm:
* stylelint-config-wikimedia: 0.13.0 → 0.13.1

Change-Id: If385e70b0bf3353adbf9d3b2f95986c9e38476a8
2022-11-16 04:20:15 +00:00
libraryupgrader b75dfe00ae build: Updating grunt-stylelint to 0.18.0
Change-Id: I1fa7e3a65a17a90bd69af999f195634f5c27a22a
2022-11-13 02:34:56 +00:00
libraryupgrader 295387b470 build: Updating npm dependencies
* minimatch: 3.0.4 → 3.0.8
  * https://github.com/advisories/GHSA-f8q6-p94x-37v3
* recursive-readdir: 2.2.2 → 2.2.3
  * https://github.com/advisories/GHSA-f8q6-p94x-37v3

Change-Id: I1ec62eb6de90481f215b6272a555fe5e12885bb9
2022-10-26 01:28:36 +00:00
libraryupgrader 9ee72034e8 build: Updating grunt-banana-checker to 0.10.0
Change-Id: Iadb6cf0718e589b83bc0b833fcd066cb53081e26
2022-10-06 21:10:21 +00:00
libraryupgrader 522ba49be2 build: Updating got to 11.8.5
* https://github.com/advisories/GHSA-pfrx-2q88-qq97

Change-Id: I90cfb8eaeb0266ae457c06e14cb2ae3cb82c1dcd
2022-06-22 05:41:29 +00:00
libraryupgrader ab9fa44e39 build: Updating grunt to 1.5.3
Change-Id: Ice96760213e0b100bfa38255f5330ea711c9d6d0
2022-05-26 09:01:24 +00:00
libraryupgrader 0924c055bb build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* mediawiki/mediawiki-phan-config: 0.11.0 → 0.11.1
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2

npm:
* grunt: 1.4.1 → 1.5.2
* stylelint-config-wikimedia: 0.12.2 → 0.13.0
* wdio-mediawiki: 1.1.1 → 1.2.0
* async: 3.2.0 → 3.2.3
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* ejs: 3.1.5 → 3.1.8
  * https://github.com/advisories/GHSA-phwq-j96m-2c2q
* jake: 10.8.2 → 10.8.5
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25
* json-schema: 0.2.3 → 0.4.0
  * https://github.com/advisories/GHSA-896r-f27r-55mw
* jsprim: 1.4.1 → 1.4.2
  * https://github.com/advisories/GHSA-896r-f27r-55mw
* minimist: 1.2.5 → 1.2.6
  * https://github.com/advisories/GHSA-xvch-5gv4-984h
* mocha: 9.1.2 → 9.2.2
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* nanoid: 3.1.25 → 3.3.1
  * https://github.com/advisories/GHSA-qrpm-p2h7-hrv2
* node-fetch: 2.6.1 → 2.6.7
  * https://github.com/advisories/GHSA-r683-j2x4-v87g

Additional changes:
* Set `name` in package.json.

Change-Id: Ib0f4642ab65e3e04ee6e324a84486accb107f564
2022-05-21 01:38:38 +00:00
Ed Sanders 80336b322a build: Update devDependencies
Change-Id: Ia0f3481cb4e153338ef68c1d44951d897ddc7195
2022-03-13 22:56:14 +00:00
libraryupgrader 0acb7475bd build: Updating validator to 13.7.0
* https://npmjs.com/advisories/1004784 (CVE-2021-3765)

Change-Id: I056b958f41dc9453068a0226f12a29ae0b270047
2021-11-04 10:23:33 +00:00
Željko Filipin 3d72bc7fc4 selenium: Remove wdio-video-reporter npm package
The repository uses video recording from wdio-mediawiki package.

Bug: T294341
Change-Id: I2a353b8443d1e5b1b4da8e21952ab882de2b89ae
2021-10-26 14:59:55 +02:00
libraryupgrader 6c842629d9 build: Updating npm dependencies
* @wdio/mocha-framework: 7.4.6 → 7.13.2
  * https://npmjs.com/advisories/5197 (CVE-2021-3807)
* ansi-regex: 5.0.0 → 5.0.1
  * https://npmjs.com/advisories/5197 (CVE-2021-3807)

Additional changes:
* composer.json: Updated phpcs command in composer test (T280592).
* composer.json: Added phpcs command to scripts (T280592).

Change-Id: Ie856dccce0f190788f394f0fd22d3fcddacddb87
2021-10-04 15:31:26 +00:00
libraryupgrader 71013b19ec build: Updating stylelint-config-wikimedia to 0.11.1
Change-Id: Ia9c3cbbff62e2363396741ec5655c0673e06c5cb
2021-09-04 19:10:40 +00:00
libraryupgrader ad8dfbd770 build: Updating path-parse to 1.0.7
* https://npmjs.com/advisories/1773 (CVE-2021-23343)

Change-Id: I24cfa814a40ece25d83f969f68a0ce2352718cdd
2021-08-11 15:39:38 +00:00
libraryupgrader 0332e21139 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* hosted-git-info: 2.8.8 → 2.8.9
* hosted-git-info: 2.7.1 → 3.0.8
  * https://npmjs.com/advisories/1677 (CVE-2021-23362)
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* browserslist: 4.16.0 → 4.16.6
  * https://npmjs.com/advisories/1747 (CVE-2021-23364)
* ws: 7.4.1 → 7.5.3
  * https://npmjs.com/advisories/1748 (CVE-2021-32640)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: None → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)
* normalize-url: 4.5.0 → 4.5.1
  * https://npmjs.com/advisories/1755 (CVE-2021-33502)

Change-Id: Ib03f54f3cf310e5e1abe3d3d773f8320a9b16828
2021-07-23 19:30:13 +00:00
sahil daeaae012c selenium: Update wdio-mediawiki
wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Bug: T283597
Change-Id: I88096682276de901e9a9f0d406b7b2e5ca2d8875
2021-06-21 19:36:43 +05:30
sahil f1221d00ec selenium: Upgrade WebdriverIO to v7
Update npm packages: @wdio/* and webdriverio.

Bug: T274579
Change-Id: I6a154ffa5d00f86aa0718aacf5593259568f250d
2021-06-09 00:26:50 +05:30