@modern-js/plugin-server-build 1.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,85 +1,58 @@
1
1
  # @modern-js/plugin-server-build
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)
3
+ ## 1.2.1
41
4
 
42
- 3. 修复模块工程方案 .npmignore 文件初始化未生成
43
-
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
5
+ ### Patch Changes
59
6
 
60
- - [254](https://github.com/modern-js-dev/modern.js/pull/254)
7
+ - 83166714: change .npmignore
8
+ - Updated dependencies [83166714]
9
+ - Updated dependencies [c3de9882]
10
+ - Updated dependencies [33ff48af]
11
+ - @modern-js/core@1.3.2
12
+ - @modern-js/server-utils@1.2.1
13
+ - @modern-js/babel-compiler@1.2.1
14
+ - @modern-js/utils@1.2.2
61
15
 
62
- 5. 修复 BFF 一体化开发不支持 unbundle 模式
16
+ ## 1.2.0
63
17
 
64
- ISSUE
18
+ ### Minor Changes
65
19
 
66
- - [235](https://github.com/modern-js-dev/modern.js/issues/235)
67
- - [257](https://github.com/modern-js-dev/modern.js/issues/257)
20
+ - cfe11628: Make Modern.js self bootstraping
68
21
 
69
- PR
22
+ ### Patch Changes
70
23
 
71
- - [269](https://github.com/modern-js-dev/modern.js/pull/269)
72
- - [271](https://github.com/modern-js-dev/modern.js/pull/271)
24
+ - Updated dependencies [2da09c69]
25
+ - Updated dependencies [fc71e36f]
26
+ - Updated dependencies [146dcd85]
27
+ - Updated dependencies [c3d46ee4]
28
+ - Updated dependencies [cfe11628]
29
+ - Updated dependencies [146dcd85]
30
+ - Updated dependencies [146dcd85]
31
+ - Updated dependencies [1ebc7ee2]
32
+ - @modern-js/utils@1.2.0
33
+ - @modern-js/core@1.3.0
34
+ - @modern-js/server-utils@1.2.0
35
+ - @modern-js/babel-compiler@1.2.0
36
+
37
+ ## 1.1.1
73
38
 
74
- 6. 修复 Node17 dev 命令报错问题
39
+ ### Patch Changes
75
40
 
76
- ISSUE
41
+ - 0fa83663: support more .env files
42
+ - Updated dependencies [6f7fe574]
43
+ - Updated dependencies [b011e0c5]
44
+ - Updated dependencies [0fa83663]
45
+ - Updated dependencies [f594fbc8]
46
+ - @modern-js/core@1.1.2
47
+ - @modern-js/server-utils@1.1.1
48
+ - @modern-js/babel-compiler@1.1.2
49
+ - @modern-js/utils@1.1.2
77
50
 
78
- - [180](https://github.com/modern-js-dev/modern.js/issues/180)
51
+ ## 1.1.0
79
52
 
80
- PR
53
+ ### Minor Changes
81
54
 
82
- - [214](https://github.com/modern-js-dev/modern.js/pull/214)
55
+ - 96119db2: Relese v1.1.0
83
56
 
84
57
  ### Patch Changes
85
58
 
package/jest.config.js ADDED
@@ -0,0 +1,8 @@
1
+ const sharedConfig = require('@scripts/jest-config');
2
+
3
+ /** @type {import('@jest/types').Config.InitialOptions} */
4
+ module.exports = {
5
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
+ ...sharedConfig,
7
+ rootDir: __dirname,
8
+ };
package/modern.config.js CHANGED
@@ -1,10 +1,2 @@
1
1
  /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {
3
- testing: {
4
- jest: {
5
- collectCoverage: true,
6
- collectCoverageFrom: ['src/**/*.ts'],
7
- coveragePathIgnorePatterns: ['/node_modules/'],
8
- },
9
- },
10
- };
2
+ module.exports = {};
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.2.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -20,6 +20,7 @@
20
20
  "exports": {
21
21
  ".": {
22
22
  "node": {
23
+ "jsnext:source": "./src/index.ts",
23
24
  "import": "./dist/js/modern/index.js",
24
25
  "require": "./dist/js/node/index.js"
25
26
  },
@@ -28,25 +29,26 @@
28
29
  },
29
30
  "dependencies": {
30
31
  "@babel/runtime": "^7",
31
- "@modern-js/babel-compiler": "^1.1.0",
32
- "@modern-js/server-utils": "^1.1.0",
33
- "@modern-js/utils": "^1.1.0",
32
+ "@modern-js/babel-compiler": "^1.2.1",
33
+ "@modern-js/server-utils": "^1.2.1",
34
+ "@modern-js/utils": "^1.2.2",
34
35
  "globby": "^12.0.2",
35
36
  "json5": "^2.2.0"
36
37
  },
37
38
  "devDependencies": {
38
- "@modern-js/plugin-analyze": "^1.1.0",
39
+ "@modern-js/plugin-analyze": "^1.2.1",
39
40
  "@types/babel__core": "^7.1.15",
40
41
  "@types/jest": "^26",
41
42
  "@types/node": "^14",
42
43
  "ts-jest": "^27.0.5",
43
44
  "typescript": "^4",
44
- "@modern-js/core": "^1.1.0",
45
- "@modern-js/plugin-testing": "^1.0.2",
46
- "@modern-js/module-tools": "^1.0.2"
45
+ "@modern-js/core": "^1.3.2",
46
+ "@scripts/build": "0.0.0",
47
+ "jest": "^27",
48
+ "@scripts/jest-config": "0.0.0"
47
49
  },
48
50
  "peerDependencies": {
49
- "@modern-js/core": "^1.1.0"
51
+ "@modern-js/core": "^1.3.2"
50
52
  },
51
53
  "sideEffects": false,
52
54
  "modernConfig": {
@@ -56,12 +58,14 @@
56
58
  },
57
59
  "publishConfig": {
58
60
  "registry": "https://registry.npmjs.org/",
59
- "access": "public"
61
+ "access": "public",
62
+ "types": "./dist/types/index.d.ts"
60
63
  },
61
64
  "scripts": {
62
65
  "new": "modern new",
63
66
  "build": "modern build",
64
67
  "dev": "modern build --watch",
65
- "test": "modern test --passWithNoTests"
66
- }
68
+ "test": "jest --passWithNoTests"
69
+ },
70
+ "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"
67
71
  }
@@ -0,0 +1,7 @@
1
+ import plugin from '../src';
2
+
3
+ describe('plugin-server-build', () => {
4
+ it('default', () => {
5
+ expect(plugin).toBeDefined();
6
+ });
7
+ });
package/tsconfig.json CHANGED
@@ -7,9 +7,7 @@
7
7
  "skipLibCheck": true,
8
8
  "esModuleInterop": true,
9
9
  "isolatedModules": true,
10
- "paths": {
11
- "@/*": ["./src/*"]
12
- },
10
+ "paths": {},
13
11
  "types": ["node", "jest"]
14
12
  },
15
13
  "include": ["src", "src/.ts"]
package/src/index.ts DELETED
@@ -1,98 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import {
4
- createPlugin,
5
- useAppContext,
6
- useResolvedConfigContext,
7
- NormalizedConfig,
8
- } from '@modern-js/core';
9
- import { compiler } from '@modern-js/babel-compiler';
10
- import { resolveBabelConfig } from '@modern-js/server-utils';
11
-
12
- const SERVER_DIR = './server';
13
- const SHARED_DIR = './shared';
14
- const TS_CONFIG_FILENAME = 'tsconfig.json';
15
- const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs'];
16
-
17
- interface Pattern {
18
- from: string;
19
- to: string;
20
- tsconfigPath?: string;
21
- }
22
-
23
- interface CompileOptions {
24
- patterns: Pattern[];
25
- }
26
-
27
- const compile = async (
28
- appDirectory: string,
29
- modernConfig: NormalizedConfig,
30
- compileOptions: CompileOptions,
31
- ) => {
32
- const { patterns } = compileOptions;
33
- const results = await Promise.all(
34
- patterns.map(pattern => {
35
- const { from, to, tsconfigPath } = pattern;
36
- const babelConfig = resolveBabelConfig(appDirectory, modernConfig, {
37
- tsconfigPath: tsconfigPath ? tsconfigPath : '',
38
- syntax: 'es6+',
39
- type: 'commonjs',
40
- });
41
- return compiler(
42
- {
43
- rootDir: appDirectory,
44
- distDir: to,
45
- sourceDir: from,
46
- extensions: FILE_EXTENSIONS,
47
- },
48
- babelConfig,
49
- );
50
- }),
51
- );
52
- results.forEach(result => {
53
- if (result.code === 1) {
54
- throw new Error(result.message);
55
- }
56
- });
57
- };
58
-
59
- export default createPlugin(
60
- () => ({
61
- config() {
62
- return {};
63
- },
64
- async afterBuild() {
65
- // eslint-disable-next-line react-hooks/rules-of-hooks
66
- const { appDirectory, distDirectory } = useAppContext();
67
- // eslint-disable-next-line react-hooks/rules-of-hooks
68
- const modernConfig = useResolvedConfigContext();
69
-
70
- const distDir = path.resolve(distDirectory);
71
- const serverDir = path.resolve(appDirectory, SERVER_DIR);
72
- const sharedDir = path.resolve(appDirectory, SHARED_DIR);
73
- const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
74
-
75
- const patterns = [];
76
- if (fs.existsSync(serverDir)) {
77
- patterns.push({
78
- from: serverDir,
79
- to: distDir,
80
- tsconfigPath,
81
- });
82
- }
83
-
84
- if (fs.existsSync(sharedDir)) {
85
- patterns.push({
86
- from: sharedDir,
87
- to: distDir,
88
- tsconfigPath,
89
- });
90
- }
91
-
92
- if (patterns.length > 0) {
93
- await compile(appDirectory, modernConfig, { patterns });
94
- }
95
- },
96
- }),
97
- { name: '@modern-js/plugin-server-build' },
98
- ) as any;