[go: nahoru, domu]

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

refactor(build): Delete Closure Library #7415

Merged
merged 8 commits into from
Aug 30, 2023

Conversation

cpcallen
Copy link
Contributor
@cpcallen cpcallen commented Aug 20, 2023

The basics

The details

Resolves

Almost finishes resolving #6858.

Proposed Changes

  1. Restore erroneously-deleted filter function in buildDeps.

    This was deleted in PR refactor(tests): Use import instead of goog.bootstrap to load Blockly in mocha tests #7406 as it was mainly being used to filter core/ vs. test/mocha/ deps into separate deps files—but it turns out also to be used for filtering error messages too. Oops.

  2. Migrate advanced compilation test to ES Modules

  3. Migrate main.js to TypeScript.

    This turns out to be pretty straight forward, even if it would cause crashing if one actually tried to import this module instead of just feeding it to Closure Compiler.

  4. Remove goog.declareModuleId calls.

    Replace each one with a comment recording the former module ID for posterity (or at least until we decide how to reformat the renamings file.

  5. Delete closure/goog/*

    By changing slightly the command line arguments to closure-make-deps and closure-calculate-chunks, even the need to have a vestigial base.js contianing only @declareGoog is eliminated.

Behaviour Before Change

  • The Advanced Compilation Test and core/base.js used goog.require to obtain their dependencies.
  • closure-make-deps and closure-calculate-chunks depended on the existence of a base.js file, containing a @declareGoog JSDoc directive.

Behaviour After Change

  • The ACT and main.ts are ES and TS modules respectively, using import to get their dependencies.
  • closure-make-deps and closure-calculate-chunks do not need any base.js.

Reason for Changes

Eliminate code we no longer need. Make it possible to build Blockly using webpack or another minifier that's not Closure Compiler.

Test Coverage

Passes npm test.

Additional Information

This PR depends upon #7414 in order to pass tests. Once #7414 is merged, this PR must be rebased onto develop or have develop merged in.

This was deleted in PR google#7406 as it was mainly being used to
filter core/ vs. test/mocha/ deps into separate deps files -
but it turns out also to be used for filtering error
messages too.  Oops.
This turns out to be pretty straight forward, even if it would
cause crashing if one actually tried to import this module
instead of just feeding it to Closure Compiler.
Replace goog.declareModuleId calls with a comment recording the
former module ID for posterity (or at least until we decide
how to reformat the renamings file.
For the moment we still need something to serve as base.js for
the benefit of closure-make-deps, so we keep a vestigial
base.js around, containing only the @provideGoog declaration.
By changing slightly the command line arguments to
closure-make-deps and closure-calculate-chunks the need to have
any base.js is eliminated.
core/main.ts Outdated Show resolved Hide resolved
@cpcallen cpcallen merged commit b0a7c00 into google:develop Aug 30, 2023
7 checks passed
@cpcallen cpcallen deleted the refactor/6858/debase branch August 30, 2023 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants