From b964c621ea741ca5eed4f5b6d4d0838b32e21c6b Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Sat, 10 Jan 2026 16:56:01 +0100 Subject: [PATCH] build(build): eliminate CommonJS module warnings Replace clipboard, file-saver, and query-string with native browser APIs. Add remaining CommonJS dependencies to allowedCommonJsDependencies. --- angular.json | 12 +++++++- .../issue/providers/jira/jira-api.service.ts | 19 +++++++++++-- .../worklog-export.component.html | 4 +-- .../worklog-export.component.ts | 28 +++++++++++-------- src/app/util/download.ts | 10 +++++-- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/angular.json b/angular.json index d4d624a90..2ed16994b 100644 --- a/angular.json +++ b/angular.json @@ -42,7 +42,17 @@ "browser": "src/main.ts", "stylePreprocessorOptions": { "includePaths": [".", "src", "src/styles"] - } + }, + "allowedCommonJsDependencies": [ + "typia", + "electron-log", + "stacktrace-js", + "spark-md5", + "chrono-node", + "dayjs", + "jira2md", + "query-string" + ] }, "configurations": { "development": { diff --git a/src/app/features/issue/providers/jira/jira-api.service.ts b/src/app/features/issue/providers/jira/jira-api.service.ts index 102c423c8..0c653c669 100644 --- a/src/app/features/issue/providers/jira/jira-api.service.ts +++ b/src/app/features/issue/providers/jira/jira-api.service.ts @@ -39,7 +39,6 @@ import { JiraIssue, JiraIssueReduced } from './jira-issue.model'; import { BannerService } from '../../../../core/banner/banner.service'; import { BannerId } from '../../../../core/banner/banner.model'; import { T } from '../../../../t.const'; -import { stringify } from 'query-string'; import { getErrorTxt } from '../../../../util/get-error-text'; import { isOnline } from '../../../../util/is-online'; import { GlobalProgressBarService } from '../../../../core-ui/global-progress-bar/global-progress-bar.service'; @@ -453,7 +452,7 @@ export class JiraApiService { const requestInit = this._makeRequestInit(jiraReqCfg, cfg); const queryStr = jiraReqCfg.query - ? `?${stringify(jiraReqCfg.query, { arrayFormat: 'comma' })}` + ? `?${stringifyQueryParams(jiraReqCfg.query)}` : ''; const base = `${stripTrailing(cfg.host || 'null', '/')}/rest/api/${API_VERSION}`; const url = `${base}/${jiraReqCfg.pathname}${queryStr}`.trim(); @@ -747,3 +746,19 @@ async function streamToJsonIfPossible(stream: ReadableStream): Promise { return text; } } + +// eslint-disable-next-line prefer-arrow/prefer-arrow-functions +function stringifyQueryParams( + params: Record, +): string { + const searchParams = new URLSearchParams(); + for (const [key, value] of Object.entries(params)) { + if (Array.isArray(value)) { + // arrayFormat: 'comma' - join array values with comma + searchParams.set(key, value.join(',')); + } else if (value !== undefined && value !== null) { + searchParams.set(key, String(value)); + } + } + return searchParams.toString(); +} diff --git a/src/app/features/worklog/worklog-export/worklog-export.component.html b/src/app/features/worklog/worklog-export/worklog-export.component.html index b3c2f25a3..e3185c4e9 100644 --- a/src/app/features/worklog/worklog-export/worklog-export.component.html +++ b/src/app/features/worklog/worklog-export/worklog-export.component.html @@ -190,10 +190,8 @@ > @if (isShowAsText) {