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: extract template compiler into own package #1954

Merged
merged 16 commits into from
Apr 28, 2024

Conversation

bigopon
Copy link
Member

@bigopon bigopon commented Apr 27, 2024

📖 Description

Currently the template compiler and compilation related infra are part of the runtime html, but it doesn't need to be, splitting this out into its own separate package to promote a reusable bit for build time pre compilation.

The following exports will be moved to the new package @aurelia/template-compiler from @aurelia/runtime-html

- ITemplateCompiler
- ITemplateCompilerHooks,
- TemplateCompilerHooks,
- templateCompilerHooks,
- IAttrMapper
- ITemplateElementFactory
- IInstruction
- InstructionType
- ... instruction classes
- IAttrParser
- AttrSyntax
- IAttributePattern
- AttributePattern
- BindingCommand
- ... default binding command classes

Applications importing the above from the aurelia package won't need to adjust their code, since it'll be the same from within the aurelia package.

Side note: this also allows me to have a clearer look of what a hello world Aurelia app weights like, it's about ~100KB (minified) so this'll be our achievable target with build time pre-compilation, after probably quite some amount of work. With moderate amount of work, its about ~140KB (minified), which is quite acceptable for most apps.

🎫 Issues

Resolve #1746

cc @Sayan751 @fkleuver

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

Attention: Patch coverage is 98.34061% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 88.64%. Comparing base (a83d5a7) to head (2fe5d2f).

Files Patch % Lines
...ackages/template-compiler/src/template-compiler.ts 98.38% 12 Missing ⚠️
packages/template-compiler/src/instructions.ts 96.62% 3 Missing ⚠️
packages/template-compiler/src/binding-command.ts 95.23% 2 Missing ⚠️
packages/state/src/state-templating.ts 0.00% 1 Missing ⚠️
packages/template-compiler/src/utilities-dom.ts 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1954      +/-   ##
==========================================
+ Coverage   88.46%   88.64%   +0.17%     
==========================================
  Files         264      272       +8     
  Lines       22770    22821      +51     
  Branches     5285     5290       +5     
==========================================
+ Hits        20144    20230      +86     
+ Misses       2626     2591      -35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Sayan751
Copy link
Member

Nice work @bigopon! Does this trigger a change in the convention package? For the XXX.define calls? Such as BindingCommand.define etc.?

@bigopon
Copy link
Member Author

bigopon commented Apr 27, 2024

... Does this trigger a change in the convention package? For the XXX.define calls? Such as BindingCommand.define etc.?

It does, I forgot about this. Maybe we can keep things as is by reexporting BindingCommand from runtime-html.

@bigopon bigopon merged commit ad7ae1e into master Apr 28, 2024
28 checks passed
@bigopon bigopon deleted the feat/extract-compiler branch April 28, 2024 12:49
AureliaEffect pushed a commit that referenced this pull request May 3, 2024
2.0.0-beta.16 (2024-05-03)

**Bug Fixes:**

* **au-slot:** ensure passthrough slot get the right host value (#1959) ([f266ddd](f266ddd))
* **rendering:** correctly handle compilation cache (#1955) ([c11491b](c11491b))

**Refactorings:**

* **router-lite:** avoided duplicate CE defn reg to same container (#1956) ([6578e54](6578e54))
* **compiler:** extract template compiler into own package (#1954) ([ad7ae1e](ad7ae1e))
* **compiler:** simplify definition creation (#1950) ([bb0fcab](bb0fcab))
* **observers:** use static blocks, group related code ([ca22bc8](ca22bc8))
* **runtime:** move scope to runtime html (#1945) ([bca0290](bca0290))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: extract template compiler into a separate package
2 participants