File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,11 @@ var _a;
12
12
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
13
13
exports . CONSOLE_STYLE_FgPink = exports . CONSOLE_STYLE_FgBrown = exports . CONSOLE_STYLE_FgViolet = exports . CONSOLE_STYLE_FgLightBlue = exports . CONSOLE_STYLE_FgLightGreen = exports . CONSOLE_STYLE_FgOrange = exports . CONSOLE_STYLE_FgGray = exports . CONSOLE_STYLE_FgWhite = exports . CONSOLE_STYLE_FgCyan = exports . CONSOLE_STYLE_FgMagenta = exports . CONSOLE_STYLE_FgBlue = exports . CONSOLE_STYLE_FgYellow = exports . CONSOLE_STYLE_FgGreen = exports . CONSOLE_STYLE_FgRed = exports . CONSOLE_STYLE_FgBlack = exports . CONSOLE_STYLE_Hidden = exports . CONSOLE_STYLE_Reverse = exports . CONSOLE_STYLE_Blink = exports . CONSOLE_STYLE_Underscore = exports . CONSOLE_STYLE_Dim = exports . CONSOLE_STYLE_Bright = exports . CONSOLE_STYLE_Reset = exports . PING_PER_REQUEST_TIMEOUT_DEFAULT = exports . PING_PER_REQUEST_TIMEOUT_MAX = exports . PING_PER_REQUEST_TIMEOUT_MIN = exports . PING_COUNT_DEFAULT = exports . PING_COUNT_MAX = exports . PING_COUNT_MIN = exports . PING_GLOBAL_TIMEOUT_DEFAULT = exports . PING_GLOBAL_TIMEOUT_MAX = exports . PING_GLOBAL_TIMEOUT_MIN = exports . PING_PACKET_SIZE_DEFAULT = exports . PING_PACKET_SIZE_MAX = exports . PING_PACKET_SIZE_MIN = exports . MIN_INTERVAL_SECOND = exports . MAX_INTERVAL_SECOND = exports . SQL_DATETIME_FORMAT_WITHOUT_SECOND = exports . SQL_DATETIME_FORMAT = exports . SQL_DATE_FORMAT = exports . STATUS_PAGE_MAINTENANCE = exports . STATUS_PAGE_PARTIAL_DOWN = exports . STATUS_PAGE_ALL_UP = exports . STATUS_PAGE_ALL_DOWN = exports . MAINTENANCE = exports . PENDING = exports . UP = exports . DOWN = exports . appName = exports . isNode = exports . isDev = void 0 ;
14
14
exports . evaluateJsonQuery = exports . intHash = exports . localToUTC = exports . utcToLocal = exports . utcToISODateTime = exports . isoToUTCDateTime = exports . parseTimeFromTimeObject = exports . parseTimeObject = exports . getMaintenanceRelativeURL = exports . getMonitorRelativeURL = exports . genSecret = exports . getCryptoRandomInt = exports . getRandomInt = exports . getRandomArbitrary = exports . TimeLogger = exports . polyfill = exports . log = exports . debug = exports . ucfirst = exports . sleep = exports . flipStatus = exports . badgeConstants = exports . CONSOLE_STYLE_BgGray = exports . CONSOLE_STYLE_BgWhite = exports . CONSOLE_STYLE_BgCyan = exports . CONSOLE_STYLE_BgMagenta = exports . CONSOLE_STYLE_BgBlue = exports . CONSOLE_STYLE_BgYellow = exports . CONSOLE_STYLE_BgGreen = exports . CONSOLE_STYLE_BgRed = exports . CONSOLE_STYLE_BgBlack = void 0 ;
15
- const dayjs = require ( "dayjs" ) ;
15
+ const dayjs_1 = require ( "dayjs" ) ;
16
16
const jsonata = require ( "jsonata" ) ;
17
17
exports . isDev = process . env . NODE_ENV === "development" ;
18
18
exports . isNode = typeof process !== "undefined" && ( ( _a = process === null || process === void 0 ? void 0 : process . versions ) === null || _a === void 0 ? void 0 : _a . node ) ;
19
+ const dayjs = ( exports . isNode ) ? require ( "dayjs" ) : dayjs_1 . default ;
19
20
exports . appName = "Uptime Kuma" ;
20
21
exports . DOWN = 0 ;
21
22
exports . UP = 1 ;
Original file line number Diff line number Diff line change 9
9
// Frontend uses util.ts
10
10
*/
11
11
12
- import * as dayjs from "dayjs" ;
12
+ import dayjsFrontend from "dayjs" ;
13
13
14
- // For loading dayjs plugins, don't remove event though it is not used in this file
14
+ // For dayjs plugins' type checking , don't remove event though it is not used in this file
15
15
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16
16
import * as timezone from "dayjs/plugin/timezone" ;
17
17
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -21,6 +21,13 @@ import * as jsonata from "jsonata";
21
21
22
22
export const isDev = process . env . NODE_ENV === "development" ;
23
23
export const isNode = typeof process !== "undefined" && process ?. versions ?. node ;
24
+
25
+ /**
26
+ * Smarter dayjs import that supports both frontend and backend
27
+ * @returns {dayjs.Dayjs } dayjs instance
28
+ */
29
+ const dayjs = ( isNode ) ? require ( "dayjs" ) : dayjsFrontend ;
30
+
24
31
export const appName = "Uptime Kuma" ;
25
32
export const DOWN = 0 ;
26
33
export const UP = 1 ;
You can’t perform that action at this time.
0 commit comments