@modern-js/plugin-server-build 0.0.0-canary-20220118120919 → 0.0.0-canary-20220127122200

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.
@@ -0,0 +1,27 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <%= meta %>
6
+ <title><%= title %></title>
7
+
8
+
9
+
10
+ <script>
11
+ window.__assetPrefix__ = '<%= assetPrefix %>';
12
+ </script>
13
+
14
+ </head>
15
+
16
+ <body>
17
+ <!--<?- chunksMap.css ?>-->
18
+ <noscript>
19
+ We're sorry but react app doesn't work properly without JavaScript enabled. Please enable it to continue.
20
+ </noscript>
21
+ <div id="<%= mountId %>"><!--<?- html ?>--></div>
22
+
23
+ <!--<?- chunksMap.js ?>-->
24
+ <!--<?- SSRDataScript ?>-->
25
+ </body>
26
+
27
+ </html>
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # @modern-js/plugin-server-build
2
2
 
3
- ## 0.0.0-canary-20220118120919
3
+ ## 0.0.0-canary-20220127122200
4
+
5
+ ### Patch Changes
6
+
7
+ - 83166714: change .npmignore
8
+ - Updated dependencies [83166714]
9
+ - Updated dependencies [33ff48af]
10
+ - @modern-js/core@0.0.0-canary-20220127122200
11
+ - @modern-js/server-utils@0.0.0-canary-20220127122200
12
+ - @modern-js/babel-compiler@0.0.0-canary-20220127122200
13
+ - @modern-js/utils@0.0.0-canary-20220127122200
14
+
15
+ ## 1.2.0
4
16
 
5
17
  ### Minor Changes
6
18
 
@@ -8,16 +20,18 @@
8
20
 
9
21
  ### Patch Changes
10
22
 
23
+ - Updated dependencies [2da09c69]
11
24
  - Updated dependencies [fc71e36f]
12
25
  - Updated dependencies [146dcd85]
13
26
  - Updated dependencies [c3d46ee4]
14
27
  - Updated dependencies [cfe11628]
15
28
  - Updated dependencies [146dcd85]
16
29
  - Updated dependencies [146dcd85]
17
- - @modern-js/core@0.0.0-canary-20220118120919
18
- - @modern-js/server-utils@0.0.0-canary-20220118120919
19
- - @modern-js/utils@0.0.0-canary-20220118120919
20
- - @modern-js/babel-compiler@0.0.0-canary-20220118120919
30
+ - Updated dependencies [1ebc7ee2]
31
+ - @modern-js/utils@1.2.0
32
+ - @modern-js/core@1.3.0
33
+ - @modern-js/server-utils@1.2.0
34
+ - @modern-js/babel-compiler@1.2.0
21
35
 
22
36
  ## 1.1.1
23
37
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "0.0.0-canary-20220118120919",
14
+ "version": "0.0.0-canary-20220127122200",
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,26 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7",
32
- "@modern-js/babel-compiler": "^0.0.0-canary-20220118120919",
33
- "@modern-js/server-utils": "^0.0.0-canary-20220118120919",
34
- "@modern-js/utils": "^0.0.0-canary-20220118120919",
32
+ "@modern-js/babel-compiler": "^0.0.0-canary-20220127122200",
33
+ "@modern-js/server-utils": "^0.0.0-canary-20220127122200",
34
+ "@modern-js/utils": "^0.0.0-canary-20220127122200",
35
35
  "globby": "^12.0.2",
36
36
  "json5": "^2.2.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@modern-js/plugin-analyze": "^0.0.0-canary-20220118120919",
39
+ "@modern-js/plugin-analyze": "^0.0.0-canary-20220127122200",
40
40
  "@types/babel__core": "^7.1.15",
41
41
  "@types/jest": "^26",
42
42
  "@types/node": "^14",
43
43
  "ts-jest": "^27.0.5",
44
44
  "typescript": "^4",
45
- "@modern-js/core": "^0.0.0-canary-20220118120919",
45
+ "@modern-js/core": "^0.0.0-canary-20220127122200",
46
46
  "@scripts/build": "0.0.0",
47
47
  "jest": "^27",
48
48
  "@scripts/jest-config": "0.0.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@modern-js/core": "^0.0.0-canary-20220118120919"
51
+ "@modern-js/core": "^0.0.0-canary-20220127122200"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "modernConfig": {
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;