react-intl 6.0.5 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUILD +130 -0
- package/CHANGELOG.md +1384 -0
- package/LICENSE.md +0 -0
- package/README.md +0 -0
- package/example-sandboxes/rescripts/.rescriptsrc.js +28 -0
- package/example-sandboxes/rescripts/package-lock.json +18035 -0
- package/example-sandboxes/rescripts/package.json +35 -0
- package/example-sandboxes/rescripts/public/index.html +42 -0
- package/example-sandboxes/rescripts/src/App.tsx +16 -0
- package/example-sandboxes/rescripts/src/index.tsx +5 -0
- package/example-sandboxes/rescripts/src/react-app-env.d.ts +1 -0
- package/example-sandboxes/rescripts/src/styles.css +4 -0
- package/example-sandboxes/rescripts/tsconfig.json +20 -0
- package/example-sandboxes/strict-locale-type/.env +1 -0
- package/example-sandboxes/strict-locale-type/package-lock.json +14595 -0
- package/example-sandboxes/strict-locale-type/package.json +35 -0
- package/example-sandboxes/strict-locale-type/src/App.tsx +48 -0
- package/example-sandboxes/strict-locale-type/src/index.html +28 -0
- package/example-sandboxes/strict-locale-type/src/index.tsx +7 -0
- package/example-sandboxes/strict-locale-type/src/styles.css +4 -0
- package/example-sandboxes/strict-locale-type/tsconfig.json +7 -0
- package/example-sandboxes/strict-message-types/.env +1 -0
- package/example-sandboxes/strict-message-types/package-lock.json +14596 -0
- package/example-sandboxes/strict-message-types/package.json +35 -0
- package/example-sandboxes/strict-message-types/src/App.tsx +31 -0
- package/example-sandboxes/strict-message-types/src/index.html +28 -0
- package/example-sandboxes/strict-message-types/src/index.tsx +7 -0
- package/example-sandboxes/strict-message-types/src/styles.css +4 -0
- package/example-sandboxes/strict-message-types/tsconfig.json +7 -0
- package/examples/BUILD +70 -0
- package/examples/Bug2727.tsx +37 -0
- package/examples/HandleChange.tsx +48 -0
- package/examples/Hooks.tsx +126 -0
- package/examples/Injected.tsx +41 -0
- package/examples/Messages.tsx +82 -0
- package/examples/StaticTypeSafetyAndCodeSplitting/StaticTypeSafetyAndCodeSplitting.tsx +44 -0
- package/examples/StaticTypeSafetyAndCodeSplitting/en.json +3 -0
- package/examples/StaticTypeSafetyAndCodeSplitting/intlHelpers.tsx +39 -0
- package/examples/StaticTypeSafetyAndCodeSplitting/it.json +3 -0
- package/examples/TimeZone.tsx +44 -0
- package/examples/advanced/Advanced.tsx +68 -0
- package/examples/advanced/compiled-lang/en.json +77 -0
- package/examples/advanced/compiled-lang/fr.json +77 -0
- package/examples/index.html +20 -0
- package/examples/index.tsx +44 -0
- package/examples/package.json +20 -0
- package/index.ts +127 -0
- package/jest.config.js +27 -0
- package/package.json +12 -8
- package/src/components/createFormattedComponent.tsx +123 -0
- package/src/components/dateTimeRange.tsx +26 -0
- package/src/components/injectIntl.tsx +111 -0
- package/src/components/message.tsx +73 -0
- package/src/components/plural.tsx +45 -0
- package/src/components/provider.tsx +196 -0
- package/src/components/relative.tsx +192 -0
- package/src/components/useIntl.ts +10 -0
- package/src/types.ts +29 -0
- package/src/utils.ts +77 -0
- package/tests/functional/index.ts +18 -0
- package/tests/functional/support/build.ts +16 -0
- package/tests/functional/support/format.tsx +112 -0
- package/tests/perf/index.tsx +196 -0
- package/tests/setup.js +10 -0
- package/tests/unit/components/__snapshots__/displayName.tsx.snap +19 -0
- package/tests/unit/components/__snapshots__/message.tsx.snap +41 -0
- package/tests/unit/components/__snapshots__/relative.tsx.snap +11 -0
- package/tests/unit/components/__snapshots__/useIntl.tsx.snap +25 -0
- package/tests/unit/components/date.tsx +233 -0
- package/tests/unit/components/dateTimeRange.tsx +103 -0
- package/tests/unit/components/displayName.tsx +57 -0
- package/tests/unit/components/message.tsx +509 -0
- package/tests/unit/components/number.tsx +198 -0
- package/tests/unit/components/plural.tsx +116 -0
- package/tests/unit/components/provider.tsx +215 -0
- package/tests/unit/components/relative.tsx +263 -0
- package/tests/unit/components/time.tsx +242 -0
- package/tests/unit/components/useIntl.tsx +64 -0
- package/tests/unit/components/withIntl.tsx +66 -0
- package/tests/unit/react-intl.ts +88 -0
- package/tests/unit/testUtils.tsx +42 -0
- package/tsconfig.json +5 -0
- package/index.d.ts +0 -43
- package/index.d.ts.map +0 -1
- package/index.js +0 -51
- package/lib/index.d.ts +0 -43
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -26
- package/lib/src/components/createFormattedComponent.d.ts +0 -29
- package/lib/src/components/createFormattedComponent.d.ts.map +0 -1
- package/lib/src/components/createFormattedComponent.js +0 -62
- package/lib/src/components/dateTimeRange.d.ts +0 -11
- package/lib/src/components/dateTimeRange.d.ts.map +0 -1
- package/lib/src/components/dateTimeRange.js +0 -15
- package/lib/src/components/injectIntl.d.ts +0 -22
- package/lib/src/components/injectIntl.d.ts.map +0 -1
- package/lib/src/components/injectIntl.js +0 -29
- package/lib/src/components/message.d.ts +0 -12
- package/lib/src/components/message.d.ts.map +0 -1
- package/lib/src/components/message.js +0 -35
- package/lib/src/components/plural.d.ts +0 -15
- package/lib/src/components/plural.d.ts.map +0 -1
- package/lib/src/components/plural.js +0 -26
- package/lib/src/components/provider.d.ts +0 -35
- package/lib/src/components/provider.d.ts.map +0 -1
- package/lib/src/components/provider.js +0 -108
- package/lib/src/components/relative.d.ts +0 -12
- package/lib/src/components/relative.d.ts.map +0 -1
- package/lib/src/components/relative.js +0 -129
- package/lib/src/components/useIntl.d.ts +0 -3
- package/lib/src/components/useIntl.d.ts.map +0 -1
- package/lib/src/components/useIntl.js +0 -8
- package/lib/src/types.d.ts +0 -12
- package/lib/src/types.d.ts.map +0 -1
- package/lib/src/types.js +0 -1
- package/lib/src/utils.d.ts +0 -14
- package/lib/src/utils.d.ts.map +0 -1
- package/lib/src/utils.js +0 -43
- package/react-intl.iife.js +0 -7485
- package/src/components/createFormattedComponent.d.ts +0 -29
- package/src/components/createFormattedComponent.d.ts.map +0 -1
- package/src/components/createFormattedComponent.js +0 -69
- package/src/components/dateTimeRange.d.ts +0 -11
- package/src/components/dateTimeRange.d.ts.map +0 -1
- package/src/components/dateTimeRange.js +0 -17
- package/src/components/injectIntl.d.ts +0 -22
- package/src/components/injectIntl.d.ts.map +0 -1
- package/src/components/injectIntl.js +0 -33
- package/src/components/message.d.ts +0 -12
- package/src/components/message.d.ts.map +0 -1
- package/src/components/message.js +0 -37
- package/src/components/plural.d.ts +0 -15
- package/src/components/plural.d.ts.map +0 -1
- package/src/components/plural.js +0 -29
- package/src/components/provider.d.ts +0 -35
- package/src/components/provider.d.ts.map +0 -1
- package/src/components/provider.js +0 -112
- package/src/components/relative.d.ts +0 -12
- package/src/components/relative.d.ts.map +0 -1
- package/src/components/relative.js +0 -131
- package/src/components/useIntl.d.ts +0 -3
- package/src/components/useIntl.d.ts.map +0 -1
- package/src/components/useIntl.js +0 -12
- package/src/types.d.ts +0 -12
- package/src/types.d.ts.map +0 -1
- package/src/types.js +0 -2
- package/src/utils.d.ts +0 -14
- package/src/utils.d.ts.map +0 -1
- package/src/utils.js +0 -49
package/BUILD
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
|
2
|
+
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
|
|
3
|
+
load("@aspect_rules_js//npm/private:npm_package.bzl", "npm_package")
|
|
4
|
+
load("@npm//:defs.bzl", "npm_link_all_packages")
|
|
5
|
+
load("//tools:index.bzl", "check_format", "package_json_test", "ts_compile")
|
|
6
|
+
load("//tools:jest.bzl", "jest_test")
|
|
7
|
+
|
|
8
|
+
npm_link_all_packages(name = "node_modules")
|
|
9
|
+
|
|
10
|
+
PACKAGE_NAME = "react-intl"
|
|
11
|
+
|
|
12
|
+
npm_package(
|
|
13
|
+
name = PACKAGE_NAME,
|
|
14
|
+
srcs = [
|
|
15
|
+
"LICENSE.md",
|
|
16
|
+
"README.md",
|
|
17
|
+
"package.json",
|
|
18
|
+
"%s.iife.js" % PACKAGE_NAME,
|
|
19
|
+
":dist",
|
|
20
|
+
":dist-esm",
|
|
21
|
+
],
|
|
22
|
+
package = PACKAGE_NAME,
|
|
23
|
+
visibility = ["//visibility:public"],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
SRCS = glob(["src/**/*.ts*"]) + ["index.ts"]
|
|
27
|
+
|
|
28
|
+
SRC_DEPS = [
|
|
29
|
+
":node_modules/@formatjs/ecma402-abstract",
|
|
30
|
+
":node_modules/@formatjs/icu-messageformat-parser",
|
|
31
|
+
":node_modules/@formatjs/intl-displaynames",
|
|
32
|
+
":node_modules/@formatjs/intl-listformat",
|
|
33
|
+
":node_modules/@formatjs/intl",
|
|
34
|
+
":node_modules/intl-messageformat",
|
|
35
|
+
"//:node_modules/@types/hoist-non-react-statics",
|
|
36
|
+
"//:node_modules/@types/react",
|
|
37
|
+
"//:node_modules/hoist-non-react-statics",
|
|
38
|
+
"//:node_modules/react",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
TESTS = glob([
|
|
42
|
+
"tests/unit/**/*.ts*",
|
|
43
|
+
"tests/unit/**/*.snap",
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
TEST_DEPS = SRC_DEPS + [
|
|
47
|
+
"//:node_modules/@testing-library/jest-dom",
|
|
48
|
+
"//:node_modules/@testing-library/react",
|
|
49
|
+
"//:node_modules/cjs-module-lexer",
|
|
50
|
+
"//:node_modules/react-dom",
|
|
51
|
+
"//:node_modules/typescript",
|
|
52
|
+
":node_modules/@formatjs/intl-numberformat",
|
|
53
|
+
":node_modules/@formatjs/intl-relativetimeformat",
|
|
54
|
+
"//:node_modules/@types/node",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
ts_compile(
|
|
58
|
+
name = "dist",
|
|
59
|
+
srcs = SRCS,
|
|
60
|
+
package = PACKAGE_NAME,
|
|
61
|
+
skip_esm = False,
|
|
62
|
+
deps = SRC_DEPS,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
esbuild(
|
|
66
|
+
name = "%s.esbuild.iife" % PACKAGE_NAME,
|
|
67
|
+
config = {
|
|
68
|
+
"globalName": "ReactIntl",
|
|
69
|
+
},
|
|
70
|
+
entry_point = "lib/index.js",
|
|
71
|
+
external = ["react"],
|
|
72
|
+
target = "es6",
|
|
73
|
+
# TODO: fix this and set it back to es5
|
|
74
|
+
deps = [
|
|
75
|
+
":dist-esm",
|
|
76
|
+
] + SRC_DEPS,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
genrule(
|
|
80
|
+
name = "external-rename",
|
|
81
|
+
srcs = [":%s.esbuild.iife.js" % PACKAGE_NAME],
|
|
82
|
+
outs = ["%s.iife.js" % PACKAGE_NAME],
|
|
83
|
+
cmd = "cat $< | sed -E 's/__require\\(\"react\"\\)/window.React/g' > $@",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
jest_test(
|
|
87
|
+
name = "unit",
|
|
88
|
+
srcs = SRCS + TESTS + [
|
|
89
|
+
"tests/setup.js",
|
|
90
|
+
],
|
|
91
|
+
jest_config = "jest.config.js",
|
|
92
|
+
# TODO: fix
|
|
93
|
+
tags = ["manual"],
|
|
94
|
+
deps = TEST_DEPS,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
jest_test(
|
|
98
|
+
name = "functional",
|
|
99
|
+
srcs = glob(["tests/functional/**/*.ts*"]) + [
|
|
100
|
+
"tests/setup.js",
|
|
101
|
+
"package.json",
|
|
102
|
+
],
|
|
103
|
+
jest_config = "jest.config.js",
|
|
104
|
+
deps = TEST_DEPS + [":dist"],
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
write_source_files(
|
|
108
|
+
name = "tsconfig_json",
|
|
109
|
+
files = {"tsconfig.json": "//tools:tsconfig.golden.json"},
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
check_format(
|
|
113
|
+
name = "prettier",
|
|
114
|
+
srcs = glob(
|
|
115
|
+
[
|
|
116
|
+
"**/*",
|
|
117
|
+
],
|
|
118
|
+
exclude = [
|
|
119
|
+
"CHANGELOG.md",
|
|
120
|
+
"tests/unit/components/__snapshots__/*",
|
|
121
|
+
"**/.env",
|
|
122
|
+
"**/.gitignore",
|
|
123
|
+
],
|
|
124
|
+
),
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
package_json_test(
|
|
128
|
+
name = "package_json_test",
|
|
129
|
+
deps = SRC_DEPS,
|
|
130
|
+
)
|