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

fix(dev-scripts)!: Fixes, refactoring and simplification of webpack.config.js and 'blockly' imports #2229

Merged
merged 11 commits into from
Mar 15, 2024

Commits on Feb 29, 2024

  1. chore(dev-scripts)!: Remove support acquiring Blockly through git

    Completes revert of PR google#335.
    
    BREAKING CHANGE: This PR removes the support that was added
    in PR google#335 for aquiring Blockly directly from a git:// URL.
    
    This feature was useful insofar as it enabled merging changes
    into blockly-samples that depend on changes in blockly that
    have not yet been published (even as a beta)—and still have
    tests pass.  For this to work seamlessly, however, the code
    in webpack.config.js depended on a postinstall script that
    was removed in PR google#1630.
    
    When testing such PRs going forward use npm link for local
    testing and wait for changes to blockly to be published
    before merging the corresponding changes to samples—or wait
    for blockly to become a monorepo so both changes can be made
    in the same PR!
    
    Note that this change is breaking only to the dev-scripts plugin
    itself, and will not cause other plugins that use it as a dev
    dependency to experience a breaking change.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    e14c67f View commit details
    Browse the repository at this point in the history
  2. fix(dev-scripts): Restore packageJson for setting PACKAGE_NAME

    The commit which removed support for git:// URLS by completing
    the revert of PR google#335 removed the initialisation of packageJson
    (from the package.json of the plugin being built) which turns
    out to still be needed by a DefinePlugin call added later.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    3938745 View commit details
    Browse the repository at this point in the history
  3. fix(dev-scripts): Don't use alias when resolving blockly

    PR google#226 addedd a resolve.alias for blockly to webpack.config.js.
    It is not entirely clear what the purpose of this was at the
    time, but it has the effect of treating imports of submodules
    (e.g. 'blockly/core') as if they were direct imports (e.g. of
    './node_modules/blockly/core.js'), causing webpack to ignore
    the blockly package's package.json file.
    
    This causes plugins to fail to build due to the introduction
    of an exports stanza in that file (and other related changes)
    in google/blockly#7822.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    4be9f33 View commit details
    Browse the repository at this point in the history
  4. fix(dev-scripts): Exclude blockly from plugin bundles

    Fix bloat caused by some plugins depending on all of blockly
    (instead of just blockly/core), resulting in webpack including
    a copy of blockly in the bundled plugin becuase only the
    subpackage entrypoints were listed inthe externals stanza of
    webpack.config.js.
    
    This will also avoid certain problems that might occur due to
    apps using such bundled inadvertently containing two or more
    different copies of Blockly.
    
    Also fix the one plugin which did still have an unnecessary dependency
    on blockly intead of blockly/core.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    8aa6cfd View commit details
    Browse the repository at this point in the history
  5. refactor(dev-scripts): Introduce exists() for readability

    Currently webpack.conf.js is hard to understand.  Attempt to
    improve readability by making some parts more DRY ("don't
    repeat yourself") and others more DAMP ("descriptive and
     meaningful phrases").
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    17cc0c0 View commit details
    Browse the repository at this point in the history
  6. fix(dev-scripts): Ignore more jsdom subdependencies

    Add bufferutils and utf-8-validate to IgnorePlugin config when
    building tests.  These are optional dependencies of wd, which is
    itself a dependency of jsdom.
    
    Also refactor how plugins config is generated to improve readability.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    2ab1194 View commit details
    Browse the repository at this point in the history
  7. refactor(dev-scripts): Simplify resolve.extensions

    There doesn't appear to be any reason not to include the '.ts'
    in resolve.extensions even for pure-JS plugins, but it is
    _necessary_ to include it in TS plugins.
    
    Since the default value for resolve.extensions is
        ['.js', '.json', '.wasm']
    set it to
        ['.ts', '.js', '.json', '.wasm']
    which gives priority to TS, then JS, then the other default
    extensions.
    
    Also add a helpful comment explaining the purpose of
    resolve.fallback.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    27c9873 View commit details
    Browse the repository at this point in the history
  8. fix(plugins): Build tests against 'blockly', not 'blockly/node'

    The latter has never been an advertised entrypoint, and will
    cease to be a valid entrypoint in v11 (see google/blockly#7822).
    Fortunately the 'blockly' entrypoint behaves the same as
    the 'blockly/node' entrypoint does in a node.js environment.
    cpcallen committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    f4d977d View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    1ea41d7 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2024

  1. fix(dev-tools): Have runSerializationTestSuite accept Blockly

    Have runSerializationTestSuite accept a second argument which is
    the Blockly object to use for XML serialization/deserialization.
    
    This works around an issue in blockly-samples that (following
    the deletion of the alias for blockly in webpack.config.js)
    causes tests using this function to fail due to having two copies
    of jsdom loaded, where each will reject DOM objects created by
    the other.  See
    google#2229 (comment)
    for more details.
    cpcallen committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    c453fb7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d0f05bc View commit details
    Browse the repository at this point in the history