Commit a165e94
authored
feat: reduce declarative template size (#7498)
# Pull Request
## 📖 Description
Reduces the declarative template entrypoint size by making optional attribute/observer map and hydration lifecycle support tree-shakable through schema transforms, replacing the custom `TemplateElement` FASTElement with a native `<f-template>` publisher, and updating declarative docs, generated API docs, fixtures, benchmarks, size docs, and the change file.
Optional helpers now use dedicated flat `@microsoft/fast-element` subpaths and are no longer exported from the root entrypoint or the old nested helper paths. The package export map keeps the public paths flat while targeting the actual source and output file locations for `types`, `test`, and `default`.
Examples of the flat subpaths:
- `@microsoft/fast-element/attribute-map.js`
- `@microsoft/fast-element/observer-map.js`
- `@microsoft/fast-element/children.js`
- `@microsoft/fast-element/ref.js`
- `@microsoft/fast-element/slotted.js`
- `@microsoft/fast-element/when.js`
- `@microsoft/fast-element/repeat.js`
- `@microsoft/fast-element/node-observation.js`
- `@microsoft/fast-element/two-way.js`
- `@microsoft/fast-element/signal.js`
- `@microsoft/fast-element/declarative-utilities.js`
Additional dedicated paths include `updates.js`, `observable.js`, `attr.js`, `volatile.js`, `css.js`, `html.js`, `array-observer.js`, `binding.js`, `dom.js`, `schema.js`, `templating.js`, `render.js`, and `hydration.js`.
`FASTElementDefinition.schema` is optional; declarative templates assign or augment it during template resolution, and non-declarative/manual schema users can use `observerMap({ schema })` or provide a schema on the definition. Explicitly supplied schemas are preserved.
This also addresses PR review feedback by replacing shell-string API document generation with argument-based `execFile` usage.
## 📑 Test Plan
- `npm run build:tsc -w @microsoft/fast-element -- --pretty false`
- `npm run doc:exports -w @microsoft/fast-element`
- `npm run doc:exports:ci -w @microsoft/fast-element`
- `npm run build:sizes -w @microsoft/fast-element`
- `npm run prebuild -w @microsoft/fast-site`
- `npm run biome:check`
- `npm run checkchange`
- `node -c sites/website/scripts/generate-docs.cjs`
- `git diff --check`
- Targeted Chromium declarative template bridge tests
- Flat subpath positive resolution checks for default and test conditions
- Stale nested export/import path searches
## ✅ Checklist
### General
- [x] I have included a change request file using `$ npm run change`
- [x] I have added tests for my changes.
- [x] I have tested my changes.
- [x] I have updated the project documentation to reflect my changes.
- [x] I have read the [CONTRIBUTING](https://github.com/microsoft/fast/blob/main/CONTRIBUTING.md) documentation and followed the [standards](https://github.com/microsoft/fast/blob/main/CODE_OF_CONDUCT.md#our-standards) for this project.1 parent b78786a commit a165e94
579 files changed
Lines changed: 20559 additions & 5564 deletions
File tree
- .github/skills/typescript
- change
- examples/todo-app/src
- packages
- fast-element
- docs
- declarative
- hydration
- styles
- scripts
- src
- binding
- components
- declarative
- directives
- di
- hydration
- observation
- state
- styles
- templating
- test
- declarative/fixtures
- bindings
- attribute
- content
- dot-syntax
- event
- host
- directives
- children
- ref
- repeat
- slotted
- when
- ecosystem
- declarative-no-hydration
- errors
- lifecycle-callbacks
- performance-metrics
- extensions
- attribute-map-naming-strategy-camel-case
- attribute-map-naming-strategy
- attribute-map
- observer-map-config-object
- observer-map-deep-merge
- observer-map-properties
- observer-map
- scenarios/nested-elements
- fast-router
- docs
- src
- fast-test-harness
- src/ssr
- sites
- benchmarks/src/scenarios
- all
- hydration
- attr-reflect
- hydration
- basic
- hydration
- bind-event
- hydration
- dot-syntax
- csr
- hydration
- ref-slotted
- hydration
- repeat
- hydration
- when
- hydration
- website
- scripts
- src
- docs/3.x
- advanced
- api
- fast-element
- context
- declarative
- di
- declarative-templates
- getting-started
- resources
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | | - | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
0 commit comments