@powerlines/plugin-date 0.12.279 → 0.12.280
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/dist/index-CA4VvAY_.d.mts +1 -0
- package/dist/index-CmCelmEL.d.cts +1 -0
- package/dist/index.cjs +2007 -18
- package/dist/index.d.cts +42 -9
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +42 -9
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1972 -7
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-CWe-29nA.d.mts +44 -0
- package/dist/plugin-CWe-29nA.d.mts.map +1 -0
- package/dist/plugin-D82ijYIk.d.cts +44 -0
- package/dist/plugin-D82ijYIk.d.cts.map +1 -0
- package/dist/plugin-DHXHjv16.cjs +0 -0
- package/dist/plugin-ufqFO5xS.mjs +1 -0
- package/dist/runtime-B7WoCmC4.mjs +1 -0
- package/dist/runtime-B8LVkjWB.d.cts +712 -0
- package/dist/runtime-B8LVkjWB.d.cts.map +1 -0
- package/dist/runtime-CiYq8JJ6.d.mts +712 -0
- package/dist/runtime-CiYq8JJ6.d.mts.map +1 -0
- package/dist/runtime-D4zTdSwv.cjs +0 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -42
- package/dist/types/plugin.d.mts +1 -42
- package/dist/types/plugin.mjs +2 -0
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts +1 -710
- package/dist/types/runtime.d.mts +1 -710
- package/dist/types/runtime.mjs +2 -0
- package/dist/types-BReKsBV6.mjs +1 -0
- package/dist/types-CBTc19th.cjs +0 -0
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/components/date-fns.cjs +0 -528
- package/dist/components/date-fns.d.cts +0 -13
- package/dist/components/date-fns.d.mts +0 -13
- package/dist/components/date-fns.mjs +0 -527
- package/dist/components/dayjs.cjs +0 -473
- package/dist/components/dayjs.d.cts +0 -13
- package/dist/components/dayjs.d.mts +0 -13
- package/dist/components/dayjs.mjs +0 -472
- package/dist/components/index.cjs +0 -4
- package/dist/components/index.d.cts +0 -4
- package/dist/components/index.d.mts +0 -4
- package/dist/components/index.mjs +0 -6
- package/dist/components/luxon.cjs +0 -477
- package/dist/components/luxon.d.cts +0 -13
- package/dist/components/luxon.d.mts +0 -13
- package/dist/components/luxon.mjs +0 -476
- package/dist/components/moment.cjs +0 -463
- package/dist/components/moment.d.cts +0 -13
- package/dist/components/moment.d.mts +0 -13
- package/dist/components/moment.mjs +0 -462
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["dateModule!: (context: DatePluginContext) => string"],"sources":["../../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs","../src/components/date-fns.ts","../src/components/dayjs.ts","../src/components/luxon.ts","../src/components/moment.ts","../src/index.ts"],"sourcesContent":["function isPlainObject(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n if (Symbol.iterator in value) {\n return false;\n }\n if (Symbol.toStringTag in value) {\n return Object.prototype.toString.call(value) === \"[object Module]\";\n }\n return true;\n}\n\nfunction _defu(baseObject, defaults, namespace = \".\", merger) {\n if (!isPlainObject(defaults)) {\n return _defu(baseObject, {}, namespace, merger);\n }\n const object = Object.assign({}, defaults);\n for (const key in baseObject) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue;\n }\n const value = baseObject[key];\n if (value === null || value === void 0) {\n continue;\n }\n if (merger && merger(object, key, value, namespace)) {\n continue;\n }\n if (Array.isArray(value) && Array.isArray(object[key])) {\n object[key] = [...value, ...object[key]];\n } else if (isPlainObject(value) && isPlainObject(object[key])) {\n object[key] = _defu(\n value,\n object[key],\n (namespace ? `${namespace}.` : \"\") + key.toString(),\n merger\n );\n } else {\n object[key] = value;\n }\n }\n return object;\n}\nfunction createDefu(merger) {\n return (...arguments_) => (\n // eslint-disable-next-line unicorn/no-array-reduce\n arguments_.reduce((p, c) => _defu(p, c, \"\", merger), {})\n );\n}\nconst defu = createDefu();\nconst defuFn = createDefu((object, key, currentValue) => {\n if (object[key] !== void 0 && typeof currentValue === \"function\") {\n object[key] = currentValue(object[key]);\n return true;\n }\n});\nconst defuArrayFn = createDefu((object, key, currentValue) => {\n if (Array.isArray(object[key]) && typeof currentValue === \"function\") {\n object[key] = currentValue(object[key]);\n return true;\n }\n});\n\nexport { createDefu, defu as default, defu, defuArrayFn, defuFn };\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getFileHeader } from \"powerlines/lib/utilities/file-header\";\nimport { DatePluginContext } from \"../types/plugin\";\n\n/**\n * Generates the Powerlines configuration file.\n *\n * @param context - The build context containing runtime information.\n * @returns A string representing the configuration file content.\n */\nexport function dateFnsModule(context: DatePluginContext) {\n return `\n/**\n * The Date module provides utility functions for date manipulation and formatting\n *\n * @module ${context.config.framework}:date\n */\n\n${getFileHeader(context)}\n\nimport { DateFormats, TimeUnit } from \"@powerlines/plugin-date/types/runtime\";\nimport { addDays as dateFnsAddDays } from \"date-fns/addDays\";\nimport { addHours as dateFnsAddHours } from \"date-fns/addHours\";\nimport { addMinutes as dateFnsAddMinutes } from \"date-fns/addMinutes\";\nimport { addMonths as dateFnsAddMonths } from \"date-fns/addMonths\";\nimport { addSeconds as dateFnsAddSeconds } from \"date-fns/addSeconds\";\nimport { addWeeks as dateFnsAddWeeks } from \"date-fns/addWeeks\";\nimport { addYears as dateFnsAddYears } from \"date-fns/addYears\";\nimport { differenceInDays } from \"date-fns/differenceInDays\";\nimport { differenceInHours } from \"date-fns/differenceInHours\";\nimport { differenceInMilliseconds } from \"date-fns/differenceInMilliseconds\";\nimport { differenceInMinutes } from \"date-fns/differenceInMinutes\";\nimport { differenceInMonths } from \"date-fns/differenceInMonths\";\nimport { differenceInQuarters } from \"date-fns/differenceInQuarters\";\nimport { differenceInSeconds } from \"date-fns/differenceInSeconds\";\nimport { differenceInWeeks } from \"date-fns/differenceInWeeks\";\nimport { differenceInYears } from \"date-fns/differenceInYears\";\nimport { eachDayOfInterval } from \"date-fns/eachDayOfInterval\";\nimport { endOfDay as dateFnsEndOfDay } from \"date-fns/endOfDay\";\nimport { endOfMonth as dateFnsEndOfMonth } from \"date-fns/endOfMonth\";\nimport { endOfWeek as dateFnsEndOfWeek } from \"date-fns/endOfWeek\";\nimport { endOfYear as dateFnsEndOfYear } from \"date-fns/endOfYear\";\nimport { format as dateFnsFormat, longFormatters } from \"date-fns/format\";\nimport { formatISO } from \"date-fns/formatISO\";\nimport { getDate as dateFnsGetDate } from \"date-fns/getDate\";\nimport { getDay as dateFnsGetDay } from \"date-fns/getDay\";\nimport { getDaysInMonth as dateFnsGetDaysInMonth } from \"date-fns/getDaysInMonth\";\nimport { getHours as dateFnsGetHours } from \"date-fns/getHours\";\nimport { getMinutes as dateFnsGetMinutes } from \"date-fns/getMinutes\";\nimport { getMonth as dateFnsGetMonth } from \"date-fns/getMonth\";\nimport { getSeconds as dateFnsGetSeconds } from \"date-fns/getSeconds\";\nimport { getWeek as dateFnsGetWeek } from \"date-fns/getWeek\";\nimport { getYear as dateFnsGetYear } from \"date-fns/getYear\";\nimport { isAfter as dateFnsIsAfter } from \"date-fns/isAfter\";\nimport { isBefore as dateFnsIsBefore } from \"date-fns/isBefore\";\nimport { isEqual as dateFnsIsEqual } from \"date-fns/isEqual\";\nimport { isSameDay as dateFnsIsSameDay } from \"date-fns/isSameDay\";\nimport { isSameHour as dateFnsIsSameHour } from \"date-fns/isSameHour\";\nimport { isSameMonth as dateFnsIsSameMonth } from \"date-fns/isSameMonth\";\nimport { isSameYear as dateFnsIsSameYear } from \"date-fns/isSameYear\";\nimport { isValid as dateFnsIsValid } from \"date-fns/isValid\";\nimport { isWithinInterval } from \"date-fns/isWithinInterval\";\nimport { Locale } from \"date-fns/locale\";\nimport { ${\n context.env.parsed.DEFAULT_LOCALE?.replaceAll(\"-\", \"\") || \"enUS\"\n } as defaultLocale } from \"date-fns/locale/${\n context.env.parsed.DEFAULT_LOCALE || \"en-US\"\n }\";\nimport { parse as dateFnsParse } from \"date-fns/parse\";\nimport { parseISO as dateFnsParseISO } from \"date-fns/parseISO\";\nimport { setDate as dateFnsSetDate } from \"date-fns/setDate\";\nimport { setHours as dateFnsSetHours } from \"date-fns/setHours\";\nimport { setMinutes as dateFnsSetMinutes } from \"date-fns/setMinutes\";\nimport { setMonth as dateFnsSetMonth } from \"date-fns/setMonth\";\nimport { setSeconds as dateFnsSetSeconds } from \"date-fns/setSeconds\";\nimport { setYear as dateFnsSetYear } from \"date-fns/setYear\";\nimport { startOfDay as dateFnsStartOfDay } from \"date-fns/startOfDay\";\nimport { startOfMonth as dateFnsStartOfMonth } from \"date-fns/startOfMonth\";\nimport { startOfWeek as dateFnsStartOfWeek } from \"date-fns/startOfWeek\";\nimport { startOfYear as dateFnsStartOfYear } from \"date-fns/startOfYear\";\n\nexport const formats: DateFormats = {\n dayOfMonth: \"d\",\n fullDate: \"PP\",\n fullDateWithWeekday: \"PPPP\",\n fullDateTime: \"PP p\",\n fullDateTime12h: \"PP hh:mm aa\",\n fullDateTime24h: \"PP HH:mm\",\n fullTime: \"p\",\n fullTime12h: \"hh:mm aa\",\n fullTime24h: \"HH:mm\",\n hours12h: \"hh\",\n hours24h: \"HH\",\n keyboardDate: \"P\",\n keyboardDateTime: \"P p\",\n keyboardDateTime12h: \"P hh:mm aa\",\n keyboardDateTime24h: \"P HH:mm\",\n systemDateTime: \"P HH:mm:ss.SSS\",\n filePathDateTime: \"P_HH-mm-ss-SSS\",\n minutes: \"mm\",\n month: \"LLLL\",\n monthAndDate: \"MMMM d\",\n monthAndYear: \"LLLL yyyy\",\n monthShort: \"MMM\",\n weekday: \"EEEE\",\n weekdayShort: \"EEE\",\n normalDate: \"d MMMM\",\n normalDateWithWeekday: \"EEE, MMM d\",\n seconds: \"ss\",\n shortDate: \"MMM d\",\n year: \"yyyy\"\n};\n\nexport const locale: Locale = defaultLocale;\n\n/**\n * Creates a date object using the provided value.\n *\n * @remarks\n * This function creates a date object using the provided value. If the value is \\`null\\`, it returns \\`null\\`. If the value is \\`undefined\\`, it returns the current date. If the value is a string, it parses the string as a date. If the value is a number, it treats it as a timestamp. If the value is a date object, it returns the date object.\n *\n * @example\n * \\`\\`\\`ts\n * import { createDate } from \"storm:date\";\n *\n * const date = createDate(\"2023-10-01\");\n * console.log(date.format(\"YYYY-MM-DD\")); // Outputs: 2023-10-01\n * \\`\\`\\`\n *\n * @param value - The value to create the date object from.\n * @returns A date object or \\`null\\` if the value is \\`null\\`.\n */\nexport function createDate<\n TArg = undefined,\n TResultingDate = TArg extends null\n ? null\n : TArg extends undefined\n ? Date\n : Date | null\n>(value?: TArg): TResultingDate {\n if (typeof value === \"undefined\") {\n return new Date() as TResultingDate;\n }\n if (value === null) {\n return null as TResultingDate;\n }\n return new Date(value as string | number) as TResultingDate;\n}\n\nexport const type = \"date-fns\";\n\n// Note: date-fns input types are more lenient than this adapter, so we need to expose our more\n// strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.\nexport function is12HourCycleInCurrentLocale(): boolean {\n if (locale) {\n return /a/.test(locale.formatLong?.time({}));\n }\n\n // By default date-fns is using en-US locale with am/pm enabled\n return true;\n}\n\nexport function getFormatHelperText(format: string) {\n // @see https://github.com/date-fns/date-fns/blob/master/src/format/index.js#L31\n const longFormatRegexp = /P+p+|P+|p+|''|'(?:''|[^'])+(?:'|$)|./g;\n const _locale = locale || defaultLocale;\n\n return (\n format\n .match(longFormatRegexp)\n ?.map(token => {\n const firstCharacter = token[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter]!;\n\n return longFormatter(token, _locale.formatLong);\n }\n\n return token;\n })\n .join(\"\")\n .replace(/aaa|aa|a/g, \"(a|p)m\")\n .toLocaleLowerCase() ?? format\n );\n}\n\nexport function parseISO(isoString: string) {\n return dateFnsParseISO(isoString);\n}\n\nexport function toISO(value: Date) {\n return formatISO(value, {\n format: \"extended\"\n });\n}\n\nexport function getCurrentLocaleCode() {\n return locale?.code || $storm.env.DEFAULT_LOCALE;\n}\n\nexport function addSeconds(value: Date, count: number) {\n return dateFnsAddSeconds(value, count);\n}\n\nexport function addMinutes(value: Date, count: number) {\n return dateFnsAddMinutes(value, count);\n}\n\nexport function addHours(value: Date, count: number) {\n return dateFnsAddHours(value, count);\n}\n\nexport function addDays(value: Date, count: number) {\n return dateFnsAddDays(value, count);\n}\n\nexport function addWeeks(value: Date, count: number) {\n return dateFnsAddWeeks(value, count);\n}\n\nexport function addMonths(value: Date, count: number) {\n return dateFnsAddMonths(value, count);\n}\n\nexport function addYears(value: Date, count: number) {\n return dateFnsAddYears(value, count);\n}\n\nexport function isValid(value: any) {\n return dateFnsIsValid(createDate(value));\n}\n\nexport function getDiff(\n value: Date,\n comparing: Date | string,\n unit?: TimeUnit\n) {\n // we output 0 if the compare date is string and parsing is not valid\n const dateToCompare = createDate(comparing) ?? value;\n if (!isValid(dateToCompare)) {\n return 0;\n }\n\n switch (unit) {\n case \"years\":\n return differenceInYears(value, dateToCompare);\n case \"quarters\":\n return differenceInQuarters(value, dateToCompare);\n case \"months\":\n return differenceInMonths(value, dateToCompare);\n case \"weeks\":\n return differenceInWeeks(value, dateToCompare);\n case \"days\":\n return differenceInDays(value, dateToCompare);\n case \"hours\":\n return differenceInHours(value, dateToCompare);\n case \"minutes\":\n return differenceInMinutes(value, dateToCompare);\n case \"seconds\":\n return differenceInSeconds(value, dateToCompare);\n case \"milliseconds\":\n case undefined:\n default:\n return differenceInMilliseconds(value, dateToCompare);\n }\n}\n\nexport function isAfter(value: Date, comparing: Date) {\n return dateFnsIsAfter(value, comparing);\n}\n\nexport function isBefore(value: Date, comparing: Date) {\n return dateFnsIsBefore(value, comparing);\n}\n\nexport function startOfDay(value: Date) {\n return dateFnsStartOfDay(value);\n}\n\nexport function endOfDay(value: Date) {\n return dateFnsEndOfDay(value);\n}\n\nexport function getHours(value: Date) {\n return dateFnsGetHours(value);\n}\n\nexport function setHours(value: Date, count: number) {\n return dateFnsSetHours(value, count);\n}\n\nexport function setMinutes(value: Date, count: number) {\n return dateFnsSetMinutes(value, count);\n}\n\nexport function getSeconds(value: Date) {\n return dateFnsGetSeconds(value);\n}\n\nexport function setSeconds(value: Date, count: number) {\n return dateFnsSetSeconds(value, count);\n}\n\nexport function isSameDay(value: Date, comparing: Date) {\n return dateFnsIsSameDay(value, comparing);\n}\n\nexport function isSameMonth(value: Date, comparing: Date) {\n return dateFnsIsSameMonth(value, comparing);\n}\n\nexport function isSameYear(value: Date, comparing: Date) {\n return dateFnsIsSameYear(value, comparing);\n}\n\nexport function isSameHour(value: Date, comparing: Date) {\n return dateFnsIsSameHour(value, comparing);\n}\n\nexport function startOfYear(value: Date) {\n return dateFnsStartOfYear(value);\n}\n\nexport function endOfYear(value: Date) {\n return dateFnsEndOfYear(value);\n}\n\nexport function startOfMonth(value: Date) {\n return dateFnsStartOfMonth(value);\n}\n\nexport function endOfMonth(value: Date) {\n return dateFnsEndOfMonth(value);\n}\n\nexport function startOfWeek(value: Date) {\n return dateFnsStartOfWeek(value, {\n locale\n });\n}\n\nexport function endOfWeek(value: Date) {\n return dateFnsEndOfWeek(value, {\n locale\n });\n}\n\nexport function getYear(value: Date) {\n return dateFnsGetYear(value);\n}\n\nexport function setYear(value: Date, count: number) {\n return dateFnsSetYear(value, count);\n}\n\nexport function toJsDate(value: Date) {\n return value;\n}\n\nexport function parse(value: string, formatString: string) {\n if (value === \"\") {\n return null;\n }\n return dateFnsParse(value, formatString, new Date(), {\n locale\n });\n}\n\nexport function format(date: Date, formatKey: keyof DateFormats) {\n return formatByString(date, formats[formatKey]);\n}\n\nexport function formatByString(date: Date, formatString: string) {\n return dateFnsFormat(date, formatString, {\n locale\n });\n}\n\nexport function isEqual(date: any, comparing: any) {\n if (date === null && comparing === null) {\n return true;\n }\n return dateFnsIsEqual(date, comparing);\n}\n\nexport function isNull(date: Date) {\n return date === null;\n}\n\nexport function isAfterDay(date: Date, value: Date) {\n return isAfter(date, endOfDay(value));\n}\n\nexport function isBeforeDay(date: Date, value: Date) {\n return isBefore(date, startOfDay(value));\n}\n\nexport function isBeforeYear(date: Date, value: Date) {\n return isBefore(date, startOfYear(value));\n}\n\nexport function isBeforeMonth(value: Date, comparing: Date): boolean {\n return isBefore(value, startOfMonth(comparing));\n}\n\nexport function isAfterMonth(value: Date, comparing: Date): boolean {\n return isAfter(value, startOfMonth(comparing));\n}\n\nexport function isAfterYear(date: Date, value: Date) {\n return isAfter(date, endOfYear(value));\n}\n\nexport function isWithinRange(date: Date, [start, end]: [Date, Date]) {\n return isWithinInterval(date, {\n start,\n end\n });\n}\n\nexport function formatNumber(numberToFormat: string) {\n return numberToFormat;\n}\n\nexport function getMinutes(date: Date) {\n return dateFnsGetMinutes(date);\n}\n\nexport function getDate(date: Date) {\n return dateFnsGetDate(date);\n}\n\nexport function setDate(date: Date, count: number) {\n return dateFnsSetDate(date, count);\n}\n\nexport function getWeek(date: Date) {\n return dateFnsGetWeek(date);\n}\n\nexport function getMonth(date: Date) {\n return dateFnsGetMonth(date);\n}\n\nexport function getDaysInMonth(date: Date) {\n return dateFnsGetDaysInMonth(date);\n}\n\nexport function setMonth(date: Date, count: number) {\n return dateFnsSetMonth(date, count);\n}\n\nexport function getMeridiemText(meridiem: \"am\" | \"pm\") {\n return meridiem === \"am\" ? \"AM\" : \"PM\";\n}\n\nexport function getNextMonth(date: Date) {\n return addMonths(date, 1);\n}\n\nexport function getPreviousMonth(date: Date) {\n return addMonths(date, -1);\n}\n\nexport function getMonthArray(date: Date) {\n const firstMonth = startOfYear(date);\n const monthArray = [firstMonth];\n\n while (monthArray.length < 12) {\n const prevMonth = monthArray[monthArray.length - 1]!;\n monthArray.push(getNextMonth(prevMonth));\n }\n\n return monthArray;\n}\n\nexport function mergeDateAndTime(date: Date, time: Date) {\n return setSeconds(\n setMinutes(setHours(date, getHours(time)), getMinutes(time)),\n getSeconds(time)\n );\n}\n\nexport function getWeekdays() {\n const now = new Date();\n\n return eachDayOfInterval({\n start: startOfWeek(now),\n end: endOfWeek(now)\n }).map(day => formatByString(day, \"EEEEEE\"));\n}\n\nexport function getWeekArray(date: Date) {\n const start = startOfWeek(startOfMonth(date));\n const end = endOfWeek(endOfMonth(date));\n let count = 0;\n let current = start;\n const nestedWeeks: Date[][] = [];\n let lastDay = null as null | number;\n while (isBefore(current, end)) {\n const weekNumber = Math.floor(count / 7);\n nestedWeeks[weekNumber] ??= [];\n const day = dateFnsGetDay(current);\n if (lastDay !== day) {\n lastDay = day;\n nestedWeeks[weekNumber].push(current);\n count += 1;\n }\n current = addDays(current, 1);\n }\n return nestedWeeks;\n}\n\nexport function getYearRange(start: Date, end: Date) {\n const startDate = startOfYear(start);\n const endDate = endOfYear(end);\n const years: Date[] = [];\n\n let current = startDate;\n while (isBefore(current, endDate)) {\n years.push(current);\n current = addYears(current, 1);\n }\n return years;\n}\n\n\n`;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getFileHeader } from \"powerlines/lib/utilities/file-header\";\nimport { DatePluginContext } from \"../types/plugin\";\n\n/**\n * Generates the Powerlines configuration file.\n *\n * @param context - The build context containing runtime information.\n * @returns A string representing the configuration file content.\n */\nexport function dayjsModule(context: DatePluginContext) {\n return `\n/**\n * The Date module provides utility functions for date manipulation and formatting\n *\n * @module ${context.config.framework}:date\n */\n\n${getFileHeader(context)}\n\nimport defaultDayjs, { QUnitType } from \"dayjs\";\nimport customParseFormatPlugin from \"dayjs/plugin/customParseFormat\";\nimport localizedFormatPlugin from \"dayjs/plugin/localizedFormat\";\nimport isBetweenPlugin from \"dayjs/plugin/isBetween\";\nimport weekOfYear from \"dayjs/plugin/weekOfYear\";\nimport {\n StormDateInterface,\n DateFormats,\n TimeUnit\n} from \"@powerlines/plugin-date/types/runtime\";\n\ndefaultDayjs.extend(customParseFormatPlugin);\ndefaultDayjs.extend(localizedFormatPlugin);\ndefaultDayjs.extend(isBetweenPlugin);\ndefaultDayjs.extend(weekOfYear);\n\ninterface Opts {\n locale?: string;\n /** Make sure that your dayjs instance extends customParseFormat and advancedFormat */\n instance?: typeof defaultDayjs;\n formats?: Partial<DateFormats>;\n}\n\ntype Dayjs = defaultDayjs.Dayjs;\ntype Constructor<TDate extends Dayjs> = (\n ...args: Parameters<typeof defaultDayjs>\n) => TDate;\nconst withLocale = <TDate extends Dayjs>(\n dayjs: any,\n locale?: string\n): Constructor<TDate> => (!locale ? dayjs : (...args) => dayjs(...args).locale(locale));\n\nexport const formats: DateFormats = {\n normalDateWithWeekday: \"ddd, MMM D\",\n normalDate: \"D MMMM\",\n shortDate: \"MMM D\",\n monthAndDate: \"MMMM D\",\n dayOfMonth: \"D\",\n year: \"YYYY\",\n month: \"MMMM\",\n monthShort: \"MMM\",\n monthAndYear: \"MMMM YYYY\",\n weekday: \"dddd\",\n weekdayShort: \"ddd\",\n minutes: \"mm\",\n hours12h: \"hh\",\n hours24h: \"HH\",\n seconds: \"ss\",\n fullTime: \"LT\",\n fullTime12h: \"hh:mm A\",\n fullTime24h: \"HH:mm\",\n fullDate: \"ll\",\n fullDateWithWeekday: \"dddd, LL\",\n fullDateTime: \"lll\",\n fullDateTime12h: \"ll hh:mm A\",\n fullDateTime24h: \"ll HH:mm\",\n keyboardDate: \"L\",\n keyboardDateTime: \"L LT\",\n keyboardDateTime12h: \"L hh:mm A\",\n keyboardDateTime24h: \"L HH:mm\",\n systemDateTime: \"L HH:mm:ss.SSS\",\n filePathDateTime: \"L_HH-mm-ss-SSS\"\n};\n\nexport let locale = \"${\n context.env.parsed.DEFAULT_LOCALE || context.workspaceConfig.locale\n ? `${context.env.parsed.DEFAULT_LOCALE || context.workspaceConfig.locale}`\n : \"en-US\"\n }\";\n\nexport const dayjs = withLocale(defaultDayjs, locale);\n\nexport const type = \"dayjs\";\n\n/**\n * Creates a date object using the provided value.\n *\n * @remarks\n * This function creates a date object using the provided value. If the value is \\`null\\`, it returns \\`null\\`. If the value is \\`undefined\\`, it returns the current date. If the value is a string, it parses the string as a date. If the value is a number, it treats it as a timestamp. If the value is a date object, it returns the date object.\n *\n * @example\n * \\`\\`\\`ts\n * import { createDate } from \"storm:date\";\n *\n * const date = createDate(\"2023-10-01\");\n * console.log(date.format(\"YYYY-MM-DD\")); // Outputs: 2023-10-01\n * \\`\\`\\`\n *\n * @param value - The value to create the date object from.\n * @returns A date object or \\`null\\` if the value is \\`null\\`.\n */\nexport function createDate<\n TArg extends unknown = undefined,\n TResultingDate extends unknown = TArg extends null\n ? null\n : TArg extends undefined\n ? TDate\n : TDate | null\n>(value?: TArg): TResultingDate {\n if (value === null) {\n return null as TResultingDate;\n }\n\n return dayjs(value as any) as unknown as TResultingDate;\n}\n\nexport function is12HourCycleInCurrentLocale() {\n /* istanbul ignore next */\n return /A|a/.test(dayjs.Ls[dayjs.locale() || $storm.env.DEFAULT_LOCALE]?.formats?.LT ?? \"\");\n};\n\nexport function getCurrentLocaleCode() {\n return dayjs.locale() || $storm.env.DEFAULT_LOCALE;\n};\n\nexport function getFormatHelperText(format: string) {\n // @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js\n const localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?)|./g;\n\n return (\n format\n .match(localFormattingTokens)\n ?.map((token) => {\n const firstCharacter = token[0];\n if (firstCharacter === \"L\") {\n /* istanbul ignore next */\n return (\n dayjs.Ls[dayjs.locale() || $storm.env.DEFAULT_LOCALE]?.formats[\n token as keyof ILocale[\"formats\"]\n ] ?? token\n );\n }\n return token;\n })\n .join(\"\")\n .replace(/a/gi, \"(a|p)m\")\n .toLocaleLowerCase() ?? format\n );\n};\n\nexport function parseISO(isoString: string) {\n return dayjs(isoString);\n};\n\nexport function toISO(value: Dayjs) {\n return value.toISOString();\n};\n\nexport function parse(value: any, format: string) {\n if (value === \"\") {\n return null;\n }\n\n return dayjs(value, format, dayjs.locale(), true);\n};\n\nexport function toJsDate(value: Dayjs) {\n return value.toDate();\n};\n\nexport function isValid(value: any) {\n return dayjs(value).isValid();\n};\n\nexport function isNull(date: Dayjs | null) {\n return date === null;\n};\n\nexport function getDiff(date: Dayjs, comparing: Dayjs | string, units?: Unit) {\n if (typeof comparing === \"string\") {\n comparing = dayjs(comparing);\n }\n\n if (!comparing.isValid()) {\n return 0;\n }\n\n return date.diff(comparing, units as QUnitType);\n};\n\nexport function isAfter(date: Dayjs, value: Dayjs) {\n return date.isAfter(value);\n};\n\nexport function isBefore(date: Dayjs, value: Dayjs) {\n return date.isBefore(value);\n};\n\nexport function isAfterDay(date: Dayjs, value: Dayjs) {\n return date.isAfter(value, \"day\");\n};\n\nexport function isBeforeDay(date: Dayjs, value: Dayjs) {\n return date.isBefore(value, \"day\");\n};\n\nexport function isAfterMonth(date: Dayjs, value: Dayjs) {\n return date.isAfter(value, \"month\");\n};\n\nexport function isBeforeMonth(date: Dayjs, value: Dayjs) {\n return date.isBefore(value, \"month\");\n};\n\nexport function isBeforeYear(date: Dayjs, value: Dayjs) {\n return date.isBefore(value, \"year\");\n};\n\nexport function isAfterYear(date: Dayjs, value: Dayjs) {\n return date.isAfter(value, \"year\");\n};\n\nexport function startOfDay(date: Dayjs) {\n return date.startOf(\"day\");\n};\n\nexport function endOfDay(date: Dayjs) {\n return date.endOf(\"day\");\n};\n\nexport function format(date: Dayjs, formatKey: keyof DateFormats) {\n return formatByString(date, formats[formatKey]);\n};\n\nexport function formatByString(date: Dayjs, formatString: string) {\n return dayjs(date).format(formatString);\n};\n\nexport function formatNumber(numberToFormat: string) {\n return numberToFormat;\n};\n\nexport function getHours(date: Dayjs) {\n return date.hour();\n};\n\nexport function addSeconds(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"second\") as Dayjs)\n : (date.add(count, \"second\") as Dayjs);\n};\n\nexport function addMinutes(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"minute\") as Dayjs)\n : (date.add(count, \"minute\") as Dayjs);\n};\n\nexport function addHours(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"hour\") as Dayjs)\n : (date.add(count, \"hour\") as Dayjs);\n};\n\nexport function addDays(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"day\") as Dayjs)\n : (date.add(count, \"day\") as Dayjs);\n};\n\nexport function addWeeks(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"week\") as Dayjs)\n : (date.add(count, \"week\") as Dayjs);\n};\n\nexport function addMonths(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"month\") as Dayjs)\n : (date.add(count, \"month\") as Dayjs);\n};\n\nexport function addYears(date: Dayjs, count: number) {\n return count < 0\n ? (date.subtract(Math.abs(count), \"year\") as Dayjs)\n : (date.add(count, \"year\") as Dayjs);\n};\n\nexport function setMonth(date: Dayjs, count: number) {\n return date.set(\"month\", count) as Dayjs;\n};\n\nexport function setHours(date: Dayjs, count: number) {\n return date.set(\"hour\", count) as Dayjs;\n};\n\nexport function getMinutes(date: Dayjs) {\n return date.minute();\n};\n\nexport function setMinutes(date: Dayjs, count: number) {\n return date.set(\"minute\", count) as Dayjs;\n};\n\nexport function getSeconds(date: Dayjs) {\n return date.second();\n};\n\nexport function setSeconds(date: Dayjs, count: number) {\n return date.set(\"second\", count) as Dayjs;\n};\n\nexport function getWeek(date: Dayjs) {\n return date.week();\n};\n\nexport function getMonth(date: Dayjs) {\n return date.month();\n};\n\nexport function getDate(date: Dayjs) {\n return date.date();\n};\n\nexport function setDate(date: Dayjs, count: number) {\n return date.set(\"date\", count) as Dayjs;\n};\n\nexport function getDaysInMonth(date: Dayjs) {\n return date.daysInMonth();\n};\n\nexport function isSameDay(date: Dayjs, comparing: Dayjs) {\n return date.isSame(comparing, \"day\");\n};\n\nexport function isSameMonth(date: Dayjs, comparing: Dayjs) {\n return date.isSame(comparing, \"month\");\n};\n\nexport function isSameYear(date: Dayjs, comparing: Dayjs) {\n return date.isSame(comparing, \"year\");\n};\n\nexport function isSameHour(date: Dayjs, comparing: Dayjs) {\n return date.isSame(comparing, \"hour\");\n};\n\nexport function getMeridiemText(meridiem: \"am\" | \"pm\") {\n return meridiem === \"am\" ? \"AM\" : \"PM\";\n};\n\nexport function startOfYear(date: Dayjs) {\n return date.startOf(\"year\") as Dayjs;\n};\n\nexport function endOfYear(date: Dayjs) {\n return date.endOf(\"year\") as Dayjs;\n};\n\nexport function startOfMonth(date: Dayjs) {\n return date.startOf(\"month\") as Dayjs;\n};\n\nexport function endOfMonth(date: Dayjs) {\n return date.endOf(\"month\") as Dayjs;\n};\n\nexport function startOfWeek(date: Dayjs) {\n return date.startOf(\"week\") as Dayjs;\n};\n\nexport function endOfWeek(date: Dayjs) {\n return date.endOf(\"week\") as Dayjs;\n};\n\nexport function getNextMonth(date: Dayjs) {\n return date.add(1, \"month\") as Dayjs;\n};\n\nexport function getPreviousMonth(date: Dayjs) {\n return date.subtract(1, \"month\") as Dayjs;\n};\n\nexport function getMonthArray(date: Dayjs) {\n const firstMonth = date.startOf(\"year\") as Dayjs;\n const monthArray = [firstMonth];\n\n while (monthArray.length < 12) {\n const prevMonth = monthArray[monthArray.length - 1];\n monthArray.push(getNextMonth(prevMonth));\n }\n\n return monthArray;\n};\n\nexport function getYear(date: Dayjs) {\n return date.year();\n};\n\nexport function setYear(date: Dayjs, year: number) {\n return date.set(\"year\", year) as Dayjs;\n};\n\nexport function mergeDateAndTime(date: Dayjs, time: Dayjs) {\n return date.hour(time.hour()).minute(time.minute()).second(time.second()) as Dayjs;\n};\n\nexport function getWeekdays() {\n const start = dayjs().startOf(\"week\");\n return [0, 1, 2, 3, 4, 5, 6].map((diff) =>\n formatByString(start.add(diff, \"day\"), \"dd\")\n );\n};\n\nexport function isEqual(value: any, comparing: any) {\n if (value === null && comparing === null) {\n return true;\n }\n\n return dayjs(value).isSame(comparing);\n};\n\nexport function getWeekArray(date: Dayjs) {\n const start = dayjs(date).startOf(\"month\").startOf(\"week\") as Dayjs;\n const end = dayjs(date).endOf(\"month\").endOf(\"week\") as Dayjs;\n\n let count = 0;\n let current = start;\n const nestedWeeks: Dayjs[][] = [];\n\n while (current.isBefore(end)) {\n const weekNumber = Math.floor(count / 7);\n nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];\n nestedWeeks[weekNumber].push(current);\n\n current = current.add(1, \"day\") as TDate;\n count += 1;\n }\n\n return nestedWeeks;\n};\n\nexport function getYearRange(start: Dayjs, end: Dayjs) {\n const startDate = start.startOf(\"year\");\n const endDate = end.endOf(\"year\");\n const years: Dayjs[] = [];\n\n let current = startDate;\n while (current.isBefore(endDate)) {\n years.push(current);\n current = current.add(1, \"year\");\n }\n\n return years;\n};\n\nexport function isWithinRange(date: Dayjs, [start, end]: [Dayjs, Dayjs]) {\n return date.isBetween(start, end, null, \"[]\");\n};\n\n\n`;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getFileHeader } from \"powerlines/lib/utilities/file-header\";\nimport { DatePluginContext } from \"../types/plugin\";\n\n/**\n * Generates the Powerlines configuration file.\n *\n * @param context - The build context containing runtime information.\n * @returns A string representing the configuration file content.\n */\nexport function luxonModule(context: DatePluginContext) {\n return `\n/**\n * The Date module provides utility functions for date manipulation and formatting\n *\n * @module ${context.config.framework}:date\n */\n\n${getFileHeader(context)}\n\nimport { DateTime, Settings, Info } from \"luxon\";\nimport {\n StormDateInterface,\n DateFormats,\n TimeUnit\n} from \"@powerlines/plugin-date/types/runtime\";\n\nexport const formats: DateFormats = {\n dayOfMonth: \"d\",\n fullDate: \"DD\",\n fullDateWithWeekday: \"DDDD\",\n fullDateTime: \"ff\",\n fullDateTime12h: \"DD, hh:mm a\",\n fullDateTime24h: \"DD, T\",\n fullTime: \"t\",\n fullTime12h: \"hh:mm a\",\n fullTime24h: \"HH:mm\",\n hours12h: \"hh\",\n hours24h: \"HH\",\n keyboardDate: \"D\",\n keyboardDateTime: \"D t\",\n keyboardDateTime12h: \"D hh:mm a\",\n keyboardDateTime24h: \"D T\",\n systemDateTime: \"D HH:mm:ss.SSS\",\n filePathDateTime: \"D_HH-mm-ss-SSS\",\n minutes: \"mm\",\n seconds: \"ss\",\n month: \"LLLL\",\n monthAndDate: \"MMMM d\",\n monthAndYear: \"LLLL yyyy\",\n monthShort: \"MMM\",\n weekday: \"cccc\",\n weekdayShort: \"ccc\",\n normalDate: \"d MMMM\",\n normalDateWithWeekday: \"EEE, MMM d\",\n shortDate: \"MMM d\",\n year: \"yyyy\",\n};\n\nexport let locale = \"${\n context.env.parsed.DEFAULT_LOCALE || context.workspaceConfig.locale\n ? `${context.env.parsed.DEFAULT_LOCALE || context.workspaceConfig.locale}`\n : \"en-US\"\n }\";\n\nexport const type = \"luxon\";\n\n/**\n * Creates a date object using the provided value.\n *\n * @remarks\n * This function creates a date object using the provided value. If the value is \\`null\\`, it returns \\`null\\`. If the value is \\`undefined\\`, it returns the current date. If the value is a string, it parses the string as a date. If the value is a number, it treats it as a timestamp. If the value is a date object, it returns the date object.\n *\n * @example\n * \\`\\`\\`ts\n * import { createDate } from \"storm:date\";\n *\n * const date = createDate(\"2023-10-01\");\n * console.log(date.format(\"YYYY-MM-DD\")); // Outputs: 2023-10-01\n * \\`\\`\\`\n *\n * @param value - The value to create the date object from.\n * @returns A date object or \\`null\\` if the value is \\`null\\`.\n */\nexport function createDate<\n TArg extends unknown = undefined,\n TResultingDate extends unknown = TArg extends null\n ? null\n : TArg extends undefined\n ? DateTime\n : DateTime | null\n>(value?: TArg): TResultingDate {\n if (typeof value === \"undefined\") {\n return DateTime.local() as TResultingDate;\n }\n\n if (value === null) {\n return null as TResultingDate;\n }\n\n if (typeof value === \"string\") {\n return DateTime.fromJSDate(new Date(value), { locale }) as TResultingDate;\n }\n\n if (DateTime.isDateTime(value)) {\n return value as TResultingDate;\n }\n\n if (value instanceof Date) {\n return DateTime.fromJSDate(value, { locale }) as TResultingDate;\n }\n\n /* istanbul ignore next */\n return DateTime.local() as TResultingDate;\n}\n\nexport function toJsDate(value: DateTime) {\n return value.toJSDate();\n};\n\nexport function parseISO(isoString: string) {\n return DateTime.fromISO(isoString);\n};\n\nexport function toISO(value: DateTime) {\n return value.toISO({ format: \"extended\" });\n};\n\nexport function parse(value: string, formatString: string) {\n if (value === \"\") {\n return null;\n }\n\n return DateTime.fromFormat(value, formatString, { locale });\n};\n\n/* istanbul ignore next */\nexport function is12HourCycleInCurrentLocale() {\n if (typeof Intl === \"undefined\" || typeof Intl.DateTimeFormat === \"undefined\") {\n return true; // Luxon defaults to en-US if Intl not found\n }\n\n return Boolean(\n new Intl.DateTimeFormat(this.locale, { hour: \"numeric\" })?.resolvedOptions()?.hour12\n );\n};\n\nexport function getFormatHelperText(format: string) {\n // Unfortunately there is no way for luxon to retrieve readable formats from localized format\n return \"\";\n};\n\n/* istanbul ignore next */\nexport function getCurrentLocaleCode() {\n return this.locale || Settings.defaultLocale;\n};\n\nexport function addSeconds(date: DateTime, count: number) {\n return date.plus({ seconds: count });\n};\n\nexport function addMinutes(date: DateTime, count: number) {\n return date.plus({ minutes: count });\n};\n\nexport function addHours(date: DateTime, count: number) {\n return date.plus({ hours: count });\n};\n\nexport function addDays(date: DateTime, count: number) {\n return date.plus({ days: count });\n};\n\nexport function addWeeks(date: DateTime, count: number) {\n return date.plus({ weeks: count });\n};\n\nexport function addMonths(date: DateTime, count: number) {\n return date.plus({ months: count });\n};\n\nexport function addYears(date: DateTime, count: number) {\n return date.plus({ years: count });\n};\n\nexport function isValid(value: any) {\n if (DateTime.isDateTime(value)) {\n return value.isValid;\n }\n\n if (value === null) {\n return false;\n }\n\n return createDate(value)?.isValid ?? false;\n};\n\nexport function isEqual(value: any, comparing: any) {\n if (value === null && comparing === null) {\n return true;\n }\n\n // make sure that null will not be passed to createDate\n if (value === null || comparing === null) {\n return false;\n }\n\n if (!createDate(comparing)) {\n /* istanbul ignore next */\n return false;\n }\n\n return createDate(value)?.equals(createDate(comparing) as DateTime) ?? false;\n};\n\nexport function isSameDay(date: DateTime, comparing: DateTime) {\n return date.hasSame(comparing, \"day\");\n};\n\nexport function isSameMonth(date: DateTime, comparing: DateTime) {\n return date.hasSame(comparing, \"month\");\n};\n\nexport function isSameYear(date: DateTime, comparing: DateTime) {\n return date.hasSame(comparing, \"year\");\n};\n\nexport function isSameHour(date: DateTime, comparing: DateTime) {\n return date.hasSame(comparing, \"hour\");\n};\n\nexport function isAfter(value: DateTime, comparing: DateTime) {\n return value > comparing;\n};\n\nexport function isBefore(value: DateTime, comparing: DateTime) {\n return value < comparing;\n};\n\nexport function isBeforeDay(value: DateTime, comparing: DateTime) {\n const diff = value.diff(comparing.startOf(\"day\"), \"days\").toObject();\n return diff.days! < 0;\n};\n\nexport function isAfterDay(value: DateTime, comparing: DateTime) {\n const diff = value.diff(comparing.endOf(\"day\"), \"days\").toObject();\n return diff.days! > 0;\n};\n\nexport function isBeforeMonth(value: DateTime, comparing: DateTime) {\n const diff = value.diff(comparing.startOf(\"month\"), \"months\").toObject();\n return diff.months! < 0;\n};\n\nexport function isAfterMonth(value: DateTime, comparing: DateTime) {\n const diff = value.diff(comparing.startOf(\"month\"), \"months\").toObject();\n return diff.months! > 0;\n};\n\nexport function isBeforeYear(value: DateTime, comparing: DateTime) {\n const diff = value.diff(comparing.startOf(\"year\"), \"years\").toObject();\n return diff.years! < 0;\n};\n\nexport function isAfterYear(value: DateTime, comparing: DateTime) {\n const diff = value.diff(comparing.endOf(\"year\"), \"years\").toObject();\n return diff.years! > 0;\n};\n\nexport function getDiff(value: DateTime, comparing: DateTime | string, unit?: TimeUnit) {\n if (typeof comparing === \"string\") {\n comparing = DateTime.fromJSDate(new Date(comparing));\n }\n\n if (!comparing.isValid) {\n return 0;\n }\n\n if (unit) {\n return Math.floor(value.diff(comparing).as(unit));\n }\n\n return value.diff(comparing).as(\"millisecond\");\n};\n\nexport function startOfDay(value: DateTime) {\n return value.startOf(\"day\");\n};\n\nexport function endOfDay(value: DateTime) {\n return value.endOf(\"day\");\n};\n\nexport function format(date: DateTime, formatKey: keyof DateFormats) {\n return formatByString(date, formats[formatKey]);\n};\n\nexport function formatByString(date: DateTime, format: string) {\n return date.setLocale(locale).toFormat(format);\n};\n\nexport function formatNumber(numberToFormat: string) {\n return numberToFormat;\n};\n\nexport function getHours(value: DateTime) {\n return value.get(\"hour\");\n};\n\nexport function setHours(value: DateTime, count: number) {\n return value.set({ hour: count });\n};\n\nexport function getMinutes(value: DateTime) {\n return value.get(\"minute\");\n};\n\nexport function setMinutes(value: DateTime, count: number) {\n return value.set({ minute: count });\n};\n\nexport function getSeconds(value: DateTime) {\n return value.get(\"second\");\n};\n\nexport function setSeconds(value: DateTime, count: number) {\n return value.set({ second: count });\n};\n\nexport function getWeek(value: DateTime) {\n return value.get(\"weekNumber\");\n};\n\nexport function getMonth(value: DateTime) {\n // See https://github.com/moment/luxon/blob/master/docs/moment.md#major-functional-differences\n return value.get(\"month\") - 1;\n};\n\nexport function getDaysInMonth(value: DateTime) {\n return value.daysInMonth;\n};\n\nexport function setMonth(value: DateTime, count: number) {\n return value.set({ month: count + 1 });\n};\n\nexport function getYear(value: DateTime) {\n return value.get(\"year\");\n};\n\nexport function setYear(value: DateTime, year: number) {\n return value.set({ year });\n};\n\nexport function getDate(value: DateTime) {\n return value.get(\"day\");\n};\n\nexport function setDate(value: DateTime, day: number) {\n return value.set({ day });\n};\n\nexport function mergeDateAndTime(date: DateTime, time: DateTime) {\n return date.set({\n second: time.second,\n hour: time.hour,\n minute: time.minute,\n });\n};\n\nexport function startOfYear(value: DateTime) {\n return value.startOf(\"year\");\n};\n\nexport function endOfYear(value: DateTime) {\n return value.endOf(\"year\");\n};\n\nexport function startOfMonth(value: DateTime) {\n return value.startOf(\"month\");\n};\n\nexport function endOfMonth(value: DateTime) {\n return value.endOf(\"month\");\n};\n\nexport function startOfWeek(value: DateTime) {\n return value.startOf(\"week\");\n};\n\nexport function endOfWeek(value: DateTime) {\n return value.endOf(\"week\");\n};\n\nexport function getNextMonth(value: DateTime) {\n return value.plus({ months: 1 });\n};\n\nexport function getPreviousMonth(value: DateTime) {\n return value.minus({ months: 1 });\n};\n\nexport function getMonthArray(date: DateTime) {\n const firstMonth = date.startOf(\"year\");\n const monthArray = [firstMonth];\n\n while (monthArray.length < 12) {\n const prevMonth = monthArray[monthArray.length - 1];\n monthArray.push(this.getNextMonth(prevMonth));\n }\n\n return monthArray;\n};\n\nexport function getWeekdays() {\n return Info.weekdaysFormat(\"short\", { locale });\n};\n\nexport function getWeekArray(date: DateTime) {\n const { days } = date\n .endOf(\"month\")\n .endOf(\"week\")\n .diff(date.startOf(\"month\").startOf(\"week\"), \"days\")\n .toObject();\n\n const weeks: DateTime[][] = [];\n new Array<number>(Math.round(days!))\n .fill(0)\n .map((_, i) => i)\n .map((day) => date.startOf(\"month\").startOf(\"week\").plus({ days: day }))\n .forEach((v, i) => {\n if (i === 0 || (i % 7 === 0 && i > 6)) {\n weeks.push([v]);\n return;\n }\n\n weeks[weeks.length - 1].push(v);\n });\n\n return weeks;\n};\n\nexport function getYearRange(start: DateTime, end: DateTime) {\n const startDate = start.startOf(\"year\");\n const endDate = end.endOf(\"year\");\n\n let current = startDate;\n const years: DateTime[] = [];\n\n while (current < endDate) {\n years.push(current);\n current = current.plus({ year: 1 });\n }\n\n return years;\n};\n\nexport function getMeridiemText(meridiem: \"am\" | \"pm\") {\n return Info.meridiems({ locale }).find(\n (v) => v.toLowerCase() === meridiem.toLowerCase()\n )!;\n};\n\nexport function isNull(date: DateTime | null) {\n return date === null;\n};\n\nexport function isWithinRange(date: DateTime, [start, end]: [DateTime, DateTime]) {\n return (\n date.equals(start) ||\n date.equals(end) ||\n (isAfter(date, start) && isBefore(date, end))\n );\n};\n\n\n`;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getFileHeader } from \"powerlines/lib/utilities/file-header\";\nimport { DatePluginContext } from \"../types/plugin\";\n\n/**\n * Generates the Powerlines configuration file.\n *\n * @param context - The build context containing runtime information.\n * @returns A string representing the configuration file content.\n */\nexport function momentModule(context: DatePluginContext) {\n return `\n/**\n * The Date module provides utility functions for date manipulation and formatting\n *\n * @module ${context.config.framework}:date\n */\n\n${getFileHeader(context)}\n\nimport defaultMoment, { LongDateFormatKey } from \"moment\";\nimport {\n StormDateInterface,\n DateFormats,\n TimeUnit\n} from \"@powerlines/plugin-date/types/runtime\";\n\ntype Moment = defaultMoment.Moment;\n\nexport const formats: DateFormats = {\n normalDateWithWeekday: \"ddd, MMM D\",\n normalDate: \"D MMMM\",\n shortDate: \"MMM D\",\n monthAndDate: \"MMMM D\",\n dayOfMonth: \"D\",\n year: \"YYYY\",\n month: \"MMMM\",\n monthShort: \"MMM\",\n monthAndYear: \"MMMM YYYY\",\n weekday: \"dddd\",\n weekdayShort: \"ddd\",\n minutes: \"mm\",\n hours12h: \"hh\",\n hours24h: \"HH\",\n seconds: \"ss\",\n fullTime: \"LT\",\n fullTime12h: \"hh:mm A\",\n fullTime24h: \"HH:mm\",\n fullDate: \"ll\",\n fullDateWithWeekday: \"dddd, LL\",\n fullDateTime: \"lll\",\n fullDateTime12h: \"ll hh:mm A\",\n fullDateTime24h: \"ll HH:mm\",\n keyboardDate: \"L\",\n keyboardDateTime: \"L LT\",\n keyboardDateTime12h: \"L hh:mm A\",\n keyboardDateTime24h: \"L HH:mm\",\n systemDateTime: \"L HH:mm:ss.SSS\",\n filePathDateTime: \"L_HH-mm-ss-SSS\"\n};\n\nexport let locale = \"${\n context.env.parsed.DEFAULT_LOCALE || context.workspaceConfig.locale\n ? `${context.env.parsed.DEFAULT_LOCALE || context.workspaceConfig.locale}`\n : \"en-US\"\n }\";\n\nexport const type = \"moment\";\n\nconst moment = defaultMoment;\n\n/**\n * Creates a date object using the provided value.\n *\n * @remarks\n * This function creates a date object using the provided value. If the value is \\`null\\`, it returns \\`null\\`. If the value is \\`undefined\\`, it returns the current date. If the value is a string, it parses the string as a date. If the value is a number, it treats it as a timestamp. If the value is a date object, it returns the date object.\n *\n * @example\n * \\`\\`\\`ts\n * import { createDate } from \"storm:date\";\n *\n * const date = createDate(\"2023-10-01\");\n * console.log(date.format(\"YYYY-MM-DD\")); // Outputs: 2023-10-01\n * \\`\\`\\`\n *\n * @param value - The value to create the date object from.\n * @returns A date object or \\`null\\` if the value is \\`null\\`.\n */\nexport function createDate<\n TArg extends unknown = undefined,\n TResultingDate extends unknown = TArg extends null\n ? null\n : TArg extends undefined\n ? defaultMoment.Moment\n : defaultMoment.Moment | null\n>(value?: TArg): TResultingDate {\n if (value === null) {\n return null as TResultingDate;\n }\n\n const _moment = moment(value);\n if (locale) {\n _moment.locale(locale);\n }\n\n return _moment as TResultingDate;\n}\n\n\nexport function is12HourCycleInCurrentLocale(): boolean {\n return /A|a/.test(\n moment.localeData(getCurrentLocaleCode()).longDateFormat(\"LT\")\n );\n};\n\nexport function getFormatHelperText(format: string) {\n // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6\n const localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;\n\n return (\n format\n .match(localFormattingTokens)\n ?.map((token) => {\n const firstCharacter = token[0];\n if (firstCharacter === \"L\" || firstCharacter === \";\") {\n return moment\n .localeData(getCurrentLocaleCode())\n .longDateFormat(token as LongDateFormatKey);\n }\n\n return token;\n })\n .join(\"\")\n .replace(/a/gi, \"(a|p)m\")\n .toLocaleLowerCase() ?? format\n );\n};\n\nexport function getCurrentLocaleCode() {\n return locale || moment.locale();\n};\n\nexport function parseISO(isoString: string) {\n return moment(isoString, true);\n};\n\nexport function toISO(value: Moment) {\n return value.toISOString();\n};\n\nexport function parse(value: string, format: string) {\n if (value === \"\") {\n return null;\n }\n\n if (locale) {\n return moment(value, format, locale, true);\n }\n\n return moment(value, format, true);\n};\n\nexport function toJsDate(value: Moment) {\n return value.toDate();\n};\n\nexport function isValid(value: any) {\n return moment(value).isValid();\n};\n\nexport function isNull(date: Moment) {\n return date === null;\n};\n\nexport function getDiff(date: Moment, comparing: Moment | string, unit?: TimeUnit) {\n if (!moment(comparing).isValid()) {\n return 0;\n }\n\n return date.diff(comparing, unit);\n};\n\nexport function isAfter(date: Moment, value: Moment) {\n return date.isAfter(value);\n};\n\nexport function isBefore(date: Moment, value: Moment) {\n return date.isBefore(value);\n};\n\nexport function isAfterDay(date: Moment, value: Moment) {\n return date.isAfter(value, \"day\");\n};\n\nexport function isBeforeDay(date: Moment, value: Moment) {\n return date.isBefore(value, \"day\");\n};\n\nexport function isBeforeMonth(date: Moment, value: Moment) {\n return date.isBefore(value, \"month\");\n};\n\nexport function isAfterMonth(date: Moment, value: Moment) {\n return date.isAfter(value, \"month\");\n};\n\nexport function isBeforeYear(date: Moment, value: Moment) {\n return date.isBefore(value, \"year\");\n};\n\nexport function isAfterYear(date: Moment, value: Moment) {\n return date.isAfter(value, \"year\");\n};\n\nexport function startOfDay(date: Moment) {\n return date.clone().startOf(\"day\");\n};\n\nexport function endOfDay(date: Moment) {\n return date.clone().endOf(\"day\");\n};\n\nexport function format(date: Moment, formatKey: keyof DateFormats) {\n return formatByString(date, formats[formatKey]);\n};\n\nexport function formatByString(date: Moment, formatString: string) {\n const clonedDate = date.clone();\n if (locale) {\n clonedDate.locale(locale);\n }\n return clonedDate.format(formatString);\n};\n\nexport function formatNumber(numberToFormat: string) {\n return numberToFormat;\n};\n\nexport function getHours(date: Moment) {\n return date.get(\"hours\");\n};\n\nexport function addSeconds(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"seconds\")\n : date.clone().add(count, \"seconds\");\n};\n\nexport function addMinutes(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"minutes\")\n : date.clone().add(count, \"minutes\");\n};\n\nexport function addHours(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"hours\")\n : date.clone().add(count, \"hours\");\n};\n\nexport function addDays(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"days\")\n : date.clone().add(count, \"days\");\n};\n\nexport function addWeeks(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"weeks\")\n : date.clone().add(count, \"weeks\");\n};\n\nexport function addMonths(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"months\")\n : date.clone().add(count, \"months\");\n};\n\nexport function addYears(date: Moment, count: number) {\n return count < 0\n ? date.clone().subtract(Math.abs(count), \"years\")\n : date.clone().add(count, \"years\");\n};\n\nexport function setHours(date: Moment, count: number) {\n return date.clone().hours(count);\n};\n\nexport function getMinutes(date: Moment) {\n return date.get(\"minutes\");\n};\n\nexport function setMinutes(date: Moment, count: number) {\n return date.clone().minutes(count);\n};\n\nexport function getSeconds(date: Moment) {\n return date.get(\"seconds\");\n};\n\nexport function setSeconds(date: Moment, count: number) {\n return date.clone().seconds(count);\n};\n\nexport function getWeek(date: Moment) {\n return date.get(\"week\");\n};\n\nexport function getMonth(date: Moment) {\n return date.get(\"month\");\n};\n\nexport function getDaysInMonth(date: Moment) {\n return date.daysInMonth();\n};\n\nexport function isSameDay(date: Moment, comparing: Moment) {\n return date.isSame(comparing, \"day\");\n};\n\nexport function isSameMonth(date: Moment, comparing: Moment) {\n return date.isSame(comparing, \"month\");\n};\n\nexport function isSameYear(date: Moment, comparing: Moment) {\n return date.isSame(comparing, \"year\");\n};\n\nexport function isSameHour(date: Moment, comparing: Moment) {\n return date.isSame(comparing, \"hour\");\n};\n\nexport function setMonth(date: Moment, count: number) {\n return date.clone().month(count);\n};\n\nexport function getMeridiemText(meridiem: \"am\" | \"pm\") {\n if (is12HourCycleInCurrentLocale()) {\n // AM/PM translation only possible in those who have 12 hour cycle in locale.\n return moment\n .localeData(getCurrentLocaleCode())\n .meridiem(meridiem === \"am\" ? 0 : 13, 0, false);\n }\n\n return meridiem === \"am\" ? \"AM\" : \"PM\"; // fallback for de, ru, ...etc\n};\n\nexport function startOfYear(date: Moment) {\n return date.clone().startOf(\"year\");\n};\n\nexport function endOfYear(date: Moment) {\n return date.clone().endOf(\"year\");\n};\n\nexport function startOfMonth(date: Moment) {\n return date.clone().startOf(\"month\");\n};\n\nexport function endOfMonth(date: Moment) {\n return date.clone().endOf(\"month\");\n};\n\nexport function startOfWeek(date: Moment) {\n return date.clone().startOf(\"week\");\n};\n\nexport function endOfWeek(date: Moment) {\n return date.clone().endOf(\"week\");\n};\n\nexport function getNextMonth(date: Moment) {\n return date.clone().add(1, \"month\");\n};\n\nexport function getPreviousMonth(date: Moment) {\n return date.clone().subtract(1, \"month\");\n};\n\nexport function getMonthArray(date: Moment) {\n const firstMonth = date.clone().startOf(\"year\");\n const monthArray = [firstMonth];\n\n while (monthArray.length < 12) {\n const prevMonth = monthArray[monthArray.length - 1];\n monthArray.push(getNextMonth(prevMonth));\n }\n\n return monthArray;\n};\n\nexport function getYear(date: Moment) {\n return date.get(\"year\");\n};\n\nexport function setYear(date: Moment, year: number) {\n return date.clone().set(\"year\", year);\n};\n\nexport function getDate(date: Moment) {\n return date.get(\"date\");\n};\n\nexport function setDate(date: Moment, day: number) {\n return date.clone().set(\"date\", day);\n};\n\nexport function mergeDateAndTime(date: Moment, time: Moment) {\n return date.hour(time.hour()).minute(time.minute()).second(time.second());\n};\n\nexport function getWeekdays() {\n return moment.weekdaysShort(true);\n};\n\nexport function isEqual(value: any, comparing: any) {\n if (value === null && comparing === null) {\n return true;\n }\n\n return moment(value).isSame(comparing);\n};\n\nexport function getWeekArray(date: Moment) {\n const start = date.clone().startOf(\"month\").startOf(\"week\");\n const end = date.clone().endOf(\"month\").endOf(\"week\");\n\n let count = 0;\n let current = start;\n const nestedWeeks: Moment[][] = [];\n\n while (current.isBefore(end)) {\n const weekNumber = Math.floor(count / 7);\n nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];\n nestedWeeks[weekNumber].push(current);\n\n current = current.clone().add(1, \"day\");\n count += 1;\n }\n\n return nestedWeeks;\n};\n\nexport function getYearRange(start: Moment, end: Moment) {\n const startDate = moment(start).startOf(\"year\");\n const endDate = moment(end).endOf(\"year\");\n const years: Moment[] = [];\n\n let current = startDate;\n while (current.isBefore(endDate)) {\n years.push(current);\n current = current.clone().add(1, \"year\");\n }\n\n return years;\n};\n\nexport function isWithinRange(date: Moment, [start, end]: [Moment, Moment]) {\n return date.isBetween(start, end, null, \"[]\");\n};\n\n\n`;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport env from \"@powerlines/plugin-env\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { dateFnsModule } from \"./components/date-fns\";\nimport { dayjsModule } from \"./components/dayjs\";\nimport { luxonModule } from \"./components/luxon\";\nimport { momentModule } from \"./components/moment\";\nimport {\n DatePluginContext,\n DatePluginOptions,\n DatePluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./components\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport function plugin<TContext extends DatePluginContext = DatePluginContext>(\n options: DatePluginOptions = {}\n) {\n return [\n env(options.env),\n {\n name: \"date\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `date` build plugin.\"\n );\n\n const config = {\n date: defu(options, {\n type: \"date-fns\"\n })\n } as DatePluginUserConfig;\n\n if (\n !config.date!.type ||\n ![\"date-fns\", \"dayjs\", \"luxon\", \"moment\"].includes(config.date!.type)\n ) {\n if (config.date!.type) {\n this.warn(\n `Invalid date library type \"${config.date!.type}\" specified. Defaulting to \"date-fns\".`\n );\n }\n\n config.date!.type = \"date-fns\";\n }\n\n this.debug(`Using date library: ${config.date!.type}`);\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.dependencies[this.config.date.type] = \"latest\";\n },\n async prepare() {\n this.debug(\n `Preparing the Date runtime artifacts for the Powerlines project.`\n );\n\n let dateModule!: (context: DatePluginContext) => string;\n switch (this.config.date.type) {\n case \"dayjs\":\n dateModule = dayjsModule;\n break;\n case \"luxon\":\n dateModule = luxonModule;\n break;\n case \"moment\":\n dateModule = momentModule;\n break;\n case \"date-fns\":\n default:\n // Default to date-fns if no type is specified or if the type is not recognized\n dateModule = dateFnsModule;\n break;\n }\n\n await this.emitBuiltin(await Promise.resolve(dateModule(this)), \"date\");\n }\n }\n ] as Plugin<TContext>[];\n}\n\nexport default plugin;\n"],"x_google_ignoreList":[0],"mappings":"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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env/types/plugin";
|
|
2
|
+
|
|
3
|
+
//#region src/types/plugin.d.ts
|
|
4
|
+
type DateLibraryType = "date-fns" | "dayjs" | "luxon" | "moment";
|
|
5
|
+
interface DatePluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of date library to use
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This value is used to determine which date library to use for date manipulation. It can be one of the following:
|
|
11
|
+
* - [date-fns](https://date-fns.org/)
|
|
12
|
+
* - [dayjs](https://day.js.org/)
|
|
13
|
+
* - [luxon](https://moment.github.io/luxon/)
|
|
14
|
+
* - [moment](https://momentjs.com/)
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue "date-fns"
|
|
17
|
+
*/
|
|
18
|
+
type?: DateLibraryType;
|
|
19
|
+
/**
|
|
20
|
+
* Options for the Env plugin.
|
|
21
|
+
*/
|
|
22
|
+
env?: EnvPluginOptions;
|
|
23
|
+
}
|
|
24
|
+
interface DatePluginUserConfig extends EnvPluginUserConfig {
|
|
25
|
+
/**
|
|
26
|
+
* Options for the date plugin.
|
|
27
|
+
*/
|
|
28
|
+
date?: Omit<DatePluginOptions, "env">;
|
|
29
|
+
}
|
|
30
|
+
interface DatePluginResolvedConfig extends EnvPluginResolvedConfig {
|
|
31
|
+
/**
|
|
32
|
+
* Options for the date plugin.
|
|
33
|
+
*/
|
|
34
|
+
date: Required<Omit<DatePluginOptions, "env">>;
|
|
35
|
+
}
|
|
36
|
+
type DatePluginContext<TResolvedConfig extends DatePluginResolvedConfig = DatePluginResolvedConfig> = EnvPluginContext<TResolvedConfig>;
|
|
37
|
+
declare type __ΩDateLibraryType = any[];
|
|
38
|
+
declare type __ΩDatePluginOptions = any[];
|
|
39
|
+
declare type __ΩDatePluginUserConfig = any[];
|
|
40
|
+
declare type __ΩDatePluginResolvedConfig = any[];
|
|
41
|
+
declare type __ΩDatePluginContext = any[];
|
|
42
|
+
//#endregion
|
|
43
|
+
export { DatePluginUserConfig as a, __ΩDatePluginOptions as c, DatePluginResolvedConfig as i, __ΩDatePluginResolvedConfig as l, DatePluginContext as n, __ΩDateLibraryType as o, DatePluginOptions as r, __ΩDatePluginContext as s, DateLibraryType as t, __ΩDatePluginUserConfig as u };
|
|
44
|
+
//# sourceMappingURL=plugin-CWe-29nA.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-CWe-29nA.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;KAyBY,eAAA;UAEK,iBAAA;EAFL;AAEZ;AAqBA;;;;;AAOA;;;;;EAAyE,IAAA,CAAA,EAfhE,eAegE;EAO7D;;;EAES,GAAA,CAAA,EAnBb,gBAmBa;;AAAD,UAhBH,oBAAA,SAA6B,mBAgB1B,CAAA;;;;SAZX,KAAK;;UAGG,wBAAA,SAAiC;;;;QAI1C,SAAS,KAAK;;KAGV,0CACc,2BAA2B,4BACjD,iBAAiB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env/types/plugin";
|
|
2
|
+
|
|
3
|
+
//#region src/types/plugin.d.ts
|
|
4
|
+
type DateLibraryType = "date-fns" | "dayjs" | "luxon" | "moment";
|
|
5
|
+
interface DatePluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of date library to use
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This value is used to determine which date library to use for date manipulation. It can be one of the following:
|
|
11
|
+
* - [date-fns](https://date-fns.org/)
|
|
12
|
+
* - [dayjs](https://day.js.org/)
|
|
13
|
+
* - [luxon](https://moment.github.io/luxon/)
|
|
14
|
+
* - [moment](https://momentjs.com/)
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue "date-fns"
|
|
17
|
+
*/
|
|
18
|
+
type?: DateLibraryType;
|
|
19
|
+
/**
|
|
20
|
+
* Options for the Env plugin.
|
|
21
|
+
*/
|
|
22
|
+
env?: EnvPluginOptions;
|
|
23
|
+
}
|
|
24
|
+
interface DatePluginUserConfig extends EnvPluginUserConfig {
|
|
25
|
+
/**
|
|
26
|
+
* Options for the date plugin.
|
|
27
|
+
*/
|
|
28
|
+
date?: Omit<DatePluginOptions, "env">;
|
|
29
|
+
}
|
|
30
|
+
interface DatePluginResolvedConfig extends EnvPluginResolvedConfig {
|
|
31
|
+
/**
|
|
32
|
+
* Options for the date plugin.
|
|
33
|
+
*/
|
|
34
|
+
date: Required<Omit<DatePluginOptions, "env">>;
|
|
35
|
+
}
|
|
36
|
+
type DatePluginContext<TResolvedConfig extends DatePluginResolvedConfig = DatePluginResolvedConfig> = EnvPluginContext<TResolvedConfig>;
|
|
37
|
+
declare type __ΩDateLibraryType = any[];
|
|
38
|
+
declare type __ΩDatePluginOptions = any[];
|
|
39
|
+
declare type __ΩDatePluginUserConfig = any[];
|
|
40
|
+
declare type __ΩDatePluginResolvedConfig = any[];
|
|
41
|
+
declare type __ΩDatePluginContext = any[];
|
|
42
|
+
//#endregion
|
|
43
|
+
export { DatePluginUserConfig as a, __ΩDatePluginOptions as c, DatePluginResolvedConfig as i, __ΩDatePluginResolvedConfig as l, DatePluginContext as n, __ΩDateLibraryType as o, DatePluginOptions as r, __ΩDatePluginContext as s, DateLibraryType as t, __ΩDatePluginUserConfig as u };
|
|
44
|
+
//# sourceMappingURL=plugin-D82ijYIk.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-D82ijYIk.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;KAyBY,eAAA;UAEK,iBAAA;EAFL;AAEZ;AAqBA;;;;;AAOA;;;;;EAAyE,IAAA,CAAA,EAfhE,eAegE;EAO7D;;;EAES,GAAA,CAAA,EAnBb,gBAmBa;;AAAD,UAhBH,oBAAA,SAA6B,mBAgB1B,CAAA;;;;SAZX,KAAK;;UAGG,wBAAA,SAAiC;;;;QAI1C,SAAS,KAAK;;KAGV,0CACc,2BAA2B,4BACjD,iBAAiB"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|