diff --git a/examples/recorder-crx/src/background.ts b/examples/recorder-crx/src/background.ts index 94b94a67d..0c545c60e 100644 --- a/examples/recorder-crx/src/background.ts +++ b/examples/recorder-crx/src/background.ts @@ -16,12 +16,10 @@ import type { Mode } from '@recorder/recorderTypes'; import type { CrxApplication } from 'playwright-crx'; -import playwright, { crx, registerSourceMap, _debug, _setUnderTest, _isUnderTest as isUnderTest } from 'playwright-crx'; +import playwright, { crx, _debug, _setUnderTest, _isUnderTest as isUnderTest } from 'playwright-crx'; import type { CrxSettings } from './settings'; import { addSettingsChangedListener, defaultSettings, loadSettings } from './settings'; -registerSourceMap().catch(() => {}); - type CrxMode = Mode | 'detached'; const stoppedModes: CrxMode[] = ['none', 'standby', 'detached']; diff --git a/examples/todomvc-crx/src/background.ts b/examples/todomvc-crx/src/background.ts index 7c444e8f7..a5902a047 100644 --- a/examples/todomvc-crx/src/background.ts +++ b/examples/todomvc-crx/src/background.ts @@ -14,11 +14,9 @@ * limitations under the License. */ -import { crx, registerSourceMap } from 'playwright-crx'; +import { crx } from 'playwright-crx'; import { createTodos } from './todos'; -registerSourceMap().catch(() => {}); - chrome.action.onClicked.addListener(async ({ id: tabId }) => { await chrome.action.disable(); diff --git a/index.d.ts b/index.d.ts index 114efa192..0696fbec0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -18,20 +18,9 @@ import type { Crx } from './src/types/types'; export * from './src/types/types'; -export interface RawSourceMap { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; -} - export const crx: Crx; export function _setUnderTest(): void; export function _isUnderTest(): boolean; -export const registerSourceMap: (url?: string, sourceMapUrl?: string | RawSourceMap) => Promise; export const _debug: { enable(namespaces: string): void; enabled(namespaces: string): boolean; diff --git a/package-lock.json b/package-lock.json index 00002b378..187419680 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,6 @@ "rimraf": "^5.0.5", "rollup-plugin-sourcemaps": "^0.6.3", "setimmediate": "^1.0.5", - "source-map": "github:mozilla/source-map#3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed", "stream-http": "^3.2.0", "string_decoder": "^1.3.0", "test-utils-bundle": "file:./playwright/packages/playwright/bundles/utils", @@ -6057,13 +6056,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true, - "license": "MIT" - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -7273,19 +7265,6 @@ "node": ">= 14" } }, - "node_modules/source-map": { - "version": "0.8.0-beta.0", - "resolved": "git+ssh://git@github.com/mozilla/source-map.git#3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed", - "integrity": "sha512-pL5ZyXoci4YOK+8r41Wzx6DoGZIbJBnUyAwuEGa9V+/TdbbzfIQC1P4jGv3ESTZIITeiKOMuXlBrGALmhFa9zw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "whatwg-url": "^7.0.0" - }, - "engines": { - "node": ">= 12" - } - }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -7618,26 +7597,6 @@ "resolved": "examples/todomvc-crx", "link": true }, - "node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/tr46/node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/ts-api-utils": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", @@ -8431,25 +8390,6 @@ "resolved": "playwright/packages/web", "link": true }, - "node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, "node_modules/which": { "version": "2.0.2", "dev": true, diff --git a/package.json b/package.json index 9f5b168dd..f21ffdd06 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,6 @@ "rimraf": "^5.0.5", "rollup-plugin-sourcemaps": "^0.6.3", "setimmediate": "^1.0.5", - "source-map": "github:mozilla/source-map#3cb92cc3b73bfab27c146bae4ef2bc09dbb4e5ed", "stream-http": "^3.2.0", "string_decoder": "^1.3.0", "test-utils-bundle": "file:./playwright/packages/playwright/bundles/utils", diff --git a/src/client/api.ts b/src/client/api.ts new file mode 100644 index 000000000..03e4af117 --- /dev/null +++ b/src/client/api.ts @@ -0,0 +1,161 @@ +/** + * Copyright (c) Rui Figueira. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// some types are commented out because they are not used in the extension +import { + Accessibility, + Browser, + BrowserContext, + BrowserType, + Clock, + ConsoleMessage, + Coverage, + Dialog, + Download, + // Electron, + // ElectronApplication, + Locator, + FrameLocator, + ElementHandle, + FileChooser, + TimeoutError, + Frame, + Keyboard, + Mouse, + Touchscreen, + JSHandle, + Route, + WebSocket, + WebSocketRoute, + // APIRequest, + // APIRequestContext, + // APIResponse, + Page, + Selectors, + Tracing, + Video, + Worker, + CDPSession, + Playwright, + WebError, +} from 'playwright-core/lib/client/api'; + +import { zones } from 'playwright-core/lib/utils'; + +type ApiTypeMap = { + 'accessibility': Accessibility, + // 'android': Android, + // 'androidDevice': AndroidDevice, + // 'androidWebView': AndroidWebView, + // 'androidInput': AndroidInput, + // 'androidSocket': AndroidSocket, + 'browser': Browser, + 'browserContext': BrowserContext, + 'browserType': BrowserType, + 'clock': Clock, + 'consoleMessage': ConsoleMessage, + 'coverage': Coverage, + 'dialog': Dialog, + 'download': Download, + // 'electron': Electron, + // 'electronApplication': ElectronApplication, + 'locator': Locator, + 'frameLocator': FrameLocator, + 'elementHandle': ElementHandle, + 'fileChooser': FileChooser, + 'timeoutError': TimeoutError, + 'frame': Frame, + 'keyboard': Keyboard, + 'mouse': Mouse, + 'touchscreen': Touchscreen, + 'jSHandle': JSHandle, + 'route': Route, + 'webSocket': WebSocket, + 'webSocketRoute': WebSocketRoute, + // 'request': APIRequest, + // 'requestContext': APIRequestContext, + // 'response': APIResponse, + 'page': Page, + 'selectors': Selectors, + 'tracing': Tracing, + 'video': Video, + 'worker': Worker, + 'session': CDPSession, + 'playwright': Playwright, + 'webError': WebError, +}; + +type KeysOfAsyncMethods = { + [K in keyof T]: T[K] extends (...args: any[]) => Promise ? (K extends `_${string}` ? never : K) : never; +}[Extract]; + +const apis: { [K in keyof ApiTypeMap]: [ApiTypeMap[K], ...Array>] } = { + accessibility: [Accessibility.prototype, 'snapshot'], + // android: [Android.prototype], + // androidDevice: [AndroidDevice.prototype], + // androidWebView: [AndroidWebView.prototype], + // androidInput: [AndroidInput.prototype], + // androidSocket: [AndroidSocket.prototype], + browser: [Browser.prototype, 'newContext', 'newPage', 'newBrowserCDPSession', 'startTracing', 'stopTracing', 'close'], + browserContext: [BrowserContext.prototype, 'newPage', 'cookies', 'addCookies', 'clearCookies', 'grantPermissions', 'clearPermissions', 'setGeolocation', 'setExtraHTTPHeaders', 'setOffline', 'setHTTPCredentials', 'addInitScript', 'exposeBinding', 'exposeFunction', 'route', 'routeWebSocket', 'routeFromHAR', 'unrouteAll', 'unroute', 'waitForEvent', 'storageState', 'newCDPSession', 'close'], + browserType: [BrowserType.prototype, 'launch', 'launchServer', 'launchPersistentContext', 'connect', 'connectOverCDP', 'removeAllListeners'], + clock: [Clock.prototype, 'install', 'fastForward', 'pauseAt', 'resume', 'runFor', 'setFixedTime', 'setSystemTime'], + consoleMessage: [ConsoleMessage.prototype], + coverage: [Coverage.prototype, 'startCSSCoverage', 'stopCSSCoverage', 'startJSCoverage', 'stopJSCoverage'], + dialog: [Dialog.prototype, 'accept', 'dismiss'], + download: [Download.prototype, 'path', 'failure', 'delete', 'saveAs'], + // electron: [Electron.prototype], + // electronApplication: [ElectronApplication.prototype], + locator: [Locator.prototype, 'setInputFiles', 'inputValue', 'click', 'hover', 'check', 'uncheck', 'selectOption', 'fill', 'press', 'focus', 'type', 'press', 'scrollIntoViewIfNeeded', 'boundingBox', 'screenshot', 'textContent', 'innerText', 'innerHTML', 'getAttribute', 'hover', 'click', 'dblclick', 'selectOption', 'fill', 'type', 'press', 'check', 'uncheck', 'scrollIntoViewIfNeeded', 'boundingBox', 'screenshot', 'textContent', 'innerText', 'innerHTML', 'getAttribute'], + frameLocator: [FrameLocator.prototype], + elementHandle: [ElementHandle.prototype, 'ownerFrame', 'contentFrame', 'getAttribute', 'inputValue', 'textContent', 'innerText', 'innerHTML', 'isChecked', 'isDisabled', 'isEditable', 'isEnabled', 'isHidden', 'isVisible', 'dispatchEvent', 'scrollIntoViewIfNeeded', 'hover', 'click', 'dblclick', 'tap', 'selectOption', 'fill', 'selectText', 'setInputFiles', 'focus', 'type', 'press', 'check', 'uncheck', 'setChecked', 'boundingBox', 'screenshot', '$', '$$', '$eval', '$$eval', 'waitForElementState', 'waitForSelector'], + fileChooser: [FileChooser.prototype, 'setFiles'], + timeoutError: [TimeoutError.prototype], + frame: [Frame.prototype, 'goto', 'waitForNavigation', 'waitForLoadState', 'waitForURL', 'frameElement', 'evaluateHandle', 'evaluate', '$', 'waitForSelector', 'dispatchEvent', '$eval', '$$', 'content', 'setContent', 'addScriptTag', 'addStyleTag', 'click', 'dblclick', 'dragAndDrop', 'tap', 'fill', 'focus', 'textContent', 'innerText', 'innerHTML', 'getAttribute', 'inputValue', 'isChecked', 'isDisabled', 'isEditable', 'isEnabled', 'isHidden', 'isVisible', 'hover', 'selectOption', 'setInputFiles', 'type', 'press', 'check', 'uncheck', 'setChecked', 'waitForTimeout', 'waitForFunction', 'title'], + keyboard: [Keyboard.prototype, 'down', 'up', 'insertText', 'type', 'press'], + mouse: [Mouse.prototype, 'click', 'dblclick', 'down', 'up', 'move', 'wheel'], + touchscreen: [Touchscreen.prototype, 'tap'], + jSHandle: [JSHandle.prototype, 'evaluate', 'evaluateHandle', 'getProperty', 'jsonValue', 'getProperties', 'dispose'], + route: [Route.prototype, 'fallback', 'abort', 'fetch', 'fulfill', 'continue'], + webSocket: [WebSocket.prototype, 'waitForEvent'], + webSocketRoute: [WebSocketRoute.prototype, 'close'], + // request: [APIRequest.prototype], + // requestContext: [APIRequestContext.prototype], + // response: [APIResponse.prototype], + page: [Page.prototype, 'opener', '$', '$$', 'waitForSelector', 'dispatchEvent', 'evaluateHandle', '$eval', '$$eval', 'addScriptTag', 'addStyleTag', 'exposeFunction', 'exposeBinding', 'setExtraHTTPHeaders', 'content', 'setContent', 'goto', 'reload', 'addLocatorHandler', 'removeLocatorHandler', 'waitForLoadState', 'waitForNavigation', 'waitForURL', 'waitForRequest', 'waitForResponse', 'waitForEvent', 'goBack', 'goForward', 'requestGC', 'emulateMedia', 'setViewportSize', 'evaluate', 'addInitScript', 'route', 'routeFromHAR', 'routeWebSocket', 'unrouteAll', 'unroute', 'screenshot', 'title', 'bringToFront', 'close', 'click', 'dragAndDrop', 'dblclick', 'tap', 'fill', 'focus', 'textContent', 'innerText', 'innerHTML', 'getAttribute', 'inputValue', 'isChecked', 'isDisabled', 'isEditable', 'isEnabled', 'isHidden', 'isVisible', 'hover', 'selectOption', 'setInputFiles', 'type', 'press', 'check', 'uncheck', 'setChecked', 'waitForTimeout', 'waitForFunction', 'pause', 'pdf'], + selectors: [Selectors.prototype, 'register'], + tracing: [Tracing.prototype, 'group', 'groupEnd', 'removeAllListeners', 'start', 'startChunk', 'stop', 'stopChunk'], + video: [Video.prototype, 'delete', 'path', 'saveAs'], + worker: [Worker.prototype, 'evaluate', 'evaluateHandle'], + session: [CDPSession.prototype, 'send', 'detach'], + playwright: [Playwright.prototype], + webError: [WebError.prototype], +}; + +for (const [typeName, [proto, ...props]] of Object.entries(apis)) { + for (const key of props) { + const originalFn = (proto as any)[key!]; + if (!originalFn || typeof originalFn !== 'function') + throw new Error(`Method ${key} not found in ${typeName}`); + + (proto as any)[key!] = async function(...args: any[]) { + const apiName = zones.zoneData<{ apiName: string }>('crxZone'); + if (apiName) + return await originalFn.apply(this, args); + return await zones.run('crxZone', { apiName: `${typeName}.${key}` }, async () => await originalFn.apply(this, args)); + }; + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e530e40cc..87395fbec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,7 +25,6 @@ import { CrxPlaywright } from './server/crxPlaywright'; import { CrxPlaywrightDispatcher } from './server/dispatchers/crxPlaywrightDispatcher'; import { PageBinding } from 'playwright-core/lib/server/page'; -export { registerSourceMap } from './utils/sourceMapUtils'; export { debug as _debug } from 'debug'; export { setUnderTest as _setUnderTest, isUnderTest as _isUnderTest } from 'playwright-core/lib/utils'; @@ -56,3 +55,5 @@ clientConnection.toImpl = (x: any) => x ? dispatcherConnection._dispatchers.get( export const { _crx: crx, selectors } = playwrightAPI; export default playwrightAPI; + +import './client/api'; diff --git a/src/shims/stack-utils.ts b/src/shims/stack-utils.ts deleted file mode 100644 index 36af9055c..000000000 --- a/src/shims/stack-utils.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Rui Figueira. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// @ts-expect-error -import StackUtilsLibrary from '_stack-utils'; -import { processStackTraceLine } from '../utils/sourceMapUtils'; - -const StackUtils = StackUtilsLibrary as typeof import('stack-utils'); - -export default class SourceMapStackUtils extends StackUtils { - - constructor(options: any) { - super(options); - } - - parseLine(line: string) { - const processedLine = processStackTraceLine(line); - return super.parseLine(processedLine); - } -} \ No newline at end of file diff --git a/src/utils/mappings.wasm b/src/utils/mappings.wasm deleted file mode 100644 index 351537072..000000000 Binary files a/src/utils/mappings.wasm and /dev/null differ diff --git a/src/utils/sourceMapUtils.ts b/src/utils/sourceMapUtils.ts deleted file mode 100644 index ada928917..000000000 --- a/src/utils/sourceMapUtils.ts +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Rui Figueira. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { type RawSourceMap, SourceMapConsumer } from 'source-map'; -// @ts-ignore -import mappingsUrl from './mappings.wasm?url'; - -const regex = /^ +at.+\((.*):([0-9]+):([0-9]+)/; - -const mapForUri = new Map(); - -function origName(origLine: string) { - const [, name] = / +at +(?:async +)?([^ ]*).*/.exec(origLine) ?? []; - return name; -} - -function formatOriginalPosition(source: string, line: number, column: number, name?: string) { - // mimic chrome's format - return ` at ${name ?? '(unknown)'} (${source}:${line}:${column})`; -} - -let initialized: Promise | undefined; - -export async function registerSourceMap(uri?: string, sourceMapUriOrValue?: string | RawSourceMap) { - if (!initialized) { - initialized = new Promise(resolve => { - if (mappingsUrl.startsWith('data:')) { - const [, base64] = mappingsUrl.split(','); - const buffer = Buffer.from(base64, 'base64').buffer; - // @ts-ignore - SourceMapConsumer.initialize({ 'lib/mappings.wasm': buffer }); - } - resolve(); - }); - } - await initialized; - - uri = uri ?? globalThis.location.href; - sourceMapUriOrValue = sourceMapUriOrValue ?? `${uri}.map`; - - if (mapForUri.has(uri)) - return; - // prevents race condition - mapForUri.set(uri, undefined); - - await new Promise(async resolve => { - try { - let sourceMap: RawSourceMap | undefined; - - if (typeof sourceMapUriOrValue === 'string') { - const result = await fetch(sourceMapUriOrValue); - if (result.ok) - sourceMap = await result.json(); - else - console.warn(`response for ${sourceMapUriOrValue} failed, result was ${result.status}: ${result.statusText}`); - - } else if (typeof sourceMapUriOrValue === 'object') { - sourceMap = sourceMapUriOrValue as RawSourceMap; - } - - if (sourceMap) { - const sourceMapConsumer = await new SourceMapConsumer(sourceMap); - mapForUri.set(uri, sourceMapConsumer); - } - } catch (e) { - console.warn(`failed to obtain source map ${sourceMapUriOrValue}`, e); - } finally { - resolve(); - } - }); -} - -export function processStackTraceLine(line: string) { - const [, uri, lineNumberStr, columnStr] = line.match(regex) ?? []; - if (uri) { - const lineNumber = parseInt(lineNumberStr, 10); - const column = parseInt(columnStr, 10); - const map = mapForUri.get(uri); - - if (map) { - // we think we have a map for that uri. call source-map library - const origPos = map.originalPositionFor({ line: lineNumber, column }); - if (origPos.source && origPos.line && origPos.column) { - let name = origPos.name; - if (!name) { - // esbuild can modify class names and include numbered suffixes - // so just remove them - name = origName(line); - if (/playwright\/packages\/playwright-core\/src\/client\/\w+\.ts$/.test(origPos.source)) - name = name.replace(/\d+\./, '.'); - - } - - return formatOriginalPosition( - origPos.source, - origPos.line, - origPos.column, - name, - ); - } - } else { - // we can't find a map for that url, but we parsed the row. - // reformat unchanged line for consistency with the sourcemapped - // lines. - return formatOriginalPosition(uri, lineNumber, column, origName(line)); - } - } - - // we weren't able to parse the row, push back what we were given - return line; -} diff --git a/tests/playwright.config.ts b/tests/playwright.config.ts index 697a8ce1a..fffdcff75 100644 --- a/tests/playwright.config.ts +++ b/tests/playwright.config.ts @@ -17,7 +17,7 @@ import { defineConfig, devices } from '@playwright/test'; import type { CrxFixtureOptions } from './crx/crxTest'; export default defineConfig({ - testDir: '.', + testDir: './crx', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, diff --git a/tests/test-extension/src/background.ts b/tests/test-extension/src/background.ts index 9d9126624..641a6c013 100644 --- a/tests/test-extension/src/background.ts +++ b/tests/test-extension/src/background.ts @@ -15,9 +15,7 @@ */ import type { CrxApplication } from 'playwright-crx/test'; -import { crx, expect, _debug, registerSourceMap } from 'playwright-crx/test'; - -registerSourceMap().catch(() => {}); +import { crx, expect, _debug } from 'playwright-crx/test'; let _crxAppPromise: Promise | undefined; diff --git a/vite.config.mts b/vite.config.mts index e8f3c3859..483b927a6 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -63,7 +63,6 @@ export default defineConfig({ 'process': path.resolve(__dirname, './node_modules/process'), 'readline': path.resolve(__dirname, './src/shims/readline'), 'setimmediate': path.resolve(__dirname, './node_modules/setimmediate'), - 'stack-utils': path.resolve(__dirname, './src/shims/stack-utils'), 'stream': path.resolve(__dirname, './node_modules/readable-stream'), 'tls': path.resolve(__dirname, './src/shims/tls'), 'url': path.resolve(__dirname, './src/shims/url'), @@ -109,9 +108,6 @@ export default defineConfig({ rollupOptions: { // @ts-ignore plugins: [sourcemaps()], - output: { - exports: 'named', - } }, commonjsOptions: { transformMixedEsModules: true,