From ff8e87ed7cbec5f8e8b6ee1f4cfeb5f9bf138a9e Mon Sep 17 00:00:00 2001
From: Benjamin Franzke <ben@bnf.dev>
Date: Thu, 6 Jul 2023 16:07:48 +0200
Subject: [PATCH] [DOCS] Update docs to refer to ES6 modules instead of
 RequireJS

Resolves: #101265
Releases: main, 12.4
Change-Id: Ia4b6e5f9cb9c17394e3d72e18d9664ccbaf53f85
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79823
Tested-by: Benjamin Franzke <ben@bnf.dev>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: core-ci <typo3@b13.com>
---
 Build/Sources/TypeScript/recycler/recycler.ts  |  2 +-
 .../Form/Element/SelectCheckBoxElement.php     |  2 +-
 .../Controller/BackendUserController.php       |  2 +-
 .../Public/JavaScript/Contrib/README.txt       |  4 ++--
 .../Developer/GraphWidgetImplementation.rst    |  2 +-
 .../Developer/WidgetImplementation.rst         | 18 +++++++++---------
 .../Classes/Evaluation/SourceHost.php          |  2 +-
 .../Documentation/Developer/Extend.rst         | 10 +++-------
 8 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/Build/Sources/TypeScript/recycler/recycler.ts b/Build/Sources/TypeScript/recycler/recycler.ts
index 827c2bbdba49..82eee62014a3 100644
--- a/Build/Sources/TypeScript/recycler/recycler.ts
+++ b/Build/Sources/TypeScript/recycler/recycler.ts
@@ -50,7 +50,7 @@ type RecordToDelete = string;
 
 /**
  * Module: @typo3/recycler/recycler
- * RequireJS module for Recycler
+ * JavaScript module for Recycler
  */
 class Recycler {
   public elements: { [key: string]: JQuery } = {}; // filled in getElements()
diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
index cf269ca4e827..baf035df63ba 100644
--- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
@@ -243,7 +243,7 @@ class SelectCheckBoxElement extends AbstractFormElement
                     $html[] =                '</tr>';
                     $html[] =            '</thead>';
 
-                    // Add RequireJS module. This is only needed, in case the element
+                    // Add JavaScript module. This is only needed, in case the element
                     // is not readOnly, since otherwise no checkbox changes take place.
                     $resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create(
                         '@typo3/backend/form-engine/element/select-check-box-element.js'
diff --git a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
index f99c0763abf2..668bf36d74d8 100644
--- a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
+++ b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
@@ -119,7 +119,7 @@ class BackendUserController extends ActionController
             'dateFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],
             'timeFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],
         ]);
-        // Load requireJS modules
+        // Load JavaScript modules
         $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js');
         $this->pageRenderer->loadJavaScriptModule('@typo3/backend/modal.js');
         $this->pageRenderer->loadJavaScriptModule('@typo3/beuser/backend-user-listing.js');
diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Contrib/README.txt b/typo3/sysext/core/Resources/Public/JavaScript/Contrib/README.txt
index 171227f60568..02988db72a7e 100644
--- a/typo3/sysext/core/Resources/Public/JavaScript/Contrib/README.txt
+++ b/typo3/sysext/core/Resources/Public/JavaScript/Contrib/README.txt
@@ -3,8 +3,8 @@ for the TYPO3 CMS Core. They are mostly managed via Grunt or have been adapted
 to fit our needs.
 
 Please make sure to never reference any file directly here, rather copy
-a file needed in your own extension or reference it via RequireJS instead of
-using the Path to this Contrib/ directory.
+a file needed in your own extension or reference it via JavaScript import
+statments instead of using the Path to this Contrib/ directory.
 
 Libraries not handled by bower/Grunt:
 
diff --git a/typo3/sysext/dashboard/Documentation/Developer/GraphWidgetImplementation.rst b/typo3/sysext/dashboard/Documentation/Developer/GraphWidgetImplementation.rst
index d253c4a5b609..75630d1bee19 100644
--- a/typo3/sysext/dashboard/Documentation/Developer/GraphWidgetImplementation.rst
+++ b/typo3/sysext/dashboard/Documentation/Developer/GraphWidgetImplementation.rst
@@ -16,7 +16,7 @@ Implement graph widget
 .. php:namespace:: TYPO3\CMS\Dashboard\Widgets
 
 First of all a new data provider is required, which will provide the data for the chart.
-Next the data will be provided to the widget instance, which will be rendered with RequireJS modules and Css.
+Next the data will be provided to the widget instance, which will be rendered with JavaScript modules and Css.
 
 To make the dashboard aware of this workflow, some interfaces come together:
 
diff --git a/typo3/sysext/dashboard/Documentation/Developer/WidgetImplementation.rst b/typo3/sysext/dashboard/Documentation/Developer/WidgetImplementation.rst
index 2ff48d6e1f5d..1b2742694ca0 100644
--- a/typo3/sysext/dashboard/Documentation/Developer/WidgetImplementation.rst
+++ b/typo3/sysext/dashboard/Documentation/Developer/WidgetImplementation.rst
@@ -103,7 +103,7 @@ Providing custom JS
 
 There are two ways to add JavaScript for an widget:
 
-RequireJS AMD module
+JavaScript module
     Implement :php:class:`\TYPO3\CMS\Dashboard\Widgets\JavaScriptInterface`:
 
     .. code-block:: php
@@ -114,11 +114,11 @@ RequireJS AMD module
             public function getJavaScriptModuleInstructions(): array
             {
                 return [
-                    JavaScriptModuleInstruction::forRequireJS(
-                        'TYPO3/CMS/MyExtension/ModuleName'
+                    JavaScriptModuleInstruction::create(
+                        '@myvendor/my-extension/module-name.js'
                     )->invoke('initialize'),
-                    JavaScriptModuleInstruction::forRequireJS(
-                        'TYPO3/CMS/MyExtension/ModuleName2'
+                    JavaScriptModuleInstruction::create(
+                        '@myvendor/my-extension/module-name2.js'
                     )->invoke('initialize'),
                 ];
             }
@@ -126,7 +126,7 @@ RequireJS AMD module
 
    .. seealso::
 
-      :ref:`t3coreapi:requirejs` for more info about RequireJS in TYPO3 Backend.
+      :ref:`t3coreapi:backend-javascript-es6` for more info about JavaScript in TYPO3 Backend.
 
 Plain JS files
     Implement :php:class:`AdditionalJavaScriptInterface`:
@@ -144,7 +144,7 @@ Plain JS files
            }
        }
 
-RequireJS
+JavaScript
     Implement :php:class:`\TYPO3\CMS\Dashboard\Widgets\JavaScriptInterface`:
 
     .. code-block:: php
@@ -155,8 +155,8 @@ RequireJS
             public function getJavaScriptModuleInstructions(): array
             {
                 return [
-                    JavaScriptModuleInstruction::forRequireJS(
-                        'TYPO3/CMS/Dashboard/ChartInitializer'
+                    JavaScriptModuleInstruction::create(
+                        '@typo3/dashboard/chart-initializer.js'
                     )->invoke('initialize'),
                 ];
             }
diff --git a/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php b/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php
index 14f2a4573ba1..30444e6601e1 100644
--- a/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php
+++ b/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php
@@ -33,7 +33,7 @@ class SourceHost
      * (invoked by FormEngine when editing redirect entities).
      *
      * Returned `JavaScriptModuleInstruction` delegates handling to corresponding
-     * RequireJS module, having a method `evaluateSourceHost` that deals with that
+     * JavaScript module, having a method `evaluateSourceHost` that deals with that
      * evaluation request.
      */
     public function returnFieldJS(): JavaScriptModuleInstruction
diff --git a/typo3/sysext/t3editor/Documentation/Developer/Extend.rst b/typo3/sysext/t3editor/Documentation/Developer/Extend.rst
index c5a432e04c07..7947c12089bc 100644
--- a/typo3/sysext/t3editor/Documentation/Developer/Extend.rst
+++ b/typo3/sysext/t3editor/Documentation/Developer/Extend.rst
@@ -38,7 +38,7 @@ To register an addon, the following code may be used:
 
     return [
         'my/addon' => [
-            'module' => 'cm/addon/my/addon',
+            'module' => JavaScriptModuleInstruction::create('@codemirror/addon', 'addon')->invoke()
             'cssFiles' => [
                 'EXT:my_extension/Resources/Public/Css/MyAddon.css',
             ],
@@ -61,9 +61,7 @@ To register an addon, the following code may be used:
     :type: string
     :Required: true
 
-    Holds the RequireJS namespace of the CodeMirror module. For custom
-    modules placed in an extension, the known
-    `TYPO3/CMS/Extension/Module` namespace must be used.
+    Holds the JavaScriptModuleInstruction of the CodeMirror module.
 
 .. confval:: cssFiles
 
@@ -122,9 +120,7 @@ To register a mode, the following code may be used:
     :type: string
     :Required: true
 
-    Holds the RequireJS namespace of the CodeMirror module. For custom
-    modules placed in an extension, the known
-    `TYPO3/CMS/Extension/Module` namespace must be used.
+    Holds the JavaScriptModuleInstruction of the CodeMirror module.
 
 .. confval:: extensions
 
-- 
GitLab