@modern-js/plugin-server-build 1.2.2 → 1.2.3
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 +9 -0
- package/dist/js/modern/index.js +35 -41
- package/dist/js/node/index.js +42 -49
- package/dist/types/index.d.ts +3 -1
- package/jest.config.js +0 -1
- package/modern.config.js +5 -1
- package/package.json +4 -12
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# @modern-js/plugin-server-build
|
2
2
|
|
3
|
+
## 1.2.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 61e3f623: feat: convert to new plugin
|
8
|
+
- 681a1ff9: feat: remove unnecessary peerDependencies
|
9
|
+
- Updated dependencies [c2046f37]
|
10
|
+
- @modern-js/utils@1.3.6
|
11
|
+
|
3
12
|
## 1.2.2
|
4
13
|
|
5
14
|
### Patch Changes
|
package/dist/js/modern/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import fs from 'fs';
|
2
2
|
import path from 'path';
|
3
|
-
import { createPlugin, useAppContext, useResolvedConfigContext } from '@modern-js/core';
|
4
3
|
import { compiler } from '@modern-js/babel-compiler';
|
5
4
|
import { resolveBabelConfig } from '@modern-js/server-utils';
|
6
5
|
const SERVER_DIR = './server';
|
@@ -37,48 +36,43 @@ const compile = async (appDirectory, modernConfig, compileOptions) => {
|
|
37
36
|
});
|
38
37
|
};
|
39
38
|
|
40
|
-
export default
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
export default (() => ({
|
40
|
+
name: '@modern-js/plugin-server-build',
|
41
|
+
setup: api => ({
|
42
|
+
async afterBuild() {
|
43
|
+
const {
|
44
|
+
appDirectory,
|
45
|
+
distDirectory
|
46
|
+
} = api.useAppContext();
|
47
|
+
const modernConfig = api.useResolvedConfigContext();
|
48
|
+
const distDir = path.resolve(distDirectory);
|
49
|
+
const serverDir = path.resolve(appDirectory, SERVER_DIR);
|
50
|
+
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
51
|
+
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
52
|
+
const patterns = [];
|
44
53
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
const modernConfig = useResolvedConfigContext();
|
53
|
-
const distDir = path.resolve(distDirectory);
|
54
|
-
const serverDir = path.resolve(appDirectory, SERVER_DIR);
|
55
|
-
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
56
|
-
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
57
|
-
const patterns = [];
|
54
|
+
if (fs.existsSync(serverDir)) {
|
55
|
+
patterns.push({
|
56
|
+
from: serverDir,
|
57
|
+
to: distDir,
|
58
|
+
tsconfigPath
|
59
|
+
});
|
60
|
+
}
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
if (fs.existsSync(sharedDir)) {
|
68
|
-
patterns.push({
|
69
|
-
from: sharedDir,
|
70
|
-
to: distDir,
|
71
|
-
tsconfigPath
|
72
|
-
});
|
73
|
-
}
|
62
|
+
if (fs.existsSync(sharedDir)) {
|
63
|
+
patterns.push({
|
64
|
+
from: sharedDir,
|
65
|
+
to: distDir,
|
66
|
+
tsconfigPath
|
67
|
+
});
|
68
|
+
}
|
74
69
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
70
|
+
if (patterns.length > 0) {
|
71
|
+
await compile(appDirectory, modernConfig, {
|
72
|
+
patterns
|
73
|
+
});
|
74
|
+
}
|
79
75
|
}
|
80
|
-
}
|
81
76
|
|
82
|
-
})
|
83
|
-
|
84
|
-
});
|
77
|
+
})
|
78
|
+
}));
|
package/dist/js/node/index.js
CHANGED
@@ -9,8 +9,6 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
9
9
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
11
11
|
|
12
|
-
var _core = require("@modern-js/core");
|
13
|
-
|
14
12
|
var _babelCompiler = require("@modern-js/babel-compiler");
|
15
13
|
|
16
14
|
var _serverUtils = require("@modern-js/server-utils");
|
@@ -51,55 +49,50 @@ const compile = async (appDirectory, modernConfig, compileOptions) => {
|
|
51
49
|
});
|
52
50
|
};
|
53
51
|
|
54
|
-
var _default = (
|
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
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
await compile(appDirectory, modernConfig, {
|
96
|
-
patterns
|
97
|
-
});
|
52
|
+
var _default = () => ({
|
53
|
+
name: '@modern-js/plugin-server-build',
|
54
|
+
setup: api => ({
|
55
|
+
async afterBuild() {
|
56
|
+
const {
|
57
|
+
appDirectory,
|
58
|
+
distDirectory
|
59
|
+
} = api.useAppContext();
|
60
|
+
const modernConfig = api.useResolvedConfigContext();
|
61
|
+
|
62
|
+
const distDir = _path.default.resolve(distDirectory);
|
63
|
+
|
64
|
+
const serverDir = _path.default.resolve(appDirectory, SERVER_DIR);
|
65
|
+
|
66
|
+
const sharedDir = _path.default.resolve(appDirectory, SHARED_DIR);
|
67
|
+
|
68
|
+
const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
69
|
+
|
70
|
+
const patterns = [];
|
71
|
+
|
72
|
+
if (_fs.default.existsSync(serverDir)) {
|
73
|
+
patterns.push({
|
74
|
+
from: serverDir,
|
75
|
+
to: distDir,
|
76
|
+
tsconfigPath
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
if (_fs.default.existsSync(sharedDir)) {
|
81
|
+
patterns.push({
|
82
|
+
from: sharedDir,
|
83
|
+
to: distDir,
|
84
|
+
tsconfigPath
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
if (patterns.length > 0) {
|
89
|
+
await compile(appDirectory, modernConfig, {
|
90
|
+
patterns
|
91
|
+
});
|
92
|
+
}
|
98
93
|
}
|
99
|
-
}
|
100
94
|
|
101
|
-
})
|
102
|
-
name: '@modern-js/plugin-server-build'
|
95
|
+
})
|
103
96
|
});
|
104
97
|
|
105
98
|
exports.default = _default;
|
package/dist/types/index.d.ts
CHANGED
package/jest.config.js
CHANGED
package/modern.config.js
CHANGED
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.2.
|
14
|
+
"version": "1.2.3",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -31,29 +31,21 @@
|
|
31
31
|
"@babel/runtime": "^7",
|
32
32
|
"@modern-js/babel-compiler": "^1.2.2",
|
33
33
|
"@modern-js/server-utils": "^1.2.1",
|
34
|
-
"@modern-js/utils": "^1.3.
|
34
|
+
"@modern-js/utils": "^1.3.6"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
-
"@modern-js/plugin-analyze": "^1.
|
37
|
+
"@modern-js/plugin-analyze": "^1.3.4",
|
38
38
|
"@types/babel__core": "^7.1.15",
|
39
39
|
"@types/jest": "^26",
|
40
40
|
"@types/node": "^14",
|
41
41
|
"ts-jest": "^27.0.5",
|
42
42
|
"typescript": "^4",
|
43
|
-
"@modern-js/core": "^1.
|
43
|
+
"@modern-js/core": "^1.6.0",
|
44
44
|
"@scripts/build": "0.0.0",
|
45
45
|
"jest": "^27",
|
46
46
|
"@scripts/jest-config": "0.0.0"
|
47
47
|
},
|
48
|
-
"peerDependencies": {
|
49
|
-
"@modern-js/core": "^1.4.4"
|
50
|
-
},
|
51
48
|
"sideEffects": false,
|
52
|
-
"modernConfig": {
|
53
|
-
"output": {
|
54
|
-
"packageMode": "node-js"
|
55
|
-
}
|
56
|
-
},
|
57
49
|
"publishConfig": {
|
58
50
|
"registry": "https://registry.npmjs.org/",
|
59
51
|
"access": "public"
|
package/tsconfig.json
CHANGED