@modern-js/server-core 1.3.6-beta.0 → 1.4.0-alpha.0
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 +16 -0
- package/dist/js/modern/loadPlugins.js +1 -21
- package/dist/js/modern/plugin.js +1 -3
- package/dist/js/node/loadPlugins.js +1 -20
- package/dist/js/node/plugin.js +1 -4
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @modern-js/server-plugin
|
|
2
2
|
|
|
3
|
+
## 1.4.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 77a8e9e1b: feat: support bff operators
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- f29e9bacf: feat: simplify context usage, no longer depend on containers
|
|
12
|
+
- a90bc96bd: perf(babel): skip babel-plugin-import if package not installed
|
|
13
|
+
- Updated dependencies [9cd364e06]
|
|
14
|
+
- Updated dependencies [f29e9bacf]
|
|
15
|
+
- Updated dependencies [a90bc96bd]
|
|
16
|
+
- @modern-js/utils@1.7.9-alpha.0
|
|
17
|
+
- @modern-js/plugin@1.4.0-alpha.0
|
|
18
|
+
|
|
3
19
|
## 1.3.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -4,28 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
import { compatRequire } from '@modern-js/utils';
|
|
7
|
+
import { compatRequire, tryResolve } from '@modern-js/utils';
|
|
8
8
|
import { createPlugin } from "./plugin";
|
|
9
|
-
|
|
10
|
-
const tryResolve = (name, appDirectory) => {
|
|
11
|
-
let filePath = '';
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
filePath = require.resolve(name, {
|
|
15
|
-
paths: [appDirectory]
|
|
16
|
-
});
|
|
17
|
-
delete require.cache[filePath];
|
|
18
|
-
} catch (err) {
|
|
19
|
-
if (err.code === 'MODULE_NOT_FOUND') {
|
|
20
|
-
throw new Error(`Can not find plugin ${name}.`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
throw err;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return filePath;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
9
|
export const loadPlugins = (plugins, appDirectory) => {
|
|
30
10
|
const resolvePlugin = p => {
|
|
31
11
|
const isPluginInstance = typeof p !== 'string' && !Array.isArray(p);
|
package/dist/js/modern/plugin.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { createContext, createAsyncManager, createAsyncPipeline, createAsyncWaterfall, createParallelWorkflow, createWaterfall } from '@modern-js/plugin';
|
|
2
|
-
|
|
3
|
-
enable(); // collect all middleware register in server plugins
|
|
4
|
-
|
|
2
|
+
// collect all middleware register in server plugins
|
|
5
3
|
const gather = createParallelWorkflow();
|
|
6
4
|
// config
|
|
7
5
|
const config = createWaterfall();
|
|
@@ -15,25 +15,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
15
|
|
|
16
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
17
|
|
|
18
|
-
const tryResolve = (name, appDirectory) => {
|
|
19
|
-
let filePath = '';
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
filePath = require.resolve(name, {
|
|
23
|
-
paths: [appDirectory]
|
|
24
|
-
});
|
|
25
|
-
delete require.cache[filePath];
|
|
26
|
-
} catch (err) {
|
|
27
|
-
if (err.code === 'MODULE_NOT_FOUND') {
|
|
28
|
-
throw new Error(`Can not find plugin ${name}.`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return filePath;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
18
|
const loadPlugins = (plugins, appDirectory) => {
|
|
38
19
|
const resolvePlugin = p => {
|
|
39
20
|
const isPluginInstance = typeof p !== 'string' && !Array.isArray(p);
|
|
@@ -45,7 +26,7 @@ const loadPlugins = (plugins, appDirectory) => {
|
|
|
45
26
|
}
|
|
46
27
|
|
|
47
28
|
const [pkg, options] = typeof p === 'string' ? [p, undefined] : p;
|
|
48
|
-
const pluginPath = tryResolve(pkg, appDirectory);
|
|
29
|
+
const pluginPath = (0, _utils.tryResolve)(pkg, appDirectory);
|
|
49
30
|
let module = (0, _utils.compatRequire)(pluginPath);
|
|
50
31
|
const useNewSyntax = typeof module === 'function';
|
|
51
32
|
|
package/dist/js/node/plugin.js
CHANGED
|
@@ -7,10 +7,7 @@ exports.useConfigContext = exports.useAppContext = exports.setAppContext = expor
|
|
|
7
7
|
|
|
8
8
|
var _plugin = require("@modern-js/plugin");
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(0, _node.enable)(); // collect all middleware register in server plugins
|
|
13
|
-
|
|
10
|
+
// collect all middleware register in server plugins
|
|
14
11
|
const gather = (0, _plugin.createParallelWorkflow)();
|
|
15
12
|
// config
|
|
16
13
|
const config = (0, _plugin.createWaterfall)();
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.4.0-alpha.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modern-js/plugin": "^1.
|
|
32
|
-
"@modern-js/utils": "^1.7.
|
|
31
|
+
"@modern-js/plugin": "^1.4.0-alpha.0",
|
|
32
|
+
"@modern-js/utils": "^1.7.9-alpha.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@modern-js/core": "1.
|
|
36
|
-
"@modern-js/types": "1.5.
|
|
35
|
+
"@modern-js/core": "1.12.2-alpha.0",
|
|
36
|
+
"@modern-js/types": "1.5.5-alpha.0",
|
|
37
37
|
"@scripts/build": "0.0.0",
|
|
38
38
|
"@scripts/jest-config": "0.0.0",
|
|
39
39
|
"@types/jest": "^27",
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"registry": "https://registry.npmjs.org/",
|
|
56
|
-
"access": "public"
|
|
57
|
-
"types": "./dist/types/index.d.ts"
|
|
56
|
+
"access": "public"
|
|
58
57
|
},
|
|
59
58
|
"wireit": {
|
|
60
59
|
"build": {
|