@modern-js/server-utils 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/.eslintrc.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['@modern-js'],
4
+ parserOptions: {
5
+ tsconfigRootDir: __dirname,
6
+ project: ['./tsconfig.json'],
7
+ },
8
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @modern-js/server-utils
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6cffe99d: chore:
8
+ remove react eslint rules for `modern-js` rule set.
9
+ add .eslintrc for each package to speed up linting
10
+ - 04ae5262: chore: bump @modern-js/utils to v1.4.1 in dependencies
11
+ - 60f7d8bf: feat: add tests dir to npmignore
12
+ - Updated dependencies [b8599d09]
13
+ - Updated dependencies [6cffe99d]
14
+ - Updated dependencies [04ae5262]
15
+ - Updated dependencies [60f7d8bf]
16
+ - Updated dependencies [3bf4f8b0]
17
+ - @modern-js/utils@1.5.0
18
+ - @modern-js/babel-preset-lib@1.2.3
19
+ - @modern-js/plugin@1.3.3
20
+
3
21
  ## 1.2.2
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.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",
@@ -35,15 +35,15 @@
35
35
  "@babel/preset-env": "^7.15.0",
36
36
  "@babel/preset-typescript": "^7.15.0",
37
37
  "@babel/runtime": "^7",
38
- "@modern-js/babel-preset-lib": "^1.2.1",
39
- "@modern-js/plugin": "^1.2.1",
40
- "@modern-js/utils": "^1.3.7",
38
+ "@modern-js/babel-preset-lib": "^1.2.3",
39
+ "@modern-js/plugin": "^1.3.3",
40
+ "@modern-js/utils": "^1.5.0",
41
41
  "babel-plugin-module-resolver": "^4.1.0",
42
42
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
43
43
  "json5": "^2.2.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@modern-js/core": "1.6.1",
46
+ "@modern-js/core": "1.8.0",
47
47
  "@types/babel__core": "^7.1.15",
48
48
  "@types/jest": "^26",
49
49
  "@types/node": "^14",
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- };
@@ -1,174 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`babel resolveBabelConfig 1`] = `
4
- Object {
5
- "plugins": Array [
6
- Array [
7
- "/babel-plugin-macros/dist/index.js",
8
- Object {
9
- "twin": Object {
10
- "preset": "styled-components",
11
- },
12
- },
13
- ],
14
- Array [
15
- "/babel-plugin-import/lib/index.js",
16
- Object {
17
- "libraryDirectory": "es",
18
- "libraryName": "antd",
19
- "style": true,
20
- },
21
- "import-antd",
22
- ],
23
- Array [
24
- "/babel-plugin-lodash/lib/index.js",
25
- Object {
26
- "id": Array [
27
- "lodash",
28
- "ramda",
29
- ],
30
- },
31
- ],
32
- Array [
33
- "/@babel/plugin-proposal-decorators/lib/index.js",
34
- Object {
35
- "legacy": true,
36
- },
37
- ],
38
- Array [
39
- "/@babel/plugin-proposal-class-properties/lib/index.js",
40
- Object {
41
- "loose": true,
42
- },
43
- ],
44
- Array [
45
- "/@babel/plugin-proposal-private-methods/lib/index.js",
46
- Object {
47
- "loose": true,
48
- },
49
- ],
50
- Array [
51
- "/@babel/plugin-proposal-private-property-in-object/lib/index.js",
52
- Object {
53
- "loose": true,
54
- },
55
- ],
56
- Array [
57
- "/@babel/plugin-proposal-object-rest-spread/lib/index.js",
58
- Object {
59
- "useBuiltIns": true,
60
- },
61
- ],
62
- Array [
63
- "/@babel/plugin-transform-runtime/lib/index.js",
64
- Object {
65
- "corejs": false,
66
- "helpers": false,
67
- "regenerator": true,
68
- "useESModules": false,
69
- "version": "7.16.7",
70
- },
71
- ],
72
- Array [
73
- "/babel-plugin-transform-react-remove-prop-types/lib/index.js",
74
- Object {
75
- "removeImport": true,
76
- },
77
- ],
78
- Array [
79
- "/@babel/plugin-proposal-function-bind/lib/index.js",
80
- ],
81
- Array [
82
- "/@babel/plugin-proposal-export-default-from/lib/index.js",
83
- ],
84
- Array [
85
- "/@babel/plugin-proposal-export-namespace-from/lib/index.js",
86
- ],
87
- Array [
88
- "/@babel/plugin-proposal-optional-chaining/lib/index.js",
89
- ],
90
- Array [
91
- "/@babel/plugin-proposal-numeric-separator/lib/index.js",
92
- ],
93
- Array [
94
- "/@babel/plugin-proposal-pipeline-operator/lib/index.js",
95
- Object {
96
- "proposal": "minimal",
97
- },
98
- ],
99
- Array [
100
- "/@babel/plugin-proposal-partial-application/lib/index.js",
101
- ],
102
- Array [
103
- "/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js",
104
- ],
105
- Array [
106
- "/babel-plugin-styled-components/lib/index.js",
107
- Object {},
108
- "styled-components",
109
- ],
110
- Array [
111
- "/babel-plugin-transform-inline-environment-variables/lib/index.js",
112
- Object {
113
- "include": Array [],
114
- },
115
- ],
116
- Array [
117
- "/babel-plugin-module-resolver/lib/index.js",
118
- Object {
119
- "alias": Object {
120
- "@/*": Array [
121
- "./src/*",
122
- ],
123
- },
124
- "extensions": Array [
125
- ".ts",
126
- ".tsx",
127
- ".js",
128
- ".jsx",
129
- ".es",
130
- ".es6",
131
- ".mjs",
132
- ],
133
- "resolvePath": [Function],
134
- "root": "/packages/server/utils/tests/fixtures/",
135
- },
136
- ],
137
- Array [
138
- "/babel-plugin-transform-typescript-metadata/lib/plugin.js",
139
- ],
140
- ],
141
- "presets": Array [
142
- Array [
143
- "/@babel/preset-env/lib/index.js",
144
- Object {
145
- "bugfixes": true,
146
- "modules": "commonjs",
147
- "shippedProposals": false,
148
- "targets": Array [
149
- "chrome > 61",
150
- "edge > 16",
151
- "firefox > 60",
152
- "safari > 11",
153
- "ios_saf > 11",
154
- ],
155
- },
156
- ],
157
- Array [
158
- "/@babel/preset-react/lib/index.js",
159
- Object {
160
- "runtime": "automatic",
161
- },
162
- ],
163
- Array [
164
- "/@babel/preset-typescript/lib/index.js",
165
- Object {
166
- "allExtensions": true,
167
- "allowDeclareFields": true,
168
- "allowNamespaces": true,
169
- "isTSX": true,
170
- },
171
- ],
172
- ],
173
- }
174
- `;
@@ -1,40 +0,0 @@
1
- import path from 'path';
2
- import { resolveBabelConfig } from '../src';
3
- import { defaults } from './helpers';
4
-
5
- describe('babel', () => {
6
- it('resolveBabelConfig', () => {
7
- const pwd = path.resolve(__dirname, './fixtures');
8
- const tsconfigPath = path.resolve(
9
- __dirname,
10
- './fixtures/api/tsconfig.json',
11
- );
12
- const config = resolveBabelConfig(pwd, defaults as any, {
13
- type: 'commonjs',
14
- syntax: 'es6+',
15
- tsconfigPath,
16
- });
17
-
18
- const root = path.resolve(__dirname, '../../../../');
19
-
20
- expect.addSnapshotSerializer({
21
- test: val =>
22
- typeof val === 'string' &&
23
- (val.includes('modern.js') ||
24
- val.includes('node_modules') ||
25
- val.includes(root)),
26
- print: val =>
27
- // eslint-disable-next-line no-nested-ternary
28
- typeof val === 'string'
29
- ? // eslint-disable-next-line no-nested-ternary
30
- val.includes('node_modules')
31
- ? `"${val.replace(/.+node_modules/, '').replace(/\\/g, '/')}"`
32
- : val.includes('modern.js')
33
- ? `"${val.replace(/.+modern\.js/, '').replace(/\\/g, '/')}"`
34
- : `"${val.replace(root, '').replace(/\\/g, '/')}"`
35
- : (val as string),
36
- });
37
-
38
- expect(config).toMatchSnapshot();
39
- });
40
- });
@@ -1,5 +0,0 @@
1
- import { hook } from '../../../src';
2
-
3
- export default hook(({ addMiddleware }) => {
4
- addMiddleware('@koa/api');
5
- });
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "declaration": false,
4
- "jsx": "preserve",
5
- "baseUrl": "./",
6
- "isolatedModules": true,
7
- "experimentalDecorators": true,
8
- "esModuleInterop": true,
9
- "paths": {
10
- "@/*": ["./src/*"]
11
- }
12
- },
13
- "include": ["src", "api", "server", "electron"]
14
- }
@@ -1,5 +0,0 @@
1
- import { hook } from '../../../src';
2
-
3
- export default hook(({ addMiddleware }) => {
4
- addMiddleware('@koa/web');
5
- });
package/tests/helpers.ts DELETED
@@ -1,100 +0,0 @@
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: false,
77
- domain: '',
78
- domainByEntries: undefined,
79
- };
80
-
81
- const toolsDefaults = {
82
- webpack: undefined,
83
- babel: undefined,
84
- postcss: undefined,
85
- autoprefixer: undefined,
86
- lodash: undefined,
87
- devServer: undefined,
88
- tsLoader: undefined,
89
- terser: undefined,
90
- minifyCss: undefined,
91
- };
92
-
93
- export const defaults = {
94
- source: sourceDefaults,
95
- output: outputDefaults,
96
- server: serverDefaults,
97
- dev: devDefaults,
98
- deploy: deployDefaults,
99
- tools: toolsDefaults,
100
- };
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "isolatedModules": true,
8
- "paths": {},
9
- "types": ["node", "jest"]
10
- }
11
- }