intl-messageformat
Advanced tools
Comparing version 3.3.0 to 4.0.0
@@ -6,2 +6,23 @@ # Change Log | ||
# [4.0.0](https://github.com/formatjs/intl-messageformat/compare/intl-messageformat@3.3.0...intl-messageformat@4.0.0) (2019-06-05) | ||
### Features | ||
* add package intl-relativetimeformat ([#51](https://github.com/formatjs/intl-messageformat/issues/51)) ([48c0f43](https://github.com/formatjs/intl-messageformat/commit/48c0f43)) | ||
* **intl-messageformat:** rm bundled intl-pluralrules ([a8526c3](https://github.com/formatjs/intl-messageformat/commit/a8526c3)) | ||
* **intl-messageformat:** rm rolluped dist ([a126939](https://github.com/formatjs/intl-messageformat/commit/a126939)) | ||
### BREAKING CHANGES | ||
* **intl-messageformat:** Change dist files packaged. Entry point should stay the | ||
same though. | ||
* **intl-messageformat:** We no longer include intl-pluralrules in our main index | ||
file. Consumer should polyfill accordingly. | ||
# [3.3.0](https://github.com/formatjs/intl-messageformat/compare/intl-messageformat@3.1.4...intl-messageformat@3.3.0) (2019-06-03) | ||
@@ -8,0 +29,0 @@ |
'use strict'; | ||
require('intl-pluralrules'); | ||
var IntlMessageFormat = require('./dist/intl-messageformat'); | ||
var IntlMessageFormat = require('./dist').default; | ||
@@ -5,0 +4,0 @@ // Re-export `IntlMessageFormat` as the CommonJS default exports with all the |
@@ -1,75 +0,51 @@ | ||
import { | ||
MessageFormatPattern, | ||
MessageTextElement, | ||
ArgumentElement | ||
} from 'intl-messageformat-parser'; | ||
import { MessageFormatPattern, MessageTextElement, ArgumentElement } from 'intl-messageformat-parser'; | ||
export interface Formats { | ||
number: Record<string, Intl.NumberFormatOptions>; | ||
date: Record<string, Intl.DateTimeFormatOptions>; | ||
time: Record<string, Intl.DateTimeFormatOptions>; | ||
number: Record<string, Intl.NumberFormatOptions>; | ||
date: Record<string, Intl.DateTimeFormatOptions>; | ||
time: Record<string, Intl.DateTimeFormatOptions>; | ||
} | ||
export declare type Pattern = | ||
| string | ||
| PluralOffsetString | ||
| PluralFormat | ||
| SelectFormat | ||
| StringFormat; | ||
export declare type Pattern = string | PluralOffsetString | PluralFormat | SelectFormat | StringFormat; | ||
export default class Compiler { | ||
private locales; | ||
private formats; | ||
private pluralNumberFormat; | ||
private currentPlural; | ||
private pluralStack; | ||
constructor(locales: string | string[], formats: Formats); | ||
compile(ast: MessageFormatPattern): Pattern[]; | ||
compileMessage(ast: MessageFormatPattern): Pattern[]; | ||
compileMessageText(element: MessageTextElement): string | PluralOffsetString; | ||
compileArgument( | ||
element: ArgumentElement | ||
): PluralFormat | SelectFormat | StringFormat; | ||
compileOptions(element: ArgumentElement): {}; | ||
private locales; | ||
private formats; | ||
private pluralNumberFormat; | ||
private currentPlural; | ||
private pluralStack; | ||
constructor(locales: string | string[], formats: Formats); | ||
compile(ast: MessageFormatPattern): Pattern[]; | ||
compileMessage(ast: MessageFormatPattern): Pattern[]; | ||
compileMessageText(element: MessageTextElement): string | PluralOffsetString; | ||
compileArgument(element: ArgumentElement): PluralFormat | SelectFormat | StringFormat; | ||
compileOptions(element: ArgumentElement): {}; | ||
} | ||
declare abstract class Formatter { | ||
id: string; | ||
constructor(id: string); | ||
abstract format(value: string | number): string; | ||
id: string; | ||
constructor(id: string); | ||
abstract format(value: string | number): string; | ||
} | ||
export declare class StringFormat extends Formatter { | ||
format(value: number | string): string; | ||
format(value: number | string): string; | ||
} | ||
export declare class PluralFormat { | ||
id: string; | ||
private offset; | ||
private options; | ||
private pluralRules; | ||
constructor( | ||
id: string, | ||
useOrdinal: boolean, | ||
offset: number, | ||
options: Record<string, Pattern[]>, | ||
locales: string | string[] | ||
); | ||
getOption(value: number): Pattern[]; | ||
id: string; | ||
private offset; | ||
private options; | ||
private pluralRules; | ||
constructor(id: string, useOrdinal: boolean, offset: number, options: Record<string, Pattern[]>, locales: string | string[]); | ||
getOption(value: number): Pattern[]; | ||
} | ||
export declare class PluralOffsetString extends Formatter { | ||
private offset; | ||
private numberFormat; | ||
private string; | ||
constructor( | ||
id: string, | ||
offset: number, | ||
numberFormat: Intl.NumberFormat, | ||
string: string | ||
); | ||
format(value: number): string; | ||
private offset; | ||
private numberFormat; | ||
private string; | ||
constructor(id: string, offset: number, numberFormat: Intl.NumberFormat, string: string); | ||
format(value: number): string; | ||
} | ||
export declare class SelectFormat { | ||
id: string; | ||
private options; | ||
constructor(id: string, options: Record<string, Pattern[]>); | ||
getOption(value: string): Pattern[]; | ||
id: string; | ||
private options; | ||
constructor(id: string, options: Record<string, Pattern[]>); | ||
getOption(value: string): Pattern[]; | ||
} | ||
export declare function isSelectOrPluralFormat( | ||
f: any | ||
): f is SelectFormat | PluralFormat; | ||
export declare function isSelectOrPluralFormat(f: any): f is SelectFormat | PluralFormat; | ||
export {}; |
import { Formats } from './compiler'; | ||
import parser, { MessageFormatPattern } from 'intl-messageformat-parser'; | ||
export interface IntlMessageFormat { | ||
new ( | ||
message: string | MessageFormatPattern, | ||
locales?: string | string[], | ||
overrideFormats?: Partial<Formats> | ||
): IntlMessageFormat; | ||
( | ||
message: string | MessageFormatPattern, | ||
locales?: string | string[], | ||
overrideFormats?: Partial<Formats> | ||
): IntlMessageFormat; | ||
format( | ||
values?: Record<string, string | number | boolean | null | undefined> | ||
): string; | ||
resolvedOptions(): { | ||
locale: string; | ||
}; | ||
getAst(): ReturnType<typeof parser['parse']>; | ||
defaultLocale: string; | ||
formats: Formats; | ||
__parse: typeof parser['parse']; | ||
new (message: string | MessageFormatPattern, locales?: string | string[], overrideFormats?: Partial<Formats>): IntlMessageFormat; | ||
(message: string | MessageFormatPattern, locales?: string | string[], overrideFormats?: Partial<Formats>): IntlMessageFormat; | ||
format(values?: Record<string, string | number | boolean | null | undefined>): string; | ||
resolvedOptions(): { | ||
locale: string; | ||
}; | ||
getAst(): ReturnType<typeof parser['parse']>; | ||
defaultLocale: string; | ||
formats: Formats; | ||
__parse: typeof parser['parse']; | ||
} | ||
declare const MessageFormat: IntlMessageFormat; | ||
export default MessageFormat; |
{ | ||
"name": "intl-messageformat", | ||
"version": "3.3.0", | ||
"version": "4.0.0", | ||
"description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.", | ||
@@ -34,4 +34,3 @@ "keywords": [ | ||
"dependencies": { | ||
"intl-messageformat-parser": "^1.6.5", | ||
"intl-pluralrules": "^1.0.1" | ||
"intl-messageformat-parser": "^1.6.5" | ||
}, | ||
@@ -41,3 +40,3 @@ "scripts": { | ||
"benchmark": "ts-node --project tests/tsconfig.json tests/benchmark", | ||
"build": "tsc && rollup -c rollup.config.js", | ||
"build": "tsc && tsc -p tsconfig.cjs.json && rollup -c rollup.config.js", | ||
"test": "mocha --opts ../../mocha.opts tests/index.ts", | ||
@@ -52,3 +51,3 @@ "karma:local": "karma start karma.conf.js", | ||
"license": "BSD-3-Clause", | ||
"gitHead": "6c131ebfbd0431cc32520f6880e1ea917797a389" | ||
"gitHead": "63e7577876040c076c2deee68da8b276f7e3ed75" | ||
} |
@@ -14,3 +14,3 @@ import { uglify } from 'rollup-plugin-uglify'; | ||
sourcemap: true, | ||
file: 'dist/intl-messageformat.js', | ||
file: 'dist/umd/intl-messageformat.js', | ||
format: 'umd', | ||
@@ -25,3 +25,3 @@ name: 'IntlMessageFormat' | ||
sourcemap: true, | ||
file: 'dist/intl-messageformat.min.js', | ||
file: 'dist/umd/intl-messageformat.min.js', | ||
format: 'umd', | ||
@@ -28,0 +28,0 @@ name: 'IntlMessageFormat' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
474500
1
42
3690
1
- Removedintl-pluralrules@^1.0.1
- Removedintl-pluralrules@1.3.1(transitive)