@modern-js/server-utils 1.0.0-rc.2

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,22 @@
1
+ import path from 'path';
2
+ import { gather } from '@/index';
3
+
4
+ describe('@modern-js/server-utils', () => {
5
+ it('should work well', () => {
6
+ const pwd = path.resolve(__dirname, './fixtures');
7
+ const result = gather(pwd);
8
+
9
+ expect(result.api.length).toBe(1);
10
+ expect(result.api[0]).toBe('@koa/api');
11
+ expect(result.web.length).toBe(1);
12
+ expect(result.web[0]).toBe('@koa/web');
13
+ });
14
+
15
+ it('should get empty when pass a empty dir', () => {
16
+ const pwd = path.resolve(__dirname, './fixtures/empty');
17
+ const result = gather(pwd);
18
+
19
+ expect(result.api.length).toBe(0);
20
+ expect(result.web.length).toBe(0);
21
+ });
22
+ });
@@ -0,0 +1,104 @@
1
+ const sourceDefaults = {
2
+ entries: undefined,
3
+ disableDefaultEntries: false,
4
+ entriesDir: './src',
5
+ configDir: './config',
6
+ apiDir: './api',
7
+ envVars: [],
8
+ globalVars: undefined,
9
+ alias: undefined,
10
+ moduleScopes: undefined,
11
+ include: [],
12
+ };
13
+
14
+ const outputDefaults = {
15
+ assetPrefix: '/',
16
+ htmlPath: 'html',
17
+ jsPath: 'static/js',
18
+ cssPath: 'static/css',
19
+ mediaPath: 'static/media',
20
+ path: 'dist',
21
+ title: '',
22
+ titleByEntries: undefined,
23
+ meta: {
24
+ charset: { charset: 'utf-8' },
25
+ viewport:
26
+ 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
27
+ 'http-equiv': { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' },
28
+ renderer: 'webkit',
29
+ layoutmode: 'standard',
30
+ imagemode: 'force',
31
+ 'wap-font-scale': 'no',
32
+ 'format-detection': 'telephone=no',
33
+ },
34
+ metaByEntries: undefined,
35
+ inject: 'head',
36
+ injectByEntries: undefined,
37
+ mountId: 'root',
38
+ favicon: '',
39
+ faviconByEntries: undefined,
40
+ copy: undefined,
41
+ scriptExt: undefined,
42
+ disableHtmlFolder: false,
43
+ disableCssModuleExtension: false,
44
+ disableCssExtract: false,
45
+ enableCssModuleTSDeclaration: false,
46
+ disableMinimize: false,
47
+ enableInlineStyles: false,
48
+ enableInlineScripts: false,
49
+ disableSourceMap: false,
50
+ disableInlineRuntimeChunk: false,
51
+ disableAssetsCache: false,
52
+ enableLatestDecorators: false,
53
+ polyfill: 'entry',
54
+ dataUriLimit: 10000,
55
+ templateParameters: {},
56
+ templateParametersByEntries: undefined,
57
+ cssModuleLocalIdentName: '[name]__[local]--[hash:base64:5]',
58
+ enableModernMode: false,
59
+ federation: undefined,
60
+ disableNodePolyfill: false,
61
+ enableTsLoader: false,
62
+ };
63
+
64
+ const serverDefaults = {
65
+ routes: undefined,
66
+ publicRoutes: undefined,
67
+ ssr: undefined,
68
+ ssrByEntries: undefined,
69
+ baseUrl: '/',
70
+ port: 8080,
71
+ };
72
+
73
+ const devDefaults = { assetPrefix: false };
74
+
75
+ const deployDefaults = {
76
+ microFrontend: {
77
+ enableLegacy: false,
78
+ enableHtmlEntry: false,
79
+ moduleApp: undefined,
80
+ },
81
+ domain: '',
82
+ domainByEntries: undefined,
83
+ };
84
+
85
+ const toolsDefaults = {
86
+ webpack: undefined,
87
+ babel: undefined,
88
+ postcss: undefined,
89
+ autoprefixer: undefined,
90
+ lodash: undefined,
91
+ devServer: undefined,
92
+ tsLoader: undefined,
93
+ terser: undefined,
94
+ minifyCss: undefined,
95
+ };
96
+
97
+ export const defaults = {
98
+ source: sourceDefaults,
99
+ output: outputDefaults,
100
+ server: serverDefaults,
101
+ dev: devDefaults,
102
+ deploy: deployDefaults,
103
+ tools: toolsDefaults,
104
+ };
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@modern-js/tsconfig/base",
3
+ "compilerOptions": {
4
+ "declaration": false,
5
+ "jsx": "preserve",
6
+ "baseUrl": "./",
7
+ "isolatedModules": true,
8
+ "paths": {
9
+ "@/*": ["../src/*"]
10
+ },
11
+ "types": ["node", "jest"]
12
+ }
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "@modern-js/tsconfig/base",
3
+ "compilerOptions": {
4
+ "declaration": false,
5
+ "jsx": "preserve",
6
+ "baseUrl": "./",
7
+ "isolatedModules": true,
8
+ "paths": {
9
+ "@/*": ["./src/*"]
10
+ },
11
+ "types": ["node", "jest"]
12
+ },
13
+ "include": ["src"]
14
+ }