build: commit builtinblocks Webpack config and stub out xmodule_assets (#32685)

The Webpack configuration file for built-in XBlock JS used to be
generated at build time and git-ignored. It lived at
common/static/xmodule/webpack.xmodule.config.js. It was generated
because the JS that it referred to was also generated at build-time, and
the filenames of those JS modules were not static.

Now that its contents have been made entirely static [1], there is no
reason we need to continue generating this Webpack configuration file.
So, we check it into edx-platform under the name
./webpack.builtinblocks.config.js. We choose to put it in the repo's
root directory because the paths contained in the config file are
relative to the repo's root.

This allows us to behead both the xmodule/static_content.py
(`xmodule_assets`) script andthe  `process_xmodule_assets` paver task, a
major step in removing the need for Python in the edx-platform asset
build [2]. It also allows us to delete the `HTMLSnippet` class and all
associated attributes, which were exclusively used by
xmodule/static_content.py..

We leave `xmodule_assets` and  `process_xmodule_assets` in as stubs for
now in order to avoid breaking external code (like Tutor) which calls
Paver; the entire pavelib/assets.py function will be eventually removed
soon anyway [3]. Further, to avoid extraneous refactoring, we keep one
method of `HTMLSnippet` around on a few of its former subclasses:
`get_html`. This method was originally part of the XModule framework;
now, it is left over on a few classes as a simple internal helper
method.

References:
1. https://github.com/openedx/edx-platform/pull/32480
2. https://github.com/openedx/edx-platform/issues/31800
3. https://github.com/openedx/edx-platform/issues/31895

Part of: https://github.com/openedx/edx-platform/issues/32481
This commit is contained in:
Kyle McCormick
2023-07-27 10:32:29 -04:00
committed by GitHub
parent c0e9dc9edd
commit 355779983e
24 changed files with 164 additions and 481 deletions

View File

@@ -14,7 +14,6 @@ from django.conf import settings
from lxml import etree
from opaque_keys.edx.keys import UsageKey
from pkg_resources import resource_filename
from pytz import UTC
from web_fragments.fragment import Fragment
from xblock.completable import XBlockCompletionMode
@@ -25,7 +24,6 @@ from xblock.fields import Boolean, Integer, List, Scope, String
from edx_toggles.toggles import WaffleFlag, SettingDictToggle
from xmodule.util.builtin_assets import add_webpack_js_to_fragment, add_sass_to_fragment
from xmodule.x_module import (
HTMLSnippet,
ResourceTemplates,
shim_xmodule_js,
STUDENT_VIEW,
@@ -258,7 +256,6 @@ class SequenceBlock(
MakoTemplateBlockBase,
XmlMixin,
XModuleToXBlockMixin,
HTMLSnippet,
ResourceTemplates,
XModuleMixin,
):
@@ -271,20 +268,6 @@ class SequenceBlock(
show_in_read_only_mode = True
uses_xmodule_styles_setup = True
preview_view_js = {
'js': [
resource_filename(__name__, 'js/src/sequence/display.js'),
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js')
}
# There is no studio_view() for this XBlock but this is needed to make the
# the static_content command happy.
studio_view_js = {
'js': [],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js')
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)