diff --git a/.gitignore b/.gitignore index b0e806e..e2d5cff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .DS_Store -.claude/ -CLAUDE.md +.vscode/ cache/ coverage/ dist/ -node_modules/ \ No newline at end of file +node_modules/ diff --git a/docs/api/format.md b/docs/api/format.md index 032d535..c7be7ea 100644 --- a/docs/api/format.md +++ b/docs/api/format.md @@ -34,7 +34,7 @@ format(now, 'ddd, MMM DD YYYY'); // => Sat, Aug 23 2025 format(now, 'hh:mm A [GMT]Z'); -// => 02:30 PM GMT+0900 +// => 02:30 PM GMT-0700 ``` ## Format Tokens @@ -255,6 +255,35 @@ format(midnight, 'H:mm', { hour24: 'h24' }); // => 24:30 ``` +### plugins + +**Type**: `FormatterPlugin[]` +**Default**: `undefined` + +Enables additional format tokens provided by plugins. Plugins extend the formatter with special tokens that are not included in the core library. + +```typescript +import { format } from 'date-and-time'; +import { formatter as ordinal } from 'date-and-time/plugins/ordinal'; +import { formatter as zonename } from 'date-and-time/plugins/zonename'; + +const date = new Date(); + +// Use ordinal plugin +format(date, 'MMMM DDD, YYYY', { plugins: [ordinal] }); +// => August 23rd, 2025 + +// Use zonename plugin +format(date, 'YYYY-MM-DD HH:mm z', { plugins: [zonename] }); +// => 2025-08-23 14:30 PDT + +// Use multiple plugins together +format(date, 'MMMM DDD, YYYY h:mm A zz', { plugins: [ordinal, zonename] }); +// => August 23rd, 2025 2:30 PM Pacific Daylight Time +``` + +For a complete list of available plugins, see [Plugins](../plugins). + ## Advanced Usage ### Comments in Format Strings @@ -290,9 +319,9 @@ import Tokyo from 'date-and-time/timezones/Asia/Tokyo'; const date = new Date(); // Japanese with timezone -format(date, 'YYYY年MMMM月D日dddd Ah:mm:ss [GMT]Z', { - timeZone: Tokyo, - locale: ja +format(date, 'YYYY年MMMM月D日dddd Ah:mm:ss [GMT]Z', { + timeZone: Tokyo, + locale: ja }); // => 2025年8月23日土曜日 午後11:30:45 GMT+0900 ``` diff --git a/docs/api/parse.md b/docs/api/parse.md index 5f739e1..976516e 100644 --- a/docs/api/parse.md +++ b/docs/api/parse.md @@ -27,24 +27,24 @@ import { parse } from 'date-and-time'; // Basic date parsing parse('2025-08-23', 'YYYY-MM-DD'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 -parse('08/23/2025', 'MM/DD/YYYY'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +parse('08/23/2025', 'MM/DD/YYYY'); +// => Fri Aug 23 2025 00:00:00 GMT-0700 parse('23.08.2025', 'DD.MM.YYYY'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 // Time parsing parse('14:30:45', 'HH:mm:ss'); -// => Thu Jan 01 1970 14:30:45 GMT+0900 +// => Thu Jan 01 1970 14:30:45 GMT-0800 parse('2:30:45 PM', 'h:mm:ss A'); -// => Thu Jan 01 1970 14:30:45 GMT+0900 +// => Thu Jan 01 1970 14:30:45 GMT-0800 // Combined date and time parse('2025-08-23 14:30:45', 'YYYY-MM-DD HH:mm:ss'); -// => Fri Aug 23 2025 14:30:45 GMT+0900 +// => Fri Aug 23 2025 14:30:45 GMT-0700 ``` ## Format Tokens @@ -133,7 +133,7 @@ import es from 'date-and-time/locales/es'; // Spanish parsing parse('23 de agosto de 2025', 'D [de] MMMM [de] YYYY', { locale: es }); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 ``` For a complete list of all supported locales with import examples, see [Supported Locales](../locales). @@ -186,11 +186,11 @@ import beng from 'date-and-time/numerals/beng'; // Arabic-Indic numerals parse('٠٨/٠٧/٢٠٢٥', 'DD/MM/YYYY', { numeral: arab }); -// => Fri Aug 08 2025 00:00:00 GMT+0900 +// => Fri Aug 08 2025 00:00:00 GMT-0700 -// Bengali numerals +// Bengali numerals parse('০৮/০৭/২০২৫', 'DD/MM/YYYY', { numeral: beng }); -// => Fri Aug 08 2025 00:00:00 GMT+0900 +// => Fri Aug 08 2025 00:00:00 GMT-0700 ``` **Available numeral systems:** @@ -213,11 +213,11 @@ import { parse } from 'date-and-time'; // Gregorian calendar (default) parse('August 23, 2025', 'MMMM D, YYYY'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 // Buddhist calendar (543 years behind) parse('August 23, 2568', 'MMMM D, YYYY', { calendar: 'buddhist' }); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 ``` ### ignoreCase @@ -236,10 +236,10 @@ parse('august 23, 2025', 'MMMM D, YYYY'); // Case-insensitive parse('AUGUST 23, 2025', 'MMMM D, YYYY', { ignoreCase: true }); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 parse('fri aug 23 2025', 'ddd MMM DD YYYY', { ignoreCase: true }); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 ``` ### hour12 @@ -254,11 +254,11 @@ import { parse } from 'date-and-time'; // h12 format - midnight is 12 AM parse('12:30 AM', 'h:mm A', { hour12: 'h12' }); -// => Thu Jan 01 1970 00:30:00 GMT+0900 +// => Thu Jan 01 1970 00:30:00 GMT-0800 // h11 format - midnight is 0 AM parse('0:30 AM', 'h:mm A', { hour12: 'h11' }); -// => Thu Jan 01 1970 00:30:00 GMT+0900 +// => Thu Jan 01 1970 00:30:00 GMT-0800 ``` ### hour24 @@ -273,13 +273,47 @@ import { parse } from 'date-and-time'; // h23 format - midnight is 0 parse('0:30', 'H:mm', { hour24: 'h23' }); -// => Thu Jan 01 1970 00:30:00 GMT+0900 +// => Thu Jan 01 1970 00:30:00 GMT-0800 // h24 format - midnight is 24 (of previous day) parse('24:30', 'H:mm', { hour24: 'h24' }); -// => Thu Jan 01 1970 00:30:00 GMT+0900 +// => Thu Jan 01 1970 00:30:00 GMT-0800 ``` +### plugins + +**Type**: `ParserPlugin[]` +**Default**: `undefined` + +Enables additional parse tokens provided by plugins. Plugins extend the parser with special tokens that are not included in the core library. + +```typescript +import { parse } from 'date-and-time'; +import { parser as ordinal } from 'date-and-time/plugins/ordinal'; +import { parser as two_digit_year } from 'date-and-time/plugins/two-digit-year'; +import { parser as microsecond } from 'date-and-time/plugins/microsecond'; + +// Use ordinal plugin +parse('January 1st, 2025', 'MMMM DDD, YYYY', { plugins: [ordinal] }); +// => Wed Jan 01 2025 00:00:00 GMT-0800 + +// Use two-digit-year plugin +parse('12/25/99', 'MM/DD/YY', { plugins: [two_digit_year] }); +// => Sat Dec 25 1999 00:00:00 GMT-0800 + +// Use microsecond plugin +parse('14:30:45.123456', 'HH:mm:ss.SSSSSS', { plugins: [microsecond] }); +// => Thu Jan 01 1970 14:30:45 GMT-0800 + +// Use multiple plugins together +parse('January 1st, 99 14:30:45.123456', 'MMMM DDD, YY HH:mm:ss.SSSSSS', { + plugins: [ordinal, two_digit_year, microsecond] +}); +// => Fri Jan 01 1999 14:30:45 GMT-0800 +``` + +For a complete list of available plugins, see [Plugins](../plugins). + ## Parsing Behavior and Limitations ### Default Date and Time Values @@ -291,19 +325,19 @@ import { parse } from 'date-and-time'; // Only time - defaults to Jan 1, 1970 parse('14:30:45', 'HH:mm:ss'); -// => Thu Jan 01 1970 14:30:45 GMT+0900 +// => Thu Jan 01 1970 14:30:45 GMT-0800 // Only date - defaults to 00:00:00 parse('2025-08-23', 'YYYY-MM-DD'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Fri Aug 23 2025 00:00:00 GMT-0700 // Year and month - defaults to 1st day parse('2025-08', 'YYYY-MM'); -// => Mon Aug 01 2025 00:00:00 GMT+0900 +// => Fri Aug 01 2025 00:00:00 GMT-0700 // Just year - defaults to Jan 1st, 00:00:00 parse('2025', 'YYYY'); -// => Wed Jan 01 2025 00:00:00 GMT+0900 +// => Wed Jan 01 2025 00:00:00 GMT-0800 ``` ### Date Range Limitations @@ -315,7 +349,7 @@ import { parse } from 'date-and-time'; // Valid maximum date parse('Dec 31 9999', 'MMM D YYYY'); -// => Dec 31 9999 00:00:00 GMT+0900 +// => Fri Dec 31 9999 00:00:00 GMT-0800 // Invalid - exceeds maximum parse('Dec 31 10000', 'MMM D YYYY'); @@ -323,7 +357,7 @@ parse('Dec 31 10000', 'MMM D YYYY'); // Valid minimum date parse('Jan 1 0001', 'MMM D YYYY'); -// => Jan 1 0001 00:00:00 GMT+0900 +// => Mon Jan 1 0001 00:00:00 GMT-0800 // Invalid - below minimum parse('Jan 1 0000', 'MMM D YYYY'); @@ -339,7 +373,7 @@ import { parse } from 'date-and-time'; // Parsed as local timezone parse('14:30:45', 'HH:mm:ss'); -// => Thu Jan 01 1970 14:30:45 GMT+0900 +// => Thu Jan 01 1970 14:30:45 GMT-0800 // Timezone offset in input takes precedence parse('14:30:45 +0000', 'HH:mm:ss Z'); @@ -359,11 +393,11 @@ import { parse } from 'date-and-time'; // Without meridiem - ambiguous time parse('11:30:45', 'h:mm:ss'); -// => Thu Jan 01 1970 11:30:45 GMT+0900 (assumes AM) +// => Thu Jan 01 1970 11:30:45 GMT-0800 (assumes AM) // With meridiem - unambiguous time parse('11:30:45 PM', 'h:mm:ss A'); -// => Thu Jan 01 1970 23:30:45 GMT+0900 +// => Thu Jan 01 1970 23:30:45 GMT-0800 ``` ## Advanced Usage @@ -376,17 +410,17 @@ Parts of the format string enclosed in square brackets are treated as literal te import { parse } from 'date-and-time'; parse('Today is Saturday, August 23, 2025', '[Today is] dddd, MMMM D, YYYY'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Sat Aug 23 2025 00:00:00 GMT-0700 parse('2025-08-23T14:30:45Z', 'YYYY-MM-DD[T]HH:mm:ss[Z]'); -// => Fri Aug 23 2025 14:30:45 GMT+0900 +// => Sat Aug 23 2025 14:30:45 GMT-0700 parse('Report generated on 2025/08/23 at 14:30', '[Report generated on] YYYY/MM/DD [at] HH:mm'); -// => Fri Aug 23 2025 14:30:00 GMT+0900 +// => Sat Aug 23 2025 14:30:00 GMT-0700 // Escape square brackets to parse them from input string parse('[2025-08-23 14:30:45]', '\\[YYYY-MM-DD HH:mm:ss\\]'); -// => Fri Aug 23 2025 14:30:45 GMT+0900 +// => Sat Aug 23 2025 14:30:45 GMT-0700 ``` ### Wildcard Parsing @@ -402,7 +436,7 @@ parse('2025/08/23 14:30:45', 'YYYY/MM/DD'); // Use whitespace as wildcard (9 spaces to match ' 14:30:45') parse('2025/08/23 14:30:45', 'YYYY/MM/DD '); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Sat Aug 23 2025 00:00:00 GMT-0700 ``` ### Ellipsis Token @@ -414,11 +448,11 @@ import { parse } from 'date-and-time'; // Ignore everything after the date parse('2025/08/23 14:30:45', 'YYYY/MM/DD...'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Sat Aug 23 2025 00:00:00 GMT-0700 // More complex example parse('Log entry: 2025-08-23 some extra data here', '[Log entry: ]YYYY-MM-DD...'); -// => Fri Aug 23 2025 00:00:00 GMT+0900 +// => Sat Aug 23 2025 00:00:00 GMT-0700 ``` ### Complex Localized Parsing @@ -445,13 +479,13 @@ import { parse } from 'date-and-time'; parse('2025-08-23T14:30:45.123Z', 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]', { timeZone: 'UTC' }); // => Fri Aug 23 2025 14:30:45 GMT+0000 -// RFC 2822 format +// RFC 2822 format parse('Sat, 23 Aug 2025 14:30:45 +0900', 'ddd, DD MMM YYYY HH:mm:ss ZZ'); -// => Fri Aug 23 2025 14:30:45 GMT+0900 +// => Sat Aug 23 2025 14:30:45 GMT+0900 // File naming format parse('20250823_143045', 'YYYYMMDD_HHmmss'); -// => Fri Aug 23 2025 14:30:45 GMT+0900 +// => Sat Aug 23 2025 14:30:45 GMT-0700 ``` ## Error Handling @@ -508,12 +542,12 @@ import { parse } from 'date-and-time'; const logLine = '[2025-08-23 14:30:45.123] Application started'; const timestamp = parse(logLine, ' YYYY-MM-DD HH:mm:ss.SSS ...'); -// => Fri Aug 23 2025 14:30:45 GMT+0900 +// => Sat Aug 23 2025 14:30:45 GMT-0700 // For different log formats const syslogLine = 'Aug 23 14:30:45 server: Process started'; const syslogTimestamp = parse(syslogLine, 'MMM DD HH:mm:ss...'); -// => Fri Aug 23 1970 14:30:45 GMT+0900 +// => Sat Aug 23 1970 14:30:45 GMT-0700 ``` ### API Responses diff --git a/eslint.config.js b/eslint.config.js index c06e837..1a6a6e1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,12 +1,20 @@ -// @ts-check import { defineConfig } from 'eslint/config'; +import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; +import stylistic from '@stylistic/eslint-plugin'; export default defineConfig( - tseslint.configs.strict, - tseslint.configs.stylistic, + eslint.configs.recommended, + tseslint.configs.strictTypeChecked, + tseslint.configs.stylisticTypeChecked, + { + ignores: ["**/*.js", "coverage", "dist", "docs"] + }, { files: ['**/*.ts'], + plugins: { + '@stylistic': stylistic + }, languageOptions: { ecmaVersion: 2021, sourceType: 'module', @@ -14,97 +22,34 @@ export default defineConfig( process: true }, parserOptions: { - project: './tsconfig.json', - tsconfigRootDir: import.meta.dirname + projectService: true } }, rules: { '@typescript-eslint/no-extraneous-class': 'off', - '@typescript-eslint/no-unused-vars': ['error', { 'caughtErrors': 'none' }], - '@typescript-eslint/unified-signatures': ['error', { 'ignoreDifferentlyNamedParameters': true }], - 'array-bracket-spacing': ['warn', 'never'], - 'array-callback-return': 'error', - 'constructor-super': 'error', - 'for-direction': 'error', - 'getter-return': 'error', - 'no-async-promise-executor': 'error', - 'no-class-assign': 'error', - 'no-compare-neg-zero': 'error', - 'no-cond-assign': 'error', - 'no-const-assign': 'error', - 'no-constant-binary-expression': 'error', - 'no-constant-condition': 'error', - 'no-constructor-return': 'error', - 'no-control-regex': 'error', - 'no-debugger': 'error', - 'no-dupe-args': 'error', - 'no-dupe-class-members': 'error', - 'no-dupe-else-if': 'error', - 'no-dupe-keys': 'error', - 'no-duplicate-case': 'error', - 'no-empty-character-class': 'error', - 'no-empty-pattern': 'error', - 'no-ex-assign': 'error', - 'no-fallthrough': 'error', - 'no-func-assign': 'error', - 'no-import-assign': 'error', - 'no-inner-declarations': 'error', - 'no-invalid-regexp': 'error', - 'no-irregular-whitespace': 'error', - 'no-loss-of-precision': 'error', - 'no-misleading-character-class': 'error', - 'no-new-native-nonconstructor': 'error', - 'no-new-symbol': 'error', - 'no-obj-calls': 'error', - 'no-self-assign': 'error', - 'no-self-compare': 'error', - 'no-setter-return': 'error', - 'no-sparse-arrays': 'error', - 'no-template-curly-in-string': 'error', - 'no-this-before-super': 'error', - 'no-undef': 'error', - 'no-unexpected-multiline': 'error', - 'no-unmodified-loop-condition': 'error', - 'no-unreachable': 'error', - 'no-unreachable-loop': 'error', - 'no-unsafe-finally': 'error', - 'no-unsafe-negation': 'error', - 'no-unsafe-optional-chaining': 'error', - 'no-unused-private-class-members': 'error', - 'no-use-before-define': 'error', - 'no-useless-backreference': 'error', - 'require-atomic-updates': 'error', - 'use-isnan': 'error', - 'valid-typeof': 'error', + 'accessor-pairs': 'error', + 'array-callback-return': 'error', 'block-scoped-var': 'error', 'consistent-return': 'error', 'curly': 'error', 'default-case-last': 'error', - 'dot-notation': 'error', 'eqeqeq': ['error', 'smart'], 'func-name-matching': 'error', - 'func-style': ['error', 'expression', { 'overrides': { 'namedExports': 'ignore' } }], + 'func-style': ['error', 'expression', { overrides: { namedExports: 'ignore' } }], 'grouped-accessor-pairs': 'error', - 'id-denylist': 'error', - 'id-match': 'error', 'max-depth': 'error', 'max-nested-callbacks': 'error', 'new-cap': 'error', - 'no-array-constructor': 'error', 'no-caller': 'error', - 'no-delete-var': 'error', + 'no-constructor-return': 'error', 'no-div-regex': 'error', 'no-else-return': 'error', 'no-empty-static-block': 'error', 'no-eval': 'error', 'no-extend-native': 'error', 'no-extra-bind': 'error', - 'no-extra-boolean-cast': 'error', 'no-extra-label': 'error', - 'no-extra-semi': 'error', - 'no-floating-decimal': 'error', - 'no-global-assign': 'error', 'no-implicit-globals': 'error', 'no-implied-eval': 'error', 'no-iterator': 'error', @@ -112,103 +57,93 @@ export default defineConfig( 'no-labels': 'error', 'no-lone-blocks': 'error', 'no-lonely-if': 'error', - 'no-loop-func': 'error', - 'no-multi-assign': ['error', { 'ignoreNonDeclaration': true }], + 'no-multi-assign': ['error', { ignoreNonDeclaration: true }], 'no-multi-str': 'error', 'no-negated-condition': 'error', 'no-new': 'error', 'no-new-func': 'error', - 'no-new-object': 'error', 'no-new-wrappers': 'error', - 'no-nonoctal-decimal-escape': 'error', - 'no-octal': 'error', + 'no-object-constructor': 'error', 'no-octal-escape': 'error', 'no-proto': 'error', - 'no-regex-spaces': 'error', - 'no-restricted-exports': 'error', - 'no-restricted-globals': 'error', - 'no-restricted-imports': 'error', - 'no-restricted-properties': 'error', - 'no-restricted-syntax': 'error', 'no-return-assign': 'error', - 'no-return-await': 'error', 'no-script-url': 'error', + 'no-self-compare': 'error', 'no-sequences': 'error', - 'no-shadow': 'error', 'no-shadow-restricted-names': 'error', - 'no-throw-literal': 'error', + 'no-template-curly-in-string': 'error', 'no-undef-init': 'error', + 'no-unmodified-loop-condition': 'error', 'no-unneeded-ternary': 'error', - 'no-unused-expressions': 'error', - 'no-unused-labels': 'error', + 'no-unreachable-loop': 'error', 'no-useless-call': 'error', - 'no-useless-catch': 'error', 'no-useless-computed-key': 'error', 'no-useless-concat': 'error', - 'no-useless-escape': 'error', 'no-useless-rename': 'error', 'no-useless-return': 'error', 'no-void': 'error', - 'no-warning-comments': 'warn', - 'no-with': 'error', + 'no-warning-comments': 'error', 'operator-assignment': 'error', - 'prefer-const': 'error', 'prefer-exponentiation-operator': 'error', 'prefer-numeric-literals': 'error', 'prefer-object-has-own': 'error', 'prefer-object-spread': 'error', - 'prefer-promise-reject-errors': ['error', { 'allowEmptyReject': true }], + 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], 'prefer-regex-literals': 'error', 'prefer-rest-params': 'error', 'prefer-spread': 'error', 'radix': 'error', - 'require-await': 'error', - 'require-yield': 'error', + 'require-atomic-updates': 'error', 'symbol-description': 'error', + 'unicode-bom': 'error', 'yoda': 'error', - 'arrow-spacing': 'warn', - 'block-spacing': 'warn', - 'comma-dangle': 'warn', - 'comma-spacing': 'warn', - 'comma-style': 'warn', - 'computed-property-spacing': 'warn', - 'dot-location': ['warn', 'property'], - 'eol-last': 'warn', - 'func-call-spacing': 'warn', - 'generator-star-spacing': 'warn', - 'implicit-arrow-linebreak': 'warn', - 'indent': ['warn', 2, { 'ignoreComments': true }], - 'jsx-quotes': 'warn', - 'key-spacing': 'warn', - 'keyword-spacing': 'warn', - 'linebreak-style': 'warn', - 'lines-between-class-members': 'warn', - 'new-parens': 'warn', - 'no-extra-parens': ['warn', 'functions'], - 'no-mixed-spaces-and-tabs': 'warn', - 'no-multi-spaces': ['warn', { 'ignoreEOLComments': true }], - 'no-tabs': 'warn', - 'no-trailing-spaces': 'warn', - 'no-whitespace-before-property': 'warn', - 'nonblock-statement-body-position': 'warn', - 'object-curly-newline': 'warn', - 'object-curly-spacing': ['warn', 'always'], - 'padding-line-between-statements': 'warn', - 'quotes': ['warn', 'single'], - 'rest-spread-spacing': 'warn', - 'semi': 'warn', - 'semi-spacing': 'warn', - 'semi-style': 'warn', - 'space-before-blocks': 'warn', - 'space-in-parens': 'warn', - 'space-infix-ops': 'warn', - 'space-unary-ops': 'warn', - 'switch-colon-spacing': 'warn', - 'template-curly-spacing': 'warn', - 'template-tag-spacing': 'warn', - 'unicode-bom': 'warn', - 'wrap-iife': ['warn', 'any'], - 'yield-star-spacing': 'warn' + + '@stylistic/array-bracket-spacing': ['warn', 'never'], + '@stylistic/arrow-spacing': 'warn', + '@stylistic/block-spacing': 'warn', + '@stylistic/comma-dangle': 'warn', + '@stylistic/comma-spacing': 'warn', + '@stylistic/comma-style': 'warn', + '@stylistic/computed-property-spacing': 'warn', + '@stylistic/dot-location': ['warn', 'property'], + '@stylistic/eol-last': 'warn', + '@stylistic/function-call-spacing': 'warn', + '@stylistic/generator-star-spacing': 'warn', + '@stylistic/implicit-arrow-linebreak': 'warn', + '@stylistic/indent': ['warn', 2, { ignoreComments: true }], + '@stylistic/jsx-quotes': 'warn', + '@stylistic/key-spacing': 'warn', + '@stylistic/keyword-spacing': 'warn', + '@stylistic/linebreak-style': 'warn', + '@stylistic/lines-between-class-members': 'warn', + '@stylistic/member-delimiter-style': ['warn', { multiline: { delimiter: 'semi', requireLast: true }, singleline: { delimiter: 'semi', requireLast: false } }], + '@stylistic/new-parens': 'warn', + '@stylistic/no-extra-parens': ['warn', 'functions'], + '@stylistic/no-extra-semi': 'warn', + '@stylistic/no-floating-decimal': 'warn', + '@stylistic/no-mixed-spaces-and-tabs': 'warn', + '@stylistic/no-multi-spaces': ['warn', { ignoreEOLComments: true }], + '@stylistic/no-tabs': 'warn', + '@stylistic/no-trailing-spaces': 'warn', + '@stylistic/no-whitespace-before-property': 'warn', + '@stylistic/nonblock-statement-body-position': 'warn', + '@stylistic/object-curly-newline': 'warn', + '@stylistic/object-curly-spacing': ['warn', 'always'], + '@stylistic/padding-line-between-statements': 'warn', + '@stylistic/quotes': ['warn', 'single'], + '@stylistic/rest-spread-spacing': 'warn', + '@stylistic/semi': 'warn', + '@stylistic/semi-spacing': 'warn', + '@stylistic/semi-style': 'warn', + '@stylistic/space-before-blocks': 'warn', + '@stylistic/space-in-parens': 'warn', + '@stylistic/space-infix-ops': 'warn', + '@stylistic/space-unary-ops': 'warn', + '@stylistic/switch-colon-spacing': 'warn', + '@stylistic/template-curly-spacing': 'warn', + '@stylistic/template-tag-spacing': 'warn', + '@stylistic/wrap-iife': ['warn', 'any'], + '@stylistic/yield-star-spacing': 'warn' } } ); diff --git a/package-lock.json b/package-lock.json index ae5a4ef..f0e5fec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,27 +1,30 @@ { "name": "date-and-time", - "version": "4.1.1", + "version": "4.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "date-and-time", - "version": "4.1.1", + "version": "4.1.2", "license": "MIT", "devDependencies": { + "@eslint/js": "^9.39.2", + "@rollup/plugin-alias": "^6.0.0", "@rollup/plugin-terser": "^0.4.4", - "@types/node": "^24.10.1", - "@vitest/coverage-v8": "^4.0.9", - "eslint": "^9.39.1", - "glob": "^11.0.3", - "prettier": "^3.6.2", - "rollup": "^4.53.2", - "rollup-plugin-dts": "^6.2.3", + "@stylistic/eslint-plugin": "^5.6.1", + "@types/node": "^25.0.2", + "@vitest/coverage-v8": "^4.0.15", + "eslint": "^9.39.2", + "glob": "^13.0.0", + "prettier": "^3.7.4", + "rollup": "^4.53.3", + "rollup-plugin-dts": "^6.3.0", "rollup-plugin-esbuild": "^6.2.1", - "tsx": "^4.20.6", - "typescript-eslint": "^8.46.4", + "tsx": "^4.21.0", + "typescript-eslint": "^8.49.0", "vitepress": "^1.6.4", - "vitest": "^4.0.9" + "vitest": "^4.0.15" }, "engines": { "node": ">=18" @@ -164,7 +167,6 @@ "version": "5.36.0", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@algolia/client-common": "5.36.0", "@algolia/requester-browser-xhr": "5.36.0", @@ -924,9 +926,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.39.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", - "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz", + "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==", "dev": true, "license": "MIT", "engines": { @@ -1050,22 +1052,6 @@ "node": "20 || >=22" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "dev": true, @@ -1106,42 +1092,22 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "node_modules/@rollup/plugin-alias": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-6.0.0.tgz", + "integrity": "sha512-tPCzJOtS7uuVZd+xPhoy5W4vThe6KWXNmsFCNktaAh5RTqcLiSfT4huPQIXkgJ6YCOjJHvecOAzQxLFhPxKr+g==", "dev": true, "license": "MIT", "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" + "node": ">=20.19.0" }, - "engines": { - "node": ">= 8" + "peerDependencies": { + "rollup": ">=4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, "node_modules/@rollup/plugin-terser": { @@ -1168,9 +1134,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.2.tgz", - "integrity": "sha512-yDPzwsgiFO26RJA4nZo8I+xqzh7sJTZIWQOxn+/XOdPE31lAvLIYCKqjV+lNH/vxE2L2iH3plKxDCRK6i+CwhA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", + "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", "cpu": [ "arm" ], @@ -1182,9 +1148,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.2.tgz", - "integrity": "sha512-k8FontTxIE7b0/OGKeSN5B6j25EuppBcWM33Z19JoVT7UTXFSo3D9CdU39wGTeb29NO3XxpMNauh09B+Ibw+9g==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", + "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", "cpu": [ "arm64" ], @@ -1196,9 +1162,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.2.tgz", - "integrity": "sha512-A6s4gJpomNBtJ2yioj8bflM2oogDwzUiMl2yNJ2v9E7++sHrSrsQ29fOfn5DM/iCzpWcebNYEdXpaK4tr2RhfQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", + "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", "cpu": [ "arm64" ], @@ -1210,9 +1176,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.2.tgz", - "integrity": "sha512-e6XqVmXlHrBlG56obu9gDRPW3O3hLxpwHpLsBJvuI8qqnsrtSZ9ERoWUXtPOkY8c78WghyPHZdmPhHLWNdAGEw==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", + "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", "cpu": [ "x64" ], @@ -1224,9 +1190,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.2.tgz", - "integrity": "sha512-v0E9lJW8VsrwPux5Qe5CwmH/CF/2mQs6xU1MF3nmUxmZUCHazCjLgYvToOk+YuuUqLQBio1qkkREhxhc656ViA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", + "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", "cpu": [ "arm64" ], @@ -1238,9 +1204,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.2.tgz", - "integrity": "sha512-ClAmAPx3ZCHtp6ysl4XEhWU69GUB1D+s7G9YjHGhIGCSrsg00nEGRRZHmINYxkdoJehde8VIsDC5t9C0gb6yqA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", + "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", "cpu": [ "x64" ], @@ -1252,9 +1218,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.2.tgz", - "integrity": "sha512-EPlb95nUsz6Dd9Qy13fI5kUPXNSljaG9FiJ4YUGU1O/Q77i5DYFW5KR8g1OzTcdZUqQQ1KdDqsTohdFVwCwjqg==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", + "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", "cpu": [ "arm" ], @@ -1266,9 +1232,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.2.tgz", - "integrity": "sha512-BOmnVW+khAUX+YZvNfa0tGTEMVVEerOxN0pDk2E6N6DsEIa2Ctj48FOMfNDdrwinocKaC7YXUZ1pHlKpnkja/Q==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", + "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", "cpu": [ "arm" ], @@ -1280,9 +1246,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.2.tgz", - "integrity": "sha512-Xt2byDZ+6OVNuREgBXr4+CZDJtrVso5woFtpKdGPhpTPHcNG7D8YXeQzpNbFRxzTVqJf7kvPMCub/pcGUWgBjA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", + "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", "cpu": [ "arm64" ], @@ -1294,9 +1260,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.2.tgz", - "integrity": "sha512-+LdZSldy/I9N8+klim/Y1HsKbJ3BbInHav5qE9Iy77dtHC/pibw1SR/fXlWyAk0ThnpRKoODwnAuSjqxFRDHUQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", + "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", "cpu": [ "arm64" ], @@ -1308,9 +1274,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.2.tgz", - "integrity": "sha512-8ms8sjmyc1jWJS6WdNSA23rEfdjWB30LH8Wqj0Cqvv7qSHnvw6kgMMXRdop6hkmGPlyYBdRPkjJnj3KCUHV/uQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", + "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", "cpu": [ "loong64" ], @@ -1322,9 +1288,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.2.tgz", - "integrity": "sha512-3HRQLUQbpBDMmzoxPJYd3W6vrVHOo2cVW8RUo87Xz0JPJcBLBr5kZ1pGcQAhdZgX9VV7NbGNipah1omKKe23/g==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", + "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", "cpu": [ "ppc64" ], @@ -1336,9 +1302,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.2.tgz", - "integrity": "sha512-fMjKi+ojnmIvhk34gZP94vjogXNNUKMEYs+EDaB/5TG/wUkoeua7p7VCHnE6T2Tx+iaghAqQX8teQzcvrYpaQA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", + "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", "cpu": [ "riscv64" ], @@ -1350,9 +1316,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.2.tgz", - "integrity": "sha512-XuGFGU+VwUUV5kLvoAdi0Wz5Xbh2SrjIxCtZj6Wq8MDp4bflb/+ThZsVxokM7n0pcbkEr2h5/pzqzDYI7cCgLQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", + "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", "cpu": [ "riscv64" ], @@ -1364,9 +1330,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.2.tgz", - "integrity": "sha512-w6yjZF0P+NGzWR3AXWX9zc0DNEGdtvykB03uhonSHMRa+oWA6novflo2WaJr6JZakG2ucsyb+rvhrKac6NIy+w==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", + "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", "cpu": [ "s390x" ], @@ -1378,9 +1344,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.2.tgz", - "integrity": "sha512-yo8d6tdfdeBArzC7T/PnHd7OypfI9cbuZzPnzLJIyKYFhAQ8SvlkKtKBMbXDxe1h03Rcr7u++nFS7tqXz87Gtw==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz", + "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==", "cpu": [ "x64" ], @@ -1392,9 +1358,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.2.tgz", - "integrity": "sha512-ah59c1YkCxKExPP8O9PwOvs+XRLKwh/mV+3YdKqQ5AMQ0r4M4ZDuOrpWkUaqO7fzAHdINzV9tEVu8vNw48z0lA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz", + "integrity": "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==", "cpu": [ "x64" ], @@ -1406,9 +1372,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.2.tgz", - "integrity": "sha512-4VEd19Wmhr+Zy7hbUsFZ6YXEiP48hE//KPLCSVNY5RMGX2/7HZ+QkN55a3atM1C/BZCGIgqN+xrVgtdak2S9+A==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", + "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", "cpu": [ "arm64" ], @@ -1420,9 +1386,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.2.tgz", - "integrity": "sha512-IlbHFYc/pQCgew/d5fslcy1KEaYVCJ44G8pajugd8VoOEI8ODhtb/j8XMhLpwHCMB3yk2J07ctup10gpw2nyMA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", + "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", "cpu": [ "arm64" ], @@ -1434,9 +1400,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.2.tgz", - "integrity": "sha512-lNlPEGgdUfSzdCWU176ku/dQRnA7W+Gp8d+cWv73jYrb8uT7HTVVxq62DUYxjbaByuf1Yk0RIIAbDzp+CnOTFg==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", + "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", "cpu": [ "ia32" ], @@ -1448,9 +1414,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.2.tgz", - "integrity": "sha512-S6YojNVrHybQis2lYov1sd+uj7K0Q05NxHcGktuMMdIQ2VixGwAfbJ23NnlvvVV1bdpR2m5MsNBViHJKcA4ADw==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", + "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", "cpu": [ "x64" ], @@ -1462,9 +1428,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.2.tgz", - "integrity": "sha512-k+/Rkcyx//P6fetPoLMb8pBeqJBNGx81uuf7iljX9++yNBVRDQgD04L+SVXmXmh5ZP4/WOp4mWF0kmi06PW2tA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", + "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", "cpu": [ "x64" ], @@ -1553,6 +1519,27 @@ "dev": true, "license": "MIT" }, + "node_modules/@stylistic/eslint-plugin": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-5.6.1.tgz", + "integrity": "sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.0", + "@typescript-eslint/types": "^8.47.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "estraverse": "^5.3.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=9.0.0" + } + }, "node_modules/@types/chai": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", @@ -1619,12 +1606,11 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", - "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "version": "25.0.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.2.tgz", + "integrity": "sha512-gWEkeiyYE4vqjON/+Obqcoeffmk0NF15WSBwSs7zwVA2bAbTaE0SJ7P0WNGoJn8uE7fiaV5a7dKYIJriEqOrmA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -1640,18 +1626,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.46.4.tgz", - "integrity": "sha512-R48VhmTJqplNyDxCyqqVkFSZIx1qX6PzwqgcXn1olLrzxcSBDlOsbtcnQuQhNtnNiJ4Xe5gREI1foajYaYU2Vg==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.49.0.tgz", + "integrity": "sha512-JXij0vzIaTtCwu6SxTh8qBc66kmf1xs7pI4UOiMDFVct6q86G0Zs7KRcEoJgY3Cav3x5Tq0MF5jwgpgLqgKG3A==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.46.4", - "@typescript-eslint/type-utils": "8.46.4", - "@typescript-eslint/utils": "8.46.4", - "@typescript-eslint/visitor-keys": "8.46.4", - "graphemer": "^1.4.0", + "@typescript-eslint/scope-manager": "8.49.0", + "@typescript-eslint/type-utils": "8.49.0", + "@typescript-eslint/utils": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" @@ -1664,7 +1649,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.46.4", + "@typescript-eslint/parser": "^8.49.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } @@ -1680,17 +1665,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.46.4.tgz", - "integrity": "sha512-tK3GPFWbirvNgsNKto+UmB/cRtn6TZfyw0D6IKrW55n6Vbs7KJoZtI//kpTKzE/DUmmnAFD8/Ca46s7Obs92/w==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.49.0.tgz", + "integrity": "sha512-N9lBGA9o9aqb1hVMc9hzySbhKibHmB+N3IpoShyV6HyQYRGIhlrO5rQgttypi+yEeKsKI4idxC8Jw6gXKD4THA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.46.4", - "@typescript-eslint/types": "8.46.4", - "@typescript-eslint/typescript-estree": "8.46.4", - "@typescript-eslint/visitor-keys": "8.46.4", + "@typescript-eslint/scope-manager": "8.49.0", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0", "debug": "^4.3.4" }, "engines": { @@ -1706,14 +1690,14 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.46.4.tgz", - "integrity": "sha512-nPiRSKuvtTN+no/2N1kt2tUh/HoFzeEgOm9fQ6XQk4/ApGqjx0zFIIaLJ6wooR1HIoozvj2j6vTi/1fgAz7UYQ==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.49.0.tgz", + "integrity": "sha512-/wJN0/DKkmRUMXjZUXYZpD1NEQzQAAn9QWfGwo+Ai8gnzqH7tvqS7oNVdTjKqOcPyVIdZdyCMoqN66Ia789e7g==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.46.4", - "@typescript-eslint/types": "^8.46.4", + "@typescript-eslint/tsconfig-utils": "^8.49.0", + "@typescript-eslint/types": "^8.49.0", "debug": "^4.3.4" }, "engines": { @@ -1728,14 +1712,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.46.4.tgz", - "integrity": "sha512-tMDbLGXb1wC+McN1M6QeDx7P7c0UWO5z9CXqp7J8E+xGcJuUuevWKxuG8j41FoweS3+L41SkyKKkia16jpX7CA==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.49.0.tgz", + "integrity": "sha512-npgS3zi+/30KSOkXNs0LQXtsg9ekZ8OISAOLGWA/ZOEn0ZH74Ginfl7foziV8DT+D98WfQ5Kopwqb/PZOaIJGg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.46.4", - "@typescript-eslint/visitor-keys": "8.46.4" + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1746,9 +1730,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.46.4.tgz", - "integrity": "sha512-+/XqaZPIAk6Cjg7NWgSGe27X4zMGqrFqZ8atJsX3CWxH/jACqWnrWI68h7nHQld0y+k9eTTjb9r+KU4twLoo9A==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.49.0.tgz", + "integrity": "sha512-8prixNi1/6nawsRYxet4YOhnbW+W9FK/bQPxsGB1D3ZrDzbJ5FXw5XmzxZv82X3B+ZccuSxo/X8q9nQ+mFecWA==", "dev": true, "license": "MIT", "engines": { @@ -1763,15 +1747,15 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.46.4.tgz", - "integrity": "sha512-V4QC8h3fdT5Wro6vANk6eojqfbv5bpwHuMsBcJUJkqs2z5XnYhJzyz9Y02eUmF9u3PgXEUiOt4w4KHR3P+z0PQ==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.49.0.tgz", + "integrity": "sha512-KTExJfQ+svY8I10P4HdxKzWsvtVnsuCifU5MvXrRwoP2KOlNZ9ADNEWWsQTJgMxLzS5VLQKDjkCT/YzgsnqmZg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.46.4", - "@typescript-eslint/typescript-estree": "8.46.4", - "@typescript-eslint/utils": "8.46.4", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0", + "@typescript-eslint/utils": "8.49.0", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, @@ -1788,9 +1772,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.46.4.tgz", - "integrity": "sha512-USjyxm3gQEePdUwJBFjjGNG18xY9A2grDVGuk7/9AkjIF1L+ZrVnwR5VAU5JXtUnBL/Nwt3H31KlRDaksnM7/w==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.49.0.tgz", + "integrity": "sha512-e9k/fneezorUo6WShlQpMxXh8/8wfyc+biu6tnAqA81oWrEic0k21RHzP9uqqpyBBeBKu4T+Bsjy9/b8u7obXQ==", "dev": true, "license": "MIT", "engines": { @@ -1802,21 +1786,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.46.4.tgz", - "integrity": "sha512-7oV2qEOr1d4NWNmpXLR35LvCfOkTNymY9oyW+lUHkmCno7aOmIf/hMaydnJBUTBMRCOGZh8YjkFOc8dadEoNGA==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.49.0.tgz", + "integrity": "sha512-jrLdRuAbPfPIdYNppHJ/D0wN+wwNfJ32YTAm10eJVsFmrVpXQnDWBn8niCSMlWjvml8jsce5E/O+86IQtTbJWA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.46.4", - "@typescript-eslint/tsconfig-utils": "8.46.4", - "@typescript-eslint/types": "8.46.4", - "@typescript-eslint/visitor-keys": "8.46.4", + "@typescript-eslint/project-service": "8.49.0", + "@typescript-eslint/tsconfig-utils": "8.49.0", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0", "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", + "tinyglobby": "^0.2.15", "ts-api-utils": "^2.1.0" }, "engines": { @@ -1857,16 +1840,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.46.4.tgz", - "integrity": "sha512-AbSv11fklGXV6T28dp2Me04Uw90R2iJ30g2bgLz529Koehrmkbs1r7paFqr1vPCZi7hHwYxYtxfyQMRC8QaVSg==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.49.0.tgz", + "integrity": "sha512-N3W7rJw7Rw+z1tRsHZbK395TWSYvufBXumYtEGzypgMUthlg0/hmCImeA8hgO2d2G4pd7ftpxxul2J8OdtdaFA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.46.4", - "@typescript-eslint/types": "8.46.4", - "@typescript-eslint/typescript-estree": "8.46.4" + "@typescript-eslint/scope-manager": "8.49.0", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1881,13 +1864,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.46.4.tgz", - "integrity": "sha512-/++5CYLQqsO9HFGLI7APrxBJYo+5OCMpViuhV8q5/Qa3o5mMrF//eQHks+PXcsAVaLdn817fMuS7zqoXNNZGaw==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.49.0.tgz", + "integrity": "sha512-LlKaciDe3GmZFphXIc79THF/YYBugZ7FS1pO581E/edlVVNbZKDy93evqmrfQ9/Y4uN0vVhX4iuchq26mK/iiA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.46.4", + "@typescript-eslint/types": "8.49.0", "eslint-visitor-keys": "^4.2.1" }, "engines": { @@ -1916,21 +1899,21 @@ } }, "node_modules/@vitest/coverage-v8": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.0.9.tgz", - "integrity": "sha512-70oyhP+Q0HlWBIeGSP74YBw5KSjYhNgSCQjvmuQFciMqnyF36WL2cIkcT7XD85G4JPmBQitEMUsx+XMFv2AzQA==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.0.15.tgz", + "integrity": "sha512-FUJ+1RkpTFW7rQITdgTi93qOCWJobWhBirEPCeXh2SW2wsTlFxy51apDz5gzG+ZEYt/THvWeNmhdAoS9DTwpCw==", "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^1.0.2", - "@vitest/utils": "4.0.9", + "@vitest/utils": "4.0.15", "ast-v8-to-istanbul": "^0.3.8", - "debug": "^4.4.3", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.2.0", "magicast": "^0.5.1", + "obug": "^2.1.1", "std-env": "^3.10.0", "tinyrainbow": "^3.0.3" }, @@ -1938,8 +1921,8 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@vitest/browser": "4.0.9", - "vitest": "4.0.9" + "@vitest/browser": "4.0.15", + "vitest": "4.0.15" }, "peerDependenciesMeta": { "@vitest/browser": { @@ -1948,17 +1931,17 @@ } }, "node_modules/@vitest/expect": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.9.tgz", - "integrity": "sha512-C2vyXf5/Jfj1vl4DQYxjib3jzyuswMi/KHHVN2z+H4v16hdJ7jMZ0OGe3uOVIt6LyJsAofDdaJNIFEpQcrSTFw==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.15.tgz", + "integrity": "sha512-Gfyva9/GxPAWXIWjyGDli9O+waHDC0Q0jaLdFP1qPAUUfo1FEXPXUfUkp3eZA0sSq340vPycSyOlYUeM15Ft1w==", "dev": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.0.0", "@types/chai": "^5.2.2", - "@vitest/spy": "4.0.9", - "@vitest/utils": "4.0.9", - "chai": "^6.2.0", + "@vitest/spy": "4.0.15", + "@vitest/utils": "4.0.15", + "chai": "^6.2.1", "tinyrainbow": "^3.0.3" }, "funding": { @@ -1966,9 +1949,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.9.tgz", - "integrity": "sha512-Hor0IBTwEi/uZqB7pvGepyElaM8J75pYjrrqbC8ZYMB9/4n5QA63KC15xhT+sqHpdGWfdnPo96E8lQUxs2YzSQ==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.15.tgz", + "integrity": "sha512-SWdqR8vEv83WtZcrfLNqlqeQXlQLh2iilO1Wk1gv4eiHKjEzvgHb2OVc3mIPyhZE6F+CtfYjNlDJwP5MN6Km7A==", "dev": true, "license": "MIT", "dependencies": { @@ -1979,13 +1962,13 @@ } }, "node_modules/@vitest/runner": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.9.tgz", - "integrity": "sha512-aF77tsXdEvIJRkj9uJZnHtovsVIx22Ambft9HudC+XuG/on1NY/bf5dlDti1N35eJT+QZLb4RF/5dTIG18s98w==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.15.tgz", + "integrity": "sha512-+A+yMY8dGixUhHmNdPUxOh0la6uVzun86vAbuMT3hIDxMrAOmn5ILBHm8ajrqHE0t8R9T1dGnde1A5DTnmi3qw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.0.9", + "@vitest/utils": "4.0.15", "pathe": "^2.0.3" }, "funding": { @@ -1993,13 +1976,13 @@ } }, "node_modules/@vitest/snapshot": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.9.tgz", - "integrity": "sha512-r1qR4oYstPbnOjg0Vgd3E8ADJbi4ditCzqr+Z9foUrRhIy778BleNyZMeAJ2EjV+r4ASAaDsdciC9ryMy8xMMg==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.15.tgz", + "integrity": "sha512-A7Ob8EdFZJIBjLjeO0DZF4lqR6U7Ydi5/5LIZ0xcI+23lYlsYJAfGn8PrIWTYdZQRNnSRlzhg0zyGu37mVdy5g==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.0.9", + "@vitest/pretty-format": "4.0.15", "magic-string": "^0.30.21", "pathe": "^2.0.3" }, @@ -2008,9 +1991,9 @@ } }, "node_modules/@vitest/spy": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.9.tgz", - "integrity": "sha512-J9Ttsq0hDXmxmT8CUOWUr1cqqAj2FJRGTdyEjSR+NjoOGKEqkEWj+09yC0HhI8t1W6t4Ctqawl1onHgipJve1A==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.15.tgz", + "integrity": "sha512-+EIjOJmnY6mIfdXtE/bnozKEvTC4Uczg19yeZ2vtCz5Yyb0QQ31QWVQ8hswJ3Ysx/K2EqaNsVanjr//2+P3FHw==", "dev": true, "license": "MIT", "funding": { @@ -2018,13 +2001,13 @@ } }, "node_modules/@vitest/utils": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.9.tgz", - "integrity": "sha512-cEol6ygTzY4rUPvNZM19sDf7zGa35IYTm9wfzkHoT/f5jX10IOY7QleWSOh5T0e3I3WVozwK5Asom79qW8DiuQ==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.15.tgz", + "integrity": "sha512-HXjPW2w5dxhTD0dLwtYHDnelK3j8sR8cWIaLxr22evTyY6q8pRCjZSmhRWVjBaOVXChQd6AwMzi9pucorXCPZA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.0.9", + "@vitest/pretty-format": "4.0.15", "tinyrainbow": "^3.0.3" }, "funding": { @@ -2264,7 +2247,6 @@ "version": "8.15.0", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2299,7 +2281,6 @@ "version": "5.36.0", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@algolia/abtesting": "1.2.0", "@algolia/client-abtesting": "5.36.0", @@ -2320,17 +2301,6 @@ "node": ">= 14.0.0" } }, - "node_modules/ansi-regex": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, "node_modules/ansi-styles": { "version": "4.3.0", "dev": true, @@ -2392,19 +2362,6 @@ "concat-map": "0.0.1" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/buffer-from": { "version": "1.1.2", "dev": true, @@ -2578,16 +2535,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "dev": true, - "license": "MIT" - }, "node_modules/emoji-regex-xs": { "version": "1.0.0", "dev": true, @@ -2616,7 +2563,6 @@ "dev": true, "hasInstallScript": true, "license": "MIT", - "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -2664,12 +2610,11 @@ } }, "node_modules/eslint": { - "version": "9.39.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", - "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.2.tgz", + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -2677,7 +2622,7 @@ "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.1", + "@eslint/js": "9.39.2", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", @@ -2827,36 +2772,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "dev": true, @@ -2867,14 +2782,22 @@ "dev": true, "license": "MIT" }, - "node_modules/fastq": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", - "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, "node_modules/file-entry-cache": { @@ -2888,19 +2811,6 @@ "node": ">=16.0.0" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/find-up": { "version": "5.0.0", "dev": true, @@ -2937,26 +2847,10 @@ "version": "7.6.5", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "tabbable": "^6.2.0" } }, - "node_modules/foreground-child": { - "version": "3.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/fsevents": { "version": "2.3.3", "dev": true, @@ -2981,22 +2875,16 @@ } }, "node_modules/glob": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", - "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.3.1", - "jackspeak": "^4.1.1", "minimatch": "^10.1.1", "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, "engines": { "node": "20 || >=22" }, @@ -3031,13 +2919,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, "node_modules/has-flag": { "version": "4.0.0", "dev": true, @@ -3138,14 +3019,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-glob": { "version": "4.0.3", "dev": true, @@ -3157,16 +3030,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/is-what": { "version": "4.1.16", "dev": true, @@ -3229,20 +3092,6 @@ "node": ">=8" } }, - "node_modules/jackspeak": { - "version": "4.1.1", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/js-tokens": { "version": "9.0.1", "dev": true, @@ -3384,16 +3233,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, "node_modules/micromark-util-character": { "version": "2.1.1", "dev": true, @@ -3478,20 +3317,6 @@ ], "license": "MIT" }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/minimatch": { "version": "3.1.2", "dev": true, @@ -3548,6 +3373,17 @@ "dev": true, "license": "MIT" }, + "node_modules/obug": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", + "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT" + }, "node_modules/oniguruma-to-es": { "version": "3.1.1", "dev": true, @@ -3602,11 +3438,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "dev": true, - "license": "BlueOak-1.0.0" - }, "node_modules/parent-module": { "version": "1.0.1", "dev": true, @@ -3665,13 +3496,13 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -3722,9 +3553,9 @@ } }, "node_modules/prettier": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", - "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", + "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", "dev": true, "license": "MIT", "bin": { @@ -3754,27 +3585,6 @@ "node": ">=6" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/randombytes": { "version": "2.1.0", "dev": true, @@ -3820,29 +3630,17 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, "node_modules/rfdc": { "version": "1.4.1", "dev": true, "license": "MIT" }, "node_modules/rollup": { - "version": "4.53.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.2.tgz", - "integrity": "sha512-MHngMYwGJVi6Fmnk6ISmnk7JAHRNF0UkuucA0CUW3N3a4KnONPEZz+vUanQP/ZC/iY1Qkf3bwPWzyY84wEks1g==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", + "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -3854,39 +3652,39 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.53.2", - "@rollup/rollup-android-arm64": "4.53.2", - "@rollup/rollup-darwin-arm64": "4.53.2", - "@rollup/rollup-darwin-x64": "4.53.2", - "@rollup/rollup-freebsd-arm64": "4.53.2", - "@rollup/rollup-freebsd-x64": "4.53.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.53.2", - "@rollup/rollup-linux-arm-musleabihf": "4.53.2", - "@rollup/rollup-linux-arm64-gnu": "4.53.2", - "@rollup/rollup-linux-arm64-musl": "4.53.2", - "@rollup/rollup-linux-loong64-gnu": "4.53.2", - "@rollup/rollup-linux-ppc64-gnu": "4.53.2", - "@rollup/rollup-linux-riscv64-gnu": "4.53.2", - "@rollup/rollup-linux-riscv64-musl": "4.53.2", - "@rollup/rollup-linux-s390x-gnu": "4.53.2", - "@rollup/rollup-linux-x64-gnu": "4.53.2", - "@rollup/rollup-linux-x64-musl": "4.53.2", - "@rollup/rollup-openharmony-arm64": "4.53.2", - "@rollup/rollup-win32-arm64-msvc": "4.53.2", - "@rollup/rollup-win32-ia32-msvc": "4.53.2", - "@rollup/rollup-win32-x64-gnu": "4.53.2", - "@rollup/rollup-win32-x64-msvc": "4.53.2", + "@rollup/rollup-android-arm-eabi": "4.53.3", + "@rollup/rollup-android-arm64": "4.53.3", + "@rollup/rollup-darwin-arm64": "4.53.3", + "@rollup/rollup-darwin-x64": "4.53.3", + "@rollup/rollup-freebsd-arm64": "4.53.3", + "@rollup/rollup-freebsd-x64": "4.53.3", + "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", + "@rollup/rollup-linux-arm-musleabihf": "4.53.3", + "@rollup/rollup-linux-arm64-gnu": "4.53.3", + "@rollup/rollup-linux-arm64-musl": "4.53.3", + "@rollup/rollup-linux-loong64-gnu": "4.53.3", + "@rollup/rollup-linux-ppc64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-musl": "4.53.3", + "@rollup/rollup-linux-s390x-gnu": "4.53.3", + "@rollup/rollup-linux-x64-gnu": "4.53.3", + "@rollup/rollup-linux-x64-musl": "4.53.3", + "@rollup/rollup-openharmony-arm64": "4.53.3", + "@rollup/rollup-win32-arm64-msvc": "4.53.3", + "@rollup/rollup-win32-ia32-msvc": "4.53.3", + "@rollup/rollup-win32-x64-gnu": "4.53.3", + "@rollup/rollup-win32-x64-msvc": "4.53.3", "fsevents": "~2.3.2" } }, "node_modules/rollup-plugin-dts": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-6.2.3.tgz", - "integrity": "sha512-UgnEsfciXSPpASuOelix7m4DrmyQgiaWBnvI0TM4GxuDh5FkqW8E5hu57bCxXB90VvR1WNfLV80yEDN18UogSA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-6.3.0.tgz", + "integrity": "sha512-d0UrqxYd8KyZ6i3M2Nx7WOMy708qsV/7fTHMHxCMCBOAe3V/U7OMPu5GkX8hC+cmkHhzGnfeYongl1IgiooddA==", "dev": true, "license": "LGPL-3.0-only", "dependencies": { - "magic-string": "^0.30.17" + "magic-string": "^0.30.21" }, "engines": { "node": ">=16" @@ -3922,30 +3720,6 @@ "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "dev": true, @@ -4031,17 +3805,6 @@ "dev": true, "license": "ISC" }, - "node_modules/signal-exit": { - "version": "4.1.0", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/smob": { "version": "1.5.0", "dev": true, @@ -4103,60 +3866,6 @@ "dev": true, "license": "MIT" }, - "node_modules/string-width": { - "version": "5.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "dev": true, @@ -4170,40 +3879,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "dev": true, @@ -4267,11 +3942,14 @@ "license": "MIT" }, "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", + "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=18" + } }, "node_modules/tinyglobby": { "version": "0.2.15", @@ -4314,7 +3992,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -4332,19 +4009,6 @@ "node": ">=14.0.0" } }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/trim-lines": { "version": "3.0.1", "dev": true, @@ -4368,14 +4032,13 @@ } }, "node_modules/tsx": { - "version": "4.20.6", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.6.tgz", - "integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "esbuild": "~0.25.0", + "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "bin": { @@ -4413,16 +4076,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.46.4", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.46.4.tgz", - "integrity": "sha512-KALyxkpYV5Ix7UhvjTwJXZv76VWsHG+NjNlt/z+a17SOQSiOcBdUXdbJdyXi7RPxrBFECtFOiPwUJQusJuCqrg==", + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.49.0.tgz", + "integrity": "sha512-zRSVH1WXD0uXczCXw+nsdjGPUdx4dfrs5VQoHnUWmv1U3oNlAKv4FUNdLDhVUg+gYn+a5hUESqch//Rv5wVhrg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.46.4", - "@typescript-eslint/parser": "8.46.4", - "@typescript-eslint/typescript-estree": "8.46.4", - "@typescript-eslint/utils": "8.46.4" + "@typescript-eslint/eslint-plugin": "8.49.0", + "@typescript-eslint/parser": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0", + "@typescript-eslint/utils": "8.49.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4519,17 +4182,6 @@ "url": "https://github.com/sponsors/sxzz" } }, - "node_modules/unplugin-utils/node_modules/picomatch": { - "version": "4.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/uri-js": { "version": "4.4.1", "dev": true, @@ -4568,7 +4220,6 @@ "version": "5.4.21", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -4666,29 +4317,28 @@ } }, "node_modules/vitest": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.9.tgz", - "integrity": "sha512-E0Ja2AX4th+CG33yAFRC+d1wFx2pzU5r6HtG6LiPSE04flaE0qB6YyjSw9ZcpJAtVPfsvZGtJlKWZpuW7EHRxg==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.15.tgz", + "integrity": "sha512-n1RxDp8UJm6N0IbJLQo+yzLZ2sQCDyl1o0LeugbPWf8+8Fttp29GghsQBjYJVmWq3gBFfe9Hs1spR44vovn2wA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "@vitest/expect": "4.0.9", - "@vitest/mocker": "4.0.9", - "@vitest/pretty-format": "4.0.9", - "@vitest/runner": "4.0.9", - "@vitest/snapshot": "4.0.9", - "@vitest/spy": "4.0.9", - "@vitest/utils": "4.0.9", - "debug": "^4.4.3", + "@vitest/expect": "4.0.15", + "@vitest/mocker": "4.0.15", + "@vitest/pretty-format": "4.0.15", + "@vitest/runner": "4.0.15", + "@vitest/snapshot": "4.0.15", + "@vitest/spy": "4.0.15", + "@vitest/utils": "4.0.15", "es-module-lexer": "^1.7.0", "expect-type": "^1.2.2", "magic-string": "^0.30.21", + "obug": "^2.1.1", "pathe": "^2.0.3", "picomatch": "^4.0.3", "std-env": "^3.10.0", "tinybench": "^2.9.0", - "tinyexec": "^0.3.2", + "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tinyrainbow": "^3.0.3", "vite": "^6.0.0 || ^7.0.0", @@ -4705,12 +4355,12 @@ }, "peerDependencies": { "@edge-runtime/vm": "*", - "@types/debug": "^4.1.12", + "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.0.9", - "@vitest/browser-preview": "4.0.9", - "@vitest/browser-webdriverio": "4.0.9", - "@vitest/ui": "4.0.9", + "@vitest/browser-playwright": "4.0.15", + "@vitest/browser-preview": "4.0.15", + "@vitest/browser-webdriverio": "4.0.15", + "@vitest/ui": "4.0.15", "happy-dom": "*", "jsdom": "*" }, @@ -4718,7 +4368,7 @@ "@edge-runtime/vm": { "optional": true }, - "@types/debug": { + "@opentelemetry/api": { "optional": true }, "@types/node": { @@ -4745,13 +4395,13 @@ } }, "node_modules/vitest/node_modules/@vitest/mocker": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.9.tgz", - "integrity": "sha512-PUyaowQFHW+9FKb4dsvvBM4o025rWMlEDXdWRxIOilGaHREYTi5Q2Rt9VCgXgPy/hHZu1LeuXtrA/GdzOatP2g==", + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.15.tgz", + "integrity": "sha512-CZ28GLfOEIFkvCFngN8Sfx5h+Se0zN+h4B7yOsPVCcgtiO7t5jt9xQh2E1UkFep+eb9fjyMfuC5gBypwb07fvQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "4.0.9", + "@vitest/spy": "4.0.15", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, @@ -4771,45 +4421,12 @@ } } }, - "node_modules/vitest/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/vitest/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/vitest/node_modules/vite": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.2.tgz", - "integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==", + "version": "7.2.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.6.tgz", + "integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -4883,7 +4500,6 @@ "version": "3.5.20", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.20", "@vue/compiler-sfc": "3.5.20", @@ -4939,87 +4555,6 @@ "node": ">=0.10.0" } }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "dev": true, diff --git a/package.json b/package.json index 3eaabdc..aa49b1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "date-and-time", - "version": "4.1.1", + "version": "4.1.2", "description": "The simplest, most intuitive date and time library", "keywords": [ "date", @@ -58,7 +58,7 @@ "docs:build": "vitepress build docs", "docs:dev": "vitepress dev docs", "docs:preview": "vitepress preview docs", - "lint": "eslint src", + "lint": "eslint", "prepublishOnly": "npm run build", "test": "vitest run", "test:coverage": "vitest run --coverage", @@ -81,19 +81,22 @@ "type": "module", "sideEffects": false, "devDependencies": { + "@eslint/js": "^9.39.2", + "@rollup/plugin-alias": "^6.0.0", "@rollup/plugin-terser": "^0.4.4", - "@types/node": "^24.10.1", - "@vitest/coverage-v8": "^4.0.9", - "eslint": "^9.39.1", - "glob": "^11.0.3", - "prettier": "^3.6.2", - "rollup": "^4.53.2", - "rollup-plugin-dts": "^6.2.3", + "@stylistic/eslint-plugin": "^5.6.1", + "@types/node": "^25.0.2", + "@vitest/coverage-v8": "^4.0.15", + "eslint": "^9.39.2", + "glob": "^13.0.0", + "prettier": "^3.7.4", + "rollup": "^4.53.3", + "rollup-plugin-dts": "^6.3.0", "rollup-plugin-esbuild": "^6.2.1", - "tsx": "^4.20.6", - "typescript-eslint": "^8.46.4", + "tsx": "^4.21.0", + "typescript-eslint": "^8.49.0", "vitepress": "^1.6.4", - "vitest": "^4.0.9" + "vitest": "^4.0.15" }, "overrides": { "esbuild": "^0.25.0" diff --git a/rollup.config.ts b/rollup.config.ts index 5814958..d7cb06b 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,10 +1,17 @@ +import alias from '@rollup/plugin-alias'; import esbuild from 'rollup-plugin-esbuild'; import terser from '@rollup/plugin-terser'; import { dts } from 'rollup-plugin-dts'; import { globSync } from 'glob'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const outputDir = (input: string) => input.replace(/^src/g, 'dist').replace(/\/[^/]*$/g, ''); +const replacePath = (input: string) => input.replace(/(^src\/|\.ts$)/g, ''); const ts = () => { const plugins = [ + alias({ entries: [{ find: '@', replacement: resolve(dirname(fileURLToPath(import.meta.url)), 'src') }] }), esbuild({ minify: false, target: 'es2021' }), terser() ]; @@ -20,17 +27,18 @@ const ts = () => { return [ config('src/index.ts', 'dist'), config('src/plugin.ts', 'dist'), - globSync('src/numerals/**/*.ts').map(input => config(input, 'dist/numerals')), - globSync('src/locales/**/*.ts').map(input => config(input, 'dist/locales')), - globSync('src/plugins/**/*.ts').map(input => config(input, 'dist/plugins')), - config(Object.fromEntries( - globSync('src/timezones/**/*.ts').map(input => [input.replace(/(^src\/|\.ts$)/g, ''), input]) - ), 'dist') + config(Object.fromEntries(globSync('src/numerals/**/*.ts').map(input => [replacePath(input), input])), 'dist'), + globSync('src/locales/**/*.ts').map(input => config(input, outputDir(input))), + globSync('src/plugins/**/*.ts').map(input => config(input, outputDir(input))), + config(Object.fromEntries(globSync('src/timezones/**/*.ts').map(input => [replacePath(input), input])), 'dist') ].flat(); }; const types = () => { - const plugins = [dts()]; + const plugins = [ + alias({ entries: [{ find: '@', replacement: resolve(dirname(fileURLToPath(import.meta.url)), 'src') }] }), + dts() + ]; const config = (input: string | Record, outputDir: string) => ({ input, output: { dir: outputDir }, @@ -40,12 +48,10 @@ const types = () => { return [ config('src/index.ts', 'dist'), config('src/plugin.ts', 'dist'), - globSync('src/plugins/**/*.ts').map(input => config(input, 'dist/plugins')), - globSync('src/locales/**/*.ts').map(input => config(input, 'dist/locales')), - globSync('src/numerals/**/*.ts').map(input => config(input, 'dist/numerals')), - config(Object.fromEntries( - globSync('src/timezones/**/*.ts').map(input => [input.replace(/(^src\/|\.ts$)/g, ''), input]) - ), 'dist') + config(Object.fromEntries(globSync('src/numerals/**/*.ts').map(input => [replacePath(input), input])), 'dist'), + globSync('src/locales/**/*.ts').map(input => config(input, outputDir(input))), + globSync('src/plugins/**/*.ts').map(input => config(input, outputDir(input))), + config(Object.fromEntries(globSync('src/timezones/**/*.ts').map(input => [replacePath(input), input])), 'dist') ].flat(); }; diff --git a/src/addDays.ts b/src/addDays.ts index 370faeb..84e5dc7 100644 --- a/src/addDays.ts +++ b/src/addDays.ts @@ -1,5 +1,5 @@ import { toParts, fromParts } from './datetime.ts'; -import { isTimeZone, isUTC, getTimezoneOffset } from './timezone.ts'; +import { isTimeZone, isUTC, createTimezoneDate } from './timezone.ts'; import type { TimeZone } from './timezone.ts'; /** @@ -17,10 +17,7 @@ export function addDays(dateObj: Date, days: number, timeZone?: TimeZone | 'UTC' parts.day += days; parts.timezoneOffset = 0; - const utcTime = fromParts(parts); - const offset = getTimezoneOffset(utcTime, timeZone); - - return new Date(utcTime - offset * 1000); + return createTimezoneDate(fromParts(parts), timeZone); } const d = new Date(dateObj.getTime()); diff --git a/src/addMonths.ts b/src/addMonths.ts index 8547b16..161988b 100644 --- a/src/addMonths.ts +++ b/src/addMonths.ts @@ -1,5 +1,5 @@ import { toParts, fromParts } from './datetime.ts'; -import { isTimeZone, isUTC, getTimezoneOffset } from './timezone.ts'; +import { isTimeZone, isUTC, createTimezoneDate } from './timezone.ts'; import type { TimeZone } from './timezone.ts'; /** @@ -23,15 +23,15 @@ export function addMonths(dateObj: Date, months: number, timeZone?: TimeZone | ' d.setUTCDate(0); } - const utcTime = fromParts({ - ...parts, - year: d.getUTCFullYear(), - month: d.getUTCMonth() + 1, - day: d.getUTCDate() - }); - const offset = getTimezoneOffset(utcTime, timeZone); - - return new Date(utcTime - offset * 1000); + return createTimezoneDate( + fromParts({ + ...parts, + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate() + }), + timeZone + ); } const d = new Date(dateObj.getTime()); diff --git a/src/compile.ts b/src/compile.ts index dfdafd4..76522d5 100644 --- a/src/compile.ts +++ b/src/compile.ts @@ -20,6 +20,6 @@ const REGEXP = /\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g; * followed by tokenized format components */ export const compile = (formatString: string): CompiledObject => { - const array = formatString.replace(LBRACKET, '\uE000').replace(RBRACKET, '\uE001').match(REGEXP) || []; + const array = formatString.replace(LBRACKET, '\uE000').replace(RBRACKET, '\uE001').match(REGEXP) ?? []; return [formatString, ...array.map(token => token.replace(PUA_LBRACKET, '[').replace(PUA_RBRACKET, ']'))]; }; diff --git a/src/datetime.ts b/src/datetime.ts index edf322b..7a37b7d 100644 --- a/src/datetime.ts +++ b/src/datetime.ts @@ -13,7 +13,7 @@ export interface DateTimeParts { } export const toParts = (dateObj: Date, zoneName: string): DateTimeParts => { - if (zoneName?.toUpperCase() === 'UTC') { + if (zoneName.toUpperCase() === 'UTC') { return { weekday: dateObj.getUTCDay(), year: dateObj.getUTCFullYear(), @@ -76,43 +76,43 @@ export interface DateLike { /** * Returns the year of the date. */ - getFullYear(): number, + getFullYear(): number; /** * Returns the month of the date (0-11). */ - getMonth(): number, + getMonth(): number; /** * Returns the day of the month (1-31). */ - getDate(): number, + getDate(): number; /** * Returns the hours of the date (0-23). */ - getHours(): number, + getHours(): number; /** * Returns the minutes of the date (0-59). */ - getMinutes(): number, + getMinutes(): number; /** * Returns the seconds of the date (0-59). */ - getSeconds(): number, + getSeconds(): number; /** * Returns the milliseconds of the date (0-999). */ - getMilliseconds(): number, + getMilliseconds(): number; /** - * Returns the day of the week (0-6, where 0 is Sunday). + * Returns the day of the week (0-6; where 0 is Sunday). */ - getDay(): number, + getDay(): number; /** - * Returns the time value in milliseconds since the Unix epoch (January 1, 1970). + * Returns the time value in milliseconds since the Unix epoch (January 1; 1970). */ - getTime(): number, + getTime(): number; /** * Returns the timezone offset in minutes from UTC. */ - getTimezoneOffset(): number + getTimezoneOffset(): number; } export class DateTime implements DateLike { diff --git a/src/dtf.ts b/src/dtf.ts index a200d79..1230901 100644 --- a/src/dtf.ts +++ b/src/dtf.ts @@ -1,7 +1,7 @@ const cache = new Map(); export const getDateTimeFormat = (zoneName: string): Intl.DateTimeFormat => { - return cache.get(zoneName) || (() => { + return cache.get(zoneName) ?? (() => { const dtf = new Intl.DateTimeFormat('en-US', { hour12: false, weekday: 'short', year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3, diff --git a/src/duration.ts b/src/duration.ts index 7f236cf..cc0a6b2 100644 --- a/src/duration.ts +++ b/src/duration.ts @@ -14,17 +14,17 @@ interface DurationFormatter { F?: number; } -const nanosecondsPart = (parts: DurationFormatter, time: number | DOMHighResTimeStamp) => { +const nanosecondsPart = (parts: DurationFormatter, time: DOMHighResTimeStamp) => { parts.F = Math.trunc(time * 1000000); return parts; }; -const microsecondsPart = (parts: DurationFormatter, time: number | DOMHighResTimeStamp) => { +const microsecondsPart = (parts: DurationFormatter, time: DOMHighResTimeStamp) => { parts.f = Math.trunc(time * 1000); return nanosecondsPart(parts, Math.abs(time) * 1000 % 1 / 1000); }; -const millisecondsPart = (parts: DurationFormatter, time: number | DOMHighResTimeStamp) => { +const millisecondsPart = (parts: DurationFormatter, time: DOMHighResTimeStamp) => { parts.S = Math.trunc(time); return microsecondsPart(parts, Math.abs(time) % 1); }; @@ -58,7 +58,7 @@ const format = (times: DurationFormatter, formatString: string, numeral: Numeral const resolveToken = (token: string) => { if (token[0] in times) { const time = times[token[0] as keyof DurationFormatter] ?? 0; - return numeral.encode(`${sign(time)}${`${Math.abs(time)}`.padStart(token.length, '0')}`); + return numeral.encode(`${sign(time)}${String(Math.abs(time)).padStart(token.length, '0')}`); } return comment.test(token) ? token.replace(comment, '$1') : token; }; @@ -116,9 +116,9 @@ export interface DurationDescriptor { } export class Duration { - private readonly time: number | DOMHighResTimeStamp; + private readonly time: DOMHighResTimeStamp; - constructor (time: number | DOMHighResTimeStamp) { + constructor (time: DOMHighResTimeStamp) { this.time = time; } diff --git a/src/format.ts b/src/format.ts index ec572a9..42f76a5 100644 --- a/src/format.ts +++ b/src/format.ts @@ -19,17 +19,17 @@ const comment = /^\[(.*)\]$/; export function format(dateObj: Date, arg: string | CompiledObject, options?: FormatterOptions) { const pattern = (typeof arg === 'string' ? compile(arg) : arg).slice(1); const timeZone = isTimeZone(options?.timeZone) || isUTC(options?.timeZone) ? options.timeZone : undefined; - const zoneName = typeof timeZone === 'string' ? timeZone : timeZone?.zone_name || ''; + const zoneName = typeof timeZone === 'string' ? timeZone : timeZone?.zone_name ?? ''; const dateTime = zoneName ? new DateTime(dateObj, zoneName) : dateObj; const formatterOptions = { - hour12: options?.hour12 || 'h12', - hour24: options?.hour24 || 'h23', - numeral: options?.numeral || latn, - calendar: options?.calendar || 'gregory', + hour12: options?.hour12 ?? 'h12', + hour24: options?.hour24 ?? 'h23', + numeral: options?.numeral ?? latn, + calendar: options?.calendar ?? 'gregory', timeZone, - locale: options?.locale || en + locale: options?.locale ?? en }; - const formatters = [...options?.plugins || [], defaultFormatter]; + const formatters = [...options?.plugins ?? [], defaultFormatter]; const encode = formatterOptions.numeral.encode; const resolveToken = (token: string, compiledObj: CompiledObject) => { for (const formatter of formatters) { diff --git a/src/formatter.ts b/src/formatter.ts index daf45bd..8e7bea6 100644 --- a/src/formatter.ts +++ b/src/formatter.ts @@ -46,7 +46,7 @@ export interface FormatterPluginOptions { } export abstract class FormatterPlugin { - [key: string]: (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string; + [key: string]: ((d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string) | undefined; } export interface FormatterOptions extends Partial { @@ -59,15 +59,15 @@ const getFullYear = (d: DateLike, calendar: 'buddhist' | 'gregory') => { class DefaultFormatter extends FormatterPlugin { YYYY (d: DateLike, options: FormatterPluginOptions) { - return `000${getFullYear(d, options.calendar)}`.slice(-4); + return `000${String(getFullYear(d, options.calendar))}`.slice(-4); } YY (d: DateLike, options: FormatterPluginOptions) { - return `0${getFullYear(d, options.calendar)}`.slice(-2); + return `0${String(getFullYear(d, options.calendar))}`.slice(-2); } Y (d: DateLike, options: FormatterPluginOptions) { - return `${getFullYear(d, options.calendar)}`; + return String(getFullYear(d, options.calendar)); } MMMM (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) { @@ -81,27 +81,27 @@ class DefaultFormatter extends FormatterPlugin { } MM (d: DateLike) { - return `0${d.getMonth() + 1}`.slice(-2); + return `0${String(d.getMonth() + 1)}`.slice(-2); } M (d: DateLike) { - return `${d.getMonth() + 1}`; + return String(d.getMonth() + 1); } DD (d: DateLike) { - return `0${d.getDate()}`.slice(-2); + return `0${String(d.getDate())}`.slice(-2); } D (d: DateLike) { - return `${d.getDate()}`; + return String(d.getDate()); } HH (d: DateLike, options: FormatterPluginOptions) { - return `0${d.getHours() || (options.hour24 === 'h24' ? 24 : 0)}`.slice(-2); + return `0${String(d.getHours() || (options.hour24 === 'h24' ? 24 : 0))}`.slice(-2); } H (d: DateLike, options: FormatterPluginOptions) { - return `${d.getHours() || (options.hour24 === 'h24' ? 24 : 0)}`; + return String(d.getHours() || (options.hour24 === 'h24' ? 24 : 0)); } AA (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) { @@ -125,39 +125,39 @@ class DefaultFormatter extends FormatterPlugin { } hh (d: DateLike, options: FormatterPluginOptions) { - return `0${d.getHours() % 12 || (options.hour12 === 'h12' ? 12 : 0)}`.slice(-2); + return `0${String(d.getHours() % 12 || (options.hour12 === 'h12' ? 12 : 0))}`.slice(-2); } h (d: DateLike, options: FormatterPluginOptions) { - return `${d.getHours() % 12 || (options.hour12 === 'h12' ? 12 : 0)}`; + return String(d.getHours() % 12 || (options.hour12 === 'h12' ? 12 : 0)); } mm (d: DateLike) { - return `0${d.getMinutes()}`.slice(-2); + return `0${String(d.getMinutes())}`.slice(-2); } m (d: DateLike) { - return `${d.getMinutes()}`; + return String(d.getMinutes()); } ss (d: DateLike) { - return `0${d.getSeconds()}`.slice(-2); + return `0${String(d.getSeconds())}`.slice(-2); } s (d: DateLike) { - return `${d.getSeconds()}`; + return String(d.getSeconds()); } SSS (d: DateLike) { - return `00${d.getMilliseconds()}`.slice(-3); + return `00${String(d.getMilliseconds())}`.slice(-3); } SS (d: DateLike) { - return `00${d.getMilliseconds()}`.slice(-3, -1); + return `00${String(d.getMilliseconds())}`.slice(-3, -1); } S (d: DateLike) { - return `00${d.getMilliseconds()}`.slice(-3, -2); + return `00${String(d.getMilliseconds())}`.slice(-3, -2); } dddd (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) { @@ -178,13 +178,13 @@ class DefaultFormatter extends FormatterPlugin { Z (d: DateLike) { const offset = d.getTimezoneOffset(); const absOffset = Math.abs(offset); - return `${offset > 0 ? '-' : '+'}${`0${absOffset / 60 | 0}`.slice(-2)}${`0${absOffset % 60}`.slice(-2)}`; + return `${offset > 0 ? '-' : '+'}${`0${String(absOffset / 60 | 0)}`.slice(-2)}${`0${String(absOffset % 60)}`.slice(-2)}`; } ZZ (d: DateLike) { const offset = d.getTimezoneOffset(); const absOffset = Math.abs(offset); - return `${offset > 0 ? '-' : '+'}${`0${absOffset / 60 | 0}`.slice(-2)}:${`0${absOffset % 60}`.slice(-2)}`; + return `${offset > 0 ? '-' : '+'}${`0${String(absOffset / 60 | 0)}`.slice(-2)}:${`0${String(absOffset % 60)}`.slice(-2)}`; } } diff --git a/src/isValid.ts b/src/isValid.ts index b004ec3..35ce9f6 100644 --- a/src/isValid.ts +++ b/src/isValid.ts @@ -25,7 +25,7 @@ export function validatePreparseResult(pr: PreparseResult, options?: ParserOptio && pr._match > 0 && range(y, 1, 9999) && range(pr.M, 1, 12) - && range(pr.D, 1, getLastDayOfMonth(y, pr.M || 1)) + && range(pr.D, 1, getLastDayOfMonth(y, pr.M ?? 1)) && range(pr.H, min24, max24) && range(pr.A, 0, 1) && range(pr.h, min12, max12) diff --git a/src/locale.ts b/src/locale.ts index 8c4385b..f6ba9ea 100644 --- a/src/locale.ts +++ b/src/locale.ts @@ -3,7 +3,7 @@ import type { CompiledObject } from './compile.ts'; export interface LocaleOptions { compiledObj: CompiledObject; style: 'long' | 'short' | 'narrow'; - case?: 'uppercase' | 'lowercase' + case?: 'uppercase' | 'lowercase'; } export interface Locale { diff --git a/src/locales/ar.ts b/src/locales/ar.ts index abe6df2..5bcf2f2 100644 --- a/src/locales/ar.ts +++ b/src/locales/ar.ts @@ -2,7 +2,7 @@ * @file Arabic (ar) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], diff --git a/src/locales/az.ts b/src/locales/az.ts index c99053a..6a16190 100644 --- a/src/locales/az.ts +++ b/src/locales/az.ts @@ -2,7 +2,7 @@ * @file Azerbaijani (az) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], diff --git a/src/locales/bn.ts b/src/locales/bn.ts index 5c7e407..fa3e700 100644 --- a/src/locales/bn.ts +++ b/src/locales/bn.ts @@ -2,7 +2,7 @@ * @file Bangla (bn) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], diff --git a/src/locales/cs.ts b/src/locales/cs.ts index 508e720..3bbf741 100644 --- a/src/locales/cs.ts +++ b/src/locales/cs.ts @@ -2,7 +2,7 @@ * @file Czech (cs) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: [ diff --git a/src/locales/da.ts b/src/locales/da.ts index e2a5db5..5261ed9 100644 --- a/src/locales/da.ts +++ b/src/locales/da.ts @@ -2,7 +2,7 @@ * @file Danish (da) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], diff --git a/src/locales/de.ts b/src/locales/de.ts index 40ae7f3..dda2c11 100644 --- a/src/locales/de.ts +++ b/src/locales/de.ts @@ -2,7 +2,7 @@ * @file German (de) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], diff --git a/src/locales/el.ts b/src/locales/el.ts index 071a298..45e47e0 100644 --- a/src/locales/el.ts +++ b/src/locales/el.ts @@ -2,7 +2,7 @@ * @file Greek (el) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: [ diff --git a/src/locales/en.ts b/src/locales/en.ts index 4dbea32..f94d6da 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -2,7 +2,7 @@ * @file English (en) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], diff --git a/src/locales/es.ts b/src/locales/es.ts index fec528f..c3e3492 100644 --- a/src/locales/es.ts +++ b/src/locales/es.ts @@ -2,7 +2,7 @@ * @file Spanish (es) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], diff --git a/src/locales/fa.ts b/src/locales/fa.ts index 80a413c..83370cb 100644 --- a/src/locales/fa.ts +++ b/src/locales/fa.ts @@ -2,7 +2,7 @@ * @file Persian (fa) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['دی', 'بهمن', 'اسفند', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر'], diff --git a/src/locales/fi.ts b/src/locales/fi.ts index a9ee338..faf65a0 100644 --- a/src/locales/fi.ts +++ b/src/locales/fi.ts @@ -2,7 +2,7 @@ * @file Finnish (fi) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: [ diff --git a/src/locales/fr.ts b/src/locales/fr.ts index 08d43a0..1bcc617 100644 --- a/src/locales/fr.ts +++ b/src/locales/fr.ts @@ -2,7 +2,7 @@ * @file French (fr) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], diff --git a/src/locales/he.ts b/src/locales/he.ts index f21a865..28e6142 100644 --- a/src/locales/he.ts +++ b/src/locales/he.ts @@ -2,7 +2,7 @@ * @file Hebrew (he) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'], diff --git a/src/locales/hi.ts b/src/locales/hi.ts index 1962b14..191e7c3 100644 --- a/src/locales/hi.ts +++ b/src/locales/hi.ts @@ -2,7 +2,7 @@ * @file Hindi (hi) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'], diff --git a/src/locales/hu.ts b/src/locales/hu.ts index ea2f4fb..f10904a 100644 --- a/src/locales/hu.ts +++ b/src/locales/hu.ts @@ -2,7 +2,7 @@ * @file Hungarian (hu) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], diff --git a/src/locales/id.ts b/src/locales/id.ts index bb6b5b7..abb40a3 100644 --- a/src/locales/id.ts +++ b/src/locales/id.ts @@ -2,7 +2,7 @@ * @file Indonesian (id) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'], diff --git a/src/locales/it.ts b/src/locales/it.ts index 81d9060..eb77186 100644 --- a/src/locales/it.ts +++ b/src/locales/it.ts @@ -2,7 +2,7 @@ * @file Italian (it) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], diff --git a/src/locales/ja.ts b/src/locales/ja.ts index cdd7f71..6609fef 100644 --- a/src/locales/ja.ts +++ b/src/locales/ja.ts @@ -2,7 +2,7 @@ * @file Japanese (ja) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], diff --git a/src/locales/ko.ts b/src/locales/ko.ts index 74cddfa..901b1bf 100644 --- a/src/locales/ko.ts +++ b/src/locales/ko.ts @@ -2,7 +2,7 @@ * @file Korean (ko) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], diff --git a/src/locales/ms.ts b/src/locales/ms.ts index 44c92cf..8b99a47 100644 --- a/src/locales/ms.ts +++ b/src/locales/ms.ts @@ -2,7 +2,7 @@ * @file Malay (ms) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'], diff --git a/src/locales/my.ts b/src/locales/my.ts index 92acc98..6e3a099 100644 --- a/src/locales/my.ts +++ b/src/locales/my.ts @@ -2,7 +2,7 @@ * @file Burmese (my) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], diff --git a/src/locales/nl.ts b/src/locales/nl.ts index 6196465..b97514e 100644 --- a/src/locales/nl.ts +++ b/src/locales/nl.ts @@ -2,7 +2,7 @@ * @file Dutch (nl) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], diff --git a/src/locales/no.ts b/src/locales/no.ts index 88766a6..0d11f85 100644 --- a/src/locales/no.ts +++ b/src/locales/no.ts @@ -2,7 +2,7 @@ * @file Norwegian (no) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'], diff --git a/src/locales/pl.ts b/src/locales/pl.ts index 25374ae..1c598bb 100644 --- a/src/locales/pl.ts +++ b/src/locales/pl.ts @@ -2,7 +2,7 @@ * @file Polish (pl) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: [ diff --git a/src/locales/pt-BR.ts b/src/locales/pt-BR.ts index 5b768d3..88bad43 100644 --- a/src/locales/pt-BR.ts +++ b/src/locales/pt-BR.ts @@ -2,7 +2,7 @@ * @file Brazilian Portuguese (pt-BR) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], diff --git a/src/locales/pt-PT.ts b/src/locales/pt-PT.ts index 7d46b56..e3504d5 100644 --- a/src/locales/pt-PT.ts +++ b/src/locales/pt-PT.ts @@ -2,7 +2,7 @@ * @file European Portuguese (pt-PT) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], diff --git a/src/locales/ro.ts b/src/locales/ro.ts index cfb2743..7d099d4 100644 --- a/src/locales/ro.ts +++ b/src/locales/ro.ts @@ -2,7 +2,7 @@ * @file Romanian (ro) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'], diff --git a/src/locales/ru.ts b/src/locales/ru.ts index 08eed3d..b977464 100644 --- a/src/locales/ru.ts +++ b/src/locales/ru.ts @@ -2,7 +2,7 @@ * @file Russian (ru) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: [ diff --git a/src/locales/rw.ts b/src/locales/rw.ts index 3468e9c..861d799 100644 --- a/src/locales/rw.ts +++ b/src/locales/rw.ts @@ -2,7 +2,7 @@ * @file Kinyarwanda (rw) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'], diff --git a/src/locales/sr-Cyrl.ts b/src/locales/sr-Cyrl.ts index c70bbc6..77842cd 100644 --- a/src/locales/sr-Cyrl.ts +++ b/src/locales/sr-Cyrl.ts @@ -2,7 +2,7 @@ * @file Serbian (sr-Cyrl) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], diff --git a/src/locales/sr-Latn.ts b/src/locales/sr-Latn.ts index e936fc1..f8db885 100644 --- a/src/locales/sr-Latn.ts +++ b/src/locales/sr-Latn.ts @@ -2,7 +2,7 @@ * @file Serbian (sr-Latn) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'], diff --git a/src/locales/sv.ts b/src/locales/sv.ts index ea510c0..c024798 100644 --- a/src/locales/sv.ts +++ b/src/locales/sv.ts @@ -2,7 +2,7 @@ * @file Swedish (sv) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'], diff --git a/src/locales/ta.ts b/src/locales/ta.ts index cf87f13..4657c91 100644 --- a/src/locales/ta.ts +++ b/src/locales/ta.ts @@ -2,7 +2,7 @@ * @file Tamil (ta) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], diff --git a/src/locales/th.ts b/src/locales/th.ts index 35fc148..e40290b 100644 --- a/src/locales/th.ts +++ b/src/locales/th.ts @@ -2,7 +2,7 @@ * @file Thai (th) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'], diff --git a/src/locales/tr.ts b/src/locales/tr.ts index dadfd6c..1721367 100644 --- a/src/locales/tr.ts +++ b/src/locales/tr.ts @@ -2,7 +2,7 @@ * @file Turkish (tr) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], diff --git a/src/locales/uk.ts b/src/locales/uk.ts index ff535f0..2e96df7 100644 --- a/src/locales/uk.ts +++ b/src/locales/uk.ts @@ -2,7 +2,7 @@ * @file Ukrainian (uk) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: [ diff --git a/src/locales/uz-Cyrl.ts b/src/locales/uz-Cyrl.ts index 6030864..55e3136 100644 --- a/src/locales/uz-Cyrl.ts +++ b/src/locales/uz-Cyrl.ts @@ -2,7 +2,7 @@ * @file Uzbek (uz-Cyrl) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], diff --git a/src/locales/uz-Latn.ts b/src/locales/uz-Latn.ts index 8858194..82d2cb9 100644 --- a/src/locales/uz-Latn.ts +++ b/src/locales/uz-Latn.ts @@ -2,7 +2,7 @@ * @file Uzbek (uz-Latn) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avgust', 'sentabr', 'oktabr', 'noyabr', 'dekabr'], diff --git a/src/locales/vi.ts b/src/locales/vi.ts index 626e5a2..da22b91 100644 --- a/src/locales/vi.ts +++ b/src/locales/vi.ts @@ -2,7 +2,7 @@ * @file Vietnamese (vi) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'], diff --git a/src/locales/zh-Hans.ts b/src/locales/zh-Hans.ts index faa99c3..7de52f0 100644 --- a/src/locales/zh-Hans.ts +++ b/src/locales/zh-Hans.ts @@ -2,7 +2,7 @@ * @file Chinese (zh-Hans) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], diff --git a/src/locales/zh-Hant.ts b/src/locales/zh-Hant.ts index 63e6a8a..64faf2f 100644 --- a/src/locales/zh-Hant.ts +++ b/src/locales/zh-Hant.ts @@ -2,7 +2,7 @@ * @file Chinese (zh-Hant) */ -import type { Locale, LocaleOptions } from '../locale.ts'; +import type { Locale, LocaleOptions } from '@/locale.ts'; const list = { MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], diff --git a/src/numerals/arab.ts b/src/numerals/arab.ts index b3c262e..bf0472e 100644 --- a/src/numerals/arab.ts +++ b/src/numerals/arab.ts @@ -1,6 +1,6 @@ const numeral = '٠١٢٣٤٥٦٧٨٩'; const array = numeral.split(''); -const map = Object.fromEntries(array.map((char, index) => [char, '' + index])); +const map = Object.fromEntries(array.map((char, index) => [char, String(index)])); export default { encode: (str: string) => str.replace(/\d/g, char => array[+char]), diff --git a/src/numerals/arabext.ts b/src/numerals/arabext.ts index 0dc95bc..2f0f3e1 100644 --- a/src/numerals/arabext.ts +++ b/src/numerals/arabext.ts @@ -1,6 +1,6 @@ const numeral = '۰۱۲۳۴۵۶۷۸۹'; const array = numeral.split(''); -const map = Object.fromEntries(array.map((char, index) => [char, '' + index])); +const map = Object.fromEntries(array.map((char, index) => [char, String(index)])); export default { encode: (str: string) => str.replace(/\d/g, char => array[+char]), diff --git a/src/numerals/beng.ts b/src/numerals/beng.ts index 78159d9..30aa841 100644 --- a/src/numerals/beng.ts +++ b/src/numerals/beng.ts @@ -1,6 +1,6 @@ const numeral = '০১২৩৪৫৬৭৮৯'; const array = numeral.split(''); -const map = Object.fromEntries(array.map((char, index) => [char, '' + index])); +const map = Object.fromEntries(array.map((char, index) => [char, String(index)])); export default { encode: (str: string) => str.replace(/\d/g, char => array[+char]), diff --git a/src/numerals/mymr.ts b/src/numerals/mymr.ts index 1bdde86..d3a5445 100644 --- a/src/numerals/mymr.ts +++ b/src/numerals/mymr.ts @@ -1,6 +1,6 @@ const numeral = '၀၁၂၃၄၅၆၇၈၉'; const array = numeral.split(''); -const map = Object.fromEntries(array.map((char, index) => [char, '' + index])); +const map = Object.fromEntries(array.map((char, index) => [char, String(index)])); export default { encode: (str: string) => str.replace(/\d/g, char => array[+char]), diff --git a/src/parse.ts b/src/parse.ts index 647622c..df4e6ac 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -1,4 +1,4 @@ -import { isTimeZone, isUTC, getTimezoneOffset } from './timezone.ts'; +import { isTimeZone, isUTC, createTimezoneDate } from './timezone.ts'; import { validatePreparseResult } from './isValid.ts'; import { preparse } from './preparse.ts'; import type { CompiledObject } from './compile.ts'; @@ -19,23 +19,20 @@ export function parse(dateString: string, arg: string | CompiledObject, options? } // Normalize date components (year, month, day, hour, minute, second, millisecond) pr.Y = pr.Y ? pr.Y - (options?.calendar === 'buddhist' ? 543 : 0) : 1970; - pr.M = (pr.M || 1) - (pr.Y < 100 ? 1900 * 12 + 1 : 1); - pr.D ||= 1; - pr.H = ((pr.H || 0) % 24) || ((pr.A || 0) * 12 + (pr.h || 0) % 12); - pr.m ||= 0; - pr.s ||= 0; - pr.S ||= 0; + pr.M = (pr.M ?? 1) - (pr.Y < 100 ? 1900 * 12 + 1 : 1); + pr.D ??= 1; + pr.H = ((pr.H ?? 0) % 24) || ((pr.A ?? 0) * 12 + (pr.h ?? 0) % 12); + pr.m ??= 0; + pr.s ??= 0; + pr.S ??= 0; if (isTimeZone(options?.timeZone)) { // Handle timezone-specific calculation - const utcTime = Date.UTC(pr.Y, pr.M, pr.D, pr.H, pr.m, pr.s, pr.S); - const offset = getTimezoneOffset(utcTime, options.timeZone); - - return new Date(utcTime - offset * 1000); + return createTimezoneDate(Date.UTC(pr.Y, pr.M, pr.D, pr.H, pr.m, pr.s, pr.S), options.timeZone); } if (isUTC(options?.timeZone) || 'Z' in pr) { // Handle UTC calculation or when 'Z' token is present - return new Date(Date.UTC(pr.Y, pr.M, pr.D, pr.H, pr.m + (pr.Z || 0), pr.s, pr.S)); + return new Date(Date.UTC(pr.Y, pr.M, pr.D, pr.H, pr.m + (pr.Z ?? 0), pr.s, pr.S)); } // Handle local timezone calculation return new Date(pr.Y, pr.M, pr.D, pr.H, pr.m, pr.s, pr.S); diff --git a/src/parser.ts b/src/parser.ts index 86855df..506db9b 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -60,7 +60,7 @@ export interface ParseResult { } export abstract class ParserPlugin { - [key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult; + [key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined; } export interface ParserOptions extends Partial { @@ -75,7 +75,7 @@ export interface ParserOptions extends Partial { * @returns ParseResult containing the numeric value, length, and token */ export const exec = (re: RegExp, str: string, token?: ParserToken) => { - const result = re.exec(str)?.[0] || ''; + const result = re.exec(str)?.[0] ?? ''; return { value: +result, length: result.length, token }; }; @@ -89,8 +89,8 @@ export const exec = (re: RegExp, str: string, token?: ParserToken) => { export const find = (array: string[], str: string, token?: ParserToken): ParseResult => { return array.reduce((result, item, value) => item.length > result.length && !str.indexOf(item) ? { value, length: item.length, token } - : result - , { value: -1, length: 0, token }); + : result, + { value: -1, length: 0, token }); }; class DefaultParser extends ParserPlugin { @@ -231,7 +231,7 @@ class DefaultParser extends ParserPlugin { } ZZ (str: string) { - const results = /^([+-][01]\d):([0-5]\d)/.exec(str) || ['', '', '']; + const results = /^([+-][01]\d):([0-5]\d)/.exec(str) ?? ['', '', '']; const value = +(results[1] + results[2]); return { value: (value / 100 | 0) * -60 - value % 100, length: results[0].length, token: 'Z' as ParserToken }; } diff --git a/src/plugins/day-of-week.ts b/src/plugins/day-of-week.ts index 9ec7ecb..cc12d57 100644 --- a/src/plugins/day-of-week.ts +++ b/src/plugins/day-of-week.ts @@ -1,4 +1,4 @@ -import { ParserPlugin, ParserPluginOptions, CompiledObject, find } from '../plugin.ts'; +import { ParserPlugin, ParserPluginOptions, CompiledObject, find } from '@/plugin.ts'; class Parser extends ParserPlugin { dddd (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) { diff --git a/src/plugins/microsecond.ts b/src/plugins/microsecond.ts index 6e94d87..ae5de29 100644 --- a/src/plugins/microsecond.ts +++ b/src/plugins/microsecond.ts @@ -1,4 +1,4 @@ -import { ParserPlugin, exec } from '../plugin.ts'; +import { ParserPlugin, exec } from '@/plugin.ts'; class Parser extends ParserPlugin { SSSS (str: string) { diff --git a/src/plugins/nanosecond.ts b/src/plugins/nanosecond.ts index 450d211..5413a3d 100644 --- a/src/plugins/nanosecond.ts +++ b/src/plugins/nanosecond.ts @@ -1,4 +1,4 @@ -import { ParserPlugin, exec } from '../plugin.ts'; +import { ParserPlugin, exec } from '@/plugin.ts'; class Parser extends ParserPlugin { SSSSSSS (str: string) { diff --git a/src/plugins/ordinal.ts b/src/plugins/ordinal.ts index e012aff..7729f1d 100644 --- a/src/plugins/ordinal.ts +++ b/src/plugins/ordinal.ts @@ -1,20 +1,20 @@ -import { FormatterPlugin, ParserPlugin, ParserPluginOptions, exec } from '../plugin.ts'; -import type { DateLike } from '../plugin.ts'; +import { FormatterPlugin, ParserPlugin, ParserPluginOptions, exec } from '@/plugin.ts'; +import type { DateLike } from '@/plugin.ts'; class Formatter extends FormatterPlugin { DDD (d: DateLike) { - const day = d.getDate(); + const day = String(d.getDate()); switch (day) { - case 1: - case 21: - case 31: + case '1': + case '21': + case '31': return `${day}st`; - case 2: - case 22: + case '2': + case '22': return `${day}nd`; - case 3: - case 23: + case '3': + case '23': return `${day}rd`; default: return `${day}th`; diff --git a/src/plugins/two-digit-year.ts b/src/plugins/two-digit-year.ts index 0fdc45e..3ec34ca 100644 --- a/src/plugins/two-digit-year.ts +++ b/src/plugins/two-digit-year.ts @@ -1,5 +1,5 @@ -import { ParserPlugin, exec } from '../plugin.ts'; -import type { ParserPluginOptions } from '../plugin.ts'; +import { ParserPlugin, exec } from '@/plugin.ts'; +import type { ParserPluginOptions } from '@/plugin.ts'; class Parser extends ParserPlugin { YY (str: string, options: ParserPluginOptions) { diff --git a/src/plugins/zonename.ts b/src/plugins/zonename.ts index 9411d8a..aa76333 100644 --- a/src/plugins/zonename.ts +++ b/src/plugins/zonename.ts @@ -1,13 +1,13 @@ -import timeZoneNames from '../zonenames.ts'; -import { FormatterPlugin } from '../plugin.ts'; -import type { FormatterPluginOptions, DateLike } from '../plugin.ts'; +import timeZoneNames from '@/zonenames.ts'; +import { FormatterPlugin } from '@/plugin.ts'; +import type { FormatterPluginOptions, DateLike } from '@/plugin.ts'; const getLongTimezoneName = (time: number, zoneName?: string) => { const parts = new Intl.DateTimeFormat('en-US', { - timeZone: zoneName || undefined, timeZoneName: 'long' + timeZone: zoneName ?? undefined, timeZoneName: 'long' }).formatToParts(time); - return parts.find(part => part.type === 'timeZoneName')?.value.replace(/^GMT[+-].+$/, '') || ''; + return parts.find(part => part.type === 'timeZoneName')?.value.replace(/^GMT[+-].+$/, '') ?? ''; }; const getShortTimezoneName = (time: number, zoneName?: string) => { diff --git a/src/preparse.ts b/src/preparse.ts index 9dc235f..c85f66f 100644 --- a/src/preparse.ts +++ b/src/preparse.ts @@ -87,20 +87,20 @@ const ellipsis = '...'; export function preparse(dateString: string, arg: string | CompiledObject, options?: ParserOptions) { const pattern = (typeof arg === 'string' ? compile(arg) : arg).slice(1); const parserOptions = { - hour12: options?.hour12 || 'h12', - hour24: options?.hour24 || 'h23', - numeral: options?.numeral || latn, - calendar: options?.calendar || 'gregory', - ignoreCase: options?.ignoreCase || false, + hour12: options?.hour12 ?? 'h12', + hour24: options?.hour24 ?? 'h23', + numeral: options?.numeral ?? latn, + calendar: options?.calendar ?? 'gregory', + ignoreCase: options?.ignoreCase ?? false, timeZone: isTimeZone(options?.timeZone) || isUTC(options?.timeZone) ? options.timeZone : undefined, - locale: options?.locale || en + locale: options?.locale ?? en }; const pr: PreparseResult = { _index: 0, _length: 0, _match: 0 }; - const parsers = [...options?.plugins || [], defaultParser]; + const parsers = [...options?.plugins ?? [], defaultParser]; const resolveToken = (token: string, str: string) => { for (const parser of parsers) { if (parser[token]) { diff --git a/src/timezone.ts b/src/timezone.ts index 65a383b..453a60c 100644 --- a/src/timezone.ts +++ b/src/timezone.ts @@ -1,8 +1,8 @@ import { getDateTimeFormat } from './dtf.ts'; export interface TimeZone { - zone_name: string, - gmt_offset: number[] + zone_name: string; + gmt_offset: number[]; } export const isTimeZone = (timeZone?: TimeZone | 'UTC'): timeZone is TimeZone => { @@ -13,11 +13,12 @@ export const isUTC = (timeZone?: TimeZone | 'UTC'): timeZone is 'UTC' => { return timeZone === 'UTC'; }; -export const getTimezoneOffset = (utcTime: number, timeZone: TimeZone): number => { +const getTimezoneOffset = (utcTime: number, timeZone: TimeZone): number => { const utc = getDateTimeFormat('UTC'); const tz = getDateTimeFormat(timeZone.zone_name); const offset = timeZone.gmt_offset; + // Try to find the correct offset by checking the current and previous days. for (let i = 0; i < 2; i++) { const targetString = utc.format(utcTime - i * 86400 * 1000); @@ -29,3 +30,5 @@ export const getTimezoneOffset = (utcTime: number, timeZone: TimeZone): number = } return NaN; }; + +export const createTimezoneDate = (utcTime: number, timeZone: TimeZone) => new Date(utcTime - getTimezoneOffset(utcTime, timeZone) * 1000); diff --git a/tests/addDays.spec.ts b/tests/addDays.spec.ts index fa08677..1584be4 100644 --- a/tests/addDays.spec.ts +++ b/tests/addDays.spec.ts @@ -1,6 +1,6 @@ import { expect, test, describe, beforeAll } from 'vitest'; -import { addDays } from '../src/index.ts'; -import Los_Angeles from '../src/timezones/America/Los_Angeles.ts'; +import { addDays } from '@/index.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; describe('Local Time', () => { beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/addHours.spec.ts b/tests/addHours.spec.ts index 7e12933..15dbf6d 100644 --- a/tests/addHours.spec.ts +++ b/tests/addHours.spec.ts @@ -1,5 +1,5 @@ import { expect, test, beforeAll } from 'vitest'; -import { addHours } from '../src/index.ts'; +import { addHours } from '@/index.ts'; beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/addMilliseconds.spec.ts b/tests/addMilliseconds.spec.ts index 57015c8..9670251 100644 --- a/tests/addMilliseconds.spec.ts +++ b/tests/addMilliseconds.spec.ts @@ -1,5 +1,5 @@ import { expect, test, beforeAll } from 'vitest'; -import { addMilliseconds } from '../src/index.ts'; +import { addMilliseconds } from '@/index.ts'; beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/addMinutes.spec.ts b/tests/addMinutes.spec.ts index 5a84f8a..79d7827 100644 --- a/tests/addMinutes.spec.ts +++ b/tests/addMinutes.spec.ts @@ -1,5 +1,5 @@ import { expect, test, beforeAll } from 'vitest'; -import { addMinutes } from '../src/index.ts'; +import { addMinutes } from '@/index.ts'; beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/addMonths.spec.ts b/tests/addMonths.spec.ts index a136e05..b566e46 100644 --- a/tests/addMonths.spec.ts +++ b/tests/addMonths.spec.ts @@ -1,6 +1,6 @@ import { expect, test, describe, beforeAll } from 'vitest'; -import { addMonths } from '../src/index.ts'; -import Los_Angeles from '../src/timezones/America/Los_Angeles.ts'; +import { addMonths } from '@/index.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; describe('Local Time', () => { beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/addSeconds.spec.ts b/tests/addSeconds.spec.ts index fbe39b5..c264328 100644 --- a/tests/addSeconds.spec.ts +++ b/tests/addSeconds.spec.ts @@ -1,5 +1,5 @@ import { expect, test, beforeAll } from 'vitest'; -import { addSeconds } from '../src/index.ts'; +import { addSeconds } from '@/index.ts'; beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/addYears.spec.ts b/tests/addYears.spec.ts index 89031cb..669dfb0 100644 --- a/tests/addYears.spec.ts +++ b/tests/addYears.spec.ts @@ -1,6 +1,6 @@ import { expect, test, describe, beforeAll } from 'vitest'; -import { addYears } from '../src/index.ts'; -import Los_Angeles from '../src/timezones/America/Los_Angeles.ts'; +import { addYears } from '@/index.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; describe('Local Time', () => { beforeAll(() => (process.env.TZ = 'America/Los_Angeles')); diff --git a/tests/compile.spec.ts b/tests/compile.spec.ts index d1f8fbc..9d60db9 100644 --- a/tests/compile.spec.ts +++ b/tests/compile.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { compile } from '../src/index.ts'; +import { compile } from '@/index.ts'; test('YYYY', () => { const obj = ['YYYY', 'YYYY']; diff --git a/tests/duration.spec.ts b/tests/duration.spec.ts index 8301687..f3ac8c1 100644 --- a/tests/duration.spec.ts +++ b/tests/duration.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { Duration } from '../src/index.ts'; +import { Duration } from '@/index.ts'; describe('Duration', () => { test('toDays', () => { diff --git a/tests/format.spec.ts b/tests/format.spec.ts index 17ec1a4..e3c22c4 100644 --- a/tests/format.spec.ts +++ b/tests/format.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { format, compile } from '../src/index.ts'; -import Los_Angeles from '../src/timezones/America/Los_Angeles.ts'; -import Tokyo from '../src/timezones/Asia/Tokyo.ts'; +import { format, compile } from '@/index.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; +import Tokyo from '@/timezones/Asia/Tokyo.ts'; describe('YYYY', () => { beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/isValid.spec.ts b/tests/isValid.spec.ts index 137b93f..bbe0dec 100644 --- a/tests/isValid.spec.ts +++ b/tests/isValid.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { isValid, compile } from '../src/index.ts'; -import { parser } from '../src/plugins/day-of-week.ts'; +import { isValid, compile } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/locales/ar.spec.ts b/tests/locales/ar.spec.ts index 5a670a7..f418928 100644 --- a/tests/locales/ar.spec.ts +++ b/tests/locales/ar.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ar.ts'; +import lo from '@/locales/ar.ts'; const locale = { MMMM: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], diff --git a/tests/locales/az.spec.ts b/tests/locales/az.spec.ts index c3e87fd..d299f29 100644 --- a/tests/locales/az.spec.ts +++ b/tests/locales/az.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/az.ts'; +import lo from '@/locales/az.ts'; const locale = { MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], diff --git a/tests/locales/bn.spec.ts b/tests/locales/bn.spec.ts index ec46f75..5aae77b 100644 --- a/tests/locales/bn.spec.ts +++ b/tests/locales/bn.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/bn.ts'; +import lo from '@/locales/bn.ts'; const locale = { MMMM: ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], diff --git a/tests/locales/cs.spec.ts b/tests/locales/cs.spec.ts index d3e2a57..a361b44 100644 --- a/tests/locales/cs.spec.ts +++ b/tests/locales/cs.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/cs.ts'; +import lo from '@/locales/cs.ts'; const locale = { MMMM: [ diff --git a/tests/locales/da.spec.ts b/tests/locales/da.spec.ts index a0807ba..20aa6fe 100644 --- a/tests/locales/da.spec.ts +++ b/tests/locales/da.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/da.ts'; +import lo from '@/locales/da.ts'; const locale = { MMMM: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], diff --git a/tests/locales/de.spec.ts b/tests/locales/de.spec.ts index 86909f7..d1c65b4 100644 --- a/tests/locales/de.spec.ts +++ b/tests/locales/de.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/de.ts'; +import lo from '@/locales/de.ts'; const locale = { MMMM: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], diff --git a/tests/locales/el.spec.ts b/tests/locales/el.spec.ts index 3471bc5..08cfe37 100644 --- a/tests/locales/el.spec.ts +++ b/tests/locales/el.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/el.ts'; +import lo from '@/locales/el.ts'; const locale = { MMMM: [ diff --git a/tests/locales/en.spec.ts b/tests/locales/en.spec.ts index 4309076..9c89610 100644 --- a/tests/locales/en.spec.ts +++ b/tests/locales/en.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/en.ts'; +import lo from '@/locales/en.ts'; const locale = { MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], diff --git a/tests/locales/es.spec.ts b/tests/locales/es.spec.ts index a270668..0f497ca 100644 --- a/tests/locales/es.spec.ts +++ b/tests/locales/es.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/es.ts'; +import lo from '@/locales/es.ts'; const locale = { MMMM: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], diff --git a/tests/locales/fa.spec.ts b/tests/locales/fa.spec.ts index b961569..d6073cd 100644 --- a/tests/locales/fa.spec.ts +++ b/tests/locales/fa.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/fa.ts'; +import lo from '@/locales/fa.ts'; const locale = { MMMM: ['دی', 'بهمن', 'اسفند', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر'], diff --git a/tests/locales/fi.spec.ts b/tests/locales/fi.spec.ts index 5c2b4e3..d69ca93 100644 --- a/tests/locales/fi.spec.ts +++ b/tests/locales/fi.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/fi.ts'; +import lo from '@/locales/fi.ts'; const locale = { MMMM: [ diff --git a/tests/locales/fr.spec.ts b/tests/locales/fr.spec.ts index e6cf71e..466b3ca 100644 --- a/tests/locales/fr.spec.ts +++ b/tests/locales/fr.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/fr.ts'; +import lo from '@/locales/fr.ts'; const locale = { MMMM: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], diff --git a/tests/locales/he.spec.ts b/tests/locales/he.spec.ts index da1b780..34e07d1 100644 --- a/tests/locales/he.spec.ts +++ b/tests/locales/he.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/he.ts'; +import lo from '@/locales/he.ts'; const locale = { MMMM: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'], diff --git a/tests/locales/hi.spec.ts b/tests/locales/hi.spec.ts index 9d4f504..2ab690f 100644 --- a/tests/locales/hi.spec.ts +++ b/tests/locales/hi.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/hi.ts'; +import lo from '@/locales/hi.ts'; const locale = { MMMM: ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'], diff --git a/tests/locales/hu.spec.ts b/tests/locales/hu.spec.ts index 7938170..3a21a0e 100644 --- a/tests/locales/hu.spec.ts +++ b/tests/locales/hu.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/hu.ts'; +import lo from '@/locales/hu.ts'; const locale = { MMMM: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], diff --git a/tests/locales/id.spec.ts b/tests/locales/id.spec.ts index 2b3d9ed..670e38f 100644 --- a/tests/locales/id.spec.ts +++ b/tests/locales/id.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/id.ts'; +import lo from '@/locales/id.ts'; const locale = { MMMM: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'], diff --git a/tests/locales/it.spec.ts b/tests/locales/it.spec.ts index 84ced38..7163d4e 100644 --- a/tests/locales/it.spec.ts +++ b/tests/locales/it.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/it.ts'; +import lo from '@/locales/it.ts'; const locale = { MMMM: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], diff --git a/tests/locales/ja.spec.ts b/tests/locales/ja.spec.ts index 8f17e9f..f313b45 100644 --- a/tests/locales/ja.spec.ts +++ b/tests/locales/ja.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ja.ts'; +import lo from '@/locales/ja.ts'; const locale = { MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], diff --git a/tests/locales/ko.spec.ts b/tests/locales/ko.spec.ts index 03def25..b839f1c 100644 --- a/tests/locales/ko.spec.ts +++ b/tests/locales/ko.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ko.ts'; +import lo from '@/locales/ko.ts'; const locale = { MMMM: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], diff --git a/tests/locales/ms.spec.ts b/tests/locales/ms.spec.ts index 4aaa664..461b8ba 100644 --- a/tests/locales/ms.spec.ts +++ b/tests/locales/ms.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ms.ts'; +import lo from '@/locales/ms.ts'; const locale = { MMMM: ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'], diff --git a/tests/locales/my.spec.ts b/tests/locales/my.spec.ts index 63f833a..0878157 100644 --- a/tests/locales/my.spec.ts +++ b/tests/locales/my.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/my.ts'; +import lo from '@/locales/my.ts'; const locale = { MMMM: ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'ဩဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], diff --git a/tests/locales/nl.spec.ts b/tests/locales/nl.spec.ts index 57ab17b..21d33b1 100644 --- a/tests/locales/nl.spec.ts +++ b/tests/locales/nl.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/nl.ts'; +import lo from '@/locales/nl.ts'; const locale = { MMMM: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], diff --git a/tests/locales/no.spec.ts b/tests/locales/no.spec.ts index 5e7ce97..a5fd8d7 100644 --- a/tests/locales/no.spec.ts +++ b/tests/locales/no.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/no.ts'; +import lo from '@/locales/no.ts'; const locale = { MMMM: ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'], diff --git a/tests/locales/pl.spec.ts b/tests/locales/pl.spec.ts index 27f41ff..59470b2 100644 --- a/tests/locales/pl.spec.ts +++ b/tests/locales/pl.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/pl.ts'; +import lo from '@/locales/pl.ts'; const locale = { MMMM: [ diff --git a/tests/locales/pt-BR.spec.ts b/tests/locales/pt-BR.spec.ts index 58ce2a4..8bd8106 100644 --- a/tests/locales/pt-BR.spec.ts +++ b/tests/locales/pt-BR.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/pt-BR.ts'; +import lo from '@/locales/pt-BR.ts'; const locale = { MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], diff --git a/tests/locales/pt-PT.spec.ts b/tests/locales/pt-PT.spec.ts index 9d84e48..b711173 100644 --- a/tests/locales/pt-PT.spec.ts +++ b/tests/locales/pt-PT.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/pt-PT.ts'; +import lo from '@/locales/pt-PT.ts'; const locale = { MMMM: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], diff --git a/tests/locales/ro.spec.ts b/tests/locales/ro.spec.ts index 1581619..d34731c 100644 --- a/tests/locales/ro.spec.ts +++ b/tests/locales/ro.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ro.ts'; +import lo from '@/locales/ro.ts'; const locale = { MMMM: ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'], diff --git a/tests/locales/ru.spec.ts b/tests/locales/ru.spec.ts index 3e7d952..5315306 100644 --- a/tests/locales/ru.spec.ts +++ b/tests/locales/ru.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ru.ts'; +import lo from '@/locales/ru.ts'; const locale = { MMMM: [ diff --git a/tests/locales/rw.spec.ts b/tests/locales/rw.spec.ts index d17af55..b94a866 100644 --- a/tests/locales/rw.spec.ts +++ b/tests/locales/rw.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/rw.ts'; +import lo from '@/locales/rw.ts'; const locale = { MMMM: ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicurasi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeri', 'Ukwakira', 'Ugushyingo', 'Ukuboza'], diff --git a/tests/locales/sr-Cyrl.spec.ts b/tests/locales/sr-Cyrl.spec.ts index 91cbc87..165f774 100644 --- a/tests/locales/sr-Cyrl.spec.ts +++ b/tests/locales/sr-Cyrl.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/sr-Cyrl.ts'; +import lo from '@/locales/sr-Cyrl.ts'; const locale = { MMMM: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], diff --git a/tests/locales/sr-Latn.spec.ts b/tests/locales/sr-Latn.spec.ts index 0a2aac7..5322ff7 100644 --- a/tests/locales/sr-Latn.spec.ts +++ b/tests/locales/sr-Latn.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/sr-Latn.ts'; +import lo from '@/locales/sr-Latn.ts'; const locale = { MMMM: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'], diff --git a/tests/locales/sv.spec.ts b/tests/locales/sv.spec.ts index 9ceb723..93139ac 100644 --- a/tests/locales/sv.spec.ts +++ b/tests/locales/sv.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/sv.ts'; +import lo from '@/locales/sv.ts'; const locale = { MMMM: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'], diff --git a/tests/locales/ta.spec.ts b/tests/locales/ta.spec.ts index 8756076..8bbbb8f 100644 --- a/tests/locales/ta.spec.ts +++ b/tests/locales/ta.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/ta.ts'; +import lo from '@/locales/ta.ts'; const locale = { MMMM: ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], diff --git a/tests/locales/th.spec.ts b/tests/locales/th.spec.ts index 06cb764..6470782 100644 --- a/tests/locales/th.spec.ts +++ b/tests/locales/th.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/th.ts'; +import lo from '@/locales/th.ts'; const locale = { MMMM: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'], diff --git a/tests/locales/tr.spec.ts b/tests/locales/tr.spec.ts index bb31678..f3167b2 100644 --- a/tests/locales/tr.spec.ts +++ b/tests/locales/tr.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/tr.ts'; +import lo from '@/locales/tr.ts'; const locale = { MMMM: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], diff --git a/tests/locales/uk.spec.ts b/tests/locales/uk.spec.ts index 23e8d23..c1e575d 100644 --- a/tests/locales/uk.spec.ts +++ b/tests/locales/uk.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/uk.ts'; +import lo from '@/locales/uk.ts'; const locale = { MMMM: [ diff --git a/tests/locales/uz-Cyrl.spec.ts b/tests/locales/uz-Cyrl.spec.ts index b26215a..accebc8 100644 --- a/tests/locales/uz-Cyrl.spec.ts +++ b/tests/locales/uz-Cyrl.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/uz-Cyrl.ts'; +import lo from '@/locales/uz-Cyrl.ts'; const locale = { MMMM: ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], diff --git a/tests/locales/uz-Latn.spec.ts b/tests/locales/uz-Latn.spec.ts index 4891dde..27b6a61 100644 --- a/tests/locales/uz-Latn.spec.ts +++ b/tests/locales/uz-Latn.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/uz-Latn.ts'; +import lo from '@/locales/uz-Latn.ts'; const locale = { MMMM: ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avgust', 'sentabr', 'oktabr', 'noyabr', 'dekabr'], diff --git a/tests/locales/vi.spec.ts b/tests/locales/vi.spec.ts index 9713187..54d3520 100644 --- a/tests/locales/vi.spec.ts +++ b/tests/locales/vi.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/vi.ts'; +import lo from '@/locales/vi.ts'; const locale = { MMMM: ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'], diff --git a/tests/locales/zh-Hans.spec.ts b/tests/locales/zh-Hans.spec.ts index a1a91f7..ef481f0 100644 --- a/tests/locales/zh-Hans.spec.ts +++ b/tests/locales/zh-Hans.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/zh-Hans.ts'; +import lo from '@/locales/zh-Hans.ts'; const locale = { MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], diff --git a/tests/locales/zh-Hant.spec.ts b/tests/locales/zh-Hant.spec.ts index 71fbcca..c4ffe31 100644 --- a/tests/locales/zh-Hant.spec.ts +++ b/tests/locales/zh-Hant.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { parser } from '../../src/plugins/day-of-week.ts'; +import { format, parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; -import lo from '../../src/locales/zh-Hant.ts'; +import lo from '@/locales/zh-Hant.ts'; const locale = { MMMM: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], diff --git a/tests/numerals/arab.spec.ts b/tests/numerals/arab.spec.ts index 498db69..b646686 100644 --- a/tests/numerals/arab.spec.ts +++ b/tests/numerals/arab.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import numeral from '../../src/numerals/arab.ts'; +import numeral from '@/numerals/arab.ts'; describe('arab', () => { test('encode', () => { diff --git a/tests/numerals/arabext.spec.ts b/tests/numerals/arabext.spec.ts index dadb5ef..1b0b589 100644 --- a/tests/numerals/arabext.spec.ts +++ b/tests/numerals/arabext.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import numeral from '../../src/numerals/arabext.ts'; +import numeral from '@/numerals/arabext.ts'; describe('arabext', () => { test('encode', () => { diff --git a/tests/numerals/beng.spec.ts b/tests/numerals/beng.spec.ts index 5a747f1..644f078 100644 --- a/tests/numerals/beng.spec.ts +++ b/tests/numerals/beng.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import numeral from '../../src/numerals/beng.ts'; +import numeral from '@/numerals/beng.ts'; describe('beng', () => { test('encode', () => { diff --git a/tests/numerals/latn.spec.ts b/tests/numerals/latn.spec.ts index 01b3870..adabf2a 100644 --- a/tests/numerals/latn.spec.ts +++ b/tests/numerals/latn.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import numeral from '../../src/numerals/latn.ts'; +import numeral from '@/numerals/latn.ts'; describe('latn', () => { test('encode', () => { diff --git a/tests/numerals/mymr.spec.ts b/tests/numerals/mymr.spec.ts index 4bc179c..1366b85 100644 --- a/tests/numerals/mymr.spec.ts +++ b/tests/numerals/mymr.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import numeral from '../../src/numerals/mymr.ts'; +import numeral from '@/numerals/mymr.ts'; describe('mymr', () => { test('encode', () => { diff --git a/tests/parse.spec.ts b/tests/parse.spec.ts index 26f9f19..f547027 100644 --- a/tests/parse.spec.ts +++ b/tests/parse.spec.ts @@ -1,10 +1,10 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { parse } from '../src/index.ts'; -import { parser } from '../src/plugins/day-of-week.ts'; -import Los_Angeles from '../src/timezones/America/Los_Angeles.ts'; -import Tokyo from '../src/timezones/Asia/Tokyo.ts'; -import Adelaide from '../src/timezones/Australia/Adelaide.ts'; -import Apia from '../src/timezones/Pacific/Apia.ts'; +import { parse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; +import Tokyo from '@/timezones/Asia/Tokyo.ts'; +import Adelaide from '@/timezones/Australia/Adelaide.ts'; +import Apia from '@/timezones/Pacific/Apia.ts'; test('YYYY', () => { expect(Number.isNaN(parse('0000', 'YYYY').getTime())).toBe(true); diff --git a/tests/plugins/microsecond.spec.ts b/tests/plugins/microsecond.spec.ts index 1a9d7ef..9408d1f 100644 --- a/tests/plugins/microsecond.spec.ts +++ b/tests/plugins/microsecond.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { parse } from '../../src/index.ts'; -import { parser as microsecond } from '../../src/plugins/microsecond.ts'; +import { parse } from '@/index.ts'; +import { parser as microsecond } from '@/plugins/microsecond.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/plugins/nanosecond.spec.ts b/tests/plugins/nanosecond.spec.ts index ca948b5..d34307a 100644 --- a/tests/plugins/nanosecond.spec.ts +++ b/tests/plugins/nanosecond.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { parse } from '../../src/index.ts'; -import { parser as nanosecond } from '../../src/plugins/nanosecond.ts'; -import { parser as microsecond } from '../../src/plugins/microsecond.ts'; +import { parse } from '@/index.ts'; +import { parser as nanosecond } from '@/plugins/nanosecond.ts'; +import { parser as microsecond } from '@/plugins/microsecond.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/plugins/ordinal.spec.ts b/tests/plugins/ordinal.spec.ts index 1148860..ca8466d 100644 --- a/tests/plugins/ordinal.spec.ts +++ b/tests/plugins/ordinal.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { format, parse } from '../../src/index.ts'; -import { formatter, parser } from '../../src/plugins/ordinal.ts'; +import { format, parse } from '@/index.ts'; +import { formatter, parser } from '@/plugins/ordinal.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/plugins/two-digit-year.spec.ts b/tests/plugins/two-digit-year.spec.ts index 8a10255..b0a82a2 100644 --- a/tests/plugins/two-digit-year.spec.ts +++ b/tests/plugins/two-digit-year.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { parse } from '../../src/index.ts'; -import { parser as year } from '../../src/plugins/two-digit-year.ts'; +import { parse } from '@/index.ts'; +import { parser as year } from '@/plugins/two-digit-year.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/plugins/zonename.spec.ts b/tests/plugins/zonename.spec.ts index de4688e..9c121f6 100644 --- a/tests/plugins/zonename.spec.ts +++ b/tests/plugins/zonename.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { format } from '../../src/index.ts'; -import { formatter as zonename } from '../../src/plugins/zonename.ts'; -import Los_Angeles from '../../src/timezones/America/Los_Angeles.ts'; -import Tokyo from '../../src/timezones/Asia/Tokyo.ts'; +import { format } from '@/index.ts'; +import { formatter as zonename } from '@/plugins/zonename.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; +import Tokyo from '@/timezones/Asia/Tokyo.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/preparse.spec.ts b/tests/preparse.spec.ts index 1303fb2..7d9be04 100644 --- a/tests/preparse.spec.ts +++ b/tests/preparse.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { preparse } from '../src/index.ts'; -import { parser } from '../src/plugins/day-of-week.ts'; +import { preparse } from '@/index.ts'; +import { parser } from '@/plugins/day-of-week.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/subtract.spec.ts b/tests/subtract.spec.ts index a68a995..04ec02a 100644 --- a/tests/subtract.spec.ts +++ b/tests/subtract.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { subtract } from '../src/index.ts'; +import { subtract } from '@/index.ts'; describe('subtraction', () => { test('One year is 365 days', () => { diff --git a/tests/timezones/timezones.spec.ts b/tests/timezones/timezones.spec.ts index 97618f0..ea45561 100644 --- a/tests/timezones/timezones.spec.ts +++ b/tests/timezones/timezones.spec.ts @@ -1,15 +1,15 @@ import { expect, test, describe } from 'vitest'; import { readdir } from 'node:fs/promises'; import { join } from 'node:path'; -import type { TimeZone } from '../../src/timezone.ts'; +import type { TimeZone } from '@/timezone.ts'; const importModules = async (path: string) => { const items = await readdir(path, { recursive: true, withFileTypes: true }); - const modules = [] as TimeZone[]; + const modules: TimeZone[] = []; for (const item of items) { if (item.isFile()) { - modules.push((await import(join('../../', item.parentPath, item.name))).default); + modules.push((await import(join('../../', item.parentPath, item.name)) as { default: TimeZone }).default); } } return modules; diff --git a/tests/transform.spec.ts b/tests/transform.spec.ts index acd5450..7c88e02 100644 --- a/tests/transform.spec.ts +++ b/tests/transform.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, test, beforeAll } from 'vitest'; -import { compile, format, transform } from '../src/index.ts'; -import Los_Angeles from '../src/timezones/America/Los_Angeles.ts'; -import New_York from '../src/timezones/America/New_York.ts'; -import Tokyo from '../src/timezones/Asia/Tokyo.ts'; +import { compile, format, transform } from '@/index.ts'; +import Los_Angeles from '@/timezones/America/Los_Angeles.ts'; +import New_York from '@/timezones/America/New_York.ts'; +import Tokyo from '@/timezones/Asia/Tokyo.ts'; beforeAll(() => (process.env.TZ = 'UTC')); diff --git a/tests/utils.spec.ts b/tests/utils.spec.ts index 1d01f7f..1904ba4 100644 --- a/tests/utils.spec.ts +++ b/tests/utils.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { isLeapYear, isSameDay } from '../src/index.ts'; +import { isLeapYear, isSameDay } from '@/index.ts'; test('isLeapYear', () => { expect(isLeapYear(4)).toBe(true); diff --git a/tools/locale.ts b/tools/locale.ts index fc99014..a0a32c8 100644 --- a/tools/locale.ts +++ b/tools/locale.ts @@ -19,10 +19,10 @@ const getMonths = (locale: string, style: 'long' | 'short' | 'narrow') => { const months2 = []; for (let i = 0; i < 12; i++) { - months1.push(dtf1.formatToParts(new Date(2024, i, 1, 0)).find(p => p.type === 'month')?.value || ''); + months1.push(dtf1.formatToParts(new Date(2024, i, 1, 0)).find(p => p.type === 'month')?.value ?? ''); } for (let i = 0; i < 12; i++) { - months2.push(dtf2.formatToParts(new Date(2024, i, 1, 0)).find(p => p.type === 'month')?.value || ''); + months2.push(dtf2.formatToParts(new Date(2024, i, 1, 0)).find(p => p.type === 'month')?.value ?? ''); } return compare(months1, months2) ? months1 : [months1, months2]; }; @@ -36,10 +36,10 @@ const getWeekdays = (locale: string, style: 'long' | 'short' | 'narrow') => { const weekdays2 = []; for (let i = 1; i <= 7; i++) { - weekdays1.push(dtf1.formatToParts(new Date(2024, 11, i, 0)).find(p => p.type === 'weekday')?.value || ''); + weekdays1.push(dtf1.formatToParts(new Date(2024, 11, i, 0)).find(p => p.type === 'weekday')?.value ?? ''); } for (let i = 1; i <= 7; i++) { - weekdays2.push(dtf2.formatToParts(new Date(2024, 11, i, 0)).find(p => p.type === 'weekday')?.value || ''); + weekdays2.push(dtf2.formatToParts(new Date(2024, 11, i, 0)).find(p => p.type === 'weekday')?.value ?? ''); } return compare(weekdays1, weekdays2) ? weekdays1 : [weekdays1, weekdays2]; }; @@ -49,18 +49,18 @@ const getDayPeriod = (locale: string) => { const options2: Intl.DateTimeFormatOptions = { ...options1, weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; const dtf1 = new Intl.DateTimeFormat(locale, options1); const dtf2 = new Intl.DateTimeFormat(locale, options2); - const dayperiod1 = []; - const dayperiod2 = []; + const dayperiod1: string[] = []; + const dayperiod2: string[] = []; for (let i = 0; i < 24; i++) { - const value = dtf1.formatToParts(new Date(2024, 11, 1, i)).find(p => p.type === 'dayPeriod')?.value || ''; - if (dayperiod1.indexOf(value) < 0) { + const value = dtf1.formatToParts(new Date(2024, 11, 1, i)).find(p => p.type === 'dayPeriod')?.value ?? ''; + if (!dayperiod1.includes(value)) { dayperiod1.push(value); } } for (let i = 0; i < 24; i++) { - const value = dtf2.formatToParts(new Date(2024, 11, 1, i)).find(p => p.type === 'dayPeriod')?.value || ''; - if (dayperiod2.indexOf(value) < 0) { + const value = dtf2.formatToParts(new Date(2024, 11, 1, i)).find(p => p.type === 'dayPeriod')?.value ?? ''; + if (!dayperiod2.includes(value)) { dayperiod2.push(value); } } @@ -82,7 +82,6 @@ const getParts = (locale: string) => { const getDate = (locale: string) => { const options: Intl.DateTimeFormatOptions = { hour12: true, weekday: 'short', -// year: 'numeric', month: 'long', day: 'numeric', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', fractionalSecondDigits: 3, timeZone: 'Europe/Paris', timeZoneName: 'longOffset' diff --git a/tools/timezone.ts b/tools/timezone.ts index bcedb60..d790ad4 100644 --- a/tools/timezone.ts +++ b/tools/timezone.ts @@ -8,7 +8,7 @@ import { readFile, mkdir, writeFile } from 'node:fs/promises'; import { join } from 'node:path'; import prettier from 'prettier'; -import type { TimeZone } from '../src/timezone.ts'; +import type { TimeZone } from '@/timezone.ts'; const createTimeZones = (csv: string) => { const map = new Map(); @@ -16,11 +16,11 @@ const createTimeZones = (csv: string) => { csv.split('\n').forEach(line => { const [zone_name, , , , gmt_offset] = line.split(','); - if (zone_name && !/UTC$/.test(zone_name)) { + if (zone_name && !zone_name.endsWith('UTC')) { const data = map.get(zone_name); if (data) { - if (data.gmt_offset.indexOf(+gmt_offset) < 0) { + if (!data.gmt_offset.includes(+gmt_offset)) { data.gmt_offset.push(+gmt_offset); } } else { @@ -35,7 +35,7 @@ const getPath = (timezone: TimeZone) => { const re = /[^/]+$/; return { dir: join('src', 'timezones', timezone.zone_name.replace(re, '')), - name: `${re.exec(timezone.zone_name)?.[0] || ''}.ts` + name: `${re.exec(timezone.zone_name)?.[0] ?? ''}.ts` }; }; @@ -47,21 +47,19 @@ const format = (timezone: TimeZone) => { return prettier.format(code, { parser: 'typescript', singleQuote: true, trailingComma: 'none' }); }; -(async () => { - const path = process.argv[2]; +const path = process.argv[2]; - if (!path) { - console.error('Please provide a CSV file path'); - process.exit(); - } +if (!path) { + console.error('Please provide a CSV file path'); + process.exit(); +} - const csv = await readFile(path, 'utf8'); - const map = createTimeZones(csv); +const csv = await readFile(path, 'utf8'); +const map = createTimeZones(csv); - map.forEach(async timezone => { - const { dir, name } = getPath(timezone); +for (const timezone of map.values()) { + const { dir, name } = getPath(timezone); - await mkdir(dir, { recursive: true }); - await writeFile(join(dir, name), await format(timezone)); - }); -})(); + await mkdir(dir, { recursive: true }); + await writeFile(join(dir, name), await format(timezone)); +} diff --git a/tools/zonename.ts b/tools/zonename.ts index cfb3911..5f7d073 100644 --- a/tools/zonename.ts +++ b/tools/zonename.ts @@ -7,7 +7,7 @@ import { readFile } from 'node:fs/promises'; import prettier from 'prettier'; -import zonenames from '../src/zonenames.ts'; +import zonenames from '@/zonenames.ts'; const getTimezone = async (path: string) => { try { @@ -30,7 +30,7 @@ const getTimezone = async (path: string) => { }; const getTimezoneName = (dtf: Intl.DateTimeFormat, time: number) => { - return dtf.formatToParts(time).find(part => part.type === 'timeZoneName')?.value.replace(/^GMT([+-].+)?$/, '') || ''; + return dtf.formatToParts(time).find(part => part.type === 'timeZoneName')?.value.replace(/^GMT([+-].+)?$/, '') ?? ''; }; const getTimezoneNames = (timeZone: string, names: Record) => { @@ -68,31 +68,29 @@ const format = (code: Map) => { };`, { parser: 'typescript', singleQuote: true, trailingComma: 'none' }); }; -(async () => { - const path = process.argv[2]; +const path = process.argv[2]; - if (!path) { - console.error('Please provide a CSV file path'); - process.exit(); - } +if (!path) { + console.error('Please provide a CSV file path'); + process.exit(); +} - const timezones = await getTimezone(path); - const timeZoneNames = new Map(); - const errorNames = new Set(); +const timezones = await getTimezone(path); +const timeZoneNames = new Map(); +const errorNames = new Set(); - timezones.forEach(timeZone => { - const { names, errors } = getTimezoneNames(timeZone, zonenames); +timezones.forEach(timeZone => { + const { names, errors } = getTimezoneNames(timeZone, zonenames); - for (const [key, value] of names.entries()) { - timeZoneNames.set(key, value); - } - errors.forEach(err => errorNames.add(err)); - }); - - if (errorNames.size) { - console.error('Not Found'); - console.error(Array.from(errorNames)); - } else { - process.stdout.write(await format(sort(timeZoneNames))); + for (const [key, value] of names.entries()) { + timeZoneNames.set(key, value); } -})(); + errors.forEach(err => errorNames.add(err)); +}); + +if (errorNames.size) { + console.error('Not Found'); + console.error(Array.from(errorNames)); +} else { + process.stdout.write(await format(sort(timeZoneNames))); +} diff --git a/tsconfig.json b/tsconfig.json index 1e856fc..89c419f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,8 +28,8 @@ "module": "ESNext", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + "paths": { "@/*": ["./src/*"] }, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ diff --git a/vitest.config.ts b/vitest.config.ts index 6d935c5..dec0307 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,10 +1,16 @@ import { defineConfig } from 'vitest/config'; +import { resolve } from 'path'; export default defineConfig({ esbuild: { target: 'es2021', sourcemap: true }, + resolve: { + alias: { + '@': resolve(__dirname, './src') + } + }, test: { coverage: { exclude: ['src/**/*.d.ts'],