diff --git a/CHANGELOG.md b/CHANGELOG.md index fc6a82e7..a8163c6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ### Changelog +- 2.6.8 (2021-02-04) + - Bugfixes: + - Solve circular imports (#444) + +- 2.6.6 (2020-08-23) + - Bugfixes: + - Fixed broken npm package (#417) + - 2.6.5 (2020-08-23) - Bugfixes: - `luxon`-less binary should not contain any `luxon` imports (#410) diff --git a/demo/demo.ts b/demo/demo.ts index 8bd18cc2..8be374f7 100644 --- a/demo/demo.ts +++ b/demo/demo.ts @@ -339,7 +339,7 @@ $(function () { const arg = match[2] activateTab($(`a[href='#${method}-input']`)) return $(`#${method}-input input:first`) - .val(arg) + .val(decodeURIComponent(arg)) .trigger('change') } } diff --git a/package.json b/package.json index 72de0f4b..d15cc660 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rrule", - "version": "2.6.5", + "version": "2.6.8", "description": "JavaScript library for working with recurrence rules for calendar dates.", "homepage": "http://jakubroztocil.github.io/rrule/", "license": "BSD-3-Clause", diff --git a/src/fake-luxon.ts b/src/fake-luxon.ts index 42b1a6fd..6bdc8dde 100644 --- a/src/fake-luxon.ts +++ b/src/fake-luxon.ts @@ -1,5 +1,5 @@ export const DateTime = { - fromJSDate() { - throw new TypeError(); + fromJSDate () { + throw new TypeError() } -}; +} diff --git a/src/nlp/index.ts b/src/nlp/index.ts index f18da328..2837583e 100644 --- a/src/nlp/index.ts +++ b/src/nlp/index.ts @@ -1,6 +1,7 @@ import ToText, { DateFormatter, GetText } from './totext' import parseText from './parsetext' import RRule from '../index' +import { Frequency } from '../types' import ENGLISH, { Language } from './i18n' /*! @@ -108,12 +109,12 @@ const common = [ ] ToText.IMPLEMENTED = [] -ToText.IMPLEMENTED[RRule.HOURLY] = common -ToText.IMPLEMENTED[RRule.MINUTELY] = common -ToText.IMPLEMENTED[RRule.DAILY] = ['byhour'].concat(common) -ToText.IMPLEMENTED[RRule.WEEKLY] = common -ToText.IMPLEMENTED[RRule.MONTHLY] = common -ToText.IMPLEMENTED[RRule.YEARLY] = ['byweekno', 'byyearday'].concat(common) +ToText.IMPLEMENTED[Frequency.HOURLY] = common +ToText.IMPLEMENTED[Frequency.MINUTELY] = common +ToText.IMPLEMENTED[Frequency.DAILY] = ['byhour'].concat(common) +ToText.IMPLEMENTED[Frequency.WEEKLY] = common +ToText.IMPLEMENTED[Frequency.MONTHLY] = common +ToText.IMPLEMENTED[Frequency.YEARLY] = ['byweekno', 'byyearday'].concat(common) // ============================================================================= // Export diff --git a/src/rrule.ts b/src/rrule.ts index ccbac06c..db337cd5 100644 --- a/src/rrule.ts +++ b/src/rrule.ts @@ -3,7 +3,7 @@ import dateutil from './dateutil' import IterResult, { IterArgs } from './iterresult' import CallbackIterResult from './callbackiterresult' import { Language } from './nlp/i18n' -import { Nlp } from './nlp/index' +import { fromText, parseText, toText, isFullyConvertible } from './nlp/index' import { DateFormatter, GetText } from './nlp/totext' import { ParsedOptions, Options, Frequency, QueryMethods, QueryMethodTypes, IterResultType } from './types' import { parseOptions, initializeOptions } from './parseoptions' @@ -13,19 +13,6 @@ import { Cache, CacheKeys } from './cache' import { Weekday } from './weekday' import { iter } from './iter/index' -interface GetNlp { - _nlp: Nlp - (): Nlp -} - -const getnlp: GetNlp = function () { - // Lazy, runtime import to avoid circular refs. - if (!getnlp._nlp) { - getnlp._nlp = require('./nlp') - } - return getnlp._nlp -} as GetNlp - // ============================================================================= // RRule // ============================================================================= @@ -114,11 +101,11 @@ export default class RRule implements QueryMethods { } static parseText (text: string, language?: Language) { - return getnlp().parseText(text, language) + return parseText(text, language) } static fromText (text: string, language?: Language) { - return getnlp().fromText(text, language) + return fromText(text, language) } static parseString = parseString @@ -256,11 +243,11 @@ export default class RRule implements QueryMethods { * to text. */ toText (gettext?: GetText, language?: Language, dateFormatter?: DateFormatter) { - return getnlp().toText(this, gettext, language, dateFormatter) + return toText(this, gettext, language, dateFormatter) } isFullyConvertibleToText () { - return getnlp().isFullyConvertible(this) + return isFullyConvertible(this) } /** diff --git a/tsconfig.json b/tsconfig.json index 35747320..0ed7bad5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": "./dist/esm", "outDir": "./dist/esm", "declaration": true, "declarationMap": true,