@atlaskit/editor-plugin-autocomplete 2.5.0 → 2.5.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
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-autocomplete
2
2
 
3
+ ## 2.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a87ba03d22d27`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a87ba03d22d27) -
8
+ Fix typecheck
9
+ - Updated dependencies
10
+
11
+ ## 2.5.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`80694949c0036`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/80694949c0036) -
16
+ Fixing typecheck errors
17
+ - Updated dependencies
18
+
3
19
  ## 2.5.0
4
20
 
5
21
  ### Minor Changes
@@ -270,7 +270,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
270
270
  if (logprobsContent && logprobsContent.length > 0) {
271
271
  tokenLogprobs = logprobsContent[0]; // Add the top token
272
272
  if (tokenLogprobs.token) {
273
- token = tokenLogprobs.token.trim().toLowerCase();
273
+ token = tokenLogprobs.token.trim().toLowerCase(); // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
274
274
  if (token.length > 0 && /^[a-z\u017F\u212A]/i.test(token)) {
275
275
  lmLogits[token] = Math.exp(tokenLogprobs.logprob);
276
276
  }
@@ -282,7 +282,7 @@ var createLocalSlowLaneClient = exports.createLocalSlowLaneClient = function cre
282
282
  try {
283
283
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
284
284
  alt = _step.value;
285
- _token = alt.token.trim().toLowerCase();
285
+ _token = alt.token.trim().toLowerCase(); // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
286
286
  if (_token.length > 0 && /^[a-z\u017F\u212A]/i.test(_token)) {
287
287
  lmLogits[_token] = Math.exp(alt.logprob);
288
288
  }
@@ -219,6 +219,7 @@ export const createLocalSlowLaneClient = (config = {}) => {
219
219
  // Add the top token
220
220
  if (tokenLogprobs.token) {
221
221
  const token = tokenLogprobs.token.trim().toLowerCase();
222
+ // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
222
223
  if (token.length > 0 && /^[a-z]/iu.test(token)) {
223
224
  lmLogits[token] = Math.exp(tokenLogprobs.logprob);
224
225
  }
@@ -228,6 +229,7 @@ export const createLocalSlowLaneClient = (config = {}) => {
228
229
  if (tokenLogprobs.top_logprobs) {
229
230
  for (const alt of tokenLogprobs.top_logprobs) {
230
231
  const token = alt.token.trim().toLowerCase();
232
+ // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
231
233
  if (token.length > 0 && /^[a-z]/iu.test(token)) {
232
234
  lmLogits[token] = Math.exp(alt.logprob);
233
235
  }
@@ -262,7 +262,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
262
262
  if (logprobsContent && logprobsContent.length > 0) {
263
263
  tokenLogprobs = logprobsContent[0]; // Add the top token
264
264
  if (tokenLogprobs.token) {
265
- token = tokenLogprobs.token.trim().toLowerCase();
265
+ token = tokenLogprobs.token.trim().toLowerCase(); // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
266
266
  if (token.length > 0 && /^[a-z\u017F\u212A]/i.test(token)) {
267
267
  lmLogits[token] = Math.exp(tokenLogprobs.logprob);
268
268
  }
@@ -274,7 +274,7 @@ export var createLocalSlowLaneClient = function createLocalSlowLaneClient() {
274
274
  try {
275
275
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
276
276
  alt = _step.value;
277
- _token = alt.token.trim().toLowerCase();
277
+ _token = alt.token.trim().toLowerCase(); // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
278
278
  if (_token.length > 0 && /^[a-z\u017F\u212A]/i.test(_token)) {
279
279
  lmLogits[_token] = Math.exp(alt.logprob);
280
280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-autocomplete",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Client-side text autocomplete plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "wink-nlp": "^2.4.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^114.43.0",
38
+ "@atlaskit/editor-common": "^114.47.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^10.1.0",
40
40
  "react": "^18.2.0"
41
41
  },
@@ -39,8 +39,7 @@ export const EXPERIENCE_NAME = {
39
39
  LOAD_VECTORS: 'load-vectors',
40
40
  } as const;
41
41
 
42
- export type AutocompleteExperienceName =
43
- (typeof EXPERIENCE_NAME)[keyof typeof EXPERIENCE_NAME];
42
+ export type AutocompleteExperienceName = (typeof EXPERIENCE_NAME)[keyof typeof EXPERIENCE_NAME];
44
43
 
45
44
  const isUfoEnabled = (): boolean => !process?.env?.REACT_SSR;
46
45
 
@@ -121,18 +120,12 @@ export const failExp = (
121
120
  }
122
121
  };
123
122
 
124
- export const abortExp = (
125
- name: AutocompleteExperienceName,
126
- id: string,
127
- reason?: string,
128
- ): void => {
123
+ export const abortExp = (name: AutocompleteExperienceName, id: string, reason?: string): void => {
129
124
  if (!isUfoEnabled()) {
130
125
  return;
131
126
  }
132
127
  try {
133
- experiences[name]
134
- .getInstance(id)
135
- .abort(reason ? { metadata: { reason } } : undefined);
128
+ experiences[name].getInstance(id).abort(reason ? { metadata: { reason } } : undefined);
136
129
  } catch {
137
130
  // UFO errors must never break the plugin
138
131
  }
@@ -31,8 +31,7 @@ const DEBOUNCE_MS = 150;
31
31
 
32
32
  const hasDestroy = (
33
33
  client: ReturnType<typeof createSlowLaneClient> | LocalSlowLaneClient,
34
- ): client is LocalSlowLaneClient =>
35
- 'destroy' in client && typeof client.destroy === 'function';
34
+ ): client is LocalSlowLaneClient => 'destroy' in client && typeof client.destroy === 'function';
36
35
 
37
36
  export interface AutocompletePluginState {
38
37
  /** The decoration set containing the ghost text widget */
@@ -145,7 +145,7 @@ export const createLocalSlowLaneClient = (
145
145
  let engineInitPromise: Promise<void> | null = null;
146
146
 
147
147
  const unloadEngine = (engineToUnload: MLCEngine): void => {
148
- engineToUnload.unload().catch((error) => {
148
+ engineToUnload.unload().catch((error: unknown) => {
149
149
  if (isAutocompleteDebugEnabled()) {
150
150
  // eslint-disable-next-line no-console
151
151
  console.log(
@@ -203,16 +203,16 @@ export const createLocalSlowLaneClient = (
203
203
  ...(customModelConfig.vramRequiredMB !== undefined
204
204
  ? {
205
205
  vram_required_MB: customModelConfig.vramRequiredMB,
206
- }
206
+ }
207
207
  : {}),
208
208
  ...(customModelConfig.contextWindowSize !== undefined
209
209
  ? {
210
210
  overrides: {
211
211
  context_window_size: customModelConfig.contextWindowSize,
212
212
  },
213
- }
213
+ }
214
214
  : {}),
215
- }
215
+ }
216
216
  : undefined;
217
217
 
218
218
  const appConfig: AppConfig = {
@@ -312,6 +312,7 @@ export const createLocalSlowLaneClient = (
312
312
  // Add the top token
313
313
  if (tokenLogprobs.token) {
314
314
  const token = tokenLogprobs.token.trim().toLowerCase();
315
+ // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
315
316
  if (token.length > 0 && /^[a-z]/iu.test(token)) {
316
317
  lmLogits[token] = Math.exp(tokenLogprobs.logprob);
317
318
  }
@@ -321,6 +322,7 @@ export const createLocalSlowLaneClient = (
321
322
  if (tokenLogprobs.top_logprobs) {
322
323
  for (const alt of tokenLogprobs.top_logprobs) {
323
324
  const token = alt.token.trim().toLowerCase();
325
+ // @ts-ignore TS1501: Unicode regex flag requires a newer TS target than the declaration build uses.
324
326
  if (token.length > 0 && /^[a-z]/iu.test(token)) {
325
327
  lmLogits[token] = Math.exp(alt.logprob);
326
328
  }