@modern-js/plugin-koa 1.0.1 → 1.1.3
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/CHANGELOG.md +37 -9
- package/dist/js/modern/cli/index.js +14 -2
- package/dist/js/node/cli/index.js +14 -2
- package/dist/types/cli/index.d.ts +3 -0
- package/package.json +13 -13
- package/src/cli/index.ts +21 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
# @modern-js/plugin-koa
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.1.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- Updated dependencies [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- @modern-js/
|
|
12
|
-
- @modern-js/
|
|
13
|
-
- @modern-js/
|
|
14
|
-
- @modern-js/utils@1.
|
|
7
|
+
- 0fa83663: support more .env files
|
|
8
|
+
- Updated dependencies [6f7fe574]
|
|
9
|
+
- Updated dependencies [0fa83663]
|
|
10
|
+
- Updated dependencies [f594fbc8]
|
|
11
|
+
- @modern-js/core@1.1.2
|
|
12
|
+
- @modern-js/adapter-helpers@1.1.1
|
|
13
|
+
- @modern-js/bff-runtime@1.1.1
|
|
14
|
+
- @modern-js/bff-utils@1.1.1
|
|
15
|
+
- @modern-js/server-plugin@1.1.1
|
|
16
|
+
- @modern-js/utils@1.1.2
|
|
17
|
+
|
|
18
|
+
## 1.1.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 6ffd1a50: Refactor to base on farrow-pipeline
|
|
23
|
+
- Updated dependencies [687c92c7]
|
|
24
|
+
- Updated dependencies [c0fc0700]
|
|
25
|
+
- @modern-js/core@1.1.1
|
|
26
|
+
- @modern-js/utils@1.1.1
|
|
27
|
+
|
|
28
|
+
## 1.1.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- 96119db2: Relese v1.1.0
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [96119db2]
|
|
37
|
+
- @modern-js/core@1.1.0
|
|
38
|
+
- @modern-js/adapter-helpers@1.1.0
|
|
39
|
+
- @modern-js/bff-runtime@1.1.0
|
|
40
|
+
- @modern-js/bff-utils@1.1.0
|
|
41
|
+
- @modern-js/server-plugin@1.1.0
|
|
42
|
+
- @modern-js/utils@1.1.0
|
|
15
43
|
|
|
16
44
|
## 1.0.0
|
|
17
45
|
|
|
@@ -8,17 +8,28 @@ export default createPlugin(() => {
|
|
|
8
8
|
config() {
|
|
9
9
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
10
10
|
const appContext = useAppContext();
|
|
11
|
+
const {
|
|
12
|
+
appDirectory
|
|
13
|
+
} = appContext;
|
|
11
14
|
bffExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'server');
|
|
15
|
+
const serverRuntimePath = bffExportsUtils.getPath(); // Look up one level, because the artifacts after build have dist directories
|
|
16
|
+
|
|
17
|
+
let relativeRuntimePath = path.join('../', path.relative(appDirectory, serverRuntimePath));
|
|
18
|
+
|
|
19
|
+
if (process.env.NODE_ENV === 'development') {
|
|
20
|
+
relativeRuntimePath = `./${path.relative(appDirectory, serverRuntimePath)}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
return {
|
|
13
24
|
source: {
|
|
14
25
|
alias: {
|
|
15
|
-
'@modern-js/runtime/server':
|
|
26
|
+
'@modern-js/runtime/server': relativeRuntimePath
|
|
16
27
|
}
|
|
17
28
|
}
|
|
18
29
|
};
|
|
19
30
|
},
|
|
20
31
|
|
|
21
|
-
modifyEntryImports() {
|
|
32
|
+
modifyEntryImports(input) {
|
|
22
33
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
34
|
const {
|
|
24
35
|
appDirectory
|
|
@@ -42,6 +53,7 @@ export default createPlugin(() => {
|
|
|
42
53
|
...pluginRuntime
|
|
43
54
|
}
|
|
44
55
|
`);
|
|
56
|
+
return input;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
};
|
|
@@ -22,17 +22,28 @@ var _default = (0, _core.createPlugin)(() => {
|
|
|
22
22
|
config() {
|
|
23
23
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
24
24
|
const appContext = (0, _core.useAppContext)();
|
|
25
|
+
const {
|
|
26
|
+
appDirectory
|
|
27
|
+
} = appContext;
|
|
25
28
|
bffExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, 'server');
|
|
29
|
+
const serverRuntimePath = bffExportsUtils.getPath(); // Look up one level, because the artifacts after build have dist directories
|
|
30
|
+
|
|
31
|
+
let relativeRuntimePath = path.join('../', path.relative(appDirectory, serverRuntimePath));
|
|
32
|
+
|
|
33
|
+
if (process.env.NODE_ENV === 'development') {
|
|
34
|
+
relativeRuntimePath = `./${path.relative(appDirectory, serverRuntimePath)}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
26
37
|
return {
|
|
27
38
|
source: {
|
|
28
39
|
alias: {
|
|
29
|
-
'@modern-js/runtime/server':
|
|
40
|
+
'@modern-js/runtime/server': relativeRuntimePath
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
};
|
|
33
44
|
},
|
|
34
45
|
|
|
35
|
-
modifyEntryImports() {
|
|
46
|
+
modifyEntryImports(input) {
|
|
36
47
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
48
|
const {
|
|
38
49
|
appDirectory
|
|
@@ -56,6 +67,7 @@ var _default = (0, _core.createPlugin)(() => {
|
|
|
56
67
|
...pluginRuntime
|
|
57
68
|
}
|
|
58
69
|
`);
|
|
70
|
+
return input;
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
declare const _default: import("@modern-js/core").AsyncPlugin<Partial<import("@modern-js/core").Progresses2Threads<{
|
|
2
2
|
config: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
|
3
|
+
resolvedConfig: import("@modern-js/core").AsyncWaterfall<{
|
|
4
|
+
resolved: import("@modern-js/core").NormalizedConfig;
|
|
5
|
+
}>;
|
|
3
6
|
validateSchema: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
|
4
7
|
prepare: import("@modern-js/core").AsyncWorkflow<void, void>;
|
|
5
8
|
commands: import("@modern-js/core").AsyncWorkflow<{
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.1.3",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.15.3",
|
|
32
|
-
"@modern-js/adapter-helpers": "^1.
|
|
33
|
-
"@modern-js/utils": "^1.
|
|
32
|
+
"@modern-js/adapter-helpers": "^1.1.1",
|
|
33
|
+
"@modern-js/utils": "^1.1.2",
|
|
34
34
|
"formidable": "^1.2.2",
|
|
35
35
|
"koa-body": "^4.2.0",
|
|
36
36
|
"koa-router": "^10.0.0",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@types/type-is": "^1.6.3",
|
|
48
48
|
"supertest": "^6.1.6",
|
|
49
49
|
"typescript": "^4",
|
|
50
|
-
"@modern-js/bff-runtime": "^1.
|
|
51
|
-
"@modern-js/bff-utils": "^1.
|
|
52
|
-
"@modern-js/core": "^1.
|
|
53
|
-
"@modern-js/server-plugin": "^1.
|
|
54
|
-
"@modern-js/plugin-testing": "^1.
|
|
55
|
-
"@modern-js/module-tools": "^1.
|
|
50
|
+
"@modern-js/bff-runtime": "^1.1.1",
|
|
51
|
+
"@modern-js/bff-utils": "^1.1.1",
|
|
52
|
+
"@modern-js/core": "^1.1.2",
|
|
53
|
+
"@modern-js/server-plugin": "^1.1.1",
|
|
54
|
+
"@modern-js/plugin-testing": "^1.1.1",
|
|
55
|
+
"@modern-js/module-tools": "^1.1.1"
|
|
56
56
|
},
|
|
57
57
|
"modernConfig": {
|
|
58
58
|
"output": {
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@modern-js/bff-utils": "^1.
|
|
64
|
-
"@modern-js/core": "^1.
|
|
65
|
-
"@modern-js/server-plugin": "^1.
|
|
66
|
-
"@modern-js/bff-runtime": "^1.
|
|
63
|
+
"@modern-js/bff-utils": "^1.1.1",
|
|
64
|
+
"@modern-js/core": "^1.1.2",
|
|
65
|
+
"@modern-js/server-plugin": "^1.1.1",
|
|
66
|
+
"@modern-js/bff-runtime": "^1.1.1",
|
|
67
67
|
"koa": "^2.13.3"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
package/src/cli/index.ts
CHANGED
|
@@ -11,18 +11,36 @@ export default createPlugin(
|
|
|
11
11
|
config() {
|
|
12
12
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
13
13
|
const appContext = useAppContext();
|
|
14
|
+
const { appDirectory } = appContext;
|
|
14
15
|
bffExportsUtils = createRuntimeExportsUtils(
|
|
15
16
|
appContext.internalDirectory,
|
|
16
17
|
'server',
|
|
17
18
|
);
|
|
18
19
|
|
|
20
|
+
const serverRuntimePath = bffExportsUtils.getPath();
|
|
21
|
+
|
|
22
|
+
// Look up one level, because the artifacts after build have dist directories
|
|
23
|
+
let relativeRuntimePath = path.join(
|
|
24
|
+
'../',
|
|
25
|
+
path.relative(appDirectory, serverRuntimePath),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (process.env.NODE_ENV === 'development') {
|
|
29
|
+
relativeRuntimePath = `./${path.relative(
|
|
30
|
+
appDirectory,
|
|
31
|
+
serverRuntimePath,
|
|
32
|
+
)}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
return {
|
|
20
36
|
source: {
|
|
21
|
-
alias: {
|
|
37
|
+
alias: {
|
|
38
|
+
'@modern-js/runtime/server': relativeRuntimePath,
|
|
39
|
+
},
|
|
22
40
|
},
|
|
23
41
|
};
|
|
24
42
|
},
|
|
25
|
-
modifyEntryImports() {
|
|
43
|
+
modifyEntryImports(input) {
|
|
26
44
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
45
|
const { appDirectory } = useAppContext();
|
|
28
46
|
const runtimePath = require.resolve(`@modern-js/runtime`, {
|
|
@@ -56,6 +74,7 @@ export default createPlugin(
|
|
|
56
74
|
...pluginRuntime
|
|
57
75
|
}
|
|
58
76
|
`);
|
|
77
|
+
return input;
|
|
59
78
|
},
|
|
60
79
|
};
|
|
61
80
|
},
|