@xh/hoist 88.1.1 → 88.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -12,6 +12,21 @@
12
12
  3. Plain ASCII punctuation only. Use " - " for in-sentence breaks, never an em dash.
13
13
  -->
14
14
 
15
+ ## 88.1.2 - 2026-10-06
16
+
17
+ ### 🐞 Bug Fixes
18
+
19
+ * Restored the `MsalClient` defaults lost in v88: `enableSsoSilent` and `enableTelemetry` again
20
+ default to `true`, and MSAL logs at `Warning` level. Also restored the 3000ms
21
+ `system.iframeBridgeTimeout` that caps `ssoSilent` failures, dropped in the MSAL 5 upgrade.
22
+
23
+ ### 🤖 AI Docs + Tooling
24
+
25
+ * Fixed the v88 `codemod-remove-makeObservable.mjs` deleting constructors that merged defaults into
26
+ their `super()` call. It now removes only constructors it emptied itself, whose remaining
27
+ `super()` passes through the constructor's own params. The v88 upgrade notes gain a grep to find
28
+ constructors an earlier copy removed.
29
+
15
30
  ## 88.1.1 - 2026-10-06
16
31
 
17
32
  ### 🤖 AI Docs + Tooling
@@ -55,7 +55,7 @@ export interface MsalClientConfig extends BaseOAuthClientConfig<MsalTokenSpec> {
55
55
  *
56
56
  * In practice, and according to documentation, this operation is likely to fail for a
57
57
  * number of reasons, and can often do so as timeout. Therefore, keeping the timeout limit
58
- * value -- `system.iframeHashTimeout` -- at a relatively low value is critical. Hoist
58
+ * value -- `system.iframeBridgeTimeout` -- at a relatively low value is critical. Hoist
59
59
  * defaults this value to 3000ms vs. the default 10000ms.
60
60
  */
61
61
  enableSsoSilent?: boolean;
@@ -105,6 +105,7 @@ export declare class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTo
105
105
  /** Enable telemetry via `enableTelemetry` ctor config, or via {@link enableTelemetry}. */
106
106
  telemetry: MsalClientTelemetry;
107
107
  private _telemetryCbHandle;
108
+ constructor(config: MsalClientConfig);
108
109
  protected doInitAsync(): Promise<TokenMap>;
109
110
  protected doLoginPopupAsync(): Promise<void>;
110
111
  protected doLoginRedirectAsync(): Promise<void>;
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
- * Phase 4 codemod — deletes every `makeObservable(this);` call, drops newly-empty constructors
4
- * (body contains only `super(...)` ± blank lines), and trims `makeObservable` from any import
5
- * that no longer references it.
3
+ * Phase 4 codemod — deletes every `makeObservable(this);` call, drops constructors that this
4
+ * emptied down to a one-line pass-through `super(...)` (args are the constructor's own params,
5
+ * bare or spread, ± blank lines), and trims `makeObservable` from any import that no longer
6
+ * references it.
6
7
  *
7
8
  * Scope: hoist-react .ts/.tsx.
8
9
  *
@@ -17,6 +18,7 @@ const SELF_DIR = path.dirname(fileURLToPath(import.meta.url));
17
18
  const REPO_ROOT = path.resolve(SELF_DIR, '../../..');
18
19
  const EXCLUDED_DIRS = new Set(['node_modules', 'build', '.git', '.idea', '.husky']);
19
20
  const EXCLUDED_PREFIXES = [];
21
+ const REMOVED_MARKER = '\u0000makeObservable-removed\u0000';
20
22
 
21
23
  const args = process.argv.slice(2);
22
24
  const DRY = args.includes('--dry');
@@ -66,30 +68,36 @@ async function processFile(filePath) {
66
68
  removedConstructors = 0,
67
69
  trimmedImports = 0;
68
70
 
69
- // 1) Remove lines that are only `makeObservable(this);` (plus optional whitespace).
71
+ // 1) Replace lines that are only `makeObservable(this);` (plus optional whitespace) with a
72
+ // marker so step 2 can tell which constructors this codemod emptied.
70
73
  const callLine = /^\s*makeObservable\(this\);?\s*$/;
71
- const kept = [];
72
- for (const line of lines) {
73
- if (callLine.test(line)) {
74
- removedCalls++;
75
- continue;
76
- }
77
- kept.push(line);
78
- }
79
- lines = kept;
74
+ lines = lines.map(line => {
75
+ if (!callLine.test(line)) return line;
76
+ removedCalls++;
77
+ return REMOVED_MARKER;
78
+ });
80
79
 
81
- // 2) Drop now-empty constructors. Match:
80
+ // 2) Drop constructors emptied by step 1. Match:
82
81
  // constructor(<anything until close-paren>) {
83
- // super(<args>);
82
+ // super(<args on one line>);
84
83
  // }
85
- // with optional blank lines in the body.
84
+ // with marker and blank lines anywhere in the body, then keep only pass-through supers whose
85
+ // args are the constructor's own params (bare or spread). Anything else stays.
86
86
  const text = lines.join('\n');
87
- const reEmptyCtor =
88
- /^([ \t]*)constructor\s*\([^)]*\)\s*\{\s*\n\s*super\s*\([^;]*\);\s*\n(?:\s*\n)*\s*\}\s*\n?/gm;
89
- const trimmedCtor = text.replace(reEmptyCtor, () => {
90
- removedConstructors++;
91
- return '';
92
- });
87
+ const filler = `(?:[ \\t]*(?:${REMOVED_MARKER})?[ \\t]*\\n)*`;
88
+ const reEmptyCtor = new RegExp(
89
+ `^([ \\t]*)constructor\\s*\\(([^)]*)\\)\\s*\\{[ \\t]*\\n${filler}[ \\t]*super\\s*\\(([^()\\n]*)\\);[ \\t]*\\n${filler}[ \\t]*\\}[ \\t]*\\n?`,
90
+ 'gm'
91
+ );
92
+ const trimmedCtor = text
93
+ .replace(reEmptyCtor, (match, indent, params, superArgs) => {
94
+ if (!match.includes(REMOVED_MARKER) || !isPassThrough(params, superArgs)) return match;
95
+ removedConstructors++;
96
+ return '';
97
+ })
98
+ .split('\n')
99
+ .filter(l => l !== REMOVED_MARKER)
100
+ .join('\n');
93
101
  lines = trimmedCtor.split('\n');
94
102
 
95
103
  // 3) Trim `makeObservable` from imports when no longer used in the file.
@@ -132,3 +140,37 @@ async function processFile(filePath) {
132
140
  );
133
141
  }
134
142
  }
143
+
144
+ // True if every super arg is a bare identifier, or spread of one, naming a constructor param.
145
+ function isPassThrough(params, superArgs) {
146
+ const names = new Set(splitTopLevel(params).map(paramName).filter(Boolean));
147
+ return splitTopLevel(superArgs).every(a => {
148
+ const m = /^(?:\.\.\.)?([A-Za-z_$][\w$]*)$/.exec(a);
149
+ return m && names.has(m[1]);
150
+ });
151
+ }
152
+
153
+ // `config: Foo`, `private x = 1`, `...args: any[]`, `y?: Bar` -> config, x, args, y
154
+ function paramName(param) {
155
+ const m = /^(?:(?:public|private|protected|readonly|override)\s+)*(?:\.\.\.)?([A-Za-z_$][\w$]*)/.exec(
156
+ param
157
+ );
158
+ return m?.[1];
159
+ }
160
+
161
+ // Split on commas not nested inside brackets, trimming and dropping empties.
162
+ function splitTopLevel(str) {
163
+ const parts = [];
164
+ let depth = 0,
165
+ cur = '';
166
+ for (const ch of str) {
167
+ if ('([{<'.includes(ch)) depth++;
168
+ else if (')]}>'.includes(ch)) depth--;
169
+ if (ch === ',' && depth === 0) {
170
+ parts.push(cur);
171
+ cur = '';
172
+ } else cur += ch;
173
+ }
174
+ parts.push(cur);
175
+ return parts.map(s => s.trim()).filter(Boolean);
176
+ }
@@ -1,6 +1,9 @@
1
1
  # Hoist React v88 Upgrade Notes
2
2
 
3
- > **From:** v87.x → v88.0.0 | **Released:** 2026-09-28 | **Difficulty:** 🔴 HIGH
3
+ > **From:** v87.x → v88.1.2 | **Released:** 2026-09-28 | **Difficulty:** 🔴 HIGH
4
+ >
5
+ > **Target v88.1.2 or later.** It restores `MsalClient` defaults that 88.0 dropped and fixes a
6
+ > codemod that could delete constructors. Earlier 88 releases are not recommended.
4
7
 
5
8
  ## Overview
6
9
 
@@ -321,6 +324,16 @@ error, and leftover imports as unused-variable warnings. One known skip: a field
321
324
  decorator line is a call form with a trailing comment, such as
322
325
  `@persist.with({...}) // note`, gets no `accessor` - add it by hand.
323
326
 
327
+ **Check for lost constructors.** Versions of `codemod-remove-makeObservable.mjs` before 88.1.2
328
+ could delete a constructor that merged defaults into its `super()` call, such as
329
+ `super({...defaults, ...config})`, mistaking it for an empty pass-through. If you ran an earlier
330
+ copy, scan the diff for removed `super(` lines that took anything other than the constructor's own
331
+ params:
332
+
333
+ ```bash
334
+ git diff <pre-upgrade-ref> -- 'client-app/src/**/*.ts' 'client-app/src/**/*.tsx' | grep -A3 '^-\s*super('
335
+ ```
336
+
324
337
  **Audit `@persist` ordering by hand.** `@persist` must now come *after* the MobX decorator. The
325
338
  codemods do not reorder decorators, and a reversed pair fails silently: `PersistenceProvider`
326
339
  logs an error to the console and the field simply stops persisting, with no type error.
@@ -61,7 +61,7 @@ Verified against both hoist-react and hoist-core changelogs.
61
61
 
62
62
  | hoist-react | Min Core Required | Recommended Core | Max Core Tested | Notes | Upgrade |
63
63
  |---|---|---|---|---|---|
64
- | 88.0 | -- | 42.0 | 42.0 | `ViewManagerModel.manageGlobal` derived from server `globalWriteRoles` (42, degrades gracefully). TC39 decorators are client-only - requires hoist-dev-utils 16 | [Notes](./upgrade-notes/v88-upgrade-notes.md) |
64
+ | 88.1 | -- | 42.0 | 42.0 | Use 88.1.2 or later - earlier 88 releases drop `MsalClient` defaults. `ViewManagerModel.manageGlobal` derived from server `globalWriteRoles` (42, degrades gracefully). TC39 decorators are client-only - requires hoist-dev-utils 16 | [Notes](./upgrade-notes/v88-upgrade-notes.md) |
65
65
  | 87.0 | 40.5.0 | 41.0 | 41.0 | `ViewManager` group rename + bulk edit (40.5); directory group names/search, tabbed config editor (41, degrade gracefully) | [Notes](./upgrade-notes/v87-upgrade-notes.md) |
66
66
  | 86.0 | -- | 40.0.1 | 40.0.1 | Client `MetricsService`, `Runner` API, remote-`traceparent` spans | [Notes](./upgrade-notes/v86-upgrade-notes.md) |
67
67
  | 85.0 | -- | 39.0 | 39.0 | Nested app-load spans, `InitContext`, name-based `sampleRules` | [Notes](./upgrade-notes/v85-upgrade-notes.md) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "88.1.1",
3
+ "version": "88.1.2",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -78,7 +78,7 @@ export interface MsalClientConfig extends BaseOAuthClientConfig<MsalTokenSpec> {
78
78
  *
79
79
  * In practice, and according to documentation, this operation is likely to fail for a
80
80
  * number of reasons, and can often do so as timeout. Therefore, keeping the timeout limit
81
- * value -- `system.iframeHashTimeout` -- at a relatively low value is critical. Hoist
81
+ * value -- `system.iframeBridgeTimeout` -- at a relatively low value is critical. Hoist
82
82
  * defaults this value to 3000ms vs. the default 10000ms.
83
83
  */
84
84
  enableSsoSilent?: boolean;
@@ -135,6 +135,17 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
135
135
  telemetry: MsalClientTelemetry = null;
136
136
  private _telemetryCbHandle: string = null;
137
137
 
138
+ constructor(config: MsalClientConfig) {
139
+ super({
140
+ initRefreshTokenExpirationOffsetSecs: -1,
141
+ msalLogLevel: LogLevel.Warning,
142
+ domainHint: null,
143
+ enableTelemetry: true,
144
+ enableSsoSilent: true,
145
+ ...config
146
+ });
147
+ }
148
+
138
149
  //-------------------------------------------
139
150
  // Implementations of core lifecycle methods
140
151
  //-------------------------------------------
@@ -403,7 +414,8 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
403
414
  loggerOptions: {
404
415
  loggerCallback: (level, message) => this.logFromMsal(level, message),
405
416
  logLevel: msalLogLevel
406
- }
417
+ },
418
+ iframeBridgeTimeout: 3000 // Prevent long pauses for sso failures.
407
419
  },
408
420
  cache: {
409
421
  cacheLocation: 'localStorage' // allows sharing auth info across tabs.