Skip to content

Commit

Permalink
Merge pull request #110 from oddbird/auto-dependency-upgrades
Browse files Browse the repository at this point in the history
Automated dependency upgrades
  • Loading branch information
jgerigmeyer authored Jul 12, 2023
2 parents 1926072 + 7712678 commit a4277eb
Show file tree
Hide file tree
Showing 8 changed files with 659 additions and 727 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"singleQuote": true,
"trailingComma": "all"
"singleQuote": true
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@
"test:wpt": "node --loader ts-node/esm ./tests/wpt.ts"
},
"dependencies": {
"@floating-ui/dom": "^1.4.3",
"@floating-ui/dom": "^1.4.4",
"@types/css-tree": "^2.3.1",
"css-tree": "^2.3.1",
"nanoid": "^4.0.2"
},
"devDependencies": {
"@playwright/test": "^1.35.1",
"@playwright/test": "^1.36.0",
"@types/async": "^3.2.20",
"@types/node": "*",
"@types/selenium-webdriver": "^4.1.15",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"@vitest/coverage-istanbul": "^0.32.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitest/coverage-istanbul": "^0.33.0",
"async": "^3.2.4",
"browserslist": "^4.21.9",
"browserstack-local": "^1.5.3",
Expand All @@ -100,21 +100,20 @@
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"fetch-mock": "^9.11.0",
"jsdom": "^22.1.0",
"liquidjs": "^10.8.3",
"liquidjs": "^10.8.4",
"node-fetch": "^2.6.7",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"selenium-webdriver": "^4.10.0",
"stylelint": "^15.9.0",
"stylelint-config-standard": "^33.0.0",
"stylelint": "^15.10.1",
"stylelint-config-standard": "^34.0.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vitest": "^0.32.2"
"vite": "^4.4.3",
"vitest": "^0.33.0"
},
"resolutions": {
"tslib": ">=2"
Expand Down
41 changes: 17 additions & 24 deletions src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ interface AtRuleRaw extends csstree.Atrule {
prelude: csstree.Raw | null;
}

interface AnchorNames {
// `key` is the `anchor-name` value
// `value` is an array of all element selectors with that anchor name
[key: string]: string[];
}
// `key` is the `anchor-name` value
// `value` is an array of all element selectors with that anchor name
type AnchorNames = Record<string, string[]>;

export type InsetProperty =
| 'top'
Expand Down Expand Up @@ -138,22 +136,18 @@ export type AnchorFunctionDeclaration = Partial<
Record<InsetProperty | SizingProperty, AnchorFunction[]>
>;

interface AnchorFunctionDeclarations {
// `key` is the target element selector
// `value` is an object with all anchor-function declarations on that element
[key: string]: AnchorFunctionDeclaration;
}
// `key` is the target element selector
// `value` is an object with all anchor-function declarations on that element
type AnchorFunctionDeclarations = Record<string, AnchorFunctionDeclaration>;

interface AnchorPosition {
declarations?: AnchorFunctionDeclaration;
fallbacks?: TryBlock[];
}

export interface AnchorPositions {
// `key` is the target element selector
// `value` is an object with all anchor-positioning data for that element
[key: string]: AnchorPosition;
}
// `key` is the target element selector
// `value` is an object with all anchor-positioning data for that element
export type AnchorPositions = Record<string, AnchorPosition>;

export interface TryBlock {
uuid: string;
Expand All @@ -164,21 +158,20 @@ export interface TryBlock {
>;
}

interface FallbackTargets {
// `key` is the `@try` block uuid
// `value` is the target element selector
[key: string]: string;
}
// `key` is the `@try` block uuid
// `value` is the target element selector
type FallbackTargets = Record<string, string>;

interface Fallbacks {
type Fallbacks = Record<
// `key` is the `position-fallback` value (name)
[key: string]: {
string,
{
// `targets` is an array of selectors where this `position-fallback` is used
targets: string[];
// `blocks` is an array of `@try` block declarations (in order)
blocks: TryBlock[];
};
}
}
>;

function isDeclaration(node: csstree.CssNode): node is DeclarationWithValue {
return node.type === 'Declaration';
Expand Down
2 changes: 1 addition & 1 deletion tests/runner.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<script src="https://polyfill.io/v3/polyfill.min.js?features=Promise"></script>
Expand Down
18 changes: 9 additions & 9 deletions tests/wpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ interface ResultDataDetail {

type TestResult = [string, ResultDataDetail];

type TestSuite = {
interface TestSuite {
js: string[];
iframe: Array<[string, string]>;
};
iframe: [string, string][];
}

const TEST_FOLDERS: Array<string> = ['css/css-anchor-position'];
const TEST_FOLDERS: string[] = ['css/css-anchor-position'];

// Tests that check DOM implementation details instead of user-facing behavior
const TEST_BLOCKLIST = [
Expand All @@ -98,7 +98,7 @@ const TEST_BLOCKLIST = [
];
const TEST_FILTERS = [new RegExp(TEST_BLOCKLIST.join('|'))];

const SUBTEST_FILTERS: Array<RegExp> = [
const SUBTEST_FILTERS: RegExp[] = [
// /calc\(.*\)/,
// /max\(.*\)/,
// /style\(.*\)/,
Expand Down Expand Up @@ -291,8 +291,8 @@ async function getTests(manifestPath: string): Promise<TestSuite> {
const manifestBuffer = await readFile(manifestPath);
const manifest = JSON.parse(manifestBuffer.toString());

const js: Array<string> = [];
const iframe: Array<[string, string]> = [];
const js: string[] = [];
const iframe: [string, string][] = [];

for (const folder_path of TEST_FOLDERS) {
// console.info(`folder_path => ${folder_path}`);
Expand Down Expand Up @@ -366,7 +366,7 @@ async function runTestSuite(
name: string,
capabilities: Record<string, unknown>,
testSuite: TestSuite,
): Promise<Array<TestResult>> {
): Promise<TestResult[]> {
const driver = createWebDriver(capabilities);

try {
Expand Down Expand Up @@ -421,7 +421,7 @@ async function main() {
`Iframe Tests:\n${testSuite.iframe.map(([, path]) => path).join('\n')}\n`,
);

const tests: Array<() => Promise<void>> = [];
const tests: (() => Promise<void>)[] = [];
const results: BrowserDefinition[] = BROWSERS.map((browser) => ({
...browser,
versions: browser.versions.map((version) => {
Expand Down
Loading

0 comments on commit a4277eb

Please sign in to comment.