@modern-js/types 2.9.0 → 2.11.0
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 +15 -0
- package/common/babel.d.ts +75 -0
- package/common/index.d.ts +1 -4
- package/package.json +10 -7
- package/server/context.d.ts +1 -1
- package/server/devServer.d.ts +1 -1
- package/server/hook.d.ts +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @modern-js/types
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
## 2.10.0
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- 3e0bd50: feat: when enable bff handle render, support use `useContext` to get framework plugin context in data loader.
|
|
10
|
+
feat: 当开启 BFF 托管渲染时,支持在 data loader 中使用 `useContext` 获取框架插件提供的上下文。
|
|
11
|
+
- 92d247f: fix: support tools.devServer.header include string[] type, remove get & delete & apply api in hook or middleware api
|
|
12
|
+
fix: 支持 tools.devServer.header 包含字符串数组类型,移除 Hook 和 Middleware 中对 响应 Cookie 的获取、删除操作
|
|
13
|
+
- 0da32d0: chore: upgrade jest and puppeteer
|
|
14
|
+
chore: 升级 jest 和 puppeteer 到 latest
|
|
15
|
+
- 0d9962b: fix: add types field in package.json
|
|
16
|
+
fix: 添加 package.json 中的 types 字段
|
|
17
|
+
|
|
3
18
|
## 2.9.0
|
|
4
19
|
|
|
5
20
|
## 2.8.0
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
TransformOptions as BabelTransformOptions,
|
|
3
|
+
PluginItem as BabelPlugin,
|
|
4
|
+
PluginOptions as BabelPluginOptions,
|
|
5
|
+
} from '@babel/core';
|
|
6
|
+
|
|
7
|
+
export type PresetEnvOptions = Partial<{
|
|
8
|
+
targets:
|
|
9
|
+
| string
|
|
10
|
+
| string[]
|
|
11
|
+
| Record<string, string>
|
|
12
|
+
| Partial<{
|
|
13
|
+
esmodules: boolean;
|
|
14
|
+
node: string | 'current';
|
|
15
|
+
safari: string | 'tp';
|
|
16
|
+
browsers: string[];
|
|
17
|
+
}>;
|
|
18
|
+
bugfixes: boolean;
|
|
19
|
+
spec: boolean;
|
|
20
|
+
loose: boolean;
|
|
21
|
+
modules: 'amd' | 'umd' | 'systemjs' | 'commonjs' | 'cjs' | 'auto' | false;
|
|
22
|
+
debug: boolean;
|
|
23
|
+
include: string[];
|
|
24
|
+
exclude: string[];
|
|
25
|
+
useBuiltIns: 'usage' | 'entry' | false;
|
|
26
|
+
corejs: string | { version: string; proposals: boolean };
|
|
27
|
+
forceAllTransforms: boolean;
|
|
28
|
+
configPath: string;
|
|
29
|
+
ignoreBrowserslistConfig: boolean;
|
|
30
|
+
browserslistEnv: string;
|
|
31
|
+
shippedProposals: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
export interface SharedBabelPresetReactOptions {
|
|
35
|
+
development?: boolean;
|
|
36
|
+
throwIfNamespace?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface AutomaticRuntimePresetReactOptions
|
|
40
|
+
extends SharedBabelPresetReactOptions {
|
|
41
|
+
runtime?: 'automatic';
|
|
42
|
+
importSource?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ClassicRuntimePresetReactOptions
|
|
46
|
+
extends SharedBabelPresetReactOptions {
|
|
47
|
+
runtime?: 'classic';
|
|
48
|
+
pragma?: string;
|
|
49
|
+
pragmaFrag?: string;
|
|
50
|
+
useBuiltIns?: boolean;
|
|
51
|
+
useSpread?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type PresetReactOptions =
|
|
55
|
+
| AutomaticRuntimePresetReactOptions
|
|
56
|
+
| ClassicRuntimePresetReactOptions;
|
|
57
|
+
|
|
58
|
+
export type BabelConfigUtils = {
|
|
59
|
+
addPlugins: (plugins: BabelPlugin[]) => void;
|
|
60
|
+
addPresets: (presets: BabelPlugin[]) => void;
|
|
61
|
+
addIncludes: (includes: string | RegExp | (string | RegExp)[]) => void;
|
|
62
|
+
addExcludes: (excludes: string | RegExp | (string | RegExp)[]) => void;
|
|
63
|
+
removePlugins: (plugins: string | string[]) => void;
|
|
64
|
+
removePresets: (presets: string | string[]) => void;
|
|
65
|
+
modifyPresetEnvOptions: (options: PresetEnvOptions) => void;
|
|
66
|
+
modifyPresetReactOptions: (options: PresetReactOptions) => void;
|
|
67
|
+
};
|
|
68
|
+
export type BabelConfig =
|
|
69
|
+
| BabelTransformOptions
|
|
70
|
+
| ((
|
|
71
|
+
config: BabelTransformOptions,
|
|
72
|
+
utils: BabelConfigUtils,
|
|
73
|
+
) => BabelTransformOptions | void);
|
|
74
|
+
|
|
75
|
+
export type BabelOptions = BabelTransformOptions;
|
package/common/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,12 +11,16 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.11.0",
|
|
15
15
|
"types": "./index.d.ts",
|
|
16
16
|
"exports": {
|
|
17
|
-
".":
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./index.d.ts"
|
|
20
|
+
},
|
|
18
21
|
"./server": {
|
|
19
22
|
"jsnext:source": "./server/index.d.ts",
|
|
23
|
+
"types": "./server/index.d.ts",
|
|
20
24
|
"default": "./server/index.d.ts"
|
|
21
25
|
}
|
|
22
26
|
},
|
|
@@ -32,14 +36,13 @@
|
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
38
|
"@types/babel__core": "^7.1.19",
|
|
35
|
-
"@types/jest": "^
|
|
39
|
+
"@types/jest": "^29",
|
|
36
40
|
"@types/node": "^14",
|
|
37
|
-
"@jest/types": "^27.0.6",
|
|
38
41
|
"http-proxy-middleware": "^2.0.4",
|
|
39
|
-
"jest": "^
|
|
42
|
+
"jest": "^29",
|
|
40
43
|
"type-fest": "2.15.0",
|
|
41
|
-
"@scripts/
|
|
42
|
-
"@scripts/
|
|
44
|
+
"@scripts/build": "2.11.0",
|
|
45
|
+
"@scripts/jest-config": "2.11.0"
|
|
43
46
|
},
|
|
44
47
|
"sideEffects": false,
|
|
45
48
|
"publishConfig": {
|
package/server/context.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
|
|
2
|
-
import { URL } from 'url';
|
|
3
2
|
import qs from 'querystring';
|
|
4
3
|
import type { SSRMode } from 'common';
|
|
5
4
|
import { Metrics, Logger } from './utils';
|
|
@@ -96,6 +95,7 @@ export type BaseSSRServerContext = {
|
|
|
96
95
|
|
|
97
96
|
mode?: SSRMode; // ssr type
|
|
98
97
|
};
|
|
98
|
+
|
|
99
99
|
export interface ISAppContext {
|
|
100
100
|
appDirectory: string;
|
|
101
101
|
distDirectory: string;
|
package/server/devServer.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type DevServerOptions = {
|
|
|
29
29
|
outputFileSystem?: Record<string, any>;
|
|
30
30
|
};
|
|
31
31
|
proxy?: BffProxyOptions;
|
|
32
|
-
headers?: Record<string, string>;
|
|
32
|
+
headers?: Record<string, string | string[]>;
|
|
33
33
|
before?: RequestHandler[];
|
|
34
34
|
after?: RequestHandler[];
|
|
35
35
|
/** Provides the ability to execute a custom function and apply custom middlewares */
|
package/server/hook.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
2
|
|
|
3
3
|
export type CookieAPI = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Using set empty cookie instead.
|
|
6
|
+
*/
|
|
7
|
+
delete?: (key: string) => void;
|
|
8
|
+
get?: (key: string) => string;
|
|
9
|
+
set: (key: string, value: string, options?: any) => void;
|
|
7
10
|
clear: () => void;
|
|
8
|
-
apply: () => void;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export interface ModernResponse {
|