Skip to content

Commit d496b46

Browse files
committed
fix: remove shared kernel
1 parent 8eb2a69 commit d496b46

6 files changed

Lines changed: 52 additions & 90 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"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.",
4+
"packageName": "@microsoft/fast-element",
5+
"email": "7559015+janechu@users.noreply.github.com",
6+
"dependentChangeType": "none"
7+
}

packages/fast-element/DESIGN.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,10 @@ engines must install their own `globalThis` polyfill before FAST loads.
6969
- `FAST.warn(code, values)` / `FAST.error(code, values)` – structured diagnostic messages
7070
- `FAST.addMessages(dict)` – registers human-readable debug messages (imported by `src/debug.ts`)
7171

72-
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:
73-
74-
| Mode | Behaviour |
75-
|---|---|
76-
| `share` | Use the shared numeric kernel service IDs |
77-
| `share-v2` | Use the alternate numeric kernel service IDs |
78-
| *(default)* | Fully isolated instance with a random postfix |
72+
The `KernelServiceId` enum provides the fixed numeric keys used for shared
73+
services on the `FAST` global. These stable IDs let FAST instances on the same
74+
page reuse the update queue, observable system, context event, and element
75+
registry.
7976

8077
---
8178

packages/fast-element/MIGRATION.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88
|---|---|
99
| `FAST.versions` | No replacement. Multiple FAST versions on the same page are unsupported in v3. |
1010

11+
### Removed configuration
12+
13+
| Removed | Replacement |
14+
|---|---|
15+
| `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. |
16+
1117
### Migration steps
1218

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

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

packages/fast-element/SIZES.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ Bundle sizes for `@microsoft/fast-element` exports.
44

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

packages/fast-element/src/interfaces.ts

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -103,66 +103,17 @@ export interface FASTGlobal {
103103
addMessages(messages: Record<number, string>): void;
104104
}
105105

106-
let kernelMode;
107-
const kernelAttr = "fast-kernel";
108-
109-
try {
110-
if (document.currentScript) {
111-
kernelMode = document.currentScript.getAttribute(kernelAttr);
112-
} else {
113-
const scripts = document.getElementsByTagName("script");
114-
const currentScript = scripts[scripts.length - 1];
115-
kernelMode = currentScript.getAttribute(kernelAttr);
116-
}
117-
} catch {
118-
kernelMode = "isolate";
119-
}
120-
121106
/**
122-
* Core services that can be shared across FAST instances.
107+
* Core services shared across FAST instances.
123108
* @internal
124109
*/
125-
type KernelServiceId = {
126-
readonly updateQueue: string | number;
127-
readonly observable: string | number;
128-
readonly contextEvent: string | number;
129-
readonly elementRegistry: string | number;
130-
};
131-
132-
let KernelServiceId: KernelServiceId;
133-
134-
switch (kernelMode) {
135-
case "share": // share the kernel across major versions
136-
KernelServiceId = Object.freeze({
137-
updateQueue: 1,
138-
observable: 2,
139-
contextEvent: 3,
140-
elementRegistry: 4,
141-
});
142-
break;
143-
case "share-v2": // only share the kernel with other v2 instances
144-
KernelServiceId = Object.freeze({
145-
updateQueue: 1.2,
146-
observable: 2.2,
147-
contextEvent: 3.2,
148-
elementRegistry: 4.2,
149-
});
150-
break;
151-
default: {
152-
// fully isolate the kernel from all other FAST instances
153-
const postfix = `-${Math.random().toString(36).substring(2, 8)}`;
154-
KernelServiceId = Object.freeze({
155-
updateQueue: `1.2${postfix}`,
156-
observable: `2.2${postfix}`,
157-
contextEvent: `3.2${postfix}`,
158-
elementRegistry: `4.2${postfix}`,
159-
});
160-
break;
161-
}
110+
export const enum KernelServiceId {
111+
updateQueue = 1,
112+
observable = 2,
113+
contextEvent = 3,
114+
elementRegistry = 4,
162115
}
163116

164-
export { KernelServiceId };
165-
166117
/**
167118
* Warning and error messages.
168119
* @internal

sites/website/src/docs/3.x/resources/export-sizes.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ Bundle sizes for `@microsoft/fast-element` exports.
1919

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

0 commit comments

Comments
 (0)