@modern-js/plugin-bff 1.4.5 → 1.5.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @modern-js/plugin-bff
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f66fa0e98: feat: support tools.webpackChain config
8
+
9
+ ### Patch Changes
10
+
11
+ - 1dfe08fcd: feat(webpack): add CHAIN_ID constants for webpack chain
12
+ - 41dc62010: fix: remove typings from ignore directories
13
+ - Updated dependencies [77917e355]
14
+ - Updated dependencies [33de0f7ec]
15
+ - @modern-js/server-utils@1.2.9
16
+ - @modern-js/utils@1.7.5
17
+
3
18
  ## 1.4.5
4
19
 
5
20
  ### Patch Changes
@@ -15,8 +15,9 @@ export default (() => ({
15
15
  config() {
16
16
  return {
17
17
  tools: {
18
- webpack: (_config, {
19
- chain
18
+ webpackChain: (chain, {
19
+ name,
20
+ CHAIN_ID
20
21
  }) => {
21
22
  const {
22
23
  appDirectory,
@@ -33,12 +34,12 @@ export default (() => ({
33
34
  const rootDir = path.resolve(appDirectory, API_DIR);
34
35
  chain.resolve.alias.set('@api', rootDir);
35
36
  const apiRegexp = new RegExp(normalizeOutputPath(`${appDirectory}${path.sep}api${path.sep}.*(.[tj]s)$`));
36
- chain.module.rule('loaders').oneOf('bff-client').before('fallback').test(apiRegexp).use('custom-loader').loader(require.resolve("./loader").replace(/\\/g, '/')).options({
37
+ 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({
37
38
  prefix,
38
39
  apiDir: rootDir,
39
40
  port,
40
41
  fetcher,
41
- target: _config.name,
42
+ target: name,
42
43
  requestCreator: bff === null || bff === void 0 ? void 0 : bff.requestCreator
43
44
  });
44
45
  }
@@ -98,7 +99,7 @@ export default (() => ({
98
99
  distDir,
99
100
  sourceDir: sourceAbsDir,
100
101
  extensions: FILE_EXTENSIONS,
101
- ignore: [`**/__tests__/**`, '**/typings/**', '*.d.ts', '*.test.ts']
102
+ ignore: [`**/__tests__/**`, '*.d.ts', '*.test.ts']
102
103
  }, babelConfig);
103
104
 
104
105
  if (await fs.pathExists(rootDir)) {
@@ -108,7 +109,9 @@ export default (() => ({
108
109
  }
109
110
 
110
111
  if (result.code === 1) {
111
- throw new Error(result.message);
112
+ var _result$messageDetail;
113
+
114
+ throw new Error((result === null || result === void 0 ? void 0 : (_result$messageDetail = result.messageDetails) === null || _result$messageDetail === void 0 ? void 0 : _result$messageDetail[0].content) || result.message);
112
115
  }
113
116
  }
114
117
 
@@ -29,8 +29,9 @@ var _default = () => ({
29
29
  config() {
30
30
  return {
31
31
  tools: {
32
- webpack: (_config, {
33
- chain
32
+ webpackChain: (chain, {
33
+ name,
34
+ CHAIN_ID
34
35
  }) => {
35
36
  const {
36
37
  appDirectory,
@@ -49,12 +50,12 @@ var _default = () => ({
49
50
 
50
51
  chain.resolve.alias.set('@api', rootDir);
51
52
  const apiRegexp = new RegExp((0, _utils.normalizeOutputPath)(`${appDirectory}${_path.default.sep}api${_path.default.sep}.*(.[tj]s)$`));
52
- chain.module.rule('loaders').oneOf('bff-client').before('fallback').test(apiRegexp).use('custom-loader').loader(require.resolve("./loader").replace(/\\/g, '/')).options({
53
+ 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({
53
54
  prefix,
54
55
  apiDir: rootDir,
55
56
  port,
56
57
  fetcher,
57
- target: _config.name,
58
+ target: name,
58
59
  requestCreator: bff === null || bff === void 0 ? void 0 : bff.requestCreator
59
60
  });
60
61
  }
@@ -119,7 +120,7 @@ var _default = () => ({
119
120
  distDir,
120
121
  sourceDir: sourceAbsDir,
121
122
  extensions: FILE_EXTENSIONS,
122
- ignore: [`**/__tests__/**`, '**/typings/**', '*.d.ts', '*.test.ts']
123
+ ignore: [`**/__tests__/**`, '*.d.ts', '*.test.ts']
123
124
  }, babelConfig);
124
125
 
125
126
  if (await _utils.fs.pathExists(rootDir)) {
@@ -129,7 +130,9 @@ var _default = () => ({
129
130
  }
130
131
 
131
132
  if (result.code === 1) {
132
- throw new Error(result.message);
133
+ var _result$messageDetail;
134
+
135
+ throw new Error((result === null || result === void 0 ? void 0 : (_result$messageDetail = result.messageDetails) === null || _result$messageDetail === void 0 ? void 0 : _result$messageDetail[0].content) || result.message);
133
136
  }
134
137
  }
135
138
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.5",
14
+ "version": "1.5.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -58,14 +58,15 @@
58
58
  "@modern-js/babel-compiler": "^1.2.5",
59
59
  "@modern-js/bff-utils": "^1.2.6",
60
60
  "@modern-js/create-request": "^1.2.8",
61
- "@modern-js/server-utils": "^1.2.6",
62
- "@modern-js/utils": "^1.7.3"
61
+ "@modern-js/server-utils": "^1.2.9",
62
+ "@modern-js/utils": "^1.7.5"
63
63
  },
64
64
  "devDependencies": {
65
- "@modern-js/core": "1.10.2",
66
- "@modern-js/plugin-analyze": "1.4.3",
65
+ "@modern-js/core": "1.11.0",
66
+ "@modern-js/plugin-analyze": "1.4.5",
67
67
  "@modern-js/runtime": "1.3.0",
68
68
  "@modern-js/server-core": "1.3.5",
69
+ "@modern-js/webpack": "1.8.0",
69
70
  "@modern-js/types": "1.5.3",
70
71
  "@scripts/build": "0.0.0",
71
72
  "@scripts/jest-config": "0.0.0",
@@ -101,7 +102,8 @@
101
102
  "files": [
102
103
  "src/**/*",
103
104
  "tsconfig.json",
104
- "package.json"
105
+ "package.json",
106
+ "tests/**/*"
105
107
  ],
106
108
  "output": []
107
109
  }