@intl-party/react 1.0.0 → 1.1.1
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/dist/index.js +1 -0
- package/dist/index.mjs +2 -0
- package/dist/server.js +48 -0
- package/dist/server.mjs +21 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/dist/server.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/server.ts
|
|
21
|
+
var server_exports = {};
|
|
22
|
+
__export(server_exports, {
|
|
23
|
+
I18nProvider: () => I18nProvider,
|
|
24
|
+
useLocale: () => useLocale,
|
|
25
|
+
useTranslations: () => useTranslations
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(server_exports);
|
|
28
|
+
function useTranslations() {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"useTranslations() is a client-side hook and cannot be used in Server Components. Use getServerTranslations() from @intl-party/nextjs/server instead."
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function useLocale() {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"useLocale() is a client-side hook and cannot be used in Server Components. Use getLocale() from @intl-party/nextjs/server instead."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function I18nProvider() {
|
|
39
|
+
throw new Error(
|
|
40
|
+
"I18nProvider is a client component and cannot be used in Server Components. Use AppI18nProvider from @intl-party/nextjs in a client component instead."
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
I18nProvider,
|
|
46
|
+
useLocale,
|
|
47
|
+
useTranslations
|
|
48
|
+
});
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/server.ts
|
|
2
|
+
function useTranslations() {
|
|
3
|
+
throw new Error(
|
|
4
|
+
"useTranslations() is a client-side hook and cannot be used in Server Components. Use getServerTranslations() from @intl-party/nextjs/server instead."
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
function useLocale() {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"useLocale() is a client-side hook and cannot be used in Server Components. Use getLocale() from @intl-party/nextjs/server instead."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
function I18nProvider() {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"I18nProvider is a client component and cannot be used in Server Components. Use AppI18nProvider from @intl-party/nextjs in a client component instead."
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
I18nProvider,
|
|
19
|
+
useLocale,
|
|
20
|
+
useTranslations
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-party/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "React integration for IntlParty - hooks, context, and components for type-safe i18n",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"react-server": "./dist/server.js",
|
|
10
11
|
"import": "./dist/index.mjs",
|
|
11
12
|
"require": "./dist/index.js",
|
|
12
13
|
"types": "./dist/index.d.ts"
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"directory": "packages/react"
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
|
-
"build": "tsup src/index.tsx --format cjs,esm --external react,react-dom",
|
|
56
|
+
"build": "tsup src/index.tsx src/server.ts --format cjs,esm --external react,react-dom",
|
|
56
57
|
"dev": "tsup src/index.tsx --format cjs,esm --external react,react-dom --watch",
|
|
57
58
|
"test": "vitest",
|
|
58
59
|
"test:watch": "vitest --watch",
|