Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/android-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"socket.io": "^4.8.1"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/node": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"devDependencies": {
"@midscene/playground": "workspace:*",
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/node": "^18.0.0",
"dotenv": "^16.4.5",
"typescript": "^5.8.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"puppeteer": "24.2.0"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/js-yaml": "4.0.9",
"@types/lodash.merge": "4.6.9",
"@types/minimist": "1.2.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"socks-proxy-agent": "8.0.4"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/node": "^18.0.0",
"@types/node-fetch": "2.6.11",
"@types/js-yaml": "4.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/ios-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@midscene/ios": "workspace:*"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/node": "^18.0.0",
"typescript": "^5.8.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"@midscene/playground": "workspace:*",
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/node": "^18.0.0",
"dotenv": "^16.4.5",
"typescript": "^5.8.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@midscene/web": "workspace:*",
"@modelcontextprotocol/inspector": "^0.16.3",
"@modelcontextprotocol/sdk": "1.10.2",
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/node": "^18.0.0",
"dotenv": "^16.4.5",
"puppeteer-core": "24.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"uuid": "11.1.0"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/node": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/recorder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@rsbuild/plugin-react": "^1.4.1",
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/react": "^18.3.1",
"react": "18.3.1",
"typescript": "^5.8.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"uuid": "11.1.0"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/debug": "4.1.12",
"@types/node": "^18.0.0",
"@ui-tars/shared": "1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/visualizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@rsbuild/plugin-node-polyfill": "1.4.2",
"@rsbuild/plugin-react": "^1.4.1",
"@rsbuild/plugin-svgr": "^1.2.2",
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/chrome": "0.0.279",
"@types/node": "^18.0.0",
"@types/react": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/web-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
},
"devDependencies": {
"@playwright/test": "^1.44.1",
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/chrome": "0.0.279",
"@types/cors": "^2.8.17",
"@types/http-server": "^0.12.4",
Expand Down
7 changes: 4 additions & 3 deletions packages/web-integration/src/playwright/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
forceChromeSelectRendering as applyChromeSelectRendering,
forceClosePopup,
} from '../puppeteer/base-page';
import { getWebpackRequire } from '../utils';

const debug = getDebug('playwright:agent');

Expand All @@ -22,10 +23,10 @@ const debug = getDebug('playwright:agent');
*/
function getPlaywrightVersion(): string | null {
try {
// Try to require playwright package.json
const playwrightPkg = require('playwright/package.json');
const playwrightPkg = getWebpackRequire()('playwright/package.json');
return playwrightPkg.version || null;
} catch {
} catch (error) {
console.error('[midscene:error] Failed to get Playwright version', error);
return null;
}
}
Expand Down
7 changes: 4 additions & 3 deletions packages/web-integration/src/puppeteer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Agent as PageAgent } from '@midscene/core/agent';
import { getDebug } from '@midscene/shared/logger';
import type { Page as PuppeteerPage } from 'puppeteer';
import semver from 'semver';
import { getWebpackRequire } from '../utils';
import {
forceChromeSelectRendering as applyChromeSelectRendering,
forceClosePopup,
Expand All @@ -16,10 +17,10 @@ const debug = getDebug('puppeteer:agent');
*/
function getPuppeteerVersion(): string | null {
try {
// Try to require puppeteer package.json
const puppeteerPkg = require('puppeteer/package.json');
const puppeteerPkg = getWebpackRequire()('puppeteer/package.json');
return puppeteerPkg.version || null;
} catch {
} catch (error) {
console.error('[midscene:error] Failed to get Puppeteer version', error);
return null;
}
}
Expand Down
13 changes: 13 additions & 0 deletions packages/web-integration/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Type declaration for webpack's __non_webpack_require__
declare const __non_webpack_require__: typeof require | undefined;

/**
* Get a require function that won't be processed by webpack.
* Returns __non_webpack_require__ if available (in webpack environment),
* otherwise falls back to the standard require.
*/
export function getWebpackRequire(): typeof require {
return typeof __non_webpack_require__ !== 'undefined'
? __non_webpack_require__
: require;
}
2 changes: 1 addition & 1 deletion packages/webdriver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"node-fetch": "^3.3.2"
},
"devDependencies": {
"@rslib/core": "^0.11.2",
"@rslib/core": "^0.18.2",
"@types/node": "^18.0.0",
"typescript": "^5.8.3",
"vitest": "3.0.5"
Expand Down
Loading
Loading