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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @modern-js/plugin-server-build
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - bebb39b6: chore: improve devDependencies and peerDependencies
8
+ - Updated dependencies [bebb39b6]
9
+ - Updated dependencies [132f7b53]
10
+ - @modern-js/server-utils@1.2.2
11
+ - @modern-js/utils@1.3.7
12
+
13
+ ## 1.2.3
14
+
15
+ ### Patch Changes
16
+
17
+ - 61e3f623: feat: convert to new plugin
18
+ - 681a1ff9: feat: remove unnecessary peerDependencies
19
+ - Updated dependencies [c2046f37]
20
+ - @modern-js/utils@1.3.6
21
+
22
+ ## 1.2.2
23
+
24
+ ### Patch Changes
25
+
26
+ - 55e18278: chore: remove unused dependencies and devDependencies
27
+ - Updated dependencies [969f172f]
28
+ - Updated dependencies [4c792f68]
29
+ - Updated dependencies [4b5d4bf4]
30
+ - Updated dependencies [62f5b8c8]
31
+ - Updated dependencies [55e18278]
32
+ - Updated dependencies [4499a674]
33
+ - Updated dependencies [403f5169]
34
+ - Updated dependencies [a7f42f48]
35
+ - @modern-js/core@1.4.4
36
+ - @modern-js/utils@1.3.3
37
+ - @modern-js/babel-compiler@1.2.2
38
+
3
39
  ## 1.2.1
4
40
 
5
41
  ### Patch Changes
@@ -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 createPlugin(() => ({
41
- config() {
42
- return {};
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
- async afterBuild() {
46
- // eslint-disable-next-line react-hooks/rules-of-hooks
47
- const {
48
- appDirectory,
49
- distDirectory
50
- } = useAppContext(); // eslint-disable-next-line react-hooks/rules-of-hooks
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
- if (fs.existsSync(serverDir)) {
60
- patterns.push({
61
- from: serverDir,
62
- to: distDir,
63
- tsconfigPath
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
- if (patterns.length > 0) {
76
- await compile(appDirectory, modernConfig, {
77
- patterns
78
- });
70
+ if (patterns.length > 0) {
71
+ await compile(appDirectory, modernConfig, {
72
+ patterns
73
+ });
74
+ }
79
75
  }
80
- }
81
76
 
82
- }), {
83
- name: '@modern-js/plugin-server-build'
84
- });
77
+ })
78
+ }));
@@ -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 = (0, _core.createPlugin)(() => ({
55
- config() {
56
- return {};
57
- },
58
-
59
- async afterBuild() {
60
- // eslint-disable-next-line react-hooks/rules-of-hooks
61
- const {
62
- appDirectory,
63
- distDirectory
64
- } = (0, _core.useAppContext)(); // eslint-disable-next-line react-hooks/rules-of-hooks
65
-
66
- const modernConfig = (0, _core.useResolvedConfigContext)();
67
-
68
- const distDir = _path.default.resolve(distDirectory);
69
-
70
- const serverDir = _path.default.resolve(appDirectory, SERVER_DIR);
71
-
72
- const sharedDir = _path.default.resolve(appDirectory, SHARED_DIR);
73
-
74
- const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
75
-
76
- const patterns = [];
77
-
78
- if (_fs.default.existsSync(serverDir)) {
79
- patterns.push({
80
- from: serverDir,
81
- to: distDir,
82
- tsconfigPath
83
- });
84
- }
85
-
86
- if (_fs.default.existsSync(sharedDir)) {
87
- patterns.push({
88
- from: sharedDir,
89
- to: distDir,
90
- tsconfigPath
91
- });
92
- }
93
-
94
- if (patterns.length > 0) {
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;
@@ -1,3 +1,5 @@
1
- declare const _default: any;
1
+ import type { CliPlugin } from '@modern-js/core';
2
+
3
+ declare const _default: () => CliPlugin;
2
4
 
3
5
  export default _default;
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
package/modern.config.js CHANGED
@@ -1,2 +1,6 @@
1
1
  /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {};
2
+ module.exports = {
3
+ output: {
4
+ packageMode: 'node-js',
5
+ },
6
+ };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.1",
14
+ "version": "1.2.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -29,37 +29,26 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7",
32
- "@modern-js/babel-compiler": "^1.2.1",
33
- "@modern-js/server-utils": "^1.2.1",
34
- "@modern-js/utils": "^1.2.2",
35
- "globby": "^12.0.2",
36
- "json5": "^2.2.0"
32
+ "@modern-js/babel-compiler": "^1.2.2",
33
+ "@modern-js/server-utils": "^1.2.2",
34
+ "@modern-js/utils": "^1.3.7"
37
35
  },
38
36
  "devDependencies": {
39
- "@modern-js/plugin-analyze": "^1.2.1",
37
+ "@modern-js/plugin-analyze": "^1.3.5",
40
38
  "@types/babel__core": "^7.1.15",
41
39
  "@types/jest": "^26",
42
40
  "@types/node": "^14",
43
41
  "ts-jest": "^27.0.5",
44
42
  "typescript": "^4",
45
- "@modern-js/core": "^1.3.2",
43
+ "@modern-js/core": "1.6.1",
46
44
  "@scripts/build": "0.0.0",
47
45
  "jest": "^27",
48
46
  "@scripts/jest-config": "0.0.0"
49
47
  },
50
- "peerDependencies": {
51
- "@modern-js/core": "^1.3.2"
52
- },
53
48
  "sideEffects": false,
54
- "modernConfig": {
55
- "output": {
56
- "packageMode": "node-js"
57
- }
58
- },
59
49
  "publishConfig": {
60
50
  "registry": "https://registry.npmjs.org/",
61
- "access": "public",
62
- "types": "./dist/types/index.d.ts"
51
+ "access": "public"
63
52
  },
64
53
  "scripts": {
65
54
  "new": "modern new",
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@modern-js/tsconfig/base",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "jsx": "preserve",
6
+ "baseUrl": "./",
7
+ "outDir": "./out",
8
+ "emitDeclarationOnly": true,
9
+ "isolatedModules": true,
10
+ "paths": {},
11
+ "types": ["node", "jest"]
12
+ }
13
+ }
package/tsconfig.json CHANGED
@@ -10,5 +10,5 @@
10
10
  "paths": {},
11
11
  "types": ["node", "jest"]
12
12
  },
13
- "include": ["src", "src/.ts"]
13
+ "include": ["src"]
14
14
  }