@midscene/shared 1.8.8-beta-20260603024013.0 → 1.8.9
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/dist/es/env/parse-model-config.mjs +1 -1
- package/dist/es/env/types.mjs +1 -0
- package/dist/lib/env/parse-model-config.js +1 -1
- package/dist/lib/env/types.js +1 -0
- package/dist/types/env/types.d.ts +1 -1
- package/package.json +1 -7
- package/src/env/types.ts +2 -0
- package/dist/es/rstest.mjs +0 -41
- package/dist/lib/rstest.js +0 -78
- package/dist/types/rstest.d.ts +0 -51
- package/src/rstest.ts +0 -116
|
@@ -5,7 +5,7 @@ import { assert } from "../utils.mjs";
|
|
|
5
5
|
import { maskConfig, parseJson } from "./helper.mjs";
|
|
6
6
|
import { initDebugConfig } from "./init-debug.mjs";
|
|
7
7
|
const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
|
|
8
|
-
const getCurrentVersion = ()=>"1.8.
|
|
8
|
+
const getCurrentVersion = ()=>"1.8.9";
|
|
9
9
|
const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
|
|
10
10
|
const KEYS_MAP = {
|
|
11
11
|
insight: INSIGHT_MODEL_CONFIG_KEYS,
|
package/dist/es/env/types.mjs
CHANGED
|
@@ -37,7 +37,7 @@ const external_utils_js_namespaceObject = require("../utils.js");
|
|
|
37
37
|
const external_helper_js_namespaceObject = require("./helper.js");
|
|
38
38
|
const external_init_debug_js_namespaceObject = require("./init-debug.js");
|
|
39
39
|
const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
|
|
40
|
-
const getCurrentVersion = ()=>"1.8.
|
|
40
|
+
const getCurrentVersion = ()=>"1.8.9";
|
|
41
41
|
const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${external_types_js_namespaceObject.MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
|
|
42
42
|
const KEYS_MAP = {
|
|
43
43
|
insight: external_constants_js_namespaceObject.INSIGHT_MODEL_CONFIG_KEYS,
|
package/dist/lib/env/types.js
CHANGED
|
@@ -124,7 +124,7 @@ export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
|
|
|
124
124
|
/**
|
|
125
125
|
* valid Model family types
|
|
126
126
|
*/
|
|
127
|
-
export type TModelFamily = 'qwen2.5-vl' | 'qwen3-vl' | 'qwen3.5' | 'qwen3.6' | 'doubao-vision' | 'doubao-seed' | 'gemini' | 'vlm-ui-tars' | 'vlm-ui-tars-doubao' | 'vlm-ui-tars-doubao-1.5' | 'glm-v' | 'auto-glm' | 'auto-glm-multilingual' | 'gpt-5';
|
|
127
|
+
export type TModelFamily = 'qwen2.5-vl' | 'qwen3-vl' | 'qwen3' | 'qwen3.5' | 'qwen3.6' | 'doubao-vision' | 'doubao-seed' | 'gemini' | 'vlm-ui-tars' | 'vlm-ui-tars-doubao' | 'vlm-ui-tars-doubao-1.5' | 'glm-v' | 'auto-glm' | 'auto-glm-multilingual' | 'gpt-5';
|
|
128
128
|
export declare const MODEL_FAMILY_VALUES: TModelFamily[];
|
|
129
129
|
export interface IModelConfigForInsight {
|
|
130
130
|
[MIDSCENE_INSIGHT_MODEL_NAME]: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/shared",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.9",
|
|
4
4
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
5
5
|
"homepage": "https://midscenejs.com/",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -72,11 +72,6 @@
|
|
|
72
72
|
"import": "./dist/es/logger.mjs",
|
|
73
73
|
"require": "./dist/lib/logger.js"
|
|
74
74
|
},
|
|
75
|
-
"./rstest": {
|
|
76
|
-
"types": "./dist/types/rstest.d.ts",
|
|
77
|
-
"import": "./dist/es/rstest.mjs",
|
|
78
|
-
"require": "./dist/lib/rstest.js"
|
|
79
|
-
},
|
|
80
75
|
"./*": {
|
|
81
76
|
"types": "./dist/types/*.d.ts",
|
|
82
77
|
"import": "./dist/es/*.mjs",
|
|
@@ -102,7 +97,6 @@
|
|
|
102
97
|
},
|
|
103
98
|
"devDependencies": {
|
|
104
99
|
"@rslib/core": "^0.18.3",
|
|
105
|
-
"@rstest/core": "0.10.3",
|
|
106
100
|
"@types/debug": "4.1.12",
|
|
107
101
|
"@types/express": "^4.17.21",
|
|
108
102
|
"@types/node": "^18.0.0",
|
package/src/env/types.ts
CHANGED
|
@@ -285,6 +285,7 @@ export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
|
|
|
285
285
|
export type TModelFamily =
|
|
286
286
|
| 'qwen2.5-vl'
|
|
287
287
|
| 'qwen3-vl'
|
|
288
|
+
| 'qwen3'
|
|
288
289
|
| 'qwen3.5'
|
|
289
290
|
| 'qwen3.6'
|
|
290
291
|
| 'doubao-vision'
|
|
@@ -304,6 +305,7 @@ export const MODEL_FAMILY_VALUES: TModelFamily[] = [
|
|
|
304
305
|
'gemini',
|
|
305
306
|
'qwen2.5-vl',
|
|
306
307
|
'qwen3-vl',
|
|
308
|
+
'qwen3',
|
|
307
309
|
'qwen3.5',
|
|
308
310
|
'qwen3.6',
|
|
309
311
|
'vlm-ui-tars',
|
package/dist/es/rstest.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { pathToFileURL } from "node:url";
|
|
2
|
-
function buildRstestInlineConfig(options, rsbuild) {
|
|
3
|
-
const maxConcurrency = void 0 !== options.maxConcurrency ? Math.max(1, options.maxConcurrency) : void 0;
|
|
4
|
-
return {
|
|
5
|
-
root: options.root,
|
|
6
|
-
include: options.include,
|
|
7
|
-
testEnvironment: 'node',
|
|
8
|
-
...void 0 !== options.testTimeout ? {
|
|
9
|
-
testTimeout: options.testTimeout
|
|
10
|
-
} : {},
|
|
11
|
-
...void 0 !== maxConcurrency ? {
|
|
12
|
-
maxConcurrency,
|
|
13
|
-
pool: {
|
|
14
|
-
maxWorkers: maxConcurrency,
|
|
15
|
-
minWorkers: maxConcurrency
|
|
16
|
-
}
|
|
17
|
-
} : {},
|
|
18
|
-
...void 0 !== options.bail ? {
|
|
19
|
-
bail: options.bail
|
|
20
|
-
} : {},
|
|
21
|
-
...void 0 !== options.reporters ? {
|
|
22
|
-
reporters: options.reporters
|
|
23
|
-
} : {},
|
|
24
|
-
tools: {
|
|
25
|
-
rspack: (_config, { appendPlugins })=>{
|
|
26
|
-
appendPlugins(new rsbuild.rspack.experiments.VirtualModulesPlugin(options.virtualModules));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
async function runRstestWithVirtualModules(options) {
|
|
32
|
-
const [rstestApi, rsbuild] = await Promise.all([
|
|
33
|
-
import("@rstest/core/api"),
|
|
34
|
-
import(pathToFileURL(options.rsbuildEntry).href)
|
|
35
|
-
]);
|
|
36
|
-
return rstestApi.runRstest({
|
|
37
|
-
cwd: options.cwd,
|
|
38
|
-
inlineConfig: buildRstestInlineConfig(options, rsbuild)
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export { buildRstestInlineConfig, runRstestWithVirtualModules };
|
package/dist/lib/rstest.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
runRstestWithVirtualModules: ()=>runRstestWithVirtualModules,
|
|
28
|
-
buildRstestInlineConfig: ()=>buildRstestInlineConfig
|
|
29
|
-
});
|
|
30
|
-
const external_node_url_namespaceObject = require("node:url");
|
|
31
|
-
function buildRstestInlineConfig(options, rsbuild) {
|
|
32
|
-
const maxConcurrency = void 0 !== options.maxConcurrency ? Math.max(1, options.maxConcurrency) : void 0;
|
|
33
|
-
return {
|
|
34
|
-
root: options.root,
|
|
35
|
-
include: options.include,
|
|
36
|
-
testEnvironment: 'node',
|
|
37
|
-
...void 0 !== options.testTimeout ? {
|
|
38
|
-
testTimeout: options.testTimeout
|
|
39
|
-
} : {},
|
|
40
|
-
...void 0 !== maxConcurrency ? {
|
|
41
|
-
maxConcurrency,
|
|
42
|
-
pool: {
|
|
43
|
-
maxWorkers: maxConcurrency,
|
|
44
|
-
minWorkers: maxConcurrency
|
|
45
|
-
}
|
|
46
|
-
} : {},
|
|
47
|
-
...void 0 !== options.bail ? {
|
|
48
|
-
bail: options.bail
|
|
49
|
-
} : {},
|
|
50
|
-
...void 0 !== options.reporters ? {
|
|
51
|
-
reporters: options.reporters
|
|
52
|
-
} : {},
|
|
53
|
-
tools: {
|
|
54
|
-
rspack: (_config, { appendPlugins })=>{
|
|
55
|
-
appendPlugins(new rsbuild.rspack.experiments.VirtualModulesPlugin(options.virtualModules));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
async function runRstestWithVirtualModules(options) {
|
|
61
|
-
const [rstestApi, rsbuild] = await Promise.all([
|
|
62
|
-
import("@rstest/core/api"),
|
|
63
|
-
import((0, external_node_url_namespaceObject.pathToFileURL)(options.rsbuildEntry).href)
|
|
64
|
-
]);
|
|
65
|
-
return rstestApi.runRstest({
|
|
66
|
-
cwd: options.cwd,
|
|
67
|
-
inlineConfig: buildRstestInlineConfig(options, rsbuild)
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
exports.buildRstestInlineConfig = __webpack_exports__.buildRstestInlineConfig;
|
|
71
|
-
exports.runRstestWithVirtualModules = __webpack_exports__.runRstestWithVirtualModules;
|
|
72
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
73
|
-
"buildRstestInlineConfig",
|
|
74
|
-
"runRstestWithVirtualModules"
|
|
75
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
76
|
-
Object.defineProperty(exports, '__esModule', {
|
|
77
|
-
value: true
|
|
78
|
-
});
|
package/dist/types/rstest.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The slice of `@rsbuild/core` the helper needs. Loosely typed so
|
|
3
|
-
* `@midscene/shared` does not take a hard dependency on `@rstest/core` /
|
|
4
|
-
* `@rsbuild/core` (both are resolved at runtime by the caller).
|
|
5
|
-
*/
|
|
6
|
-
export interface RsbuildLike {
|
|
7
|
-
rspack: {
|
|
8
|
-
experiments: {
|
|
9
|
-
VirtualModulesPlugin: new (modules: Record<string, string>) => unknown;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface RstestRunResultLike {
|
|
14
|
-
ok?: boolean;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export interface RunRstestWithVirtualModulesOptions {
|
|
18
|
-
/** Working directory passed to Rstest. */
|
|
19
|
-
cwd: string;
|
|
20
|
-
/** Project root. */
|
|
21
|
-
root: string;
|
|
22
|
-
/** Rstest `include` entries (typically the virtual module ids). */
|
|
23
|
-
include: string[];
|
|
24
|
-
/** Virtual test modules to register with the bundler. */
|
|
25
|
-
virtualModules: Record<string, string>;
|
|
26
|
-
/**
|
|
27
|
-
* Absolute path to the `@rsbuild/core` entry. The caller resolves it from the
|
|
28
|
-
* right base — the user project for `@midscene/testing-framework`, the bundled
|
|
29
|
-
* copy for `@midscene/cli` — so this helper stays free of a hard
|
|
30
|
-
* `@rstest/core` / `@rsbuild/core` dependency.
|
|
31
|
-
*/
|
|
32
|
-
rsbuildEntry: string;
|
|
33
|
-
testTimeout?: number;
|
|
34
|
-
maxConcurrency?: number;
|
|
35
|
-
bail?: number;
|
|
36
|
-
reporters?: unknown[];
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Build the Rstest `inlineConfig` that registers `virtualModules` as test files
|
|
40
|
-
* through `@rsbuild/core`'s `VirtualModulesPlugin`. Pure (no I/O) so it can be
|
|
41
|
-
* unit tested directly; {@link runRstestWithVirtualModules} wires it to the real
|
|
42
|
-
* `runRstest`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function buildRstestInlineConfig(options: RunRstestWithVirtualModulesOptions, rsbuild: RsbuildLike): Record<string, unknown>;
|
|
45
|
-
/**
|
|
46
|
-
* Run an in-process Rstest pass whose test files are supplied as virtual
|
|
47
|
-
* modules. Shared by `@midscene/cli` and `@midscene/testing-framework`: each
|
|
48
|
-
* resolves `@rstest/core` + `@rsbuild/core` from its own base and passes the
|
|
49
|
-
* resolved `@rsbuild/core` entry path in.
|
|
50
|
-
*/
|
|
51
|
-
export declare function runRstestWithVirtualModules(options: RunRstestWithVirtualModulesOptions): Promise<RstestRunResultLike>;
|
package/src/rstest.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { pathToFileURL } from 'node:url';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The slice of `@rsbuild/core` the helper needs. Loosely typed so
|
|
5
|
-
* `@midscene/shared` does not take a hard dependency on `@rstest/core` /
|
|
6
|
-
* `@rsbuild/core` (both are resolved at runtime by the caller).
|
|
7
|
-
*/
|
|
8
|
-
export interface RsbuildLike {
|
|
9
|
-
rspack: {
|
|
10
|
-
experiments: {
|
|
11
|
-
VirtualModulesPlugin: new (modules: Record<string, string>) => unknown;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface RstestRunResultLike {
|
|
17
|
-
ok?: boolean;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface RunRstestWithVirtualModulesOptions {
|
|
22
|
-
/** Working directory passed to Rstest. */
|
|
23
|
-
cwd: string;
|
|
24
|
-
/** Project root. */
|
|
25
|
-
root: string;
|
|
26
|
-
/** Rstest `include` entries (typically the virtual module ids). */
|
|
27
|
-
include: string[];
|
|
28
|
-
/** Virtual test modules to register with the bundler. */
|
|
29
|
-
virtualModules: Record<string, string>;
|
|
30
|
-
/**
|
|
31
|
-
* Absolute path to the `@rsbuild/core` entry. The caller resolves it from the
|
|
32
|
-
* right base — the user project for `@midscene/testing-framework`, the bundled
|
|
33
|
-
* copy for `@midscene/cli` — so this helper stays free of a hard
|
|
34
|
-
* `@rstest/core` / `@rsbuild/core` dependency.
|
|
35
|
-
*/
|
|
36
|
-
rsbuildEntry: string;
|
|
37
|
-
testTimeout?: number;
|
|
38
|
-
maxConcurrency?: number;
|
|
39
|
-
bail?: number;
|
|
40
|
-
reporters?: unknown[];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Build the Rstest `inlineConfig` that registers `virtualModules` as test files
|
|
45
|
-
* through `@rsbuild/core`'s `VirtualModulesPlugin`. Pure (no I/O) so it can be
|
|
46
|
-
* unit tested directly; {@link runRstestWithVirtualModules} wires it to the real
|
|
47
|
-
* `runRstest`.
|
|
48
|
-
*/
|
|
49
|
-
export function buildRstestInlineConfig(
|
|
50
|
-
options: RunRstestWithVirtualModulesOptions,
|
|
51
|
-
rsbuild: RsbuildLike,
|
|
52
|
-
): Record<string, unknown> {
|
|
53
|
-
const maxConcurrency =
|
|
54
|
-
options.maxConcurrency !== undefined
|
|
55
|
-
? Math.max(1, options.maxConcurrency)
|
|
56
|
-
: undefined;
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
root: options.root,
|
|
60
|
-
include: options.include,
|
|
61
|
-
testEnvironment: 'node',
|
|
62
|
-
...(options.testTimeout !== undefined
|
|
63
|
-
? { testTimeout: options.testTimeout }
|
|
64
|
-
: {}),
|
|
65
|
-
...(maxConcurrency !== undefined
|
|
66
|
-
? {
|
|
67
|
-
maxConcurrency,
|
|
68
|
-
pool: { maxWorkers: maxConcurrency, minWorkers: maxConcurrency },
|
|
69
|
-
}
|
|
70
|
-
: {}),
|
|
71
|
-
...(options.bail !== undefined ? { bail: options.bail } : {}),
|
|
72
|
-
...(options.reporters !== undefined
|
|
73
|
-
? { reporters: options.reporters }
|
|
74
|
-
: {}),
|
|
75
|
-
tools: {
|
|
76
|
-
rspack: (
|
|
77
|
-
_config: unknown,
|
|
78
|
-
{ appendPlugins }: { appendPlugins: (plugin: unknown) => void },
|
|
79
|
-
) => {
|
|
80
|
-
appendPlugins(
|
|
81
|
-
new rsbuild.rspack.experiments.VirtualModulesPlugin(
|
|
82
|
-
options.virtualModules,
|
|
83
|
-
),
|
|
84
|
-
);
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Run an in-process Rstest pass whose test files are supplied as virtual
|
|
92
|
-
* modules. Shared by `@midscene/cli` and `@midscene/testing-framework`: each
|
|
93
|
-
* resolves `@rstest/core` + `@rsbuild/core` from its own base and passes the
|
|
94
|
-
* resolved `@rsbuild/core` entry path in.
|
|
95
|
-
*/
|
|
96
|
-
export async function runRstestWithVirtualModules(
|
|
97
|
-
options: RunRstestWithVirtualModulesOptions,
|
|
98
|
-
): Promise<RstestRunResultLike> {
|
|
99
|
-
// `@rstest/core` is a dev-only dependency here (types); at runtime it resolves
|
|
100
|
-
// from the caller's context — the CLI's bundled copy or the user project's
|
|
101
|
-
// peer dependency — never from `@midscene/shared` itself.
|
|
102
|
-
const [rstestApi, rsbuild] = await Promise.all([
|
|
103
|
-
import('@rstest/core/api') as unknown as Promise<{
|
|
104
|
-
runRstest: (args: {
|
|
105
|
-
cwd: string;
|
|
106
|
-
inlineConfig: Record<string, unknown>;
|
|
107
|
-
}) => Promise<RstestRunResultLike>;
|
|
108
|
-
}>,
|
|
109
|
-
import(pathToFileURL(options.rsbuildEntry).href) as Promise<RsbuildLike>,
|
|
110
|
-
]);
|
|
111
|
-
|
|
112
|
-
return rstestApi.runRstest({
|
|
113
|
-
cwd: options.cwd,
|
|
114
|
-
inlineConfig: buildRstestInlineConfig(options, rsbuild),
|
|
115
|
-
});
|
|
116
|
-
}
|