@modern-js/plugin-server-build 0.0.0-canary-20220121110643 → 0.0.0-canary-20220308102236

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,6 +1,33 @@
1
1
  # @modern-js/plugin-server-build
2
2
 
3
- ## 0.0.0-canary-20220121110643
3
+ ## 0.0.0-canary-20220308102236
4
+
5
+ ### Patch Changes
6
+
7
+ - 55e18278: chore: remove unused dependencies and devDependencies
8
+ - Updated dependencies [4c792f68]
9
+ - Updated dependencies [62f5b8c8]
10
+ - Updated dependencies [55e18278]
11
+ - Updated dependencies [4499a674]
12
+ - Updated dependencies [a7f42f48]
13
+ - @modern-js/utils@0.0.0-canary-20220308102236
14
+ - @modern-js/core@0.0.0-canary-20220308102236
15
+ - @modern-js/babel-compiler@0.0.0-canary-20220308102236
16
+
17
+ ## 1.2.1
18
+
19
+ ### Patch Changes
20
+
21
+ - 83166714: change .npmignore
22
+ - Updated dependencies [83166714]
23
+ - Updated dependencies [c3de9882]
24
+ - Updated dependencies [33ff48af]
25
+ - @modern-js/core@1.3.2
26
+ - @modern-js/server-utils@1.2.1
27
+ - @modern-js/babel-compiler@1.2.1
28
+ - @modern-js/utils@1.2.2
29
+
30
+ ## 1.2.0
4
31
 
5
32
  ### Minor Changes
6
33
 
@@ -15,11 +42,11 @@
15
42
  - Updated dependencies [cfe11628]
16
43
  - Updated dependencies [146dcd85]
17
44
  - Updated dependencies [146dcd85]
18
- - Updated dependencies [cc3c7237]
19
- - @modern-js/utils@0.0.0-canary-20220121110643
20
- - @modern-js/core@0.0.0-canary-20220121110643
21
- - @modern-js/server-utils@0.0.0-canary-20220121110643
22
- - @modern-js/babel-compiler@0.0.0-canary-20220121110643
45
+ - Updated dependencies [1ebc7ee2]
46
+ - @modern-js/utils@1.2.0
47
+ - @modern-js/core@1.3.0
48
+ - @modern-js/server-utils@1.2.0
49
+ - @modern-js/babel-compiler@1.2.0
23
50
 
24
51
  ## 1.1.1
25
52
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "0.0.0-canary-20220121110643",
14
+ "version": "0.0.0-canary-20220308102236",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -29,26 +29,24 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7",
32
- "@modern-js/babel-compiler": "^0.0.0-canary-20220121110643",
33
- "@modern-js/server-utils": "^0.0.0-canary-20220121110643",
34
- "@modern-js/utils": "^0.0.0-canary-20220121110643",
35
- "globby": "^12.0.2",
36
- "json5": "^2.2.0"
32
+ "@modern-js/babel-compiler": "^0.0.0-canary-20220308102236",
33
+ "@modern-js/server-utils": "^1.2.1",
34
+ "@modern-js/utils": "^0.0.0-canary-20220308102236"
37
35
  },
38
36
  "devDependencies": {
39
- "@modern-js/plugin-analyze": "^0.0.0-canary-20220121110643",
37
+ "@modern-js/plugin-analyze": "^1.2.1",
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": "^0.0.0-canary-20220121110643",
43
+ "@modern-js/core": "^0.0.0-canary-20220308102236",
46
44
  "@scripts/build": "0.0.0",
47
45
  "jest": "^27",
48
46
  "@scripts/jest-config": "0.0.0"
49
47
  },
50
48
  "peerDependencies": {
51
- "@modern-js/core": "^0.0.0-canary-20220121110643"
49
+ "@modern-js/core": "^0.0.0-canary-20220308102236"
52
50
  },
53
51
  "sideEffects": false,
54
52
  "modernConfig": {
@@ -58,8 +56,7 @@
58
56
  },
59
57
  "publishConfig": {
60
58
  "registry": "https://registry.npmjs.org/",
61
- "access": "public",
62
- "types": "./dist/types/index.d.ts"
59
+ "access": "public"
63
60
  },
64
61
  "scripts": {
65
62
  "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/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;