Skip to content

Commit e6b2ade

Browse files
committed
f
1 parent a55969f commit e6b2ade

File tree

250 files changed

+1376
-771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+1376
-771
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
jobs:
1010
Job:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66

77
jobs:
88
release:

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CHANGELOG.md
22
__snapshots__
3+
benchmark

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Then you can start with code below
6262
import { EggCore as Application } from '@eggjs/core';
6363

6464
const app = new Application({
65-
baseDir: '/path/to/app'
65+
baseDir: '/path/to/app',
6666
});
6767
app.ready(() => {
6868
app.listen(3000);
@@ -140,13 +140,13 @@ Load app/service
140140
Retrieve application environment variable values via `serverEnv`.
141141
You can access directly by calling `this.serverEnv` after instantiation.
142142

143-
serverEnv | description
144-
--- | ---
145-
default | default environment
146-
test | system integration testing environment
147-
prod | production environment
148-
local | local environment on your own computer
149-
unittest | unit test environment
143+
| serverEnv | description |
144+
| --------- | -------------------------------------- |
145+
| default | default environment |
146+
| test | system integration testing environment |
147+
| prod | production environment |
148+
| local | local environment on your own computer |
149+
| unittest | unit test environment |
150150

151151
#### getEggPaths()
152152

@@ -163,7 +163,7 @@ This function will get add loadUnits follow the order:
163163
2. framework
164164
3. app
165165

166-
loadUnit has a path and a type. Type must be one of those values: *app*, *framework*, *plugin*.
166+
loadUnit has a path and a type. Type must be one of those values: _app_, _framework_, _plugin_.
167167

168168
```js
169169
{
@@ -174,7 +174,7 @@ loadUnit has a path and a type. Type must be one of those values: *app*, *framew
174174

175175
#### getAppname()
176176

177-
To get application name from *package.json*
177+
To get application name from _package.json_
178178

179179
#### appInfo
180180

@@ -228,18 +228,18 @@ await this.loadExtend('application', app);
228228

229229
### LoaderOptions
230230

231-
Param | Type | Description
232-
-------------- | -------------- | ------------------------
233-
directory | `String/Array` | directories to be loaded
234-
target | `Object` | attach the target object from loaded files
235-
match | `String/Array` | match the files when load, default to `**/*.js`(if process.env.EGG_TYPESCRIPT was true, default to `[ '**/*.(js|ts)', '!**/*.d.ts' ]`)
236-
ignore | `String/Array` | ignore the files when load
237-
initializer | `Function` | custom file exports, receive two parameters, first is the inject object(if not js file, will be content buffer), second is an `options` object that contain `path`
238-
caseStyle | `String/Function` | set property's case when converting a filepath to property list.
239-
override | `Boolean` | determine whether override the property when get the same name
240-
call | `Boolean` | determine whether invoke when exports is function
241-
inject | `Object` | an object that be the argument when invoke the function
242-
filter | `Function` | a function that filter the exports which can be loaded
231+
| Param | Type | Description |
232+
| ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------- |
233+
| directory | `String/Array` | directories to be loaded |
234+
| target | `Object` | attach the target object from loaded files |
235+
| match | `String/Array` | match the files when load, default to `**/*.js`(if process.env.EGG_TYPESCRIPT was true, default to `[ '\*_/_.(js | ts)', '!\*_/_.d.ts' ]`) |
236+
| ignore | `String/Array` | ignore the files when load |
237+
| initializer | `Function` | custom file exports, receive two parameters, first is the inject object(if not js file, will be content buffer), second is an `options` object that contain `path` |
238+
| caseStyle | `String/Function` | set property's case when converting a filepath to property list. |
239+
| override | `Boolean` | determine whether override the property when get the same name |
240+
| call | `Boolean` | determine whether invoke when exports is function |
241+
| inject | `Object` | an object that be the argument when invoke the function |
242+
| filter | `Function` | a function that filter the exports which can be loaded |
243243

244244
## Timing
245245

benchmark/middleware/app/middleware/async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
let index = 0;
44

5-
module.exports = function exports() {
5+
module.exports = function exports() {
66
return async (ctx, next) => {
77
await next();
88
ctx.body.push(`async middleware #${++index}`);

benchmark/middleware/app/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ module.exports = app => {
99

1010
app.get('/', app.controller.home.index);
1111
app.get('/async', ...asyncMiddlewares, 'home.async');
12-
}
12+
};

benchmark/middleware/start.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ const app = new EggApplication({
77
type: 'application',
88
});
99

10-
app.loader.loadAll().then(() => {
11-
app.listen(7001);
12-
console.log('server started at 7001');
13-
}).catch(err => {
14-
throw err;
15-
});
16-
10+
app.loader
11+
.loadAll()
12+
.then(() => {
13+
app.listen(7001);
14+
console.log('server started at 7001');
15+
})
16+
.catch(err => {
17+
throw err;
18+
});

0 commit comments

Comments
 (0)