Skip to content

Commit

Permalink
fix: rm core pkg for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Long Ho committed Aug 6, 2019
1 parent 5295ee1 commit 223d2cf
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 111 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ Internationalize [React][] apps. This library provides React components and an A
[![npm Version](https://badgen.net/npm/v/react-intl/next)][npm]
[![Build Status][travis-badge]][travis]

| Package | Minified Size | Minzipped Size |
| ----------------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `react-intl` | ![minified size](https://badgen.net/badgesize/normal/https://unpkg.com/react-intl@next/dist/react-intl.min.js) | ![minzipped size](https://badgen.net/badgesize/gzip/https://unpkg.com/react-intl@next/dist/react-intl.min.js) |
| `react-intl/core` | ![core min size](https://badgen.net/badgesize/normal/https://unpkg.com/react-intl@next/dist/react-intl-core.min.js) | ![core minzipped size](https://badgen.net/badgesize/gzip/https://unpkg.com/react-intl@next/dist/react-intl-core.min.js) |
| Package | Minified Size | Minzipped Size |
| ------------ | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `react-intl` | ![minified size](https://badgen.net/badgesize/normal/https://unpkg.com/react-intl@next/dist/react-intl.min.js) | ![minzipped size](https://badgen.net/badgesize/gzip/https://unpkg.com/react-intl@next/dist/react-intl.min.js) |

## Overview

Expand Down
1 change: 0 additions & 1 deletion core.ts

This file was deleted.

2 changes: 1 addition & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ There are a few API layers that React Intl provides and is built on. When using
- [ECMAScript Internationalization API](#ecmascript-internationalization-api)
- [FormatJS Internationalization Formatters](#formatjs-internationalization-formatters)
- [React Intl API](#react-intl-api)
- [`defineMessages`](#definemessages)
- [`defineMessages`](#definemessages)
- [Injection API](#injection-api)
- [`useIntl` hook (currently available in 3.0.0 beta)](#useintl-hook-currently-available-in-300-beta)
- [`injectIntl` HOC](#injectintl-hoc)
Expand Down
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"@formatjs/intl-relativetimeformat": "^2.5.0",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/invariant": "^2.2.30",
"@types/react": "^16.0.0",
"@types/react": "^16.8.24",

This comment has been minimized.

Copy link
@redonkulus

redonkulus Aug 6, 2019

Member

Was this unintentional?

This comment has been minimized.

Copy link
@longlho

longlho Aug 6, 2019

Member

yeah my bad downgrading that now

"hoist-non-react-statics": "^3.3.0",
"intl-format-cache": "^4.1.4",
"intl-locales-supported": "^1.4.2",
"intl-messageformat": "^6.0.0",
"intl-messageformat-parser": "^3.0.0",
"intl-messageformat": "^6.0.1",
"intl-messageformat-parser": "^3.0.1",
"invariant": "^2.1.1",
"react": "^16.3.0",
"shallow-equal": "^1.1.0"
Expand All @@ -61,13 +61,13 @@
"@babel/preset-react": "^7.0.0",
"@types/benchmark": "^1.0.31",
"@types/enzyme": "^3.10.3",
"@types/jest": "^24.0.16",
"@types/jest": "^24.0.17",
"@types/prop-types": "^15.7.1",
"@types/react-dom": "^16.8.5",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"babel-jest": "^24.8.0",
"babel-plugin-react-intl": "^4.1.4",
"babel-plugin-react-intl": "^4.1.5",
"babel-plugin-transform-member-expression-literals": "^6.9.4",
"babel-plugin-transform-property-literals": "^6.9.4",
"babel-plugin-transform-react-remove-prop-types": "^0.4.18",
Expand Down Expand Up @@ -97,8 +97,8 @@
"prop-types": "^15.7.2",
"react-dom": "^16.8.6",
"rimraf": "^2.4.2",
"rollup": "^1.17.0",
"rollup-plugin-commonjs": "^10.0.1",
"rollup": "^1.19.2",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-typescript": "^1.0.1",
Expand All @@ -117,7 +117,7 @@
"build:dist:dev": "cross-env NODE_ENV=development rollup -c rollup.config.dist.js",
"build:dist:prod": "cross-env NODE_ENV=production rollup -c rollup.config.dist.js",
"build:dist": "npm run build:dist:dev && npm run build:dist:prod",
"build:lib": "tsc -p src/tsconfig.json && tsc -p src/tsconfig.cjs.json && tsc -p tsconfig.core.json",
"build:lib": "tsc -p src/tsconfig.json && tsc -p src/tsconfig.cjs.json",
"build": "npm run build:lib && npm run build:dist",
"clean": "rimraf coverage/ dist/ lib/ core.js core.d.ts",
"example": "parcel examples/index.html",
Expand Down
2 changes: 1 addition & 1 deletion src/components/html-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import * as React from 'react';
import FormattedMessage from './message';
import {PrimitiveType} from 'intl-messageformat/core';
import {PrimitiveType} from 'intl-messageformat';

export default class FormattedHTMLMessage extends FormattedMessage<
Record<string, PrimitiveType>
Expand Down
5 changes: 2 additions & 3 deletions src/components/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import {
DEFAULT_INTL_CONFIG,
createFormatters,
} from '../utils';
import {PrimitiveType, FormatXMLElementFn} from 'intl-messageformat/core';
import {IntlContext} from '../core';
import {PrimitiveType, FormatXMLElementFn} from 'intl-messageformat';

const defaultFormatMessage = (
descriptor: MessageDescriptor,
Expand Down Expand Up @@ -63,7 +62,7 @@ export default class FormattedMessage<
static contextType = Context;
context!: React.ContextType<typeof Context>;

constructor(props: Props<V>, context: React.ContextType<typeof IntlContext>) {
constructor(props: Props<V>, context: React.ContextType<typeof Context>) {
super(props);
if (!props.defaultMessage) {
invariantIntlContext(context);
Expand Down
31 changes: 0 additions & 31 deletions src/core.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import IntlRelativeTimeFormat, {
IntlRelativeTimeFormatOptions,
} from '@formatjs/intl-relativetimeformat';
import {LiteralElement, TYPE} from 'intl-messageformat-parser';
import {FormatXMLElementFn, PrimitiveType} from 'intl-messageformat/core';
import {FormatXMLElementFn, PrimitiveType} from 'intl-messageformat';

const DATE_TIME_FORMAT_OPTIONS: Array<keyof Intl.DateTimeFormatOptions> = [
'localeMatcher',
Expand Down
39 changes: 21 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@
*/

export * from './types';
import {parse} from 'intl-messageformat-parser';
import {IntlMessageFormat} from 'intl-messageformat/core';
IntlMessageFormat.__parse = parse;
export {default as defineMessages} from './define-messages';
import createFormattedComponent from './components/createFormattedComponent';
export {
createIntl,
defineMessages,
FormattedDate,
FormattedHTMLMessage,
FormattedMessage,
FormattedNumber,
FormattedPlural,
FormattedRelativeTime,
FormattedTime,
injectIntl,
IntlContext,
IntlProvider,
RawIntlProvider,
useIntl,
default as injectIntl,
Provider as RawIntlProvider,
Context as IntlContext,
WithIntlProps,
WrappedComponentProps,
} from './core';
} from './components/injectIntl';
export {default as useIntl} from './components/useIntl';
export {default as IntlProvider, createIntl} from './components/provider';
export const {Component: FormattedDate} = createFormattedComponent(
'formatDate'
);
export const {Component: FormattedTime} = createFormattedComponent(
'formatTime'
);
export const {Component: FormattedNumber} = createFormattedComponent(
'formatNumber'
);
export {default as FormattedRelativeTime} from './components/relative';
export {default as FormattedPlural} from './components/plural';
export {default as FormattedMessage} from './components/message';
export {default as FormattedHTMLMessage} from './components/html-message';
5 changes: 2 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
* See the accompanying LICENSE file for terms.
*/
import * as React from 'react';
import {
IntlMessageFormat,
import IntlMessageFormat, {
Formats,
PrimitiveType,
FormatXMLElementFn,
} from 'intl-messageformat/core';
} from 'intl-messageformat';
import IntlRelativeTimeFormat, {
IntlRelativeTimeFormatOptions,
} from '@formatjs/intl-relativetimeformat';
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ file in the root directory of React's source tree.

import {IntlConfig, IntlCache} from './types';
import * as React from 'react';
import {IntlMessageFormat} from 'intl-messageformat/core';
import IntlMessageFormat from 'intl-messageformat';
import memoizeIntlConstructor from 'intl-format-cache';
import IntlRelativeTimeFormat from '@formatjs/intl-relativetimeformat';
// Since rollup cannot deal with namespace being a function,
Expand Down Expand Up @@ -72,7 +72,7 @@ export function invariantIntlContext(intl?: any) {
}

export function createError(message: string, exception?: Error) {
const eMsg = exception ? `\n${exception}` : '';
const eMsg = exception ? `\n${exception.stack}` : '';
return `[React Intl] ${message}${eMsg}`;
}

Expand Down
7 changes: 0 additions & 7 deletions tsconfig.core.json

This file was deleted.

0 comments on commit 223d2cf

Please sign in to comment.