midscene/packages/web-integration/modern.config.ts
yuyutaotao 9d5f2fbcac
feat(web-extract): extract web content as a tree (#337)
* feat: extract web content as a tree

* chore: update test data

* chore: update test data

* feat: update answer of evaluation

* chore: update test cases

* chore: remove focusing on cases

* fix: ci

* fix: put rect in html tree

* fix: CI

* fix: AI test

* fix: lint

* fix: CI

* fix: static-page compatibility

* fix: CI

* fix: map by markerId

* fix: llm planning prompt

* chore: update hash length

* chore: ignore writing dump file

* fix: lint

* fix: ci snapshot

* chore: snapshot tree in web extractor

* chore: export tree utils in core

* chore: export tree utils in core

* fix: CI

* fix: update test case and evaluation

* chore: remove unused file

* refactor(extract): modify dependencies (#358)

* refactor(extract): modify dependencies

* chore: modify files config

* chore: add indexId as key for map

---------

Co-authored-by: Zhou Xiao <zhouxiao.shaw@bytedance.com>
2025-02-07 14:55:52 +08:00

61 lines
1.8 KiB
TypeScript

import fs from 'node:fs';
import path from 'node:path';
import { defineConfig, moduleTools } from '@modern-js/module-tools';
import { version } from './package.json';
// Create directories and copy files
// The file copying functionality in modern.js is not operating correctly.
const files = [
[
'node_modules/@midscene/shared/dist/script/htmlElement.js',
'iife-script/htmlElement.js',
],
[
'node_modules/@midscene/shared/dist/script/htmlElementDebug.js',
'iife-script/htmlElementDebug.js',
],
];
files.forEach(([src, dest]) => {
// Create parent directory if it doesn't exist
const destDir = path.dirname(path.join(__dirname, dest));
fs.mkdirSync(destDir, { recursive: true });
// Copy file
fs.copyFileSync(path.join(__dirname, src), path.join(__dirname, dest));
});
export default defineConfig({
plugins: [moduleTools()],
buildPreset: 'npm-library',
buildConfig: {
format: 'cjs',
input: {
index: 'src/index.ts',
'bridge-mode': 'src/bridge-mode/index.ts',
'bridge-mode-browser': 'src/bridge-mode/browser.ts',
utils: 'src/common/utils.ts',
'ui-utils': 'src/common/ui-utils.ts',
debug: 'src/debug/index.ts',
puppeteer: 'src/puppeteer/index.ts',
playwright: 'src/playwright/index.ts',
playground: 'src/playground/index.ts',
'midscene-playground': 'src/playground/bin.ts',
appium: 'src/appium/index.ts',
'playwright-report': './src/playwright/reporter/index.ts',
'chrome-extension': 'src/chrome-extension/index.ts',
yaml: 'src/yaml/index.ts',
},
target: 'es2018',
externals: [
'@midscene/core',
'@midscene/shared',
'puppeteer',
'bufferutil',
'utf-8-validate',
],
define: {
__VERSION__: version,
},
// splitting: true,
},
});