Skip to content

Commit

Permalink
feat: async request in onLoad when immediate is true, you can access …
Browse files Browse the repository at this point in the history
…the options (#2)

* feat: async request in onLoad when immediate is true, you can access the options

* test: correct types of unit tests

* test: adujst unit tests
  • Loading branch information
JOU-amjs authored Dec 26, 2023
1 parent 201a8ed commit 1f48e56
Show file tree
Hide file tree
Showing 21 changed files with 2,710 additions and 554 deletions.
8 changes: 2 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
root = true

[{*.js,*.css,*.html}]
[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
insert_final_newline = true

[{package.json,.*rc,*.yml}]
indent_style = space
indent_size = 2
4 changes: 3 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
env: {
browser: true,
es2021: true
es2021: true,
node: true
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
overrides: [],
Expand All @@ -20,6 +21,7 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'no-empty': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/triple-slash-reference': 'off'
}
};
File renamed without changes.
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"jest.autoRun": "off",
"editor.suggestSelection": "recentlyUsedByPrefix", // 自动补全
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll.eslint": true // 修复所有代码
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
}
}
3 changes: 3 additions & 0 deletions __mocks__/@dcloudio/uni-app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const onLoad = (callback: () => void) => {
callback();
};
6 changes: 3 additions & 3 deletions babel.config.js → babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
presets: [
[
"@babel/preset-env",
'@babel/preset-env',
{
targets: {
node: "current"
node: 'current'
}
}
]
]
};
};
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
};
3 changes: 0 additions & 3 deletions commitlint.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion config/rollup.js → config/rollup.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports.banner = `/**
`;

const compilePath = (exports.compilePath = {
external: ['alova', 'alova/vue', 'vue'],
external: ['alova', 'alova/vue', 'vue', '@dcloudio/uni-app'],
packageName: 'AlovaAdapterUniapp',
input: 'src/index.ts',
output: suffix => `dist/alova-adapter-uniapp.${suffix}.js`
Expand Down
35 changes: 35 additions & 0 deletions config/rollup.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* @Date: 2020-04-09 11:06:01
* @LastEditors: JOU(wx: huzhen555)
* @LastEditTime: 2022-06-12 09:51:56
*/
// rollup.config.js
// commonjs
var config = require('./rollup.cjs');
var module = process.argv.pop().replace('--', '') || 'core';
var paths = config.compilePath;
var moduleType = 'cjs';

module.exports = {
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'cjs',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
banner: config.banner
},
external: config.external,
plugins: [
config.getCompiler({
tsconfigOverride: {
compilerOptions: {
declaration: true,
module: 'ES2015'
}
},
useTsconfigDeclarationDir: true
})
]
};
9 changes: 4 additions & 5 deletions config/rollup.config.esm.js → config/rollup.config.esm.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// rollup.config.js
// ES output
var { nodeResolve } = require('@rollup/plugin-node-resolve');
var config = require('./rollup.js');
var paths = config.compilePath;
var moduleType = 'esm';

const { nodeResolve } = require('@rollup/plugin-node-resolve');
const config = require('./rollup.cjs');
const paths = config.compilePath;
const moduleType = 'esm';
const globals = {};
// 将externals中的内容放到globals对象中
config.external.forEach(key => (globals[key] = key));
Expand Down
35 changes: 0 additions & 35 deletions config/rollup.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var commonjs = require('@rollup/plugin-commonjs');
var { terser } = require('rollup-plugin-terser');
var replace = require('@rollup/plugin-replace');
var json = require('@rollup/plugin-json');
var config = require('./rollup.js');
var config = require('./rollup.cjs');
var prod = process.env.NODE_ENV === 'production';
var paths = config.compilePath;
var moduleType = prod ? 'umd.min' : 'umd';
Expand Down
Loading

0 comments on commit 1f48e56

Please sign in to comment.