@modern-js/plugin-bff 1.4.4 → 1.5.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 CHANGED
@@ -1,5 +1,51 @@
1
1
  # @modern-js/plugin-bff
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6451a098: fix: cyclic dependencies of @modern-js/core and @moden-js/webpack
8
+ - Updated dependencies [d57e7622]
9
+ - Updated dependencies [6451a098]
10
+ - Updated dependencies [bfccb4c8]
11
+ - Updated dependencies [d5a2cfd8]
12
+ - Updated dependencies [437367c6]
13
+ - @modern-js/bff-utils@1.2.8
14
+ - @modern-js/utils@1.7.6
15
+ - @modern-js/create-request@1.2.10
16
+ - @modern-js/server-utils@1.2.9
17
+
18
+ ## 1.5.0
19
+
20
+ ### Minor Changes
21
+
22
+ - f66fa0e98: feat: support tools.webpackChain config
23
+
24
+ ### Patch Changes
25
+
26
+ - 1dfe08fcd: feat(webpack): add CHAIN_ID constants for webpack chain
27
+ - 41dc62010: fix: remove typings from ignore directories
28
+ - Updated dependencies [77917e355]
29
+ - Updated dependencies [33de0f7ec]
30
+ - @modern-js/server-utils@1.2.9
31
+ - @modern-js/utils@1.7.5
32
+
33
+ ## 1.4.5
34
+
35
+ ### Patch Changes
36
+
37
+ - d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
38
+ - Updated dependencies [d32f35134]
39
+ - Updated dependencies [6ae4a34ae]
40
+ - Updated dependencies [b80229c79]
41
+ - Updated dependencies [1a30be07b]
42
+ - Updated dependencies [948cc4436]
43
+ - @modern-js/bff-utils@1.2.6
44
+ - @modern-js/create-request@1.2.8
45
+ - @modern-js/server-utils@1.2.6
46
+ - @modern-js/babel-compiler@1.2.5
47
+ - @modern-js/utils@1.7.3
48
+
3
49
  ## 1.4.4
4
50
 
5
51
  ### 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
 
@@ -1,3 +1,5 @@
1
+ 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; }
2
+
1
3
  import path from 'path';
2
4
  import { injectAPIHandlerInfos } from '@modern-js/bff-utils';
3
5
  import { API_DIR, isProd, requireExistModule } from '@modern-js/utils';
@@ -5,7 +7,7 @@ import { API_APP_NAME } from "./constants";
5
7
 
6
8
  class Storage {
7
9
  constructor() {
8
- this.middlewares = [];
10
+ _defineProperty(this, "middlewares", []);
9
11
  }
10
12
 
11
13
  reset() {
@@ -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
 
@@ -15,9 +15,11 @@ var _constants = require("./constants");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
+ 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; }
19
+
18
20
  class Storage {
19
21
  constructor() {
20
- this.middlewares = [];
22
+ _defineProperty(this, "middlewares", []);
21
23
  }
22
24
 
23
25
  reset() {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.4",
14
+ "version": "1.5.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -55,22 +55,22 @@
55
55
  "dependencies": {
56
56
  "@babel/core": "^7.17.0",
57
57
  "@babel/runtime": "^7",
58
- "@modern-js/babel-compiler": "^1.2.4",
59
- "@modern-js/bff-utils": "^1.2.5",
60
- "@modern-js/create-request": "^1.2.7",
61
- "@modern-js/server-utils": "^1.2.5",
62
- "@modern-js/utils": "^1.7.2"
58
+ "@modern-js/babel-compiler": "^1.2.5",
59
+ "@modern-js/bff-utils": "^1.2.8",
60
+ "@modern-js/create-request": "^1.2.10",
61
+ "@modern-js/server-utils": "^1.2.9",
62
+ "@modern-js/utils": "^1.7.6"
63
63
  },
64
64
  "devDependencies": {
65
- "@modern-js/core": "1.10.1",
66
- "@modern-js/plugin-analyze": "1.4.2",
67
- "@modern-js/runtime": "1.2.9",
68
- "@modern-js/server-core": "1.3.4",
69
- "@modern-js/types": "1.5.2",
65
+ "@modern-js/core": "1.11.1",
66
+ "@modern-js/plugin-analyze": "1.4.5",
67
+ "@modern-js/runtime": "1.3.0",
68
+ "@modern-js/server-core": "1.3.5",
69
+ "@modern-js/types": "1.5.4",
70
70
  "@scripts/build": "0.0.0",
71
71
  "@scripts/jest-config": "0.0.0",
72
72
  "@types/babel__core": "^7.1.15",
73
- "@types/jest": "^26",
73
+ "@types/jest": "^27",
74
74
  "@types/node": "^14",
75
75
  "jest": "^27",
76
76
  "memfs": "^3.3.0",
@@ -84,11 +84,34 @@
84
84
  "registry": "https://registry.npmjs.org/",
85
85
  "access": "public"
86
86
  },
87
+ "wireit": {
88
+ "build": {
89
+ "command": "modern build",
90
+ "files": [
91
+ "src/**/*",
92
+ "tsconfig.json",
93
+ "package.json"
94
+ ],
95
+ "output": [
96
+ "dist/**/*"
97
+ ]
98
+ },
99
+ "test": {
100
+ "command": "jest --passWithNoTests",
101
+ "files": [
102
+ "src/**/*",
103
+ "tsconfig.json",
104
+ "package.json",
105
+ "tests/**/*"
106
+ ],
107
+ "output": []
108
+ }
109
+ },
87
110
  "scripts": {
88
111
  "new": "modern new",
89
- "build": "modern build",
112
+ "build": "wireit",
90
113
  "dev": "modern build --watch",
91
- "test": "jest --passWithNoTests"
114
+ "test": "wireit"
92
115
  },
93
116
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
94
117
  }
package/.eslintrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- ignorePatterns: ['types.d.ts'],
7
- };
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- const sharedConfig = require('@scripts/jest-config');
2
-
3
- /** @type {import('@jest/types').Config.InitialOptions} */
4
- module.exports = {
5
- ...sharedConfig,
6
- rootDir: __dirname,
7
- };
package/modern.config.js DELETED
@@ -1,6 +0,0 @@
1
- /** @type {import('@modern/module-tools').UserConfig} */
2
- module.exports = {
3
- output: {
4
- packageMode: 'node-js',
5
- },
6
- };
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "jsx": "preserve",
6
- "baseUrl": ".",
7
- "skipLibCheck": true,
8
- "esModuleInterop": true,
9
- "isolatedModules": true,
10
- "paths": {},
11
- "types": ["node"]
12
- },
13
- "include": ["src"]
14
- }