Skip to content

Commit

Permalink
AG-14921 group src selector files into one folder, fix namings
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 5763c5bc1044454d142c117989de3a6189a8e056
Author: Slava Leleka <[email protected]>
Date:   Wed Jun 22 00:38:15 2022 +0300

    group src selector files into one folder, fix namings

commit fa3d19eb9591175f9479537cb0fd47575e7d81c8
Author: Slava Leleka <[email protected]>
Date:   Wed Jun 22 00:28:45 2022 +0300

    fix always-true condition for utils.logError()
  • Loading branch information
slavaleleka committed Jun 22, 2022
1 parent 6ee775e commit c59d012
Show file tree
Hide file tree
Showing 18 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const OUTPUT_PATH = 'dist-v2';
const SOURCE_PATH = './src/index.ts';
const LIBRARY_NAME = 'ExtendedCSS';

const SELECTOR_SOURCE_PATH = './src/selector.ts';
const SELECTOR_SOURCE_PATH = './src/selector/index.ts';
const TEST_TEMP_DIR = 'test/build';

const banner = `/*! ${pkg.name} - v${pkg.version} - ${new Date().toDateString()}
Expand Down
3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export * from './converter';
export * from './tokenizer';
export * from './parser';
export * from './selector';
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/selector.ts → src/selector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
AnySelectorNodeInterface,
} from './nodes';

import utils from './utils';
import utils from '../utils';

import {
CONTAINS_PSEUDO_CLASS_MARKERS,
Expand All @@ -32,7 +32,7 @@ import {
COLON,
ABSOLUTE_PSEUDO_CLASSES,
RELATIVE_PSEUDO_CLASSES,
} from './constants';
} from '../constants';

/**
* Selects dom elements by value of RegularSelector
Expand Down
4 changes: 2 additions & 2 deletions src/matcher-utils.ts → src/selector/matcher-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
REGEXP_ANY_SYMBOL,
REGEXP_WITH_FLAGS_REGEXP,
SLASH,
} from './constants';
} from '../constants';

import utils from './utils';
import utils from '../utils';

/**
* Removes quotes for specified content value.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/parser.ts → src/selector/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
REGULAR_PSEUDO_CLASSES,
REGULAR_PSEUDO_ELEMENTS,
IS_OR_NOT_PSEUDO_SELECTING_ROOT,
} from './constants';
} from '../constants';

/**
* Checks whether the passed token is supported extended pseudo-class
Expand Down
4 changes: 2 additions & 2 deletions src/pseudo-processor.ts → src/selector/pseudo-processor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import utils from './utils';
import utils from '../utils';

import {
matchingText,
Expand All @@ -19,7 +19,7 @@ import {
MATCHES_CSS_BEFORE_PSEUDO,
MATCHES_CSS_AFTER_PSEUDO,
REGULAR_PSEUDO_ELEMENTS,
} from './constants';
} from '../constants';

export const matchPseudo = {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer.ts → src/selector/tokenizer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { convert } from './converter';

import { ACCEPTABLE_MARKS } from './constants';
import { ACCEPTABLE_MARKS } from '../constants';

export enum TokenType {
Mark = 'mark',
Expand Down
1 change: 0 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const utils = {
*/
logError: (typeof console !== 'undefined'
&& console.error
&& Function.prototype.bind
&& console.error.bind)
? console.error.bind(window.console)
: console.error,
Expand Down
4 changes: 2 additions & 2 deletions test/v2/helpers/parser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { parse } from '../../../src/parser';
import { parse } from '../../../src/selector/parser';

import { NodeType } from '../../../src/nodes';
import { NodeType } from '../../../src/selector/nodes';

interface TestAnySelectorNodeInterface {
type: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convert } from '../../src/converter';
import { convert } from '../../src/selector/converter';

describe('converter', () => {
describe('trim selectors', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import {
getValidMatcherArg,
parseRawPropChain,
} from '../../src/matcher-utils';
} from '../../src/selector/matcher-utils';

describe('matcher-utils tests', () => {
describe('test getValidMatcherArg', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/v2/parser.test.ts → test/v2/selector-parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { parse } from '../../src/parser';
import { parse } from '../../src/selector/parser';

import { NodeType } from '../../src/nodes';
import { NodeType } from '../../src/selector/nodes';

import {
getRegularSelector,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tokenize } from '../../src/tokenizer';
import { tokenize } from '../../src/selector/tokenizer';

describe('tokenizer', () => {
it('simple', () => {
Expand Down

0 comments on commit c59d012

Please sign in to comment.