@rpascene/shared 0.30.9 → 0.30.11
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/README.md +2 -3
- package/dist/es/common.mjs +7 -7
- package/dist/es/constants/example-code.mjs +10 -10
- package/dist/es/env/init-debug.mjs +2 -2
- package/dist/es/env/model-config-manager.mjs +1 -1
- package/dist/es/extractor/debug.mjs +2 -2
- package/dist/es/extractor/util.mjs +11 -11
- package/dist/es/extractor/web-extractor.mjs +7 -7
- package/dist/es/logger.mjs +3 -3
- package/dist/es/node/fs.mjs +6 -6
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/common.js +15 -15
- package/dist/lib/constants/example-code.js +10 -10
- package/dist/lib/env/init-debug.js +2 -2
- package/dist/lib/env/model-config-manager.js +1 -1
- package/dist/lib/extractor/debug.js +1 -1
- package/dist/lib/extractor/util.js +16 -16
- package/dist/lib/extractor/web-extractor.js +6 -6
- package/dist/lib/logger.js +2 -2
- package/dist/lib/node/fs.js +6 -6
- package/dist/lib/utils.js +2 -2
- package/dist/types/common.d.ts +5 -5
- package/dist/types/constants/example-code.d.ts +2 -2
- package/dist/types/env/types.d.ts +1 -1
- package/dist/types/extractor/util.d.ts +2 -2
- package/dist/types/node/fs.d.ts +1 -1
- package/package.json +12 -12
- package/src/common.ts +7 -7
- package/src/constants/example-code.ts +10 -10
- package/src/env/init-debug.ts +2 -2
- package/src/env/model-config-manager.ts +1 -1
- package/src/env/types.ts +1 -1
- package/src/extractor/debug.ts +2 -2
- package/src/extractor/util.ts +15 -15
- package/src/extractor/web-extractor.ts +7 -7
- package/src/logger.ts +3 -3
- package/src/node/fs.ts +5 -5
- package/src/utils.ts +2 -2
package/dist/lib/common.js
CHANGED
|
@@ -35,9 +35,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
36
|
defaultRunDirName: ()=>defaultRunDirName,
|
|
37
37
|
ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED: ()=>ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
getRpasceneRunSubDir: ()=>getRpasceneRunSubDir,
|
|
39
|
+
getRpasceneRunDir: ()=>getRpasceneRunDir,
|
|
40
|
+
getRpasceneRunBaseDir: ()=>getRpasceneRunBaseDir
|
|
41
41
|
});
|
|
42
42
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
43
43
|
const external_node_os_namespaceObject = require("node:os");
|
|
@@ -46,14 +46,14 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
|
|
|
46
46
|
const basic_js_namespaceObject = require("./env/basic.js");
|
|
47
47
|
const types_js_namespaceObject = require("./env/types.js");
|
|
48
48
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
49
|
-
const defaultRunDirName = '
|
|
50
|
-
const
|
|
49
|
+
const defaultRunDirName = 'rpascene_run';
|
|
50
|
+
const getRpasceneRunDir = ()=>{
|
|
51
51
|
if (!external_utils_js_namespaceObject.ifInNode) return '';
|
|
52
52
|
return (0, basic_js_namespaceObject.getBasicEnvValue)(types_js_namespaceObject.MIDSCENE_RUN_DIR) || defaultRunDirName;
|
|
53
53
|
};
|
|
54
|
-
const
|
|
54
|
+
const getRpasceneRunBaseDir = ()=>{
|
|
55
55
|
if (!external_utils_js_namespaceObject.ifInNode) return '';
|
|
56
|
-
let basePath = external_node_path_default().resolve(process.cwd(),
|
|
56
|
+
let basePath = external_node_path_default().resolve(process.cwd(), getRpasceneRunDir());
|
|
57
57
|
if (!(0, external_node_fs_namespaceObject.existsSync)(basePath)) try {
|
|
58
58
|
(0, external_node_fs_namespaceObject.mkdirSync)(basePath, {
|
|
59
59
|
recursive: true
|
|
@@ -66,9 +66,9 @@ const getMidsceneRunBaseDir = ()=>{
|
|
|
66
66
|
}
|
|
67
67
|
return basePath;
|
|
68
68
|
};
|
|
69
|
-
const
|
|
69
|
+
const getRpasceneRunSubDir = (subdir)=>{
|
|
70
70
|
if (!external_utils_js_namespaceObject.ifInNode) return '';
|
|
71
|
-
const basePath =
|
|
71
|
+
const basePath = getRpasceneRunBaseDir();
|
|
72
72
|
const logPath = external_node_path_default().join(basePath, subdir);
|
|
73
73
|
if (!(0, external_node_fs_namespaceObject.existsSync)(logPath)) (0, external_node_fs_namespaceObject.mkdirSync)(logPath, {
|
|
74
74
|
recursive: true
|
|
@@ -78,15 +78,15 @@ const getMidsceneRunSubDir = (subdir)=>{
|
|
|
78
78
|
const ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED = 'NOT_IMPLEMENTED_AS_DESIGNED';
|
|
79
79
|
exports.ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED = __webpack_exports__.ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED;
|
|
80
80
|
exports.defaultRunDirName = __webpack_exports__.defaultRunDirName;
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
81
|
+
exports.getRpasceneRunBaseDir = __webpack_exports__.getRpasceneRunBaseDir;
|
|
82
|
+
exports.getRpasceneRunDir = __webpack_exports__.getRpasceneRunDir;
|
|
83
|
+
exports.getRpasceneRunSubDir = __webpack_exports__.getRpasceneRunSubDir;
|
|
84
84
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
85
85
|
"ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED",
|
|
86
86
|
"defaultRunDirName",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
87
|
+
"getRpasceneRunBaseDir",
|
|
88
|
+
"getRpasceneRunDir",
|
|
89
|
+
"getRpasceneRunSubDir"
|
|
90
90
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
91
91
|
Object.defineProperty(exports, '__esModule', {
|
|
92
92
|
value: true
|
|
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
YAML_EXAMPLE_CODE: ()=>YAML_EXAMPLE_CODE
|
|
29
29
|
});
|
|
30
30
|
const PLAYWRIGHT_EXAMPLE_CODE = `
|
|
31
|
-
// Reference the following code to generate
|
|
32
|
-
// The following is test code for
|
|
31
|
+
// Reference the following code to generate Rpascene test cases
|
|
32
|
+
// The following is test code for Rpascene AI, for reference
|
|
33
33
|
// The following is Playwright syntax, you can use Playwright to assist in test generation
|
|
34
34
|
IMPORTANT: Follow these exact type signatures for AI functions:
|
|
35
35
|
|
|
@@ -46,8 +46,8 @@ aiAssert(assertion: string): Promise<void>
|
|
|
46
46
|
aiQuery<T>(queryObject: Record<string, string>): Promise<T> // Extracts data from page based on descriptions
|
|
47
47
|
|
|
48
48
|
// examples:
|
|
49
|
-
// Reference the following code to generate
|
|
50
|
-
// The following is test code for
|
|
49
|
+
// Reference the following code to generate Rpascene test cases
|
|
50
|
+
// The following is test code for Rpascene AI, for reference
|
|
51
51
|
// The following is Playwright syntax, you can use Playwright to assist in test generation
|
|
52
52
|
import { test as base } from '@playwright/test';
|
|
53
53
|
import type { PlayWrightAiFixtureType } from '@rpascene/web/playwright';
|
|
@@ -156,33 +156,33 @@ tasks:
|
|
|
156
156
|
# Tap an element described by a prompt.
|
|
157
157
|
- aiTap: <prompt>
|
|
158
158
|
deepThink: <boolean> # Optional, whether to use deepThink to precisely locate the element. Defaults to False.
|
|
159
|
-
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided,
|
|
159
|
+
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Rpascene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
|
|
160
160
|
cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
|
|
161
161
|
|
|
162
162
|
# Double click an element described by a prompt.
|
|
163
163
|
- aiDoubleClick: <prompt>
|
|
164
164
|
deepThink: <boolean> # Optional, whether to use deepThink to precisely locate the element. Defaults to False.
|
|
165
|
-
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided,
|
|
165
|
+
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Rpascene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
|
|
166
166
|
cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
|
|
167
167
|
|
|
168
168
|
# Hover over an element described by a prompt.
|
|
169
169
|
- aiHover: <prompt>
|
|
170
170
|
deepThink: <boolean> # Optional, whether to use deepThink to precisely locate the element. Defaults to False.
|
|
171
|
-
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided,
|
|
171
|
+
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Rpascene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
|
|
172
172
|
cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
|
|
173
173
|
|
|
174
174
|
# Input text into an element described by a prompt.
|
|
175
175
|
- aiInput: <final text content of the input>
|
|
176
176
|
locate: <prompt>
|
|
177
177
|
deepThink: <boolean> # Optional, whether to use deepThink to precisely locate the element. Defaults to False.
|
|
178
|
-
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided,
|
|
178
|
+
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Rpascene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
|
|
179
179
|
cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
|
|
180
180
|
|
|
181
181
|
# Press a key (e.g., Enter, Tab, Escape) on an element described by a prompt.
|
|
182
182
|
- aiKeyboardPress: <key>
|
|
183
183
|
locate: <prompt>
|
|
184
184
|
deepThink: <boolean> # Optional, whether to use deepThink to precisely locate the element. Defaults to False.
|
|
185
|
-
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided,
|
|
185
|
+
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Rpascene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
|
|
186
186
|
cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
|
|
187
187
|
|
|
188
188
|
# Scroll globally or on an element described by a prompt.
|
|
@@ -192,7 +192,7 @@ tasks:
|
|
|
192
192
|
distance: <number> # Optional, the scroll distance in pixels.
|
|
193
193
|
locate: <prompt> # Optional, the element to scroll on.
|
|
194
194
|
deepThink: <boolean> # Optional, whether to use deepThink to precisely locate the element. Defaults to False.
|
|
195
|
-
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided,
|
|
195
|
+
xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Rpascene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.
|
|
196
196
|
cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.
|
|
197
197
|
|
|
198
198
|
# Log the current screenshot with a description in the report file.
|
|
@@ -33,12 +33,12 @@ const initDebugConfig = ()=>{
|
|
|
33
33
|
const shouldPrintTiming = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.MIDSCENE_DEBUG_AI_PROFILE);
|
|
34
34
|
let debugConfig = '';
|
|
35
35
|
if (shouldPrintTiming) {
|
|
36
|
-
console.warn('MIDSCENE_DEBUG_AI_PROFILE is deprecated, use DEBUG=
|
|
36
|
+
console.warn('MIDSCENE_DEBUG_AI_PROFILE is deprecated, use DEBUG=rpascene:ai:profile instead');
|
|
37
37
|
debugConfig = 'ai:profile';
|
|
38
38
|
}
|
|
39
39
|
const shouldPrintAIResponse = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.MIDSCENE_DEBUG_AI_RESPONSE);
|
|
40
40
|
if (shouldPrintAIResponse) {
|
|
41
|
-
console.warn('MIDSCENE_DEBUG_AI_RESPONSE is deprecated, use DEBUG=
|
|
41
|
+
console.warn('MIDSCENE_DEBUG_AI_RESPONSE is deprecated, use DEBUG=rpascene:ai:response instead');
|
|
42
42
|
debugConfig = debugConfig ? 'ai:*' : 'ai:call';
|
|
43
43
|
}
|
|
44
44
|
if (debugConfig) (0, external_logger_js_namespaceObject.enableDebug)(debugConfig);
|
|
@@ -111,7 +111,7 @@ class ModelConfigManager {
|
|
|
111
111
|
}
|
|
112
112
|
throwErrorIfNonVLModel(intent = 'grounding') {
|
|
113
113
|
const modelConfig = this.getModelConfig(intent);
|
|
114
|
-
if (!modelConfig.vlMode) throw new Error('No visual language model (VL model) detected for the current scenario. Element localization may be inaccurate. Please verify your model configuration. Learn more: https://
|
|
114
|
+
if (!modelConfig.vlMode) throw new Error('No visual language model (VL model) detected for the current scenario. Element localization may be inaccurate. Please verify your model configuration. Learn more: https://rpascenejs.com/choose-a-model');
|
|
115
115
|
}
|
|
116
116
|
constructor(modelConfigFn){
|
|
117
117
|
_define_property(this, "modelConfigMap", void 0);
|
|
@@ -5,7 +5,7 @@ const external_util_js_namespaceObject = require("./util.js");
|
|
|
5
5
|
console.log((0, external_index_js_namespaceObject.webExtractTextWithPosition)(document.body, true));
|
|
6
6
|
console.log(JSON.stringify((0, external_index_js_namespaceObject.webExtractTextWithPosition)(document.body, true)));
|
|
7
7
|
(0, external_util_js_namespaceObject.setExtractTextWithPositionOnWindow)();
|
|
8
|
-
(0, external_util_js_namespaceObject.
|
|
8
|
+
(0, external_util_js_namespaceObject.setRpasceneVisibleRectOnWindow)();
|
|
9
9
|
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
10
10
|
Object.defineProperty(exports, '__esModule', {
|
|
11
11
|
value: true
|
|
@@ -24,14 +24,13 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
midsceneGenerateHash: ()=>midsceneGenerateHash,
|
|
28
27
|
validTextNodeContent: ()=>validTextNodeContent,
|
|
29
28
|
setNodeHashCacheListOnWindow: ()=>setNodeHashCacheListOnWindow,
|
|
30
29
|
overlappedRect: ()=>overlappedRect,
|
|
31
30
|
isElementPartiallyInViewport: ()=>isElementPartiallyInViewport,
|
|
32
31
|
elementRect: ()=>elementRect,
|
|
33
32
|
getTopDocument: ()=>getTopDocument,
|
|
34
|
-
|
|
33
|
+
rpasceneGenerateHash: ()=>rpasceneGenerateHash,
|
|
35
34
|
getNodeFromCacheList: ()=>getNodeFromCacheList,
|
|
36
35
|
getNodeAttributes: ()=>getNodeAttributes,
|
|
37
36
|
generateId: ()=>generateId,
|
|
@@ -43,6 +42,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
43
42
|
getRect: ()=>getRect,
|
|
44
43
|
setDebugMode: ()=>setDebugMode,
|
|
45
44
|
setExtractTextWithPositionOnWindow: ()=>setExtractTextWithPositionOnWindow,
|
|
45
|
+
setRpasceneVisibleRectOnWindow: ()=>setRpasceneVisibleRectOnWindow,
|
|
46
46
|
setGenerateHashOnWindow: ()=>setGenerateHashOnWindow
|
|
47
47
|
});
|
|
48
48
|
const external_utils_js_namespaceObject = require("../utils.js");
|
|
@@ -244,22 +244,22 @@ function getNodeAttributes(node, currentWindow) {
|
|
|
244
244
|
});
|
|
245
245
|
return Object.fromEntries(attributesList);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function rpasceneGenerateHash(node, content, rect) {
|
|
248
248
|
const slicedHash = (0, external_utils_js_namespaceObject.generateHashId)(rect, content);
|
|
249
249
|
if (node) {
|
|
250
|
-
if (!window.
|
|
250
|
+
if (!window.rpasceneNodeHashCacheList) setNodeHashCacheListOnWindow();
|
|
251
251
|
setNodeToCacheList(node, slicedHash);
|
|
252
252
|
}
|
|
253
253
|
return slicedHash;
|
|
254
254
|
}
|
|
255
255
|
function setNodeHashCacheListOnWindow() {
|
|
256
|
-
if ('undefined' != typeof window) window.
|
|
256
|
+
if ('undefined' != typeof window) window.rpasceneNodeHashCacheList = [];
|
|
257
257
|
}
|
|
258
258
|
function setNodeToCacheList(node, id) {
|
|
259
259
|
if ('undefined' != typeof window) {
|
|
260
|
-
var
|
|
260
|
+
var _window_rpasceneNodeHashCacheList;
|
|
261
261
|
if (getNodeFromCacheList(id)) return;
|
|
262
|
-
null == (
|
|
262
|
+
null == (_window_rpasceneNodeHashCacheList = window.rpasceneNodeHashCacheList) || _window_rpasceneNodeHashCacheList.push({
|
|
263
263
|
node,
|
|
264
264
|
id
|
|
265
265
|
});
|
|
@@ -267,8 +267,8 @@ function setNodeToCacheList(node, id) {
|
|
|
267
267
|
}
|
|
268
268
|
function getNodeFromCacheList(id) {
|
|
269
269
|
if ('undefined' != typeof window) {
|
|
270
|
-
var
|
|
271
|
-
return null == (
|
|
270
|
+
var _window_rpasceneNodeHashCacheList_find, _window_rpasceneNodeHashCacheList;
|
|
271
|
+
return null == (_window_rpasceneNodeHashCacheList = window.rpasceneNodeHashCacheList) ? void 0 : null == (_window_rpasceneNodeHashCacheList_find = _window_rpasceneNodeHashCacheList.find((item)=>item.id === id)) ? void 0 : _window_rpasceneNodeHashCacheList_find.node;
|
|
272
272
|
}
|
|
273
273
|
return null;
|
|
274
274
|
}
|
|
@@ -276,10 +276,10 @@ function generateId(numberId) {
|
|
|
276
276
|
return `${numberId}`;
|
|
277
277
|
}
|
|
278
278
|
function setGenerateHashOnWindow() {
|
|
279
|
-
if ('undefined' != typeof window) window.
|
|
279
|
+
if ('undefined' != typeof window) window.rpasceneGenerateHash = rpasceneGenerateHash;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
if ('undefined' != typeof window) window.
|
|
281
|
+
function setRpasceneVisibleRectOnWindow() {
|
|
282
|
+
if ('undefined' != typeof window) window.rpasceneVisibleRect = elementRect;
|
|
283
283
|
}
|
|
284
284
|
function setExtractTextWithPositionOnWindow() {
|
|
285
285
|
if ('undefined' != typeof window) window.extractTextWithPosition = external_web_extractor_js_namespaceObject.extractTextWithPosition;
|
|
@@ -299,14 +299,14 @@ exports.getTopDocument = __webpack_exports__.getTopDocument;
|
|
|
299
299
|
exports.hasOverflowY = __webpack_exports__.hasOverflowY;
|
|
300
300
|
exports.isElementPartiallyInViewport = __webpack_exports__.isElementPartiallyInViewport;
|
|
301
301
|
exports.logger = __webpack_exports__.logger;
|
|
302
|
-
exports.midsceneGenerateHash = __webpack_exports__.midsceneGenerateHash;
|
|
303
302
|
exports.overlappedRect = __webpack_exports__.overlappedRect;
|
|
303
|
+
exports.rpasceneGenerateHash = __webpack_exports__.rpasceneGenerateHash;
|
|
304
304
|
exports.setDebugMode = __webpack_exports__.setDebugMode;
|
|
305
305
|
exports.setExtractTextWithPositionOnWindow = __webpack_exports__.setExtractTextWithPositionOnWindow;
|
|
306
306
|
exports.setGenerateHashOnWindow = __webpack_exports__.setGenerateHashOnWindow;
|
|
307
|
-
exports.setMidsceneVisibleRectOnWindow = __webpack_exports__.setMidsceneVisibleRectOnWindow;
|
|
308
307
|
exports.setNodeHashCacheListOnWindow = __webpack_exports__.setNodeHashCacheListOnWindow;
|
|
309
308
|
exports.setNodeToCacheList = __webpack_exports__.setNodeToCacheList;
|
|
309
|
+
exports.setRpasceneVisibleRectOnWindow = __webpack_exports__.setRpasceneVisibleRectOnWindow;
|
|
310
310
|
exports.validTextNodeContent = __webpack_exports__.validTextNodeContent;
|
|
311
311
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
312
312
|
"elementRect",
|
|
@@ -320,14 +320,14 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
320
320
|
"hasOverflowY",
|
|
321
321
|
"isElementPartiallyInViewport",
|
|
322
322
|
"logger",
|
|
323
|
-
"midsceneGenerateHash",
|
|
324
323
|
"overlappedRect",
|
|
324
|
+
"rpasceneGenerateHash",
|
|
325
325
|
"setDebugMode",
|
|
326
326
|
"setExtractTextWithPositionOnWindow",
|
|
327
327
|
"setGenerateHashOnWindow",
|
|
328
|
-
"setMidsceneVisibleRectOnWindow",
|
|
329
328
|
"setNodeHashCacheListOnWindow",
|
|
330
329
|
"setNodeToCacheList",
|
|
330
|
+
"setRpasceneVisibleRectOnWindow",
|
|
331
331
|
"validTextNodeContent"
|
|
332
332
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
333
333
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -66,7 +66,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
|
|
|
66
66
|
if ((0, external_dom_util_js_namespaceObject.isFormElement)(node, currentWindow)) {
|
|
67
67
|
const attributes = (0, external_util_js_namespaceObject.getNodeAttributes)(node, currentWindow);
|
|
68
68
|
let valueContent = attributes.value || attributes.placeholder || node.textContent || '';
|
|
69
|
-
const nodeHashId = (0, external_util_js_namespaceObject.
|
|
69
|
+
const nodeHashId = (0, external_util_js_namespaceObject.rpasceneGenerateHash)(node, valueContent, rect);
|
|
70
70
|
const tagName = node.tagName.toLowerCase();
|
|
71
71
|
if ('select' === node.tagName.toLowerCase()) {
|
|
72
72
|
const selectedOption = node.options[node.selectedIndex];
|
|
@@ -100,7 +100,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
|
|
|
100
100
|
const attributes = (0, external_util_js_namespaceObject.getNodeAttributes)(node, currentWindow);
|
|
101
101
|
const pseudo = (0, external_util_js_namespaceObject.getPseudoElementContent)(node, currentWindow);
|
|
102
102
|
const content = node.innerText || pseudo.before || pseudo.after || '';
|
|
103
|
-
const nodeHashId = (0, external_util_js_namespaceObject.
|
|
103
|
+
const nodeHashId = (0, external_util_js_namespaceObject.rpasceneGenerateHash)(node, content, rect);
|
|
104
104
|
const elementInfo = {
|
|
105
105
|
id: nodeHashId,
|
|
106
106
|
indexId: indexId++,
|
|
@@ -125,7 +125,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
|
|
|
125
125
|
if ((0, external_dom_util_js_namespaceObject.isImgElement)(node, currentWindow)) {
|
|
126
126
|
var _node_nodeName;
|
|
127
127
|
const attributes = (0, external_util_js_namespaceObject.getNodeAttributes)(node, currentWindow);
|
|
128
|
-
const nodeHashId = (0, external_util_js_namespaceObject.
|
|
128
|
+
const nodeHashId = (0, external_util_js_namespaceObject.rpasceneGenerateHash)(node, '', rect);
|
|
129
129
|
const elementInfo = {
|
|
130
130
|
id: nodeHashId,
|
|
131
131
|
indexId: indexId++,
|
|
@@ -157,7 +157,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
|
|
|
157
157
|
const attributes = (0, external_util_js_namespaceObject.getNodeAttributes)(node, currentWindow);
|
|
158
158
|
const attributeKeys = Object.keys(attributes);
|
|
159
159
|
if (!text.trim() && 0 === attributeKeys.length) return null;
|
|
160
|
-
const nodeHashId = (0, external_util_js_namespaceObject.
|
|
160
|
+
const nodeHashId = (0, external_util_js_namespaceObject.rpasceneGenerateHash)(node, text, rect);
|
|
161
161
|
const elementInfo = {
|
|
162
162
|
id: nodeHashId,
|
|
163
163
|
indexId: indexId++,
|
|
@@ -183,7 +183,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
|
|
|
183
183
|
const attributes = (0, external_util_js_namespaceObject.getNodeAttributes)(node, currentWindow);
|
|
184
184
|
const pseudo = (0, external_util_js_namespaceObject.getPseudoElementContent)(node, currentWindow);
|
|
185
185
|
const content = node.innerText || pseudo.before || pseudo.after || '';
|
|
186
|
-
const nodeHashId = (0, external_util_js_namespaceObject.
|
|
186
|
+
const nodeHashId = (0, external_util_js_namespaceObject.rpasceneGenerateHash)(node, content, rect);
|
|
187
187
|
const elementInfo = {
|
|
188
188
|
id: nodeHashId,
|
|
189
189
|
indexId: indexId++,
|
|
@@ -207,7 +207,7 @@ function collectElementInfo(node, currentWindow, currentDocument, baseZoom = 1,
|
|
|
207
207
|
}
|
|
208
208
|
if ((0, external_dom_util_js_namespaceObject.isContainerElement)(node, currentWindow) || isContainer) {
|
|
209
209
|
const attributes = (0, external_util_js_namespaceObject.getNodeAttributes)(node, currentWindow);
|
|
210
|
-
const nodeHashId = (0, external_util_js_namespaceObject.
|
|
210
|
+
const nodeHashId = (0, external_util_js_namespaceObject.rpasceneGenerateHash)(node, '', rect);
|
|
211
211
|
const elementInfo = {
|
|
212
212
|
id: nodeHashId,
|
|
213
213
|
nodeHashId,
|
package/dist/lib/logger.js
CHANGED
|
@@ -47,13 +47,13 @@ const external_debug_namespaceObject = require("debug");
|
|
|
47
47
|
var external_debug_default = /*#__PURE__*/ __webpack_require__.n(external_debug_namespaceObject);
|
|
48
48
|
const external_common_js_namespaceObject = require("./common.js");
|
|
49
49
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
50
|
-
const topicPrefix = '
|
|
50
|
+
const topicPrefix = 'rpascene';
|
|
51
51
|
const logStreams = new Map();
|
|
52
52
|
const debugInstances = new Map();
|
|
53
53
|
function getLogStream(topic) {
|
|
54
54
|
const topicFileName = topic.replace(/:/g, '-');
|
|
55
55
|
if (!logStreams.has(topicFileName)) {
|
|
56
|
-
const logFile = external_node_path_default().join((0, external_common_js_namespaceObject.
|
|
56
|
+
const logFile = external_node_path_default().join((0, external_common_js_namespaceObject.getRpasceneRunSubDir)('log'), `${topicFileName}.log`);
|
|
57
57
|
const stream = external_node_fs_default().createWriteStream(logFile, {
|
|
58
58
|
flags: 'a'
|
|
59
59
|
});
|