@modern-js/plugin-express 1.1.0 → 1.1.4

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,85 +1,35 @@
1
1
  # @modern-js/plugin-express
2
2
 
3
- ## 1.1.0
4
-
5
- ### Minor Changes
6
-
7
- - 96119db2: Relese v1.1.0
8
-
9
- 1. 全面支持 Windows 平台
10
-
11
- ISSUE:
12
-
13
- - [182](https://github.com/modern-js-dev/modern.js/issues/182)
14
- - [236](https://github.com/modern-js-dev/modern.js/issues/236)
15
-
16
- PR
17
-
18
- - [219](https://github.com/modern-js-dev/modern.js/pull/219)
19
- - [247](https://github.com/modern-js-dev/modern.js/pull/247)
20
- - [249](https://github.com/modern-js-dev/modern.js/pull/249)
21
- - [253](https://github.com/modern-js-dev/modern.js/pull/253)
22
- - [268](https://github.com/modern-js-dev/modern.js/pull/268)
23
- - [270](https://github.com/modern-js-dev/modern.js/pull/270)
24
- - [273](https://github.com/modern-js-dev/modern.js/pull/273)
25
- - [276](https://github.com/modern-js-dev/modern.js/pull/276)
26
-
27
- 2. 修复 Unbundled 模式启用问题
28
-
29
- ISSUE
30
-
31
- - [186](https://github.com/modern-js-dev/modern.js/issues/186)
32
- - [224](https://github.com/modern-js-dev/modern.js/issues/224)
33
- - [225](https://github.com/modern-js-dev/modern.js/issues/225)
34
- - [238](https://github.com/modern-js-dev/modern.js/issues/238)
35
-
36
- PR
37
-
38
- - [226](https://github.com/modern-js-dev/modern.js/pull/226)
39
- - [264](https://github.com/modern-js-dev/modern.js/pull/264)
40
- - [codesmith-12](https://github.com/modern-js-dev/codesmith/pull/12)
41
-
42
- 3. 修复模块工程方案 .npmignore 文件初始化未生成
3
+ ## 1.1.2
43
4
 
44
- ISSUE
45
-
46
- - [198](https://github.com/modern-js-dev/modern.js/issues/198)
47
-
48
- PR
49
-
50
- - [209](https://github.com/modern-js-dev/modern.js/pull/209)
51
-
52
- 4. 修复 Storybook 使用时浏览器打开页面报错
53
-
54
- ISSUE
55
-
56
- - [228](https://github.com/modern-js-dev/modern.js/issues/228)
57
-
58
- PR
59
-
60
- - [254](https://github.com/modern-js-dev/modern.js/pull/254)
61
-
62
- 5. 修复 BFF 一体化开发不支持 unbundle 模式
63
-
64
- ISSUE
65
-
66
- - [235](https://github.com/modern-js-dev/modern.js/issues/235)
67
- - [257](https://github.com/modern-js-dev/modern.js/issues/257)
5
+ ### Patch Changes
68
6
 
69
- PR
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
70
17
 
71
- - [269](https://github.com/modern-js-dev/modern.js/pull/269)
72
- - [271](https://github.com/modern-js-dev/modern.js/pull/271)
18
+ ## 1.1.1
73
19
 
74
- 6. 修复 Node17 dev 命令报错问题
20
+ ### Patch Changes
75
21
 
76
- ISSUE
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
77
27
 
78
- - [180](https://github.com/modern-js-dev/modern.js/issues/180)
28
+ ## 1.1.0
79
29
 
80
- PR
30
+ ### Minor Changes
81
31
 
82
- - [214](https://github.com/modern-js-dev/modern.js/pull/214)
32
+ - 96119db2: Relese v1.1.0
83
33
 
84
34
  ### Patch Changes
85
35
 
@@ -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': bffExportsUtils.getPath()
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': bffExportsUtils.getPath()
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.1.0",
14
+ "version": "1.1.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -27,10 +27,17 @@
27
27
  },
28
28
  "./cli": "./dist/js/node/cli/index.js"
29
29
  },
30
+ "scripts": {
31
+ "prepare": "pnpm build",
32
+ "prepublishOnly": "pnpm build -- --platform",
33
+ "new": "modern new",
34
+ "build": "modern build",
35
+ "test": "modern test"
36
+ },
30
37
  "dependencies": {
31
38
  "@babel/runtime": "^7.15.3",
32
- "@modern-js/adapter-helpers": "^1.1.0",
33
- "@modern-js/utils": "^1.1.0",
39
+ "@modern-js/adapter-helpers": "workspace:^1.1.1",
40
+ "@modern-js/utils": "workspace:^1.1.2",
34
41
  "cookie-parser": "^1.4.5",
35
42
  "finalhandler": "^1.1.2",
36
43
  "formidable": "^1.2.2",
@@ -38,8 +45,8 @@
38
45
  },
39
46
  "devDependencies": {
40
47
  "express": "^4.17.1",
41
- "@modern-js/server-utils": "^1.1.0",
42
- "@modern-js/bff-runtime": "^1.1.0",
48
+ "@modern-js/server-utils": "workspace:^1.1.1",
49
+ "@modern-js/bff-runtime": "workspace:^1.1.1",
43
50
  "@types/cookie-parser": "^1.4.2",
44
51
  "@types/express": "^4.17.13",
45
52
  "@types/finalhandler": "^1.1.1",
@@ -50,11 +57,11 @@
50
57
  "@types/type-is": "^1.6.3",
51
58
  "supertest": "^6.1.6",
52
59
  "typescript": "^4",
53
- "@modern-js/bff-utils": "^1.1.0",
54
- "@modern-js/core": "^1.1.0",
55
- "@modern-js/server-plugin": "^1.1.0",
56
- "@modern-js/plugin-testing": "^1.0.2",
57
- "@modern-js/module-tools": "^1.0.2"
60
+ "@modern-js/bff-utils": "workspace:^1.1.1",
61
+ "@modern-js/core": "workspace:^1.1.2",
62
+ "@modern-js/server-plugin": "workspace:^1.1.1",
63
+ "@modern-js/plugin-testing": "^1.1.1",
64
+ "@modern-js/module-tools": "^1.1.1"
58
65
  },
59
66
  "modernConfig": {
60
67
  "output": {
@@ -62,19 +69,14 @@
62
69
  }
63
70
  },
64
71
  "peerDependencies": {
65
- "@modern-js/bff-utils": "^1.1.0",
66
- "@modern-js/core": "^1.1.0",
67
- "@modern-js/server-plugin": "^1.1.0",
68
- "@modern-js/bff-runtime": "^1.1.0",
72
+ "@modern-js/bff-utils": "workspace:^1.1.1",
73
+ "@modern-js/core": "workspace:^1.1.2",
74
+ "@modern-js/server-plugin": "workspace:^1.1.1",
75
+ "@modern-js/bff-runtime": "workspace:^1.1.1",
69
76
  "express": "^4.17.1"
70
77
  },
71
78
  "publishConfig": {
72
79
  "registry": "https://registry.npmjs.org/",
73
80
  "access": "public"
74
- },
75
- "scripts": {
76
- "new": "modern new",
77
- "build": "modern build",
78
- "test": "modern test"
79
81
  }
80
- }
82
+ }
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: { '@modern-js/runtime/server': bffExportsUtils.getPath() },
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
  },