@openmrs/esm-utils 5.3.3-pre.1240 → 5.3.3-pre.1251

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/src/omrs-dates.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  * @module
3
3
  * @category Date and Time
4
4
  */
5
- import { i18n } from "i18next";
6
- import dayjs from "dayjs";
7
- import utc from "dayjs/plugin/utc";
8
- import isToday from "dayjs/plugin/isToday";
5
+ import { i18n } from 'i18next';
6
+ import dayjs from 'dayjs';
7
+ import utc from 'dayjs/plugin/utc';
8
+ import isToday from 'dayjs/plugin/isToday';
9
9
 
10
10
  dayjs.extend(utc);
11
11
  dayjs.extend(isToday);
@@ -18,7 +18,7 @@ declare global {
18
18
 
19
19
  export type DateInput = string | number | Date;
20
20
 
21
- const isoFormat = "YYYY-MM-DDTHH:mm:ss.SSSZZ";
21
+ const isoFormat = 'YYYY-MM-DDTHH:mm:ss.SSSZZ';
22
22
 
23
23
  /**
24
24
  * This function checks whether a date string is the OpenMRS ISO format.
@@ -26,31 +26,23 @@ const isoFormat = "YYYY-MM-DDTHH:mm:ss.SSSZZ";
26
26
  */
27
27
  export function isOmrsDateStrict(omrsPayloadString: string): boolean {
28
28
  // omrs format 2018-03-19T00:00:00.000+0300
29
- if (
30
- omrsPayloadString === null ||
31
- omrsPayloadString === undefined ||
32
- omrsPayloadString.trim().length !== 28
33
- ) {
29
+ if (omrsPayloadString === null || omrsPayloadString === undefined || omrsPayloadString.trim().length !== 28) {
34
30
  return false;
35
31
  }
36
32
  omrsPayloadString = omrsPayloadString.trim();
37
33
 
38
34
  // 11th character will always be T
39
- if (omrsPayloadString[10] !== "T") {
35
+ if (omrsPayloadString[10] !== 'T') {
40
36
  return false;
41
37
  }
42
38
 
43
39
  // checking time format
44
- if (
45
- omrsPayloadString[13] !== ":" ||
46
- omrsPayloadString[16] !== ":" ||
47
- omrsPayloadString[19] !== "."
48
- ) {
40
+ if (omrsPayloadString[13] !== ':' || omrsPayloadString[16] !== ':' || omrsPayloadString[19] !== '.') {
49
41
  return false;
50
42
  }
51
43
 
52
44
  // checking UTC offset format
53
- if (!(omrsPayloadString[23] === "+" || omrsPayloadString[23] === "-")) {
45
+ if (!(omrsPayloadString[23] === '+' || omrsPayloadString[23] === '-')) {
54
46
  return false;
55
47
  }
56
48
 
@@ -95,7 +87,7 @@ export function toOmrsIsoString(date: DateInput, toUTC = false): string {
95
87
  * Formats the input as a time string using the format "HH:mm".
96
88
  */
97
89
  export function toOmrsTimeString24(date: DateInput) {
98
- return dayjs(date).format("HH:mm");
90
+ return dayjs(date).format('HH:mm');
99
91
  }
100
92
 
101
93
  /**
@@ -103,7 +95,7 @@ export function toOmrsTimeString24(date: DateInput) {
103
95
  * Formats the input as a time string using the format "HH:mm A".
104
96
  */
105
97
  export function toOmrsTimeString(date: DateInput) {
106
- return dayjs.utc(date).format("HH:mm A");
98
+ return dayjs.utc(date).format('HH:mm A');
107
99
  }
108
100
 
109
101
  /**
@@ -111,7 +103,7 @@ export function toOmrsTimeString(date: DateInput) {
111
103
  * Formats the input as a date string using the format "DD - MMM - YYYY".
112
104
  */
113
105
  export function toOmrsDayDateFormat(date: DateInput) {
114
- return toOmrsDateFormat(date, "DD - MMM - YYYY");
106
+ return toOmrsDateFormat(date, 'DD - MMM - YYYY');
115
107
  }
116
108
 
117
109
  /**
@@ -119,14 +111,14 @@ export function toOmrsDayDateFormat(date: DateInput) {
119
111
  * Formats the input as a date string using the format "DD-MMM".
120
112
  */
121
113
  export function toOmrsYearlessDateFormat(date: DateInput) {
122
- return toOmrsDateFormat(date, "DD-MMM");
114
+ return toOmrsDateFormat(date, 'DD-MMM');
123
115
  }
124
116
 
125
117
  /**
126
118
  * @deprecated use `formatDate(date)`
127
119
  * Formats the input as a date string. By default the format "YYYY-MMM-DD" is used.
128
120
  */
129
- export function toOmrsDateFormat(date: DateInput, format = "YYYY-MMM-DD") {
121
+ export function toOmrsDateFormat(date: DateInput, format = 'YYYY-MMM-DD') {
130
122
  return dayjs(date).format(format);
131
123
  }
132
124
 
@@ -138,7 +130,7 @@ export function parseDate(dateString: string) {
138
130
  return dayjs(dateString).toDate();
139
131
  }
140
132
 
141
- export type FormatDateMode = "standard" | "wide";
133
+ export type FormatDateMode = 'standard' | 'wide';
142
134
 
143
135
  export type FormatDateOptions = {
144
136
  /**
@@ -154,7 +146,7 @@ export type FormatDateOptions = {
154
146
  * Whether the time should be included in the output always (`true`),
155
147
  * never (`false`), or only when the input date is today (`for today`).
156
148
  */
157
- time: true | false | "for today";
149
+ time: true | false | 'for today';
158
150
  /** Whether to include the day number */
159
151
  day: boolean;
160
152
  /** Whether to include the year */
@@ -169,8 +161,8 @@ export type FormatDateOptions = {
169
161
  };
170
162
 
171
163
  const defaultOptions: FormatDateOptions = {
172
- mode: "standard",
173
- time: "for today",
164
+ mode: 'standard',
165
+ time: 'for today',
174
166
  day: true,
175
167
  year: true,
176
168
  noToday: false,
@@ -183,7 +175,7 @@ class LocaleCalendars {
183
175
  #registry = new Map<string, string>();
184
176
 
185
177
  constructor() {
186
- this.#registry.set("am", "ethiopic");
178
+ this.#registry.set('am', 'ethiopic');
187
179
  }
188
180
 
189
181
  register(locale: string, calendar: string) {
@@ -210,15 +202,10 @@ class LocaleCalendars {
210
202
  return this.#registry.get(locale.language);
211
203
  }
212
204
 
213
- const defaultCalendar = new Intl.DateTimeFormat(
214
- locale.toString()
215
- ).resolvedOptions().calendar;
205
+ const defaultCalendar = new Intl.DateTimeFormat(locale.toString()).resolvedOptions().calendar;
216
206
 
217
207
  // cache this result
218
- this.#registry.set(
219
- `${locale.language}${locale.region ? `-${locale.region}` : ""}`,
220
- defaultCalendar
221
- );
208
+ this.#registry.set(`${locale.language}${locale.region ? `-${locale.region}` : ''}`, defaultCalendar);
222
209
 
223
210
  return defaultCalendar;
224
211
  }
@@ -249,9 +236,7 @@ export function registerDefaultCalendar(locale: string, calendar: string) {
249
236
  export function getDefaultCalendar(locale: Intl.Locale | string | undefined) {
250
237
  const locale_ = locale ?? getLocale();
251
238
 
252
- return registeredLocaleCalendars.getCalendar(
253
- locale_ instanceof Intl.Locale ? locale_ : new Intl.Locale(locale_)
254
- );
239
+ return registeredLocaleCalendars.getCalendar(locale_ instanceof Intl.Locale ? locale_ : new Intl.Locale(locale_));
255
240
  }
256
241
 
257
242
  /**
@@ -279,7 +264,7 @@ export function formatDate(date: Date, options?: Partial<FormatDateOptions>) {
279
264
 
280
265
  const { calendar, mode, time, day, year, noToday }: FormatDateOptions = {
281
266
  ...defaultOptions,
282
- ...{ noToday: _locale.language === "am" ? true : false },
267
+ ...{ noToday: _locale.language === 'am' ? true : false },
283
268
  ...options,
284
269
  };
285
270
 
@@ -287,51 +272,43 @@ export function formatDate(date: Date, options?: Partial<FormatDateOptions>) {
287
272
 
288
273
  const formatterOptions: Intl.DateTimeFormatOptions = {
289
274
  calendar: formatCalendar,
290
- year: year ? "numeric" : undefined,
291
- month: "short",
292
- day: day ? "2-digit" : undefined,
275
+ year: year ? 'numeric' : undefined,
276
+ month: 'short',
277
+ day: day ? '2-digit' : undefined,
293
278
  };
294
279
 
295
280
  let localeString: string;
296
281
  const isToday = dayjs(date).isToday();
297
282
  if (isToday && !noToday) {
298
283
  // This produces the word "Today" in the language of `locale`
299
- const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
300
- localeString = rtf.format(0, "day");
301
- localeString =
302
- localeString[0].toLocaleUpperCase(locale) + localeString.slice(1);
284
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
285
+ localeString = rtf.format(0, 'day');
286
+ localeString = localeString[0].toLocaleUpperCase(locale) + localeString.slice(1);
303
287
  } else {
304
- if (_locale.language === "en") {
288
+ if (_locale.language === 'en') {
305
289
  // This locale override is here rather than in `getLocale`
306
290
  // because Americans should see AM/PM for times.
307
- locale = "en-GB";
291
+ locale = 'en-GB';
308
292
  }
309
293
 
310
294
  const formatter = new Intl.DateTimeFormat(locale, formatterOptions);
311
295
  let parts = formatter.formatToParts(date);
312
296
 
313
- if (
314
- (_locale.language === "en" || _locale.language === "am") &&
315
- mode == "standard" &&
316
- year &&
317
- day
318
- ) {
297
+ if ((_locale.language === 'en' || _locale.language === 'am') && mode == 'standard' && year && day) {
319
298
  // Custom formatting for English and Amharic. Use hyphens instead of spaces.
320
- parts = parts.map(formatParts("-"));
299
+ parts = parts.map(formatParts('-'));
321
300
  }
322
301
 
323
- if (mode == "wide") {
324
- parts = parts.map(formatParts("")); // space-emdash-space
302
+ if (mode == 'wide') {
303
+ parts = parts.map(formatParts('')); // space-emdash-space
325
304
  }
326
305
 
327
306
  // omit the era when using the Ethiopic calendar
328
- if (formatterOptions.calendar === "ethiopic") {
307
+ if (formatterOptions.calendar === 'ethiopic') {
329
308
  parts = parts.filter((part, idx, values) => {
330
309
  if (
331
- part.type === "era" ||
332
- (part.type === "literal" &&
333
- idx < values.length - 1 &&
334
- values[idx + 1].type === "era")
310
+ part.type === 'era' ||
311
+ (part.type === 'literal' && idx < values.length - 1 && values[idx + 1].type === 'era')
335
312
  ) {
336
313
  return false;
337
314
  }
@@ -340,9 +317,9 @@ export function formatDate(date: Date, options?: Partial<FormatDateOptions>) {
340
317
  });
341
318
  }
342
319
 
343
- localeString = parts.map((p) => p.value).join("");
320
+ localeString = parts.map((p) => p.value).join('');
344
321
  }
345
- if (time === true || (isToday && time === "for today")) {
322
+ if (time === true || (isToday && time === 'for today')) {
346
323
  localeString += `, ${formatTime(date)}`;
347
324
  }
348
325
  return localeString;
@@ -350,20 +327,16 @@ export function formatDate(date: Date, options?: Partial<FormatDateOptions>) {
350
327
 
351
328
  // Internal curried call-back for map()
352
329
  const formatParts = (separator: string) => {
353
- return (
354
- part: Intl.DateTimeFormatPart,
355
- idx: number,
356
- values: Array<Intl.DateTimeFormatPart>
357
- ) => {
358
- if (part.type !== "literal" || part.value !== " ") {
330
+ return (part: Intl.DateTimeFormatPart, idx: number, values: Array<Intl.DateTimeFormatPart>) => {
331
+ if (part.type !== 'literal' || part.value !== ' ') {
359
332
  return part;
360
333
  }
361
334
 
362
- if (idx < values.length - 1 && values[idx + 1].type === "era") {
335
+ if (idx < values.length - 1 && values[idx + 1].type === 'era') {
363
336
  return part;
364
337
  }
365
338
 
366
- return { type: "literal", value: separator } as Intl.DateTimeFormatPart;
339
+ return { type: 'literal', value: separator } as Intl.DateTimeFormatPart;
367
340
  };
368
341
  };
369
342
 
@@ -373,8 +346,8 @@ const formatParts = (separator: string) => {
373
346
  */
374
347
  export function formatTime(date: Date) {
375
348
  return date.toLocaleTimeString(getLocale(), {
376
- hour: "2-digit",
377
- minute: "2-digit",
349
+ hour: '2-digit',
350
+ minute: '2-digit',
378
351
  });
379
352
  }
380
353
 
@@ -387,10 +360,7 @@ export function formatTime(date: Date) {
387
360
  * and `formatTime` with a comma and space. This agrees with the
388
361
  * output of `Date.prototype.toLocaleString` for *most* locales.
389
362
  */
390
- export function formatDatetime(
391
- date: Date,
392
- options?: Partial<Omit<FormatDateOptions, "time">>
393
- ) {
363
+ export function formatDatetime(date: Date, options?: Partial<Omit<FormatDateOptions, 'time'>>) {
394
364
  return formatDate(date, { ...options, time: true });
395
365
  }
396
366
 
@@ -400,10 +370,10 @@ export function formatDatetime(
400
370
  */
401
371
  export function getLocale() {
402
372
  let language = window.i18next.language;
403
- language = language.replace("_", "-"); // just in case
373
+ language = language.replace('_', '-'); // just in case
404
374
  // hack for `ht` until https://unicode-org.atlassian.net/browse/CLDR-14956 is fixed
405
- if (language === "ht") {
406
- language = "fr-HT";
375
+ if (language === 'ht') {
376
+ language = 'fr-HT';
407
377
  }
408
378
 
409
379
  return language;
package/src/retry.ts CHANGED
@@ -37,10 +37,7 @@ export interface RetryOptions {
37
37
  * @returns The result of successfully executing `fn`.
38
38
  * @throws Rethrows the final error of running `fn` when the function stops retrying.
39
39
  */
40
- export async function retry<T>(
41
- fn: () => Promise<T>,
42
- options: RetryOptions = {}
43
- ) {
40
+ export async function retry<T>(fn: () => Promise<T>, options: RetryOptions = {}) {
44
41
  let { shouldRetry, getDelay, onError } = options;
45
42
  shouldRetry = shouldRetry ?? ((attempt) => limitAttempts(attempt, 5));
46
43
  getDelay = getDelay ?? ((attempt) => getExponentialDelay(attempt, 1000));
@@ -67,11 +64,7 @@ function limitAttempts(attempt: number, maxAttempts: number) {
67
64
  return attempt <= maxAttempts;
68
65
  }
69
66
 
70
- function getExponentialDelay(
71
- attempt: number,
72
- startingDelay: number,
73
- initialDelay = false
74
- ) {
67
+ function getExponentialDelay(attempt: number, startingDelay: number, initialDelay = false) {
75
68
  const exponent = initialDelay ? attempt + 1 : attempt;
76
69
  return startingDelay * Math.pow(2, exponent);
77
70
  }
@@ -15,20 +15,12 @@ export function shallowEqual(objA: unknown, objB: unknown) {
15
15
  return true;
16
16
  }
17
17
 
18
- if (
19
- typeof objA !== "object" ||
20
- objA === null ||
21
- typeof objB !== "object" ||
22
- objB === null
23
- ) {
18
+ if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
24
19
  return false;
25
20
  }
26
21
 
27
22
  const objAKeys = Object.getOwnPropertyNames(objA);
28
23
  const objBKeys = Object.getOwnPropertyNames(objB);
29
24
 
30
- return (
31
- objAKeys.length === objBKeys.length &&
32
- objAKeys.every((key) => objA[key] === objB[key])
33
- );
25
+ return objAKeys.length === objBKeys.length && objAKeys.every((key) => objA[key] === objB[key]);
34
26
  }
package/src/translate.ts CHANGED
@@ -1,12 +1,7 @@
1
1
  /** @module @category Utility */
2
- import _i18n from "i18next";
2
+ import _i18n from 'i18next';
3
3
 
4
- export function translateFrom(
5
- moduleName: string,
6
- key: string,
7
- fallback?: string,
8
- options?: object
9
- ) {
4
+ export function translateFrom(moduleName: string, key: string, fallback?: string, options?: object) {
10
5
  const i18n: typeof _i18n = (_i18n as any).default || _i18n;
11
6
  return i18n.t(key, {
12
7
  ns: moduleName,
@@ -1,65 +1,65 @@
1
- import { isVersionSatisfied } from "./version";
1
+ import { isVersionSatisfied } from './version';
2
2
 
3
- describe("Version utilities", () => {
4
- it("Is satisfied if exactly equals", () => {
5
- const result = isVersionSatisfied("1.2.3", "1.2.3");
3
+ describe('Version utilities', () => {
4
+ it('Is satisfied if exactly equals', () => {
5
+ const result = isVersionSatisfied('1.2.3', '1.2.3');
6
6
  expect(result).toBe(true);
7
7
  });
8
8
 
9
- it("Is satisfied if caret and minor change", () => {
10
- const result = isVersionSatisfied("^1.2.3", "1.3.0");
9
+ it('Is satisfied if caret and minor change', () => {
10
+ const result = isVersionSatisfied('^1.2.3', '1.3.0');
11
11
  expect(result).toBe(true);
12
12
  });
13
13
 
14
- it("Is not satisfied if exact and minor change", () => {
15
- const result = isVersionSatisfied("1.2.3", "1.3.0");
14
+ it('Is not satisfied if exact and minor change', () => {
15
+ const result = isVersionSatisfied('1.2.3', '1.3.0');
16
16
  expect(result).toBe(false);
17
17
  });
18
18
 
19
- it("Is not satisfied if caret and major change", () => {
20
- const result = isVersionSatisfied("^1.2.3", "2.0.0");
19
+ it('Is not satisfied if caret and major change', () => {
20
+ const result = isVersionSatisfied('^1.2.3', '2.0.0');
21
21
  expect(result).toBe(false);
22
22
  });
23
23
 
24
- it("Is satisfied if caret and minor change with prerelease", () => {
25
- const result = isVersionSatisfied("^1.2.3", "1.3.0-alpha.1");
24
+ it('Is satisfied if caret and minor change with prerelease', () => {
25
+ const result = isVersionSatisfied('^1.2.3', '1.3.0-alpha.1');
26
26
  expect(result).toBe(true);
27
27
  });
28
28
 
29
- it("Is not satisfied if version equals same prerelease", () => {
30
- const result = isVersionSatisfied("^3.1.10", "3.1.10-pre.284");
29
+ it('Is not satisfied if version equals same prerelease', () => {
30
+ const result = isVersionSatisfied('^3.1.10', '3.1.10-pre.284');
31
31
  expect(result).toBe(false);
32
32
  });
33
33
 
34
- it("Is satisfied if version equals higher with build number", () => {
35
- const result = isVersionSatisfied("^2.24.0", "2.30.0.7e24fb");
34
+ it('Is satisfied if version equals higher with build number', () => {
35
+ const result = isVersionSatisfied('^2.24.0', '2.30.0.7e24fb');
36
36
  expect(result).toBe(true);
37
37
  });
38
38
 
39
- it("Is satisfied if version equals higher with build number and pre", () => {
40
- const result = isVersionSatisfied("^2.24.0", "2.30.0.7e24fb-pre.3");
39
+ it('Is satisfied if version equals higher with build number and pre', () => {
40
+ const result = isVersionSatisfied('^2.24.0', '2.30.0.7e24fb-pre.3');
41
41
  expect(result).toBe(true);
42
42
  });
43
43
 
44
- it("Is not satisfied if version equals same with build number and pre", () => {
45
- const result = isVersionSatisfied("^2.24.0", "2.24.0.7e24fb-pre.3");
44
+ it('Is not satisfied if version equals same with build number and pre', () => {
45
+ const result = isVersionSatisfied('^2.24.0', '2.24.0.7e24fb-pre.3');
46
46
  expect(result).toBe(false);
47
47
  });
48
48
 
49
- it("Is satisfied if version equals same with only build number", () => {
50
- const result = isVersionSatisfied("^2.24.0", "2.24.0.7e24fb");
49
+ it('Is satisfied if version equals same with only build number', () => {
50
+ const result = isVersionSatisfied('^2.24.0', '2.24.0.7e24fb');
51
51
  expect(result).toBe(true);
52
52
  });
53
53
 
54
- it("Is satisfied with major version caret specifier and pre", () => {
55
- const result = isVersionSatisfied("^3", "3.1.14-pre.3");
54
+ it('Is satisfied with major version caret specifier and pre', () => {
55
+ const result = isVersionSatisfied('^3', '3.1.14-pre.3');
56
56
  });
57
57
 
58
- it("Is satisfied with major version caret specifier and pre and a build number", () => {
59
- const result = isVersionSatisfied("^3", "3.1.14.7e24fb-pre.3");
58
+ it('Is satisfied with major version caret specifier and pre and a build number', () => {
59
+ const result = isVersionSatisfied('^3', '3.1.14.7e24fb-pre.3');
60
60
  });
61
61
 
62
- it("Is satisfied with major version caret specifier and a build number", () => {
63
- const result = isVersionSatisfied("^3", "3.1.14.7e24fb");
62
+ it('Is satisfied with major version caret specifier and a build number', () => {
63
+ const result = isVersionSatisfied('^3', '3.1.14.7e24fb');
64
64
  });
65
65
  });
package/src/version.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /** @module @category Utility */
2
- import * as semver from "semver";
2
+ import * as semver from 'semver';
3
3
 
4
4
  function normalizeOnlyVersion(version: string) {
5
- const [major, minor, patch] = version.split(".");
5
+ const [major, minor, patch] = version.split('.');
6
6
  return `${major}.${minor}.${patch}`;
7
7
  }
8
8
 
9
9
  function normalizeFullVersion(version: string) {
10
- const idx = version.indexOf("-");
10
+ const idx = version.indexOf('-');
11
11
  const prerelease = idx >= 0;
12
12
 
13
13
  if (prerelease) {
@@ -19,10 +19,7 @@ function normalizeFullVersion(version: string) {
19
19
  return normalizeOnlyVersion(version);
20
20
  }
21
21
 
22
- export function isVersionSatisfied(
23
- requiredVersion: string,
24
- installedVersion: string
25
- ) {
22
+ export function isVersionSatisfied(requiredVersion: string, installedVersion: string) {
26
23
  const version = normalizeFullVersion(installedVersion);
27
24
 
28
25
  return semver.satisfies(version, requiredVersion, {
package/webpack.config.js CHANGED
@@ -1,42 +1,42 @@
1
- const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
2
- const { resolve } = require("path");
3
- const { CleanWebpackPlugin } = require("clean-webpack-plugin");
4
- const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
1
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2
+ const { resolve } = require('path');
3
+ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
4
+ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
5
5
 
6
- const { peerDependencies } = require("./package.json");
6
+ const { peerDependencies } = require('./package.json');
7
7
 
8
8
  module.exports = (env) => ({
9
- entry: [resolve(__dirname, "src/index.ts")],
9
+ entry: [resolve(__dirname, 'src/index.ts')],
10
10
  output: {
11
- filename: "openmrs-esm-utils.js",
12
- path: resolve(__dirname, "dist"),
13
- library: { type: "system" },
11
+ filename: 'openmrs-esm-utils.js',
12
+ path: resolve(__dirname, 'dist'),
13
+ library: { type: 'system' },
14
14
  },
15
- devtool: "source-map",
15
+ devtool: 'source-map',
16
16
  module: {
17
17
  rules: [
18
18
  {
19
19
  test: /\.m?(js|ts|tsx)$/,
20
20
  exclude: /node_modules/,
21
- use: "swc-loader",
21
+ use: 'swc-loader',
22
22
  },
23
23
  ],
24
24
  },
25
25
  externals: Object.keys(peerDependencies || {}),
26
26
  resolve: {
27
- extensions: [".ts", ".js", ".tsx", ".jsx"],
27
+ extensions: ['.ts', '.js', '.tsx', '.jsx'],
28
28
  },
29
29
  plugins: [
30
30
  new CleanWebpackPlugin(),
31
31
  new ForkTsCheckerWebpackPlugin(),
32
32
  new BundleAnalyzerPlugin({
33
- analyzerMode: env && env.analyze ? "static" : "disabled",
33
+ analyzerMode: env && env.analyze ? 'static' : 'disabled',
34
34
  }),
35
35
  ],
36
36
  devServer: {
37
37
  disableHostCheck: true,
38
38
  headers: {
39
- "Access-Control-Allow-Origin": "*",
39
+ 'Access-Control-Allow-Origin': '*',
40
40
  },
41
41
  },
42
42
  });