Skip to content

change(web): util package modularization, bundling 🧩#7800

Merged
jahorton merged 12 commits intofeature-esmodule-web-enginefrom
change/web/util-modularization
Feb 2, 2023
Merged

change(web): util package modularization, bundling 🧩#7800
jahorton merged 12 commits intofeature-esmodule-web-enginefrom
change/web/util-modularization

Conversation

@jahorton
Copy link
Copy Markdown
Contributor

@jahorton jahorton commented Nov 23, 2022

A very early-stage part of addressing #7309. As a result, the Web build (and those dependent on it) will be broken for a while in this PR and its following chain.

The highlights:

  1. Drops the namespaced version from the keyman-version build output. Where we're going, we don't need (or want) namespaces.
  2. I decided to experiment a bit for DeviceSpec - its related enums are now attached as 'subclasses' of a sort via namespace-aliasing tricks like seen here: https://stackoverflow.com/a/47401896
    • I thought I saw official documentation about this trick at some point, but I'm having difficulty finding that reference at the moment.
  3. common/web/utils is now fully ES6-module based; that's what its TypeScript build output produces.
    • https://esbuild.github.io/content-types/#es5 - esbuild doesn't handle transformations to es5 well. Known limitation.
    • tsc, on the other hand, has no such qualms and is happy to transpile to ES5, so we can just bundle that instead.
    • This was the best step I could find to enable the next one.
  4. As an early prototype, the utils module build now includes a bundled build version, courtesy of es6build. This relies upon a prior TS build, bundling its JS outputs.
    • As the bundle-build is thus JS-based, it is best to ensure that all import statements refer to .js files, rather than .ts files.
    • If from a separate submodule, use an import on the node-modules version of the path based on the build directory / 'output' version of the submodule.

@keymanapp-test-bot skip

@jahorton jahorton added this to the 17.0 milestone Nov 23, 2022
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Nov 23, 2022

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

@jahorton jahorton force-pushed the change/web/util-modularization branch from 24a46bf to 1966468 Compare January 20, 2023 06:03
@jahorton jahorton changed the base branch from master to feature-esmodule-web-engine January 20, 2023 06:03
@jahorton jahorton marked this pull request as ready for review January 20, 2023 06:03
@github-actions github-actions bot added web/ and removed web/ labels Jan 27, 2023
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think LGTM. I can see us wanting to converge on a common set of params for build-bundler.js over time.

@github-actions github-actions bot added web/ and removed web/ labels Feb 2, 2023
@jahorton jahorton merged commit 84e80fc into feature-esmodule-web-engine Feb 2, 2023
@jahorton jahorton deleted the change/web/util-modularization branch February 2, 2023 07:07
@mcdurdin mcdurdin modified the milestones: 17.0, A17S19 Aug 18, 2023
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.

2 participants