Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "fix: remove the fast-kernel multi-kernel modes. Breaking change: FAST no longer supports configuring isolated or version-scoped kernels via the script attribute.",
"packageName": "@microsoft/fast-element",
"email": "7559015+janechu@users.noreply.github.com",
"dependentChangeType": "none"
}
11 changes: 4 additions & 7 deletions packages/fast-element/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ engines must install their own `globalThis` polyfill before FAST loads.
- `FAST.warn(code, values)` / `FAST.error(code, values)` – structured diagnostic messages
- `FAST.addMessages(dict)` – registers human-readable debug messages (imported by `src/debug.ts`)

The `KernelServiceId` object controls which numeric/string keys are used for shared services. Three modes are supported via a `fast-kernel` attribute on the current `<script>` tag:

| Mode | Behaviour |
|---|---|
| `share` | Use the shared numeric kernel service IDs |
| `share-v2` | Use the alternate numeric kernel service IDs |
| *(default)* | Fully isolated instance with a random postfix |
The `KernelServiceId` enum provides the fixed numeric keys used for shared
services on the `FAST` global. These stable IDs let FAST instances on the same
page reuse the update queue, observable system, context event, and element
registry.

---

Expand Down
7 changes: 7 additions & 0 deletions packages/fast-element/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
|---|---|
| `FAST.versions` | No replacement. Multiple FAST versions on the same page are unsupported in v3. |

### Removed configuration

| Removed | Replacement |
|---|---|
| `fast-kernel="share"` / `fast-kernel="share-v2"` / `fast-kernel="isolate"` | No replacement. FAST now uses a single shared kernel contract, and multiple FAST versions on the same page are unsupported. |

### Migration steps

1. Remove any runtime checks that read `FAST.versions`.
2. Fix duplicate FAST installs in your bundler or dependency graph instead of relying on version tracking at runtime.
3. Remove any `fast-kernel` script attributes. They no longer affect FAST initialization.

## Native `globalThis` requirement (v2 → v3)

Expand Down
28 changes: 14 additions & 14 deletions packages/fast-element/SIZES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Bundle sizes for `@microsoft/fast-element` exports.

| Export | Minified | Gzip | Brotli |
|--------|----------|------|--------|
| CDN Rollup Bundle | 63.06 KB | 18.80 KB | 16.88 KB |
| FASTElement | 23.30 KB | 7.32 KB | 6.60 KB |
| Updates | 3.45 KB | 1.43 KB | 1.21 KB |
| Observable | 7.96 KB | 2.94 KB | 2.62 KB |
| observable | 8.00 KB | 2.95 KB | 2.62 KB |
| attr | 3.39 KB | 1.37 KB | 1.13 KB |
| children | 5.99 KB | 2.29 KB | 2.01 KB |
| css | 4.47 KB | 1.78 KB | 1.54 KB |
| ref | 4.96 KB | 1.96 KB | 1.71 KB |
| slotted | 5.78 KB | 2.22 KB | 1.95 KB |
| volatile | 8.05 KB | 2.97 KB | 2.63 KB |
| when | 2.40 KB | 978 B | 786 B |
| html | 27.14 KB | 8.88 KB | 7.96 KB |
| repeat | 30.79 KB | 9.81 KB | 8.82 KB |
| CDN Rollup Bundle | 62.60 KB | 18.64 KB | 16.77 KB |
| FASTElement | 22.88 KB | 7.14 KB | 6.46 KB |
| Updates | 3.03 KB | 1.25 KB | 1.06 KB |
| Observable | 7.55 KB | 2.76 KB | 2.48 KB |
| observable | 7.58 KB | 2.77 KB | 2.50 KB |
| attr | 2.98 KB | 1.18 KB | 1011 B |
| children | 5.58 KB | 2.15 KB | 1.90 KB |
| css | 4.06 KB | 1.60 KB | 1.40 KB |
| ref | 4.55 KB | 1.81 KB | 1.60 KB |
| slotted | 5.36 KB | 2.08 KB | 1.83 KB |
| volatile | 7.64 KB | 2.79 KB | 2.51 KB |
| when | 1.99 KB | 770 B | 625 B |
| html | 26.71 KB | 8.74 KB | 7.84 KB |
| repeat | 30.37 KB | 9.67 KB | 8.70 KB |
61 changes: 6 additions & 55 deletions packages/fast-element/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,66 +103,17 @@ export interface FASTGlobal {
addMessages(messages: Record<number, string>): void;
}

let kernelMode;
const kernelAttr = "fast-kernel";

try {
if (document.currentScript) {
kernelMode = document.currentScript.getAttribute(kernelAttr);
} else {
const scripts = document.getElementsByTagName("script");
const currentScript = scripts[scripts.length - 1];
kernelMode = currentScript.getAttribute(kernelAttr);
}
} catch {
kernelMode = "isolate";
}

/**
* Core services that can be shared across FAST instances.
* Core services shared across FAST instances.
* @internal
*/
type KernelServiceId = {
readonly updateQueue: string | number;
readonly observable: string | number;
readonly contextEvent: string | number;
readonly elementRegistry: string | number;
};

let KernelServiceId: KernelServiceId;

switch (kernelMode) {
case "share": // share the kernel across major versions
KernelServiceId = Object.freeze({
updateQueue: 1,
observable: 2,
contextEvent: 3,
elementRegistry: 4,
});
break;
case "share-v2": // only share the kernel with other v2 instances
KernelServiceId = Object.freeze({
updateQueue: 1.2,
observable: 2.2,
contextEvent: 3.2,
elementRegistry: 4.2,
});
break;
default: {
// fully isolate the kernel from all other FAST instances
const postfix = `-${Math.random().toString(36).substring(2, 8)}`;
KernelServiceId = Object.freeze({
updateQueue: `1.2${postfix}`,
observable: `2.2${postfix}`,
contextEvent: `3.2${postfix}`,
elementRegistry: `4.2${postfix}`,
});
break;
}
export const enum KernelServiceId {
updateQueue = 1,
observable = 2,
contextEvent = 3,
elementRegistry = 4,
}

export { KernelServiceId };

/**
* Warning and error messages.
* @internal
Expand Down
28 changes: 14 additions & 14 deletions sites/website/src/docs/3.x/resources/export-sizes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ Bundle sizes for `@microsoft/fast-element` exports.

| Export | Minified | Gzip | Brotli |
|--------|----------|------|--------|
| CDN Rollup Bundle | 63.06 KB | 18.80 KB | 16.88 KB |
| FASTElement | 23.30 KB | 7.32 KB | 6.60 KB |
| Updates | 3.45 KB | 1.43 KB | 1.21 KB |
| Observable | 7.96 KB | 2.94 KB | 2.62 KB |
| observable | 8.00 KB | 2.95 KB | 2.62 KB |
| attr | 3.39 KB | 1.37 KB | 1.13 KB |
| children | 5.99 KB | 2.29 KB | 2.01 KB |
| css | 4.47 KB | 1.78 KB | 1.54 KB |
| ref | 4.96 KB | 1.96 KB | 1.71 KB |
| slotted | 5.78 KB | 2.22 KB | 1.95 KB |
| volatile | 8.05 KB | 2.97 KB | 2.63 KB |
| when | 2.40 KB | 978 B | 786 B |
| html | 27.14 KB | 8.88 KB | 7.96 KB |
| repeat | 30.79 KB | 9.81 KB | 8.82 KB |
| CDN Rollup Bundle | 62.60 KB | 18.64 KB | 16.77 KB |
| FASTElement | 22.88 KB | 7.14 KB | 6.46 KB |
| Updates | 3.03 KB | 1.25 KB | 1.06 KB |
| Observable | 7.55 KB | 2.76 KB | 2.48 KB |
| observable | 7.58 KB | 2.77 KB | 2.50 KB |
| attr | 2.98 KB | 1.18 KB | 1011 B |
| children | 5.58 KB | 2.15 KB | 1.90 KB |
| css | 4.06 KB | 1.60 KB | 1.40 KB |
| ref | 4.55 KB | 1.81 KB | 1.60 KB |
| slotted | 5.36 KB | 2.08 KB | 1.83 KB |
| volatile | 7.64 KB | 2.79 KB | 2.51 KB |
| when | 1.99 KB | 770 B | 625 B |
| html | 26.71 KB | 8.74 KB | 7.84 KB |
| repeat | 30.37 KB | 9.67 KB | 8.70 KB |
Loading