@modern-js/plugin-bff 1.5.3-beta.1 → 1.6.1
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 +30 -0
- package/dist/js/modern/cli.js +120 -102
- package/dist/js/modern/helper.js +14 -0
- package/dist/js/node/cli.js +119 -100
- package/dist/js/node/helper.js +27 -0
- package/dist/types/helper.d.ts +2 -0
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @modern-js/plugin-bff
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d86f009: feat: optimize implentation of registerModernRuntimePath
|
|
8
|
+
- Updated dependencies [dc4676b]
|
|
9
|
+
- Updated dependencies [d86f009]
|
|
10
|
+
- @modern-js/utils@1.7.12
|
|
11
|
+
- @modern-js/bff-core@1.1.1
|
|
12
|
+
|
|
13
|
+
## 1.6.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 77a8e9e: feat: support bff operators
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- f29e9ba: feat: simplify context usage, no longer depend on containers
|
|
22
|
+
- 6eebd9c: fix: resolve server runtime alias for esbuild-register
|
|
23
|
+
- Updated dependencies [77a8e9e]
|
|
24
|
+
- Updated dependencies [77a8e9e]
|
|
25
|
+
- Updated dependencies [b220f1d]
|
|
26
|
+
- Updated dependencies [7b9e302]
|
|
27
|
+
- Updated dependencies [a90bc96]
|
|
28
|
+
- @modern-js/bff-core@1.1.0
|
|
29
|
+
- @modern-js/create-request@1.3.0
|
|
30
|
+
- @modern-js/utils@1.7.9
|
|
31
|
+
- @modern-js/server-utils@1.2.11
|
|
32
|
+
|
|
3
33
|
## 1.5.2
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/js/modern/cli.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { compiler } from '@modern-js/babel-compiler';
|
|
3
|
-
import { fs, API_DIR, PLUGIN_SCHEMAS, normalizeOutputPath, SHARED_DIR } from '@modern-js/utils';
|
|
3
|
+
import { fs, API_DIR, PLUGIN_SCHEMAS, normalizeOutputPath, SHARED_DIR, isProd } from '@modern-js/utils';
|
|
4
4
|
import { resolveBabelConfig } from '@modern-js/server-utils';
|
|
5
|
+
import { registerModernRuntimePath } from "./helper";
|
|
5
6
|
const DEFAULT_API_PREFIX = '/api';
|
|
6
7
|
const TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
7
8
|
const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // TODO: 封装服务端编译函数
|
|
@@ -46,112 +47,129 @@ const compile = async (appDirectory, modernConfig, compileOptions) => {
|
|
|
46
47
|
|
|
47
48
|
export default (() => ({
|
|
48
49
|
name: '@modern-js/plugin-bff',
|
|
49
|
-
setup: api =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
50
|
+
setup: api => {
|
|
51
|
+
let unRegisterResolveRuntimePath = null;
|
|
52
|
+
return {
|
|
53
|
+
validateSchema() {
|
|
54
|
+
return PLUGIN_SCHEMAS['@modern-js/plugin-bff'];
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
config() {
|
|
58
|
+
return {
|
|
59
|
+
tools: {
|
|
60
|
+
webpackChain: (chain, {
|
|
61
|
+
name,
|
|
62
|
+
CHAIN_ID
|
|
63
|
+
}) => {
|
|
64
|
+
const {
|
|
65
|
+
appDirectory,
|
|
66
|
+
port
|
|
67
|
+
} = api.useAppContext();
|
|
68
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
69
|
+
const {
|
|
70
|
+
bff
|
|
71
|
+
} = modernConfig || {};
|
|
72
|
+
const {
|
|
73
|
+
fetcher
|
|
74
|
+
} = bff || {};
|
|
75
|
+
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
|
|
76
|
+
const rootDir = path.resolve(appDirectory, API_DIR);
|
|
77
|
+
chain.resolve.alias.set('@api', rootDir);
|
|
78
|
+
const apiRegexp = new RegExp(normalizeOutputPath(`${appDirectory}${path.sep}api${path.sep}.*(.[tj]s)$`));
|
|
79
|
+
chain.module.rule(CHAIN_ID.RULE.LOADERS).oneOf(CHAIN_ID.ONE_OF.BFF_CLIENT).before(CHAIN_ID.ONE_OF.FALLBACK).test(apiRegexp).use('custom-loader').loader(require.resolve("./loader").replace(/\\/g, '/')).options({
|
|
80
|
+
prefix,
|
|
81
|
+
apiDir: rootDir,
|
|
82
|
+
port,
|
|
83
|
+
fetcher,
|
|
84
|
+
target: name,
|
|
85
|
+
requestCreator: bff === null || bff === void 0 ? void 0 : bff.requestCreator
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
source: {
|
|
90
|
+
moduleScopes: [`./${API_DIR}`, /create-request/]
|
|
84
91
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
modifyServerRoutes({
|
|
96
|
+
routes
|
|
97
|
+
}) {
|
|
98
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
99
|
+
const {
|
|
100
|
+
bff
|
|
101
|
+
} = modernConfig || {};
|
|
102
|
+
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
103
|
+
const prefixList = [];
|
|
104
|
+
|
|
105
|
+
if (Array.isArray(prefix)) {
|
|
106
|
+
prefixList.push(...prefix);
|
|
107
|
+
} else {
|
|
108
|
+
prefixList.push(prefix);
|
|
88
109
|
}
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
modifyServerRoutes({
|
|
93
|
-
routes
|
|
94
|
-
}) {
|
|
95
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
96
|
-
const {
|
|
97
|
-
bff
|
|
98
|
-
} = modernConfig || {};
|
|
99
|
-
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
100
|
-
const prefixList = [];
|
|
101
|
-
|
|
102
|
-
if (Array.isArray(prefix)) {
|
|
103
|
-
prefixList.push(...prefix);
|
|
104
|
-
} else {
|
|
105
|
-
prefixList.push(prefix);
|
|
106
|
-
}
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}));
|
|
116
|
-
return {
|
|
117
|
-
routes: routes.concat(apiServerRoutes)
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
async afterBuild() {
|
|
122
|
-
const {
|
|
123
|
-
appDirectory,
|
|
124
|
-
distDirectory
|
|
125
|
-
} = api.useAppContext();
|
|
126
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
127
|
-
const distDir = path.resolve(distDirectory);
|
|
128
|
-
const apiDir = path.resolve(appDirectory, API_DIR);
|
|
129
|
-
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
130
|
-
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
131
|
-
const patterns = [];
|
|
132
|
-
|
|
133
|
-
if (fs.existsSync(apiDir)) {
|
|
134
|
-
patterns.push({
|
|
135
|
-
from: apiDir,
|
|
136
|
-
to: distDir,
|
|
137
|
-
tsconfigPath
|
|
138
|
-
});
|
|
139
|
-
}
|
|
111
|
+
const apiServerRoutes = prefixList.map(pre => ({
|
|
112
|
+
urlPath: pre,
|
|
113
|
+
isApi: true,
|
|
114
|
+
entryPath: '',
|
|
115
|
+
isSPA: false,
|
|
116
|
+
isSSR: false // FIXME: })) as IAppContext[`serverRoutes`];
|
|
140
117
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
118
|
+
}));
|
|
119
|
+
return {
|
|
120
|
+
routes: routes.concat(apiServerRoutes)
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
async beforeBuild() {
|
|
125
|
+
// help esbuild-register resolve @modern-js/server/runtime
|
|
126
|
+
if (isProd()) {
|
|
127
|
+
const {
|
|
128
|
+
internalDirectory
|
|
129
|
+
} = api.useAppContext();
|
|
130
|
+
unRegisterResolveRuntimePath = registerModernRuntimePath(internalDirectory);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
148
133
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
134
|
+
async afterBuild() {
|
|
135
|
+
if (unRegisterResolveRuntimePath) {
|
|
136
|
+
unRegisterResolveRuntimePath();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const {
|
|
140
|
+
appDirectory,
|
|
141
|
+
distDirectory
|
|
142
|
+
} = api.useAppContext();
|
|
143
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
144
|
+
const distDir = path.resolve(distDirectory);
|
|
145
|
+
const apiDir = path.resolve(appDirectory, API_DIR);
|
|
146
|
+
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
147
|
+
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
148
|
+
const patterns = [];
|
|
149
|
+
|
|
150
|
+
if (fs.existsSync(apiDir)) {
|
|
151
|
+
patterns.push({
|
|
152
|
+
from: apiDir,
|
|
153
|
+
to: distDir,
|
|
154
|
+
tsconfigPath
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (fs.existsSync(sharedDir)) {
|
|
159
|
+
patterns.push({
|
|
160
|
+
from: sharedDir,
|
|
161
|
+
to: distDir,
|
|
162
|
+
tsconfigPath
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (patterns.length > 0) {
|
|
167
|
+
await compile(appDirectory, modernConfig, {
|
|
168
|
+
patterns
|
|
169
|
+
});
|
|
170
|
+
}
|
|
153
171
|
}
|
|
154
|
-
}
|
|
155
172
|
|
|
156
|
-
|
|
173
|
+
};
|
|
174
|
+
}
|
|
157
175
|
}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { registerPaths } from '@modern-js/bff-core';
|
|
3
|
+
const serverRuntimeAlias = '@modern-js/runtime/server';
|
|
4
|
+
const serverRuntimePath = '.runtime-exports/server';
|
|
5
|
+
|
|
6
|
+
const registerModernRuntimePath = internalDirectory => {
|
|
7
|
+
const paths = {
|
|
8
|
+
[serverRuntimeAlias]: path.join(internalDirectory, serverRuntimePath)
|
|
9
|
+
};
|
|
10
|
+
const unRegister = registerPaths(paths);
|
|
11
|
+
return unRegister;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { registerModernRuntimePath };
|
package/dist/js/node/cli.js
CHANGED
|
@@ -13,6 +13,8 @@ var _utils = require("@modern-js/utils");
|
|
|
13
13
|
|
|
14
14
|
var _serverUtils = require("@modern-js/server-utils");
|
|
15
15
|
|
|
16
|
+
var _helper = require("./helper");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
const DEFAULT_API_PREFIX = '/api';
|
|
@@ -61,121 +63,138 @@ const compile = async (appDirectory, modernConfig, compileOptions) => {
|
|
|
61
63
|
|
|
62
64
|
var _default = () => ({
|
|
63
65
|
name: '@modern-js/plugin-bff',
|
|
64
|
-
setup: api =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
66
|
+
setup: api => {
|
|
67
|
+
let unRegisterResolveRuntimePath = null;
|
|
68
|
+
return {
|
|
69
|
+
validateSchema() {
|
|
70
|
+
return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-bff'];
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
config() {
|
|
74
|
+
return {
|
|
75
|
+
tools: {
|
|
76
|
+
webpackChain: (chain, {
|
|
77
|
+
name,
|
|
78
|
+
CHAIN_ID
|
|
79
|
+
}) => {
|
|
80
|
+
const {
|
|
81
|
+
appDirectory,
|
|
82
|
+
port
|
|
83
|
+
} = api.useAppContext();
|
|
84
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
85
|
+
const {
|
|
86
|
+
bff
|
|
87
|
+
} = modernConfig || {};
|
|
88
|
+
const {
|
|
89
|
+
fetcher
|
|
90
|
+
} = bff || {};
|
|
91
|
+
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
|
|
92
|
+
|
|
93
|
+
const rootDir = _path.default.resolve(appDirectory, _utils.API_DIR);
|
|
94
|
+
|
|
95
|
+
chain.resolve.alias.set('@api', rootDir);
|
|
96
|
+
const apiRegexp = new RegExp((0, _utils.normalizeOutputPath)(`${appDirectory}${_path.default.sep}api${_path.default.sep}.*(.[tj]s)$`));
|
|
97
|
+
chain.module.rule(CHAIN_ID.RULE.LOADERS).oneOf(CHAIN_ID.ONE_OF.BFF_CLIENT).before(CHAIN_ID.ONE_OF.FALLBACK).test(apiRegexp).use('custom-loader').loader(require.resolve("./loader").replace(/\\/g, '/')).options({
|
|
98
|
+
prefix,
|
|
99
|
+
apiDir: rootDir,
|
|
100
|
+
port,
|
|
101
|
+
fetcher,
|
|
102
|
+
target: name,
|
|
103
|
+
requestCreator: bff === null || bff === void 0 ? void 0 : bff.requestCreator
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
source: {
|
|
108
|
+
moduleScopes: [`./${_utils.API_DIR}`, /create-request/]
|
|
101
109
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
modifyServerRoutes({
|
|
114
|
+
routes
|
|
115
|
+
}) {
|
|
116
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
117
|
+
const {
|
|
118
|
+
bff
|
|
119
|
+
} = modernConfig || {};
|
|
120
|
+
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
121
|
+
const prefixList = [];
|
|
122
|
+
|
|
123
|
+
if (Array.isArray(prefix)) {
|
|
124
|
+
prefixList.push(...prefix);
|
|
125
|
+
} else {
|
|
126
|
+
prefixList.push(prefix);
|
|
105
127
|
}
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
modifyServerRoutes({
|
|
110
|
-
routes
|
|
111
|
-
}) {
|
|
112
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
113
|
-
const {
|
|
114
|
-
bff
|
|
115
|
-
} = modernConfig || {};
|
|
116
|
-
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
117
|
-
const prefixList = [];
|
|
118
|
-
|
|
119
|
-
if (Array.isArray(prefix)) {
|
|
120
|
-
prefixList.push(...prefix);
|
|
121
|
-
} else {
|
|
122
|
-
prefixList.push(prefix);
|
|
123
|
-
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
const apiServerRoutes = prefixList.map(pre => ({
|
|
130
|
+
urlPath: pre,
|
|
131
|
+
isApi: true,
|
|
132
|
+
entryPath: '',
|
|
133
|
+
isSPA: false,
|
|
134
|
+
isSSR: false // FIXME: })) as IAppContext[`serverRoutes`];
|
|
135
|
+
|
|
136
|
+
}));
|
|
137
|
+
return {
|
|
138
|
+
routes: routes.concat(apiServerRoutes)
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
async beforeBuild() {
|
|
143
|
+
// help esbuild-register resolve @modern-js/server/runtime
|
|
144
|
+
if ((0, _utils.isProd)()) {
|
|
145
|
+
const {
|
|
146
|
+
internalDirectory
|
|
147
|
+
} = api.useAppContext();
|
|
148
|
+
unRegisterResolveRuntimePath = (0, _helper.registerModernRuntimePath)(internalDirectory);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
131
151
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
152
|
+
async afterBuild() {
|
|
153
|
+
if (unRegisterResolveRuntimePath) {
|
|
154
|
+
unRegisterResolveRuntimePath();
|
|
155
|
+
}
|
|
137
156
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const modernConfig = api.useResolvedConfigContext();
|
|
157
|
+
const {
|
|
158
|
+
appDirectory,
|
|
159
|
+
distDirectory
|
|
160
|
+
} = api.useAppContext();
|
|
161
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
144
162
|
|
|
145
|
-
|
|
163
|
+
const distDir = _path.default.resolve(distDirectory);
|
|
146
164
|
|
|
147
|
-
|
|
165
|
+
const apiDir = _path.default.resolve(appDirectory, _utils.API_DIR);
|
|
148
166
|
|
|
149
|
-
|
|
167
|
+
const sharedDir = _path.default.resolve(appDirectory, _utils.SHARED_DIR);
|
|
150
168
|
|
|
151
|
-
|
|
169
|
+
const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
152
170
|
|
|
153
|
-
|
|
171
|
+
const patterns = [];
|
|
154
172
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
173
|
+
if (_utils.fs.existsSync(apiDir)) {
|
|
174
|
+
patterns.push({
|
|
175
|
+
from: apiDir,
|
|
176
|
+
to: distDir,
|
|
177
|
+
tsconfigPath
|
|
178
|
+
});
|
|
179
|
+
}
|
|
162
180
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
181
|
+
if (_utils.fs.existsSync(sharedDir)) {
|
|
182
|
+
patterns.push({
|
|
183
|
+
from: sharedDir,
|
|
184
|
+
to: distDir,
|
|
185
|
+
tsconfigPath
|
|
186
|
+
});
|
|
187
|
+
}
|
|
170
188
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
189
|
+
if (patterns.length > 0) {
|
|
190
|
+
await compile(appDirectory, modernConfig, {
|
|
191
|
+
patterns
|
|
192
|
+
});
|
|
193
|
+
}
|
|
175
194
|
}
|
|
176
|
-
}
|
|
177
195
|
|
|
178
|
-
|
|
196
|
+
};
|
|
197
|
+
}
|
|
179
198
|
});
|
|
180
199
|
|
|
181
200
|
exports.default = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerModernRuntimePath = void 0;
|
|
7
|
+
|
|
8
|
+
var path = _interopRequireWildcard(require("path"));
|
|
9
|
+
|
|
10
|
+
var _bffCore = require("@modern-js/bff-core");
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
const serverRuntimeAlias = '@modern-js/runtime/server';
|
|
17
|
+
const serverRuntimePath = '.runtime-exports/server';
|
|
18
|
+
|
|
19
|
+
const registerModernRuntimePath = internalDirectory => {
|
|
20
|
+
const paths = {
|
|
21
|
+
[serverRuntimeAlias]: path.join(internalDirectory, serverRuntimePath)
|
|
22
|
+
};
|
|
23
|
+
const unRegister = (0, _bffCore.registerPaths)(paths);
|
|
24
|
+
return unRegister;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.registerModernRuntimePath = registerModernRuntimePath;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.6.1",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -53,20 +53,20 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@babel/core": "^7.
|
|
57
|
-
"@babel/runtime": "^7",
|
|
58
|
-
"@modern-js/babel-compiler": "^1.2.
|
|
59
|
-
"@modern-js/bff-core": "^1.
|
|
60
|
-
"@modern-js/create-request": "^1.
|
|
61
|
-
"@modern-js/server-utils": "^1.2.
|
|
62
|
-
"@modern-js/utils": "^1.7.
|
|
56
|
+
"@babel/core": "^7.18.0",
|
|
57
|
+
"@babel/runtime": "^7.18.0",
|
|
58
|
+
"@modern-js/babel-compiler": "^1.2.6",
|
|
59
|
+
"@modern-js/bff-core": "^1.1.1",
|
|
60
|
+
"@modern-js/create-request": "^1.3.0",
|
|
61
|
+
"@modern-js/server-utils": "^1.2.11",
|
|
62
|
+
"@modern-js/utils": "^1.7.12"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@modern-js/core": "1.
|
|
66
|
-
"@modern-js/plugin-analyze": "1.4.
|
|
67
|
-
"@modern-js/runtime": "1.3.
|
|
68
|
-
"@modern-js/server-core": "1.
|
|
69
|
-
"@modern-js/types": "1.5.
|
|
65
|
+
"@modern-js/core": "1.12.4",
|
|
66
|
+
"@modern-js/plugin-analyze": "1.4.7",
|
|
67
|
+
"@modern-js/runtime": "1.3.4",
|
|
68
|
+
"@modern-js/server-core": "1.4.0",
|
|
69
|
+
"@modern-js/types": "1.5.6",
|
|
70
70
|
"@scripts/build": "0.0.0",
|
|
71
71
|
"@scripts/jest-config": "0.0.0",
|
|
72
72
|
"@types/babel__core": "^7.1.15",
|
|
@@ -82,8 +82,7 @@
|
|
|
82
82
|
"sideEffects": false,
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"registry": "https://registry.npmjs.org/",
|
|
85
|
-
"access": "public"
|
|
86
|
-
"types": "./dist/types/index.d.ts"
|
|
85
|
+
"access": "public"
|
|
87
86
|
},
|
|
88
87
|
"wireit": {
|
|
89
88
|
"build": {
|