Skip to content

Commit f6479e6

Browse files
committed
feat: rebase API2.0 into main
1 parent 01f51b4 commit f6479e6

File tree

24 files changed

+5700
-720
lines changed

24 files changed

+5700
-720
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ node_modules
22
.idea
33
.vscode
44
package-lock.json
5-
pnpm-lock.yaml
5+
/packages/**/node_modules
66
/packages/inula-cli/lib
77
build
8+
dist
89
/packages/inula-router/connectRouter
910
/packages/inula-router/router
10-
dist
11-
.history
11+
.turbo
12+
coverage

demos/benchmark/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "dev",
2+
"name": "next-benchmark",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",

demos/v2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "dev",
2+
"name": "next-dev",
33
"private": true,
44
"version": "0.0.6",
55
"type": "module",

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"name": "inula",
33
"description": "Inula is a JavaScript framework library.",
44
"private": true,
5-
"packageManager": "pnpm@8.15.4",
5+
"packageManager": "pnpm@10.4.1",
66
"scripts": {
77
"lint": "eslint . --ext .ts --fix",
88
"lint-commit": "lint-staged",
99
"prettier": "prettier .prettierrc.js -w packages/**/*.{ts,tsx,js,jsx}",
10+
"build": "turbo build",
11+
"test": "turbo test",
12+
"release": "pnpm run build && changeset publish",
1013
"build:inula": "pnpm -F openinula build",
1114
"test:inula": "pnpm -F openinula test",
1215
"test:inula-intl": "pnpm -F inula-intl test",
@@ -16,11 +19,8 @@
1619
"build:inula-intl": "pnpm -F inula-intl rollup-build",
1720
"build:inula-request": "pnpm -F inula-request build",
1821
"build:inula-router": "pnpm -F inula-router build",
19-
"build:transpiler": "pnpm --filter './packages/transpiler/*' run build",
20-
"build:inula-next": "pnpm -F inula-next build",
2122
"commitlint": "commitlint --config commitlint.config.js -e",
22-
"postinstall": "husky install",
23-
"publish": "changeset publish"
23+
"postinstall": "husky install"
2424
},
2525
"lint-staged": {
2626
"*.{js,jsx,ts,tsx}": [
@@ -56,6 +56,7 @@
5656
"@babel/preset-env": "7.23.8",
5757
"@babel/preset-typescript": "7.23.3",
5858
"@babel/runtime": "7.23.8",
59+
"@changesets/cli": "^2.28.1",
5960
"@commitlint/cli": "^17.8.1",
6061
"@commitlint/config-conventional": "^17.8.1",
6162
"@rollup/plugin-babel": "^6.0.4",
@@ -82,14 +83,11 @@
8283
"rollup-plugin-dts": "^6.1.0",
8384
"rollup-plugin-terser": "^7.0.2",
8485
"ts-jest": "^29.1.1",
86+
"turbo": "^2.4.2",
8587
"typescript": "^4.9.5"
8688
},
8789
"engines": {
8890
"node": ">=10.x",
8991
"npm": ">=7.x"
90-
},
91-
"dependencies": {
92-
"@changesets/cli": "^2.27.1",
93-
"changeset": "^0.2.6"
9492
}
9593
}

packages/create-inula/lib/generators/Simple-app/templates/webpack/src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
</head>
77
<body>
88
<div id="root"></div>
9+
<script src="../dist/bundle.js"></script>
910
</body>
1011
</html>

packages/create-inula/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-inula",
3-
"version": "0.0.9",
3+
"version": "1.0.22",
44
"description": "",
55
"main": "index.js",
66
"bin": {

packages/inula-cli/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ inula-cli的推荐目录结构如下:
5454
│ └── inula-cli
5555
│ ├── lib
5656
├── mock // mock目录
57-
│ └── transform.ts
57+
│ └── mock.ts
5858
├── src // 项目源码目录
5959
│ ├── pages
6060
│ │ ├── index.less
@@ -178,10 +178,10 @@ inula-cli的所有功能都围绕插件展开,插件可以很方便地让用
178178

179179
inula-cli支持用户集成已发布在npm仓库的插件,用户可以按需安装并运行这些插件。
180180

181-
安装可以通过npm安装,这里以插件@openinula/add为例:
181+
安装可以通过npm安装,这里以插件@inula/add为例:
182182

183183
```shell
184-
npm i --save-dev @openinula/add
184+
npm i --save-dev @inula/add
185185
```
186186

187187
如果需要运行插件,需要在配置文件中配置对应的插件路径
@@ -191,7 +191,7 @@ npm i --save-dev @openinula/add
191191

192192
export default {
193193
...
194-
plugins:["@openinula/add"]
194+
plugins:["@inula/add"]
195195
}
196196
```
197197

packages/inula-intl/src/format/fomatters/PluralFormatter.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ class PluralFormatter {
2727
private readonly locales: Locales;
2828
private readonly value: number;
2929
private readonly message: any;
30-
private readonly cache: I18nCache;
31-
32-
constructor(locale: Locale, locales: Locales, value: any, message: any, cache?: I18nCache) {
30+
constructor(locale: Locale, locales: Locales, value: any, message: any) {
3331
this.locale = locale;
3432
this.locales = locales;
3533
this.value = value;
3634
this.message = message;
37-
this.cache = cache ?? creatI18nCache();
3835
}
3936

4037
// 将 message中的“#”替换为指定数字value,并返回新的字符串或者字符串数组
@@ -45,19 +42,6 @@ class PluralFormatter {
4542
const numberFormatter = new NumberFormatter(this.locales);
4643
const valueStr = numberFormatter.numberFormat(this.value);
4744

48-
if (this.cache.octothorpe) {
49-
// 创建key,用于唯一标识
50-
const cacheKey = utils.generateKey<Intl.NumberFormatOptions>(this.locale, this.message);
51-
52-
// 如果key存在,则使用缓存中的替代
53-
if (this.cache.octothorpe[cacheKey]) {
54-
return messages.map(msg => (typeof msg === 'string' ? msg.replace('#', this.cache.octothorpe[cacheKey]) : msg));
55-
}
56-
57-
// 如果不存在,则进行缓存
58-
this.cache.octothorpe[cacheKey] = valueStr;
59-
}
60-
6145
return messages.map(msg => (typeof msg === 'string' ? msg.replace('#', valueStr) : msg));
6246
}
6347
}

packages/inula-request/src/utils/commonUtils/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ function getObjectByArray(arr: any[]): Record<string, any> {
443443
}, {});
444444
}
445445

446-
function filterUndefinedValues(obj: Record<any, any>) {
447-
return Object.keys(obj).reduce((result, key) => {
446+
function filterUndefinedValues<T extends Record<string, any>>(obj: T): Partial<T> {
447+
return Object.keys(obj).reduce((result: Partial<T>, key: keyof T) => {
448448
if (obj[key] !== undefined && obj[key] !== null) {
449449
result[key] = obj[key];
450450
}

packages/inula-request/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"allowJs": true,
77
"strict": true,
88
"lib": ["DOM", "DOM.Iterable", "ESNext", "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020"],
9-
"suppressImplicitAnyIndexErrors": true,
109
"esModuleInterop": true,
1110
"declaration": true,
1211
"moduleResolution": "node",

0 commit comments

Comments
 (0)