chore: use utils via index export (6) (#13417)
This commit is contained in:
parent
e79b90f454
commit
845e32cbb8
|
|
@ -1,4 +1,4 @@
|
||||||
[*]
|
[*]
|
||||||
../common/
|
../common/
|
||||||
../protocol/
|
../protocol/
|
||||||
../utils/
|
../utils/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import { ElementHandle } from './elementHandle';
|
||||||
import type { Frame } from './frame';
|
import type { Frame } from './frame';
|
||||||
import type { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
|
import type { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
|
||||||
import { parseResult, serializeArgument } from './jsHandle';
|
import { parseResult, serializeArgument } from './jsHandle';
|
||||||
import { escapeWithQuotes } from '../utils/stringUtils';
|
import { escapeWithQuotes } from '../utils/isomorphic/stringUtils';
|
||||||
|
|
||||||
export class Locator implements api.Locator {
|
export class Locator implements api.Locator {
|
||||||
_frame: Frame;
|
_frame: Frame;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@
|
||||||
../protocol/
|
../protocol/
|
||||||
../utils/
|
../utils/
|
||||||
./
|
./
|
||||||
./common/
|
|
||||||
./injected/
|
./injected/
|
||||||
|
./isomorphic/
|
||||||
|
./registry/
|
||||||
./supplements/
|
./supplements/
|
||||||
./trace/recorder/tracing.ts
|
./trace/recorder/tracing.ts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import { getExceptionMessage, releaseObject } from './crProtocolHelper';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import * as js from '../javascript';
|
import * as js from '../javascript';
|
||||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
||||||
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
import { isSessionClosedError } from '../protocolError';
|
import { isSessionClosedError } from '../protocolError';
|
||||||
|
|
||||||
export class CRExecutionContext implements js.ExecutionContextDelegate {
|
export class CRExecutionContext implements js.ExecutionContextDelegate {
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
[*]
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Files in this folder are used both in Node.js and injected environments, they can't have dependencies.
|
|
||||||
|
|
@ -19,7 +19,7 @@ import * as js from '../javascript';
|
||||||
import type { FFSession } from './ffConnection';
|
import type { FFSession } from './ffConnection';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
||||||
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
import { isSessionClosedError } from '../protocolError';
|
import { isSessionClosedError } from '../protocolError';
|
||||||
|
|
||||||
export class FFExecutionContext implements js.ExecutionContextDelegate {
|
export class FFExecutionContext implements js.ExecutionContextDelegate {
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ import { serverSideCallMetadata, SdkObject } from './instrumentation';
|
||||||
import { type InjectedScript } from './injected/injectedScript';
|
import { type InjectedScript } from './injected/injectedScript';
|
||||||
import type { ElementStateWithoutStable, FrameExpectParams, InjectedScriptPoll, InjectedScriptProgress } from './injected/injectedScript';
|
import type { ElementStateWithoutStable, FrameExpectParams, InjectedScriptPoll, InjectedScriptProgress } from './injected/injectedScript';
|
||||||
import { isSessionClosedError } from './protocolError';
|
import { isSessionClosedError } from './protocolError';
|
||||||
import type { ParsedSelector } from './common/selectorParser';
|
import type { ParsedSelector } from './isomorphic/selectorParser';
|
||||||
import { isInvalidSelectorError, splitSelectorByFrame, stringifySelector } from './common/selectorParser';
|
import { isInvalidSelectorError, splitSelectorByFrame, stringifySelector } from './isomorphic/selectorParser';
|
||||||
import type { SelectorInfo } from './selectors';
|
import type { SelectorInfo } from './selectors';
|
||||||
import type { ScreenshotOptions } from './screenshotter';
|
import type { ScreenshotOptions } from './screenshotter';
|
||||||
import type { InputFilesItems } from './dom';
|
import type { InputFilesItems } from './dom';
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
|
# Files in this folder are used in browser environment, they can only depend on isomorphic files.
|
||||||
[*]
|
[*]
|
||||||
../common/
|
../isomorphic/
|
||||||
|
|
@ -19,11 +19,11 @@ import { XPathEngine } from './xpathSelectorEngine';
|
||||||
import { ReactEngine } from './reactSelectorEngine';
|
import { ReactEngine } from './reactSelectorEngine';
|
||||||
import { VueEngine } from './vueSelectorEngine';
|
import { VueEngine } from './vueSelectorEngine';
|
||||||
import { RoleEngine } from './roleSelectorEngine';
|
import { RoleEngine } from './roleSelectorEngine';
|
||||||
import type { ParsedSelector, ParsedSelectorPart } from '../common/selectorParser';
|
import type { ParsedSelector, ParsedSelectorPart } from '../isomorphic/selectorParser';
|
||||||
import { allEngineNames, parseSelector, stringifySelector } from '../common/selectorParser';
|
import { allEngineNames, parseSelector, stringifySelector } from '../isomorphic/selectorParser';
|
||||||
import type { TextMatcher } from './selectorEvaluator';
|
import type { TextMatcher } from './selectorEvaluator';
|
||||||
import { SelectorEvaluatorImpl, isVisible, parentElementOrShadowHost, elementMatchesText, createRegexTextMatcher, createStrictTextMatcher, createLaxTextMatcher } from './selectorEvaluator';
|
import { SelectorEvaluatorImpl, isVisible, parentElementOrShadowHost, elementMatchesText, createRegexTextMatcher, createStrictTextMatcher, createLaxTextMatcher } from './selectorEvaluator';
|
||||||
import type { CSSComplexSelectorList } from '../common/cssParser';
|
import type { CSSComplexSelectorList } from '../isomorphic/cssParser';
|
||||||
import { generateSelector } from './selectorGenerator';
|
import { generateSelector } from './selectorGenerator';
|
||||||
import type * as channels from '../../protocol/channels';
|
import type * as channels from '../../protocol/channels';
|
||||||
import { Highlight } from './highlight';
|
import { Highlight } from './highlight';
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../common/cssParser';
|
import type { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../isomorphic/cssParser';
|
||||||
import { customCSSNames } from '../common/selectorParser';
|
import { customCSSNames } from '../isomorphic/selectorParser';
|
||||||
|
|
||||||
export type QueryContext = {
|
export type QueryContext = {
|
||||||
scope: Element | Document;
|
scope: Element | Document;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { serializeAsCallArgument, parseEvaluationResultValue } from '../common/utilityScriptSerializers';
|
import { serializeAsCallArgument, parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
|
|
||||||
export class UtilityScript {
|
export class UtilityScript {
|
||||||
evaluate(isFunction: boolean | undefined, returnByValue: boolean, expression: string, argCount: number, ...argsAndHandles: any[]) {
|
evaluate(isFunction: boolean | undefined, returnByValue: boolean, expression: string, argCount: number, ...argsAndHandles: any[]) {
|
||||||
|
|
|
||||||
2
packages/playwright-core/src/server/isomorphic/DEPS.list
Normal file
2
packages/playwright-core/src/server/isomorphic/DEPS.list
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Files in this folder are used both in Node.js and injected environments, they are isomorphic and can't have dependencies.
|
||||||
|
[*]
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import type * as dom from './dom';
|
import type * as dom from './dom';
|
||||||
import * as utilityScriptSource from '../generated/utilityScriptSource';
|
import * as utilityScriptSource from '../generated/utilityScriptSource';
|
||||||
import { serializeAsCallArgument } from './common/utilityScriptSerializers';
|
import { serializeAsCallArgument } from './isomorphic/utilityScriptSerializers';
|
||||||
import { type UtilityScript } from './injected/utilityScript';
|
import { type UtilityScript } from './injected/utilityScript';
|
||||||
import { SdkObject } from './instrumentation';
|
import { SdkObject } from './instrumentation';
|
||||||
import { ManualPromise } from '../utils/manualPromise';
|
import { ManualPromise } from '../utils/manualPromise';
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ import type { CallMetadata } from './instrumentation';
|
||||||
import { SdkObject } from './instrumentation';
|
import { SdkObject } from './instrumentation';
|
||||||
import type { Artifact } from './artifact';
|
import type { Artifact } from './artifact';
|
||||||
import type { TimeoutOptions } from '../common/types';
|
import type { TimeoutOptions } from '../common/types';
|
||||||
import type { ParsedSelector } from './common/selectorParser';
|
import type { ParsedSelector } from './isomorphic/selectorParser';
|
||||||
import { isInvalidSelectorError } from './common/selectorParser';
|
import { isInvalidSelectorError } from './isomorphic/selectorParser';
|
||||||
|
|
||||||
export interface PageDelegate {
|
export interface PageDelegate {
|
||||||
readonly rawMouse: input.RawMouse;
|
readonly rawMouse: input.RawMouse;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import type { Rect } from '../common/types';
|
||||||
import { helper } from './helper';
|
import { helper } from './helper';
|
||||||
import type { Page } from './page';
|
import type { Page } from './page';
|
||||||
import type { Frame } from './frames';
|
import type { Frame } from './frames';
|
||||||
import type { ParsedSelector } from './common/selectorParser';
|
import type { ParsedSelector } from './isomorphic/selectorParser';
|
||||||
import type * as types from './types';
|
import type * as types from './types';
|
||||||
import type { Progress } from './progress';
|
import type { Progress } from './progress';
|
||||||
import { assert } from '../utils';
|
import { assert } from '../utils';
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import type * as dom from './dom';
|
||||||
import type * as frames from './frames';
|
import type * as frames from './frames';
|
||||||
import type * as js from './javascript';
|
import type * as js from './javascript';
|
||||||
import type * as types from './types';
|
import type * as types from './types';
|
||||||
import type { ParsedSelector } from './common/selectorParser';
|
import type { ParsedSelector } from './isomorphic/selectorParser';
|
||||||
import { allEngineNames, InvalidSelectorError, parseSelector, stringifySelector } from './common/selectorParser';
|
import { allEngineNames, InvalidSelectorError, parseSelector, stringifySelector } from './isomorphic/selectorParser';
|
||||||
import { createGuid, experimentalFeaturesEnabled } from '../utils';
|
import { createGuid, experimentalFeaturesEnabled } from '../utils';
|
||||||
|
|
||||||
export type SelectorInfo = {
|
export type SelectorInfo = {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Files in this folder are used in browser environment, they can only depend on isomorphic files.
|
||||||
[*]
|
[*]
|
||||||
../../injected/
|
../../injected/
|
||||||
../../../utils/
|
../../../utils/isomorphic/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { escapeWithQuotes } from '../../../utils/stringUtils';
|
import { escapeWithQuotes } from '../../../utils/isomorphic/stringUtils';
|
||||||
import { type InjectedScript } from '../../injected/injectedScript';
|
import { type InjectedScript } from '../../injected/injectedScript';
|
||||||
import { generateSelector } from '../../injected/selectorGenerator';
|
import { generateSelector } from '../../injected/selectorGenerator';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
[*]
|
[*]
|
||||||
../../
|
../../
|
||||||
|
../../registry/**
|
||||||
../../../common/
|
../../../common/
|
||||||
../../../protocol/
|
../../../protocol/
|
||||||
../../../utils/
|
../../../utils/**
|
||||||
|
|
||||||
[recorderApp.ts]
|
[recorderApp.ts]
|
||||||
../../chromium/crApp.ts
|
../../chromium/crApp.ts
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import type { Action } from './recorderActions';
|
||||||
import { actionTitle } from './recorderActions';
|
import { actionTitle } from './recorderActions';
|
||||||
import type { MouseClickOptions } from './utils';
|
import type { MouseClickOptions } from './utils';
|
||||||
import { toModifiers } from './utils';
|
import { toModifiers } from './utils';
|
||||||
import { escapeWithQuotes } from '../../../utils/stringUtils';
|
import { escapeWithQuotes } from '../../../utils/isomorphic/stringUtils';
|
||||||
import deviceDescriptors from '../../deviceDescriptors';
|
import deviceDescriptors from '../../deviceDescriptors';
|
||||||
|
|
||||||
export class CSharpLanguageGenerator implements LanguageGenerator {
|
export class CSharpLanguageGenerator implements LanguageGenerator {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import type { MouseClickOptions } from './utils';
|
||||||
import { toModifiers } from './utils';
|
import { toModifiers } from './utils';
|
||||||
import deviceDescriptors from '../../deviceDescriptors';
|
import deviceDescriptors from '../../deviceDescriptors';
|
||||||
import { JavaScriptFormatter } from './javascript';
|
import { JavaScriptFormatter } from './javascript';
|
||||||
import { escapeWithQuotes } from '../../../utils/stringUtils';
|
import { escapeWithQuotes } from '../../../utils/isomorphic/stringUtils';
|
||||||
|
|
||||||
export class JavaLanguageGenerator implements LanguageGenerator {
|
export class JavaLanguageGenerator implements LanguageGenerator {
|
||||||
id = 'java';
|
id = 'java';
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { actionTitle } from './recorderActions';
|
||||||
import type { MouseClickOptions } from './utils';
|
import type { MouseClickOptions } from './utils';
|
||||||
import { toModifiers } from './utils';
|
import { toModifiers } from './utils';
|
||||||
import deviceDescriptors from '../../deviceDescriptors';
|
import deviceDescriptors from '../../deviceDescriptors';
|
||||||
import { escapeWithQuotes } from '../../../utils/stringUtils';
|
import { escapeWithQuotes } from '../../../utils/isomorphic/stringUtils';
|
||||||
|
|
||||||
export class JavaScriptLanguageGenerator implements LanguageGenerator {
|
export class JavaScriptLanguageGenerator implements LanguageGenerator {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import type { Action } from './recorderActions';
|
||||||
import { actionTitle } from './recorderActions';
|
import { actionTitle } from './recorderActions';
|
||||||
import type { MouseClickOptions } from './utils';
|
import type { MouseClickOptions } from './utils';
|
||||||
import { toModifiers } from './utils';
|
import { toModifiers } from './utils';
|
||||||
import { escapeWithQuotes } from '../../../utils/stringUtils';
|
import { escapeWithQuotes } from '../../../utils/isomorphic/stringUtils';
|
||||||
import deviceDescriptors from '../../deviceDescriptors';
|
import deviceDescriptors from '../../deviceDescriptors';
|
||||||
|
|
||||||
export class PythonLanguageGenerator implements LanguageGenerator {
|
export class PythonLanguageGenerator implements LanguageGenerator {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[*]
|
[*]
|
||||||
../../
|
../../
|
||||||
|
../../registry/
|
||||||
../../../generated/
|
../../../generated/
|
||||||
../../../utils/
|
../../../utils/
|
||||||
../../chromium/crApp.ts
|
../../chromium/crApp.ts
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
import type { WKSession } from './wkConnection';
|
import type { WKSession } from './wkConnection';
|
||||||
import type { Protocol } from './protocol';
|
import type { Protocol } from './protocol';
|
||||||
import * as js from '../javascript';
|
import * as js from '../javascript';
|
||||||
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../isomorphic/utilityScriptSerializers';
|
||||||
import { isSessionClosedError } from '../protocolError';
|
import { isSessionClosedError } from '../protocolError';
|
||||||
|
|
||||||
export class WKExecutionContext implements js.ExecutionContextDelegate {
|
export class WKExecutionContext implements js.ExecutionContextDelegate {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { playwrightTest as it, expect } from '../config/browserTest';
|
import { playwrightTest as it, expect } from '../config/browserTest';
|
||||||
import { parseCSS, serializeSelector as serialize } from '../../packages/playwright-core/lib/server/common/cssParser';
|
import { parseCSS, serializeSelector as serialize } from '../../packages/playwright-core/lib/server/isomorphic/cssParser';
|
||||||
|
|
||||||
const parse = (selector: string) => {
|
const parse = (selector: string) => {
|
||||||
return parseCSS(selector, new Set(['text', 'not', 'has', 'react', 'scope', 'right-of', 'is'])).selector;
|
return parseCSS(selector, new Set(['text', 'not', 'has', 'react', 'scope', 'right-of', 'is'])).selector;
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,9 @@ async function innerCheckDeps(root, checkDepsFile, checkPackageJson) {
|
||||||
|
|
||||||
function allowImport(from, to) {
|
function allowImport(from, to) {
|
||||||
const fromDirectory = path.dirname(from);
|
const fromDirectory = path.dirname(from);
|
||||||
const toDirectory = path.dirname(to);
|
const toDirectory = isDirectory(to) ? to : path.dirname(to);
|
||||||
|
if (to === toDirectory)
|
||||||
|
to = path.join(to, 'index.ts');
|
||||||
if (fromDirectory === toDirectory)
|
if (fromDirectory === toDirectory)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -217,3 +219,7 @@ checkDeps().catch(e => {
|
||||||
console.error(e && e.stack ? e.stack : e);
|
console.error(e && e.stack ? e.stack : e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function isDirectory(dir) {
|
||||||
|
return fs.existsSync(dir) && fs.statSync(dir).isDirectory();
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue