@marko/language-server 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +291 -389
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +235 -334
- package/dist/index.mjs.map +4 -4
- package/dist/service/html/axe-rules/axe-rules.d.ts +202 -222
- package/dist/service/html/axe-rules/rule-exceptions.d.ts +15 -0
- package/dist/ts-plugin/index.d.ts +1 -0
- package/dist/utils/project-defaults.d.ts +1 -0
- package/package.json +13 -13
- package/dist/service/html/axe-rules/separated-rules.d.ts +0 -48
package/dist/index.mjs
CHANGED
|
@@ -15,14 +15,29 @@ import {
|
|
|
15
15
|
} from "vscode-languageserver/node";
|
|
16
16
|
import { Project as Project6 } from "@marko/language-tools";
|
|
17
17
|
|
|
18
|
-
// src/utils/
|
|
18
|
+
// src/utils/project-defaults.ts
|
|
19
19
|
import path from "path";
|
|
20
|
-
import
|
|
20
|
+
import * as defaultCompiler from "@marko/compiler";
|
|
21
|
+
import defaultConfig from "@marko/compiler/config";
|
|
22
|
+
import * as defaultTranslator from "@marko/translator-default";
|
|
23
|
+
import { Project } from "@marko/language-tools";
|
|
24
|
+
Project.setDefaultTypePaths({
|
|
25
|
+
internalTypesFile: path.join(__dirname, "marko.internal.d.ts"),
|
|
26
|
+
markoTypesFile: path.join(__dirname, "marko.runtime.d.ts")
|
|
27
|
+
});
|
|
28
|
+
Project.setDefaultCompilerMeta(defaultCompiler, {
|
|
29
|
+
...defaultConfig,
|
|
30
|
+
translator: defaultTranslator
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// src/utils/file.ts
|
|
34
|
+
import path2 from "path";
|
|
35
|
+
import { Project as Project2, parse } from "@marko/language-tools";
|
|
21
36
|
import { URI } from "vscode-uri";
|
|
22
37
|
var processorCaches = /* @__PURE__ */ new WeakMap();
|
|
23
38
|
function getFSDir(doc) {
|
|
24
39
|
const filename = getFSPath(doc);
|
|
25
|
-
return filename &&
|
|
40
|
+
return filename && path2.dirname(filename);
|
|
26
41
|
}
|
|
27
42
|
function getFSPath(doc) {
|
|
28
43
|
const parsed = URI.parse(doc.uri);
|
|
@@ -32,14 +47,14 @@ function getMarkoFile(doc) {
|
|
|
32
47
|
const { uri } = doc;
|
|
33
48
|
const { fsPath, scheme } = URI.parse(uri);
|
|
34
49
|
const filename = scheme === "file" ? fsPath : void 0;
|
|
35
|
-
const dirname = filename ?
|
|
36
|
-
const cache =
|
|
50
|
+
const dirname = filename ? path2.dirname(filename) : process.cwd();
|
|
51
|
+
const cache = Project2.getCache(dirname);
|
|
37
52
|
let file = cache.get(doc);
|
|
38
53
|
if (!file) {
|
|
39
54
|
const { version } = doc;
|
|
40
55
|
const code = doc.getText();
|
|
41
56
|
const parsed = parse(code, filename);
|
|
42
|
-
const lookup =
|
|
57
|
+
const lookup = Project2.getTagLookup(dirname);
|
|
43
58
|
cache.set(
|
|
44
59
|
doc,
|
|
45
60
|
file = {
|
|
@@ -57,7 +72,7 @@ function getMarkoFile(doc) {
|
|
|
57
72
|
return file;
|
|
58
73
|
}
|
|
59
74
|
function clearMarkoCacheForFile(doc) {
|
|
60
|
-
|
|
75
|
+
Project2.getCache(getFSDir(doc)).delete(doc);
|
|
61
76
|
}
|
|
62
77
|
function processDoc(doc, process2) {
|
|
63
78
|
const file = getMarkoFile(doc);
|
|
@@ -293,673 +308,579 @@ import { JSDOM } from "jsdom";
|
|
|
293
308
|
var keyboard = {
|
|
294
309
|
/**
|
|
295
310
|
* - Ensures every accesskey attribute value is unique
|
|
296
|
-
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
311
|
+
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.7/accesskeys?application=axeAPI))
|
|
297
312
|
*/
|
|
298
313
|
accesskeys: "accesskeys",
|
|
299
314
|
/**
|
|
300
315
|
* - Ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content
|
|
301
|
-
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
316
|
+
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.7/bypass?application=axeAPI))
|
|
302
317
|
*/
|
|
303
318
|
bypass: "bypass",
|
|
304
319
|
/**
|
|
305
320
|
* - Ensures elements in the focus order have a role appropriate for interactive content
|
|
306
|
-
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
321
|
+
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.7/focus-order-semantics?application=axeAPI))
|
|
307
322
|
*/
|
|
308
323
|
focusOrderSemantics: "focus-order-semantics",
|
|
309
324
|
/**
|
|
310
325
|
* - Ensures `<frame>` and `<iframe>` elements with focusable content do not have tabindex=-1
|
|
311
|
-
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.
|
|
326
|
+
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.7/frame-focusable-content?application=axeAPI))
|
|
312
327
|
*/
|
|
313
328
|
frameFocusableContent: "frame-focusable-content",
|
|
314
329
|
/**
|
|
315
330
|
* - Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies
|
|
316
|
-
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.
|
|
331
|
+
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.7/nested-interactive?application=axeAPI))
|
|
317
332
|
*/
|
|
318
333
|
nestedInteractive: "nested-interactive",
|
|
319
334
|
/**
|
|
320
335
|
* - Ensures all page content is contained by landmarks
|
|
321
|
-
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
336
|
+
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.7/region?application=axeAPI))
|
|
322
337
|
*/
|
|
323
338
|
region: "region",
|
|
324
339
|
/**
|
|
325
340
|
* - Ensure elements that have scrollable content are accessible by keyboard
|
|
326
|
-
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.
|
|
341
|
+
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.7/scrollable-region-focusable?application=axeAPI))
|
|
327
342
|
*/
|
|
328
343
|
scrollableRegionFocusable: "scrollable-region-focusable",
|
|
329
344
|
/**
|
|
330
345
|
* - Ensure all skip links have a focusable target
|
|
331
|
-
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.
|
|
346
|
+
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.7/skip-link?application=axeAPI))
|
|
332
347
|
*/
|
|
333
348
|
skipLink: "skip-link",
|
|
334
349
|
/**
|
|
335
350
|
* - Ensures tabindex attribute values are not greater than 0
|
|
336
|
-
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.
|
|
351
|
+
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.7/tabindex?application=axeAPI))
|
|
337
352
|
*/
|
|
338
353
|
tabindex: "tabindex"
|
|
339
354
|
};
|
|
340
355
|
var textAlternatives = {
|
|
341
356
|
/**
|
|
342
357
|
* - Ensures `<area>` elements of image maps have alternate text
|
|
343
|
-
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
358
|
+
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/area-alt?application=axeAPI))
|
|
344
359
|
*/
|
|
345
360
|
areaAlt: "area-alt",
|
|
346
361
|
/**
|
|
347
362
|
* - Ensures each HTML document contains a non-empty `<title>` element
|
|
348
|
-
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
363
|
+
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.7/document-title?application=axeAPI))
|
|
349
364
|
*/
|
|
350
365
|
documentTitle: "document-title",
|
|
351
366
|
/**
|
|
352
367
|
* - Ensures `<iframe>` and `<frame>` elements contain a unique title attribute
|
|
353
|
-
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
368
|
+
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.7/frame-title-unique?application=axeAPI))
|
|
354
369
|
*/
|
|
355
370
|
frameTitleUnique: "frame-title-unique",
|
|
356
371
|
/**
|
|
357
372
|
* - Ensures `<iframe>` and `<frame>` elements have an accessible name
|
|
358
|
-
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
373
|
+
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/frame-title?application=axeAPI))
|
|
359
374
|
*/
|
|
360
375
|
frameTitle: "frame-title",
|
|
361
376
|
/**
|
|
362
377
|
* - Ensures `<img>` elements have alternate text or a role of none or presentation
|
|
363
|
-
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
378
|
+
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/image-alt?application=axeAPI))
|
|
364
379
|
*/
|
|
365
380
|
imageAlt: "image-alt",
|
|
366
381
|
/**
|
|
367
382
|
* - Ensure image alternative is not repeated as text
|
|
368
|
-
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
383
|
+
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.7/image-redundant-alt?application=axeAPI))
|
|
369
384
|
*/
|
|
370
385
|
imageRedundantAlt: "image-redundant-alt",
|
|
371
386
|
/**
|
|
372
387
|
* - Ensures `<input type="image">` elements have alternate text
|
|
373
|
-
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
388
|
+
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/input-image-alt?application=axeAPI))
|
|
374
389
|
*/
|
|
375
390
|
inputImageAlt: "input-image-alt",
|
|
376
391
|
/**
|
|
377
392
|
* - Ensures `<object>` elements have alternate text
|
|
378
|
-
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
393
|
+
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/object-alt?application=axeAPI))
|
|
379
394
|
*/
|
|
380
395
|
objectAlt: "object-alt",
|
|
381
396
|
/**
|
|
382
|
-
* - Ensures [role=
|
|
383
|
-
* - [role=
|
|
397
|
+
* - Ensures [role='img'] elements have alternate text
|
|
398
|
+
* - [role='img'] elements must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.7/role-img-alt?application=axeAPI))
|
|
384
399
|
*/
|
|
385
400
|
roleImgAlt: "role-img-alt",
|
|
386
401
|
/**
|
|
387
402
|
* - Ensures that server-side image maps are not used
|
|
388
|
-
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
403
|
+
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/server-side-image-map?application=axeAPI))
|
|
389
404
|
*/
|
|
390
405
|
serverSideImageMap: "server-side-image-map",
|
|
391
406
|
/**
|
|
392
407
|
* - Ensures `<svg>` elements with an img, graphics-document or graphics-symbol role have an accessible text
|
|
393
|
-
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
408
|
+
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.7/svg-img-alt?application=axeAPI))
|
|
394
409
|
*/
|
|
395
410
|
svgImgAlt: "svg-img-alt",
|
|
396
411
|
/**
|
|
397
412
|
* - Ensures `<video>` elements have captions
|
|
398
|
-
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.
|
|
413
|
+
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.7/video-caption?application=axeAPI))
|
|
399
414
|
*/
|
|
400
415
|
videoCaption: "video-caption"
|
|
401
416
|
};
|
|
402
417
|
var aria = {
|
|
403
418
|
/**
|
|
404
|
-
* - Ensures an element's role
|
|
405
|
-
* - Elements must only use
|
|
419
|
+
* - Ensures ARIA attributes are allowed for an element's role
|
|
420
|
+
* - Elements must only use allowed ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.7/aria-allowed-attr?application=axeAPI))
|
|
406
421
|
*/
|
|
407
422
|
ariaAllowedAttr: "aria-allowed-attr",
|
|
408
423
|
/**
|
|
409
424
|
* - Ensures role attribute has an appropriate value for the element
|
|
410
|
-
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.
|
|
425
|
+
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.7/aria-allowed-role?application=axeAPI))
|
|
411
426
|
*/
|
|
412
427
|
ariaAllowedRole: "aria-allowed-role",
|
|
413
|
-
/**
|
|
414
|
-
* - Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent
|
|
415
|
-
* - aria-braille attributes must have a non-braille equivalent ([url](https://dequeuniversity.com/rules/axe/4.8/aria-braille-equivalent?application=axeAPI))
|
|
416
|
-
*/
|
|
417
|
-
ariaBrailleEquivalent: "aria-braille-equivalent",
|
|
418
428
|
/**
|
|
419
429
|
* - Ensures every ARIA button, link and menuitem has an accessible name
|
|
420
|
-
* - ARIA commands must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
430
|
+
* - ARIA commands must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-command-name?application=axeAPI))
|
|
421
431
|
*/
|
|
422
432
|
ariaCommandName: "aria-command-name",
|
|
423
|
-
/**
|
|
424
|
-
* - Ensures ARIA attributes are used as described in the specification of the element's role
|
|
425
|
-
* - ARIA attributes must be used as specified for the element's role ([url](https://dequeuniversity.com/rules/axe/4.8/aria-conditional-attr?application=axeAPI))
|
|
426
|
-
*/
|
|
427
|
-
ariaConditionalAttr: "aria-conditional-attr",
|
|
428
|
-
/**
|
|
429
|
-
* - Ensures elements do not use deprecated roles
|
|
430
|
-
* - Deprecated ARIA roles must not be used ([url](https://dequeuniversity.com/rules/axe/4.8/aria-deprecated-role?application=axeAPI))
|
|
431
|
-
*/
|
|
432
|
-
ariaDeprecatedRole: "aria-deprecated-role",
|
|
433
433
|
/**
|
|
434
434
|
* - Ensures every ARIA dialog and alertdialog node has an accessible name
|
|
435
|
-
* - ARIA dialog and alertdialog nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
435
|
+
* - ARIA dialog and alertdialog nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-dialog-name?application=axeAPI))
|
|
436
436
|
*/
|
|
437
437
|
ariaDialogName: "aria-dialog-name",
|
|
438
438
|
/**
|
|
439
|
-
* - Ensures aria-hidden=
|
|
440
|
-
* - aria-hidden=
|
|
439
|
+
* - Ensures aria-hidden='true' is not present on the document body.
|
|
440
|
+
* - aria-hidden='true' must not be present on the document body ([url](https://dequeuniversity.com/rules/axe/4.7/aria-hidden-body?application=axeAPI))
|
|
441
441
|
*/
|
|
442
442
|
ariaHiddenBody: "aria-hidden-body",
|
|
443
443
|
/**
|
|
444
444
|
* - Ensures every ARIA input field has an accessible name
|
|
445
|
-
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
445
|
+
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-input-field-name?application=axeAPI))
|
|
446
446
|
*/
|
|
447
447
|
ariaInputFieldName: "aria-input-field-name",
|
|
448
448
|
/**
|
|
449
449
|
* - Ensures every ARIA meter node has an accessible name
|
|
450
|
-
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
450
|
+
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-meter-name?application=axeAPI))
|
|
451
451
|
*/
|
|
452
452
|
ariaMeterName: "aria-meter-name",
|
|
453
453
|
/**
|
|
454
454
|
* - Ensures every ARIA progressbar node has an accessible name
|
|
455
|
-
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
455
|
+
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-progressbar-name?application=axeAPI))
|
|
456
456
|
*/
|
|
457
457
|
ariaProgressbarName: "aria-progressbar-name",
|
|
458
|
-
/**
|
|
459
|
-
* - Ensures ARIA attributes are not prohibited for an element's role
|
|
460
|
-
* - Elements must only use permitted ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.8/aria-prohibited-attr?application=axeAPI))
|
|
461
|
-
*/
|
|
462
|
-
ariaProhibitedAttr: "aria-prohibited-attr",
|
|
463
458
|
/**
|
|
464
459
|
* - Ensures elements with ARIA roles have all required ARIA attributes
|
|
465
|
-
* - Required ARIA attributes must be provided ([url](https://dequeuniversity.com/rules/axe/4.
|
|
460
|
+
* - Required ARIA attributes must be provided ([url](https://dequeuniversity.com/rules/axe/4.7/aria-required-attr?application=axeAPI))
|
|
466
461
|
*/
|
|
467
462
|
ariaRequiredAttr: "aria-required-attr",
|
|
468
463
|
/**
|
|
469
464
|
* - Ensures elements with an ARIA role that require child roles contain them
|
|
470
|
-
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.
|
|
465
|
+
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.7/aria-required-children?application=axeAPI))
|
|
471
466
|
*/
|
|
472
467
|
ariaRequiredChildren: "aria-required-children",
|
|
473
468
|
/**
|
|
474
469
|
* - Ensures elements with an ARIA role that require parent roles are contained by them
|
|
475
|
-
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.
|
|
470
|
+
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.7/aria-required-parent?application=axeAPI))
|
|
476
471
|
*/
|
|
477
472
|
ariaRequiredParent: "aria-required-parent",
|
|
478
473
|
/**
|
|
479
474
|
* - Ensure aria-roledescription is only used on elements with an implicit or explicit role
|
|
480
|
-
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
475
|
+
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.7/aria-roledescription?application=axeAPI))
|
|
481
476
|
*/
|
|
482
477
|
ariaRoledescription: "aria-roledescription",
|
|
483
478
|
/**
|
|
484
479
|
* - Ensures all elements with a role attribute use a valid value
|
|
485
|
-
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
480
|
+
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.7/aria-roles?application=axeAPI))
|
|
486
481
|
*/
|
|
487
482
|
ariaRoles: "aria-roles",
|
|
488
483
|
/**
|
|
489
|
-
* - Ensures role=
|
|
490
|
-
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.
|
|
484
|
+
* - Ensures "role=text" is used on elements with no focusable descendants
|
|
485
|
+
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.7/aria-text?application=axeAPI))
|
|
491
486
|
*/
|
|
492
487
|
ariaText: "aria-text",
|
|
493
488
|
/**
|
|
494
489
|
* - Ensures every ARIA toggle field has an accessible name
|
|
495
|
-
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
490
|
+
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-toggle-field-name?application=axeAPI))
|
|
496
491
|
*/
|
|
497
492
|
ariaToggleFieldName: "aria-toggle-field-name",
|
|
498
493
|
/**
|
|
499
494
|
* - Ensures every ARIA tooltip node has an accessible name
|
|
500
|
-
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
495
|
+
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-tooltip-name?application=axeAPI))
|
|
501
496
|
*/
|
|
502
497
|
ariaTooltipName: "aria-tooltip-name",
|
|
503
498
|
/**
|
|
504
499
|
* - Ensures every ARIA treeitem node has an accessible name
|
|
505
|
-
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
500
|
+
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-treeitem-name?application=axeAPI))
|
|
506
501
|
*/
|
|
507
502
|
ariaTreeitemName: "aria-treeitem-name",
|
|
508
503
|
/**
|
|
509
504
|
* - Ensures all ARIA attributes have valid values
|
|
510
|
-
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
505
|
+
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.7/aria-valid-attr-value?application=axeAPI))
|
|
511
506
|
*/
|
|
512
507
|
ariaValidAttrValue: "aria-valid-attr-value",
|
|
513
508
|
/**
|
|
514
509
|
* - Ensures attributes that begin with aria- are valid ARIA attributes
|
|
515
|
-
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.
|
|
510
|
+
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.7/aria-valid-attr?application=axeAPI))
|
|
516
511
|
*/
|
|
517
512
|
ariaValidAttr: "aria-valid-attr",
|
|
518
513
|
/**
|
|
519
514
|
* - Elements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them
|
|
520
|
-
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.
|
|
515
|
+
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.7/presentation-role-conflict?application=axeAPI))
|
|
521
516
|
*/
|
|
522
517
|
presentationRoleConflict: "presentation-role-conflict"
|
|
523
518
|
};
|
|
524
519
|
var nameRoleValue = {
|
|
525
520
|
/**
|
|
526
521
|
* - Ensures aria-hidden elements are not focusable nor contain focusable elements
|
|
527
|
-
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
522
|
+
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.7/aria-hidden-focus?application=axeAPI))
|
|
528
523
|
*/
|
|
529
524
|
ariaHiddenFocus: "aria-hidden-focus",
|
|
530
525
|
/**
|
|
531
526
|
* - Ensures buttons have discernible text
|
|
532
|
-
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
527
|
+
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.7/button-name?application=axeAPI))
|
|
533
528
|
*/
|
|
534
529
|
buttonName: "button-name",
|
|
535
530
|
/**
|
|
536
531
|
* - Ensures headings have discernible text
|
|
537
|
-
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
532
|
+
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.7/empty-heading?application=axeAPI))
|
|
538
533
|
*/
|
|
539
534
|
emptyHeading: "empty-heading",
|
|
540
535
|
/**
|
|
541
536
|
* - Ensures table headers have discernible text
|
|
542
|
-
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
537
|
+
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.7/empty-table-header?application=axeAPI))
|
|
543
538
|
*/
|
|
544
539
|
emptyTableHeader: "empty-table-header",
|
|
545
540
|
/**
|
|
546
541
|
* - Ensures input buttons have discernible text
|
|
547
|
-
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
542
|
+
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.7/input-button-name?application=axeAPI))
|
|
548
543
|
*/
|
|
549
544
|
inputButtonName: "input-button-name",
|
|
550
545
|
/**
|
|
551
546
|
* - Ensures links have discernible text
|
|
552
|
-
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
547
|
+
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.7/link-name?application=axeAPI))
|
|
553
548
|
*/
|
|
554
549
|
linkName: "link-name"
|
|
555
550
|
};
|
|
556
551
|
var timeAndMedia = {
|
|
557
552
|
/**
|
|
558
553
|
* - Ensures `<audio>` elements have captions
|
|
559
|
-
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.
|
|
554
|
+
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.7/audio-caption?application=axeAPI))
|
|
560
555
|
*/
|
|
561
556
|
audioCaption: "audio-caption",
|
|
562
557
|
/**
|
|
563
558
|
* - Ensures `<blink>` elements are not used
|
|
564
|
-
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
559
|
+
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/blink?application=axeAPI))
|
|
565
560
|
*/
|
|
566
561
|
blink: "blink",
|
|
567
562
|
/**
|
|
568
563
|
* - Ensures `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
569
|
-
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
564
|
+
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/meta-refresh-no-exceptions?application=axeAPI))
|
|
570
565
|
*/
|
|
571
566
|
metaRefreshNoExceptions: "meta-refresh-no-exceptions",
|
|
572
567
|
/**
|
|
573
568
|
* - Ensures `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
574
|
-
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
569
|
+
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/meta-refresh?application=axeAPI))
|
|
575
570
|
*/
|
|
576
571
|
metaRefresh: "meta-refresh",
|
|
577
572
|
/**
|
|
578
573
|
* - Ensures `<video>` or `<audio>` elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio
|
|
579
|
-
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.
|
|
574
|
+
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.7/no-autoplay-audio?application=axeAPI))
|
|
580
575
|
*/
|
|
581
576
|
noAutoplayAudio: "no-autoplay-audio"
|
|
582
577
|
};
|
|
583
578
|
var forms = {
|
|
584
579
|
/**
|
|
585
580
|
* - Ensure the autocomplete attribute is correct and suitable for the form field
|
|
586
|
-
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
581
|
+
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.7/autocomplete-valid?application=axeAPI))
|
|
587
582
|
*/
|
|
588
583
|
autocompleteValid: "autocomplete-valid",
|
|
589
584
|
/**
|
|
590
585
|
* - Ensures form field does not have multiple label elements
|
|
591
|
-
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
586
|
+
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.7/form-field-multiple-labels?application=axeAPI))
|
|
592
587
|
*/
|
|
593
588
|
formFieldMultipleLabels: "form-field-multiple-labels",
|
|
594
589
|
/**
|
|
595
590
|
* - Ensures that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes
|
|
596
|
-
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.
|
|
591
|
+
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.7/label-title-only?application=axeAPI))
|
|
597
592
|
*/
|
|
598
593
|
labelTitleOnly: "label-title-only",
|
|
599
594
|
/**
|
|
600
595
|
* - Ensures every form element has a label
|
|
601
|
-
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.
|
|
596
|
+
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.7/label?application=axeAPI))
|
|
602
597
|
*/
|
|
603
598
|
label: "label",
|
|
604
599
|
/**
|
|
605
600
|
* - Ensures select element has an accessible name
|
|
606
|
-
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
601
|
+
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/select-name?application=axeAPI))
|
|
607
602
|
*/
|
|
608
603
|
selectName: "select-name"
|
|
609
604
|
};
|
|
610
605
|
var structure = {
|
|
611
606
|
/**
|
|
612
607
|
* - Ensure that text spacing set through style attributes can be adjusted with custom stylesheets
|
|
613
|
-
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.
|
|
608
|
+
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.7/avoid-inline-spacing?application=axeAPI))
|
|
614
609
|
*/
|
|
615
610
|
avoidInlineSpacing: "avoid-inline-spacing",
|
|
616
611
|
/**
|
|
617
612
|
* - Ensures content is not locked to any specific display orientation, and the content is operable in all display orientations
|
|
618
|
-
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
613
|
+
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.7/css-orientation-lock?application=axeAPI))
|
|
619
614
|
*/
|
|
620
615
|
cssOrientationLock: "css-orientation-lock",
|
|
621
616
|
/**
|
|
622
617
|
* - Ensures `<dl>` elements are structured correctly
|
|
623
|
-
* - `<dl>` elements must only directly contain properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
618
|
+
* - `<dl>` elements must only directly contain properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements ([url](https://dequeuniversity.com/rules/axe/4.7/definition-list?application=axeAPI))
|
|
624
619
|
*/
|
|
625
620
|
definitionList: "definition-list",
|
|
626
621
|
/**
|
|
627
622
|
* - Ensures `<dt>` and `<dd>` elements are contained by a `<dl>`
|
|
628
|
-
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
623
|
+
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.7/dlitem?application=axeAPI))
|
|
629
624
|
*/
|
|
630
625
|
dlitem: "dlitem",
|
|
631
626
|
/**
|
|
632
627
|
* - Ensures `<iframe>` and `<frame>` elements contain the axe-core script
|
|
633
|
-
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.
|
|
628
|
+
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.7/frame-tested?application=axeAPI))
|
|
634
629
|
*/
|
|
635
630
|
frameTested: "frame-tested",
|
|
636
631
|
/**
|
|
637
632
|
* - Informs users about hidden content.
|
|
638
|
-
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.
|
|
633
|
+
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.7/hidden-content?application=axeAPI))
|
|
639
634
|
*/
|
|
640
635
|
hiddenContent: "hidden-content",
|
|
641
636
|
/**
|
|
642
637
|
* - Ensures that lists are structured correctly
|
|
643
|
-
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
638
|
+
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.7/list?application=axeAPI))
|
|
644
639
|
*/
|
|
645
640
|
list: "list",
|
|
646
641
|
/**
|
|
647
642
|
* - Ensures `<li>` elements are used semantically
|
|
648
|
-
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
643
|
+
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.7/listitem?application=axeAPI))
|
|
649
644
|
*/
|
|
650
645
|
listitem: "listitem"
|
|
651
646
|
};
|
|
652
647
|
var parsing = {
|
|
653
648
|
/**
|
|
654
649
|
* - Ensures every id attribute value of active elements is unique
|
|
655
|
-
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
650
|
+
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.7/duplicate-id-active?application=axeAPI))
|
|
656
651
|
*/
|
|
657
652
|
duplicateIdActive: "duplicate-id-active",
|
|
658
653
|
/**
|
|
659
654
|
* - Ensures every id attribute value used in ARIA and in labels is unique
|
|
660
|
-
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
655
|
+
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.7/duplicate-id-aria?application=axeAPI))
|
|
661
656
|
*/
|
|
662
657
|
duplicateIdAria: "duplicate-id-aria",
|
|
663
658
|
/**
|
|
664
659
|
* - Ensures every id attribute value is unique
|
|
665
|
-
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
660
|
+
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.7/duplicate-id?application=axeAPI))
|
|
666
661
|
*/
|
|
667
662
|
duplicateId: "duplicate-id",
|
|
668
663
|
/**
|
|
669
664
|
* - Ensures `<marquee>` elements are not used
|
|
670
|
-
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
665
|
+
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/marquee?application=axeAPI))
|
|
671
666
|
*/
|
|
672
667
|
marquee: "marquee"
|
|
673
668
|
};
|
|
674
669
|
var semantics = {
|
|
675
670
|
/**
|
|
676
671
|
* - Ensures the order of headings is semantically correct
|
|
677
|
-
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.
|
|
672
|
+
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.7/heading-order?application=axeAPI))
|
|
678
673
|
*/
|
|
679
674
|
headingOrder: "heading-order",
|
|
680
675
|
/**
|
|
681
676
|
* - Ensure that links with the same accessible name serve a similar purpose
|
|
682
|
-
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.
|
|
677
|
+
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.7/identical-links-same-purpose?application=axeAPI))
|
|
683
678
|
*/
|
|
684
679
|
identicalLinksSamePurpose: "identical-links-same-purpose",
|
|
685
680
|
/**
|
|
686
681
|
* - Ensures that elements labelled through their content must have their visible text as part of their accessible name
|
|
687
|
-
* - Elements must have their visible text as part of their accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
682
|
+
* - Elements must have their visible text as part of their accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/label-content-name-mismatch?application=axeAPI))
|
|
688
683
|
*/
|
|
689
684
|
labelContentNameMismatch: "label-content-name-mismatch",
|
|
690
685
|
/**
|
|
691
686
|
* - Ensures the banner landmark is at top level
|
|
692
|
-
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
687
|
+
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-banner-is-top-level?application=axeAPI))
|
|
693
688
|
*/
|
|
694
689
|
landmarkBannerIsTopLevel: "landmark-banner-is-top-level",
|
|
695
690
|
/**
|
|
696
691
|
* - Ensures the complementary landmark or aside is at top level
|
|
697
|
-
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
692
|
+
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-complementary-is-top-level?application=axeAPI))
|
|
698
693
|
*/
|
|
699
694
|
landmarkComplementaryIsTopLevel: "landmark-complementary-is-top-level",
|
|
700
695
|
/**
|
|
701
696
|
* - Ensures the contentinfo landmark is at top level
|
|
702
|
-
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
697
|
+
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-contentinfo-is-top-level?application=axeAPI))
|
|
703
698
|
*/
|
|
704
699
|
landmarkContentinfoIsTopLevel: "landmark-contentinfo-is-top-level",
|
|
705
700
|
/**
|
|
706
701
|
* - Ensures the main landmark is at top level
|
|
707
|
-
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
702
|
+
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-main-is-top-level?application=axeAPI))
|
|
708
703
|
*/
|
|
709
704
|
landmarkMainIsTopLevel: "landmark-main-is-top-level",
|
|
710
705
|
/**
|
|
711
706
|
* - Ensures the document has at most one banner landmark
|
|
712
|
-
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
707
|
+
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-no-duplicate-banner?application=axeAPI))
|
|
713
708
|
*/
|
|
714
709
|
landmarkNoDuplicateBanner: "landmark-no-duplicate-banner",
|
|
715
710
|
/**
|
|
716
711
|
* - Ensures the document has at most one contentinfo landmark
|
|
717
|
-
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
712
|
+
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-no-duplicate-contentinfo?application=axeAPI))
|
|
718
713
|
*/
|
|
719
714
|
landmarkNoDuplicateContentinfo: "landmark-no-duplicate-contentinfo",
|
|
720
715
|
/**
|
|
721
716
|
* - Ensures the document has at most one main landmark
|
|
722
|
-
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
717
|
+
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-no-duplicate-main?application=axeAPI))
|
|
723
718
|
*/
|
|
724
719
|
landmarkNoDuplicateMain: "landmark-no-duplicate-main",
|
|
725
720
|
/**
|
|
726
721
|
* - Ensures the document has a main landmark
|
|
727
|
-
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
722
|
+
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-one-main?application=axeAPI))
|
|
728
723
|
*/
|
|
729
724
|
landmarkOneMain: "landmark-one-main",
|
|
730
725
|
/**
|
|
731
726
|
* - Landmarks should have a unique role or role/label/title (i.e. accessible name) combination
|
|
732
|
-
* - Ensures landmarks are unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
727
|
+
* - Ensures landmarks are unique ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-unique?application=axeAPI))
|
|
733
728
|
*/
|
|
734
729
|
landmarkUnique: "landmark-unique",
|
|
735
730
|
/**
|
|
736
731
|
* - Ensure bold, italic text and font-size is not used to style `<p>` elements as a heading
|
|
737
|
-
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.
|
|
732
|
+
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.7/p-as-heading?application=axeAPI))
|
|
738
733
|
*/
|
|
739
734
|
pAsHeading: "p-as-heading",
|
|
740
735
|
/**
|
|
741
736
|
* - Ensure that the page, or at least one of its frames contains a level-one heading
|
|
742
|
-
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.
|
|
737
|
+
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.7/page-has-heading-one?application=axeAPI))
|
|
743
738
|
*/
|
|
744
739
|
pageHasHeadingOne: "page-has-heading-one"
|
|
745
740
|
};
|
|
746
741
|
var language = {
|
|
747
742
|
/**
|
|
748
743
|
* - Ensures every HTML document has a lang attribute
|
|
749
|
-
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
744
|
+
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.7/html-has-lang?application=axeAPI))
|
|
750
745
|
*/
|
|
751
746
|
htmlHasLang: "html-has-lang",
|
|
752
747
|
/**
|
|
753
748
|
* - Ensures the lang attribute of the `<html>` element has a valid value
|
|
754
|
-
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
749
|
+
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.7/html-lang-valid?application=axeAPI))
|
|
755
750
|
*/
|
|
756
751
|
htmlLangValid: "html-lang-valid",
|
|
757
752
|
/**
|
|
758
753
|
* - Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page
|
|
759
|
-
* - HTML elements with lang and xml:lang must have the same base language ([url](https://dequeuniversity.com/rules/axe/4.
|
|
754
|
+
* - HTML elements with lang and xml:lang must have the same base language ([url](https://dequeuniversity.com/rules/axe/4.7/html-xml-lang-mismatch?application=axeAPI))
|
|
760
755
|
*/
|
|
761
756
|
htmlXmlLangMismatch: "html-xml-lang-mismatch",
|
|
762
757
|
/**
|
|
763
758
|
* - Ensures lang attributes have valid values
|
|
764
|
-
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.
|
|
759
|
+
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.7/valid-lang?application=axeAPI))
|
|
765
760
|
*/
|
|
766
761
|
validLang: "valid-lang"
|
|
767
762
|
};
|
|
768
763
|
var sensoryAndVisualCues = {
|
|
769
764
|
/**
|
|
770
765
|
* - Ensures `<meta name="viewport">` can scale a significant amount
|
|
771
|
-
* - Users should be able to zoom and scale the text up to 500% ([url](https://dequeuniversity.com/rules/axe/4.
|
|
766
|
+
* - Users should be able to zoom and scale the text up to 500% ([url](https://dequeuniversity.com/rules/axe/4.7/meta-viewport-large?application=axeAPI))
|
|
772
767
|
*/
|
|
773
768
|
metaViewportLarge: "meta-viewport-large",
|
|
774
769
|
/**
|
|
775
770
|
* - Ensures `<meta name="viewport">` does not disable text scaling and zooming
|
|
776
|
-
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.
|
|
771
|
+
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.7/meta-viewport?application=axeAPI))
|
|
777
772
|
*/
|
|
778
773
|
metaViewport: "meta-viewport",
|
|
779
774
|
/**
|
|
780
775
|
* - Ensure touch target have sufficient size and space
|
|
781
|
-
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.
|
|
776
|
+
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.7/target-size?application=axeAPI))
|
|
782
777
|
*/
|
|
783
778
|
targetSize: "target-size"
|
|
784
779
|
};
|
|
785
780
|
var tables = {
|
|
786
781
|
/**
|
|
787
782
|
* - Ensures the scope attribute is used correctly on tables
|
|
788
|
-
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
783
|
+
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.7/scope-attr-valid?application=axeAPI))
|
|
789
784
|
*/
|
|
790
785
|
scopeAttrValid: "scope-attr-valid",
|
|
791
786
|
/**
|
|
792
787
|
* - Ensure the `<caption>` element does not contain the same text as the summary attribute
|
|
793
|
-
* - tables should not have the same summary and caption ([url](https://dequeuniversity.com/rules/axe/4.
|
|
788
|
+
* - tables should not have the same summary and caption ([url](https://dequeuniversity.com/rules/axe/4.7/table-duplicate-name?application=axeAPI))
|
|
794
789
|
*/
|
|
795
790
|
tableDuplicateName: "table-duplicate-name",
|
|
796
791
|
/**
|
|
797
792
|
* - Ensure that tables with a caption use the `<caption>` element.
|
|
798
|
-
* - Data or header cells must not be used to give caption to a data table. ([url](https://dequeuniversity.com/rules/axe/4.
|
|
793
|
+
* - Data or header cells must not be used to give caption to a data table. ([url](https://dequeuniversity.com/rules/axe/4.7/table-fake-caption?application=axeAPI))
|
|
799
794
|
*/
|
|
800
795
|
tableFakeCaption: "table-fake-caption",
|
|
801
796
|
/**
|
|
802
797
|
* - Ensure that each non-empty data cell in a `<table>` larger than 3 by 3 has one or more table headers
|
|
803
|
-
* - Non-empty `<td>` elements in larger `<table>` must have an associated table header ([url](https://dequeuniversity.com/rules/axe/4.
|
|
798
|
+
* - Non-empty `<td>` elements in larger `<table>` must have an associated table header ([url](https://dequeuniversity.com/rules/axe/4.7/td-has-header?application=axeAPI))
|
|
804
799
|
*/
|
|
805
800
|
tdHasHeader: "td-has-header",
|
|
806
801
|
/**
|
|
807
802
|
* - Ensure that each cell in a table that uses the headers attribute refers only to other cells in that table
|
|
808
|
-
* - Table cells that use the headers attribute must only refer to cells in the same table ([url](https://dequeuniversity.com/rules/axe/4.
|
|
803
|
+
* - Table cells that use the headers attribute must only refer to cells in the same table ([url](https://dequeuniversity.com/rules/axe/4.7/td-headers-attr?application=axeAPI))
|
|
809
804
|
*/
|
|
810
805
|
tdHeadersAttr: "td-headers-attr",
|
|
811
806
|
/**
|
|
812
807
|
* - Ensure that `<th>` elements and elements with role=columnheader/rowheader have data cells they describe
|
|
813
|
-
* - Table headers in a data table must refer to data cells ([url](https://dequeuniversity.com/rules/axe/4.
|
|
808
|
+
* - Table headers in a data table must refer to data cells ([url](https://dequeuniversity.com/rules/axe/4.7/th-has-data-cells?application=axeAPI))
|
|
814
809
|
*/
|
|
815
810
|
thHasDataCells: "th-has-data-cells"
|
|
816
811
|
};
|
|
817
812
|
|
|
818
|
-
// src/service/html/axe-rules/
|
|
819
|
-
var
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
],
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
],
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
keyboard.frameFocusableContent,
|
|
889
|
-
keyboard.skipLink,
|
|
890
|
-
nameRoleValue.ariaHiddenFocus,
|
|
891
|
-
semantics.labelContentNameMismatch,
|
|
892
|
-
structure.definitionList,
|
|
893
|
-
structure.list,
|
|
894
|
-
tables.tableDuplicateName,
|
|
895
|
-
tables.tableFakeCaption,
|
|
896
|
-
tables.thHasDataCells,
|
|
897
|
-
textAlternatives.documentTitle,
|
|
898
|
-
textAlternatives.frameTitleUnique,
|
|
899
|
-
textAlternatives.frameTitle,
|
|
900
|
-
textAlternatives.videoCaption
|
|
901
|
-
],
|
|
902
|
-
/**
|
|
903
|
-
* These rules can be resolved by changing content in
|
|
904
|
-
* either the node body or its attributes
|
|
905
|
-
*/
|
|
906
|
-
requiresAttrsOrChildren: [
|
|
907
|
-
aria.ariaCommandName,
|
|
908
|
-
aria.ariaDialogName,
|
|
909
|
-
aria.ariaInputFieldName,
|
|
910
|
-
aria.ariaMeterName,
|
|
911
|
-
aria.ariaProgressbarName,
|
|
912
|
-
aria.ariaToggleFieldName,
|
|
913
|
-
aria.ariaTooltipName,
|
|
914
|
-
aria.ariaTreeitemName,
|
|
915
|
-
nameRoleValue.inputButtonName,
|
|
916
|
-
nameRoleValue.linkName
|
|
917
|
-
],
|
|
918
|
-
/**
|
|
919
|
-
* These rules cannot be supported until multiple files
|
|
920
|
-
* are analyzed at once. For now they are ignored.
|
|
921
|
-
*/
|
|
922
|
-
requiresParent: [
|
|
923
|
-
aria.ariaRequiredParent,
|
|
924
|
-
forms.label,
|
|
925
|
-
forms.labelTitleOnly,
|
|
926
|
-
forms.selectName,
|
|
927
|
-
keyboard.bypass,
|
|
928
|
-
keyboard.nestedInteractive,
|
|
929
|
-
keyboard.region,
|
|
930
|
-
semantics.headingOrder,
|
|
931
|
-
semantics.landmarkBannerIsTopLevel,
|
|
932
|
-
semantics.landmarkComplementaryIsTopLevel,
|
|
933
|
-
semantics.landmarkContentinfoIsTopLevel,
|
|
934
|
-
semantics.landmarkMainIsTopLevel,
|
|
935
|
-
semantics.landmarkOneMain,
|
|
936
|
-
semantics.pageHasHeadingOne,
|
|
937
|
-
structure.dlitem,
|
|
938
|
-
structure.listitem,
|
|
939
|
-
tables.tdHasHeader,
|
|
940
|
-
tables.tdHeadersAttr
|
|
941
|
-
],
|
|
942
|
-
/**
|
|
943
|
-
* These rules should not be enforced to all users of
|
|
944
|
-
* the official Marko language server.
|
|
945
|
-
*/
|
|
946
|
-
blacklist: [structure.frameTested],
|
|
947
|
-
/**
|
|
948
|
-
* These are rules that cannot currently be validated, either
|
|
949
|
-
* because of limitations with JSDom + axe-core or with the
|
|
950
|
-
* current implementation of the language server.
|
|
951
|
-
*/
|
|
952
|
-
cannotValidate: [
|
|
953
|
-
parsing.duplicateIdAria,
|
|
954
|
-
keyboard.scrollableRegionFocusable,
|
|
955
|
-
semantics.pAsHeading,
|
|
956
|
-
structure.avoidInlineSpacing,
|
|
957
|
-
structure.cssOrientationLock,
|
|
958
|
-
structure.hiddenContent,
|
|
959
|
-
sensoryAndVisualCues.targetSize
|
|
960
|
-
]
|
|
813
|
+
// src/service/html/axe-rules/rule-exceptions.ts
|
|
814
|
+
var ruleExceptions = {
|
|
815
|
+
[aria.ariaAllowedAttr]: {},
|
|
816
|
+
[aria.ariaAllowedRole]: { dynamicAttrs: ["role"] },
|
|
817
|
+
[aria.ariaCommandName]: { unknownBody: true, attrSpread: true },
|
|
818
|
+
[aria.ariaDialogName]: { unknownBody: true, attrSpread: true },
|
|
819
|
+
[aria.ariaHiddenBody]: {},
|
|
820
|
+
[aria.ariaInputFieldName]: { unknownBody: true, attrSpread: true },
|
|
821
|
+
[aria.ariaMeterName]: { unknownBody: true, attrSpread: true },
|
|
822
|
+
[aria.ariaProgressbarName]: { unknownBody: true, attrSpread: true },
|
|
823
|
+
[aria.ariaRequiredAttr]: { attrSpread: true },
|
|
824
|
+
[aria.ariaRequiredChildren]: { unknownBody: true },
|
|
825
|
+
[aria.ariaRoles]: { dynamicAttrs: ["role"] },
|
|
826
|
+
[aria.ariaText]: { unknownBody: true },
|
|
827
|
+
[aria.ariaToggleFieldName]: { unknownBody: true, attrSpread: true },
|
|
828
|
+
[aria.ariaTooltipName]: { unknownBody: true, attrSpread: true },
|
|
829
|
+
[aria.ariaTreeitemName]: { unknownBody: true, attrSpread: true },
|
|
830
|
+
[aria.presentationRoleConflict]: {},
|
|
831
|
+
[forms.autocompleteValid]: {},
|
|
832
|
+
[forms.formFieldMultipleLabels]: {},
|
|
833
|
+
[keyboard.accesskeys]: {},
|
|
834
|
+
[keyboard.focusOrderSemantics]: {},
|
|
835
|
+
[keyboard.frameFocusableContent]: { unknownBody: true },
|
|
836
|
+
[keyboard.skipLink]: { unknownBody: true },
|
|
837
|
+
[keyboard.tabindex]: {},
|
|
838
|
+
[language.htmlHasLang]: { attrSpread: true },
|
|
839
|
+
[language.htmlLangValid]: { dynamicAttrs: ["lang"] },
|
|
840
|
+
[language.htmlXmlLangMismatch]: {},
|
|
841
|
+
[language.validLang]: { dynamicAttrs: ["lang"] },
|
|
842
|
+
[nameRoleValue.ariaHiddenFocus]: { unknownBody: true },
|
|
843
|
+
[nameRoleValue.buttonName]: { unknownBody: true, attrSpread: true },
|
|
844
|
+
[nameRoleValue.emptyHeading]: {},
|
|
845
|
+
[nameRoleValue.emptyTableHeader]: { unknownBody: true },
|
|
846
|
+
[nameRoleValue.inputButtonName]: {
|
|
847
|
+
unknownBody: true,
|
|
848
|
+
attrSpread: true
|
|
849
|
+
},
|
|
850
|
+
[nameRoleValue.linkName]: { unknownBody: true, attrSpread: true },
|
|
851
|
+
[parsing.marquee]: {},
|
|
852
|
+
[semantics.identicalLinksSamePurpose]: {},
|
|
853
|
+
[semantics.labelContentNameMismatch]: { unknownBody: true },
|
|
854
|
+
[semantics.landmarkNoDuplicateBanner]: {},
|
|
855
|
+
[semantics.landmarkNoDuplicateContentinfo]: {},
|
|
856
|
+
[semantics.landmarkNoDuplicateMain]: {},
|
|
857
|
+
[semantics.landmarkUnique]: {},
|
|
858
|
+
[sensoryAndVisualCues.metaViewport]: {},
|
|
859
|
+
[sensoryAndVisualCues.metaViewportLarge]: {},
|
|
860
|
+
[structure.definitionList]: { unknownBody: true },
|
|
861
|
+
[structure.list]: { unknownBody: true },
|
|
862
|
+
[tables.scopeAttrValid]: {},
|
|
863
|
+
[tables.tableDuplicateName]: { unknownBody: true },
|
|
864
|
+
[tables.tableFakeCaption]: { unknownBody: true },
|
|
865
|
+
[tables.thHasDataCells]: { unknownBody: true },
|
|
866
|
+
[textAlternatives.areaAlt]: { attrSpread: true },
|
|
867
|
+
[textAlternatives.documentTitle]: { unknownBody: true },
|
|
868
|
+
[textAlternatives.frameTitle]: { unknownBody: true },
|
|
869
|
+
[textAlternatives.frameTitleUnique]: { unknownBody: true },
|
|
870
|
+
[textAlternatives.imageAlt]: { attrSpread: true },
|
|
871
|
+
[textAlternatives.imageRedundantAlt]: { attrSpread: true },
|
|
872
|
+
[textAlternatives.inputImageAlt]: { attrSpread: true },
|
|
873
|
+
[textAlternatives.objectAlt]: { attrSpread: true },
|
|
874
|
+
[textAlternatives.roleImgAlt]: { attrSpread: true },
|
|
875
|
+
[textAlternatives.serverSideImageMap]: {},
|
|
876
|
+
[textAlternatives.svgImgAlt]: { attrSpread: true },
|
|
877
|
+
[textAlternatives.videoCaption]: { unknownBody: true },
|
|
878
|
+
[timeAndMedia.audioCaption]: { unknownBody: true },
|
|
879
|
+
[timeAndMedia.blink]: {},
|
|
880
|
+
[timeAndMedia.metaRefresh]: {},
|
|
881
|
+
[timeAndMedia.metaRefreshNoExceptions]: {},
|
|
882
|
+
[timeAndMedia.noAutoplayAudio]: {}
|
|
961
883
|
};
|
|
962
|
-
var separated_rules_default = rules;
|
|
963
884
|
|
|
964
885
|
// src/service/html/index.ts
|
|
965
886
|
var extractCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -993,32 +914,22 @@ var HTMLService = {
|
|
|
993
914
|
({ nodes, id }) => nodes.map((node) => ({ ...node, ruleId: id }))
|
|
994
915
|
);
|
|
995
916
|
const release = await acquireMutexLock();
|
|
996
|
-
const violations = await getViolationNodes(
|
|
997
|
-
const requiresAttrs = await getViolationNodes(separated_rules_default.requiresAttrs);
|
|
998
|
-
const requiresChildren = await getViolationNodes(separated_rules_default.requiresChildren);
|
|
999
|
-
const requiresAttrsOrChildren = await getViolationNodes(
|
|
1000
|
-
separated_rules_default.requiresAttrsOrChildren
|
|
1001
|
-
);
|
|
917
|
+
const violations = await getViolationNodes(Object.keys(ruleExceptions));
|
|
1002
918
|
release();
|
|
1003
|
-
violations.push(
|
|
1004
|
-
...requiresAttrs.filter(
|
|
1005
|
-
({ element }) => (element == null ? void 0 : element.dataset.markoNodeId) && !nodeDetails[element.dataset.markoNodeId].hasDynamicAttrs
|
|
1006
|
-
)
|
|
1007
|
-
);
|
|
1008
|
-
violations.push(
|
|
1009
|
-
...requiresChildren.filter(
|
|
1010
|
-
({ element }) => (element == null ? void 0 : element.dataset.markoNodeId) && !nodeDetails[element.dataset.markoNodeId].hasDynamicBody
|
|
1011
|
-
)
|
|
1012
|
-
);
|
|
1013
|
-
violations.push(
|
|
1014
|
-
...requiresAttrsOrChildren.filter(
|
|
1015
|
-
({ element }) => (element == null ? void 0 : element.dataset.markoNodeId) && !nodeDetails[element.dataset.markoNodeId].hasDynamicAttrs && !nodeDetails[element.dataset.markoNodeId].hasDynamicBody
|
|
1016
|
-
)
|
|
1017
|
-
);
|
|
1018
919
|
return violations.flatMap((result) => {
|
|
920
|
+
var _a;
|
|
1019
921
|
const { element } = result;
|
|
1020
922
|
if (!element)
|
|
1021
923
|
return [];
|
|
924
|
+
const ruleId = result.ruleId;
|
|
925
|
+
if (element.dataset.markoNodeId) {
|
|
926
|
+
const details = nodeDetails[element.dataset.markoNodeId];
|
|
927
|
+
if (ruleExceptions[ruleId].attrSpread && details.hasDynamicAttrs || ruleExceptions[ruleId].unknownBody && details.hasDynamicBody || ((_a = ruleExceptions[ruleId].dynamicAttrs) == null ? void 0 : _a.some(
|
|
928
|
+
(attr) => element.getAttribute(attr) === "dynamic"
|
|
929
|
+
))) {
|
|
930
|
+
return [];
|
|
931
|
+
}
|
|
932
|
+
}
|
|
1022
933
|
const generatedLoc = jsdom.nodeLocation(element);
|
|
1023
934
|
if (!generatedLoc)
|
|
1024
935
|
return [];
|
|
@@ -1032,7 +943,7 @@ var HTMLService = {
|
|
|
1032
943
|
{
|
|
1033
944
|
range: sourceRange,
|
|
1034
945
|
severity: 3,
|
|
1035
|
-
source: `axe-core(${
|
|
946
|
+
source: `axe-core(${ruleId})`,
|
|
1036
947
|
message: result.failureSummary ?? "unknown accessibility issue"
|
|
1037
948
|
}
|
|
1038
949
|
];
|
|
@@ -1168,7 +1079,7 @@ function isExternalModule(file) {
|
|
|
1168
1079
|
}
|
|
1169
1080
|
|
|
1170
1081
|
// src/service/marko/complete/AttrValue.ts
|
|
1171
|
-
import
|
|
1082
|
+
import path3 from "path";
|
|
1172
1083
|
import {
|
|
1173
1084
|
CompletionItemKind as CompletionItemKind2,
|
|
1174
1085
|
TextEdit as TextEdit2
|
|
@@ -1281,7 +1192,7 @@ async function AttrValue({
|
|
|
1281
1192
|
const resolved = resolveUrl(req, uri);
|
|
1282
1193
|
if (resolved) {
|
|
1283
1194
|
const result = [];
|
|
1284
|
-
const curFile = req === "." ?
|
|
1195
|
+
const curFile = req === "." ? path3.basename(uri) : void 0;
|
|
1285
1196
|
const replaceRange = parsed.locationAt({
|
|
1286
1197
|
start: start + segmentStart + 1,
|
|
1287
1198
|
end: start + rawValue.length
|
|
@@ -1314,7 +1225,7 @@ async function AttrValue({
|
|
|
1314
1225
|
import { TextEdit as TextEdit4 } from "vscode-languageserver";
|
|
1315
1226
|
|
|
1316
1227
|
// src/service/marko/util/get-tag-name-completion.ts
|
|
1317
|
-
import
|
|
1228
|
+
import path4 from "path";
|
|
1318
1229
|
import {
|
|
1319
1230
|
CompletionItemKind as CompletionItemKind3,
|
|
1320
1231
|
CompletionItemTag,
|
|
@@ -1343,7 +1254,7 @@ function getTagNameCompletion({
|
|
|
1343
1254
|
kind: MarkupKind2.Markdown,
|
|
1344
1255
|
value: tag.html ? `Built in [<${tag.name}>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/${tag.name}) HTML tag.` : isCoreTag ? `Core Marko <${tag.name}> tag.` : nodeModuleName ? `Custom Marko tag discovered from the ["${nodeModuleName}"](${fileURIForTag}) npm package.` : `Custom Marko tag discovered from:
|
|
1345
1256
|
|
|
1346
|
-
[${importer ?
|
|
1257
|
+
[${importer ? path4.relative(importer, fileForTag) : fileForTag}](${fileURIForTag})`
|
|
1347
1258
|
};
|
|
1348
1259
|
if (tag.description) {
|
|
1349
1260
|
documentation.value += `
|
|
@@ -1533,8 +1444,8 @@ var doComplete = async (doc, params) => {
|
|
|
1533
1444
|
};
|
|
1534
1445
|
|
|
1535
1446
|
// src/service/marko/validate.ts
|
|
1536
|
-
import
|
|
1537
|
-
import { Project as
|
|
1447
|
+
import path5 from "path";
|
|
1448
|
+
import { Project as Project3 } from "@marko/language-tools";
|
|
1538
1449
|
import { DiagnosticSeverity } from "vscode-languageserver";
|
|
1539
1450
|
import { DiagnosticType } from "@marko/babel-utils";
|
|
1540
1451
|
var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
|
|
@@ -1542,8 +1453,8 @@ var doValidate = (doc) => {
|
|
|
1542
1453
|
const filename = getFSPath(doc);
|
|
1543
1454
|
const diagnostics = [];
|
|
1544
1455
|
try {
|
|
1545
|
-
const { meta } =
|
|
1546
|
-
filename &&
|
|
1456
|
+
const { meta } = Project3.getCompiler(
|
|
1457
|
+
filename && path5.dirname(filename)
|
|
1547
1458
|
).compileSync(doc.getText(), filename || "untitled.marko", {
|
|
1548
1459
|
code: false,
|
|
1549
1460
|
output: "migrate",
|
|
@@ -1800,7 +1711,7 @@ function AttrName2({
|
|
|
1800
1711
|
|
|
1801
1712
|
// src/service/marko/definition/OpenTagName.ts
|
|
1802
1713
|
import fs4 from "fs";
|
|
1803
|
-
import
|
|
1714
|
+
import path6 from "path";
|
|
1804
1715
|
import { URI as URI5 } from "vscode-uri";
|
|
1805
1716
|
import {
|
|
1806
1717
|
NodeType as NodeType5,
|
|
@@ -1826,7 +1737,7 @@ function OpenTagName3({
|
|
|
1826
1737
|
return;
|
|
1827
1738
|
}
|
|
1828
1739
|
const tagEntryFile = tagDef.template || tagDef.renderer || tagDef.filePath;
|
|
1829
|
-
if (!
|
|
1740
|
+
if (!path6.isAbsolute(tagEntryFile)) {
|
|
1830
1741
|
return;
|
|
1831
1742
|
}
|
|
1832
1743
|
if (/\/marko(?:-tag)?\.json$/.test(tagEntryFile)) {
|
|
@@ -1995,7 +1906,7 @@ function extractDocumentSymbols({
|
|
|
1995
1906
|
import { TextEdit as TextEdit6 } from "vscode-languageserver";
|
|
1996
1907
|
import * as prettier from "prettier";
|
|
1997
1908
|
import * as markoPrettier from "prettier-plugin-marko";
|
|
1998
|
-
import { Project as
|
|
1909
|
+
import { Project as Project4 } from "@marko/language-tools";
|
|
1999
1910
|
var format2 = async (doc, params, cancel) => {
|
|
2000
1911
|
try {
|
|
2001
1912
|
const dir = getFSDir(doc);
|
|
@@ -2013,14 +1924,14 @@ var format2 = async (doc, params, cancel) => {
|
|
|
2013
1924
|
};
|
|
2014
1925
|
if (cancel.isCancellationRequested)
|
|
2015
1926
|
return;
|
|
2016
|
-
markoPrettier.setCompiler(
|
|
1927
|
+
markoPrettier.setCompiler(Project4.getCompiler(dir), Project4.getConfig(dir));
|
|
2017
1928
|
const ret = [
|
|
2018
1929
|
TextEdit6.replace(
|
|
2019
1930
|
{
|
|
2020
1931
|
start: START_POSITION,
|
|
2021
1932
|
end: doc.positionAt(text.length)
|
|
2022
1933
|
},
|
|
2023
|
-
prettier.format(text, options)
|
|
1934
|
+
await prettier.format(text, options)
|
|
2024
1935
|
)
|
|
2025
1936
|
];
|
|
2026
1937
|
return ret;
|
|
@@ -2041,7 +1952,7 @@ var marko_default = {
|
|
|
2041
1952
|
};
|
|
2042
1953
|
|
|
2043
1954
|
// src/service/script/index.ts
|
|
2044
|
-
import
|
|
1955
|
+
import path8 from "path";
|
|
2045
1956
|
import { relativeImportPath } from "relative-import-path";
|
|
2046
1957
|
import ts from "typescript/lib/tsserverlibrary";
|
|
2047
1958
|
import {
|
|
@@ -2061,26 +1972,14 @@ import {
|
|
|
2061
1972
|
} from "@marko/language-tools";
|
|
2062
1973
|
|
|
2063
1974
|
// src/ts-plugin/host.ts
|
|
2064
|
-
import
|
|
2065
|
-
import * as defaultCompiler from "@marko/compiler";
|
|
2066
|
-
import defaultConfig from "@marko/compiler/config";
|
|
2067
|
-
import * as defaultTranslator from "@marko/translator-default";
|
|
1975
|
+
import path7 from "path";
|
|
2068
1976
|
import {
|
|
2069
1977
|
Processors,
|
|
2070
|
-
Project as Project4,
|
|
2071
1978
|
getExt,
|
|
2072
1979
|
isDefinitionFile
|
|
2073
1980
|
} from "@marko/language-tools";
|
|
2074
1981
|
var fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
|
|
2075
1982
|
var modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
|
|
2076
|
-
Project4.setDefaultTypePaths({
|
|
2077
|
-
internalTypesFile: path6.join(__dirname, "marko.internal.d.ts"),
|
|
2078
|
-
markoTypesFile: path6.join(__dirname, "marko.runtime.d.ts")
|
|
2079
|
-
});
|
|
2080
|
-
Project4.setDefaultCompilerMeta(defaultCompiler, {
|
|
2081
|
-
...defaultConfig,
|
|
2082
|
-
translator: defaultTranslator
|
|
2083
|
-
});
|
|
2084
1983
|
function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
2085
1984
|
var _a, _b, _c;
|
|
2086
1985
|
const processors = Processors.create({
|
|
@@ -2147,9 +2046,9 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2147
2046
|
}
|
|
2148
2047
|
const readDirectory2 = (_b = host.readDirectory) == null ? void 0 : _b.bind(host);
|
|
2149
2048
|
if (readDirectory2) {
|
|
2150
|
-
host.readDirectory = (
|
|
2049
|
+
host.readDirectory = (path9, extensions, exclude, include, depth) => {
|
|
2151
2050
|
return readDirectory2(
|
|
2152
|
-
|
|
2051
|
+
path9,
|
|
2153
2052
|
extensions == null ? void 0 : extensions.concat(Processors.extensions),
|
|
2154
2053
|
exclude,
|
|
2155
2054
|
include,
|
|
@@ -2169,7 +2068,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2169
2068
|
if (processor) {
|
|
2170
2069
|
let resolvedFileName;
|
|
2171
2070
|
if (fsPathReg.test(moduleName)) {
|
|
2172
|
-
resolvedFileName =
|
|
2071
|
+
resolvedFileName = path7.resolve(containingFile, "..", moduleName);
|
|
2173
2072
|
} else {
|
|
2174
2073
|
const [, nodeModuleName, relativeModulePath] = modulePartsReg.exec(moduleName);
|
|
2175
2074
|
const { resolvedModule } = ts2.nodeModuleNameResolver(
|
|
@@ -2181,7 +2080,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2181
2080
|
redirectedReference
|
|
2182
2081
|
);
|
|
2183
2082
|
if (resolvedModule) {
|
|
2184
|
-
resolvedFileName =
|
|
2083
|
+
resolvedFileName = path7.join(
|
|
2185
2084
|
resolvedModule.resolvedFileName,
|
|
2186
2085
|
"..",
|
|
2187
2086
|
relativeModulePath
|
|
@@ -2529,7 +2428,7 @@ var ScriptService = {
|
|
|
2529
2428
|
let source = completion.source;
|
|
2530
2429
|
if (source && completion.hasAction) {
|
|
2531
2430
|
if (source[0] === ".") {
|
|
2532
|
-
source =
|
|
2431
|
+
source = path8.resolve(fileName, "..", source);
|
|
2533
2432
|
}
|
|
2534
2433
|
detail = relativeImportPath(fileName, source);
|
|
2535
2434
|
sortText = `\uFFFF${sortText}`;
|
|
@@ -2894,7 +2793,7 @@ function docLocationAtTextSpan(doc, { start, length }) {
|
|
|
2894
2793
|
}
|
|
2895
2794
|
function getTSConfigFile(fileName) {
|
|
2896
2795
|
let configFile;
|
|
2897
|
-
const docFsDir =
|
|
2796
|
+
const docFsDir = path8.dirname(fileName);
|
|
2898
2797
|
const cache = Project5.getCache(docFsDir);
|
|
2899
2798
|
let configFileCache = cache.get(getTSConfigFile);
|
|
2900
2799
|
if (configFileCache) {
|
|
@@ -2919,7 +2818,7 @@ function getTSProject(docFsPath) {
|
|
|
2919
2818
|
markoScriptLang = ScriptLang.ts;
|
|
2920
2819
|
}
|
|
2921
2820
|
}
|
|
2922
|
-
const rootDir = configFile &&
|
|
2821
|
+
const rootDir = configFile && path8.dirname(configFile) || process.cwd();
|
|
2923
2822
|
const cache = Project5.getCache(configFile && rootDir);
|
|
2924
2823
|
let projectCache = cache.get(getTSProject);
|
|
2925
2824
|
let cached;
|
|
@@ -2945,8 +2844,8 @@ function getTSProject(docFsPath) {
|
|
|
2945
2844
|
fileNames.filter((file) => /\.[cm]?ts$/.test(file))
|
|
2946
2845
|
);
|
|
2947
2846
|
const tsPkgFile = configFile && ((_a = ts.resolveModuleName("typescript/package.json", configFile, options, ts.sys).resolvedModule) == null ? void 0 : _a.resolvedFileName);
|
|
2948
|
-
const defaultLibFile =
|
|
2949
|
-
tsPkgFile ?
|
|
2847
|
+
const defaultLibFile = path8.join(
|
|
2848
|
+
tsPkgFile ? path8.join(tsPkgFile, "../lib") : __dirname,
|
|
2950
2849
|
ts.getDefaultLibFileName(options)
|
|
2951
2850
|
);
|
|
2952
2851
|
const resolutionCache = ts.createModuleResolutionCache(
|
|
@@ -3017,7 +2916,7 @@ function getTSProject(docFsPath) {
|
|
|
3017
2916
|
return `${((_a2 = get(filenameToURI(filename))) == null ? void 0 : _a2.version) ?? -1}`;
|
|
3018
2917
|
},
|
|
3019
2918
|
getScriptKind(filename) {
|
|
3020
|
-
switch (
|
|
2919
|
+
switch (path8.extname(filename)) {
|
|
3021
2920
|
case ts.Extension.Js:
|
|
3022
2921
|
case ts.Extension.Cjs:
|
|
3023
2922
|
case ts.Extension.Mjs:
|
|
@@ -3704,10 +3603,12 @@ var service = {
|
|
|
3704
3603
|
},
|
|
3705
3604
|
async findDocumentSymbols(doc, params, cancel) {
|
|
3706
3605
|
const results = await Promise.allSettled(
|
|
3707
|
-
plugins.map(
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3606
|
+
plugins.map(
|
|
3607
|
+
(plugin) => {
|
|
3608
|
+
var _a;
|
|
3609
|
+
return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3610
|
+
}
|
|
3611
|
+
)
|
|
3711
3612
|
);
|
|
3712
3613
|
if (cancel.isCancellationRequested)
|
|
3713
3614
|
return;
|