Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat vite #1184

Open
wants to merge 342 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
342 commits
Select commit Hold shift + click to select a range
dab176d
feat(\): tsup
mater1996 Sep 6, 2022
c62d497
feat: tsup
mater1996 Sep 6, 2022
25a289f
Merge branch 'master' of github.com:yandadaFreedom/mpx
mater1996 Sep 6, 2022
cc7b20b
fix: gen dts when dev
mater1996 Sep 7, 2022
d7d8bc9
fix: compiler dep'
mater1996 Sep 7, 2022
f59a353
fix: add webConfig support
mater1996 Sep 7, 2022
b5514cd
feat: proxy pluginContext
mater1996 Sep 7, 2022
fc238b6
feat: add format
mater1996 Sep 7, 2022
d70e630
test
yandadaFreedom Sep 7, 2022
a7549d8
update: 删除代码
yandadaFreedom Sep 7, 2022
db06e68
fix: import order
mater1996 Sep 7, 2022
5bbbb4d
fix: 修复lint报错
yandadaFreedom Sep 8, 2022
ac21c09
update: 修改 mpx 引用路径
yandadaFreedom Sep 13, 2022
e4bd260
update: 修改 mpx 引用路径
yandadaFreedom Sep 13, 2022
32d22c2
update: 还原doc
yandadaFreedom Sep 13, 2022
74253f9
update: 还原
yandadaFreedom Sep 13, 2022
0ba3e16
update: 还原
yandadaFreedom Sep 13, 2022
3711772
update: 还原
yandadaFreedom Sep 13, 2022
296c578
update: 修复lint报错
yandadaFreedom Sep 13, 2022
5dd4096
fix: eslint不生效问题
yandadaFreedom Sep 14, 2022
c2c36ff
Merge pull request #2 from yandadaFreedom/feat-mpx
yandadaFreedom Sep 14, 2022
2a18d97
update: 添加依赖
yandadaFreedom Sep 14, 2022
4b2f54f
feat: dts in production
mater1996 Sep 14, 2022
14a256d
udapte: 新增 loaders 文件夹
yandadaFreedom Sep 14, 2022
c8d3429
fix: options eslint error
mater1996 Sep 14, 2022
cda857d
feat: support css sourcempa
mater1996 Sep 15, 2022
2dc59ab
update: 修改 lint 报错
yandadaFreedom Sep 15, 2022
9da1cb1
update: 添加 lint
yandadaFreedom Sep 15, 2022
e2ea3b7
修改file-loader&pre-loader
Sep 15, 2022
dc5eec9
update: 修改 lint 报错
yandadaFreedom Sep 15, 2022
bbd194c
Merge branch 'didi:master' into master
yandadaFreedom Sep 15, 2022
c8fd21e
Merge branch 'master' into feat-mpx-loader
yandadaFreedom Sep 15, 2022
99aa281
update: 修改mpx对象引用方式
yandadaFreedom Sep 16, 2022
93b1bde
update: 同步远端代码
yandadaFreedom Sep 16, 2022
3fe46fb
update: 添加gitignore
yandadaFreedom Sep 16, 2022
cca6656
update: 修改 mpx
yandadaFreedom Sep 19, 2022
b33eb19
Merge pull request #4 from yandadaFreedom/feat-mpx
mater1996 Sep 20, 2022
d24a09f
update: cr
yandadaFreedom Sep 20, 2022
64944a6
Merge remote-tracking branch 'origin/feat-mpx' into feat-mpx-loader
mater1996 Sep 20, 2022
32f8c19
fix: vite processOptions params error
mater1996 Sep 20, 2022
c2a4eb1
Merge branch 'feat-mpx-loader' of https://github.com/yandadaFreedom/m…
yandadaFreedom Sep 20, 2022
3f52da4
fix: transRpxRules ts
mater1996 Sep 20, 2022
ca12098
fix: resolve page path with base
mater1996 Sep 20, 2022
c0e8ba4
update: 修改mpx对象生成&解决ts报错
yandadaFreedom Sep 20, 2022
85a5cc9
Merge branch 'feat-mpx-loader' of https://github.com/yandadaFreedom/m…
yandadaFreedom Sep 20, 2022
2138d20
update: update demo
yandadaFreedom Sep 20, 2022
74d7d17
update: 调整目录
yandadaFreedom Sep 20, 2022
6d0d7e1
update: 合并d,ts
yandadaFreedom Sep 21, 2022
bc514fd
Merge branch 'master' into feat-mpx-loader
yandadaFreedom Sep 21, 2022
92e9ce6
update: 修改demo
yandadaFreedom Sep 21, 2022
66311fc
update: 修改demo
yandadaFreedom Sep 21, 2022
587b268
Merge branch 'didi:master' into master
yandadaFreedom Sep 21, 2022
6725a4e
update: 同步master
yandadaFreedom Sep 21, 2022
92b8f48
Merge branch 'master' into feat-mpx-loader
yandadaFreedom Sep 21, 2022
6d99e27
feat: package spilt chunk
mater1996 Sep 22, 2022
dd350f9
update: 删除无用配置
yandadaFreedom Sep 23, 2022
dde17ba
update: 修改utils
yandadaFreedom Sep 23, 2022
28b9057
update: 整理 uitls
yandadaFreedom Sep 25, 2022
a9733f3
fix: 修复 onshow 不生效问题
yandadaFreedom Sep 26, 2022
4b3eaf9
Merge branch 'feat-mpx-loader' into feat-mpx-utils-multiplexi
yandadaFreedom Sep 26, 2022
25927da
修改demo
yandadaFreedom Oct 4, 2022
c34d404
update: add tsc script
yandadaFreedom Oct 7, 2022
0956366
fix: error path
yandadaFreedom Oct 7, 2022
9c4d990
fix: script src resolve path
mater1996 Oct 9, 2022
b5b8d18
fix: sourcemap error
mater1996 Oct 9, 2022
ab791db
Merge branch 'feat-mpx-loader' into feat-mpx-utils-multiplexi
yandadaFreedom Oct 9, 2022
f9fa2f1
fix: sourcemap lost
mater1996 Oct 9, 2022
766fd7b
update: 修改utils引用
yandadaFreedom Oct 9, 2022
c781012
修改包引入
yandadaFreedom Oct 9, 2022
6339f71
Merge pull request #5 from yandadaFreedom/feat-mpx-utils-multiplexi
yandadaFreedom Oct 9, 2022
52b787e
update: rename file
yandadaFreedom Oct 9, 2022
5b36fab
update: 修改测试demo
yandadaFreedom Oct 9, 2022
47883bd
fix: query null
mater1996 Oct 10, 2022
d76476c
update: 同步代码 支持 checkUsingComponentsRules
yandadaFreedom Oct 10, 2022
4c174ef
Merge branch 'didi:master' into master
yandadaFreedom Oct 10, 2022
613a1a4
Merge branch 'master' into feat-mpx-loader
yandadaFreedom Oct 10, 2022
bd7c698
update: 合并代码
yandadaFreedom Oct 10, 2022
e2df0e3
Merge branch 'feat-mpx-loader' of https://github.com/yandadaFreedom/m…
yandadaFreedom Oct 10, 2022
bf38582
fix: extensions regexp
mater1996 Oct 12, 2022
9bae385
update: utils包重命名
yandadaFreedom Oct 13, 2022
8cd96e9
Merge branch 'feat-mpx-loader' into feat-ts-build
yandadaFreedom Oct 13, 2022
98ef66e
update: 修改引用包名
yandadaFreedom Oct 13, 2022
31ccf02
update
yandadaFreedom Oct 14, 2022
22988d2
update: build cjs
yandadaFreedom Oct 14, 2022
fb90863
update: package script
yandadaFreedom Oct 14, 2022
d8e639f
fix: mpx.i18n undefined
mater1996 Oct 18, 2022
90ba86b
Merge branch 'feat-mpx-loader' into feat-ts-build
yandadaFreedom Oct 20, 2022
427c0c9
feat: 修改构建方式
yandadaFreedom Oct 20, 2022
b17379d
feat: 修改构建方式
yandadaFreedom Oct 20, 2022
d44f794
refactor: 删除 utils dist
yandadaFreedom Oct 20, 2022
4207e73
fix: error code
yandadaFreedom Oct 20, 2022
003c8c2
Merge pull request #6 from yandadaFreedom/feat-ts-build
yandadaFreedom Oct 21, 2022
3d30685
refactor: 修改入口
yandadaFreedom Oct 21, 2022
7a530d9
fix: i18n
mater1996 Oct 28, 2022
38d77ed
Merge branch 'feat-mpx-loader' of github.com:yandadaFreedom/mpx into …
mater1996 Oct 28, 2022
089632e
feat: style transform
mater1996 Nov 17, 2022
37e7421
fix: style ts
mater1996 Nov 17, 2022
46aff2a
feat: pnpm
mater1996 Nov 17, 2022
1baf606
fix: remove yarn
mater1996 Nov 17, 2022
f062b42
fix: remove workspace
mater1996 Nov 17, 2022
433d9bb
save
yandadaFreedom Nov 17, 2022
6ff9143
fix: lock
mater1996 Nov 17, 2022
98bc93b
fix: style options
mater1996 Nov 17, 2022
0dc2ace
fix: template compiler
mater1996 Nov 17, 2022
67bbaaf
save
yandadaFreedom Nov 21, 2022
7894157
Merge branch 'feat-mpx-loader' into feat-mpx-transfrom
yandadaFreedom Nov 21, 2022
00de2ed
save
yandadaFreedom Nov 21, 2022
d4200cf
refactor: 修改processJSON
yandadaFreedom Nov 21, 2022
19da0b8
refactor: 删除废弃文件
yandadaFreedom Nov 21, 2022
b7b4049
fix: 执行顺序问题
yandadaFreedom Nov 21, 2022
5c8dd64
refactor: 格式
yandadaFreedom Nov 21, 2022
25db946
refactor: query格式拉齐
yandadaFreedom Nov 21, 2022
c9ed438
fix: 图片处理失败问题
yandadaFreedom Nov 22, 2022
3d34ace
fix: file-loader处理异常
yandadaFreedom Nov 22, 2022
6cdc2c0
fix: file-loader处理异常
yandadaFreedom Nov 22, 2022
322a9ab
fix: build error
mater1996 Nov 22, 2022
7a4a7d5
feat: npm rc
mater1996 Nov 23, 2022
f6eda6d
feat: 拉齐localPagesMap格式
yandadaFreedom Nov 28, 2022
02865da
refactor: 优化
yandadaFreedom Nov 28, 2022
ad0a613
feat: 添加 packages demo
yandadaFreedom Nov 28, 2022
8ff307f
feat: 修改demo
yandadaFreedom Nov 28, 2022
3df5462
Merge branch 'feat-mpx-loader' of https://github.com/yandadaFreedom/m…
yandadaFreedom Nov 28, 2022
a67974d
Merge branch 'feat-mpx-loader' into feat-mpx-transfrom
yandadaFreedom Nov 28, 2022
a68e2fd
refactor: 优化
yandadaFreedom Nov 28, 2022
d1cd8ac
refactor: 修改processPackages逻辑
yandadaFreedom Dec 1, 2022
50c238d
update: demo
yandadaFreedom Dec 1, 2022
e4c5745
fix: not found fast-glob
mater1996 Dec 1, 2022
f34e990
fix: resolve entry error
mater1996 Dec 1, 2022
50cb6a7
Merge branch 'feat-mpx-loader' into feat-mpx-transfrom
yandadaFreedom Dec 1, 2022
41c929c
refactor: 修改processPackages逻辑
yandadaFreedom Dec 1, 2022
2203020
fix: pnpm install
mater1996 Dec 1, 2022
ea88d51
Merge branch 'feat-mpx-loader' into feat-mpx-transfrom
yandadaFreedom Dec 1, 2022
e754bc1
feat: loader 添加缺失依赖
yandadaFreedom Dec 1, 2022
e79262b
Merge branch 'feat-mpx-loader' into feat-mpx-transfrom
yandadaFreedom Dec 1, 2022
6d1b4c2
refactor: 修改 json 处理逻辑整体提交
yandadaFreedom Dec 5, 2022
cb8b708
refactor: 删除废弃json逻辑
yandadaFreedom Dec 5, 2022
c1e43ad
refactor: 重写pathHash & getOutputPath
yandadaFreedom Dec 5, 2022
6c3dd18
refactor: processTemplate
yandadaFreedom Dec 6, 2022
d246acb
refactor: processTemplate
yandadaFreedom Dec 6, 2022
9ac32b2
fix: webpack processTemplate
yandadaFreedom Dec 6, 2022
6988ca8
refactor: 优化代码
yandadaFreedom Dec 7, 2022
72d03c5
refacrot:修改demo
yandadaFreedom Dec 7, 2022
9a222e8
refactor: 安装依赖包
yandadaFreedom Dec 7, 2022
718b12d
fix: async 判断
yandadaFreedom Dec 7, 2022
4d917cc
refacrot:修改demo
yandadaFreedom Dec 7, 2022
33c8052
Merge branch 'feat-mpx-loader' into feat-mpx-transfrom
yandadaFreedom Dec 7, 2022
3c965d0
refacrot:修改demo
yandadaFreedom Dec 7, 2022
490ab83
fix: mpx-tab-bar组件中global.__tabBar获取时机
yandadaFreedom Dec 7, 2022
cd086ad
fix: mpx-tab-bar组件中global.__tabBar获取时机
yandadaFreedom Dec 7, 2022
e3f6575
fix: 处理组件独立构建
yandadaFreedom Dec 7, 2022
eb8a457
feat: 添加ts定义
yandadaFreedom Dec 7, 2022
9f62c5f
fix: 修复部分ts报错
yandadaFreedom Dec 7, 2022
9c4f496
refacrot:add ts ignore
yandadaFreedom Dec 9, 2022
cc520b2
feat: 处理 script 逻辑
yandadaFreedom Dec 12, 2022
2786c98
feat: 处理 script 逻辑
yandadaFreedom Dec 12, 2022
fe3e1b0
feat: transfrom to vue-plugin
mater1996 Dec 14, 2022
d9b7d7f
feat: vue-plugin
mater1996 Dec 14, 2022
09e886b
Merge branch 'feat-mpx-loader' of github.com:yandadaFreedom/mpx into …
mater1996 Dec 14, 2022
ee2076c
feat: vue2.7
mater1996 Dec 14, 2022
ef16972
feat: vue 2.7
mater1996 Dec 14, 2022
04d9de4
fix: sourcemap
mater1996 Dec 15, 2022
f360c59
fix: script sourcemap
mater1996 Dec 15, 2022
9ec4e03
fix: hotupdate return
mater1996 Dec 15, 2022
b789bc5
fix: remove unused resolve
mater1996 Dec 15, 2022
285ed89
fix: transformPluginContext
mater1996 Dec 15, 2022
aeae1de
fix: build error
mater1996 Dec 15, 2022
5fc532c
feat: build error
mater1996 Dec 15, 2022
483eadf
Merge branch 'feat-mpx-transform-v2' into feat-mpx-loader
yandadaFreedom Dec 15, 2022
7dfb9ac
Merge branch 'feat-mpx-loader' of https://github.com/yandadaFreedom/m…
yandadaFreedom Dec 15, 2022
98fd162
fix: tab-bar
yandadaFreedom Dec 15, 2022
60e59d5
Merge branch 'feat-mpx-transform-v2' into feat-mpx-loader
yandadaFreedom Dec 15, 2022
d045e26
Merge branch 'master' of https://github.com/yandadaFreedom/mpx
yandadaFreedom Dec 21, 2022
3fb7317
feat: 修改AddEnvPlugin,AddModePlugin文件路径
yandadaFreedom Dec 22, 2022
22603c8
fix: ts报错
yandadaFreedom Dec 22, 2022
8f65951
feat: 同步代码
yandadaFreedom Dec 27, 2022
da1e128
fix: 二进制文件获取乱码
yandadaFreedom Dec 27, 2022
957a2a2
feat: 升级 bs
yandadaFreedom Dec 27, 2022
a2cbcfc
fix: i18n ts 报错
yandadaFreedom Dec 28, 2022
3742c6f
refactor: 修改 hasScoped 传参处理
yandadaFreedom Jan 5, 2023
e585c28
fix: compiler-utils type
mater1996 Jan 31, 2023
ace8da6
feat: 分离plugin-proxy
mater1996 Feb 3, 2023
5190848
fix: readme
mater1996 Feb 3, 2023
9724cee
fix: mpx
mater1996 Feb 3, 2023
ad20198
fix: getOptions
mater1996 Feb 3, 2023
ad0a5fd
fix: mpx
mater1996 Feb 3, 2023
2f1d1b1
feat: mpx and options optimize
mater1996 Feb 6, 2023
5054d14
feat: mpx and options optimize
mater1996 Feb 6, 2023
7d9b01c
fix: webpack build
mater1996 Feb 6, 2023
350871a
fix: mpx and web optimize
mater1996 Feb 6, 2023
20f02cf
fix: tabbar gen
mater1996 Feb 6, 2023
24d85f9
feat: webpack resolve json content
mater1996 Feb 7, 2023
075b801
fix: type options
mater1996 Feb 7, 2023
a00826b
fix: processjson
mater1996 Feb 7, 2023
7b16424
fix: loader-utils type extend
mater1996 Feb 7, 2023
63c3af6
fix: replace type main to hot
mater1996 Feb 7, 2023
dd51a0e
fix: 热更新失败当json配置变化时
mater1996 Feb 8, 2023
68a2c4b
fix: rename
mater1996 Feb 10, 2023
c2b6268
fix: 热更新导致主文件更新多次
mater1996 Feb 10, 2023
627a5b6
Merge branch 'master' of https://github.com/yandadaFreedom/mpx
yandadaFreedom Feb 10, 2023
7d0421f
fix: hotupdate
mater1996 Feb 13, 2023
8e71f64
fix: vite version
mater1996 Feb 13, 2023
6e77e61
feat: merge conflict
mater1996 Feb 13, 2023
c228a4f
feat: merge master
mater1996 Feb 13, 2023
07efdef
fix: dep version
mater1996 Feb 13, 2023
006f771
feat: dep version
mater1996 Feb 13, 2023
8e9aef3
fix: eslint
mater1996 Feb 13, 2023
3f4be0e
chore: pnpm lock
mater1996 Feb 14, 2023
1f0d0c9
feat: merge 2.8
mater1996 Feb 14, 2023
623cf2b
feat: 合并2.8代码
yandadaFreedom Feb 14, 2023
adfb682
feat: 修改测试demo
yandadaFreedom Feb 14, 2023
313a352
fix: components/web 组件 util 引用路径
yandadaFreedom Feb 14, 2023
ceef554
fix: 修改被覆盖的code
yandadaFreedom Feb 14, 2023
5c1b5c9
fix: 修改被覆盖的code
yandadaFreedom Feb 14, 2023
34c2ee9
Merge pull request #7 from yandadaFreedom/feat-mpx-2.8-part
yandadaFreedom Feb 14, 2023
e55db62
fix: dep version
mater1996 Feb 14, 2023
b297ff4
feat: 同步url-loder&script-setup-complier最新code
yandadaFreedom Feb 14, 2023
b8473c4
Merge branch 'feat-mpx-web-release' of https://github.com/yandadaFree…
yandadaFreedom Feb 14, 2023
17ff9be
fix: add core-js-pure for symlink
mater1996 Feb 15, 2023
700bf3a
Merge branch 'feat-mpx-web-release' of github.com:yandadaFreedom/mpx …
mater1996 Feb 15, 2023
af18afa
fix: i18n
mater1996 Feb 15, 2023
9ee9cab
fix: 修改@mpxjs/webpack-plugin包引用
yandadaFreedom Feb 15, 2023
b4ff2c3
feat: 修改loaders包导出路径&整体 demo package
yandadaFreedom Feb 15, 2023
d3aa876
feat: 修改@mpxjs/webpack-plugin引用路径
yandadaFreedom Feb 15, 2023
2559c04
fix: pnpm
mater1996 Feb 16, 2023
8c2db86
Merge branch 'feat-mpx-web-release' of github.com:yandadaFreedom/mpx …
mater1996 Feb 16, 2023
780f385
fix: registry
mater1996 Feb 16, 2023
6972ffa
fix: remove test
mater1996 Feb 16, 2023
a2a347b
fix: api-proxy dep
mater1996 Feb 16, 2023
1b6c863
fix: peer dep
mater1996 Feb 16, 2023
4e3149e
fix: remove console
mater1996 Feb 16, 2023
1d359a6
fix: registry
mater1996 Feb 16, 2023
f7afac0
feat: 修改template-helper文件名
yandadaFreedom Feb 16, 2023
fdfd00a
Merge branch 'feat-mpx-web-release' of https://github.com/yandadaFree…
yandadaFreedom Feb 16, 2023
df91db4
Merge branch 'master' of https://github.com/yandadaFreedom/mpx
yandadaFreedom Feb 21, 2023
671f851
Merge branch 'master' into feat-mpx-web-release
yandadaFreedom Feb 21, 2023
34e653a
Merge pull request #1177 from yandadaFreedom/feat-mpx-web-release
Blackgan3 Feb 21, 2023
bd39955
feat: refactor compiler
mater1996 Feb 23, 2023
89a125d
fix: remove dist
mater1996 Feb 23, 2023
09b3c70
fix: ts error
mater1996 Feb 24, 2023
7170bb2
feat: vite script setup
mater1996 Feb 24, 2023
e43cb46
feat: rename
mater1996 Feb 24, 2023
7962924
fix: path error
yandadaFreedom Feb 24, 2023
524f94b
feat: delete plugin-proxy script
yandadaFreedom Feb 24, 2023
1f28fb3
fix: pnpm install compiler package error
yandadaFreedom Feb 24, 2023
904fdad
fix: setup sourcemap
mater1996 Mar 1, 2023
52279fe
chrom: 调整package dep & 修复eslint
yandadaFreedom Mar 2, 2023
a9152bb
Merge branch 'master' into feat-vite
yandadaFreedom Mar 2, 2023
b79baa6
feat: update eslintrc
yandadaFreedom Mar 2, 2023
d905a57
fix: learn error - Package name "build" used in multiple packages
yandadaFreedom Mar 2, 2023
51533a9
fix: learn error - Package name "build" used in multiple packages
yandadaFreedom Mar 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 15 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
module.exports = {
root: true,
parser: '@babel/eslint-parser',
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module'
},
extends: 'standard',
extends: [
'plugin:@typescript-eslint/recommended',
'standard'
],
plugins: [
'@typescript-eslint',
'html',
'jest'
],
Expand All @@ -27,10 +31,18 @@ module.exports = {
getCurrentPages: 'readonly'
},
rules: {
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'no-cond-assign': 0,
camelcase: 0
},
env: {
'jest/globals': true
'jest/globals': true,
es6: true,
browser: true,
node: true
}
}
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- name: generate docs file
if: env.GIT_DIFF
run: |
cd docs-vueporess
npm i
npm run docs:build

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ package-lock.json
pnpm-lock.yaml
yarn.lock
.DS_Store
docs-vuepress/.vuepress/dist
docs-vuepress/docs/.vuepress/dist
elevate/
.yarn/
packages/**/dist/
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry = https://registry.npmjs.org/
auto-install-peers = true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.21.1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
131 changes: 131 additions & 0 deletions docs-vuepress/docs/guide/extend/request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# 网络请求


Mpx 提供了网络请求库 fetch,抹平了微信,阿里等平台请求参数及响应数据的差异;同时支持请求拦截器,请求取消等


## 使用说明

```js
import mpx from '@mpxjs/core'
import mpxFetch from '@mpxjs/fetch'
mpx.use(mpxFetch)
// 第一种访问形式
mpx.xfetch.fetch({
url: 'http://xxx.com'
}).then(res => {
console.log(res.data)
})

mpx.createApp({
onLaunch() {
// 第二种访问形式
this.$xfetch.fetch({url: 'http://test.com'})
}
})
```

## 导出说明

mpx-fetch提供了一个实例 **xfetch** ,该实例包含以下api

- fetch(config), 正常的promisify风格的请求方法
- CancelToken,实例属性,用于创建一个取消请求的凭证。
- interceptors,实例属性,用于添加拦截器,包含两个属性,request & response

## 请求拦截器

```js
mpx.xfetch.interceptors.request.use(function(config) {
console.log(config)
// 也可以返回promise
return config
})
mpx.xfetch.interceptors.response.use(function(res) {
console.log(res)
// 也可以返回promise
return res
})
```

## 请求中断

```js
const cancelToken = new mpx.xfetch.CancelToken()
mpx.xfetch.fetch({
url: 'http://xxx.com',
data: {
name: 'test'
},
cancelToken: cancelToken.token
})
cancelToken.exec('手动取消请求') // 执行后请求中断,返回abort fail
```

## 设置请求参数
```js
mpx.xfetch.fetch({
url: 'http://xxx.com',
params: {
name: 'test'
}
})

mpx.xfetch.fetch({
url: 'http://xxx.com',
method: 'POST',
// params 参数等价于 url query
params: {
age: 10
},
data: {
name: 'test'
},
// 设置参数序列化方式,等价于header = {'content-type': 'application/x-www-form-urlencoded'}
emulateJSON: true
})
```

## 设置请求 timeout

```js
mpx.xfetch.fetch({
url: 'http://xxx.com',
method: 'POST',
data: {
name: 'test'
},
timeout: 10000 // 超时时间
})
```

## 在组合式 API 中使用 {#composition-api-usage}
在组合式 API 中我们提供了 [useFetch](/api/extend.html#usefetch) 方法来访问 `xfetch` 实例对象

```js
// app.mpx
import mpx, { createComponent } from '@mpxjs/core'
import { useFetch } from '@mpxjs/fetch'

createComponent({
setup() {
useFetch().fetch({
url: 'http://xxx.com',
method: 'POST',
params: {
age: 10
},
data: {
name: 'test'
},
emulateJSON: true,
usePre: true,
cacheInvalidationTime: 3000,
ignorePreParamKeys: ['timestamp']
}).then(res => {
console.log(res.data)
})
}
})

```
File renamed without changes.
14 changes: 14 additions & 0 deletions docs-vuepress/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "mpx-docs",
"description": "mpx docs",
"private": true,
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
},
"devDependencies": {
"@vuepress/plugin-back-to-top": "^1.8.2",
"@vuepress/plugin-pwa": "^1.8.0",
"vuepress": "^1.9.7"
}
}
2 changes: 1 addition & 1 deletion examples/mpx-cloud/babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@babel/transform-runtime",
{
"corejs": 3,
"version": "^7.12.5"
"version": "^7.20.13"
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-cloud/build/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "build",
"name": "mpx-cloud-build",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
2 changes: 1 addition & 1 deletion examples/mpx-cloud/config/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "config",
"name": "mpx-cloud-config",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
10 changes: 5 additions & 5 deletions examples/mpx-cloud/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mpx-cloud",
"name": "mpx-cloud-demo",
"version": "1.0.0",
"description": "A mpx project",
"main": "index.js",
Expand All @@ -19,16 +19,16 @@
"author": "sky-admin <[email protected]>",
"license": "ISC",
"dependencies": {
"@mpxjs/api-proxy": "^2.7.28",
"@mpxjs/core": "^2.7.26"
"@mpxjs/api-proxy": "workspace:*",
"@mpxjs/core": "workspace:*"
},
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/eslint-parser": "7.16.0",
"@babel/plugin-transform-runtime": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/runtime-corejs3": "7.12.5",
"@mpxjs/webpack-plugin": "^2.7.27",
"@babel/runtime-corejs3": "7.20.13",
"@mpxjs/webpack-plugin": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"babel-jest": "^25.3.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-i18n/babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@babel/transform-runtime",
{
"corejs": 3,
"version": "^7.12.5"
"version": "^7.20.13"
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-i18n/build/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "build",
"name": "mpx-i18n-build",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
2 changes: 1 addition & 1 deletion examples/mpx-i18n/config/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "config",
"name": "mpx-i18n-config",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
12 changes: 6 additions & 6 deletions examples/mpx-i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mpx-subpackage-demo",
"name": "mpx-i18n-demo",
"version": "1.0.0",
"description": "A mpx project",
"main": "index.js",
Expand All @@ -19,16 +19,16 @@
"author": "sky-admin <[email protected]>",
"license": "ISC",
"dependencies": {
"@mpxjs/api-proxy": "^2.7.28",
"@mpxjs/core": "^2.7.26"
"@mpxjs/api-proxy": "workspace:*",
"@mpxjs/core": "workspace:*"
},
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/eslint-parser": "7.16.0",
"@babel/plugin-transform-runtime": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/runtime-corejs3": "7.12.5",
"@mpxjs/webpack-plugin": "^2.7.27",
"@babel/runtime-corejs3": "7.20.13",
"@mpxjs/webpack-plugin": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"babel-jest": "^25.3.0",
Expand Down Expand Up @@ -59,7 +59,7 @@
"vue-loader": "^15.9.3",
"vue-router": "^3.1.3",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.10",
"vue-template-compiler": "~2.6.10",
"ts-loader": "9.2.6",
"typescript": "^4.1.3",
"webpack": "^5.72.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-progressive/babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@babel/transform-runtime",
{
"corejs": 3,
"version": "^7.12.5"
"version": "^7.20.13"
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-progressive/build/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "build",
"name": "mpx-progressive-build",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
2 changes: 1 addition & 1 deletion examples/mpx-progressive/config/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "config",
"name": "mpx-progressive-config",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
10 changes: 5 additions & 5 deletions examples/mpx-progressive/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mpx-subpackage-demo",
"name": "mpx-progressive-demo",
"version": "1.0.0",
"description": "A mpx project",
"main": "index.js",
Expand All @@ -19,17 +19,17 @@
"author": "sky-admin <[email protected]>",
"license": "ISC",
"dependencies": {
"@mpxjs/api-proxy": "^2.7.28",
"@mpxjs/core": "^2.7.26"
"@mpxjs/api-proxy": "workspace:*",
"@mpxjs/core": "workspace:*"
},
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/eslint-parser": "7.16.0",
"@babel/plugin-syntax-typescript": "^7.16.7",
"@babel/plugin-transform-runtime": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/runtime-corejs3": "7.12.5",
"@mpxjs/webpack-plugin": "^2.7.27",
"@babel/runtime-corejs3": "7.20.13",
"@mpxjs/webpack-plugin": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"babel-jest": "^25.3.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-subpackage/babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@babel/transform-runtime",
{
"corejs": 3,
"version": "^7.12.5"
"version": "^7.20.13"
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion examples/mpx-subpackage/build/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "build",
"name": "mpx-subpackage-build",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
2 changes: 1 addition & 1 deletion examples/mpx-subpackage/config/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "config",
"name": "mpx-subpackage-config",
"version": "1.0.0",
"description": "避免webpack通过分析目录依赖错误地将项目package.json中声明的dependencies作为buildDependencies,请勿删除该文件!"
}
Loading